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';
179$permissiontoread = $user->hasRight(
'partnership',
'read');
180$permissiontoadd = $user->hasRight(
'partnership',
'write');
181$permissiontodelete = $user->hasRight(
'partnership',
'delete');
187if (empty(
$conf->partnership->enabled)) {
190if (empty($permissiontoread)) {
193if (
$object->id > 0 && !(
$object->fk_member > 0) && $managedfor ==
'member') {
196if (
$object->id > 0 && !(
$object->fk_soc > 0) && $managedfor ==
'thirdparty') {
205if (
GETPOST(
'cancel',
'alpha')) {
209if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
213$parameters = array(
'socid' => $socid);
214$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
219if (empty($reshook)) {
221 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
224 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
225 foreach ($all_fields_list as $key => $val) {
227 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
228 $search[$key.
'_dtstart'] =
'';
229 $search[$key.
'_dtend'] =
'';
233 $search_array_options = array();
235 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
236 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
241 $objectclass =
'Partnership';
242 $objectlabel =
'Partnership';
243 $uploaddir =
$conf->partnership->dir_output;
244 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
247 if (!$error && $massaction ==
'approve' && $permissiontoadd) {
254 foreach ($toselect as $checked) {
255 if ($objecttmp->fetch($checked)) {
256 if ($objecttmp->status == $objecttmp::STATUS_DRAFT) {
258 $result = $objecttmp->validate($user);
261 if ($result >= 0 && $objecttmp->status == $objecttmp::STATUS_VALIDATED) {
262 $result = $objecttmp->approve($user);
264 setEventMessages($langs->trans(
"PartnershipRefApproved", $objecttmp->ref),
null);
284 if ($massaction ==
'cancel' && $permissiontoadd) {
287 $objecttmp =
new $objectclass(
$db);
289 foreach ($toselect as $toselectid) {
290 $result = $objecttmp->fetch($toselectid);
292 $result = $objecttmp->cancel($user, 0);
294 setEventMessages($langs->trans(
'StatusOfRefMustBe', $objecttmp->ref, $objecttmp->LibStatut($objecttmp::STATUS_APPROVED)),
null,
'warnings');
296 } elseif ($result <= 0) {
332$title = $langs->trans(
"Partnerships");
340$sql .=
$object->getFieldList(
't');
341if ($managedfor ==
'member') {
342 $sql .=
', d.rowid as memberid, d.lastname, d.firstname, d.datefin, d.fk_adherent_type, dty.subscription';
344if ($managedfor ==
'thirdparty' &&
isModEnabled(
'member')) {
345 $sql .=
', d.rowid as memberid, d.lastname, d.firstname, d.datefin, d.fk_adherent_type, dty.subscription';
348if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
349 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
350 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
354$parameters = array();
355$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
356$sql .= $hookmanager->resPrint;
357$sql = preg_replace(
'/,\s*$/',
'', $sql);
361$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
362if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
363 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
365if ($managedfor ==
'member') {
366 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent as d on (d.rowid = t.fk_member)";
367 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent_type as dty on (dty.rowid = d.fk_adherent_type)";
369 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s on (s.rowid = t.fk_soc)";
370 if ($managedfor ==
'thirdparty' &&
isModEnabled(
'member')) {
371 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent as d on (d.fk_soc = s.rowid)";
372 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent_type as dty on (dty.rowid = d.fk_adherent_type)";
377$parameters = array();
378$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
379$sql .= $hookmanager->resPrint;
380if (
$object->ismultientitymanaged == 1) {
381 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element).
")";
383 $sql .=
" WHERE 1 = 1";
385if ($managedfor ==
'member') {
387 $sql .=
" AND t.fk_member = ".((int) $memberid);
389 $sql .=
" AND t.fk_member > 0";
393 $sql .=
" AND t.fk_soc = ".((int) $socid);
395 $sql .=
" AND t.fk_soc > 0";
398foreach ($search as $key => $val) {
399 if (array_key_exists($key,
$object->fields)) {
400 if ($key ==
'status' && $search[$key] == -1) {
404 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
405 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
410 if ($search[$key] !=
'') {
411 $sql .=
natural_search(
"t.".
$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
414 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
415 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
416 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
417 if (preg_match(
'/_dtstart$/', $key)) {
418 $sql .=
" AND t.".$db->escape($columnName).
" >= '".
$db->idate($search[$key]).
"'";
420 if (preg_match(
'/_dtend$/', $key)) {
421 $sql .=
" AND t.".$db->escape($columnName).
" <= '".
$db->idate($search[$key]).
"'";
425 if ($key ==
'country' && $search[$key] !=
'') {
426 if ($managedfor ==
'member') {
427 $sql .=
" AND d.country = '".$db->escape($val).
"'";
429 $sql .=
" AND s.fk_pays = '".$db->escape($val).
"'";
432 if ($key ==
'town' && $search[$key] !=
'') {
433 if ($managedfor ==
'member') {
441if ($managedfor ==
'member' || ($managedfor ==
'thirdparty' &&
isModEnabled(
'member'))) {
442 if ($search_filter ==
'withoutsubscription') {
443 $sql .=
" AND (d.datefin IS NULL)";
445 if ($search_filter ==
'waitingsubscription') {
446 $sql .=
" AND (d.datefin IS NULL AND t.subscription = '1')";
448 if ($search_filter ==
'uptodate') {
449 $sql .=
" AND (d.datefin >= '".$db->idate($now).
"' OR dty.subscription = '0')";
451 if ($search_filter ==
'outofdate') {
452 $sql .=
" AND (d.datefin < '".$db->idate($now).
"' AND dty.subscription = '1')";
456 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
460include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
462$parameters = array();
463$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
464$sql .= $hookmanager->resPrint;
485$nbtotalofrecords =
'';
488 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
489 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
490 $resql =
$db->query($sqlforcount);
492 $objforcount =
$db->fetch_object($resql);
493 $nbtotalofrecords = $objforcount->nbtotalofrecords;
498 if (($page * $limit) > (
int) $nbtotalofrecords) {
506$sql .=
$db->order($sortfield, $sortorder);
508 $sql .=
$db->plimit($limit + 1, $offset);
511$resql =
$db->query($sql);
517$num =
$db->num_rows($resql);
521if ($num == 1 &&
getDolGlobalInt(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
522 $obj =
$db->fetch_object($resql);
524 header(
"Location: ".
dol_buildpath(
'/partnership/partnership_card.php', 1).
'?id='.$id);
532llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-partnership page-list');
534if ($managedfor ==
"member") {
535 if ($memberid > 0 && $user->hasRight(
'adherent',
'lire')) {
536 $langs->load(
"members");
540 $result = $adhstat->fetch($memberid);
542 $adht->fetch($adhstat->typeid);
546 print
dol_get_fiche_head($head,
'partnerships', $langs->trans(
"ThirdParty"), -1,
'user');
548 $linkback =
'<a href="'.DOL_URL_ROOT.
'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
550 dol_banner_tab($object,
'rowid', $linkback);
552 print
'<div class="fichecenter">';
554 print
'<div class="underbanner clearboth"></div>';
555 print
'<table class="border centpercent tableforfield">';
559 print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</td><td class="valeur">'.
$object->login.
' </td></tr>';
563 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td class="valeur">'.$adht->getNomUrl(1).
"</td></tr>\n";
566 print
'<tr><td>'.$langs->trans(
"MemberNature").
'</td><td class="valeur" >'.$adhstat->getmorphylib().
'</td>';
570 print
'<tr><td>'.$langs->trans(
"Company").
'</td><td class="valeur">'.$adhstat->company.
'</td></tr>';
573 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td class="valeur">'.$adhstat->getCivilityLabel().
' </td>';
582} elseif ($managedfor ==
"thirdparty") {
583 if ($socid && $user->hasRight(
'societe',
'lire')) {
585 $res = $socstat->fetch($socid);
592 print
dol_get_fiche_head($head,
'partnerships', $langs->trans(
"ThirdParty"), -1,
'company');
594 dol_banner_tab($socstat,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
596 print
'<div class="fichecenter">';
598 print
'<div class="underbanner clearboth"></div>';
599 print
'<table class="border centpercent tableforfield">';
602 print
'<tr><td class="titlefield">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
603 print $socstat->getTypeUrl(1);
607 if ($socstat->client && !empty($socstat->code_client)) {
608 print
'<tr><td class="titlefield">';
609 print $langs->trans(
'CustomerCode').
'</td><td>';
611 $tmpcheck = $socstat->check_codeclient();
612 if ($tmpcheck != 0 && $tmpcheck != -5) {
613 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
619 if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
620 print
'<tr><td class="titlefield">';
621 print $langs->trans(
'SupplierCode').
'</td><td>';
623 $tmpcheck = $socstat->check_codefournisseur();
624 if ($tmpcheck != 0 && $tmpcheck != -5) {
625 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
640$arrayofselected = is_array($toselect) ? $toselect : array();
644 $param .=
'&mode='.urlencode($mode);
646if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
647 $param .=
'&contextpage='.urlencode($contextpage);
649if ($limit > 0 && $limit !=
$conf->liste_limit) {
650 $param .=
'&limit='.((int) $limit);
652if ($optioncss !=
'') {
653 $param .=
'&optioncss='.urlencode($optioncss);
656 $param .=
'&socid='.urlencode((
string) ($socid));
659 $param .=
'&rowid='.urlencode((
string) ($memberid));
661foreach ($search as $key => $val) {
662 if (is_array($search[$key])) {
663 foreach ($search[$key] as $skey) {
665 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
668 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
669 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
670 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
671 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
672 } elseif ($search[$key] !=
'') {
673 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
676if ($search_filter && $search_filter !=
'-1') {
677 $param .=
"&search_filter=".urlencode($search_filter);
680include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
682$parameters = array(
'param' => &$param);
683$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
684$param .= $hookmanager->resPrint;
687$arrayofmassactions = array(
689 'approve' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"ValidateAndApprove"),
690 'cancel' =>
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Cancel"),
693 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendMail"),
695if ($permissiontodelete) {
696 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
698if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'prevalidate',
'presend',
'predelete'))) {
699 $arrayofmassactions = array();
701$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
703print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
704if ($optioncss !=
'') {
705 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
707print
'<input type="hidden" name="token" value="'.newToken().
'">';
708print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
709print
'<input type="hidden" name="action" value="list">';
710print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
711print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
712print
'<input type="hidden" name="page" value="'.$page.
'">';
713print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
714print
'<input type="hidden" name="page_y" value="">';
715print
'<input type="hidden" name="mode" value="'.$mode.
'">';
717 print
'<input type="hidden" name="socid" value="'.$socid.
'" >';
718} elseif ($memberid) {
719 print
'<input type="hidden" name="rowid" value="'.$memberid.
'" >';
724$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'));
725$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'));
726$newcardbutton .= dolGetButtonTitleSeparator();
727$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);
730print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
733$topicmail =
"SendPartnershipRef";
734$modelmail =
"partnership_send";
736$trackid =
'pship'.$object->id;
737include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
741 foreach ($fieldstosearchall as $key => $val) {
742 $fieldstosearchall[$key] = $langs->trans($val);
743 $setupstring .= $key.
"=".$val.
";";
745 print
'<!-- Search done like if PARTNERSHIP_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
746 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
754$parameters = array();
755$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
756if (empty($reshook)) {
757 $moreforfilter .= $hookmanager->resPrint;
759 $moreforfilter = $hookmanager->resPrint;
762if (!empty($moreforfilter)) {
763 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
764 print $moreforfilter;
768$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
769$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
770$selectedfields = (($mode !=
'kanban' && $mode !=
'kanbangroupby') ? $htmlofselectarray :
'');
771$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
773print
'<div class="div-table-responsive">';
774print
'<table class="tagtable nobottomiftotal noborder liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
777if ($managedfor ==
'member') {
778 $arrayfields[
't.fk_member'][
'checked'] = 1;
780 $arrayfields[
't.fk_soc'][
'checked'] = 1;
786print
'<tr class="liste_titre_filter">';
788if (
$conf->main_checkbox_left_column) {
789 print
'<td class="liste_titre center maxwidthsearch">';
790 $searchpicto = $form->showFilterButtons(
'left');
794foreach ($all_fields_list as $key => $val) {
795 $searchkey = empty($search[$key]) ?
'' : $search[$key];
796 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
797 if ($key ==
'status') {
798 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
799 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
800 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
801 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
802 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
803 } 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'])) {
804 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
806 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
807 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
808 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
809 if (empty($val[
'searchmulti'])) {
810 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);
812 print $form->multiselectarray(
'search_'.$key, $val[
'arrayofkeyval'], (isset($search[$key]) ? $search[$key] :
''), 0, 0,
'maxwidth100'.($key ==
'status' ?
' search_status width100 onrightofpage' :
''), 1);
814 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
815 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
816 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
817 print
'<div class="nowrap">';
818 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
820 print
'<div class="nowrap">';
821 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
823 } elseif ($key ==
'lang') {
824 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
826 print $formadmin->select_language((isset($search[$key]) ? $search[$key] :
''),
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
827 } elseif ($val[
'type'] ===
'boolean') {
828 print $form->selectyesno(
'search_' . $key, $search[$key] ??
'', 1,
false, 1);
829 } elseif ($key ==
'country') {
830 print $form->select_country(in_array($key, $search) ? $search[$key] : 0,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
831 } elseif ($key ==
'fk_soc_member') {
833 } elseif ($key ==
'fk_soc_dateend') {
834 $selectarray = array(
'-1' =>
'',
'withoutsubscription' => $langs->trans(
"WithoutSubscription"),
'uptodate' => $langs->trans(
"UpToDate"),
'outofdate' => $langs->trans(
"OutOfDate"));
835 print $form->selectarray(
'search_filter', $selectarray, $search_filter);
837 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] :
'').
'">';
843include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
846$parameters = array(
'arrayfields' => $arrayfields);
847$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
848print $hookmanager->resPrint;
850if (!
$conf->main_checkbox_left_column) {
851 print
'<td class="liste_titre maxwidthsearch">';
852 $searchpicto = $form->showFilterButtons();
863print
'<tr class="liste_titre">';
864if (
$conf->main_checkbox_left_column) {
865 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
868foreach ($all_fields_list as $key => $val) {
869 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
870 if ($key ==
'status') {
871 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
872 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
873 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
874 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
875 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
876 } 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'])) {
877 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
879 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
880 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
881 $tmpfield =
't.'.$key;
882 if ($key ==
'fk_soc_member') {
884 } elseif ($key ==
'fk_soc_dateend') {
885 $tmpfield =
'd.datefin';
886 $cssforfield =
'center';
888 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";
893include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
895$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
896$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
897print $hookmanager->resPrint;
899if (!
$conf->main_checkbox_left_column) {
900 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
907$needToFetchEachLine = 0;
908if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
909 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
910 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
911 $needToFetchEachLine++;
923$imaxinloop = ($limit ? min($num, $limit) : $num);
925while ($i < $imaxinloop) {
926 $obj =
$db->fetch_object($resql);
932 $object->setVarsFromFetchObj($obj);
935 if ($obj->fk_soc > 0) {
936 if (!empty(
$conf->cache[
'thirdparty'][$obj->fk_soc])) {
937 $companyobj =
$conf->cache[
'thirdparty'][$obj->fk_soc];
940 $companyobj->fetch($obj->fk_soc);
941 $conf->cache[
'thirdparty'][$obj->fk_soc] = $companyobj;
944 $object->thirdparty = $companyobj;
948 if ($managedfor ==
'member' && $obj->fk_member > 0) {
949 $result = $adherent->fetch($obj->fk_member);
951 if ($managedfor ==
'thirdparty' &&
isModEnabled(
'member') && $obj->fk_soc) {
952 $result = $adherent->fetch(0,
'', $obj->fk_soc);
955 if ($mode ==
'kanban' || $mode ==
'kanbangroupby') {
957 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
958 print
'<div class="box-flex-container kanban">';
962 if ($massactionbutton || $massaction) {
964 if (in_array(
$object->id, $arrayofselected)) {
968 print
$object->getKanbanView(
'', array(
'thirdparty' =>
$object->thirdparty,
'selected' => $selected));
969 if ($i == ($imaxinloop - 1)) {
976 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select">';
978 if (
$conf->main_checkbox_left_column) {
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"' :
'').
'>';
993 foreach ($all_fields_list as $key => $val) {
994 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
995 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
996 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
997 } elseif ($key ==
'status') {
998 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
1001 if (in_array($val[
'type'], array(
'timestamp'))) {
1002 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
1003 } elseif ($key ==
'ref') {
1004 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowraponall';
1007 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'])) {
1008 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
1012 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
1013 print
'<td'.($cssforfield ?
' class="'.$cssforfield.((preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) ?
' classfortooltip' :
'').
'"' :
'');
1014 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key) && !in_array($key, array(
'ref'))) {
1015 print
' title="'.dol_escape_htmltag((
string)
$object->$key).
'"';
1018 if ($key ==
'status') {
1019 print
$object->getLibStatut(5);
1020 } elseif ($key ==
'rowid') {
1021 print
$object->showOutputField($val, $key, (
string)
$object->id,
'');
1022 } elseif ($key ==
'country') {
1023 if ($managedfor ==
'member') {
1024 if (!empty($adherent->country_code)) {
1025 print $langs->trans(
"Country".$adherent->country_code);
1028 if (!empty(
$object->thirdparty->country_code)) {
1029 print $langs->trans(
"Country".
$object->thirdparty->country_code);
1032 } elseif ($key ==
'town') {
1033 if ($managedfor ==
'member') {
1034 print $adherent->town;
1036 print
$object->thirdparty->town;
1038 } elseif ($key ==
'fk_soc_member' && $adherent->id > 0) {
1039 print $adherent->getNomUrl(1);
1040 } elseif ($key ==
'fk_soc_dateend') {
1041 if ($adherent->id > 0) {
1042 $datefin = $adherent->datefin;
1045 if ($adherent->hasDelay()) {
1046 $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").
')';
1047 print
" ".img_warning($langs->trans(
"SubscriptionLate").$textlate);
1050 if ($adherent->subscription ==
'yes') {
1051 print $langs->trans(
"SubscriptionNotReceived");
1052 if ($adherent->status > 0) {
1053 print
" ".img_warning();
1067 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
1071 if (!isset($totalarray[
'val'])) {
1074 if (!isset($totalarray[
'val'][
't.'.$key])) {
1082 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1084 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1085 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1086 print $hookmanager->resPrint;
1088 if (!
$conf->main_checkbox_left_column) {
1089 print
'<td class="nowrap center">';
1090 if ($massactionbutton || $massaction) {
1092 if (in_array(
$object->id, $arrayofselected)) {
1095 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1110include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1115 foreach ($arrayfields as $key => $val) {
1116 if (!empty($val[
'checked'])) {
1120 if ($managedfor ==
'member' || ($managedfor ==
'thirdparty' &&
isModEnabled(
'member'))) {
1123 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1129$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1130$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1131print $hookmanager->resPrint;
1133print
'</table>'.
"\n";
1136print
'</form>'.
"\n";
1138if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1139 $hidegeneratedfilelistifempty = 1;
1140 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1141 $hidegeneratedfilelistifempty = 0;
1144 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1148 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1149 $urlsource .= str_replace(
'&',
'&', $param);
1151 $filedir = $diroutputmassaction;
1152 $genallowed = $permissiontoread;
1153 $delallowed = $permissiontoadd;
1155 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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_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)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
natural_search($fields, $value, $mode=0, $nofirstand=0, $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...
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_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).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
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...
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
buildzip.php
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.