|
@@ -66,10 +66,6 @@ $search_lang = GETPOST('search_lang', 'alpha');
|
|
|
$search_fk_user = GETPOST('search_fk_user', 'intcomma');
|
|
|
$search_topic = GETPOST('search_topic', 'alpha');
|
|
|
|
|
|
-if (!empty($user->socid)) {
|
|
|
- accessforbidden();
|
|
|
-}
|
|
|
-
|
|
|
$acts = array();
|
|
|
$actl = array();
|
|
|
$acts[0] = "activate";
|
|
@@ -100,6 +96,7 @@ if (empty($sortorder)) {
|
|
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
|
|
$hookmanager->initHooks(array('emailtemplates'));
|
|
|
|
|
|
+
|
|
|
// Name of SQL tables of dictionaries
|
|
|
$tabname = array();
|
|
|
$tabname[25] = MAIN_DB_PREFIX."c_email_templates";
|
|
@@ -246,6 +243,12 @@ if ($reshook == 0) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+if (!empty($user->socid)) {
|
|
|
+ accessforbidden();
|
|
|
+}
|
|
|
+
|
|
|
$permissiontoadd = 1;
|
|
|
|
|
|
//asort($elementList);
|
|
@@ -273,6 +276,9 @@ if ($reshook < 0) {
|
|
|
}
|
|
|
|
|
|
if (empty($reshook)) {
|
|
|
+ // Selection of new fields
|
|
|
+ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
|
|
+
|
|
|
// Purge search criteria
|
|
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
|
|
|
// All tests are required to be compatible with all browsers
|
|
@@ -281,7 +287,7 @@ if (empty($reshook)) {
|
|
|
$search_lang = '';
|
|
|
$search_fk_user = '';
|
|
|
$search_topic = '';
|
|
|
- $toselect = '';
|
|
|
+ $toselect = array();
|
|
|
$search_array_options = array();
|
|
|
}
|
|
|
|
|
@@ -395,7 +401,7 @@ if (empty($reshook)) {
|
|
|
}
|
|
|
} elseif ($keycode == 'content') {
|
|
|
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'";
|
|
|
- } elseif (in_array($keycode, array('joinfiles', 'private', 'position'))) {
|
|
|
+ } elseif (in_array($keycode, array('joinfiles', 'private', 'position', 'entity'))) {
|
|
|
$sql .= (int) GETPOST($keycode, 'int');
|
|
|
} else {
|
|
|
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
|
|
@@ -502,9 +508,9 @@ if (empty($reshook)) {
|
|
|
if ($action == 'confirm_delete' && $confirm == 'yes') { // delete
|
|
|
$rowidcol = "rowid";
|
|
|
|
|
|
- $sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."=".((int) $rowid);
|
|
|
+ $sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol." = ".((int) $rowid);
|
|
|
if (!$user->admin) { // A non admin user can only edit its own template
|
|
|
- $sql .= " AND fk_user = ".((int) $user->id);
|
|
|
+ $sql .= " AND fk_user = ".((int) $user->id);
|
|
|
}
|
|
|
dol_syslog("delete", LOG_DEBUG);
|
|
|
$result = $db->query($sql);
|
|
@@ -548,47 +554,20 @@ if (empty($reshook)) {
|
|
|
*/
|
|
|
|
|
|
$form = new Form($db);
|
|
|
+
|
|
|
+$now = dol_now();
|
|
|
+
|
|
|
$formadmin = new FormAdmin($db);
|
|
|
|
|
|
+//$help_url = "EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject";
|
|
|
$help_url = '';
|
|
|
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
|
|
|
$title = $langs->trans("EMailsSetup");
|
|
|
} else {
|
|
|
$title = $langs->trans("EMailTemplates");
|
|
|
}
|
|
|
-
|
|
|
-llxHeader('', $title, $help_url);
|
|
|
-
|
|
|
-$linkback = '';
|
|
|
-$titlepicto = 'title_setup';
|
|
|
-
|
|
|
-
|
|
|
-$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, '');
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-// Confirmation de la suppression de la ligne
|
|
|
-if ($action == 'delete') {
|
|
|
- print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
|
|
|
-}
|
|
|
-
|
|
|
+$morejs = array();
|
|
|
+$morecss = array();
|
|
|
|
|
|
$sql = "SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, joinfiles, content_lines, content, enabled, active";
|
|
|
$sql .= " FROM ".MAIN_DB_PREFIX."c_email_templates";
|
|
@@ -623,6 +602,78 @@ $sql .= $db->order($sortfield, $sortorder);
|
|
|
$sql .= $db->plimit($listlimit + 1, $offset);
|
|
|
//print $sql;
|
|
|
|
|
|
+// Output page
|
|
|
+// --------------------------------------------------------------------
|
|
|
+
|
|
|
+llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', '');
|
|
|
+
|
|
|
+$arrayofselected = is_array($toselect) ? $toselect : array();
|
|
|
+
|
|
|
+$param = '';
|
|
|
+if (!empty($mode)) {
|
|
|
+ $param .= '&mode='.urlencode($mode);
|
|
|
+}
|
|
|
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
|
|
|
+ $param .= '&contextpage='.urlencode($contextpage);
|
|
|
+}
|
|
|
+if ($limit > 0 && $limit != $conf->liste_limit) {
|
|
|
+ $param .= '&limit='.urlencode($limit);
|
|
|
+}
|
|
|
+foreach ($search as $key => $val) {
|
|
|
+ if (is_array($search[$key]) && count($search[$key])) {
|
|
|
+ foreach ($search[$key] as $skey) {
|
|
|
+ if ($skey != '') {
|
|
|
+ $param .= '&search_'.$key.'[]='.urlencode($skey);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } elseif ($search[$key] != '') {
|
|
|
+ $param .= '&search_'.$key.'='.urlencode($search[$key]);
|
|
|
+ }
|
|
|
+}
|
|
|
+if ($optioncss != '') {
|
|
|
+ $param .= '&optioncss='.urlencode($optioncss);
|
|
|
+}
|
|
|
+// Add $param from extra fields
|
|
|
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
|
|
+// Add $param from hooks
|
|
|
+$parameters = array();
|
|
|
+$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
|
|
|
+$param .= $hookmanager->resPrint;
|
|
|
+
|
|
|
+
|
|
|
+$linkback = '';
|
|
|
+$titlepicto = 'title_setup';
|
|
|
+
|
|
|
+
|
|
|
+$url = DOL_URL_ROOT.'/admin/mails_templates.php?action=add&token='.newToken();
|
|
|
+$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, '');
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+// Confirmation de la suppression de la ligne
|
|
|
+if ($action == 'delete') {
|
|
|
+ print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete', '', 0, 1);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
$fieldlist = explode(',', $tabfield[$id]);
|
|
|
|
|
|
if ($action == 'add') {
|
|
@@ -681,7 +732,7 @@ if ($action == 'add') {
|
|
|
}
|
|
|
|
|
|
if ($valuetoshow != '') {
|
|
|
- print '<td class="'.$align.'">';
|
|
|
+ print '<th class="'.$align.'">';
|
|
|
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) {
|
|
|
print '<a href="'.$tabhelp[$id][$value].'" target="_blank" rel="noopener noreferrer">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
|
|
|
} elseif (!empty($tabhelp[$id][$value])) {
|
|
@@ -693,12 +744,12 @@ if ($action == 'add') {
|
|
|
} else {
|
|
|
print $valuetoshow;
|
|
|
}
|
|
|
- print '</td>';
|
|
|
+ print '</th>';
|
|
|
}
|
|
|
}
|
|
|
- print '<td>';
|
|
|
+ print '<th>';
|
|
|
print '<input type="hidden" name="id" value="'.$id.'">';
|
|
|
- print '</td>';
|
|
|
+ print '</th>';
|
|
|
print '</tr>';
|
|
|
|
|
|
$obj = new stdClass();
|
|
@@ -742,7 +793,7 @@ if ($action == 'add') {
|
|
|
$fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines');
|
|
|
}
|
|
|
foreach ($fieldsforcontent as $tmpfieldlist) {
|
|
|
- print '<tr class="impair nodrag nodrop nohover"><td colspan="6" class="nobottom">';
|
|
|
+ print '<tr class="impair nodrag nodrop nohover"><td colspan="7" class="nobottom">';
|
|
|
|
|
|
// Label
|
|
|
if ($tmpfieldlist == 'topic') {
|
|
@@ -773,24 +824,33 @@ if ($action == 'add') {
|
|
|
print $doleditor->Create(1);
|
|
|
}
|
|
|
print '</td>';
|
|
|
- if ($tmpfieldlist == 'topic') {
|
|
|
- print '<td class="center" rowspan="'.(count($fieldsforcontent)).'">';
|
|
|
- if ($action != 'edit') {
|
|
|
- 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>';
|
|
|
- }
|
|
|
- // else print '<td></td>';
|
|
|
print '</tr>';
|
|
|
}
|
|
|
|
|
|
print '</table>';
|
|
|
+
|
|
|
+ if ($action != 'edit') {
|
|
|
+ print '<center>';
|
|
|
+ print '<input type="submit" class="button button-add" name="actionadd" value="'.$langs->trans("Add").'"> ';
|
|
|
+ print '<input type="submit" class="button button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
|
|
+ print '</center>';
|
|
|
+ }
|
|
|
+
|
|
|
print '</div>';
|
|
|
print '</form>';
|
|
|
- print '<br>';
|
|
|
+ print '<br><br>';
|
|
|
} // END IF not edit
|
|
|
|
|
|
+// List of available record in database
|
|
|
+dol_syslog("htdocs/admin/dict", LOG_DEBUG);
|
|
|
+$resql = $db->query($sql);
|
|
|
+if (!$resql) {
|
|
|
+ dol_print_error($db);
|
|
|
+ exit;
|
|
|
+}
|
|
|
+
|
|
|
+$num = $db->num_rows($resql);
|
|
|
+
|
|
|
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
|
|
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
|
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
|
|
@@ -798,371 +858,375 @@ print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('fro
|
|
|
print '<div class="div-table-responsive-no-min">';
|
|
|
print '<table class="noborder centpercent">';
|
|
|
|
|
|
-// List of available record in database
|
|
|
-dol_syslog("htdocs/admin/dict", LOG_DEBUG);
|
|
|
-$resql = $db->query($sql);
|
|
|
-if ($resql) {
|
|
|
- $num = $db->num_rows($resql);
|
|
|
- $i = 0;
|
|
|
+$i = 0;
|
|
|
+
|
|
|
+$param = '&id='.$id;
|
|
|
+if ($search_label) {
|
|
|
+ $param .= '&search_label='.urlencode($search_label);
|
|
|
+}
|
|
|
+if ($search_lang > 0) {
|
|
|
+ $param .= '&search_lang='.urlencode($search_lang);
|
|
|
+}
|
|
|
+if ($search_type_template != '-1') {
|
|
|
+ $param .= '&search_type_template='.urlencode($search_type_template);
|
|
|
+}
|
|
|
+if ($search_fk_user > 0) {
|
|
|
+ $param .= '&search_fk_user='.urlencode($search_fk_user);
|
|
|
+}
|
|
|
+if ($search_topic) {
|
|
|
+ $param .= '&search_topic='.urlencode($search_topic);
|
|
|
+}
|
|
|
+
|
|
|
+$paramwithsearch = $param;
|
|
|
+if ($sortorder) {
|
|
|
+ $paramwithsearch .= '&sortorder='.urlencode($sortorder);
|
|
|
+}
|
|
|
+if ($sortfield) {
|
|
|
+ $paramwithsearch .= '&sortfield='.urlencode($sortfield);
|
|
|
+}
|
|
|
+if (GETPOST('from', 'alpha')) {
|
|
|
+ $paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha'));
|
|
|
+}
|
|
|
|
|
|
- $param = '&id='.$id;
|
|
|
- if ($search_label) {
|
|
|
- $param .= '&search_label='.urlencode($search_label);
|
|
|
+// There is several pages
|
|
|
+if ($num > $listlimit) {
|
|
|
+ print '<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).'">';
|
|
|
+ print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
|
|
|
+ print '</td></tr>';
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+// Title line with search boxes
|
|
|
+print '<tr class="liste_titre">';
|
|
|
+
|
|
|
+foreach ($fieldlist as $field => $value) {
|
|
|
+ if ($value == 'label') {
|
|
|
+ print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth200" value="'.dol_escape_htmltag($search_label).'"></td>';
|
|
|
+ } elseif ($value == 'lang') {
|
|
|
+ print '<td class="liste_titre">';
|
|
|
+ print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth150');
|
|
|
+ print '</td>';
|
|
|
+ } elseif ($value == 'fk_user') {
|
|
|
+ print '<td class="liste_titre">';
|
|
|
+ print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'maxwidth150');
|
|
|
+ print '</td>';
|
|
|
+ } elseif ($value == 'topic') {
|
|
|
+ print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
|
|
|
+ } elseif ($value == 'type_template') {
|
|
|
+ print '<td class="liste_titre center">';
|
|
|
+ print $form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'minwidth150', 1, '', 0, 1);
|
|
|
+ print '</td>';
|
|
|
+ } elseif (!in_array($value, array('content', 'content_lines'))) {
|
|
|
+ print '<td class="liste_titre"></td>';
|
|
|
}
|
|
|
- if ($search_lang > 0) {
|
|
|
- $param .= '&search_lang='.urlencode($search_lang);
|
|
|
+}
|
|
|
+
|
|
|
+if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
|
|
|
+ print '<td class="liste_titre"></td>';
|
|
|
+}
|
|
|
+
|
|
|
+// Action column
|
|
|
+print '<td class="liste_titre right" width="64">';
|
|
|
+$searchpicto = $form->showFilterButtons();
|
|
|
+print $searchpicto;
|
|
|
+print '</td>';
|
|
|
+print '</tr>';
|
|
|
+
|
|
|
+// Title of lines
|
|
|
+print '<tr class="liste_titre">';
|
|
|
+foreach ($fieldlist as $field => $value) {
|
|
|
+ $showfield = 1; // By defaut
|
|
|
+ $align = "left";
|
|
|
+ $sortable = 1;
|
|
|
+ $valuetoshow = '';
|
|
|
+ $forcenowrap = 1;
|
|
|
+ /*
|
|
|
+ $tmparray=getLabelOfField($fieldlist[$field]);
|
|
|
+ $showfield=$tmp['showfield'];
|
|
|
+ $valuetoshow=$tmp['valuetoshow'];
|
|
|
+ $align=$tmp['align'];
|
|
|
+ $sortable=$tmp['sortable'];
|
|
|
+ */
|
|
|
+ $valuetoshow = ucfirst($fieldlist[$field]); // By defaut
|
|
|
+ $valuetoshow = $langs->trans($valuetoshow); // try to translate
|
|
|
+ if ($fieldlist[$field] == 'fk_user') {
|
|
|
+ $valuetoshow = $langs->trans("Owner");
|
|
|
}
|
|
|
- if ($search_type_template != '-1') {
|
|
|
- $param .= '&search_type_template='.urlencode($search_type_template);
|
|
|
+ if ($fieldlist[$field] == 'lang') {
|
|
|
+ $valuetoshow = $langs->trans("Language");
|
|
|
}
|
|
|
- if ($search_fk_user > 0) {
|
|
|
- $param .= '&search_fk_user='.urlencode($search_fk_user);
|
|
|
+ if ($fieldlist[$field] == 'type') {
|
|
|
+ $valuetoshow = $langs->trans("Type");
|
|
|
}
|
|
|
- if ($search_topic) {
|
|
|
- $param .= '&search_topic='.urlencode($search_topic);
|
|
|
+ if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
|
|
|
+ $valuetoshow = $langs->trans("Code");
|
|
|
}
|
|
|
-
|
|
|
- $paramwithsearch = $param;
|
|
|
- if ($sortorder) {
|
|
|
- $paramwithsearch .= '&sortorder='.urlencode($sortorder);
|
|
|
+ if ($fieldlist[$field] == 'type_template') {
|
|
|
+ $align = 'center';
|
|
|
+ $valuetoshow = $langs->trans("TypeOfTemplate");
|
|
|
}
|
|
|
- if ($sortfield) {
|
|
|
- $paramwithsearch .= '&sortfield='.urlencode($sortfield);
|
|
|
+ if ($fieldlist[$field] == 'private') {
|
|
|
+ $align = 'center';
|
|
|
}
|
|
|
- if (GETPOST('from', 'alpha')) {
|
|
|
- $paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha'));
|
|
|
+ if ($fieldlist[$field] == 'position') {
|
|
|
+ $align = 'center';
|
|
|
}
|
|
|
|
|
|
- // There is several pages
|
|
|
- if ($num > $listlimit) {
|
|
|
- print '<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).'">';
|
|
|
- print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
|
|
|
- print '</td></tr>';
|
|
|
+ if ($fieldlist[$field] == 'joinfiles') {
|
|
|
+ $valuetoshow = $langs->trans("FilesAttachedToEmail"); $align = 'center'; $forcenowrap = 0;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- // Title line with search boxes
|
|
|
- print '<tr class="liste_titre">';
|
|
|
-
|
|
|
- foreach ($fieldlist as $field => $value) {
|
|
|
- if ($value == 'label') {
|
|
|
- print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth200" value="'.dol_escape_htmltag($search_label).'"></td>';
|
|
|
- } elseif ($value == 'lang') {
|
|
|
- print '<td class="liste_titre">';
|
|
|
- print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth150');
|
|
|
- print '</td>';
|
|
|
- } elseif ($value == 'fk_user') {
|
|
|
- print '<td class="liste_titre">';
|
|
|
- print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'maxwidth150');
|
|
|
- print '</td>';
|
|
|
- } elseif ($value == 'topic') {
|
|
|
- print '<td class="liste_titre"><input type="text" name="search_topic" value="'.dol_escape_htmltag($search_topic).'"></td>';
|
|
|
- } elseif ($value == 'type_template') {
|
|
|
- print '<td class="liste_titre center">';
|
|
|
- print $form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'minwidth150', 1, '', 0, 1);
|
|
|
- print '</td>';
|
|
|
- } elseif (!in_array($value, array('content', 'content_lines'))) {
|
|
|
- print '<td class="liste_titre"></td>';
|
|
|
- }
|
|
|
+ if ($fieldlist[$field] == 'content') {
|
|
|
+ $valuetoshow = $langs->trans("Content"); $showfield = 0;
|
|
|
}
|
|
|
-
|
|
|
- if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
|
|
|
- print '<td class="liste_titre"></td>';
|
|
|
+ if ($fieldlist[$field] == 'content_lines') {
|
|
|
+ $valuetoshow = $langs->trans("ContentForLines"); $showfield = 0;
|
|
|
}
|
|
|
|
|
|
- // Action column
|
|
|
- print '<td class="liste_titre right" width="64">';
|
|
|
- $searchpicto = $form->showFilterButtons();
|
|
|
- print $searchpicto;
|
|
|
- print '</td>';
|
|
|
- print '</tr>';
|
|
|
-
|
|
|
- // Title of lines
|
|
|
- print '<tr class="liste_titre">';
|
|
|
- foreach ($fieldlist as $field => $value) {
|
|
|
- $showfield = 1; // By defaut
|
|
|
- $align = "left";
|
|
|
- $sortable = 1;
|
|
|
- $valuetoshow = '';
|
|
|
- $forcenowrap = 1;
|
|
|
- /*
|
|
|
- $tmparray=getLabelOfField($fieldlist[$field]);
|
|
|
- $showfield=$tmp['showfield'];
|
|
|
- $valuetoshow=$tmp['valuetoshow'];
|
|
|
- $align=$tmp['align'];
|
|
|
- $sortable=$tmp['sortable'];
|
|
|
- */
|
|
|
- $valuetoshow = ucfirst($fieldlist[$field]); // By defaut
|
|
|
- $valuetoshow = $langs->trans($valuetoshow); // try to translate
|
|
|
- if ($fieldlist[$field] == 'fk_user') {
|
|
|
- $valuetoshow = $langs->trans("Owner");
|
|
|
- }
|
|
|
- if ($fieldlist[$field] == 'lang') {
|
|
|
- $valuetoshow = $langs->trans("Language");
|
|
|
- }
|
|
|
- if ($fieldlist[$field] == 'type') {
|
|
|
- $valuetoshow = $langs->trans("Type");
|
|
|
- }
|
|
|
- if ($fieldlist[$field] == 'libelle' || $fieldlist[$field] == 'label') {
|
|
|
- $valuetoshow = $langs->trans("Code");
|
|
|
- }
|
|
|
- if ($fieldlist[$field] == 'type_template') {
|
|
|
- $align = 'center';
|
|
|
- $valuetoshow = $langs->trans("TypeOfTemplate");
|
|
|
- }
|
|
|
- if ($fieldlist[$field] == 'private') {
|
|
|
- $align = 'center';
|
|
|
- }
|
|
|
- if ($fieldlist[$field] == 'position') {
|
|
|
- $align = 'center';
|
|
|
- }
|
|
|
-
|
|
|
- if ($fieldlist[$field] == 'joinfiles') {
|
|
|
- $valuetoshow = $langs->trans("FilesAttachedToEmail"); $align = 'center'; $forcenowrap = 0;
|
|
|
- }
|
|
|
- if ($fieldlist[$field] == 'content') {
|
|
|
- $valuetoshow = $langs->trans("Content"); $showfield = 0;
|
|
|
- }
|
|
|
- if ($fieldlist[$field] == 'content_lines') {
|
|
|
- $valuetoshow = $langs->trans("ContentForLines"); $showfield = 0;
|
|
|
- }
|
|
|
-
|
|
|
- // Show fields
|
|
|
- if ($showfield) {
|
|
|
- if (!empty($tabhelp[$id][$value])) {
|
|
|
- if (in_array($value, array('topic'))) {
|
|
|
- $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value, $forcenowrap); // Tooltip on click
|
|
|
- } else {
|
|
|
- $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, '', $forcenowrap); // Tooltip on hover
|
|
|
- }
|
|
|
+ // Show fields
|
|
|
+ if ($showfield) {
|
|
|
+ if (!empty($tabhelp[$id][$value])) {
|
|
|
+ if (in_array($value, array('topic'))) {
|
|
|
+ $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, 'tooltip'.$value, $forcenowrap); // Tooltip on click
|
|
|
+ } else {
|
|
|
+ $valuetoshow = $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, '', $forcenowrap); // Tooltip on hover
|
|
|
}
|
|
|
- print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "align=".$align, $sortfield, $sortorder);
|
|
|
}
|
|
|
+ print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "align=".$align, $sortfield, $sortorder);
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
- print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder);
|
|
|
- print getTitleFieldOfList('');
|
|
|
- print '</tr>';
|
|
|
+print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder);
|
|
|
+print getTitleFieldOfList('');
|
|
|
+print '</tr>';
|
|
|
|
|
|
- if ($num) {
|
|
|
- // Lines with values
|
|
|
- while ($i < $num) {
|
|
|
- $obj = $db->fetch_object($resql);
|
|
|
+if ($num) {
|
|
|
+ $nbqualified = 0;
|
|
|
|
|
|
- if ($obj) {
|
|
|
- if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
|
|
|
- print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
|
|
+ // Lines with values
|
|
|
+ while ($i < $num) {
|
|
|
+ $obj = $db->fetch_object($resql);
|
|
|
|
|
|
- $tmpaction = 'edit';
|
|
|
- $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
|
|
- $reshook = $hookmanager->executeHooks('editEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
|
|
- $error = $hookmanager->error; $errors = $hookmanager->errors;
|
|
|
+ if ($obj) {
|
|
|
+ if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) {
|
|
|
+ print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
|
|
|
|
|
- // Show fields
|
|
|
- if (empty($reshook)) {
|
|
|
- fieldList($fieldlist, $obj, $tabname[$id], 'edit');
|
|
|
- }
|
|
|
+ $tmpaction = 'edit';
|
|
|
+ $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
|
|
+ $reshook = $hookmanager->executeHooks('editEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
|
|
+ $error = $hookmanager->error; $errors = $hookmanager->errors;
|
|
|
|
|
|
- print '<td></td><td></td><td></td>';
|
|
|
- print '<td class="center">';
|
|
|
- print '<input type="hidden" name="page" value="'.$page.'">';
|
|
|
- print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
|
|
- print '<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
|
|
- print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
|
|
|
- print '<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
|
|
- print '</td>';
|
|
|
-
|
|
|
- $fieldsforcontent = array('topic', 'joinfiles', 'content');
|
|
|
- if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
|
|
|
- $fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines');
|
|
|
- }
|
|
|
- foreach ($fieldsforcontent as $tmpfieldlist) {
|
|
|
- $showfield = 1;
|
|
|
- $align = "left";
|
|
|
- $valuetoshow = $obj->{$tmpfieldlist};
|
|
|
+ // Show fields
|
|
|
+ if (empty($reshook)) {
|
|
|
+ fieldList($fieldlist, $obj, $tabname[$id], 'edit');
|
|
|
+ }
|
|
|
|
|
|
- $class = 'tddict';
|
|
|
- // Show value for field
|
|
|
- if ($showfield) {
|
|
|
- // Show line for topic, joinfiles and content
|
|
|
- print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' ">';
|
|
|
- print '<td colspan="8">';
|
|
|
- if ($tmpfieldlist == 'topic') {
|
|
|
- print '<strong>'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
|
|
|
- print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
|
|
|
- }
|
|
|
- if ($tmpfieldlist == 'joinfiles') {
|
|
|
- print '<strong>'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
|
|
|
- print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
|
|
|
- }
|
|
|
- if ($tmpfieldlist == 'content') {
|
|
|
- print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
|
|
|
- $okforextended = true;
|
|
|
- if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
|
|
|
- $okforextended = false;
|
|
|
- }
|
|
|
- $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, true, $okforextended, ROWS_6, '90%');
|
|
|
- print $doleditor->Create(1);
|
|
|
- }
|
|
|
- if ($tmpfieldlist == 'content_lines') {
|
|
|
- print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
|
|
|
- $okforextended = true;
|
|
|
- if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
|
|
|
- $okforextended = false;
|
|
|
- $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
|
|
|
- print $doleditor->Create(1);
|
|
|
+ print '<td></td><td></td><td></td>';
|
|
|
+ print '<td class="center">';
|
|
|
+ print '<input type="hidden" name="page" value="'.$page.'">';
|
|
|
+ print '<input type="hidden" name="rowid" value="'.$rowid.'">';
|
|
|
+ print '<input type="submit" class="button buttongen button-save" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
|
|
+ print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
|
|
|
+ print '<input type="submit" class="button buttongen button-cancel" name="actioncancel" value="'.$langs->trans("Cancel").'">';
|
|
|
+ print '</td>';
|
|
|
+
|
|
|
+ $fieldsforcontent = array('topic', 'joinfiles', 'content');
|
|
|
+ if (!empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
|
|
|
+ $fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines');
|
|
|
+ }
|
|
|
+ foreach ($fieldsforcontent as $tmpfieldlist) {
|
|
|
+ $showfield = 1;
|
|
|
+ $align = "left";
|
|
|
+ $valuetoshow = $obj->{$tmpfieldlist};
|
|
|
+
|
|
|
+ $class = 'tddict';
|
|
|
+ // Show value for field
|
|
|
+ if ($showfield) {
|
|
|
+ // Show line for topic, joinfiles and content
|
|
|
+ print '</tr><tr class="oddeven" nohover tr-'.$tmpfieldlist.'-'.$rowid.' ">';
|
|
|
+ print '<td colspan="8">';
|
|
|
+ if ($tmpfieldlist == 'topic') {
|
|
|
+ print '<strong>'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
|
|
|
+ print '<input type="text" class="flat minwidth500" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
|
|
|
+ }
|
|
|
+ if ($tmpfieldlist == 'joinfiles') {
|
|
|
+ print '<strong>'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'</strong> ';
|
|
|
+ print '<input type="text" class="flat maxwidth50" name="'.$tmpfieldlist.'-'.$rowid.'" value="'.(!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : '').'">';
|
|
|
+ }
|
|
|
+ if ($tmpfieldlist == 'content') {
|
|
|
+ print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
|
|
|
+ $okforextended = true;
|
|
|
+ if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) {
|
|
|
+ $okforextended = false;
|
|
|
}
|
|
|
- print '</td>';
|
|
|
- print '<td></td>';
|
|
|
- print '<td></td>';
|
|
|
+ $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, true, $okforextended, ROWS_6, '90%');
|
|
|
+ print $doleditor->Create(1);
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- print "</tr>\n";
|
|
|
- } else {
|
|
|
- // If template is for a module, check module is enabled.
|
|
|
- if ($obj->module) {
|
|
|
- $tempmodulekey = $obj->module;
|
|
|
- if (empty($conf->$tempmodulekey) || empty($conf->$tempmodulekey->enabled)) {
|
|
|
- $i++;
|
|
|
- continue;
|
|
|
+ if ($tmpfieldlist == 'content_lines') {
|
|
|
+ print $form->textwithpicto($langs->trans("ContentForLines"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'<br>';
|
|
|
+ $okforextended = true;
|
|
|
+ if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
|
|
|
+ $okforextended = false;
|
|
|
+ $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
|
|
|
+ print $doleditor->Create(1);
|
|
|
}
|
|
|
+ print '</td>';
|
|
|
+ print '<td></td>';
|
|
|
+ print '<td></td>';
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- $keyforobj = 'type_template';
|
|
|
- if (!in_array($obj->$keyforobj, array_keys($elementList))) {
|
|
|
- $i++;
|
|
|
- continue; // It means this is a type of template not into elementList (may be because enabled condition of this type is false because module is not enabled)
|
|
|
- }
|
|
|
- // Test on 'enabled'
|
|
|
- if (!dol_eval($obj->enabled, 1, 1, '1')) {
|
|
|
+ print "</tr>\n";
|
|
|
+
|
|
|
+ $nbqualified++;
|
|
|
+ } else {
|
|
|
+ // If template is for a module, check module is enabled.
|
|
|
+ if ($obj->module) {
|
|
|
+ $tempmodulekey = $obj->module;
|
|
|
+ if (empty($conf->$tempmodulekey) || empty($conf->$tempmodulekey->enabled)) {
|
|
|
$i++;
|
|
|
- continue; // Email template not qualified
|
|
|
+ continue;
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
|
|
+ $keyforobj = 'type_template';
|
|
|
+ if (!in_array($obj->$keyforobj, array_keys($elementList))) {
|
|
|
+ $i++;
|
|
|
+ continue; // It means this is a type of template not into elementList (may be because enabled condition of this type is false because module is not enabled)
|
|
|
+ }
|
|
|
+ // Test on 'enabled'
|
|
|
+ if (!dol_eval($obj->enabled, 1, 1, '1')) {
|
|
|
+ $i++;
|
|
|
+ continue; // Email template not qualified
|
|
|
+ }
|
|
|
|
|
|
- $tmpaction = 'view';
|
|
|
- $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
|
|
- $reshook = $hookmanager->executeHooks('viewEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
|
|
+ $nbqualified++;
|
|
|
|
|
|
- $error = $hookmanager->error; $errors = $hookmanager->errors;
|
|
|
+ print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
|
|
|
|
|
- if (empty($reshook)) {
|
|
|
- foreach ($fieldlist as $field => $value) {
|
|
|
- if (in_array($fieldlist[$field], array('content', 'content_lines'))) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- $showfield = 1;
|
|
|
- $align = "";
|
|
|
- $class = "tddict";
|
|
|
- $title = '';
|
|
|
- $valuetoshow = $obj->{$fieldlist[$field]};
|
|
|
- if ($value == 'label' || $value == 'topic') {
|
|
|
- if ($langs->trans($valuetoshow) != $valuetoshow) {
|
|
|
- $valuetoshow = $langs->trans($valuetoshow);
|
|
|
- }
|
|
|
- $valuetoshow = dol_escape_htmltag($valuetoshow);
|
|
|
- }
|
|
|
- if ($value == 'label') {
|
|
|
- $class .= ' tdoverflowmax100';
|
|
|
- }
|
|
|
- if ($value == 'topic') {
|
|
|
- $class .= 'tdoverflowmax200 small';
|
|
|
- }
|
|
|
- if ($value == 'type_template') {
|
|
|
- $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
|
|
|
- $align = "center";
|
|
|
- }
|
|
|
- if ($value == 'lang' && $valuetoshow) {
|
|
|
- $valuetoshow = $valuetoshow.' - '.$langs->trans("Language_".$valuetoshow);
|
|
|
- }
|
|
|
- if ($value == 'fk_user') {
|
|
|
- if ($valuetoshow > 0) {
|
|
|
- $fuser = new User($db);
|
|
|
- $fuser->fetch($valuetoshow);
|
|
|
- $valuetoshow = $fuser->getNomUrl(1);
|
|
|
- }
|
|
|
- }
|
|
|
- if ($value == 'private') {
|
|
|
- $align = "center";
|
|
|
- if ($valuetoshow) {
|
|
|
- $valuetoshow = yn($valuetoshow);
|
|
|
- } else {
|
|
|
- $valuetoshow = '';
|
|
|
- }
|
|
|
+ $tmpaction = 'view';
|
|
|
+ $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
|
|
|
+ $reshook = $hookmanager->executeHooks('viewEmailTemplateFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
|
|
|
+
|
|
|
+ $error = $hookmanager->error; $errors = $hookmanager->errors;
|
|
|
+
|
|
|
+ if (empty($reshook)) {
|
|
|
+ foreach ($fieldlist as $field => $value) {
|
|
|
+ if (in_array($fieldlist[$field], array('content', 'content_lines'))) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $showfield = 1;
|
|
|
+ $align = "";
|
|
|
+ $class = "tddict";
|
|
|
+ $title = '';
|
|
|
+ $valuetoshow = $obj->{$fieldlist[$field]};
|
|
|
+ if ($value == 'label' || $value == 'topic') {
|
|
|
+ if ($langs->trans($valuetoshow) != $valuetoshow) {
|
|
|
+ $valuetoshow = $langs->trans($valuetoshow);
|
|
|
}
|
|
|
- if ($value == 'position') {
|
|
|
- $align = "center";
|
|
|
+ $valuetoshow = dol_escape_htmltag($valuetoshow);
|
|
|
+ }
|
|
|
+ if ($value == 'label') {
|
|
|
+ $class .= ' tdoverflowmax100';
|
|
|
+ }
|
|
|
+ if ($value == 'topic') {
|
|
|
+ $class .= 'tdoverflowmax200 small';
|
|
|
+ }
|
|
|
+ if ($value == 'type_template') {
|
|
|
+ $valuetoshow = isset($elementList[$valuetoshow]) ? $elementList[$valuetoshow] : $valuetoshow;
|
|
|
+ $align = "center";
|
|
|
+ }
|
|
|
+ if ($value == 'lang' && $valuetoshow) {
|
|
|
+ $valuetoshow = $valuetoshow.' - '.$langs->trans("Language_".$valuetoshow);
|
|
|
+ }
|
|
|
+ if ($value == 'fk_user') {
|
|
|
+ if ($valuetoshow > 0) {
|
|
|
+ $fuser = new User($db);
|
|
|
+ $fuser->fetch($valuetoshow);
|
|
|
+ $valuetoshow = $fuser->getNomUrl(1);
|
|
|
}
|
|
|
- if ($value == 'joinfiles') {
|
|
|
- $align = "center";
|
|
|
- if ($valuetoshow) {
|
|
|
- $valuetoshow = 1;
|
|
|
- } else {
|
|
|
- $valuetoshow = '';
|
|
|
- }
|
|
|
+ }
|
|
|
+ if ($value == 'private') {
|
|
|
+ $align = "center";
|
|
|
+ if ($valuetoshow) {
|
|
|
+ $valuetoshow = yn($valuetoshow);
|
|
|
+ } else {
|
|
|
+ $valuetoshow = '';
|
|
|
}
|
|
|
- if ($align) {
|
|
|
- $class .= ' '.$align;
|
|
|
+ }
|
|
|
+ if ($value == 'position') {
|
|
|
+ $align = "center";
|
|
|
+ }
|
|
|
+ if ($value == 'joinfiles') {
|
|
|
+ $align = "center";
|
|
|
+ if ($valuetoshow) {
|
|
|
+ $valuetoshow = 1;
|
|
|
+ } else {
|
|
|
+ $valuetoshow = '';
|
|
|
}
|
|
|
+ }
|
|
|
+ if ($align) {
|
|
|
+ $class .= ' '.$align;
|
|
|
+ }
|
|
|
|
|
|
- // Show value for field
|
|
|
- if ($showfield) {
|
|
|
- print '<!-- '.$fieldlist[$field].' -->';
|
|
|
- print '<td class="'.$class.'"';
|
|
|
- if (in_array($value, array('code', 'label', 'topic'))) {
|
|
|
- print ' title="'.dol_escape_htmltag($valuetoshow).'"';
|
|
|
- }
|
|
|
- print '>';
|
|
|
- print $valuetoshow;
|
|
|
- print '</td>';
|
|
|
+ // Show value for field
|
|
|
+ if ($showfield) {
|
|
|
+ print '<!-- '.$fieldlist[$field].' -->';
|
|
|
+ print '<td class="'.$class.'"';
|
|
|
+ if (in_array($value, array('code', 'label', 'topic'))) {
|
|
|
+ print ' title="'.dol_escape_htmltag($valuetoshow).'"';
|
|
|
}
|
|
|
+ print '>';
|
|
|
+ print $valuetoshow;
|
|
|
+ print '</td>';
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- // Can an entry be erased or disabled ?
|
|
|
- $iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
|
|
|
- if (!$user->admin && $obj->fk_user != $user->id) {
|
|
|
- $iserasable = 0;
|
|
|
- $canbedisabled = 0;
|
|
|
- $canbemodified = 0;
|
|
|
- }
|
|
|
-
|
|
|
- $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
|
|
|
- if ($param) {
|
|
|
- $url .= '&'.$param;
|
|
|
- }
|
|
|
+ // Can an entry be erased or disabled ?
|
|
|
+ $iserasable = 1; $canbedisabled = 1; $canbemodified = 1; // true by default
|
|
|
+ if (!$user->admin && $obj->fk_user != $user->id) {
|
|
|
+ $iserasable = 0;
|
|
|
+ $canbedisabled = 0;
|
|
|
+ $canbemodified = 0;
|
|
|
+ }
|
|
|
|
|
|
- // Status / Active
|
|
|
- print '<td class="center nowrap">';
|
|
|
- if ($canbedisabled) {
|
|
|
- print '<a href="'.$url.'&action='.$acts[$obj->active].'&token='.newToken().'">'.$actl[$obj->active].'</a>';
|
|
|
- } else {
|
|
|
- print '<span class="opacitymedium">'.$actl[$obj->active].'</span>';
|
|
|
- }
|
|
|
- print "</td>";
|
|
|
+ $url = $_SERVER["PHP_SELF"].'?'.($page ? 'page='.$page.'&' : '').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(!empty($obj->rowid) ? $obj->rowid : (!empty($obj->code) ? $obj->code : '')).'&code='.(!empty($obj->code) ?urlencode($obj->code) : '');
|
|
|
+ if ($param) {
|
|
|
+ $url .= '&'.$param;
|
|
|
+ }
|
|
|
|
|
|
- // Modify link / Delete link
|
|
|
- print '<td class="center nowraponall" width="64">';
|
|
|
- if ($canbemodified) {
|
|
|
- print '<a class="reposition editfielda" href="'.$url.'&action=edit&token='.newToken().'">'.img_edit().'</a>';
|
|
|
- }
|
|
|
- if ($iserasable) {
|
|
|
- print '<a class="marginleftonly" href="'.$url.'&action=delete&token='.newToken().'">'.img_delete().'</a>';
|
|
|
- //else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
|
|
- }
|
|
|
- print '</td>';
|
|
|
+ // Status / Active
|
|
|
+ print '<td class="center nowrap">';
|
|
|
+ if ($canbedisabled) {
|
|
|
+ print '<a href="'.$url.'&action='.$acts[$obj->active].'&token='.newToken().'">'.$actl[$obj->active].'</a>';
|
|
|
+ } else {
|
|
|
+ print '<span class="opacitymedium">'.$actl[$obj->active].'</span>';
|
|
|
+ }
|
|
|
+ print "</td>";
|
|
|
|
|
|
- print "</tr>\n";
|
|
|
+ // Modify link / Delete link
|
|
|
+ print '<td class="center nowraponall" width="64">';
|
|
|
+ if ($canbemodified) {
|
|
|
+ print '<a class="reposition editfielda" href="'.$url.'&action=edit&token='.newToken().'">'.img_edit().'</a>';
|
|
|
}
|
|
|
- }
|
|
|
+ if ($iserasable) {
|
|
|
+ print '<a class="marginleftonly" href="'.$url.'&action=delete&token='.newToken().'">'.img_delete().'</a>';
|
|
|
+ //else print '<a href="#">'.img_delete().'</a>'; // Some dictionary can be edited by other profile than admin
|
|
|
+ }
|
|
|
+ print '</td>';
|
|
|
|
|
|
- $i++;
|
|
|
+ print "</tr>\n";
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ $i++;
|
|
|
}
|
|
|
-} else {
|
|
|
- dol_print_error($db);
|
|
|
+}
|
|
|
+
|
|
|
+// If no record found
|
|
|
+if ($nbqualified == 0) {
|
|
|
+ $colspan = 10;
|
|
|
+ print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
|
|
}
|
|
|
|
|
|
print '</table>';
|