diff --git a/htdocs/core/datepicker.php b/htdocs/core/datepicker.php
index 7c5c4898fce..9c584c2ef6e 100644
--- a/htdocs/core/datepicker.php
+++ b/htdocs/core/datepicker.php
@@ -27,7 +27,7 @@
*/
if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
-if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
+//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
@@ -186,27 +186,13 @@ function displayBox($selectedDate,$month,$year)
global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1;
- if($startday==1)
- {?>
- | trans("ShortMonday") ?> |
- trans("ShortTuesday") ?> |
- trans("ShortWednesday") ?> |
- trans("ShortThursday") ?> |
- trans("ShortFriday") ?> |
- trans("ShortSaturday") ?> |
- trans("ShortSunday") ?> |
-
- trans("ShortSunday") ?> |
- trans("ShortMonday") ?> |
- trans("ShortTuesday") ?> |
- trans("ShortWednesday") ?> |
- trans("ShortThursday") ?> |
- trans("ShortFriday") ?> |
- trans("ShortSaturday") ?> |
-
+ $first_day_of_week = isset($conf->global->MAIN_START_WEEK) ? (int) $conf->global->MAIN_START_WEEK : 0;
+ $day_names = array('ShortSunday', 'ShortMonday', 'ShortTuesday', 'ShortWednesday', 'ShortThursday', 'ShortFriday', 'ShortSaturday');
+ for( $i=0; $i < 7; $i++ )
+ {
+ echo '', $langs->trans($day_names[($i + $first_day_of_week) % 7]), ' | ', "\n";
+ }
+ ?>
";
$cols=0;
- for($i=0;$i< $mydate["wday"];$i++)
+ for($i=0;$i< ($mydate["wday"]+7-$first_day_of_week)%7;$i++)
{
echo " | ";
$cols++;
@@ -230,7 +216,7 @@ function displayBox($selectedDate,$month,$year)
}
else
{
- if ($mydate["wday"]==0)
+ if ($mydate["wday"]==$first_day_of_week)
{
echo "";
$cols=0;
@@ -254,7 +240,7 @@ function displayBox($selectedDate,$month,$year)
echo ">".sprintf("%02s",$mydate["mday"])."";
$cols++;
- if ($mydate["wday"]==6) echo "
\n";
+ if ($mydate != $firstdate && $mydate["wday"]==(($first_day_of_week + 6)%7)) echo "\n";
//$thedate=strtotime("tomorrow",$thedate);
$day++;