forked from Wavyzz/dolibarr
Can set status of a websitepage
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 '<tr><td class="fieldrequired">';
|
||||
@@ -3381,6 +3383,16 @@ if ($action == 'editmeta' || $action == 'createcontainer')
|
||||
print $doleditor->Create(1, '', true, 'HTML Header', 'html');
|
||||
print '</td></tr>';
|
||||
|
||||
if ($action != 'createcontainer')
|
||||
{
|
||||
print '<tr><td>';
|
||||
print $langs->trans('Status');
|
||||
print '</td><td>';
|
||||
print ajax_object_onoff($objectpage, 'status', 'status', 'Enabled', 'Disabled');
|
||||
//print dol_print_date($pagedatecreation, 'dayhour');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
if ($action == 'createcontainer')
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user