Debug for php 8.1

This commit is contained in:
Laurent Destailleur 2022-05-08 18:25:22 +02:00
parent f52a7a26f6
commit 6592eb5d73
52 changed files with 519 additions and 445 deletions

View File

@ -304,7 +304,7 @@ if (empty($reshook)) {
$search_lettering_code = ''; $search_lettering_code = '';
$search_not_reconciled = ''; $search_not_reconciled = '';
$search_import_key = ''; $search_import_key = '';
$toselect = ''; $toselect = array();
} }
// Must be after the remove filter action, before the export. // Must be after the remove filter action, before the export.

View File

@ -259,7 +259,7 @@ if (empty($reshook)) {
$search_lettering_code = ''; $search_lettering_code = '';
$search_not_reconciled = ''; $search_not_reconciled = '';
$search_import_key = ''; $search_import_key = '';
$toselect = ''; $toselect = array();
} }
// Must be after the remove filter action, before the export. // Must be after the remove filter action, before the export.

View File

@ -215,7 +215,7 @@ if (empty($reshook)) {
$search_status = ""; $search_status = "";
$catid = ""; $catid = "";
$sall = ""; $sall = "";
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }

View File

@ -135,7 +135,7 @@ if (empty($reshook)) {
$search_note = ""; $search_note = "";
$search_amount = ""; $search_amount = "";
$search_account = ""; $search_account = "";
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }
} }

View File

@ -101,7 +101,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$defaulturl = ''; $defaulturl = '';
$defaultkey = ''; $defaultkey = '';
$defaultvalue = ''; $defaultvalue = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }

View File

@ -169,7 +169,7 @@ if (empty($reshook)) {
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
$search[$key] = ''; $search[$key] = '';
} }
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')

View File

