26 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/partnership/class/partnership.class.php';
38 $langs->loadLangs(array(
"partnership",
"members",
"other"));
40 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
41 $massaction =
GETPOST(
'massaction',
'alpha');
42 $show_files =
GETPOST(
'show_files',
'int');
43 $confirm =
GETPOST(
'confirm',
'alpha');
44 $cancel =
GETPOST(
'cancel',
'alpha');
45 $toselect =
GETPOST(
'toselect',
'array');
46 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
47 $backtopage =
GETPOST(
'backtopage',
'alpha');
48 $optioncss =
GETPOST(
'optioncss',
'aZ');
54 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
55 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
56 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
58 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
62 $offset = $limit * $page;
63 $pageprev = $page - 1;
64 $pagenext = $page + 1;
70 $diroutputmassaction = $conf->partnership->dir_output.
'/temp/massgeneration/'.$user->id;
71 $hookmanager->initHooks(array(
'partnershiplist'));
74 $extrafields->fetch_name_optionals_label($object->table_element);
77 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
81 if ($managedfor !=
'member' && $sortfield ==
'd.datefin') $sortfield =
'';
85 reset($object->fields);
86 $sortfield =
"t.".key($object->fields);
93 $search_all =
GETPOST(
'search_all',
'alphanohtml');
95 foreach ($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'])) {
100 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
101 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
104 $search_filter =
GETPOST(
"search_filter",
'alpha');
105 $filter =
GETPOST(
"filter",
'alpha');
107 $search_filter = $filter;
111 $fieldstosearchall = array();
112 foreach ($object->fields as $key => $val) {
113 if (!empty($val[
'searchall'])) {
114 $fieldstosearchall[
't.'.$key] = $val[
'label'];
119 $arrayfields = array();
120 foreach ($object->fields as $key => $val) {
122 if (!empty($val[
'visible'])) {
123 $visible = (int)
dol_eval($val[
'visible'], 1);
124 $arrayfields[
't.'.$key] = array(
125 'label'=>$val[
'label'],
126 'checked'=>(($visible < 0) ? 0 : 1),
127 'enabled'=>(abs($visible) != 3 &&
dol_eval($val[
'enabled'], 1)),
128 'position'=>$val[
'position'],
129 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
134 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
139 $permissiontoread = $user->rights->partnership->read;
140 $permissiontoadd = $user->rights->partnership->write;
141 $permissiontodelete = $user->rights->partnership->delete;
144 if (empty($conf->partnership->enabled)) {
148 if ($user->socid > 0) {
162 if (
GETPOST(
'cancel',
'alpha')) {
166 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
170 $parameters = array();
171 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
176 if (empty($reshook)) {
178 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
181 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
182 foreach ($object->fields as $key => $val) {
184 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
185 $search[$key.
'_dtstart'] =
'';
186 $search[$key.
'_dtend'] =
'';
190 $search_array_options = array();
192 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
193 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
198 $objectclass =
'Partnership';
199 $objectlabel =
'Partnership';
200 $uploaddir = $conf->partnership->dir_output;
201 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
204 if (!$error && $massaction ==
'approve' && $permissiontoadd) {
211 foreach ($toselect as $checked) {
212 if ($objecttmp->fetch($checked)) {
213 if ($objecttmp->status == $objecttmp::STATUS_DRAFT) {
215 $result = $objecttmp->validate($user);
218 if ($result >= 0 && $objecttmp->status == $objecttmp::STATUS_VALIDATED) {
219 $result = $objecttmp->approve($user);
221 setEventMessages($langs->trans(
"PartnershipRefApproved", $objecttmp->ref), null);
241 if ($massaction ==
'cancel' && $permissiontoadd) {
244 $objecttmp =
new $objectclass($db);
246 foreach ($toselect as $toselectid) {
247 $result = $objecttmp->fetch($toselectid);
249 $result = $objecttmp->cancel($user, 0);
251 setEventMessages($langs->trans(
'StatusOfRefMustBe', $objecttmp->ref, $objecttmp->LibStatut($objecttmp::STATUS_APPROVED)), null,
'warnings');
253 } elseif ($result <= 0) {
288 $title = $langs->trans(
"Partnerships");
296 $sql .= $object->getFieldList(
't');
297 if ($managedfor ==
'member') {
298 $sql .=
', d.datefin, d.fk_adherent_type, dty.subscription';
301 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
302 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
303 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
307 $parameters = array();
308 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
309 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
310 $sql = preg_replace(
'/,\s*$/',
'', $sql);
311 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
312 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
313 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
315 if ($managedfor ==
'member') {
316 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent as d on (d.rowid = t.fk_member)";
317 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent_type as dty on (dty.rowid = d.fk_adherent_type)";
320 $parameters = array();
321 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
322 $sql .= $hookmanager->resPrint;
323 if ($object->ismultientitymanaged == 1) {
324 $sql .=
" WHERE t.entity IN (".getEntity($object->element).
")";
326 $sql .=
" WHERE 1 = 1";
328 if ($managedfor ==
'member')
329 $sql .=
" AND fk_member > 0";
330 else $sql .=
" AND fk_soc > 0";
331 foreach ($search as $key => $val) {
332 if (array_key_exists($key, $object->fields)) {
333 if ($key ==
'status' && $search[$key] == -1) {
336 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
337 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
338 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
343 if ($search[$key] !=
'') {
344 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
347 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
348 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
349 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
350 if (preg_match(
'/_dtstart$/', $key)) {
351 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
353 if (preg_match(
'/_dtend$/', $key)) {
354 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
360 if ($managedfor ==
'member') {
361 if ($search_filter ==
'withoutsubscription') {
362 $sql .=
" AND (d.datefin IS NULL OR dty.subscription = 0)";
364 if ($search_filter ==
'uptodate') {
365 $sql .=
" AND (d.datefin >= '".$db->idate($now).
"' OR dty.subscription = 0)";
367 if ($search_filter ==
'outofdate') {
368 $sql .=
" AND (d.datefin < '".$db->idate($now).
"' AND dty.subscription = 1)";
372 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
376 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
378 $parameters = array();
379 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
380 $sql .= $hookmanager->resPrint;
401 $nbtotalofrecords =
'';
402 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
404 $sqlforcount = preg_replace(
'/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/',
'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
405 $resql = $db->query($sqlforcount);
407 $objforcount = $db->fetch_object(
$resql);
408 $nbtotalofrecords = $objforcount->nbtotalofrecords;
413 if (($page * $limit) > $nbtotalofrecords) {
421 $sql .= $db->order($sortfield, $sortorder);
423 $sql .= $db->plimit($limit + 1, $offset);
426 $resql = $db->query($sql);
432 $num = $db->num_rows(
$resql);
436 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
437 $obj = $db->fetch_object(
$resql);
439 header(
"Location: ".
dol_buildpath(
'/partnership/partnership_card.php', 1).
'?id='.$id);
447 llxHeader(
'', $title,
$help_url,
'', 0, 0, $morejs, $morecss,
'',
'classforhorizontalscrolloftabs');
450 $arrayofselected = is_array($toselect) ? $toselect : array();
453 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
454 $param .=
'&contextpage='.urlencode($contextpage);
456 if ($limit > 0 && $limit != $conf->liste_limit) {
457 $param .=
'&limit='.urlencode($limit);
459 foreach ($search as $key => $val) {
460 if (is_array($search[$key]) && count($search[$key])) {
461 foreach ($search[$key] as $skey) {
463 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
466 } elseif ($search[$key] !=
'') {
467 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
470 if ($optioncss !=
'') {
471 $param .=
'&optioncss='.urlencode($optioncss);
473 if ($search_filter && $search_filter !=
'-1') {
474 $param .=
"&search_filter=".urlencode($search_filter);
477 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
479 $parameters = array();
480 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
481 $param .= $hookmanager->resPrint;
484 $arrayofmassactions = array(
486 'approve'=>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"ValidateAndApprove"),
487 'cancel'=>
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Cancel"),
490 'presend'=>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendMail"),
492 if ($permissiontodelete) {
493 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
495 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'prevalidate',
'presend',
'predelete'))) {
496 $arrayofmassactions = array();
498 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
500 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
501 if ($optioncss !=
'') {
502 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
504 print
'<input type="hidden" name="token" value="'.newToken().
'">';
505 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
506 print
'<input type="hidden" name="action" value="list">';
507 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
508 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
509 print
'<input type="hidden" name="page" value="'.$page.
'">';
510 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
511 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
514 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/partnership/partnership_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
516 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
519 $topicmail =
"SendPartnershipRef";
520 $modelmail =
"partnership_send";
522 $trackid =
'pship'.$object->id;
523 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
527 foreach ($fieldstosearchall as $key => $val) {
528 $fieldstosearchall[$key] = $langs->trans($val);
529 $setupstring .= $key.
"=".$val.
";";
531 print
'<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
532 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
540 $parameters = array();
541 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
542 if (empty($reshook)) {
543 $moreforfilter .= $hookmanager->resPrint;
545 $moreforfilter = $hookmanager->resPrint;
548 if (!empty($moreforfilter)) {
549 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
550 print $moreforfilter;
554 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
555 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
556 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
558 print
'<div class="div-table-responsive">';
559 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
562 if ($managedfor ==
'member') {
563 $arrayfields[
't.fk_member'][
'checked'] = 1;
565 $arrayfields[
't.fk_soc'][
'checked'] = 1;
569 print
'<tr class="liste_titre">';
571 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
572 print
'<td class="liste_titre maxwidthsearch">';
573 $searchpicto =
$form->showFilterButtons(
'left');
577 foreach ($object->fields as $key => $val) {
578 $searchkey = empty($search[$key]) ?
'' : $search[$key];
579 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
580 if ($key ==
'status') {
581 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
582 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
583 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
584 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
585 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
586 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $key !=
'rowid' && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
587 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
589 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
590 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
591 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
592 print
$form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
593 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
594 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
595 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
596 print
'<div class="nowrap">';
597 print
$form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
599 print
'<div class="nowrap">';
600 print
$form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
602 } elseif ($key ==
'lang') {
603 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
605 print $formadmin->select_language($search[$key],
'search_lang', 0, null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
607 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
613 if ($managedfor ==
'member') {
614 print
'<td class="liste_titre center">';
615 $selectarray = array(
'-1'=>
'',
'withoutsubscription'=>$langs->trans(
"WithoutSubscription"),
'uptodate'=>$langs->trans(
"UpToDate"),
'outofdate'=>$langs->trans(
"OutOfDate"));
616 print
$form->selectarray(
'search_filter', $selectarray, $search_filter);
620 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
623 $parameters = array(
'arrayfields'=>$arrayfields);
624 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
625 print $hookmanager->resPrint;
627 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
628 print
'<td class="liste_titre maxwidthsearch">';
629 $searchpicto =
$form->showFilterButtons();
635 $totalarray = array();
636 $totalarray[
'nbfield'] = 0;
640 print
'<tr class="liste_titre">';
641 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
642 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
644 foreach ($object->fields as $key => $val) {
645 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
646 if ($key ==
'status') {
647 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
648 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
649 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
650 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
651 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
652 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $key !=
'rowid' && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
653 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
655 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
656 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
657 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
658 $totalarray[
'nbfield']++;
662 if ($managedfor ==
'member') {
664 $cssforfield =
'center';
665 print
getTitleFieldOfList(
'SubscriptionEndDate', 0, $_SERVER[
'PHP_SELF'],
'd.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
668 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
670 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
671 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
672 print $hookmanager->resPrint;
674 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
675 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
677 $totalarray[
'nbfield']++;
682 $needToFetchEachLine = 0;
683 if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
684 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
685 if (preg_match(
'/\$object/', $val)) {
686 $needToFetchEachLine++;
695 $savnbfield = $totalarray[
'nbfield'];
696 $totalarray = array();
697 $totalarray[
'nbfield'] = 0;
698 $imaxinloop = ($limit ? min($num, $limit) : $num);
699 while ($i < $imaxinloop) {
700 $obj = $db->fetch_object(
$resql);
706 $object->setVarsFromFetchObj($obj);
708 if ($mode ==
'kanban') {
710 print
'<tr><td colspan="'.$savnbfield.
'">';
711 print
'<div class="box-flex-container">';
714 print $object->getKanbanView(
'');
715 if ($i == ($imaxinloop - 1)) {
722 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
724 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
725 print
'<td class="nowrap center">';
726 if ($massactionbutton || $massaction) {
728 if (in_array($object->id, $arrayofselected)) {
731 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
735 foreach ($object->fields as $key => $val) {
736 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
737 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
738 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
739 } elseif ($key ==
'status') {
740 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
743 if (in_array($val[
'type'], array(
'timestamp'))) {
744 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
745 } elseif ($key ==
'ref') {
746 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
749 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
750 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
754 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
755 print
'<td'.($cssforfield ?
' class="'.$cssforfield.
'"' :
'');
756 if (preg_match(
'/tdoverflow/', $cssforfield)) {
757 print
' title="'.dol_escape_htmltag($object->$key).
'"';
760 if ($key ==
'status') {
761 print $object->getLibStatut(5);
762 } elseif ($key ==
'rowid') {
763 print $object->showOutputField($val, $key, $object->id,
'');
765 print $object->showOutputField($val, $key, $object->$key,
'');
769 $totalarray[
'nbfield']++;
771 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
773 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
775 if (!isset($totalarray[
'val'])) {
776 $totalarray[
'val'] = array();
778 if (!isset($totalarray[
'val'][
't.'.$key])) {
779 $totalarray[
'val'][
't.'.$key] = 0;
781 $totalarray[
'val'][
't.'.$key] += $object->$key;
786 if ($managedfor ==
'member') {
787 print
'<td class="nowrap center endofsubscriptiondate">';
788 $result = $adherent->fetch($object->fk_member);
790 $datefin = $adherent->datefin;
793 if ($adherent->hasDelay()) {
794 $textlate .=
' ('.$langs->trans(
"DateReference").
' > '.$langs->trans(
"DateToday").
' '.(ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24) >= 0 ?
'+' :
'').ceil($conf->adherent->subscription->warning_delay / 60 / 60 / 24).
' '.$langs->trans(
"days").
')';
795 print
" ".img_warning($langs->trans(
"SubscriptionLate").$textlate);
798 if ($adherent->subscription ==
'yes') {
799 print $langs->trans(
"SubscriptionNotReceived");
800 if ($adherent->statut > 0) {
801 print
" ".img_warning();
811 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
813 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
814 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
815 print $hookmanager->resPrint;
817 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
818 print
'<td class="nowrap center">';
819 if ($massactionbutton || $massaction) {
821 if (in_array($object->id, $arrayofselected)) {
824 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
829 $totalarray[
'nbfield']++;
837 if ($managedfor !=
'member') $totalarray[
'nbfield']++;
840 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
845 foreach ($arrayfields as $key => $val) {
846 if (!empty($val[
'checked'])) {
850 if ($managedfor !=
'member') $colspan++;
851 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
857 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
858 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
859 print $hookmanager->resPrint;
861 print
'</table>'.
"\n";
864 print
'</form>'.
"\n";
866 if (in_array(
'builddoc', $arrayofmassactions) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
867 $hidegeneratedfilelistifempty = 1;
868 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
869 $hidegeneratedfilelistifempty = 0;
872 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
876 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
877 $urlsource .= str_replace(
'&',
'&', $param);
879 $filedir = $diroutputmassaction;
880 $genallowed = $permissiontoread;
881 $delallowed = $permissiontoadd;
883 print $formfile->showdocuments(
'massfilesarea_partnership',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'', null, $hidegeneratedfilelistifempty);
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
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_now($mode= 'auto')
Return date for now.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default= '')
Return dolibarr global constant string value.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save"&&empty($cancel)) $help_url
View.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring= '1')
Replace eval function to add more security.
print_barre_liste($titre, $page, $file, $options= '', $sortfield= '', $sortorder= '', $morehtmlcenter= '', $num=-1, $totalnboflines= '', $picto= 'generic', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow= '')
Print a title with navigation controls for pagination.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form...
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Class to manage members of a foundation.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
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...
if(isModEnabled('facture')&&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur')&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)&&$user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice')&&$user->rights->supplier_invoice->lire)) if(isModEnabled('don')&&!empty($user->rights->don->lire)) if(isModEnabled('tax')&&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture')&&isModEnabled('commande')&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
dol_sort_array(&$array, $index, $order= 'asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip= '', $forcenowrapcolumntitle=0)
Get title line of an array.