FIX Edit blog meta post

This commit is contained in:
Laurent Destailleur 2019-01-15 10:53:28 +01:00
parent 8c6fde72f8
commit 2ec2daa18d
3 changed files with 31 additions and 11 deletions

View File

@ -79,16 +79,13 @@ class Website extends CommonObject
* @var mixed
*/
public $date_creation;
/**
* @var mixed
*/
public $tms = '';
public $date_modification;
/**
* @var integer
*/
public $fk_default_home;
public $fk_user_creat;
/**
* @var string
@ -169,7 +166,7 @@ class Website extends CommonObject
$sql .= ' '.(! isset($this->virtualhost)?'NULL':"'".$this->db->escape($this->virtualhost)."'").",";
$sql .= ' '.(! isset($this->fk_user_creat)?$user->id:$this->fk_user_creat).',';
$sql .= ' '.(! isset($this->date_creation) || dol_strlen($this->date_creation)==0?'NULL':"'".$this->db->idate($this->date_creation)."'").",";
$sql .= ' '.(! isset($this->date_modification) || dol_strlen($this->date_modification)==0?'NULL':"'".$this->db->idate($this->date_creation)."'");
$sql .= ' '.(! isset($this->date_modification) || dol_strlen($this->date_modification)==0?'NULL':"'".$this->db->idate($this->date_modification)."'");
$sql .= ')';
$this->db->begin();
@ -525,6 +522,7 @@ class Website extends CommonObject
global $hookmanager, $langs;
global $dolibarr_main_data_root;
$now = dol_now();
$error=0;
dol_syslog(__METHOD__, LOG_DEBUG);
@ -560,6 +558,8 @@ class Website extends CommonObject
$object->ref=$newref;
$object->fk_default_home=0;
$object->virtualhost='';
$object->date_creation = $now;
$object->fk_user_creat = $user->id;
// Create clone
$object->context['createfromclone'] = 'createfromclone';

View File

@ -410,6 +410,8 @@ class WebsitePage extends CommonObject
public function createFromClone(User $user, $fromid, $newref, $newlang='', $istranslation=0, $newwebsite=0, $keeptitleunchanged=0)
{
global $hookmanager, $langs;
$now = dol_now();
$error = 0;
dol_syslog(__METHOD__, LOG_DEBUG);
@ -428,6 +430,7 @@ class WebsitePage extends CommonObject
$object->pageurl = $newref;
$object->aliasalt = '';
$object->fk_user_creat = $user->id;
$object->date_creation = $now;
$object->title = ($keeptitleunchanged ? '' : $langs->trans("CopyOf").' ').$object->title;
if (! empty($newlang)) $object->lang=$newlang;
if ($istranslation) $object->fk_page = $fromid;

View File

@ -1163,6 +1163,8 @@ if ($action == 'updatemeta')
$objectpage->keywords = GETPOST('WEBSITE_KEYWORDS', 'alpha');
$objectpage->lang = GETPOST('WEBSITE_LANG', 'aZ09');
$objectpage->htmlheader = trim(GETPOST('htmlheader', 'none'));
$newdatecreation=dol_mktime(GETPOST('datecreationhour','int'), GETPOST('datecreationmin','int'), GETPOST('datecreationsec','int'), GETPOST('datecreationmonth','int'), GETPOST('datecreationday','int'), GETPOST('datecreationyear','int'));
if ($newdatecreation) $objectpage->date_creation = $newdatecreation;
$res = $objectpage->update($user);
if (! ($res > 0))
@ -2506,7 +2508,8 @@ if ($action == 'editmeta' || $action == 'createcontainer')
$pagehtmlheader=$objectpage->htmlheader;
$pagedatecreation=$objectpage->date_creation;
$pagedatemodification=$objectpage->date_modification;
$pageauthorid=$objectpage->fk_user_create;
$pageauthorid=$objectpage->fk_user_creat;
$pageusermodifid=$objectpage->fk_user_modif;
}
else
{
@ -2633,23 +2636,37 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print '</td></tr>';
$fuser=new User($db);
$fuser->fetch($pageauthorid);
print '<tr><td>';
print $langs->trans('Author');
print '</td><td>';
if ($pageauthorid > 0) print $fuser->getNomUrl(1);
if ($pageauthorid > 0)
{
$fuser->fetch($pageauthorid);
print $fuser->getNomUrl(1);
}
print '</td></tr>';
print '<tr><td>';
print $langs->trans('DateCreation');
print '</td><td>';
print dol_print_date($pagedatecreation, 'dayhour');
print $form->select_date($pagedatecreation, 'datecreation', 1, 1, 0, '', 1, 1);
//print dol_print_date($pagedatecreation, 'dayhour');
print '</td></tr>';
if ($action != 'createcontainer')
{
print '<tr><td>';
print '<tr><td>';
print $langs->trans('LastModificationAuthor');
print '</td><td>';
if ($pageusermodifid > 0)
{
$fuser->fetch($pageusermodifid);
print $fuser->getNomUrl(1);
}
print '</td></tr>';
print '<tr><td>';
print $langs->trans('DateModification');
print '</td><td>';
print dol_print_date($pagedatemodification, 'dayhour');