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',
'globalcard'));
76 } elseif ($memberid > 0) {
77 $hookmanager->initHooks(array(
'memberpartnership',
'globalcard'));
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, $action);
315 $sql .= $hookmanager->resPrint;
316 $sql = preg_replace(
'/,\s*$/',
'',
$sql);
320 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
321 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
322 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
324 if ($managedfor ==
'member') {
325 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent as d on (d.rowid = t.fk_member)";
326 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent_type as dty on (dty.rowid = d.fk_adherent_type)";
329 $parameters = array();
330 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
331 $sql .= $hookmanager->resPrint;
332 if ($object->ismultientitymanaged == 1) {
333 $sql .=
" WHERE t.entity IN (".getEntity($object->element).
")";
335 $sql .=
" WHERE 1 = 1";
337 if ($managedfor ==
'member') {
339 $sql .=
" AND t.fk_member = ".((int) $memberid);
341 $sql .=
" AND fk_member > 0";
345 $sql .=
" AND t.fk_soc = ".((int) $socid);
347 $sql .=
" AND fk_soc > 0";
350 foreach ($search as $key => $val) {
351 if (array_key_exists($key, $object->fields)) {
352 if ($key ==
'status' && $search[$key] == -1) {
355 $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
356 if ((strpos($object->fields[$key][
'type'],
'integer:') === 0) || (strpos($object->fields[$key][
'type'],
'sellist:') === 0) || !empty($object->fields[$key][
'arrayofkeyval'])) {
357 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty($object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0', $object->fields[$key][
'arrayofkeyval'])))) {
362 if ($search[$key] !=
'') {
363 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
366 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
367 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
368 if (preg_match(
'/^(date|timestamp|datetime)/', $object->fields[$columnName][
'type'])) {
369 if (preg_match(
'/_dtstart$/', $key)) {
370 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
372 if (preg_match(
'/_dtend$/', $key)) {
373 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
379 if ($managedfor ==
'member') {
380 if ($search_filter ==
'withoutsubscription') {
381 $sql .=
" AND (d.datefin IS NULL)";
383 if ($search_filter ==
'waitingsubscription') {
384 $sql .=
" AND (d.datefin IS NULL AND t.subscription = '1')";
386 if ($search_filter ==
'uptodate') {
387 $sql .=
" AND (d.datefin >= '".$db->idate($now).
"' OR dty.subscription = '0')";
389 if ($search_filter ==
'outofdate') {
390 $sql .=
" AND (d.datefin < '".$db->idate($now).
"' AND dty.subscription = '1')";
398 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
400 $parameters = array();
401 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
402 $sql .= $hookmanager->resPrint;
423 $nbtotalofrecords =
'';
426 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords',
$sql);
427 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
428 $resql = $db->query($sqlforcount);
430 $objforcount = $db->fetch_object($resql);
431 $nbtotalofrecords = $objforcount->nbtotalofrecords;
436 if (($page * $limit) > $nbtotalofrecords) {
444 $sql .= $db->order($sortfield, $sortorder);
446 $sql .= $db->plimit($limit + 1, $offset);
449 $resql = $db->query(
$sql);
455 $num = $db->num_rows($resql);
459 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
460 $obj = $db->fetch_object($resql);
462 header(
"Location: ".
dol_buildpath(
'/partnership/partnership_card.php', 1).
'?id='.$id);
472 if ($managedfor ==
"member") {
473 if ($memberid > 0 && $user->hasRight(
'adherent',
'lire')) {
474 $langs->load(
"members");
478 $result = $adhstat->fetch($memberid);
481 $langs->load(
"mails");
484 $adht->fetch($adhstat->typeid);
488 print
dol_get_fiche_head($head,
'partnerships', $langs->trans(
"ThirdParty"), -1,
'user');
490 $linkback =
'<a href="'.DOL_URL_ROOT.
'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
494 print
'<div class="fichecenter">';
496 print
'<div class="underbanner clearboth"></div>';
497 print
'<table class="border centpercent tableforfield">';
500 if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
501 print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</td><td class="valeur">'.$object->login.
' </td></tr>';
505 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td class="valeur">'.$adht->getNomUrl(1).
"</td></tr>\n";
508 print
'<tr><td>'.$langs->trans(
"MemberNature").
'</td><td class="valeur" >'.$adhstat->getmorphylib().
'</td>';
512 print
'<tr><td>'.$langs->trans(
"Company").
'</td><td class="valeur">'.$adhstat->company.
'</td></tr>';
515 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td class="valeur">'.$adhstat->getCivilityLabel().
' </td>';
524 } elseif ($managedfor ==
"thirdparty") {
525 if ($socid && $user->hasRight(
'societe',
'lire')) {
527 $res = $socstat->fetch($socid);
529 $tmpobject = $object;
532 $object = $tmpobject;
534 print
dol_get_fiche_head($head,
'partnerships', $langs->trans(
"ThirdParty"), -1,
'company');
536 dol_banner_tab($socstat,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
538 print
'<div class="fichecenter">';
540 print
'<div class="underbanner clearboth"></div>';
541 print
'<table class="border centpercent tableforfield">';
544 print
'<tr><td class="titlefield">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
545 print $socstat->getTypeUrl(1);
549 if ($socstat->client && !empty($socstat->code_client)) {
550 print
'<tr><td class="titlefield">';
551 print $langs->trans(
'CustomerCode').
'</td><td>';
553 $tmpcheck = $socstat->check_codeclient();
554 if ($tmpcheck != 0 && $tmpcheck != -5) {
555 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
561 if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
562 print
'<tr><td class="titlefield">';
563 print $langs->trans(
'SupplierCode').
'</td><td>';
565 $tmpcheck = $socstat->check_codefournisseur();
566 if ($tmpcheck != 0 && $tmpcheck != -5) {
567 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
580 $arrayofselected = is_array($toselect) ? $toselect : array();
584 $param .=
'&mode='.urlencode($mode);
586 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
587 $param .=
'&contextpage='.urlencode($contextpage);
589 if ($limit > 0 && $limit != $conf->liste_limit) {
590 $param .=
'&limit='.((int) $limit);
593 $param .=
'&socid='.urlencode($socid);
596 $param .=
'&rowid='.urlencode($memberid);
598 foreach ($search as $key => $val) {
599 if (is_array($search[$key])) {
600 foreach ($search[$key] as $skey) {
602 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
605 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
606 $param .=
'&search_'.$key.
'month='.((int)
GETPOST(
'search_'.$key.
'month',
'int'));
607 $param .=
'&search_'.$key.
'day='.((int)
GETPOST(
'search_'.$key.
'day',
'int'));
608 $param .=
'&search_'.$key.
'year='.((int)
GETPOST(
'search_'.$key.
'year',
'int'));
609 } elseif ($search[$key] !=
'') {
610 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
613 if ($optioncss !=
'') {
614 $param .=
'&optioncss='.urlencode($optioncss);
616 if ($search_filter && $search_filter !=
'-1') {
617 $param .=
"&search_filter=".urlencode($search_filter);
620 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
622 $parameters = array();
623 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
624 $param .= $hookmanager->resPrint;
627 $arrayofmassactions = array(
629 'approve'=>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"ValidateAndApprove"),
630 'cancel'=>
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Cancel"),
633 'presend'=>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendMail"),
635 if ($permissiontodelete) {
636 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
638 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'prevalidate',
'presend',
'predelete'))) {
639 $arrayofmassactions = array();
641 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
643 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
644 if ($optioncss !=
'') {
645 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
647 print
'<input type="hidden" name="token" value="'.newToken().
'">';
648 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
649 print
'<input type="hidden" name="action" value="list">';
650 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
651 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
652 print
'<input type="hidden" name="page" value="'.$page.
'">';
653 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
654 print
'<input type="hidden" name="page_y" value="">';
655 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
657 print
'<input type="hidden" name="socid" value="'.$socid.
'" >';
658 } elseif ($memberid) {
659 print
'<input type="hidden" name="rowid" value="'.$memberid.
'" >';
664 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss'=>
'reposition'));
665 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
667 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/partnership/partnership_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF']),
'', $permissiontoadd);
670 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
673 $topicmail =
"SendPartnershipRef";
674 $modelmail =
"partnership_send";
676 $trackid =
'pship'.$object->id;
677 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
681 foreach ($fieldstosearchall as $key => $val) {
682 $fieldstosearchall[$key] = $langs->trans($val);
683 $setupstring .= $key.
"=".$val.
";";
685 print
'<!-- Search done like if PARTNERSHIP_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
686 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>'.
"\n";
694 $parameters = array();
695 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
696 if (empty($reshook)) {
697 $moreforfilter .= $hookmanager->resPrint;
699 $moreforfilter = $hookmanager->resPrint;
702 if (!empty($moreforfilter)) {
703 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
704 print $moreforfilter;
705 $parameters = array(
'type'=>$type);
706 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
707 print $hookmanager->resPrint;
711 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
712 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
713 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
715 print
'<div class="div-table-responsive">';
716 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
719 if ($managedfor ==
'member') {
720 $arrayfields[
't.fk_member'][
'checked'] = 1;
722 $arrayfields[
't.fk_soc'][
'checked'] = 1;
726 print
'<tr class="liste_titre_filter">';
729 print
'<td class="liste_titre maxwidthsearch">';
730 $searchpicto =
$form->showFilterButtons(
'left');
734 foreach ($object->fields as $key => $val) {
735 $searchkey = empty($search[$key]) ?
'' : $search[$key];
736 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
737 if ($key ==
'status') {
738 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
739 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
740 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
741 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
742 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
743 } 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'])) {
744 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
746 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
747 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
748 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
749 print
$form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), $val[
'notnull'], 0, 0,
'', 1, 0, 0,
'',
'maxwidth100'.($key ==
'status' ?
' search_status width100 onrightofpage' :
''), 1);
750 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
751 print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
752 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
753 print
'<div class="nowrap">';
754 print
$form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
756 print
'<div class="nowrap">';
757 print
$form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
759 } elseif ($key ==
'lang') {
760 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
762 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth150 maxwidth200', 2);
764 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
770 if ($managedfor ==
'member') {
771 print
'<td class="liste_titre center">';
772 $selectarray = array(
'-1'=>
'',
'withoutsubscription'=>$langs->trans(
"WithoutSubscription"),
'uptodate'=>$langs->trans(
"UpToDate"),
'outofdate'=>$langs->trans(
"OutOfDate"));
773 print
$form->selectarray(
'search_filter', $selectarray, $search_filter);
777 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
780 $parameters = array(
'arrayfields'=>$arrayfields);
781 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
782 print $hookmanager->resPrint;
785 print
'<td class="liste_titre maxwidthsearch">';
786 $searchpicto =
$form->showFilterButtons();
792 $totalarray = array();
793 $totalarray[
'nbfield'] = 0;
797 print
'<tr class="liste_titre">';
799 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
800 $totalarray[
'nbfield']++;
802 foreach ($object->fields as $key => $val) {
803 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
804 if ($key ==
'status') {
805 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
806 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
807 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
808 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
809 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
810 } 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'])) {
811 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
813 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
814 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
815 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";
816 $totalarray[
'nbfield']++;
820 if ($managedfor ==
'member') {
822 $cssforfield =
'center';
823 print
getTitleFieldOfList(
'SubscriptionEndDate', 0, $_SERVER[
'PHP_SELF'],
'd.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
826 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
828 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
829 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
830 print $hookmanager->resPrint;
833 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
834 $totalarray[
'nbfield']++;
840 $needToFetchEachLine = 0;
841 if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
842 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
843 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
844 $needToFetchEachLine++;
853 $savnbfield = $totalarray[
'nbfield'];
854 $totalarray = array();
855 $totalarray[
'nbfield'] = 0;
856 $imaxinloop = ($limit ? min($num, $limit) : $num);
857 while ($i < $imaxinloop) {
858 $obj = $db->fetch_object($resql);
864 $object->setVarsFromFetchObj($obj);
866 if ($mode ==
'kanban') {
868 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
869 print
'<div class="box-flex-container kanban">';
872 print $object->getKanbanView(
'', array(
'selected' => in_array($object->id, $arrayofselected)));
873 if ($i == ($imaxinloop - 1)) {
880 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
883 print
'<td class="nowrap center">';
884 if ($massactionbutton || $massaction) {
886 if (in_array($object->id, $arrayofselected)) {
889 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
893 $totalarray[
'nbfield']++;
896 foreach ($object->fields as $key => $val) {
897 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
898 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
899 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
900 } elseif ($key ==
'status') {
901 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
904 if (in_array($val[
'type'], array(
'timestamp'))) {
905 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
906 } elseif ($key ==
'ref') {
907 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
910 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
911 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
915 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
916 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
917 if (preg_match(
'/tdoverflow/', $cssforfield) && !is_numeric($object->$key)) {
918 print
' title="'.dol_escape_htmltag($object->$key).
'"';
921 if ($key ==
'status') {
922 print $object->getLibStatut(5);
923 } elseif ($key ==
'rowid') {
924 print $object->showOutputField($val, $key, $object->id,
'');
926 print $object->showOutputField($val, $key, $object->$key,
'');
930 $totalarray[
'nbfield']++;
932 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
934 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
936 if (!isset($totalarray[
'val'])) {
937 $totalarray[
'val'] = array();
939 if (!isset($totalarray[
'val'][
't.'.$key])) {
940 $totalarray[
'val'][
't.'.$key] = 0;
942 $totalarray[
'val'][
't.'.$key] += $object->$key;
947 if ($managedfor ==
'member') {
948 print
'<td class="nowrap center endofsubscriptiondate">';
949 $result = $adherent->fetch($object->fk_member);
951 $datefin = $adherent->datefin;
954 if ($adherent->hasDelay()) {
955 $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").
')';
956 print
" ".img_warning($langs->trans(
"SubscriptionLate").$textlate);
959 if ($adherent->subscription ==
'yes') {
960 print $langs->trans(
"SubscriptionNotReceived");
961 if ($adherent->statut > 0) {
962 print
" ".img_warning();
972 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
974 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
975 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
976 print $hookmanager->resPrint;
979 print
'<td class="nowrap center">';
980 if ($massactionbutton || $massaction) {
982 if (in_array($object->id, $arrayofselected)) {
985 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
989 $totalarray[
'nbfield']++;
998 if ($managedfor !=
'member') {
999 $totalarray[
'nbfield']++;
1003 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1008 foreach ($arrayfields as $key => $val) {
1009 if (!empty($val[
'checked'])) {
1013 if ($managedfor !=
'member') {
1016 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1022 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>
$sql);
1023 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1024 print $hookmanager->resPrint;
1026 print
'</table>'.
"\n";
1027 print
'</div>'.
"\n";
1029 print
'</form>'.
"\n";
1031 if (in_array(
'builddoc', $arrayofmassactions) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1032 $hidegeneratedfilelistifempty = 1;
1033 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1034 $hidegeneratedfilelistifempty = 0;
1037 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1041 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1042 $urlsource .= str_replace(
'&',
'&', $param);
1044 $filedir = $diroutputmassaction;
1045 $genallowed = $permissiontoread;
1046 $delallowed = $permissiontoadd;
1048 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') && $user->hasRight('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') && $user->hasRight('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)) $sql
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...
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
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.
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...
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.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
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.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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...
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object informations.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.