diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index bc7ea7c7072..ce0714d5651 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -304,7 +304,7 @@ if (empty($reshook)) { $search_lettering_code = ''; $search_not_reconciled = ''; $search_import_key = ''; - $toselect = ''; + $toselect = array(); } // Must be after the remove filter action, before the export. diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index cb8a2ee0517..80b2efe7050 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -259,7 +259,7 @@ if (empty($reshook)) { $search_lettering_code = ''; $search_not_reconciled = ''; $search_import_key = ''; - $toselect = ''; + $toselect = array(); } // Must be after the remove filter action, before the export. diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 9fa02f1c01b..c2ef4583bdc 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -215,7 +215,7 @@ if (empty($reshook)) { $search_status = ""; $catid = ""; $sall = ""; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index aed531d86b4..d96adbc3b82 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -135,7 +135,7 @@ if (empty($reshook)) { $search_note = ""; $search_amount = ""; $search_account = ""; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } } diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index 58a72250d64..088c84de3f0 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -101,7 +101,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $defaulturl = ''; $defaultkey = ''; $defaultvalue = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index d3441cf2e21..8e31d0e6d62 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -169,7 +169,7 @@ if (empty($reshook)) { foreach ($object->fields as $key => $val) { $search[$key] = ''; } - $toselect = ''; + $toselect = array(); $search_array_options = array(); } if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 30713d6da4a..d96e0706223 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -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 ''; + print ''; if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) { print ''.$valuetoshow.' '.img_help(1, $valuetoshow).''; } elseif (!empty($tabhelp[$id][$value])) { @@ -693,12 +744,12 @@ if ($action == 'add') { } else { print $valuetoshow; } - print ''; + print ''; } } - print ''; + print ''; print ''; - print ''; + print ''; print ''; $obj = new stdClass(); @@ -742,7 +793,7 @@ if ($action == 'add') { $fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines'); } foreach ($fieldsforcontent as $tmpfieldlist) { - print ''; + print ''; // Label if ($tmpfieldlist == 'topic') { @@ -773,24 +824,33 @@ if ($action == 'add') { print $doleditor->Create(1); } print ''; - if ($tmpfieldlist == 'topic') { - print ''; - if ($action != 'edit') { - print '
'; - print ''; - } - print ''; - } - // else print ''; print ''; } print ''; + + if ($action != 'edit') { + print '
'; + print ' '; + print ''; + print '
'; + } + print ''; print ''; - print '
'; + print '

