28require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/emailsenderprofile.class.php';
44$langs->loadLangs(array(
"errors",
"admin",
"mails",
"languages"));
46$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
47$massaction =
GETPOST(
'massaction',
'alpha');
49$confirm =
GETPOST(
'confirm',
'alpha');
50$cancel =
GETPOST(
'cancel',
'alpha');
51$toselect =
GETPOST(
'toselect',
'array');
52$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'emailsenderprofilelist';
53$backtopage =
GETPOST(
'backtopage',
'alpha');
54$optioncss =
GETPOST(
'optioncss',
'aZ');
61$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
62$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
64if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
68$offset = $limit * $page;
75$diroutputmassaction =
$conf->admin->dir_output.
'/temp/massgeneration/'.$user->id;
76$hookmanager->initHooks(array(
'emailsenderprofilelist'));
79$extrafields->fetch_name_optionals_label(
$object->table_element);
81$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
86 $sortfield =
"t.position";
93$search_all = trim(
GETPOST(
"search_all",
'alphanohtml'));
95foreach (
$object->fields as $key => $val) {
96 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
97 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
99 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
105$fieldstosearchall = array();
107foreach (
$object->fields as $key => $val) {
108 if (!empty($val[
'searchall'])) {
109 $fieldstosearchall[
't.'.$key] = $val[
'label'];
114$arrayfields = array();
115foreach (
$object->fields as $key => $val) {
117 if (!empty($val[
'visible'])) {
118 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
119 $arrayfields[
't.'.$key] = array(
120 'label' => $val[
'label'],
121 'checked' => (($visible < 0) ? 0 : 1),
122 'enabled' => (abs($visible) != 3 && (bool)
dol_eval((string) $val[
'enabled'], 1)),
123 'position' => $val[
'position'],
124 'help' => isset($val[
'help']) ? $val[
'help'] :
''
129include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
134$permissiontoread = $user->admin;
135$permissiontoadd = $user->admin;
136$permissiontodelete = $user->admin;
144if ($user->socid > 0) {
159if (
GETPOST(
'cancel',
'alpha')) {
163if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
167$parameters = array();
168$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
173if (empty($reshook)) {
175 $backurlforlist = $_SERVER[
"PHP_SELF"];
176 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
179 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
182 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
183 foreach (
$object->fields as $key => $val) {
185 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
186 $search[$key.
'_dtstart'] =
'';
187 $search[$key.
'_dtend'] =
'';
191 $search_array_options = array();
193 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
194 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
199 $objectclass =
'EmailSenderProfile';
200 $objectlabel =
'EmailSenderProfile';
201 $uploaddir =
$conf->admin->dir_output.
'/senderprofiles';
202 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
204 if ($action ==
'delete') {
205 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"c_email_senderprofile WHERE rowid = ".
GETPOSTINT(
'id');
206 $resql = $db->query($sql);
210 setEventMessages($langs->trans(
"Error").
' '.$db->lasterror(),
null,
'errors');
221$form =
new Form($db);
227$title = $langs->trans(
"EMailsSetup");
229llxHeader(
'', $title,
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-mails_senderprofile_list');
232$titlepicto =
'title_setup';
240print
'<span class="opacitymedium">'.$langs->trans(
"EMailsSenderProfileDesc").
"</span><br>\n";
246$sql .=
$object->getFieldList(
't');
248if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
249 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
250 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
254$parameters = array();
255$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
256$sql .= $hookmanager->resPrint;
257$sql = preg_replace(
'/,\s*$/',
'', $sql);
261$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
262if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
263 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
266$parameters = array();
267$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
268$sql .= $hookmanager->resPrint;
269if (
$object->ismultientitymanaged == 1) {
270 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
272 $sql .=
" WHERE 1 = 1";
274foreach ($search as $key => $val) {
275 if (array_key_exists($key,
$object->fields)) {
276 if ($key ==
'status' && $search[$key] == -1) {
280 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
281 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
286 if ($search[$key] !=
'') {
287 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
290 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
291 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
292 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
293 if (preg_match(
'/_dtstart$/', $key)) {
294 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
296 if (preg_match(
'/_dtend$/', $key)) {
297 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
304 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
307if (empty($user->admin)) {
308 $sql .=
" AND private = ".((int) $user->id);
312include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
314$parameters = array();
315$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
316$sql .= $hookmanager->resPrint;
337$nbtotalofrecords =
'';
340 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
341 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
343 $resql = $db->query($sqlforcount);
345 $objforcount = $db->fetch_object($resql);
346 $nbtotalofrecords = $objforcount->nbtotalofrecords;
351 if (($page * $limit) > $nbtotalofrecords) {
359$sql .= $db->order($sortfield, $sortorder);
361 $sql .= $db->plimit($limit + 1, $offset);
364$resql = $db->query($sql);
370$num = $db->num_rows($resql);
376$arrayofselected = is_array($toselect) ? $toselect : array();
380 $param .=
'&mode='.urlencode($mode);
382if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
383 $param .=
'&contextpage='.urlencode($contextpage);
385if ($limit > 0 && $limit !=
$conf->liste_limit) {
386 $param .=
'&limit='.((int) $limit);
388if ($optioncss !=
'') {
389 $param .=
'&optioncss='.urlencode($optioncss);
391foreach ($search as $key => $val) {
392 if (is_array($search[$key])) {
393 foreach ($search[$key] as $skey) {
395 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
398 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
399 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
400 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
401 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
402 } elseif ($search[$key] !=
'') {
403 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
407include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
409$parameters = array();
410$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
411$param .= $hookmanager->resPrint;
414$arrayofmassactions = array(
420$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
422print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
423if ($optioncss !=
'') {
424 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
426print
'<input type="hidden" name="token" value="'.newToken().
'">';
427print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
428print
'<input type="hidden" name="action" value="'.($action ==
'create' ?
'add' : ($action ==
'edit' ?
'update' :
'list')).
'">';
429print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
430print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
431print
'<input type="hidden" name="page" value="'.$page.
'">';
432print
'<input type="hidden" name="id" value="'.$id.
'">';
433print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
434print
'<input type="hidden" name="page_y" value="">';
435print
'<input type="hidden" name="mode" value="'.$mode.
'">';
439if ($action !=
'create') {
440 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', $_SERVER[
'PHP_SELF'].
'?action=create',
'', $permissiontoadd);
442 if ($action ==
'edit') {
443 print
'<table class="border centpercent tableforfield">';
444 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td><td><input type="text" name="label" class="width300" value="'.(GETPOSTISSET(
'label') ?
GETPOST(
'label',
'alphanohtml') :
$object->label).
'"></td></tr>';
445 print
'<tr><td>'.$langs->trans(
"Email").
'</td><td>';
446 print
img_picto(
'',
'email',
'class="pictofixedwidth"');
447 print
'<input type="text" name="email" value="'.(GETPOSTISSET(
'email') ?
GETPOST(
'email',
'alphanohtml') :
$object->
email).
'"></td></tr>';
448 print
'<tr><td>'.$langs->trans(
"Signature").
'</td><td>';
449 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
450 $doleditor =
new DolEditor(
'signature', (GETPOSTISSET(
'signature') ?
GETPOST(
'signature',
'restricthtml') :
$object->signature),
'', 138,
'dolibarr_notes',
'In', true, true, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
451 print $doleditor->Create(1);
453 print
'<tr><td>'.$langs->trans(
"User").
'</td><td>';
454 print
img_picto(
'',
'user',
'class="pictofixedwidth"');
455 print $form->select_dolusers((GETPOSTISSET(
'private') ?
GETPOSTINT(
'private') :
$object->private),
'private', 1, null, 0, ($user->admin ?
'' : $user->id));
457 print
'<tr><td>'.$langs->trans(
"Position").
'</td><td><input type="text" name="position" class="maxwidth50" value="'.(GETPOSTISSET(
'position') ?
GETPOSTINT(
'position') :
$object->
position).
'"></td></tr>';
458 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
459 print $form->selectarray(
'active',
$object->fields[
'active'][
'arrayofkeyval'], (GETPOSTISSET(
'active') ?
GETPOSTINT(
'active') :
$object->active), 0, 0, 0,
'', 1);
463 print $form->buttonsSaveCancel();
475 print
'<table class="border centpercent tableforfield">';
476 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td><td><input type="text" name="label" class="width300" value="'.
GETPOST(
'label',
'alphanohtml').
'" autofocus></td></tr>';
477 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Email").
'</td><td>';
478 print
img_picto(
'',
'email',
'class="pictofixedwidth"');
479 print
'<input type="text" name="email" class="width300" value="'.GETPOST(
'email',
'alphanohtml').
'"></td></tr>';
480 print
'<tr><td>'.$langs->trans(
"Signature").
'</td><td>';
481 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
482 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature'),
'', 138,
'dolibarr_notes',
'In',
true,
true, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
483 print $doleditor->Create(1);
485 print
'<tr><td>'.$langs->trans(
"User").
'</td><td>';
486 print
img_picto(
'',
'user',
'class="pictofixedwidth"');
487 print $form->select_dolusers((GETPOSTISSET(
'private') ?
GETPOSTINT(
'private') : -1),
'private', 1, null, 0, ($user->admin ?
'' : $user->id));
489 print
'<tr><td>'.$langs->trans(
"Position").
'</td><td><input type="text" name="position" class="maxwidth50" value="'.
GETPOSTINT(
'position').
'"></td></tr>';
490 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
491 print $form->selectarray(
'active',
$object->fields[
'active'][
'arrayofkeyval'],
GETPOSTINT(
'active'), 0);
495 print $form->buttonsSaveCancel();
499print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'title_companies', 0, $newcardbutton,
'', $limit);
502$topicmail =
"Information";
506include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
509 foreach ($fieldstosearchall as $key => $val) {
510 $fieldstosearchall[$key] = $langs->trans($val);
512 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
520$parameters = array();
521$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
522if (empty($reshook)) {
523 $moreforfilter .= $hookmanager->resPrint;
525 $moreforfilter = $hookmanager->resPrint;
528if (!empty($moreforfilter)) {
529 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
530 print $moreforfilter;
534$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
535$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
536$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
537$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
539print
'<div class="div-table-responsive">';
540print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
545print
'<tr class="liste_titre">';
548 print
'<td class="liste_titre center maxwidthsearch">';
549 $searchpicto = $form->showFilterButtons(
'left');
553foreach (
$object->fields as $key => $val) {
554 $searchkey = empty($search[$key]) ?
'' : $search[$key];
555 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
556 if ($key ==
'status') {
557 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
558 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
559 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
560 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
561 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
562 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'id',
'rowid',
'ref',
'status')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
563 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
565 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
566 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
567 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
568 print $form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), 1, 0, 0,
'', 1, 0, 0,
'',
'maxwidth100'.($key ==
'status' ?
' search_status width100 onrightofpage' :
''), 1);
569 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
570 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
571 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
572 print
'<div class="nowrap">';
573 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
575 print
'<div class="nowrap">';
576 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
578 } elseif ($key ==
'lang') {
579 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
581 print $formadmin->select_language($search[$key],
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
583 print
'<input type="text" class="flat maxwidth'.($val[
'type'] ==
'integer' ?
'50' :
'75').
'" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
589include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
591$parameters = array(
'arrayfields' => $arrayfields);
592$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
593print $hookmanager->resPrint;
596 print
'<td class="liste_titre center maxwidthsearch">';
597 $searchpicto = $form->showFilterButtons();
608print
'<tr class="liste_titre">';
611 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
614foreach (
$object->fields as $key => $val) {
615 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
616 if ($key ==
'status') {
617 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
618 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
619 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
620 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
621 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
622 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'id',
'rowid',
'ref',
'status')) && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
623 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
625 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
626 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
627 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
''), 0, (empty($val[
'helplist']) ?
'' : $val[
'helplist'])).
"\n";
632include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
635$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
636$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
637print $hookmanager->resPrint;
640 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
647$needToFetchEachLine = 0;
648if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
649 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
650 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
651 $needToFetchEachLine++;
663$imaxinloop = ($limit ? min($num, $limit) : $num);
664while ($i < $imaxinloop) {
665 $obj = $db->fetch_object($resql);
671 $object->setVarsFromFetchObj($obj);
673 if ($mode ==
'kanban') {
675 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
676 print
'<div class="box-flex-container kanban">';
680 if ($massactionbutton || $massaction) {
682 if (in_array(
$object->id, $arrayofselected)) {
687 print
$object->getKanbanView(
'', array(
'selected' => $selected));
688 if ($i == ($imaxinloop - 1)) {
695 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
699 print
'<td class="nowrap center">';
701 $url = $_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid;
703 $url .=
'&limit='.((int) $limit);
706 $url .=
'&page='.urlencode((
string) ($page));
709 $url .=
'&sortfield='.urlencode($sortfield);
712 $url .=
'&page='.urlencode($sortorder);
714 print
'<a class="editfielda reposition marginrightonly marginleftonly" href="'.$url.
'&action=edit&token='.
newToken().
'&rowid='.$obj->rowid.
'">'.
img_edit().
'</a>';
716 print
'<a class=" marginrightonly marginleftonly" href="'.$url.
'&action=delete&token='.
newToken().
'">'.
img_delete().
'</a> ';
717 if ($massactionbutton || $massaction) {
719 if (in_array(
$object->id, $arrayofselected)) {
722 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
730 foreach (
$object->fields as $key => $val) {
731 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
732 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
733 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
734 } elseif ($key ==
'status') {
735 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
738 if (in_array($val[
'type'], array(
'timestamp'))) {
739 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
740 } elseif ($key ==
'ref') {
741 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
744 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'id',
'rowid',
'ref',
'status')) && empty($val[
'arrayofkeyval'])) {
745 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
749 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
750 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
751 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
752 print
' title="'.dol_escape_htmltag((
string)
$object->$key).
'"';
755 if ($key ==
'status') {
756 print
$object->getLibStatut(5);
757 } elseif ($key ==
'rowid') {
758 print
$object->showOutputField($val, $key, (
string)
$object->id,
'');
766 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
770 if (!isset($totalarray[
'val'])) {
773 if (!isset($totalarray[
'val'][
't.'.$key])) {
781 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
783 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
784 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
785 print $hookmanager->resPrint;
789 print
'<td class="nowrap center">';
791 $url = $_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid;
793 $url .=
'&limit='.((int) $limit);
796 $url .=
'&page='.urlencode((
string) $page);
798 $url .=
'&sortfield='.urlencode((
string) $sortfield);
799 $url .=
'&page='.urlencode((
string) $sortorder);
801 print
'<a class="editfielda reposition marginrightonly marginleftonly" href="'.$url.
'&action=edit&token='.
newToken().
'&rowid='.$obj->rowid.
'">'.
img_edit().
'</a>';
803 print
'<a class=" marginrightonly marginleftonly" href="'.$url.
'&action=delete&token='.
newToken().
'">'.
img_delete().
'</a> ';
804 if ($massactionbutton || $massaction) {
806 if (in_array(
$object->id, $arrayofselected)) {
809 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
824include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
830 foreach ($arrayfields as $key => $val) {
831 if (!empty($val[
'checked'])) {
835 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
841$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
842$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
843print $hookmanager->resPrint;
845print
'</table>'.
"\n";
850if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
851 $hidegeneratedfilelistifempty = 1;
852 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
853 $hidegeneratedfilelistifempty = 0;
856 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
860 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
861 $urlsource .= str_replace(
'&',
'&', $param);
863 $filedir = $diroutputmassaction;
864 $genallowed = $permissiontoread;
865 $delallowed = $permissiontoadd;
867 print $formfile->showdocuments(
'massfilesarea_emailsenderprofile',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
email_admin_prepare_head()
Return array head with list of tabs to view object information.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage a WYSIWYG editor.
Class for EmailSenderProfile.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as p label as s rowid as s nom as s email
Sender: Who sends the email ("Sender" has sent emails on behalf of "From").
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.