Fix update tms

This commit is contained in:
Laurent Destailleur 2017-07-20 18:36:18 +02:00
parent 7760594643
commit dfb49fc47b
2 changed files with 8 additions and 8 deletions

View File

@ -208,7 +208,7 @@ class Website extends CommonObject
$sql .= " t.fk_user_create,"; $sql .= " t.fk_user_create,";
$sql .= " t.fk_user_modif,"; $sql .= " t.fk_user_modif,";
$sql .= " t.date_creation,"; $sql .= " t.date_creation,";
$sql .= " t.tms"; $sql .= " t.tms as date_modification";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
if (null !== $ref) { if (null !== $ref) {
$sql .= " WHERE t.ref = '" . $this->db->escape($ref) . "'"; $sql .= " WHERE t.ref = '" . $this->db->escape($ref) . "'";
@ -233,7 +233,7 @@ class Website extends CommonObject
$this->fk_user_create = $obj->fk_user_create; $this->fk_user_create = $obj->fk_user_create;
$this->fk_user_modif = $obj->fk_user_modif; $this->fk_user_modif = $obj->fk_user_modif;
$this->date_creation = $this->db->jdate($obj->date_creation); $this->date_creation = $this->db->jdate($obj->date_creation);
$this->tms = $this->db->jdate($obj->tms); $this->date_modification = $this->db->jdate($obj->date_modification);
} }
$this->db->free($resql); $this->db->free($resql);
@ -277,7 +277,7 @@ class Website extends CommonObject
$sql .= " t.fk_user_create,"; $sql .= " t.fk_user_create,";
$sql .= " t.fk_user_modif,"; $sql .= " t.fk_user_modif,";
$sql .= " t.date_creation,"; $sql .= " t.date_creation,";
$sql .= " t.tms"; $sql .= " t.tms as date_modification";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
// Manage filter // Manage filter
@ -317,7 +317,7 @@ class Website extends CommonObject
$this->fk_user_create = $obj->fk_user_create; $this->fk_user_create = $obj->fk_user_create;
$this->fk_user_modif = $obj->fk_user_modif; $this->fk_user_modif = $obj->fk_user_modif;
$line->date_creation = $this->db->jdate($obj->date_creation); $line->date_creation = $this->db->jdate($obj->date_creation);
$line->tms = $this->db->jdate($obj->tms); $line->date_modification = $this->db->jdate($obj->date_modification);
$this->records[$line->id] = $line; $this->records[$line->id] = $line;
} }
@ -373,8 +373,8 @@ class Website extends CommonObject
$sql .= ' fk_default_home = '.(($this->fk_default_home > 0)?$this->fk_default_home:"null").','; $sql .= ' fk_default_home = '.(($this->fk_default_home > 0)?$this->fk_default_home:"null").',';
$sql .= ' virtualhost = '.(($this->virtualhost != '')?"'".$this->db->escape($this->virtualhost)."'":"null").','; $sql .= ' virtualhost = '.(($this->virtualhost != '')?"'".$this->db->escape($this->virtualhost)."'":"null").',';
$sql .= ' fk_user_modif = '.(! isset($this->fk_user_modif) ? $user->id : $this->fk_user_modif).','; $sql .= ' fk_user_modif = '.(! isset($this->fk_user_modif) ? $user->id : $this->fk_user_modif).',';
$sql .= ' date_creation = '.(! isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').','; $sql .= ' date_creation = '.(! isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null');
$sql .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'"); $sql .= ', tms = '.(dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : "'".$this->db->idate(dol_now())."'");
$sql .= ' WHERE rowid=' . $this->id; $sql .= ' WHERE rowid=' . $this->id;
$this->db->begin(); $this->db->begin();

View File

@ -381,8 +381,8 @@ class WebsitePage extends CommonObject
$sql .= ' keywords = '.(isset($this->keywords)?"'".$this->db->escape($this->keywords)."'":"null").','; $sql .= ' keywords = '.(isset($this->keywords)?"'".$this->db->escape($this->keywords)."'":"null").',';
$sql .= ' content = '.(isset($this->content)?"'".$this->db->escape($this->content)."'":"null").','; $sql .= ' content = '.(isset($this->content)?"'".$this->db->escape($this->content)."'":"null").',';
$sql .= ' status = '.(isset($this->status)?$this->status:"null").','; $sql .= ' status = '.(isset($this->status)?$this->status:"null").',';
$sql .= ' date_creation = '.(! isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').','; $sql .= ' date_creation = '.(! isset($this->date_creation) || dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null');
//$sql .= ' tms = '.(dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : "'".$this->db->idate(dol_now())."'"); $sql .= ', tms = '.(dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : "'".$this->db->idate(dol_now())."'");
$sql .= ' WHERE rowid=' . $this->id; $sql .= ' WHERE rowid=' . $this->id;
$this->db->begin(); $this->db->begin();