@ -66,10 +66,6 @@ $search_lang = GETPOST('search_lang', 'alpha');
$search_fk_user = GETPOST('search_fk_user', 'intcomma'); $search_fk_user = GETPOST('search_fk_user', 'intcomma');
$search_topic = GETPOST('search_topic', 'alpha'); $search_topic = GETPOST('search_topic', 'alpha');
if (!empty($user->socid)) {
accessforbidden();
}
$acts = array(); $acts = array();
$actl = array(); $actl = array();
$acts[0] = "activate"; $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 // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('emailtemplates')); $hookmanager->initHooks(array('emailtemplates'));
// Name of SQL tables of dictionaries // Name of SQL tables of dictionaries
$tabname = array(); $tabname = array();
$tabname[25] = MAIN_DB_PREFIX."c_email_templates"; $tabname[25] = MAIN_DB_PREFIX."c_email_templates";
@ -246,6 +243,12 @@ if ($reshook == 0) {
} }
} }
if (!empty($user->socid)) {
accessforbidden();
}
$permissiontoadd = 1; $permissiontoadd = 1;
//asort($elementList); //asort($elementList);
@ -273,6 +276,9 @@ if ($reshook < 0) {
} }
if (empty($reshook)) { if (empty($reshook)) {
// Selection of new fields
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
// Purge search criteria // Purge search criteria
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { 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 // All tests are required to be compatible with all browsers
@ -281,7 +287,7 @@ if (empty($reshook)) {
$search_lang = ''; $search_lang = '';
$search_fk_user = ''; $search_fk_user = '';
$search_topic = ''; $search_topic = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }
@ -395,7 +401,7 @@ if (empty($reshook)) {
} }
} elseif ($keycode == 'content') { } elseif ($keycode == 'content') {
$sql .= "'".$db->escape(GETPOST($keycode, 'restricthtml'))."'"; $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'); $sql .= (int) GETPOST($keycode, 'int');
} else { } else {
$sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'"; $sql .= "'".$db->escape(GETPOST($keycode, 'nohtml'))."'";
@ -502,7 +508,7 @@ if (empty($reshook)) {
if ($action == 'confirm_delete' && $confirm == 'yes') { // delete if ($action == 'confirm_delete' && $confirm == 'yes') { // delete
$rowidcol = "rowid"; $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 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);
} }
@ -548,47 +554,20 @@ if (empty($reshook)) {
*/ */
$form = new Form($db); $form = new Form($db);
$now = dol_now();
$formadmin = new FormAdmin($db); $formadmin = new FormAdmin($db);
//$help_url = "EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject";
$help_url = ''; $help_url = '';
if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) { if (!empty($user->admin) && (empty($_SESSION['leftmenu']) || $_SESSION['leftmenu'] != 'email_templates')) {
$title = $langs->trans("EMailsSetup"); $title = $langs->trans("EMailsSetup");
} else { } else {
$title = $langs->trans("EMailTemplates"); $title = $langs->trans("EMailTemplates");
} }
$morejs = array();
llxHeader('', $title, $help_url); $morecss = array();
$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);
}
$sql = "SELECT rowid as rowid, module, label, type_template, lang, fk_user, private, position, topic, joinfiles, content_lines, content, enabled, active"; $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"; $sql .= " FROM ".MAIN_DB_PREFIX."c_email_templates";
@ -623,6 +602,78 @@ $sql .= $db->order($sortfield, $sortorder);
$sql .= $db->plimit($listlimit + 1, $offset); $sql .= $db->plimit($listlimit + 1, $offset);
//print $sql; //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]); $fieldlist = explode(',', $tabfield[$id]);
if ($action == 'add') { if ($action == 'add') {
@ -681,7 +732,7 @@ if ($action == 'add') {
} }
if ($valuetoshow != '') { if ($valuetoshow != '') {
print '<td class="'.$align.'">'; print '<th class="'.$align.'">';
if (!empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i', $tabhelp[$id][$value])) { 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>'; print '<a href="'.$tabhelp[$id][$value].'" target="_blank" rel="noopener noreferrer">'.$valuetoshow.' '.img_help(1, $valuetoshow).'</a>';
} elseif (!empty($tabhelp[$id][$value])) { } elseif (!empty($tabhelp[$id][$value])) {
@ -693,12 +744,12 @@ if ($action == 'add') {
} else { } else {
print $valuetoshow; print $valuetoshow;
} }
print '</td>'; print '</th>';
} }
} }
print '<td>'; print '<th>';
print '<input type="hidden" name="id" value="'.$id.'">'; print '<input type="hidden" name="id" value="'.$id.'">';
print '</td>'; print '</th>';
print '</tr>'; print '</tr>';
$obj = new stdClass(); $obj = new stdClass();
@ -742,7 +793,7 @@ if ($action == 'add') {
$fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines'); $fieldsforcontent = array('topic', 'joinfiles', 'content', 'content_lines');
} }
foreach ($fieldsforcontent as $tmpfieldlist) { 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 // Label
if ($tmpfieldlist == 'topic') { if ($tmpfieldlist == 'topic') {
@ -773,24 +824,33 @@ if ($action == 'add') {
print $doleditor->Create(1); print $doleditor->Create(1);
} }
print '</td>'; 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 '</tr>';
} }
print '</table>'; 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 '</div>';
print '</form>'; print '</form>';
print '<br>'; print '<br><br>';
} // END IF not edit } // 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 '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">'; print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from', 'alpha')).'">';
@ -798,53 +858,48 @@ print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('fro
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
// List of available record in database $i = 0;
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$param = '&id='.$id; $param = '&id='.$id;
if ($search_label) { if ($search_label) {
$param .= '&search_label='.urlencode($search_label); $param .= '&search_label='.urlencode($search_label);
} }
if ($search_lang > 0) { if ($search_lang > 0) {
$param .= '&search_lang='.urlencode($search_lang); $param .= '&search_lang='.urlencode($search_lang);
} }
if ($search_type_template != '-1') { if ($search_type_template != '-1') {
$param .= '&search_type_template='.urlencode($search_type_template); $param .= '&search_type_template='.urlencode($search_type_template);
} }
if ($search_fk_user > 0) { if ($search_fk_user > 0) {
$param .= '&search_fk_user='.urlencode($search_fk_user); $param .= '&search_fk_user='.urlencode($search_fk_user);
} }
if ($search_topic) { if ($search_topic) {
$param .= '&search_topic='.urlencode($search_topic); $param .= '&search_topic='.urlencode($search_topic);
} }
$paramwithsearch = $param; $paramwithsearch = $param;
if ($sortorder) { if ($sortorder) {
$paramwithsearch .= '&sortorder='.urlencode($sortorder); $paramwithsearch .= '&sortorder='.urlencode($sortorder);
} }
if ($sortfield) { if ($sortfield) {
$paramwithsearch .= '&sortfield='.urlencode($sortfield); $paramwithsearch .= '&sortfield='.urlencode($sortfield);
} }
if (GETPOST('from', 'alpha')) { if (GETPOST('from', 'alpha')) {
$paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha')); $paramwithsearch .= '&from='.urlencode(GETPOST('from', 'alpha'));
} }
// There is several pages // There is several pages
if ($num > $listlimit) { if ($num > $listlimit) {
print '<tr class="none"><td class="right" colspan="'.(3 + count($fieldlist)).'">'; 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_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page + 1).'</span></li>');
print '</td></tr>'; print '</td></tr>';
} }
// Title line with search boxes // Title line with search boxes
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value) { foreach ($fieldlist as $field => $value) {
if ($value == 'label') { if ($value == 'label') {
print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth200" value="'.dol_escape_htmltag($search_label).'"></td>'; print '<td class="liste_titre"><input type="text" name="search_label" class="maxwidth200" value="'.dol_escape_htmltag($search_label).'"></td>';
} elseif ($value == 'lang') { } elseif ($value == 'lang') {
@ -864,22 +919,22 @@ if ($resql) {
} elseif (!in_array($value, array('content', 'content_lines'))) { } elseif (!in_array($value, array('content', 'content_lines'))) {
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
} }
} }
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) { if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) {
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
} }
// Action column // Action column
print '<td class="liste_titre right" width="64">'; print '<td class="liste_titre right" width="64">';
$searchpicto = $form->showFilterButtons(); $searchpicto = $form->showFilterButtons();
print $searchpicto; print $searchpicto;
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Title of lines // Title of lines
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value) { foreach ($fieldlist as $field => $value) {
$showfield = 1; // By defaut $showfield = 1; // By defaut
$align = "left"; $align = "left";
$sortable = 1; $sortable = 1;
@ -938,13 +993,15 @@ if ($resql) {
} }
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($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page ? 'page='.$page.'&' : ''), $param, 'align="center"', $sortfield, $sortorder);
print getTitleFieldOfList(''); print getTitleFieldOfList('');
print '</tr>'; print '</tr>';
if ($num) {
$nbqualified = 0;
if ($num) {
// Lines with values // Lines with values
while ($i < $num) { while ($i < $num) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@ -1019,6 +1076,8 @@ if ($resql) {
} }
print "</tr>\n"; print "</tr>\n";
$nbqualified++;
} else { } else {
// If template is for a module, check module is enabled. // If template is for a module, check module is enabled.
if ($obj->module) { if ($obj->module) {
@ -1040,6 +1099,8 @@ if ($resql) {
continue; // Email template not qualified continue; // Email template not qualified
} }
$nbqualified++;
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">'; print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
$tmpaction = 'view'; $tmpaction = 'view';
@ -1160,9 +1221,12 @@ if ($resql) {
$i++; $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>'; print '</table>';

View File

@ -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 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 = ''; $transkey = '';
$transvalue = ''; $transvalue = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }

View File

@ -118,7 +118,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_ref = ''; $search_ref = '';
$search_amount = ''; $search_amount = '';
$search_showonlyerrors = 0; $search_showonlyerrors = 0;
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }

View File

@ -217,7 +217,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$dateend_dtstart = ''; $dateend_dtstart = '';
$dateend_dtend = ''; $dateend_dtend = '';
$search_status = ''; $search_status = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }

View File

@ -103,7 +103,7 @@ if (empty($reshook)) {
}*/ }*/
$search_ref = ''; $search_ref = '';
$search_all = ''; $search_all = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')