'; } // 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 '
'; print ''; print ''; @@ -798,371 +858,375 @@ print ''; print ''; -// 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); - } +$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')); - } +$paramwithsearch = $param; +if ($sortorder) { + $paramwithsearch .= '&sortorder='.urlencode($sortorder); +} +if ($sortfield) { + $paramwithsearch .= '&sortfield='.urlencode($sortfield); +} +if (GETPOST('from', 'alpha')) { + $paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha')); +} - // There is several pages - if ($num > $listlimit) { - print ''; - } +// There is several pages +if ($num > $listlimit) { + print ''; +} - // Title line with search boxes - print ''; +// Title line with search boxes +print ''; - foreach ($fieldlist as $field => $value) { - if ($value == 'label') { - print ''; - } elseif ($value == 'lang') { - print ''; - } elseif ($value == 'fk_user') { - print ''; - } elseif ($value == 'topic') { - print ''; - } elseif ($value == 'type_template') { - print ''; - } elseif (!in_array($value, array('content', 'content_lines'))) { - print ''; - } - } - - if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { +foreach ($fieldlist as $field => $value) { + if ($value == 'label') { + print ''; + } elseif ($value == 'lang') { + print ''; + } elseif ($value == 'fk_user') { + print ''; + } elseif ($value == 'topic') { + print ''; + } elseif ($value == 'type_template') { + print ''; + } elseif (!in_array($value, array('content', 'content_lines'))) { print ''; } +} - // Action column - print ''; - print ''; +if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { + print ''; +} - // Title of lines - print ''; - 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'; - } +// Action column +print ''; +print ''; - 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 - } - } - print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable ? $fieldlist[$field] : ''), ($page ? 'page='.$page.'&' : ''), $param, "align=".$align, $sortfield, $sortorder); - } +// Title of lines +print ''; +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'; } - print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder); - print getTitleFieldOfList(''); - print ''; + 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; + } - if ($num) { - // Lines with values - while ($i < $num) { - $obj = $db->fetch_object($resql); + // 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); + } +} - if ($obj) { - if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) { - print ''; +print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder); +print getTitleFieldOfList(''); +print ''; - $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 ($num) { + $nbqualified = 0; - // Show fields - if (empty($reshook)) { - fieldList($fieldlist, $obj, $tabname[$id], 'edit'); - } + // Lines with values + while ($i < $num) { + $obj = $db->fetch_object($resql); - print ''; - print ''; + if ($obj) { + if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) { + print ''; - $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}; + $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; - $class = 'tddict'; - // Show value for field - if ($showfield) { - // Show line for topic, joinfiles and content - print ''; - print ''; - print ''; - print ''; + // Show fields + if (empty($reshook)) { + fieldList($fieldlist, $obj, $tabname[$id], 'edit'); + } + + print ''; + print ''; + + $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 ''; + print ''; + print ''; + print ''; } + } - print "\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++; + print "\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; + } + } + + $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 + } + + $nbqualified++; + + print ''; + + $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; } - } - - $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 - } - - print ''; - - $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); } - $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 = ''; - } - } - 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 ''; - print ''; + $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 = ''; + } + } + if ($value == 'position') { + $align = "center"; + } + if ($value == 'joinfiles') { + $align = "center"; + if ($valuetoshow) { + $valuetoshow = 1; + } else { + $valuetoshow = ''; + } + } + if ($align) { + $class .= ' '.$align; + } - // 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; + // Show value for field + if ($showfield) { + print ''; + print ''; + } } - - $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; - } - - // Status / Active - print '"; - - // Modify link / Delete link - print ''; - - print "\n"; } - } - $i++; + // 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; + } + + // Status / Active + print '"; + + // Modify link / Delete link + print ''; + + print "\n"; + } } + + $i++; } -} else { - dol_print_error($db); +} + +// If no record found +if ($nbqualified == 0) { + $colspan = 10; + print ''; } print '
'; - print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), ''); - print '
'; + print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), ''); + print '
'; - print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth150'); - print ''; - print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'maxwidth150'); - print ''; - print $form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'minwidth150', 1, '', 0, 1); - print ''; + print $formadmin->select_language($search_lang, 'search_lang', 0, null, 1, 0, 0, 'maxwidth150'); + print ''; + print $form->select_dolusers($search_fk_user, 'search_fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'maxwidth150'); + print ''; + print $form->selectarray('search_type_template', $elementList, $search_type_template, 1, 0, 0, '', 0, 0, 0, '', 'minwidth150', 1, '', 0, 1); + print ''; - $searchpicto = $form->showFilterButtons(); - print $searchpicto; - print '
'; +$searchpicto = $form->showFilterButtons(); +print $searchpicto; +print '
'; - print ''; - print ''; - print ''; - print '
'; - print ''; - print '
'; - if ($tmpfieldlist == 'topic') { - print ''.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' '; - print ''; - } - if ($tmpfieldlist == 'joinfiles') { - print ''.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' '; - print ''; - } - if ($tmpfieldlist == 'content') { - print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'
'; - $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).'
'; - $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 '
'; + print ''; + print ''; + print ''; + print '
'; + print ''; + print '
'; + if ($tmpfieldlist == 'topic') { + print ''.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' '; + print ''; } + if ($tmpfieldlist == 'joinfiles') { + print ''.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' '; + print ''; + } + if ($tmpfieldlist == 'content') { + print $form->textwithpicto($langs->trans("Content"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'
'; + $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).'
'; + $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 '
'; - print $valuetoshow; - print ''; + print $valuetoshow; + print ''; - if ($canbedisabled) { - print ''.$actl[$obj->active].''; - } else { - print ''.$actl[$obj->active].''; - } - print "'; - if ($canbemodified) { - print ''.img_edit().''; - } - if ($iserasable) { - print ''.img_delete().''; - //else print ''.img_delete().''; // Some dictionary can be edited by other profile than admin - } - print '
'; + if ($canbedisabled) { + print ''.$actl[$obj->active].''; + } else { + print ''.$actl[$obj->active].''; + } + print "'; + if ($canbemodified) { + print ''.img_edit().''; + } + if ($iserasable) { + print ''.img_delete().''; + //else print ''.img_delete().''; // Some dictionary can be edited by other profile than admin + } + print '
'.$langs->trans("NoRecordFound").'
'; diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 10f0f8375e3..18ce707c839 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -90,7 +90,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; 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 $transkey = ''; $transvalue = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 4698222bda8..4490b3897df 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -118,7 +118,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_ref = ''; $search_amount = ''; $search_showonlyerrors = 0; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index f6932cc4bef..86b8a3b5ce5 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -217,7 +217,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $dateend_dtstart = ''; $dateend_dtend = ''; $search_status = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index be458d41fe3..ecde836c428 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -103,7 +103,7 @@ if (empty($reshook)) { }*/ $search_ref = ''; $search_all = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 0056716972b..76c36a47733 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -340,7 +340,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_availability = ''; $search_status = ''; $object_statut = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); $search_categ_cus = 0; $search_fk_cond_reglement = ''; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index e1a08d47f3f..f8cdcdf456e 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -267,7 +267,7 @@ if (empty($reshook)) { $search_project = ''; $search_status = ''; $search_billed = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); $search_categ_cus = 0; $search_datecloture_start = ''; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 4d133c50dda..05b30d69668 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -214,7 +214,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_thirdparty_user = ''; $search_num_releve = ''; $search_conciliated = ''; - $toselect = ''; + $toselect = array(); $search_account = ""; if ($id > 0 || !empty($ref)) { diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 7822819c06a..2315f12757a 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -165,7 +165,7 @@ if (empty($reshook)) { $search[$key.'_dtend'] = ''; } } - $toselect = ''; + $toselect = array(); $search_array_options = array(); } if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index f3173b0ac22..2ef50801717 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -366,7 +366,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter', $search_fac_rec_source_title = ''; $option = ''; $filter = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); $search_categ_cus = 0; } diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index d2ed6b939c8..3d0698118ff 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -148,7 +148,7 @@ if (empty($reshook)) { $search_company = ''; $search_status = ''; $option = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } } diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index 77230bac407..43e9d5d4668 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -80,7 +80,7 @@ $result = restrictedArea($user, 'tax', '', 'chargesociales', 'charges'); // 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 $search_sc_type = ''; - //$toselect = ''; + //$toselect = array(); //$search_array_options = array(); } diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index cbcfa2b6efe..260e5bade41 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -203,7 +203,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_date_end = ''; $sall = ""; $search_status = ""; - $toselect = ''; + $toselect = array(); $search_type_thirdparty = ''; $search_array_options = array(); } diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index f12d48df44a..1f3ccf70f3a 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -201,7 +201,7 @@ if (empty($reshook)) { $filter_opcloture = ""; $mode = ''; $filter = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } } diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 9e2c45fd634..6f54229c993 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -234,7 +234,7 @@ class Ldap } } - if (is_resource($this->connection)) { + if (is_resource($this->connection) || is_object($this->connection)) { // Upgrade connexion to TLS, if requested by the configuration if (!empty($conf->global->LDAP_SERVER_USE_TLS)) { // For test/debug diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php index e349072ddec..1d24b058614 100644 --- a/htdocs/core/db/Database.interface.php +++ b/htdocs/core/db/Database.interface.php @@ -502,8 +502,8 @@ interface Database /** * Returns the current line (as an object) for the resultset cursor * - * @param resource $resultset Cursor of the desired request - * @return Object Object result line or false if KO or end of cursor + * @param resource|Connection $resultset Handler of the desired request + * @return Object Object result line or false if KO or end of cursor */ public function fetch_object($resultset); // phpcs:enable diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index 4ab7b4d65a1..5a2a1c1b753 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -584,7 +584,7 @@ class DoliDBPgsql extends DoliDB { // phpcs:enable // If resultset not provided, we take the last used by connexion - if (!is_resource($resultset)) { + if (!is_resource($resultset) && !is_object($resultset)) { $resultset = $this->_results; } return pg_fetch_object($resultset); @@ -601,7 +601,7 @@ class DoliDBPgsql extends DoliDB { // phpcs:enable // If resultset not provided, we take the last used by connexion - if (!is_resource($resultset)) { + if (!is_resource($resultset) && !is_object($resultset)) { $resultset = $this->_results; } return pg_fetch_array($resultset); @@ -618,7 +618,7 @@ class DoliDBPgsql extends DoliDB { // phpcs:enable // Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion - if (!is_resource($resultset)) { + if (!is_resource($resultset) && !is_object($resultset)) { $resultset = $this->_results; } return pg_fetch_row($resultset); @@ -636,7 +636,7 @@ class DoliDBPgsql extends DoliDB { // phpcs:enable // If resultset not provided, we take the last used by connexion - if (!is_resource($resultset)) { + if (!is_resource($resultset) && !is_object($resultset)) { $resultset = $this->_results; } return pg_num_rows($resultset); @@ -654,7 +654,7 @@ class DoliDBPgsql extends DoliDB { // phpcs:enable // If resultset not provided, we take the last used by connexion - if (!is_resource($resultset)) { + if (!is_resource($resultset) && !is_object($resultset)) { $resultset = $this->_results; } // pgsql necessite un resultset pour cette fonction contrairement @@ -672,11 +672,11 @@ class DoliDBPgsql extends DoliDB public function free($resultset = null) { // If resultset not provided, we take the last used by connexion - if (!is_resource($resultset)) { + if (!is_resource($resultset) && !is_object($resultset)) { $resultset = $this->_results; } // Si resultset en est un, on libere la memoire - if (is_resource($resultset)) { + if (is_resource($resultset) || is_object($resultset)) { pg_free_result($resultset); } } diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index 1d86bd19549..022186b8de1 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -260,7 +260,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) ** 53 - Account inactive (manually locked out by administrator) */ dol_syslog("functions_ldap::check_user_password_ldap Authentication KO failed to connect to LDAP for '".$usertotest."'", LOG_NOTICE); - if (is_resource($ldap->connection)) { // If connection ok but bind ko + if (is_resource($ldap->connection) || is_object($ldap->connection)) { // If connection ok but bind ko $ldap->ldapErrorCode = ldap_errno($ldap->connection); $ldap->ldapErrorText = ldap_error($ldap->connection); dol_syslog("functions_ldap::check_user_password_ldap ".$ldap->ldapErrorCode." ".$ldap->ldapErrorText); diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 7ee64ec2c6f..1072f68b48f 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -115,7 +115,7 @@ if (empty($reshook)) { $search_label = ''; $search_status = -1; $search_lastresult = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') diff --git a/htdocs/debugbar/class/TraceableDB.php b/htdocs/debugbar/class/TraceableDB.php index 2d9f70a1eb5..082e45e4f43 100644 --- a/htdocs/debugbar/class/TraceableDB.php +++ b/htdocs/debugbar/class/TraceableDB.php @@ -684,10 +684,10 @@ class TraceableDB extends DoliDB // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Renvoie la ligne courante (comme un objet) pour le curseur resultset + * Returns the current line (as an object) for the resultset cursor * - * @param resource $resultset Curseur de la requete voulue - * @return Object Object result line or false if KO or end of cursor + * @param resource|Connection $resultset Handler of the desired SQL request + * @return Object Object result line or false if KO or end of cursor */ public function fetch_object($resultset) { diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index bea241b0266..88dad1bbac0 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -205,7 +205,7 @@ if (empty($reshook)) { $search[$key.'_dtend'] = ''; } } - $toselect = ''; + $toselect = array(); $search_array_options = array(); } if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index be24d7b6797..ee7fe97421a 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -206,7 +206,7 @@ if (empty($reshook)) { $search[$key.'_dtend'] = ''; } } - $toselect = ''; + $toselect = array(); $search_array_options = array(); } if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 7ae586020c6..6b67f419da5 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -196,7 +196,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_datereceipt_start = ''; $search_datereceipt_end = ''; $search_status = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); $search_categ_cus = 0; } diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index ab763dc8a11..551957d0a69 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -224,7 +224,7 @@ if (empty($reshook)) { $search_date_endendyear = ''; $search_date_end = ''; $search_date_endend = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 9ec00d62b8e..f0e028ea92f 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -171,7 +171,7 @@ if (empty($reshook)) { $search_contrat_ref = ""; $search_desc = ""; $search_status = ""; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 98df5e11170..224a36e4acd 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -291,7 +291,7 @@ if (empty($reshook)) { $search_date_approve_end = ''; $billed = ''; $search_billed = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index bc0e80e9f69..09b8ab43a05 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -290,7 +290,7 @@ if (empty($reshook)) { $search_datelimit_endyear = ''; $search_datelimit_start = ''; $search_datelimit_end = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); $filter = ''; $option = ''; diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index a20e586e2ee..2665f987a10 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -108,7 +108,7 @@ if (empty($reshook)) { $search_field2 = ''; $search_date_creation = ''; $search_date_update = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } } diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 12a32ba3f50..dedc7d1da0f 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -111,7 +111,7 @@ if (empty($reshook)) { 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 $search_name = ''; $search_supervisor = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index efafac7f823..5dc05d1c617 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -200,7 +200,7 @@ if (empty($reshook)) { $search_valideur = ""; $search_status = ""; $search_type = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index e76d316bf6c..67c860e6f70 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -95,7 +95,7 @@ if (empty($reshook)) { $search_employee = ''; $search_type = ''; $search_description = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } diff --git a/htdocs/holiday/view_log.php b/htdocs/holiday/view_log.php index 1a621d55a98..7dffc0adbfe 100644 --- a/htdocs/holiday/view_log.php +++ b/htdocs/holiday/view_log.php @@ -133,7 +133,7 @@ if (empty($reshook)) { $search_type = ''; $search_prev_solde = ''; $search_new_solde = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } diff --git a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql index 4c9d85dc1dd..1e1394a98d8 100644 --- a/htdocs/install/mysql/migration/15.0.0-16.0.0.sql +++ b/htdocs/install/mysql/migration/15.0.0-16.0.0.sql @@ -346,3 +346,9 @@ ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN firstname ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN lastname varchar(100); ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN email_company varchar(128) after email; + +ALTER TABLE llx_c_email_template ADD COLUMN email_from varchar(255); +ALTER TABLE llx_c_email_template ADD COLUMN email_to varchar(255); +ALTER TABLE llx_c_email_template ADD COLUMN email_tocc varchar(255); +ALTER TABLE llx_c_email_template ADD COLUMN email_tobcc varchar(255); + diff --git a/htdocs/install/mysql/tables/llx_c_email_templates.sql b/htdocs/install/mysql/tables/llx_c_email_templates.sql index 04130a208fe..4d22767bc58 100644 --- a/htdocs/install/mysql/tables/llx_c_email_templates.sql +++ b/htdocs/install/mysql/tables/llx_c_email_templates.sql @@ -32,6 +32,10 @@ create table llx_c_email_templates position smallint, -- Position enabled varchar(255) DEFAULT '1', -- Condition to have this module visible active tinyint DEFAULT 1 NOT NULL, + email_from varchar(255), -- default email from + email_to varchar(255), -- default email to + email_tocc varchar(255), -- default email to cc + email_tobcc varchar(255), -- default email to bcc topic text, -- Predefined topic joinfiles text, -- Files to attach content mediumtext, -- Predefined text diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index feadd8d9800..b644546d8b9 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -189,7 +189,7 @@ if (empty($reshook)) { $search[$key.'_dtend'] = ''; } } - $toselect = ''; + $toselect = array(); $search_array_options = array(); } if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') diff --git a/htdocs/mrp/mo_movements.php b/htdocs/mrp/mo_movements.php index 10e430479cf..7bb040abe1f 100644 --- a/htdocs/mrp/mo_movements.php +++ b/htdocs/mrp/mo_movements.php @@ -193,7 +193,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_batch = ""; $search_qty = ''; $sall = ""; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index b0fafc9e357..0e22c524529 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -137,7 +137,7 @@ if (empty($reshook)) { $search_status = ''; $search_title = ''; $search_ref = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') diff --git a/htdocs/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index 2eaa8cc5dd2..42d4354516e 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -185,7 +185,7 @@ if (empty($reshook)) { $search[$key.'_dtend'] = ''; } } - $toselect = ''; + $toselect = array(); $search_array_options = array(); $search_filter = ""; } diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index abcc5f7da42..e31420b7f21 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -161,7 +161,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_batch = ""; $search_qty = ''; $sall = ""; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 73c6751262a..2ad77fca49e 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -223,7 +223,7 @@ if (empty($reshook)) { $search_qty = ''; $search_fk_projet=0; $sall = ""; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index 74abbad9140..565b309b113 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -168,7 +168,7 @@ if (empty($reshook)) { foreach ($object->fields as $key => $val) { $search[$key] = ''; } - $toselect = ''; + $toselect = array(); $search_array_options = array(); } if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 6ec329c41f4..0d5c4964003 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -285,7 +285,7 @@ if (empty($reshook)) { $search_accept_booth_suggestions = ''; $search_price_registration = ''; $search_price_booth = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); $search_category_array = array(); } diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 364fcfe49f1..aabca026f20 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -209,7 +209,7 @@ if (empty($reshook)) { $search_progresscalc = ''; $search_progressdeclare = ''; $search_task_budget_amount = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); $search_date_start_startmonth = ""; $search_date_start_startyear = ""; diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 4374ffb2d37..aab0fb8dbcf 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -164,7 +164,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_task_label = ''; $search_user = 0; $search_valuebilled = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); $action = ''; } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 5884679950f..746b4dc0db0 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -365,7 +365,7 @@ if (empty($reshook)) { $search_level = ''; $search_parent_name = ''; $search_import_key = ''; - $toselect = ''; + $toselect = array(); $search_array_options = array(); } diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 974b3d9b891..2d346282c4c 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -144,7 +144,7 @@ if (empty($reshook)) { foreach ($objectwebsiteaccount->fields as $key => $val) { $search[$key] = ''; } - $toselect = ''; + $toselect = array(); $search_array_options = array(); } if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')