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');
58$rowid =
GETPOST(
'rowid',
'alpha');
62$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
63$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
65if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
69$offset = $limit * $page;
76$diroutputmassaction =
$conf->admin->dir_output.
'/temp/massgeneration/'.$user->id;
77$hookmanager->initHooks(array(
'emailsenderprofilelist'));
80$extrafields->fetch_name_optionals_label(
$object->table_element);
82$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
87 $sortfield =
"t.".key(
$object->fields);
94$search_all = trim(
GETPOST(
"search_all",
'alphanohtml'));
96foreach (
$object->fields as $key => $val) {
97 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
98 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
100 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
106$fieldstosearchall = array();
108foreach (
$object->fields as $key => $val) {
109 if (!empty($val[
'searchall'])) {
110 $fieldstosearchall[
't.'.$key] = $val[
'label'];
115$arrayfields = array();
116foreach (
$object->fields as $key => $val) {
118 if (!empty($val[
'visible'])) {
119 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
120 $arrayfields[
't.'.$key] = array(
121 'label' => $val[
'label'],
122 'checked' => (($visible < 0) ? 0 : 1),
123 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
124 'position' => $val[
'position'],
125 'help' => isset($val[
'help']) ? $val[
'help'] :
''
130if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label']) > 0) {
131 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
132 if (!empty($extrafields->attributes[
$object->table_element][
'list'][$key])) {
133 $arrayfields[
"ef.".$key] = array(
134 'label' => $extrafields->attributes[
$object->table_element][
'label'][$key],
135 'checked' => (($extrafields->attributes[
$object->table_element][
'list'][$key] < 0) ? 0 : 1),
136 'position' => $extrafields->attributes[
$object->table_element][
'pos'][$key],
137 'enabled' => (abs($extrafields->attributes[
$object->table_element][
'list'][$key]) != 3 && $extrafields->attributes[
$object->table_element][
'perms'][$key])
145$permissiontoread = $user->admin;
146$permissiontoadd = $user->admin;
147$permissiontodelete = $user->admin;
155if ($user->socid > 0) {
170if (
GETPOST(
'cancel',
'alpha')) {
174if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
178$parameters = array();
179$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
184if (empty($reshook)) {
186 $backurlforlist = $_SERVER[
"PHP_SELF"];
187 include DOL_DOCUMENT_ROOT.
'/core/actions_addupdatedelete.inc.php';
190 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
193 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
194 foreach (
$object->fields as $key => $val) {
196 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
197 $search[$key.
'_dtstart'] =
'';
198 $search[$key.
'_dtend'] =
'';
202 $search_array_options = array();
204 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
205 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
210 $objectclass =
'EmailSenderProfile';
211 $objectlabel =
'EmailSenderProfile';
212 $uploaddir =
$conf->admin->dir_output.
'/senderprofiles';
213 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
215 if ($action ==
'delete') {
216 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"c_email_senderprofile WHERE rowid = ".
GETPOSTINT(
'id');
217 $resql = $db->query($sql);
221 setEventMessages($langs->trans(
"Error").
' '.$db->lasterror(),
null,
'errors');
232$form =
new Form($db);
238$title = $langs->trans(
"EMailsSetup");
240llxHeader(
'', $title,
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-mails_senderprofile_list');
243$titlepicto =
'title_setup';
251print
'<span class="opacitymedium">'.$langs->trans(
"EMailsSenderProfileDesc").
"</span><br>\n";
257$sql .=
$object->getFieldList(
't');
259if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
260 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
261 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
265$parameters = array();
266$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
267$sql .= $hookmanager->resPrint;
268$sql = preg_replace(
'/,\s*$/',
'', $sql);
272$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
273if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
274 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
277$parameters = array();
278$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
279$sql .= $hookmanager->resPrint;
280if (
$object->ismultientitymanaged == 1) {
281 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element, (
GETPOSTINT(
'search_current_entity') ? 0 : 1)).
")";
283 $sql .=
" WHERE 1 = 1";
285foreach ($search as $key => $val) {
286 if (array_key_exists($key,
$object->fields)) {
287 if ($key ==
'status' && $search[$key] == -1) {
291 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
292 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
297 if ($search[$key] !=
'') {
298 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
301 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
302 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
303 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
304 if (preg_match(
'/_dtstart$/', $key)) {
305 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
307 if (preg_match(
'/_dtend$/', $key)) {
308 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
315 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
318if (empty($user->admin)) {
319 $sql .=
" AND private = ".((int) $user->id);
323include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
325$parameters = array();
326$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
327$sql .= $hookmanager->resPrint;
348$nbtotalofrecords =
'';
351 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
352 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
354 $resql = $db->query($sqlforcount);
356 $objforcount = $db->fetch_object($resql);
357 $nbtotalofrecords = $objforcount->nbtotalofrecords;
362 if (($page * $limit) > $nbtotalofrecords) {
370$sql .= $db->order($sortfield, $sortorder);
372 $sql .= $db->plimit($limit + 1, $offset);
375$resql = $db->query($sql);
381$num = $db->num_rows($resql);
387$arrayofselected = is_array($toselect) ? $toselect : array();
391 $param .=
'&mode='.urlencode($mode);
393if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
394 $param .=
'&contextpage='.urlencode($contextpage);
396if ($limit > 0 && $limit !=
$conf->liste_limit) {
397 $param .=
'&limit='.((int) $limit);
399if ($optioncss !=
'') {
400 $param .=
'&optioncss='.urlencode($optioncss);
402foreach ($search as $key => $val) {
403 if (is_array($search[$key])) {
404 foreach ($search[$key] as $skey) {
406 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
409 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
410 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
411 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
412 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
413 } elseif ($search[$key] !=
'') {
414 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
418include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
420$parameters = array();
421$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
422$param .= $hookmanager->resPrint;
425$arrayofmassactions = array(
431$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
433print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
434if ($optioncss !=
'') {
435 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
437print
'<input type="hidden" name="token" value="'.newToken().
'">';
438print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
439print
'<input type="hidden" name="action" value="'.($action ==
'create' ?
'add' : ($action ==
'edit' ?
'update' :
'list')).
'">';
440print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
441print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
442print
'<input type="hidden" name="page" value="'.$page.
'">';
443print
'<input type="hidden" name="id" value="'.$id.
'">';
444print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
445print
'<input type="hidden" name="page_y" value="">';
446print
'<input type="hidden" name="mode" value="'.$mode.
'">';
450if ($action !=
'create') {
451 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle', $_SERVER[
'PHP_SELF'].
'?action=create',
'', $permissiontoadd);
453 if ($action ==
'edit') {
454 print
'<table class="border centpercent tableforfield">';
455 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>';
456 print
'<tr><td>'.$langs->trans(
"Email").
'</td><td>';
457 print
img_picto(
'',
'email',
'class="pictofixedwidth"');
458 print
'<input type="text" name="email" value="'.(GETPOSTISSET(
'email') ?
GETPOST(
'email',
'alphanohtml') :
$object->
email).
'"></td></tr>';
459 print
'<tr><td>'.$langs->trans(
"Signature").
'</td><td>';
460 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
461 $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%');
462 print $doleditor->Create(1);
464 print
'<tr><td>'.$langs->trans(
"User").
'</td><td>';
465 print
img_picto(
'',
'user',
'class="pictofixedwidth"');
466 print $form->select_dolusers((GETPOSTISSET(
'private') ?
GETPOSTINT(
'private') :
$object->private),
'private', 1, null, 0, ($user->admin ?
'' : $user->id));
468 print
'<tr><td>'.$langs->trans(
"Position").
'</td><td><input type="text" name="position" class="maxwidth50" value="'.(GETPOSTISSET(
'position') ?
GETPOSTINT(
'position') :
$object->
position).
'"></td></tr>';
469 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
470 print $form->selectarray(
'active',
$object->fields[
'active'][
'arrayofkeyval'], (GETPOSTISSET(
'active') ?
GETPOSTINT(
'active') :
$object->active), 0, 0, 0,
'', 1);
474 print $form->buttonsSaveCancel();
486 print
'<table class="border centpercent tableforfield">';
487 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Label").
'</td><td><input type="text" name="label" class="width300" value="'.
GETPOST(
'label',
'alphanohtml').
'" autofocus></td></tr>';
488 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Email").
'</td><td>';
489 print
img_picto(
'',
'email',
'class="pictofixedwidth"');
490 print
'<input type="text" name="email" class="width300" value="'.GETPOST(
'email',
'alphanohtml').
'"></td></tr>';
491 print
'<tr><td>'.$langs->trans(
"Signature").
'</td><td>';
492 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
493 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature'),
'', 138,
'dolibarr_notes',
'In',
true,
true, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
494 print $doleditor->Create(1);
496 print
'<tr><td>'.$langs->trans(
"User").
'</td><td>';
497 print
img_picto(
'',
'user',
'class="pictofixedwidth"');
498 print $form->select_dolusers((GETPOSTISSET(
'private') ?
GETPOSTINT(
'private') : -1),
'private', 1, null, 0, ($user->admin ?
'' : $user->id));
500 print
'<tr><td>'.$langs->trans(
"Position").
'</td><td><input type="text" name="position" class="maxwidth50" value="'.
GETPOSTINT(
'position').
'"></td></tr>';
501 print
'<tr><td>'.$langs->trans(
"Status").
'</td><td>';
502 print $form->selectarray(
'active',
$object->fields[
'active'][
'arrayofkeyval'],
GETPOSTINT(
'active'), 0);
506 print $form->buttonsSaveCancel();
510print_barre_liste(
'', $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'title_companies', 0, $newcardbutton,
'', $limit);
513$topicmail =
"Information";
517include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
520 foreach ($fieldstosearchall as $key => $val) {
521 $fieldstosearchall[$key] = $langs->trans($val);
523 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
531$parameters = array();
532$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
533if (empty($reshook)) {
534 $moreforfilter .= $hookmanager->resPrint;
536 $moreforfilter = $hookmanager->resPrint;
539if (!empty($moreforfilter)) {
540 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
541 print $moreforfilter;
545$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
546$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
547$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
548$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
550print
'<div class="div-table-responsive">';
551print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
556print
'<tr class="liste_titre">';
559 print
'<td class="liste_titre center maxwidthsearch">';
560 $searchpicto = $form->showFilterButtons(
'left');
564foreach (
$object->fields as $key => $val) {
565 $searchkey = empty($search[$key]) ?
'' : $search[$key];
566 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
567 if ($key ==
'status') {
568 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
569 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
570 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
571 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
572 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
573 } 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'])) {
574 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
576 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
577 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
578 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
579 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);
580 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
581 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
582 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
583 print
'<div class="nowrap">';
584 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
586 print
'<div class="nowrap">';
587 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
589 } elseif ($key ==
'lang') {
590 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
592 print $formadmin->select_language($search[$key],
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
594 print
'<input type="text" class="flat maxwidth'.($val[
'type'] ==
'integer' ?
'50' :
'75').
'" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
600include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
602$parameters = array(
'arrayfields' => $arrayfields);
603$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
604print $hookmanager->resPrint;
607 print
'<td class="liste_titre center maxwidthsearch">';
608 $searchpicto = $form->showFilterButtons();
614$totalarray = array();
615$totalarray[
'nbfield'] = 0;
619print
'<tr class="liste_titre">';
622 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
623 $totalarray[
'nbfield']++;
625foreach (
$object->fields as $key => $val) {
626 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
627 if ($key ==
'status') {
628 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
629 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
630 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
631 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
632 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
633 } 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'])) {
634 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
636 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
637 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
638 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";
639 $totalarray[
'nbfield']++;
643include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
646$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
647$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
648print $hookmanager->resPrint;
651 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
652 $totalarray[
'nbfield']++;
658$needToFetchEachLine = 0;
659if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
660 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
661 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
662 $needToFetchEachLine++;
671$savnbfield = $totalarray[
'nbfield'];
672$totalarray = array();
673$totalarray[
'nbfield'] = 0;
674$imaxinloop = ($limit ? min($num, $limit) : $num);
675while ($i < $imaxinloop) {
676 $obj = $db->fetch_object($resql);
682 $object->setVarsFromFetchObj($obj);
684 if ($mode ==
'kanban') {
686 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
687 print
'<div class="box-flex-container kanban">';
691 if ($massactionbutton || $massaction) {
693 if (in_array(
$object->id, $arrayofselected)) {
698 print
$object->getKanbanView(
'', array(
'selected' => $selected));
699 if ($i == ($imaxinloop - 1)) {
706 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
710 print
'<td class="nowrap center">';
712 $url = $_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid;
714 $url .=
'&limit='.((int) $limit);
717 $url .=
'&page='.urlencode((
string) ($page));
720 $url .=
'&sortfield='.urlencode($sortfield);
723 $url .=
'&page='.urlencode($sortorder);
725 print
'<a class="editfielda reposition marginrightonly marginleftonly" href="'.$url.
'&action=edit&token='.
newToken().
'&rowid='.$obj->rowid.
'">'.
img_edit().
'</a>';
727 print
'<a class=" marginrightonly marginleftonly" href="'.$url.
'&action=delete&token='.
newToken().
'">'.
img_delete().
'</a> ';
728 if ($massactionbutton || $massaction) {
730 if (in_array(
$object->id, $arrayofselected)) {
733 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
737 $totalarray[
'nbfield']++;
741 foreach (
$object->fields as $key => $val) {
742 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
743 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
744 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
745 } elseif ($key ==
'status') {
746 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
749 if (in_array($val[
'type'], array(
'timestamp'))) {
750 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
751 } elseif ($key ==
'ref') {
752 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
755 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'])) {
756 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
760 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
761 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
762 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
763 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
766 if ($key ==
'status') {
767 print
$object->getLibStatut(5);
768 } elseif ($key ==
'rowid') {
775 $totalarray[
'nbfield']++;
777 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
779 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
781 if (!isset($totalarray[
'val'])) {
782 $totalarray[
'val'] = array();
784 if (!isset($totalarray[
'val'][
't.'.$key])) {
785 $totalarray[
'val'][
't.'.$key] = 0;
787 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
792 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
794 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
795 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
796 print $hookmanager->resPrint;
800 print
'<td class="nowrap center">';
802 $url = $_SERVER[
"PHP_SELF"].
'?id='.$obj->rowid;
804 $url .=
'&limit='.((int) $limit);
807 $url .=
'&page='.urlencode((
string) ($page));
810 $url .=
'&sortfield='.urlencode($sortfield);
813 $url .=
'&page='.urlencode($sortorder);
815 print
'<a class="editfielda reposition marginrightonly marginleftonly" href="'.$url.
'&action=edit&token='.
newToken().
'&rowid='.$obj->rowid.
'">'.
img_edit().
'</a>';
817 print
'<a class=" marginrightonly marginleftonly" href="'.$url.
'&action=delete&token='.
newToken().
'">'.
img_delete().
'</a> ';
818 if ($massactionbutton || $massaction) {
820 if (in_array(
$object->id, $arrayofselected)) {
823 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
827 $totalarray[
'nbfield']++;
839include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
845 foreach ($arrayfields as $key => $val) {
846 if (!empty($val[
'checked'])) {
850 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
856$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
857$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
858print $hookmanager->resPrint;
860print
'</table>'.
"\n";
865if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
866 $hidegeneratedfilelistifempty = 1;
867 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
868 $hidegeneratedfilelistifempty = 0;
871 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
875 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
876 $urlsource .= str_replace(
'&',
'&', $param);
878 $filedir = $diroutputmassaction;
879 $genallowed = $permissiontoread;
880 $delallowed = $permissiontoadd;
882 print $formfile->showdocuments(
'massfilesarea_emailsenderprofile',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
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.
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_delete($titlealt='default', $other='class="pictodelete"', $morecss='')
Show delete logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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)
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.