28require
'../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/partnership/class/partnership.class.php';
47$langs->loadLangs(array(
"partnership",
"members",
"other"));
49$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
50$massaction =
GETPOST(
'massaction',
'alpha');
52$confirm =
GETPOST(
'confirm',
'alpha');
53$cancel =
GETPOST(
'cancel',
'alpha');
54$toselect =
GETPOST(
'toselect',
'array:int');
55$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
56$backtopage =
GETPOST(
'backtopage',
'alpha');
57$optioncss =
GETPOST(
'optioncss',
'aZ');
65$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
66$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
68if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
72$offset = $limit * $page;
80$diroutputmassaction =
$conf->partnership->dir_output.
'/temp/massgeneration/'.$user->id;
82 $hookmanager->initHooks(array(
'thirdpartypartnership',
'globalcard'));
83} elseif ($memberid > 0) {
84 $hookmanager->initHooks(array(
'memberpartnership',
'globalcard'));
86 $hookmanager->initHooks(array(
'partnershiplist'));
90$extrafields->fetch_name_optionals_label(
$object->table_element);
93$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
99if ($sortfield ==
'd.datefin') {
100 if ($managedfor !=
'member' && !
isModEnabled(
'member')) {
106$non_object_fields = array(
107 'town' => array(
'type' =>
'varchar(128)',
'label' =>
'Town',
'enabled' => 1,
'position' => 51,
'notnull' => 0,
'visible' => -1,
'alwayseditable' => 1,
'searchall' => 1,),
108 'country' => array(
'type' =>
'integer',
'label' =>
'Country',
'enabled' => 1,
'position' => 52,
'notnull' => 0,
'visible' => -1,
'alwayseditable' => 1,
'css' =>
'maxwidth500 widthcentpercentminusxx',
'searchall' => 1,),
110 'fk_soc_member' => array(
'type' =>
'custom',
'label' =>
'Member',
'visible' => -1,
'enabled' => ($managedfor !=
'member' &&
isModEnabled(
'member')),
'picto' =>
'member',
'csslist' =>
'tdoverflowmax125',
'position' => 54),
112 'fk_soc_dateend' => array(
'type' =>
'custom',
'label' =>
'DateEndSubscription',
'visible' => -1,
'enabled' => ($managedfor ==
'member' ||
isModEnabled(
'member')),
'picto' =>
'member',
'csslist' =>
'center',
'position' => 55)
119$all_fields_list = array_merge(
$object->fields, $non_object_fields);
123 reset($all_fields_list);
124 $sortfield =
"t.".key($all_fields_list);
131$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
133foreach ($all_fields_list as $key => $val) {
134 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
135 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
137 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
142$search_filter =
GETPOST(
"search_filter",
'alpha');
143$filter =
GETPOST(
"filter",
'alpha');
145 $search_filter = $filter;
149$fieldstosearchall = array();
150foreach ($non_object_fields as $key => $val) {
151 if (!empty($val[
'searchall'])) {
152 $fieldstosearchall[
't.'.$key] = $val[
'label'];
158$arrayfields = array();
159foreach ($all_fields_list as $key => $val) {
161 if (!empty($val[
'visible'])) {
162 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
163 $arrayfields[$tableprefix.
'.'.$key] = array(
164 'label' => $val[
'label'],
165 'checked' => (($visible < 0) ?
'0' :
'1'),
166 'enabled' => (
string) (int) (abs($visible) != 3 && (bool)
dol_eval((
string) $val[
'enabled'], 1)),
167 'position' => $val[
'position'],
168 'help' => isset($val[
'help']) ? $val[
'help'] :
''
173include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
175$parameters = array(
'arrayfields' => &$arrayfields);
176$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
182$permissiontoread = $user->hasRight(
'partnership',
'read');
183$permissiontoadd = $user->hasRight(
'partnership',
'write');
184$permissiontodelete = $user->hasRight(
'partnership',
'delete');
190if (empty(
$conf->partnership->enabled)) {
193if (empty($permissiontoread)) {
196if (
$object->id > 0 && !(
$object->fk_member > 0) && $managedfor ==
'member') {
199if (
$object->id > 0 && !(
$object->fk_soc > 0) && $managedfor ==
'thirdparty') {
208if (
GETPOST(
'cancel',
'alpha')) {
212if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
216$parameters = array(
'socid' => $socid);
217$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
222if (empty($reshook)) {
224 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
227 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
228 foreach ($all_fields_list as $key => $val) {
230 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
231 $search[$key.
'_dtstart'] =
'';
232 $search[$key.
'_dtend'] =
'';
236 $search_array_options = array();
238 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
239 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
244 $objectclass =
'Partnership';
245 $objectlabel =
'Partnership';
246 $uploaddir =
$conf->partnership->dir_output;
247 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
250 if (!$error && $massaction ==
'approve' && $permissiontoadd) {
257 foreach ($toselect as $checked) {
258 if ($objecttmp->fetch($checked)) {
259 if ($objecttmp->status == $objecttmp::STATUS_DRAFT) {
261 $result = $objecttmp->validate($user);
264 if ($result >= 0 && $objecttmp->status == $objecttmp::STATUS_VALIDATED) {
265 $result = $objecttmp->approve($user);
267 setEventMessages($langs->trans(
"PartnershipRefApproved", $objecttmp->ref),
null);
287 if ($massaction ==
'cancel' && $permissiontoadd) {
290 $objecttmp =
new $objectclass(
$db);
292 foreach ($toselect as $toselectid) {
293 $result = $objecttmp->fetch($toselectid);
295 $result = $objecttmp->cancel($user, 0);
297 setEventMessages($langs->trans(
'StatusOfRefMustBe', $objecttmp->ref, $objecttmp->LibStatut($objecttmp::STATUS_APPROVED)),
null,
'warnings');
299 } elseif ($result <= 0) {
335$title = $langs->trans(
"Partnerships");
343$sql .=
$object->getFieldList(
't');
344if ($managedfor ==
'member') {
345 $sql .=
', d.rowid as memberid, d.lastname, d.firstname, d.datefin, d.fk_adherent_type, dty.subscription';
347if ($managedfor ==
'thirdparty' &&
isModEnabled(
'member')) {
348 $sql .=
', d.rowid as memberid, d.lastname, d.firstname, d.datefin, d.fk_adherent_type, dty.subscription';
351if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
352 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
353 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
357$parameters = array();
358$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
359$sql .= $hookmanager->resPrint;
360$sql = preg_replace(
'/,\s*$/',
'', $sql);
364$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
365if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
366 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
368if ($managedfor ==
'member') {
369 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent as d on (d.rowid = t.fk_member)";
370 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent_type as dty on (dty.rowid = d.fk_adherent_type)";
372 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on (s.rowid = t.fk_soc)";
373 if ($managedfor ==
'thirdparty' &&
isModEnabled(
'member')) {
374 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent as d on (d.fk_soc = s.rowid)";
375 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent_type as dty on (dty.rowid = d.fk_adherent_type)";
380$parameters = array();
381$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
382$sql .= $hookmanager->resPrint;
383if (
$object->ismultientitymanaged == 1) {
384 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element).
")";
386 $sql .=
" WHERE 1 = 1";
388if ($managedfor ==
'member') {
390 $sql .=
" AND t.fk_member = ".((int) $memberid);
392 $sql .=
" AND t.fk_member > 0";
396 $sql .=
" AND t.fk_soc = ".((int) $socid);
398 $sql .=
" AND t.fk_soc > 0";
401foreach ($search as $key => $val) {
402 if (array_key_exists($key,
$object->fields)) {
403 if ($key ==
'status' && $search[$key] == -1) {
407 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
408 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
413 if ($search[$key] !=
'') {
414 $sql .=
natural_search(
"t.".
$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
417 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
418 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
419 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
420 if (preg_match(
'/_dtstart$/', $key)) {
421 $sql .=
" AND t.".$db->sanitize($columnName).
" >= '".
$db->idate($search[$key]).
"'";
423 if (preg_match(
'/_dtend$/', $key)) {
424 $sql .=
" AND t.".$db->sanitize($columnName).
" <= '".
$db->idate($search[$key]).
"'";
428 if ($key ==
'country' && $search[$key] !=
'') {
429 if ($managedfor ==
'member') {
430 $sql .=
" AND d.country = '".$db->escape($val).
"'";
432 $sql .=
" AND s.fk_pays = '".$db->escape($val).
"'";
435 if ($key ==
'town' && $search[$key] !=
'') {
436 if ($managedfor ==
'member') {
444if ($managedfor ==
'member' || ($managedfor ==
'thirdparty' &&
isModEnabled(
'member'))) {
445 if ($search_filter ==
'withoutsubscription') {
446 $sql .=
" AND (d.datefin IS NULL)";
448 if ($search_filter ==
'waitingsubscription') {
449 $sql .=
" AND (d.datefin IS NULL AND t.subscription = '1')";
451 if ($search_filter ==
'uptodate') {
452 $sql .=
" AND (d.datefin >= '".$db->idate($now).
"' OR dty.subscription = '0')";
454 if ($search_filter ==
'outofdate') {
455 $sql .=
" AND (d.datefin < '".$db->idate($now).
"' AND dty.subscription = '1')";
459 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
463include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
465$parameters = array();
466$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
467$sql .= $hookmanager->resPrint;
488$nbtotalofrecords =
'';
491 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
492 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
493 $resql =
$db->query($sqlforcount);
495 $objforcount =
$db->fetch_object($resql);
496 $nbtotalofrecords = $objforcount->nbtotalofrecords;
501 if (($page * $limit) > (
int) $nbtotalofrecords) {
509$sql .=
$db->order($sortfield, $sortorder);
511 $sql .=
$db->plimit($limit + 1, $offset);
514$resql =
$db->query($sql);
520$num =
$db->num_rows($resql);
524if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
525 $obj =
$db->fetch_object($resql);
527 header(
"Location: ".
dol_buildpath(
'/partnership/partnership_card.php', 1).
'?id='.$id);
535llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-partnership page-list');
537if ($managedfor ==
"member") {
538 if ($memberid > 0 && $user->hasRight(
'adherent',
'lire')) {
539 $langs->load(
"members");
543 $result = $adhstat->fetch($memberid);
545 $adht->fetch($adhstat->typeid);
549 print
dol_get_fiche_head($head,
'partnerships', $langs->trans(
"ThirdParty"), -1,
'user');
551 $linkback =
'<a href="'.DOL_URL_ROOT.
'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
553 dol_banner_tab($object,
'rowid', $linkback);
555 print
'<div class="fichecenter">';
557 print
'<div class="underbanner clearboth"></div>';
558 print
'<table class="border centpercent tableforfield">';
562 print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</td><td class="valeur">'.
$object->login.
' </td></tr>';
566 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td class="valeur">'.$adht->getNomUrl(1).
"</td></tr>\n";
569 print
'<tr><td>'.$langs->trans(
"MemberNature").
'</td><td class="valeur" >'.$adhstat->getmorphylib().
'</td>';
573 print
'<tr><td>'.$langs->trans(
"Company").
'</td><td class="valeur">'.$adhstat->company.
'</td></tr>';
576 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td class="valeur">'.$adhstat->getCivilityLabel().
' </td>';
585} elseif ($managedfor ==
"thirdparty") {
586 if ($socid && $user->hasRight(
'societe',
'lire')) {
588 $res = $socstat->fetch($socid);
595 print
dol_get_fiche_head($head,
'partnerships', $langs->trans(
"ThirdParty"), -1,
'company');
597 dol_banner_tab($socstat,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
599 print
'<div class="fichecenter">';
601 print
'<div class="underbanner clearboth"></div>';
602 print
'<table class="border centpercent tableforfield">';
605 print
'<tr><td class="titlefield">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
606 print $socstat->getTypeUrl(1);
610 if ($socstat->client && !empty($socstat->code_client)) {
611 print
'<tr><td class="titlefield">';
612 print $langs->trans(
'CustomerCode').
'</td><td>';
614 $tmpcheck = $socstat->check_codeclient();
615 if ($tmpcheck != 0 && $tmpcheck != -5) {
616 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
622 if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
623 print
'<tr><td class="titlefield">';
624 print $langs->trans(
'SupplierCode').
'</td><td>';
626 $tmpcheck = $socstat->check_codefournisseur();
627 if ($tmpcheck != 0 && $tmpcheck != -5) {
628 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
643$arrayofselected = is_array($toselect) ? $toselect : array();
647 $param .=
'&mode='.urlencode($mode);
649if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
650 $param .=
'&contextpage='.urlencode($contextpage);
652if ($limit > 0 && $limit !=
$conf->liste_limit) {
653 $param .=
'&limit='.((int) $limit);
655if ($optioncss !=
'') {
656 $param .=
'&optioncss='.urlencode($optioncss);
659 $param .=
'&socid='.urlencode((
string) ($socid));
662 $param .=
'&rowid='.urlencode((
string) ($memberid));
664foreach ($search as $key => $val) {
665 if (is_array($search[$key])) {
666 foreach ($search[$key] as $skey) {
668 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
671 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
672 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
673 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
674 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
675 } elseif ($search[$key] !=
'') {
676 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
679if ($search_filter && $search_filter !=
'-1') {
680 $param .=
"&search_filter=".urlencode($search_filter);
683include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
685$parameters = array(
'param' => &$param);
686$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
687$param .= $hookmanager->resPrint;
690$arrayofmassactions = array(
692 'approve' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"ValidateAndApprove"),
693 'cancel' =>
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Cancel"),
696 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendMail"),
698if ($permissiontodelete) {
699 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
701if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'prevalidate',
'presend',
'predelete'))) {
702 $arrayofmassactions = array();
704$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
706print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
707if ($optioncss !=
'') {
708 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
710print
'<input type="hidden" name="token" value="'.newToken().
'">';
711print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
712print
'<input type="hidden" name="action" value="list">';
713print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
714print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
715print
'<input type="hidden" name="page" value="'.$page.
'">';
716print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
717print
'<input type="hidden" name="page_y" value="">';
718print
'<input type="hidden" name="mode" value="'.$mode.
'">';
720 print
'<input type="hidden" name="socid" value="'.$socid.
'" >';
721} elseif ($memberid) {
722 print
'<input type="hidden" name="rowid" value="'.$memberid.
'" >';
727$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'));
728$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'));
730$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/partnership/partnership_card.php', 1).
'?action=create'.($socid > 0 ?
'&fk_soc='.$socid :
'').
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].($socid > 0 ?
'?socid='.$socid :
'')),
'', $permissiontoadd);
733print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
736$topicmail =
"SendPartnershipRef";
737$modelmail =
"partnership_send";
739$trackid =
'pship'.$object->id;
740include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
744 foreach ($fieldstosearchall as $key => $val) {
745 $fieldstosearchall[$key] = $langs->trans($val);
746 $setupstring .= $key.
"=".$val.
";";
748 print
'<!-- Search done like if PARTNERSHIP_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
749 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
757$parameters = array();
758$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
759if (empty($reshook)) {
760 $moreforfilter .= $hookmanager->resPrint;
762 $moreforfilter = $hookmanager->resPrint;
765if (!empty($moreforfilter)) {
766 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
767 print $moreforfilter;
771$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
772$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
773$selectedfields = (($mode !=
'kanban' && $mode !=
'kanbangroupby') ? $htmlofselectarray :
'');
774$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
776print
'<div class="div-table-responsive">';
777print
'<table class="tagtable nobottomiftotal noborder liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
780if ($managedfor ==
'member') {
781 $arrayfields[
't.fk_member'][
'checked'] = 1;
783 $arrayfields[
't.fk_soc'][
'checked'] = 1;
789print
'<tr class="liste_titre_filter">';
791if (
$conf->main_checkbox_left_column) {
792 print
'<td class="liste_titre center maxwidthsearch">';
793 $searchpicto = $form->showFilterButtons(
'left');
797foreach ($all_fields_list as $key => $val) {
798 $searchkey = empty($search[$key]) ?
'' : $search[$key];
799 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
800 if ($key ==
'status') {
801 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
802 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
803 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
804 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
805 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
806 } 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'])) {
807 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
809 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
810 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
811 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
812 if (empty($val[
'searchmulti'])) {
813 print $form->selectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), 1, 0, 0,
'', 1, 0, 0,
'',
'maxwidth100'.($key ==
'status' ?
' search_status width100 onrightofpage' :
''), 1);
815 print $form->multiselectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), 0, 0,
'maxwidth100'.($key ==
'status' ?
' search_status width100 onrightofpage' :
''), 1);
817 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
818 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
819 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
820 print
'<div class="nowrap">';
821 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
823 print
'<div class="nowrap">';
824 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
826 } elseif ($key ==
'lang') {
827 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
829 print $formadmin->select_language((isset($search[$key]) ? $search[$key] :
''),
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
830 } elseif ($val[
'type'] ===
'boolean') {
831 print $form->selectyesno(
'search_' . $key, $search[$key] ??
'', 1,
false, 1);
832 } elseif ($key ==
'country') {
833 print $form->select_country(in_array($key, $search) ? $search[$key] : 0,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
834 } elseif ($key ==
'fk_soc_member') {
836 } elseif ($key ==
'fk_soc_dateend') {
837 $selectarray = array(
'-1' =>
'',
'withoutsubscription' => $langs->trans(
"WithoutSubscription"),
'uptodate' => $langs->trans(
"UpToDate"),
'outofdate' => $langs->trans(
"OutOfDate"));
838 print $form->selectarray(
'search_filter', $selectarray, $search_filter);
840 print
'<input type="text" class="flat maxwidth'.(in_array($val[
'type'], array(
'integer',
'price')) ?
'50' :
'75').
'" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
846include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
849$parameters = array(
'arrayfields' => $arrayfields);
850$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
851print $hookmanager->resPrint;
853if (!
$conf->main_checkbox_left_column) {
854 print
'<td class="liste_titre maxwidthsearch">';
855 $searchpicto = $form->showFilterButtons();
866print
'<tr class="liste_titre">';
867if (
$conf->main_checkbox_left_column) {
868 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
871foreach ($all_fields_list as $key => $val) {
872 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
873 if ($key ==
'status') {
874 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
875 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
876 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
877 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
878 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
879 } 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'])) {
880 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
882 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
883 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
884 $tmpfield =
't.'.$key;
885 if ($key ==
'fk_soc_member') {
887 } elseif ($key ==
'fk_soc_dateend') {
888 $tmpfield =
'd.datefin';
889 $cssforfield =
'center';
891 print
getTitleFieldOfList($arrayfields[
't.'.$key][
'label'], 0, $_SERVER[
'PHP_SELF'], $tmpfield,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
''), 0, (empty($val[
'helplist']) ?
'' : $val[
'helplist'])).
"\n";
896include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
898$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
899$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
900print $hookmanager->resPrint;
902if (!
$conf->main_checkbox_left_column) {
903 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
910$needToFetchEachLine = 0;
911if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
912 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
913 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
914 $needToFetchEachLine++;
926$imaxinloop = ($limit ? min($num, $limit) : $num);
928while ($i < $imaxinloop) {
929 $obj =
$db->fetch_object($resql);
935 $object->setVarsFromFetchObj($obj);
938 if ($obj->fk_soc > 0) {
939 if (!empty(
$conf->cache[
'thirdparty'][$obj->fk_soc])) {
940 $companyobj =
$conf->cache[
'thirdparty'][$obj->fk_soc];
943 $companyobj->fetch($obj->fk_soc);
944 $conf->cache[
'thirdparty'][$obj->fk_soc] = $companyobj;
947 $object->thirdparty = $companyobj;
951 if ($managedfor ==
'member' && $obj->fk_member > 0) {
952 $result = $adherent->fetch($obj->fk_member);
954 if ($managedfor ==
'thirdparty' &&
isModEnabled(
'member') && $obj->fk_soc) {
955 $result = $adherent->fetch(0,
'', $obj->fk_soc);
958 if ($mode ==
'kanban' || $mode ==
'kanbangroupby') {
960 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
961 print
'<div class="box-flex-container kanban">';
965 if ($massactionbutton || $massaction) {
967 if (in_array(
$object->id, $arrayofselected)) {
971 print
$object->getKanbanView(
'', array(
'thirdparty' =>
$object->thirdparty,
'selected' => $selected));
972 if ($i == ($imaxinloop - 1)) {
979 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select">';
981 if (
$conf->main_checkbox_left_column) {
982 print
'<td class="nowrap center">';
983 if ($massactionbutton || $massaction) {
985 if (in_array(
$object->id, $arrayofselected)) {
988 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
996 foreach ($all_fields_list as $key => $val) {
997 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
998 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
999 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
1000 } elseif ($key ==
'status') {
1001 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
1004 if (in_array($val[
'type'], array(
'timestamp'))) {
1005 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
1006 } elseif ($key ==
'ref') {
1007 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
1010 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'id',
'rowid',
'ref',
'status')) && empty($val[
'arrayofkeyval'])) {
1011 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
1015 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
1016 print
'<td'.($cssforfield ?
' class="'.$cssforfield.((preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) ?
' classfortooltip' :
'').
'"' :
'');
1017 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key) && !in_array($key, array(
'ref'))) {
1018 print
' title="'.dol_escape_htmltag((
string)
$object->$key).
'"';
1021 if ($key ==
'status') {
1022 print
$object->getLibStatut(5);
1023 } elseif ($key ==
'rowid') {
1024 print
$object->showOutputField($val, $key, (
string)
$object->id,
'');
1025 } elseif ($key ==
'country') {
1026 if ($managedfor ==
'member') {
1027 if (!empty($adherent->country_code)) {
1028 print $langs->trans(
"Country".$adherent->country_code);
1031 if (!empty(
$object->thirdparty->country_code)) {
1032 print $langs->trans(
"Country".
$object->thirdparty->country_code);
1035 } elseif ($key ==
'town') {
1036 if ($managedfor ==
'member') {
1037 print $adherent->town;
1039 print
$object->thirdparty->town;
1041 } elseif ($key ==
'fk_soc_member' && $adherent->id > 0) {
1042 print $adherent->getNomUrl(1);
1043 } elseif ($key ==
'fk_soc_dateend') {
1044 if ($adherent->id > 0) {
1045 $datefin = $adherent->datefin;
1048 if ($adherent->hasDelay()) {
1049 $textlate .=
' ('.$langs->trans(
"DateReference").
' > '.$langs->trans(
"DateToday").
' '.(ceil(
$conf->member->subscription->warning_delay / 60 / 60 / 24) >= 0 ?
'+' :
'').ceil(
$conf->member->subscription->warning_delay / 60 / 60 / 24).
' '.$langs->trans(
"days").
')';
1050 print
" ".img_warning($langs->trans(
"SubscriptionLate").$textlate);
1053 if ($adherent->subscription ==
'yes') {
1054 print $langs->trans(
"SubscriptionNotReceived");
1055 if ($adherent->status > 0) {
1056 print
" ".img_warning();
1070 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
1074 if (!isset($totalarray[
'val'])) {
1077 if (!isset($totalarray[
'val'][
't.'.$key])) {
1085 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1087 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1088 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1089 print $hookmanager->resPrint;
1091 if (!
$conf->main_checkbox_left_column) {
1092 print
'<td class="nowrap center">';
1093 if ($massactionbutton || $massaction) {
1095 if (in_array(
$object->id, $arrayofselected)) {
1098 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1113include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1118 foreach ($arrayfields as $key => $val) {
1119 if (!empty($val[
'checked'])) {
1123 if ($managedfor ==
'member' || ($managedfor ==
'thirdparty' &&
isModEnabled(
'member'))) {
1126 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1132$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1133$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1134print $hookmanager->resPrint;
1136print
'</table>'.
"\n";
1139print
'</form>'.
"\n";
1141if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1142 $hidegeneratedfilelistifempty = 1;
1143 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1144 $hidegeneratedfilelistifempty = 0;
1147 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1151 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1152 $urlsource .= str_replace(
'&',
'&', $param);
1154 $filedir = $diroutputmassaction;
1155 $genallowed = $permissiontoread;
1156 $delallowed = $permissiontoadd;
1158 print $formfile->showdocuments(
'massfilesarea_partnership',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage members of a foundation.
Class to manage members type.
Class to manage third parties objects (customers, suppliers, prospects...)
societe_prepare_head(Societe $object, $subtabs='')
Return array of tabs to used on pages for third parties cards.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object information.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.