Fix warning on date

This commit is contained in:
ldestailleur
2025-02-16 14:23:16 +01:00
parent 75590f1f09
commit cb18bebb87
3 changed files with 9 additions and 7 deletions

View File

@@ -10059,9 +10059,9 @@ abstract class CommonObject
/**
* Create object in the database
*
* @param User $user User that creates
* @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers
* @return int<-1,max> Return integer <0 if KO, Id of created object if OK
* @param User $user User that creates
* @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers
* @return int<-1,max> Return integer <0 if KO, Id of created object if OK
*/
public function createCommon(User $user, $notrigger = 0)
{
@@ -10080,6 +10080,7 @@ abstract class CommonObject
if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) {
$fieldvalues['date_creation'] = $this->db->idate($now);
}
// For backward compatibility, if a property ->fk_user_creat exists and not filled.
if (array_key_exists('fk_user_creat', $fieldvalues) && !($fieldvalues['fk_user_creat'] > 0)) {
$fieldvalues['fk_user_creat'] = $user->id;
$this->fk_user_creat = $user->id;

View File

@@ -139,7 +139,7 @@ class Task extends CommonObjectLine
public $timespent_old_duration;
public $timespent_date;
public $timespent_datehour; // More accurate start date (same than timespent_date but includes hours, minutes and seconds)
public $timespent_withhour; // 1 = we entered also start hours for timesheet line
public $timespent_withhour; // 0 or 1 = we have entered also start hours for timesheet line
public $timespent_fk_user;
public $timespent_thm;
public $timespent_note;
@@ -1467,10 +1467,9 @@ class Task extends CommonObjectLine
$timespent->fk_user = $this->timespent_fk_user;
$timespent->fk_product = $this->timespent_fk_product;
$timespent->note = $this->timespent_note;
$timespent->datec = $this->db->idate($now);
$timespent->datec = $now;
$result = $timespent->create($user);
if ($result > 0) {
$ret = $result;
$this->timespent_id = $result;

View File

@@ -175,7 +175,6 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_year = '';
$search_note = '';
$search_duration = '';
$search_value = '';
$search_date_startday = '';
$search_date_startmonth = '';
$search_date_startyear = '';
@@ -249,6 +248,7 @@ if ($action == 'addtimespent' && $user->hasRight('projet', 'time')) {
$object->timespent_withhour = 1;
} else {
$object->timespent_date = dol_mktime(12, 0, 0, GETPOSTINT("timemonth"), GETPOSTINT("timeday"), GETPOSTINT("timeyear"));
$object->timespent_withhour = 0;
}
$object->timespent_fk_user = GETPOSTINT("userid");
$object->timespent_fk_product = GETPOSTINT("fk_product");
@@ -299,6 +299,7 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us
$object->timespent_withhour = 1;
} else {
$object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear"));
$object->timespent_withhour = 0;
}
$object->timespent_fk_user = GETPOSTINT("userid_line");
$object->timespent_fk_product = GETPOSTINT("fk_product");
@@ -328,6 +329,7 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$cancel && $us
$object->timespent_withhour = 1;
} else {
$object->timespent_date = dol_mktime(12, 0, 0, GETPOSTINT("timelinemonth"), GETPOSTINT("timelineday"), GETPOSTINT("timelineyear"));
$object->timespent_withhour = 0;
}
$object->timespent_fk_user = GETPOSTINT("userid_line");
$object->timespent_fk_product = GETPOSTINT("fk_product");