View File

@ -340,7 +340,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_availability = ''; $search_availability = '';
$search_status = ''; $search_status = '';
$object_statut = ''; $object_statut = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
$search_categ_cus = 0; $search_categ_cus = 0;
$search_fk_cond_reglement = ''; $search_fk_cond_reglement = '';

View File

@ -267,7 +267,7 @@ if (empty($reshook)) {
$search_project = ''; $search_project = '';
$search_status = ''; $search_status = '';
$search_billed = ''; $search_billed = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
$search_categ_cus = 0; $search_categ_cus = 0;
$search_datecloture_start = ''; $search_datecloture_start = '';

View File

@ -214,7 +214,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_thirdparty_user = ''; $search_thirdparty_user = '';
$search_num_releve = ''; $search_num_releve = '';
$search_conciliated = ''; $search_conciliated = '';
$toselect = ''; $toselect = array();
$search_account = ""; $search_account = "";
if ($id > 0 || !empty($ref)) { if ($id > 0 || !empty($ref)) {

View File

@ -165,7 +165,7 @@ if (empty($reshook)) {
$search[$key.'_dtend'] = ''; $search[$key.'_dtend'] = '';
} }
} }
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')

View File

@ -366,7 +366,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
$search_fac_rec_source_title = ''; $search_fac_rec_source_title = '';
$option = ''; $option = '';
$filter = ''; $filter = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
$search_categ_cus = 0; $search_categ_cus = 0;
} }

