Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update functions.lib.php #28678

Closed
wants to merge 1 commit into from
Closed

Conversation

bos4711
Copy link
Contributor

@bos4711 bos4711 commented Mar 7, 2024

Fix #20209

When using multiple languages Dolibarr sometimes switches languages depending on settings. By not loading the "main.lang" file, the proper date formats will not be used and this leads to inconsistency.

@@ -2987,6 +2987,9 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
$format = 'daytextshort';
}

// Make sure the format strings are loaded/updated (#20209)
$outputlangs->load("main");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dol_print_date is a low level memory function called a lot of time.
We should not have instruction into it that make IO like loading file from disk.
The main language file should be loaded by the caller that has initialized the $outputlangs object.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I just found a better solution and will make new PR.

@eldy eldy added the PR not qualified PR is not qualified (feature not enough requested, duplicate feature or other reason) label Mar 7, 2024
@eldy eldy closed this Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR not qualified PR is not qualified (feature not enough requested, duplicate feature or other reason)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

__DATE_DUE_YMD__ always give date format %d/%m/%Y no matter what main.lang defines it as
2 participants