Fix fk_user

This commit is contained in:
Laurent Destailleur 2018-09-10 21:55:03 +02:00
parent 98c3657d45
commit 280f15e8bf

View File

@ -158,7 +158,9 @@ class WebsitePage extends CommonObject
$sql .= " t.status,"; $sql .= " t.status,";
$sql .= " t.grabbed_from,"; $sql .= " t.grabbed_from,";
$sql .= " t.date_creation,"; $sql .= " t.date_creation,";
$sql .= " t.tms as date_modification"; $sql .= " t.tms as date_modification,";
$sql .= " t.fk_user_create,";
$sql .= " t.fk_user_modif";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
//$sql .= ' WHERE entity IN ('.getEntity('website').')'; // entity is on website level //$sql .= ' WHERE entity IN ('.getEntity('website').')'; // entity is on website level
$sql .= ' WHERE 1 = 1'; $sql .= ' WHERE 1 = 1';
@ -200,6 +202,8 @@ class WebsitePage extends CommonObject
$this->grabbed_from = $obj->grabbed_from; $this->grabbed_from = $obj->grabbed_from;
$this->date_creation = $this->db->jdate($obj->date_creation); $this->date_creation = $this->db->jdate($obj->date_creation);
$this->date_modification = $this->db->jdate($obj->date_modification); $this->date_modification = $this->db->jdate($obj->date_modification);
$this->fk_user_create = $obj->fk_user_create;
$this->fk_user_modif = $obj->fk_user_modif;
} }
$this->db->free($resql); $this->db->free($resql);
@ -250,7 +254,9 @@ class WebsitePage extends CommonObject
$sql .= " t.status,"; $sql .= " t.status,";
$sql .= " t.grabbed_from,"; $sql .= " t.grabbed_from,";
$sql .= " t.date_creation,"; $sql .= " t.date_creation,";
$sql .= " t.tms as date_modification"; $sql .= " t.tms as date_modification,";
$sql .= " t.fk_user_create,";
$sql .= " t.fk_user_modif";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
$sql .= ' WHERE t.fk_website = '.$websiteid; $sql .= ' WHERE t.fk_website = '.$websiteid;
// Manage filter // Manage filter
@ -299,6 +305,8 @@ class WebsitePage extends CommonObject
$record->grabbed_from = $obj->grabbed_from; $record->grabbed_from = $obj->grabbed_from;
$record->date_creation = $this->db->jdate($obj->date_creation); $record->date_creation = $this->db->jdate($obj->date_creation);
$record->date_modification = $this->db->jdate($obj->date_modification); $record->date_modification = $this->db->jdate($obj->date_modification);
$record->fk_user_create = $obj->fk_user_create;
$record->fk_user_modif = $obj->fk_user_modif;
//var_dump($record->id); //var_dump($record->id);
$records[$record->id] = $record; $records[$record->id] = $record;
} }
@ -393,6 +401,7 @@ class WebsitePage extends CommonObject
$object->ref = $newref; $object->ref = $newref;
$object->pageurl = $newref; $object->pageurl = $newref;
$object->aliasalt = ''; $object->aliasalt = '';
$object->fk_user_create = $user->id;
$object->title = ($keeptitleunchanged ? '' : $langs->trans("CopyOf").' ').$object->title; $object->title = ($keeptitleunchanged ? '' : $langs->trans("CopyOf").' ').$object->title;
if (! empty($newlang)) $object->lang=$newlang; if (! empty($newlang)) $object->lang=$newlang;
if ($istranslation) $object->fk_page = $fromid; if ($istranslation) $object->fk_page = $fromid;
@ -526,6 +535,8 @@ class WebsitePage extends CommonObject
*/ */
public function initAsSpecimen() public function initAsSpecimen()
{ {
global $user;
$this->id = 0; $this->id = 0;
$now=dol_now(); $now=dol_now();
@ -543,5 +554,6 @@ class WebsitePage extends CommonObject
$this->grabbed_from = ''; $this->grabbed_from = '';
$this->date_creation = $now - (24 * 30 * 3600); $this->date_creation = $now - (24 * 30 * 3600);
$this->date_modification = $now - (24 * 7 * 3600); $this->date_modification = $now - (24 * 7 * 3600);
$this->fk_user_create = $user->id;
} }
} }