View File

@ -148,7 +148,7 @@ if (empty($reshook)) {
$search_company = ''; $search_company = '';
$search_status = ''; $search_status = '';
$option = ''; $option = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }
} }

View File

@ -80,7 +80,7 @@ $result = restrictedArea($user, 'tax', '', 'chargesociales', 'charges');
// Purge search criteria // 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 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 = ''; $search_sc_type = '';
//$toselect = ''; //$toselect = array();
//$search_array_options = array(); //$search_array_options = array();
} }

View File

@ -203,7 +203,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_date_end = ''; $search_date_end = '';
$sall = ""; $sall = "";
$search_status = ""; $search_status = "";
$toselect = ''; $toselect = array();
$search_type_thirdparty = ''; $search_type_thirdparty = '';
$search_array_options = array(); $search_array_options = array();
} }

View File

@ -201,7 +201,7 @@ if (empty($reshook)) {
$filter_opcloture = ""; $filter_opcloture = "";
$mode = ''; $mode = '';
$filter = ''; $filter = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }
} }

View File

@ -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 // Upgrade connexion to TLS, if requested by the configuration
if (!empty($conf->global->LDAP_SERVER_USE_TLS)) { if (!empty($conf->global->LDAP_SERVER_USE_TLS)) {
// For test/debug // For test/debug

View File

@ -502,7 +502,7 @@ interface Database
/** /**
* Returns the current line (as an object) for the resultset cursor * Returns the current line (as an object) for the resultset cursor
* *
* @param resource $resultset Cursor of the desired request * @param resource|Connection $resultset Handler of the desired request
* @return Object Object result line or false if KO or end of cursor * @return Object Object result line or false if KO or end of cursor
*/ */
public function fetch_object($resultset); public function fetch_object($resultset);

View File

@ -584,7 +584,7 @@ class DoliDBPgsql extends DoliDB
{ {
// phpcs:enable // phpcs:enable
// If resultset not provided, we take the last used by connexion // 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; $resultset = $this->_results;
} }
return pg_fetch_object($resultset); return pg_fetch_object($resultset);
@ -601,7 +601,7 @@ class DoliDBPgsql extends DoliDB
{ {
// phpcs:enable // phpcs:enable
// If resultset not provided, we take the last used by connexion // 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; $resultset = $this->_results;
} }
return pg_fetch_array($resultset); return pg_fetch_array($resultset);
@ -618,7 +618,7 @@ class DoliDBPgsql extends DoliDB
{ {
// phpcs:enable // phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion // 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; $resultset = $this->_results;
} }
return pg_fetch_row($resultset); return pg_fetch_row($resultset);
@ -636,7 +636,7 @@ class DoliDBPgsql extends DoliDB
{ {
// phpcs:enable // phpcs:enable
// If resultset not provided, we take the last used by connexion // 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; $resultset = $this->_results;
} }
return pg_num_rows($resultset); return pg_num_rows($resultset);
@ -654,7 +654,7 @@ class DoliDBPgsql extends DoliDB
{ {
// phpcs:enable // phpcs:enable
// If resultset not provided, we take the last used by connexion // 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; $resultset = $this->_results;
} }
// pgsql necessite un resultset pour cette fonction contrairement // pgsql necessite un resultset pour cette fonction contrairement
@ -672,11 +672,11 @@ class DoliDBPgsql extends DoliDB
public function free($resultset = null) public function free($resultset = null)
{ {
// If resultset not provided, we take the last used by connexion // 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; $resultset = $this->_results;
} }
// Si resultset en est un, on libere la memoire // Si resultset en est un, on libere la memoire
if (is_resource($resultset)) { if (is_resource($resultset) || is_object($resultset)) {
pg_free_result($resultset); pg_free_result($resultset);
} }
} }

