Fix look and feel v15

This commit is contained in:
Laurent Destailleur 2022-02-01 11:57:33 +01:00
parent 3a40078149
commit 9db0b7d0ef

View File

@ -246,11 +246,14 @@ if ($reshook == 0) {
} }
} }
$permissiontoadd = 1;
//asort($elementList); //asort($elementList);
$id = 25; $id = 25;
/* /*
* Actions * Actions
*/ */
@ -338,6 +341,7 @@ if (empty($reshook)) {
} }
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
$action = 'add';
} }
} }
@ -411,6 +415,7 @@ if (empty($reshook)) {
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
$action = 'add';
} }
} }
@ -489,6 +494,7 @@ if (empty($reshook)) {
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
} else { } else {
setEventMessages($db->error(), null, 'errors'); setEventMessages($db->error(), null, 'errors');
$action = 'edit';
} }
} }
} }
@ -515,7 +521,7 @@ if (empty($reshook)) {
if ($action == $acts[0]) { if ($action == $acts[0]) {
$rowidcol = "rowid"; $rowidcol = "rowid";
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."=".((int) $rowid); $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE rowid = ".((int) $rowid);
$result = $db->query($sql); $result = $db->query($sql);
if (!$result) { if (!$result) {
@ -527,7 +533,7 @@ if (empty($reshook)) {
if ($action == $acts[1]) { if ($action == $acts[1]) {
$rowidcol = "rowid"; $rowidcol = "rowid";
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."=".((int) $rowid); $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE rowid = ".((int) $rowid);
$result = $db->query($sql); $result = $db->query($sql);
if (!$result) { if (!$result) {
@ -545,18 +551,38 @@ $form = new Form($db);
$formadmin = new FormAdmin($db); $formadmin = new FormAdmin($db);
$help_url = ''; $help_url = '';
$title = $langs->trans("EMailsSetup"); if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
$title = $langs->trans("EMailsSetup");
} else {
$title = $langs->trans("EMailsTemplates");
}
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
$linkback = ''; $linkback = '';
$titlepicto = 'title_setup'; $titlepicto = 'title_setup';
print load_fiche_titre($title, $linkback, $titlepicto);
$head = email_admin_prepare_head(); $url = DOL_URL_ROOT.'/admin/mails_templates.php?action=add';
$newcardbutton = dolGetButtonTitle($langs->trans('NewEMailTemplate'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
print load_fiche_titre($title, '', $titlepicto);
} else {
print load_fiche_titre($title, $newcardbutton, $titlepicto);
}
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
$head = email_admin_prepare_head();
print dol_get_fiche_head($head, 'templates', '', -1);
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
print load_fiche_titre('', $newcardbutton, '');
}
}
print dol_get_fiche_head($head, 'templates', '', -1);
// Confirmation de la suppression de la ligne // Confirmation de la suppression de la ligne
if ($action == 'delete') { if ($action == 'delete') {
@ -599,7 +625,7 @@ $sql .= $db->plimit($listlimit + 1, $offset);
$fieldlist = explode(',', $tabfield[$id]); $fieldlist = explode(',', $tabfield[$id]);
if ($action == 'view') { if ($action == 'add') {
// Form to add a new line // Form to add a new line
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">'; print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
@ -750,7 +776,8 @@ if ($action == 'view') {
if ($tmpfieldlist == 'topic') { if ($tmpfieldlist == 'topic') {
print '<td class="center" rowspan="'.(count($fieldsforcontent)).'">'; print '<td class="center" rowspan="'.(count($fieldsforcontent)).'">';
if ($action != 'edit') { if ($action != 'edit') {
print '<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans("Add").'">'; print '<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans("Add").'"><br>';
print '<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
} }
print '</td>'; print '</td>';
} }
@ -1142,7 +1169,10 @@ print '</div>';
print '</form>'; print '</form>';
print dol_get_fiche_end(); if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
print dol_get_fiche_end();
}
// End of page // End of page
llxFooter(); llxFooter();