diff --git a/html/ajax.php b/html/ajax.php
index 4219a4cda..76bb6a257 100644
--- a/html/ajax.php
+++ b/html/ajax.php
@@ -28,6 +28,7 @@ $cn=Dossier::connect();
$g_parameter=new Noalyss_Parameter_Folder($cn);
$g_user=new User($cn);
$g_user->check(true);
+IDate::set_firstDate($g_user->get_first_week_day());
set_language();
/* if a code has been asked */
if (isset($_REQUEST['plugin_code']) )
diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index a1dfd697c..f0cd81541 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -94,6 +94,8 @@ else
$g_user->check(true);
}
+IDate::set_firstDate($g_user->get_first_week_day());
+
// For progress bar, for saving time , we check and answer directly
if ($op == "progressBar") {
$task_id=$http->request("task_id");
diff --git a/html/do.php b/html/do.php
index 47f180f21..2b677236c 100644
--- a/html/do.php
+++ b/html/do.php
@@ -56,9 +56,7 @@ $cn = Dossier::connect();
global $g_user, $cn,$g_parameter,$http;
$g_user = new User($cn);
$http=new HttpInput();
-if ( ! defined("FIRST_WEEK_DAY")) {
- define ("FIRST_WEEK_DAY",$g_user->get_first_week_day());
-}
+IDate::set_firstDate($g_user->get_first_week_day());
/*
* check that the database is not empty
*/
diff --git a/include/lib/idate.class.php b/include/lib/idate.class.php
index 805041b0f..8eab4fdbc 100644
--- a/include/lib/idate.class.php
+++ b/include/lib/idate.class.php
@@ -37,7 +37,7 @@ class IDate extends HtmlInput
var $placeholder;
var $title;
var $autofocus;
- var $firstDate; //extra="";
$this->style=' class="input_text" ';
$this->autofocus=false;
- $this->firstDate=(defined("FIRST_WEEK_DAY"))?FIRST_WEEK_DAY:0;
}
/**
* @return string
@@ -108,20 +107,18 @@ class IDate extends HtmlInput
*/
public function get_firstDate()
{
- return $this->firstDate;
- return $this;
+ return self::$firstDate;
}
/**
* @param mixed $firstDate
*/
- public function set_firstDate($firstDate)
+ static function set_firstDate($firstDate)
{
if (isNumber($firstDate)==0){
throw new Exception("IDATE1: invalide data");
}
- $this->firstDate = $firstDate;
- return $this;
+ self::$firstDate= $firstDate;
}
@@ -165,7 +162,7 @@ class IDate extends HtmlInput
'
,$this->id,
$this->id,
- $this->firstDate);
+ self::$firstDate);
return $r;
}