View File

@ -260,7 +260,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest)
** 53 - Account inactive (manually locked out by administrator) ** 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); 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->ldapErrorCode = ldap_errno($ldap->connection);
$ldap->ldapErrorText = ldap_error($ldap->connection); $ldap->ldapErrorText = ldap_error($ldap->connection);
dol_syslog("functions_ldap::check_user_password_ldap ".$ldap->ldapErrorCode." ".$ldap->ldapErrorText); dol_syslog("functions_ldap::check_user_password_ldap ".$ldap->ldapErrorCode." ".$ldap->ldapErrorText);

View File

@ -115,7 +115,7 @@ if (empty($reshook)) {
$search_label = ''; $search_label = '';
$search_status = -1; $search_status = -1;
$search_lastresult = ''; $search_lastresult = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')

View File

@ -684,9 +684,9 @@ class TraceableDB extends DoliDB
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // 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 * @param resource|Connection $resultset Handler of the desired SQL request
* @return Object Object result line or false if KO or end of cursor * @return Object Object result line or false if KO or end of cursor
*/ */
public function fetch_object($resultset) public function fetch_object($resultset)

View File

@ -205,7 +205,7 @@ if (empty($reshook)) {
$search[$key.'_dtend'] = ''; $search[$key.'_dtend'] = '';
} }
} }
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')

View File

@ -206,7 +206,7 @@ if (empty($reshook)) {
$search[$key.'_dtend'] = ''; $search[$key.'_dtend'] = '';
} }
} }
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')

View File

@ -196,7 +196,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_datereceipt_start = ''; $search_datereceipt_start = '';
$search_datereceipt_end = ''; $search_datereceipt_end = '';
$search_status = ''; $search_status = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
$search_categ_cus = 0; $search_categ_cus = 0;
} }

View File

@ -224,7 +224,7 @@ if (empty($reshook)) {
$search_date_endendyear = ''; $search_date_endendyear = '';
$search_date_end = ''; $search_date_end = '';
$search_date_endend = ''; $search_date_endend = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')

View File

@ -171,7 +171,7 @@ if (empty($reshook)) {
$search_contrat_ref = ""; $search_contrat_ref = "";
$search_desc = ""; $search_desc = "";
$search_status = ""; $search_status = "";
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }

View File

@ -291,7 +291,7 @@ if (empty($reshook)) {
$search_date_approve_end = ''; $search_date_approve_end = '';
$billed = ''; $billed = '';
$search_billed = ''; $search_billed = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')

View File

@ -290,7 +290,7 @@ if (empty($reshook)) {
$search_datelimit_endyear = ''; $search_datelimit_endyear = '';
$search_datelimit_start = ''; $search_datelimit_start = '';
$search_datelimit_end = ''; $search_datelimit_end = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
$filter = ''; $filter = '';
$option = ''; $option = '';

View File

@ -108,7 +108,7 @@ if (empty($reshook)) {
$search_field2 = ''; $search_field2 = '';
$search_date_creation = ''; $search_date_creation = '';
$search_date_update = ''; $search_date_update = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }
} }

View File

@ -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 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_name = '';
$search_supervisor = ''; $search_supervisor = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }

View File

