Skip to content

Commit

Permalink
Fix update tms
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jul 20, 2017
1 parent 7760594 commit dfb49fc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions htdocs/websites/class/website.class.php
Expand Up @@ -208,7 +208,7 @@ public function fetch($id, $ref = null)
$sql .= " t.fk_user_create,";
$sql .= " t.fk_user_modif,";
$sql .= " t.date_creation,";
$sql .= " t.tms";
$sql .= " t.tms as date_modification";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
if (null !== $ref) {
$sql .= " WHERE t.ref = '" . $this->db->escape($ref) . "'";
Expand All @@ -233,7 +233,7 @@ public function fetch($id, $ref = null)
$this->fk_user_create = $obj->fk_user_create;
$this->fk_user_modif = $obj->fk_user_modif;
$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);

Expand Down Expand Up @@ -277,7 +277,7 @@ public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, arra
$sql .= " t.fk_user_create,";
$sql .= " t.fk_user_modif,";
$sql .= " t.date_creation,";
$sql .= " t.tms";
$sql .= " t.tms as date_modification";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';

// Manage filter
Expand Down Expand Up @@ -317,7 +317,7 @@ public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, arra
$this->fk_user_create = $obj->fk_user_create;
$this->fk_user_modif = $obj->fk_user_modif;
$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;
}
Expand Down Expand Up @@ -373,8 +373,8 @@ public function update(User $user, $notrigger = false)
$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 .= ' 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 .= ' tms = '.(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : "'".$this->db->idate(dol_now())."'");
$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 .= ' WHERE rowid=' . $this->id;

$this->db->begin();
Expand Down
4 changes: 2 additions & 2 deletions htdocs/websites/class/websitepage.class.php
Expand Up @@ -381,8 +381,8 @@ public function update(User $user, $notrigger = false)
$sql .= ' keywords = '.(isset($this->keywords)?"'".$this->db->escape($this->keywords)."'":"null").',';
$sql .= ' content = '.(isset($this->content)?"'".$this->db->escape($this->content)."'":"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 .= ' tms = '.(dol_strlen($this->date_modification) != 0 ? "'".$this->db->idate($this->date_modification)."'" : "'".$this->db->idate(dol_now())."'");
$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 .= ' WHERE rowid=' . $this->id;

$this->db->begin();
Expand Down

0 comments on commit dfb49fc

Please sign in to comment.