28require
'../main.inc.php';
36require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/partnership/class/partnership.class.php';
46$langs->loadLangs(array(
"partnership",
"members",
"other"));
48$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
49$massaction =
GETPOST(
'massaction',
'alpha');
51$confirm =
GETPOST(
'confirm',
'alpha');
52$cancel =
GETPOST(
'cancel',
'alpha');
53$toselect =
GETPOST(
'toselect',
'array:int');
54$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
55$backtopage =
GETPOST(
'backtopage',
'alpha');
56$optioncss =
GETPOST(
'optioncss',
'aZ');
64$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
65$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
67if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
71$offset = $limit * $page;
79$diroutputmassaction = $conf->partnership->dir_output.
'/temp/massgeneration/'.$user->id;
81 $hookmanager->initHooks(array(
'thirdpartypartnership',
'globalcard'));
82} elseif ($memberid > 0) {
83 $hookmanager->initHooks(array(
'memberpartnership',
'globalcard'));
85 $hookmanager->initHooks(array(
'partnershiplist'));
89$extrafields->fetch_name_optionals_label(
$object->table_element);
92$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
98if ($managedfor !=
'member' && $sortfield ==
'd.datefin') {
103$non_object_fields = array(
104 'town' => array(
'type' =>
'varchar(128)',
'label' =>
'Town',
'enabled' => 1,
'position' => 51,
'notnull' => 0,
'visible' => 1,
'alwayseditable' => 1,
'searchall' => 1,),
105 'country' => array(
'type' =>
'integer',
'label' =>
'Country',
'enabled' => 1,
'position' => 51,
'notnull' => 0,
'visible' => 1,
'alwayseditable' => 1,
'css' =>
'maxwidth500 widthcentpercentminusxx',
'searchall' => 1,)
109$all_fields_list = array_merge(
$object->fields, $non_object_fields);
113 reset($all_fields_list);
114 $sortfield =
"t.".key($all_fields_list);
121$search_all =
GETPOST(
'search_all',
'alphanohtml');
123foreach ($all_fields_list as $key => $val) {
124 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
125 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
127 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
132$search_filter =
GETPOST(
"search_filter",
'alpha');
133$filter =
GETPOST(
"filter",
'alpha');
135 $search_filter = $filter;
139$fieldstosearchall = array();
140foreach ($non_object_fields as $key => $val) {
141 if (!empty($val[
'searchall'])) {
142 $fieldstosearchall[
't.'.$key] = $val[
'label'];
147$arrayfields = array();
148foreach ($all_fields_list as $key => $val) {
150 if (!empty($val[
'visible'])) {
151 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
152 $arrayfields[
't.'.$key] = array(
153 'label' => $val[
'label'],
154 'checked' => (($visible < 0) ? 0 : 1),
155 'enabled' => (abs($visible) != 3 && (bool)
dol_eval((string) $val[
'enabled'], 1)),
156 'position' => $val[
'position'],
157 'help' => isset($val[
'help']) ? $val[
'help'] :
''
162include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
168$permissiontoread = $user->hasRight(
'partnership',
'read');
169$permissiontoadd = $user->hasRight(
'partnership',
'write');
170$permissiontodelete = $user->hasRight(
'partnership',
'delete');
176if (empty($conf->partnership->enabled)) {
179if (empty($permissiontoread)) {
182if (
$object->id > 0 && !(
$object->fk_member > 0) && $managedfor ==
'member') {
185if (
$object->id > 0 && !(
$object->fk_soc > 0) && $managedfor ==
'thirdparty') {
194if (
GETPOST(
'cancel',
'alpha')) {
198if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
202$parameters = array(
'socid' => $socid);
203$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
208if (empty($reshook)) {
210 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
213 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
214 foreach ($all_fields_list as $key => $val) {
216 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
217 $search[$key.
'_dtstart'] =
'';
218 $search[$key.
'_dtend'] =
'';
222 $search_array_options = array();
224 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
225 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
230 $objectclass =
'Partnership';
231 $objectlabel =
'Partnership';
232 $uploaddir = $conf->partnership->dir_output;
233 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
236 if (!$error && $massaction ==
'approve' && $permissiontoadd) {
243 foreach ($toselect as $checked) {
244 if ($objecttmp->fetch($checked)) {
245 if ($objecttmp->status == $objecttmp::STATUS_DRAFT) {
247 $result = $objecttmp->validate($user);
250 if ($result >= 0 && $objecttmp->status == $objecttmp::STATUS_VALIDATED) {
251 $result = $objecttmp->approve($user);
253 setEventMessages($langs->trans(
"PartnershipRefApproved", $objecttmp->ref),
null);
273 if ($massaction ==
'cancel' && $permissiontoadd) {
276 $objecttmp =
new $objectclass($db);
278 foreach ($toselect as $toselectid) {
279 $result = $objecttmp->fetch($toselectid);
281 $result = $objecttmp->cancel($user, 0);
283 setEventMessages($langs->trans(
'StatusOfRefMustBe', $objecttmp->ref, $objecttmp->LibStatut($objecttmp::STATUS_APPROVED)),
null,
'warnings');
285 } elseif ($result <= 0) {
314$form =
new Form($db);
315$companystatic =
new Societe($db);
321$title = $langs->trans(
"Partnerships");
329$sql .=
$object->getFieldList(
't');
330if ($managedfor ==
'member') {
331 $sql .=
', d.datefin, d.fk_adherent_type, dty.subscription';
334if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
335 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
336 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
340$parameters = array();
341$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
342$sql .= $hookmanager->resPrint;
343$sql = preg_replace(
'/,\s*$/',
'', $sql);
347$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
348if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
349 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
351if ($managedfor ==
'member') {
352 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent as d on (d.rowid = t.fk_member)";
353 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent_type as dty on (dty.rowid = d.fk_adherent_type)";
355 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as d on (d.rowid = t.fk_soc)";
358$parameters = array();
359$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
360$sql .= $hookmanager->resPrint;
361if (
$object->ismultientitymanaged == 1) {
362 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element).
")";
364 $sql .=
" WHERE 1 = 1";
366if ($managedfor ==
'member') {
368 $sql .=
" AND t.fk_member = ".((int) $memberid);
370 $sql .=
" AND fk_member > 0";
374 $sql .=
" AND t.fk_soc = ".((int) $socid);
376 $sql .=
" AND fk_soc > 0";
379foreach ($search as $key => $val) {
380 if (array_key_exists($key,
$object->fields)) {
381 if ($key ==
'status' && $search[$key] == -1) {
385 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
386 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
391 if ($search[$key] !=
'') {
392 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
395 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
396 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
397 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
398 if (preg_match(
'/_dtstart$/', $key)) {
399 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
401 if (preg_match(
'/_dtend$/', $key)) {
402 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
406 if ($key ==
'country' && $search[$key] !=
'') {
407 if ($managedfor ==
'member') {
408 $sql .=
" AND d.country = '".$db->escape($val).
"'";
410 $sql .=
" AND d.fk_pays = '".$db->escape($val).
"'";
414 if ($key ==
'town' && $search[$key] !=
'') {
419if ($managedfor ==
'member') {
420 if ($search_filter ==
'withoutsubscription') {
421 $sql .=
" AND (d.datefin IS NULL)";
423 if ($search_filter ==
'waitingsubscription') {
424 $sql .=
" AND (d.datefin IS NULL AND t.subscription = '1')";
426 if ($search_filter ==
'uptodate') {
427 $sql .=
" AND (d.datefin >= '".$db->idate($now).
"' OR dty.subscription = '0')";
429 if ($search_filter ==
'outofdate') {
430 $sql .=
" AND (d.datefin < '".$db->idate($now).
"' AND dty.subscription = '1')";
434 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
438include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
440$parameters = array();
441$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
442$sql .= $hookmanager->resPrint;
463$nbtotalofrecords =
'';
466 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
467 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
468 $resql = $db->query($sqlforcount);
470 $objforcount = $db->fetch_object($resql);
471 $nbtotalofrecords = $objforcount->nbtotalofrecords;
476 if (($page * $limit) > (
int) $nbtotalofrecords) {
484$sql .= $db->order($sortfield, $sortorder);
486 $sql .= $db->plimit($limit + 1, $offset);
489$resql = $db->query($sql);
495$num = $db->num_rows($resql);
499if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
500 $obj = $db->fetch_object($resql);
502 header(
"Location: ".
dol_buildpath(
'/partnership/partnership_card.php', 1).
'?id='.$id);
510llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-partnership page-list');
512if ($managedfor ==
"member") {
513 if ($memberid > 0 && $user->hasRight(
'adherent',
'lire')) {
514 $langs->load(
"members");
518 $result = $adhstat->fetch($memberid);
520 $adht->fetch($adhstat->typeid);
524 print
dol_get_fiche_head($head,
'partnerships', $langs->trans(
"ThirdParty"), -1,
'user');
526 $linkback =
'<a href="'.DOL_URL_ROOT.
'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
528 dol_banner_tab($object,
'rowid', $linkback);
530 print
'<div class="fichecenter">';
532 print
'<div class="underbanner clearboth"></div>';
533 print
'<table class="border centpercent tableforfield">';
537 print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</td><td class="valeur">'.
$object->login.
' </td></tr>';
541 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td class="valeur">'.$adht->getNomUrl(1).
"</td></tr>\n";
544 print
'<tr><td>'.$langs->trans(
"MemberNature").
'</td><td class="valeur" >'.$adhstat->getmorphylib().
'</td>';
548 print
'<tr><td>'.$langs->trans(
"Company").
'</td><td class="valeur">'.$adhstat->company.
'</td></tr>';
551 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td class="valeur">'.$adhstat->getCivilityLabel().
' </td>';
560} elseif ($managedfor ==
"thirdparty") {
561 if ($socid && $user->hasRight(
'societe',
'lire')) {
563 $res = $socstat->fetch($socid);
570 print
dol_get_fiche_head($head,
'partnerships', $langs->trans(
"ThirdParty"), -1,
'company');
572 dol_banner_tab($socstat,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
574 print
'<div class="fichecenter">';
576 print
'<div class="underbanner clearboth"></div>';
577 print
'<table class="border centpercent tableforfield">';
580 print
'<tr><td class="titlefield">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
581 print $socstat->getTypeUrl(1);
585 if ($socstat->client && !empty($socstat->code_client)) {
586 print
'<tr><td class="titlefield">';
587 print $langs->trans(
'CustomerCode').
'</td><td>';
589 $tmpcheck = $socstat->check_codeclient();
590 if ($tmpcheck != 0 && $tmpcheck != -5) {
591 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
597 if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
598 print
'<tr><td class="titlefield">';
599 print $langs->trans(
'SupplierCode').
'</td><td>';
601 $tmpcheck = $socstat->check_codefournisseur();
602 if ($tmpcheck != 0 && $tmpcheck != -5) {
603 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
618$arrayofselected = is_array($toselect) ? $toselect : array();
622 $param .=
'&mode='.urlencode($mode);
624if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
625 $param .=
'&contextpage='.urlencode($contextpage);
627if ($limit > 0 && $limit != $conf->liste_limit) {
628 $param .=
'&limit='.((int) $limit);
630if ($optioncss !=
'') {
631 $param .=
'&optioncss='.urlencode($optioncss);
634 $param .=
'&socid='.urlencode((
string) ($socid));
637 $param .=
'&rowid='.urlencode((
string) ($memberid));
639foreach ($search as $key => $val) {
640 if (is_array($search[$key])) {
641 foreach ($search[$key] as $skey) {
643 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
646 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
647 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
648 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
649 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
650 } elseif ($search[$key] !=
'') {
651 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
654if ($search_filter && $search_filter !=
'-1') {
655 $param .=
"&search_filter=".urlencode($search_filter);
658include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
660$parameters = array(
'param' => &$param);
661$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
662$param .= $hookmanager->resPrint;
665$arrayofmassactions = array(
667 'approve' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"ValidateAndApprove"),
668 'cancel' =>
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Cancel"),
671 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendMail"),
673if ($permissiontodelete) {
674 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
676if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'prevalidate',
'presend',
'predelete'))) {
677 $arrayofmassactions = array();
679$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
681print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
682if ($optioncss !=
'') {
683 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
685print
'<input type="hidden" name="token" value="'.newToken().
'">';
686print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
687print
'<input type="hidden" name="action" value="list">';
688print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
689print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
690print
'<input type="hidden" name="page" value="'.$page.
'">';
691print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
692print
'<input type="hidden" name="page_y" value="">';
693print
'<input type="hidden" name="mode" value="'.$mode.
'">';
695 print
'<input type="hidden" name="socid" value="'.$socid.
'" >';
696} elseif ($memberid) {
697 print
'<input type="hidden" name="rowid" value="'.$memberid.
'" >';
702$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'));
703$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'));
705$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);
708print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
711$topicmail =
"SendPartnershipRef";
712$modelmail =
"partnership_send";
714$trackid =
'pship'.$object->id;
715include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
719 foreach ($fieldstosearchall as $key => $val) {
720 $fieldstosearchall[$key] = $langs->trans($val);
721 $setupstring .= $key.
"=".$val.
";";
723 print
'<!-- Search done like if PARTNERSHIP_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
724 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
732$parameters = array();
733$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
734if (empty($reshook)) {
735 $moreforfilter .= $hookmanager->resPrint;
737 $moreforfilter = $hookmanager->resPrint;
740if (!empty($moreforfilter)) {
741 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
742 print $moreforfilter;
746$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
747$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
748$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
750print
'<div class="div-table-responsive">';
751print
'<table class="tagtable nobottomiftotal liste noborder'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
754if ($managedfor ==
'member') {
755 $arrayfields[
't.fk_member'][
'checked'] = 1;
757 $arrayfields[
't.fk_soc'][
'checked'] = 1;
761print
'<tr class="liste_titre_filter">';
764 print
'<td class="liste_titre maxwidthsearch">';
765 $searchpicto = $form->showFilterButtons(
'left');
769foreach ($all_fields_list as $key => $val) {
770 $searchkey = empty($search[$key]) ?
'' : $search[$key];
771 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
772 if ($key ==
'status') {
773 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
774 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
775 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
776 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
777 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
778 } 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'])) {
779 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
781 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
782 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
783 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
784 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);
785 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
786 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
787 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
788 print
'<div class="nowrap">';
789 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
791 print
'<div class="nowrap">';
792 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
794 } elseif ($key ==
'lang') {
795 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
797 print $formadmin->select_language($search[$key],
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
798 } elseif ($key ==
'country') {
799 print $form->select_country(in_array($key, $search) ? $search[$key] : 0,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
801 print
'<input type="text" class="flat maxwidth'.($val[
'type'] ==
'integer' ?
'50' :
'75').
'" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
807if ($managedfor ==
'member') {
808 print
'<td class="liste_titre center">';
809 $selectarray = array(
'-1' =>
'',
'withoutsubscription' => $langs->trans(
"WithoutSubscription"),
'uptodate' => $langs->trans(
"UpToDate"),
'outofdate' => $langs->trans(
"OutOfDate"));
810 print $form->selectarray(
'search_filter', $selectarray, $search_filter);
814include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
817$parameters = array(
'arrayfields' => $arrayfields);
818$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
819print $hookmanager->resPrint;
822 print
'<td class="liste_titre maxwidthsearch">';
823 $searchpicto = $form->showFilterButtons();
834print
'<tr class="liste_titre">';
836 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
839foreach ($all_fields_list as $key => $val) {
840 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
841 if ($key ==
'status') {
842 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
843 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
844 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
845 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
846 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
847 } 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'])) {
848 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
850 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
851 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
852 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";
857if ($managedfor ==
'member') {
859 $cssforfield =
'center';
860 print
getTitleFieldOfList(
'SubscriptionEndDate', 0, $_SERVER[
'PHP_SELF'],
'd.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
863include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
865$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
866$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
867print $hookmanager->resPrint;
870 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
877$needToFetchEachLine = 0;
878if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
879 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
880 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
881 $needToFetchEachLine++;
893$imaxinloop = ($limit ? min($num, $limit) : $num);
895while ($i < $imaxinloop) {
896 $obj = $db->fetch_object($resql);
902 $object->setVarsFromFetchObj($obj);
905 if ($obj->fk_soc > 0) {
906 if (!empty($conf->cache[
'thirdparty'][$obj->fk_soc])) {
907 $companyobj = $conf->cache[
'thirdparty'][$obj->fk_soc];
909 $companyobj =
new Societe($db);
910 $companyobj->fetch($obj->fk_soc);
911 $conf->cache[
'thirdparty'][$obj->fk_soc] = $companyobj;
914 $object->thirdparty = $companyobj;
917 if ($managedfor ==
'member') {
918 if ($obj->fk_member > 0) {
919 $result = $adherent->fetch($obj->fk_member);
923 if ($mode ==
'kanban') {
925 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
926 print
'<div class="box-flex-container kanban">';
930 if ($massactionbutton || $massaction) {
932 if (in_array(
$object->id, $arrayofselected)) {
936 print
$object->getKanbanView(
'', array(
'thirdparty' =>
$object->thirdparty,
'selected' => $selected));
937 if ($i == ($imaxinloop - 1)) {
944 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select">';
947 print
'<td class="nowrap center">';
948 if ($massactionbutton || $massaction) {
950 if (in_array(
$object->id, $arrayofselected)) {
953 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
960 foreach ($all_fields_list as $key => $val) {
961 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
962 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
963 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
964 } elseif ($key ==
'status') {
965 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
968 if (in_array($val[
'type'], array(
'timestamp'))) {
969 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
970 } elseif ($key ==
'ref') {
971 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
974 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
975 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
979 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
980 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
981 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
982 print
' title="'.dol_escape_htmltag((
string)
$object->$key).
'"';
985 if ($key ==
'status') {
986 print
$object->getLibStatut(5);
987 } elseif ($key ==
'country') {
988 if ($managedfor ==
'member') {
989 if (!empty($adherent->country_code)) {
990 print $langs->trans(
"Country".$adherent->country_code);
993 if (!empty(
$object->thirdparty->country_code)) {
994 print $langs->trans(
"Country".
$object->thirdparty->country_code);
997 } elseif ($key ==
'town') {
998 if ($managedfor ==
'member') {
999 print $adherent->town;
1001 print
$object->thirdparty->town;
1003 } elseif ($key ==
'rowid') {
1004 print
$object->showOutputField($val, $key, (
string)
$object->id,
'');
1012 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
1016 if (!isset($totalarray[
'val'])) {
1019 if (!isset($totalarray[
'val'][
't.'.$key])) {
1027 if ($managedfor ==
'member') {
1028 print
'<td class="nowrap center endofsubscriptiondate">';
1029 $result = $adherent->fetch(
$object->fk_member);
1031 $datefin = $adherent->datefin;
1034 if ($adherent->hasDelay()) {
1035 $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").
')';
1036 print
" ".img_warning($langs->trans(
"SubscriptionLate").$textlate);
1039 if ($adherent->subscription ==
'yes') {
1040 print $langs->trans(
"SubscriptionNotReceived");
1041 if ($adherent->status > 0) {
1042 print
" ".img_warning();
1052 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1054 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1055 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1056 print $hookmanager->resPrint;
1059 print
'<td class="nowrap center">';
1060 if ($massactionbutton || $massaction) {
1062 if (in_array(
$object->id, $arrayofselected)) {
1065 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1078if ($managedfor !=
'member') {
1083include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1088 foreach ($arrayfields as $key => $val) {
1089 if (!empty($val[
'checked'])) {
1093 if ($managedfor ==
'member') {
1096 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1102$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1103$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1104print $hookmanager->resPrint;
1106print
'</table>'.
"\n";
1109print
'</form>'.
"\n";
1111if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1112 $hidegeneratedfilelistifempty = 1;
1113 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1114 $hidegeneratedfilelistifempty = 0;
1117 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1121 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1122 $urlsource .= str_replace(
'&',
'&', $param);
1124 $filedir = $diroutputmassaction;
1125 $genallowed = $permissiontoread;
1126 $delallowed = $permissiontoadd;
1128 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)
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.
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)
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.
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.
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.
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.
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.
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 information.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.