@ -200,7 +200,7 @@ if (empty($reshook)) {
$search_valideur = ""; $search_valideur = "";
$search_status = ""; $search_status = "";
$search_type = ''; $search_type = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')

View File

@ -95,7 +95,7 @@ if (empty($reshook)) {
$search_employee = ''; $search_employee = '';
$search_type = ''; $search_type = '';
$search_description = ''; $search_description = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }

View File

@ -133,7 +133,7 @@ if (empty($reshook)) {
$search_type = ''; $search_type = '';
$search_prev_solde = ''; $search_prev_solde = '';
$search_new_solde = ''; $search_new_solde = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }

View File

@ -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 lastname varchar(100);
ALTER TABLE llx_eventorganization_conferenceorboothattendee ADD COLUMN email_company varchar(128) after email; 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);

View File

@ -32,6 +32,10 @@ create table llx_c_email_templates
position smallint, -- Position position smallint, -- Position
enabled varchar(255) DEFAULT '1', -- Condition to have this module visible enabled varchar(255) DEFAULT '1', -- Condition to have this module visible
active tinyint DEFAULT 1 NOT NULL, 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 topic text, -- Predefined topic
joinfiles text, -- Files to attach joinfiles text, -- Files to attach
content mediumtext, -- Predefined text content mediumtext, -- Predefined text

View File

@ -189,7 +189,7 @@ if (empty($reshook)) {
$search[$key.'_dtend'] = ''; $search[$key.'_dtend'] = '';
} }
} }
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')

View File

@ -193,7 +193,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_batch = ""; $search_batch = "";
$search_qty = ''; $search_qty = '';
$sall = ""; $sall = "";
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }

View File

@ -137,7 +137,7 @@ if (empty($reshook)) {
$search_status = ''; $search_status = '';
$search_title = ''; $search_title = '';
$search_ref = ''; $search_ref = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')

View File

@ -185,7 +185,7 @@ if (empty($reshook)) {
$search[$key.'_dtend'] = ''; $search[$key.'_dtend'] = '';
} }
} }
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
$search_filter = ""; $search_filter = "";
} }

View File

@ -161,7 +161,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_batch = ""; $search_batch = "";
$search_qty = ''; $search_qty = '';
$sall = ""; $sall = "";
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }

View File

@ -223,7 +223,7 @@ if (empty($reshook)) {
$search_qty = ''; $search_qty = '';
$search_fk_projet=0; $search_fk_projet=0;
$sall = ""; $sall = "";
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')

View File

@ -168,7 +168,7 @@ if (empty($reshook)) {
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
$search[$key] = ''; $search[$key] = '';
} }
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')

View File

@ -285,7 +285,7 @@ if (empty($reshook)) {
$search_accept_booth_suggestions = ''; $search_accept_booth_suggestions = '';
$search_price_registration = ''; $search_price_registration = '';
$search_price_booth = ''; $search_price_booth = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
$search_category_array = array(); $search_category_array = array();
} }

View File

@ -209,7 +209,7 @@ if (empty($reshook)) {
$search_progresscalc = ''; $search_progresscalc = '';
$search_progressdeclare = ''; $search_progressdeclare = '';
$search_task_budget_amount = ''; $search_task_budget_amount = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
$search_date_start_startmonth = ""; $search_date_start_startmonth = "";
$search_date_start_startyear = ""; $search_date_start_startyear = "";

View File

@ -164,7 +164,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
$search_task_label = ''; $search_task_label = '';
$search_user = 0; $search_user = 0;
$search_valuebilled = ''; $search_valuebilled = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
$action = ''; $action = '';
} }

View File

@ -365,7 +365,7 @@ if (empty($reshook)) {
$search_level = ''; $search_level = '';
$search_parent_name = ''; $search_parent_name = '';
$search_import_key = ''; $search_import_key = '';
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }

View File

@ -144,7 +144,7 @@ if (empty($reshook)) {
foreach ($objectwebsiteaccount->fields as $key => $val) { foreach ($objectwebsiteaccount->fields as $key => $val) {
$search[$key] = ''; $search[$key] = '';
} }
$toselect = ''; $toselect = array();
$search_array_options = array(); $search_array_options = array();
} }
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')