2
0
forked from Wavyzz/dolibarr

Can set status of a websitepage

This commit is contained in:
Laurent Destailleur
2020-05-14 18:14:55 +02:00
parent 215cf9e6f8
commit 1bf677f537
4 changed files with 26 additions and 5 deletions

View File

@@ -43,9 +43,9 @@ if (!empty($user->socid)) {
$socid = $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'); 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'; $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);
} }

View File

@@ -8070,7 +8070,10 @@ abstract class CommonObject
{ {
if (empty($id) && empty($ref) && empty($morewhere)) return -1; 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; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element;
if (!empty($id)) $sql .= ' WHERE rowid = '.$id; if (!empty($id)) $sql .= ' WHERE rowid = '.$id;

View File

@@ -192,6 +192,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
if ($features == 'mo') $features = 'mrp'; if ($features == 'mo') $features = 'mrp';
if ($features == 'member') $features = 'adherent'; if ($features == 'member') $features = 'adherent';
if ($features == 'subscription') { $features = 'adherent'; $feature2 = 'cotisation'; }; if ($features == 'subscription') { $features = 'adherent'; $feature2 = 'cotisation'; };
if ($features == 'websitepage') $features = 'website';
// Get more permissions checks from hooks // Get more permissions checks from hooks
$parameters = array('features'=>$features, 'objectid'=>$objectid, 'idtype'=>$dbt_select); $parameters = array('features'=>$features, 'objectid'=>$objectid, 'idtype'=>$dbt_select);

View File

@@ -3170,6 +3170,7 @@ if ($action == 'editmeta' || $action == 'createcontainer')
$pageauthorid = $objectpage->fk_user_creat; $pageauthorid = $objectpage->fk_user_creat;
$pageusermodifid = $objectpage->fk_user_modif; $pageusermodifid = $objectpage->fk_user_modif;
$pageauthoralias = $objectpage->author_alias; $pageauthoralias = $objectpage->author_alias;
$pagestatus = $objectpage->status;
} }
else else
{ {
@@ -3178,6 +3179,7 @@ if ($action == 'editmeta' || $action == 'createcontainer')
$pageauthorid = $user->id; $pageauthorid = $user->id;
$pageusermodifid = 0; $pageusermodifid = 0;
$pageauthoralias = ''; $pageauthoralias = '';
$pagestatus = 1;
} }
if (GETPOST('WEBSITE_TITLE', 'alpha')) $pagetitle = GETPOST('WEBSITE_TITLE', 'alpha'); if (GETPOST('WEBSITE_TITLE', 'alpha')) $pagetitle = GETPOST('WEBSITE_TITLE', 'alpha');
if (GETPOST('WEBSITE_PAGENAME', 'alpha')) $pageurl = GETPOST('WEBSITE_PAGENAME', '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_IMAGE', 'alpha')) $pageimage = GETPOST('WEBSITE_IMAGE', 'alpha');
if (GETPOST('WEBSITE_KEYWORDS', 'alpha')) $pagekeywords = GETPOST('WEBSITE_KEYWORDS', 'alpha'); if (GETPOST('WEBSITE_KEYWORDS', 'alpha')) $pagekeywords = GETPOST('WEBSITE_KEYWORDS', 'alpha');
if (GETPOST('WEBSITE_LANG', 'aZ09')) $pagelang = GETPOST('WEBSITE_LANG', 'aZ09'); 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 // Title
print '<tr><td class="fieldrequired">'; print '<tr><td class="fieldrequired">';
@@ -3381,6 +3383,16 @@ if ($action == 'editmeta' || $action == 'createcontainer')
print $doleditor->Create(1, '', true, 'HTML Header', 'html'); print $doleditor->Create(1, '', true, 'HTML Header', 'html');
print '</td></tr>'; 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>'; print '</table>';
if ($action == 'createcontainer') if ($action == 'createcontainer')
{ {