diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php index dd39bce6d4e..6466df89a07 100644 --- a/htdocs/core/ajax/objectonoff.php +++ b/htdocs/core/ajax/objectonoff.php @@ -43,9 +43,9 @@ if (!empty($user->socid)) { $socid = $user->socid; } -if (empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { +/*if (empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { accessforbidden('Calling this file is allowed only when MAIN_DIRECT_STATUS_UPDATE is set'); -} +}*/ /* @@ -75,5 +75,10 @@ if (($action == 'set') && !empty($id)) { $triggerkey = 'COMPANY_UPDATE'; } - $object->setValueFrom($field, $value, $element, $id, $user, $triggerkey); + $tablename = $element; + if ($tablename == 'websitepage') $tablename = 'website_page'; + + $format = 'int'; + + $object->setValueFrom($field, $value, $tablename, $id, $format, '', $user, $triggerkey); } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f3f1b9eaee3..6148b55a5cf 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -8070,7 +8070,10 @@ abstract class CommonObject { if (empty($id) && empty($ref) && empty($morewhere)) return -1; - $sql = 'SELECT '.$this->getFieldList(); + $fieldlist = $this->getFieldList(); + if (empty($fieldlist)) return 0; + + $sql = 'SELECT '.$fieldlist; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element; if (!empty($id)) $sql .= ' WHERE rowid = '.$id; diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 6749f32ffbe..03f1525eb91 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -192,6 +192,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f if ($features == 'mo') $features = 'mrp'; if ($features == 'member') $features = 'adherent'; if ($features == 'subscription') { $features = 'adherent'; $feature2 = 'cotisation'; }; + if ($features == 'websitepage') $features = 'website'; // Get more permissions checks from hooks $parameters = array('features'=>$features, 'objectid'=>$objectid, 'idtype'=>$dbt_select); diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 690dc0efe3b..ac26f2ee7bb 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3170,6 +3170,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') $pageauthorid = $objectpage->fk_user_creat; $pageusermodifid = $objectpage->fk_user_modif; $pageauthoralias = $objectpage->author_alias; + $pagestatus = $objectpage->status; } else { @@ -3178,6 +3179,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') $pageauthorid = $user->id; $pageusermodifid = 0; $pageauthoralias = ''; + $pagestatus = 1; } if (GETPOST('WEBSITE_TITLE', 'alpha')) $pagetitle = GETPOST('WEBSITE_TITLE', 'alpha'); if (GETPOST('WEBSITE_PAGENAME', 'alpha')) $pageurl = GETPOST('WEBSITE_PAGENAME', 'alpha'); @@ -3186,7 +3188,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') if (GETPOST('WEBSITE_IMAGE', 'alpha')) $pageimage = GETPOST('WEBSITE_IMAGE', 'alpha'); if (GETPOST('WEBSITE_KEYWORDS', 'alpha')) $pagekeywords = GETPOST('WEBSITE_KEYWORDS', 'alpha'); if (GETPOST('WEBSITE_LANG', 'aZ09')) $pagelang = GETPOST('WEBSITE_LANG', 'aZ09'); - if (GETPOST('htmlheader', 'none')) $pagehtmlheader = GETPOST('htmlheader', 'none'); + if (GETPOST('htmlheader', 'none')) $pagehtmlheader = GETPOST('htmlheader', 'none'); // Title print ''; @@ -3381,6 +3383,16 @@ if ($action == 'editmeta' || $action == 'createcontainer') print $doleditor->Create(1, '', true, 'HTML Header', 'html'); print ''; + if ($action != 'createcontainer') + { + print ''; + print $langs->trans('Status'); + print ''; + print ajax_object_onoff($objectpage, 'status', 'status', 'Enabled', 'Disabled'); + //print dol_print_date($pagedatecreation, 'dayhour'); + print ''; + } + print ''; if ($action == 'createcontainer') {