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.
'/core/lib/member.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/partnership/class/partnership.class.php';
40 $langs->loadLangs(array(
"partnership",
"members",
"other"));
42 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
43 $massaction =
GETPOST(
'massaction',
'alpha');
44 $show_files =
GETPOST(
'show_files',
'int');
45 $confirm =
GETPOST(
'confirm',
'alpha');
46 $cancel =
GETPOST(
'cancel',
'alpha');
47 $toselect =
GETPOST(
'toselect',
'array');
48 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
49 $backtopage =
GETPOST(
'backtopage',
'alpha');
50 $optioncss =
GETPOST(
'optioncss',
'aZ');
54 $socid =
GETPOST(
'socid',
'int');
55 $memberid =
GETPOST(
'rowid',
'int');
57 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
58 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
59 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
61 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
65 $offset = $limit * $page;
66 $pageprev = $page - 1;
67 $pagenext = $page + 1;
73 $diroutputmassaction = $conf->partnership->dir_output.
'/temp/massgeneration/'.$user->id;
75 $hookmanager->initHooks(array(
'thirdpartypartnership'));
76 } elseif ($memberid > 0) {
77 $hookmanager->initHooks(array(
'memberpartnership'));
79 $hookmanager->initHooks(array(
'partnershiplist'));
83 $extrafields->fetch_name_optionals_label($object->table_element);
86 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
92 if ($managedfor !=
'member' && $sortfield ==
'd.datefin') $sortfield =
'';
96 reset($object->fields);
97 $sortfield =
"t.".key($object->fields);
104 $search_all =
GETPOST(
'search_all',
'alphanohtml');
106 foreach ($object->fields as $key => $val) {
107 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
108 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
110 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
111 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
112 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
115 $search_filter =
GETPOST(
"search_filter",
'alpha');
116 $filter =
GETPOST(
"filter",
'alpha');
118 $search_filter = $filter;
122 $fieldstosearchall = array();
123 foreach ($object->fields as $key => $val) {
124 if (!empty($val[
'searchall'])) {
125 $fieldstosearchall[
't.'.$key] = $val[
'label'];
130 $arrayfields = array();
131 foreach ($object->fields as $key => $val) {
133 if (!empty($val[
'visible'])) {
134 $visible = (int)
dol_eval($val[
'visible'], 1);
135 $arrayfields[
't.'.$key] = array(
136 'label'=>$val[
'label'],
137 'checked'=>(($visible < 0) ? 0 : 1),
138 'enabled'=>(abs($visible) != 3 &&
dol_eval($val[
'enabled'], 1)),
139 'position'=>$val[
'position'],
140 'help'=> isset($val[
'help']) ? $val[
'help'] :
''
145 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
150 $permissiontoread = $user->rights->partnership->read;
151 $permissiontoadd = $user->rights->partnership->write;
152 $permissiontodelete = $user->rights->partnership->delete;
160 if ($object->id > 0 && !($object->fk_member > 0) && $managedfor ==
'member')
accessforbidden();
161 if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor ==
'thirdparty')
accessforbidden();
168 if (
GETPOST(
'cancel',
'alpha')) {
172 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
176 $parameters = array();
177 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
182 if (empty($reshook)) {
184 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
187 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
188 foreach ($object->fields as $key => $val) {
190 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
191 $search[$key.
'_dtstart'] =
'';
192 $search[$key.
'_dtend'] =
'';
196 $search_array_options = array();
198 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
199 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
204 $objectclass =
'Partnership';
205 $objectlabel =
'Partnership';
206 $uploaddir = $conf->partnership->dir_output;
207 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
210 if (!$error && $massaction ==
'approve' && $permissiontoadd) {
217 foreach ($toselect as $checked) {
218 if ($objecttmp->fetch($checked)) {
219 if ($objecttmp->status == $objecttmp::STATUS_DRAFT) {
221 $result = $objecttmp->validate($user);
224 if ($result >= 0 && $objecttmp->status == $objecttmp::STATUS_VALIDATED) {
225 $result = $objecttmp->approve($user);
227 setEventMessages($langs->trans(
"PartnershipRefApproved", $objecttmp->ref),
null);
247 if ($massaction ==
'cancel' && $permissiontoadd) {
250 $objecttmp =
new $objectclass($db);
252 foreach ($toselect as $toselectid) {
253 $result = $objecttmp->fetch($toselectid);
255 $result = $objecttmp->cancel($user, 0);
257 setEventMessages($langs->trans(
'StatusOfRefMustBe', $objecttmp->ref, $objecttmp->LibStatut($objecttmp::STATUS_APPROVED)),
null,
'warnings');
259 } elseif ($result <= 0) {
294 $title = $langs->trans(
"Partnerships");
302 $sql .= $object->getFieldList(
't');
303 if ($managedfor ==
'member') {
304 $sql .=
', d.datefin, d.fk_adherent_type, dty.subscription';
307 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
308 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
309 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
313 $parameters = array();
314 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
315 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
316 $sql = preg_replace(
'/,\s*$/',
'', $sql);
317 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
318 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
319 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
321 if ($managedfor ==
'member') {
322 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent as d on (d.rowid = t.fk_member)";
323 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent_type as dty on (dty.rowid = d.fk_adherent_type)";
326 $parameters = array();
327 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
328 $sql .= $hookmanager->resPrint;
329 if ($object->ismultientitymanaged == 1) {
330 $sql .=
" WHERE t.entity IN (".getEntity($object->element).
")";
332 $sql .=
" WHERE 1 = 1";
334 if ($managedfor ==
'member') {
336 $sql .=
" AND t.fk_member = ".((int) $memberid);
338 $sql .=
" AND fk_member > 0";
342 $sql .=
" AND t.fk_soc = ".((int) $socid);
344 $sql .=
" AND fk_soc > 0";
347 foreach ($search as $key => $val) {
348 if (array_key_exists($key, $object->fields)) {
349 if ($key ==
'status' && $search[$key] == -1) {
352 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
353 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
354 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
359 if ($search[$key] !=
'') {
360 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
363 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
364 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
365 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
366 if (preg_match(
'/_dtstart$/', $key)) {
367 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
369 if (preg_match(
'/_dtend$/', $key)) {
370 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
376 if ($managedfor ==
'member') {
377 if ($search_filter ==
'withoutsubscription') {
378 $sql .=
" AND (d.datefin IS NULL)";
380 if ($search_filter ==
'waitingsubscription') {
381 $sql .=
" AND (d.datefin IS NULL AND t.subscription = '1')";
383 if ($search_filter ==
'uptodate') {
384 $sql .=
" AND (d.datefin >= '".$db->idate($now).
"' OR dty.subscription = '0')";
386 if ($search_filter ==
'outofdate') {
387 $sql .=
" AND (d.datefin < '".$db->idate($now).
"' AND dty.subscription = '1')";
391 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
395 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
397 $parameters = array();
398 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
399 $sql .= $hookmanager->resPrint;
421 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
423 $sqlforcount = preg_replace(
'/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/Ui',
'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
424 $resql = $db->query($sqlforcount);
426 $objforcount = $db->fetch_object(
$resql);
440 $sql .= $db->order($sortfield, $sortorder);
442 $sql .= $db->plimit($limit + 1, $offset);
445 $resql = $db->query($sql);
451 $num = $db->num_rows(
$resql);
455 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
456 $obj = $db->fetch_object(
$resql);
458 header(
"Location: ".
dol_buildpath(
'/partnership/partnership_card.php', 1).
'?id='.$id);
466 llxHeader(
'', $title,
$help_url,
'', 0, 0, $morejs, $morecss,
'',
'classforhorizontalscrolloftabs');
468 if ($managedfor ==
"member") {
469 if ($memberid > 0 && $user->hasRight(
'adherent',
'lire')) {
470 $langs->load(
"members");
474 $result = $adhstat->fetch($memberid);
477 $langs->load(
"mails");
480 $adht->fetch($adhstat->typeid);
484 print
dol_get_fiche_head($head,
'partnerships', $langs->trans(
"ThirdParty"), -1,
'user');
486 $linkback =
'<a href="'.DOL_URL_ROOT.
'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
490 print
'<div class="fichecenter">';
492 print
'<div class="underbanner clearboth"></div>';
493 print
'<table class="border centpercent tableforfield">';
496 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
497 print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</td><td class="valeur">'.$object->login.
' </td></tr>';
501 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td class="valeur">'.$adht->getNomUrl(1).
"</td></tr>\n";
504 print
'<tr><td>'.$langs->trans(
"MemberNature").
'</td><td class="valeur" >'.$adhstat->getmorphylib().
'</td>';
508 print
'<tr><td>'.$langs->trans(
"Company").
'</td><td class="valeur">'.$adhstat->company.
'</td></tr>';
511 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td class="valeur">'.$adhstat->getCivilityLabel().
' </td>';
520 } elseif ($managedfor ==
"thirdparty") {
521 if ($socid && $user->hasRight(
'societe',
'lire')) {
523 $res = $socstat->fetch($socid);
525 $tmpobject = $object;
528 $object = $tmpobject;
530 print
dol_get_fiche_head($head,
'partnerships', $langs->trans(
"ThirdParty"), -1,
'company');
532 dol_banner_tab($socstat,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
534 print
'<div class="fichecenter">';
536 print
'<div class="underbanner clearboth"></div>';
537 print
'<table class="border centpercent tableforfield">';
540 print
'<tr><td class="titlefield">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
541 print $socstat->getTypeUrl(1);
545 if ($socstat->client && !empty($socstat->code_client)) {
546 print
'<tr><td class="titlefield">';
547 print $langs->trans(
'CustomerCode').
'</td><td>';
549 $tmpcheck = $socstat->check_codeclient();
550 if ($tmpcheck != 0 && $tmpcheck != -5) {
551 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
557 if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
558 print
'<tr><td class="titlefield">';
559 print $langs->trans(
'SupplierCode').
'</td><td>';
561 $tmpcheck = $socstat->check_codefournisseur();
562 if ($tmpcheck != 0 && $tmpcheck != -5) {
563 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
576 $arrayofselected = is_array($toselect) ? $toselect : array();
579 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
580 $param .=
'&contextpage='.urlencode($contextpage);
582 if ($limit > 0 && $limit != $conf->liste_limit) {
583 $param .=
'&limit='.urlencode($limit);
586 $param .=
'&socid='.urlencode($socid);
589 $param .=
'&rowid='.urlencode($memberid);
591 foreach ($search as $key => $val) {
592 if (is_array($search[$key]) && count($search[$key])) {
593 foreach ($search[$key] as $skey) {
595 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
598 } elseif ($search[$key] !=
'') {
599 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
602 if ($optioncss !=
'') {
603 $param .=
'&optioncss='.urlencode($optioncss);
605 if ($search_filter && $search_filter !=
'-1') {
606 $param .=
"&search_filter=".urlencode($search_filter);
609 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
611 $parameters = array();
612 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
613 $param .= $hookmanager->resPrint;
616 $arrayofmassactions = array(
618 'approve'=>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"ValidateAndApprove"),
619 'cancel'=>
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Cancel"),
622 'presend'=>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendMail"),
624 if ($permissiontodelete) {
625 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
627 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'prevalidate',
'presend',
'predelete'))) {
628 $arrayofmassactions = array();
630 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
632 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
633 if ($optioncss !=
'') {
634 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
636 print
'<input type="hidden" name="token" value="'.newToken().
'">';
637 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
638 print
'<input type="hidden" name="action" value="list">';
639 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
640 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
641 print
'<input type="hidden" name="page" value="'.$page.
'">';
642 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
643 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
645 print
'<input type="hidden" name="socid" value="'.$socid.
'" >';
646 } elseif ($memberid) {
647 print
'<input type="hidden" name="rowid" value="'.$memberid.
'" >';
650 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/partnership/partnership_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
652 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
655 $topicmail =
"SendPartnershipRef";
656 $modelmail =
"partnership_send";
658 $trackid =
'pship'.$object->id;
659 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
663 foreach ($fieldstosearchall as $key => $val) {
664 $fieldstosearchall[$key] = $langs->trans($val);
665 $setupstring .= $key.
"=".$val.
";";
667 print
'<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
668 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
676 $parameters = array();
677 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
678 if (empty($reshook)) {
679 $moreforfilter .= $hookmanager->resPrint;
681 $moreforfilter = $hookmanager->resPrint;
684 if (!empty($moreforfilter)) {
685 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
686 print $moreforfilter;
690 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
691 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
692 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
694 print
'<div class="div-table-responsive">';
695 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
698 if ($managedfor ==
'member') {
699 $arrayfields[
't.fk_member'][
'checked'] = 1;
701 $arrayfields[
't.fk_soc'][
'checked'] = 1;
705 print
'<tr class="liste_titre">';
707 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
708 print
'<td class="liste_titre maxwidthsearch">';
709 $searchpicto =
$form->showFilterButtons(
'left');
713 foreach ($object->fields as $key => $val) {
714 $searchkey = empty($search[$key]) ?
'' : $search[$key];
715 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
716 if ($key ==
'status') {
717 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
718 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
719 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
720 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
721 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
722 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $key !=
'rowid' && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
723 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
725 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
726 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').
'">';
727 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
728 print
$form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100', 1);
729 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
730 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
731 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
732 print
'<div class="nowrap">';
733 print
$form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
735 print
'<div class="nowrap">';
736 print
$form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
738 } elseif ($key ==
'lang') {
739 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
741 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
743 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
749 if ($managedfor ==
'member') {
750 print
'<td class="liste_titre center">';
751 $selectarray = array(
'-1'=>
'',
'withoutsubscription'=>$langs->trans(
"WithoutSubscription"),
'uptodate'=>$langs->trans(
"UpToDate"),
'outofdate'=>$langs->trans(
"OutOfDate"));
752 print
$form->selectarray(
'search_filter', $selectarray, $search_filter);
756 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
759 $parameters = array(
'arrayfields'=>$arrayfields);
760 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
761 print $hookmanager->resPrint;
763 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
764 print
'<td class="liste_titre maxwidthsearch">';
765 $searchpicto =
$form->showFilterButtons();
771 $totalarray = array();
772 $totalarray[
'nbfield'] = 0;
776 print
'<tr class="liste_titre">';
777 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
778 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
780 foreach ($object->fields as $key => $val) {
781 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
782 if ($key ==
'status') {
783 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
784 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
785 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
786 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
787 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
788 } elseif (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && $key !=
'rowid' && $val[
'label'] !=
'TechnicalID' && empty($val[
'arrayofkeyval'])) {
789 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
791 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
792 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
793 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'],
't.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
794 $totalarray[
'nbfield']++;
798 if ($managedfor ==
'member') {
800 $cssforfield =
'center';
801 print
getTitleFieldOfList(
'SubscriptionEndDate', 0, $_SERVER[
'PHP_SELF'],
'd.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
804 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
806 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
807 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
808 print $hookmanager->resPrint;
810 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
811 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
813 $totalarray[
'nbfield']++;
818 $needToFetchEachLine = 0;
819 if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
820 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
821 if ($val && preg_match(
'/\$object/', $val)) {
822 $needToFetchEachLine++;
831 $savnbfield = $totalarray[
'nbfield'];
832 $totalarray = array();
833 $totalarray[
'nbfield'] = 0;
834 $imaxinloop = ($limit ? min($num, $limit) : $num);
835 while ($i < $imaxinloop) {
836 $obj = $db->fetch_object(
$resql);
842 $object->setVarsFromFetchObj($obj);
844 if ($mode ==
'kanban') {
846 print
'<tr><td colspan="'.$savnbfield.
'">';
847 print
'<div class="box-flex-container">';
850 print $object->getKanbanView(
'');
851 if ($i == ($imaxinloop - 1)) {
858 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
860 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
861 print
'<td class="nowrap center">';
862 if ($massactionbutton || $massaction) {
864 if (in_array($object->id, $arrayofselected)) {
867 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
871 foreach ($object->fields as $key => $val) {
872 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
873 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
874 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
875 } elseif ($key ==
'status') {
876 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
879 if (in_array($val[
'type'], array(
'timestamp'))) {
880 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
881 } elseif ($key ==
'ref') {
882 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
885 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
886 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
890 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
891 print
'<td'.($cssforfield ?
' class="'.$cssforfield.
'"' :
'');
892 if (preg_match(
'/tdoverflow/', $cssforfield)) {
893 print
' title="'.dol_escape_htmltag($object->$key).
'"';
896 if ($key ==
'status') {
897 print $object->getLibStatut(5);
898 } elseif ($key ==
'rowid') {
899 print $object->showOutputField($val, $key, $object->id,
'');
901 print $object->showOutputField($val, $key, $object->$key,
'');
905 $totalarray[
'nbfield']++;
907 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
909 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
911 if (!isset($totalarray[
'val'])) {
912 $totalarray[
'val'] = array();
914 if (!isset($totalarray[
'val'][
't.'.$key])) {
915 $totalarray[
'val'][
't.'.$key] = 0;
917 $totalarray[
'val'][
't.'.$key] += $object->$key;
922 if ($managedfor ==
'member') {
923 print
'<td class="nowrap center endofsubscriptiondate">';
924 $result = $adherent->fetch($object->fk_member);
926 $datefin = $adherent->datefin;
929 if ($adherent->hasDelay()) {
930 $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").
')';
931 print
" ".img_warning($langs->trans(
"SubscriptionLate").$textlate);
934 if ($adherent->subscription ==
'yes') {
935 print $langs->trans(
"SubscriptionNotReceived");
936 if ($adherent->statut > 0) {
937 print
" ".img_warning();
947 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
949 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
950 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
951 print $hookmanager->resPrint;
953 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
954 print
'<td class="nowrap center">';
955 if ($massactionbutton || $massaction) {
957 if (in_array($object->id, $arrayofselected)) {
960 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
965 $totalarray[
'nbfield']++;
973 if ($managedfor !=
'member') $totalarray[
'nbfield']++;
976 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
981 foreach ($arrayfields as $key => $val) {
982 if (!empty($val[
'checked'])) {
986 if ($managedfor !=
'member') $colspan++;
987 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
993 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
994 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
995 print $hookmanager->resPrint;
997 print
'</table>'.
"\n";
1000 print
'</form>'.
"\n";
1003 $hidegeneratedfilelistifempty = 1;
1004 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1005 $hidegeneratedfilelistifempty = 0;
1008 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1012 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1013 $urlsource .= str_replace(
'&',
'&', $param);
1015 $filedir = $diroutputmassaction;
1016 $genallowed = $permissiontoread;
1017 $delallowed = $permissiontoadd;
1019 print $formfile->showdocuments(
'massfilesarea_partnership',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
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.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage members of a foundation.
Class to manage members type.
Class to manage third parties objects (customers, suppliers, prospects...)
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("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->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
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...
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
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_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
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.
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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object informations.
$nbtotalofrecords
Count total nb of records.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.