26require
'../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/partnership/class/partnership.class.php';
41$langs->loadLangs(array(
"partnership",
"members",
"other"));
43$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
44$massaction =
GETPOST(
'massaction',
'alpha');
46$confirm =
GETPOST(
'confirm',
'alpha');
47$cancel =
GETPOST(
'cancel',
'alpha');
48$toselect =
GETPOST(
'toselect',
'array');
49$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
50$backtopage =
GETPOST(
'backtopage',
'alpha');
51$optioncss =
GETPOST(
'optioncss',
'aZ');
59$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
60$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
62if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
66$offset = $limit * $page;
74$diroutputmassaction = $conf->partnership->dir_output.
'/temp/massgeneration/'.$user->id;
76 $hookmanager->initHooks(array(
'thirdpartypartnership',
'globalcard'));
77} elseif ($memberid > 0) {
78 $hookmanager->initHooks(array(
'memberpartnership',
'globalcard'));
80 $hookmanager->initHooks(array(
'partnershiplist'));
84$extrafields->fetch_name_optionals_label(
$object->table_element);
87$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
93if ($managedfor !=
'member' && $sortfield ==
'd.datefin') {
100 $sortfield =
"t.".key(
$object->fields);
107$search_all =
GETPOST(
'search_all',
'alphanohtml');
109foreach (
$object->fields as $key => $val) {
110 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
111 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
113 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
118$search_filter =
GETPOST(
"search_filter",
'alpha');
119$filter =
GETPOST(
"filter",
'alpha');
121 $search_filter = $filter;
125$fieldstosearchall = array();
126foreach (
$object->fields as $key => $val) {
127 if (!empty($val[
'searchall'])) {
128 $fieldstosearchall[
't.'.$key] = $val[
'label'];
133$arrayfields = array();
134foreach (
$object->fields as $key => $val) {
136 if (!empty($val[
'visible'])) {
137 $visible = (int)
dol_eval($val[
'visible'], 1);
138 $arrayfields[
't.'.$key] = array(
139 'label' => $val[
'label'],
140 'checked' => (($visible < 0) ? 0 : 1),
141 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
142 'position' => $val[
'position'],
143 'help' => isset($val[
'help']) ? $val[
'help'] :
''
148include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
153$permissiontoread = $user->hasRight(
'partnership',
'read');
154$permissiontoadd = $user->hasRight(
'partnership',
'write');
155$permissiontodelete = $user->hasRight(
'partnership',
'delete');
161if (empty($conf->partnership->enabled)) {
164if (empty($permissiontoread)) {
167if (
$object->id > 0 && !(
$object->fk_member > 0) && $managedfor ==
'member') {
170if (
$object->id > 0 && !(
$object->fk_soc > 0) && $managedfor ==
'thirdparty') {
179if (
GETPOST(
'cancel',
'alpha')) {
183if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
187$parameters = array();
188$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
193if (empty($reshook)) {
195 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
198 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
199 foreach (
$object->fields as $key => $val) {
201 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
202 $search[$key.
'_dtstart'] =
'';
203 $search[$key.
'_dtend'] =
'';
207 $search_array_options = array();
209 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
210 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
215 $objectclass =
'Partnership';
216 $objectlabel =
'Partnership';
217 $uploaddir = $conf->partnership->dir_output;
218 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
221 if (!$error && $massaction ==
'approve' && $permissiontoadd) {
228 foreach ($toselect as $checked) {
229 if ($objecttmp->fetch($checked)) {
230 if ($objecttmp->status == $objecttmp::STATUS_DRAFT) {
232 $result = $objecttmp->validate($user);
235 if ($result >= 0 && $objecttmp->status == $objecttmp::STATUS_VALIDATED) {
236 $result = $objecttmp->approve($user);
238 setEventMessages($langs->trans(
"PartnershipRefApproved", $objecttmp->ref),
null);
258 if ($massaction ==
'cancel' && $permissiontoadd) {
261 $objecttmp =
new $objectclass($db);
263 foreach ($toselect as $toselectid) {
264 $result = $objecttmp->fetch($toselectid);
266 $result = $objecttmp->cancel($user, 0);
268 setEventMessages($langs->trans(
'StatusOfRefMustBe', $objecttmp->ref, $objecttmp->LibStatut($objecttmp::STATUS_APPROVED)),
null,
'warnings');
270 } elseif ($result <= 0) {
299$form =
new Form($db);
300$companystatic =
new Societe($db);
306$title = $langs->trans(
"Partnerships");
314$sql .=
$object->getFieldList(
't');
315if ($managedfor ==
'member') {
316 $sql .=
', d.datefin, d.fk_adherent_type, dty.subscription';
319if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
320 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
321 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
325$parameters = array();
326$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
327$sql .= $hookmanager->resPrint;
328$sql = preg_replace(
'/,\s*$/',
'', $sql);
332$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
333if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
334 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
336if ($managedfor ==
'member') {
337 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent as d on (d.rowid = t.fk_member)";
338 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent_type as dty on (dty.rowid = d.fk_adherent_type)";
341$parameters = array();
342$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
343$sql .= $hookmanager->resPrint;
344if (
$object->ismultientitymanaged == 1) {
345 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element).
")";
347 $sql .=
" WHERE 1 = 1";
349if ($managedfor ==
'member') {
351 $sql .=
" AND t.fk_member = ".((int) $memberid);
353 $sql .=
" AND fk_member > 0";
357 $sql .=
" AND t.fk_soc = ".((int) $socid);
359 $sql .=
" AND fk_soc > 0";
362foreach ($search as $key => $val) {
363 if (array_key_exists($key,
$object->fields)) {
364 if ($key ==
'status' && $search[$key] == -1) {
368 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
369 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
374 if ($search[$key] !=
'') {
375 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
378 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
379 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
380 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
381 if (preg_match(
'/_dtstart$/', $key)) {
382 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
384 if (preg_match(
'/_dtend$/', $key)) {
385 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
391if ($managedfor ==
'member') {
392 if ($search_filter ==
'withoutsubscription') {
393 $sql .=
" AND (d.datefin IS NULL)";
395 if ($search_filter ==
'waitingsubscription') {
396 $sql .=
" AND (d.datefin IS NULL AND t.subscription = '1')";
398 if ($search_filter ==
'uptodate') {
399 $sql .=
" AND (d.datefin >= '".$db->idate($now).
"' OR dty.subscription = '0')";
401 if ($search_filter ==
'outofdate') {
402 $sql .=
" AND (d.datefin < '".$db->idate($now).
"' AND dty.subscription = '1')";
406 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
410include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
412$parameters = array();
413$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
414$sql .= $hookmanager->resPrint;
435$nbtotalofrecords =
'';
438 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
439 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
440 $resql = $db->query($sqlforcount);
442 $objforcount = $db->fetch_object($resql);
443 $nbtotalofrecords = $objforcount->nbtotalofrecords;
448 if (($page * $limit) > $nbtotalofrecords) {
456$sql .= $db->order($sortfield, $sortorder);
458 $sql .= $db->plimit($limit + 1, $offset);
461$resql = $db->query($sql);
467$num = $db->num_rows($resql);
471if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
472 $obj = $db->fetch_object($resql);
474 header(
"Location: ".
dol_buildpath(
'/partnership/partnership_card.php', 1).
'?id='.$id);
482llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-partnership page-list');
484if ($managedfor ==
"member") {
485 if ($memberid > 0 && $user->hasRight(
'adherent',
'lire')) {
486 $langs->load(
"members");
490 $result = $adhstat->fetch($memberid);
492 $adht->fetch($adhstat->typeid);
496 print
dol_get_fiche_head($head,
'partnerships', $langs->trans(
"ThirdParty"), -1,
'user');
498 $linkback =
'<a href="'.DOL_URL_ROOT.
'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
500 dol_banner_tab($object,
'rowid', $linkback);
502 print
'<div class="fichecenter">';
504 print
'<div class="underbanner clearboth"></div>';
505 print
'<table class="border centpercent tableforfield">';
509 print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</td><td class="valeur">'.
$object->login.
' </td></tr>';
513 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td class="valeur">'.$adht->getNomUrl(1).
"</td></tr>\n";
516 print
'<tr><td>'.$langs->trans(
"MemberNature").
'</td><td class="valeur" >'.$adhstat->getmorphylib().
'</td>';
520 print
'<tr><td>'.$langs->trans(
"Company").
'</td><td class="valeur">'.$adhstat->company.
'</td></tr>';
523 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td class="valeur">'.$adhstat->getCivilityLabel().
' </td>';
532} elseif ($managedfor ==
"thirdparty") {
533 if ($socid && $user->hasRight(
'societe',
'lire')) {
535 $res = $socstat->fetch($socid);
542 print
dol_get_fiche_head($head,
'partnerships', $langs->trans(
"ThirdParty"), -1,
'company');
544 dol_banner_tab($socstat,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
546 print
'<div class="fichecenter">';
548 print
'<div class="underbanner clearboth"></div>';
549 print
'<table class="border centpercent tableforfield">';
552 print
'<tr><td class="titlefield">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
553 print $socstat->getTypeUrl(1);
557 if ($socstat->client && !empty($socstat->code_client)) {
558 print
'<tr><td class="titlefield">';
559 print $langs->trans(
'CustomerCode').
'</td><td>';
561 $tmpcheck = $socstat->check_codeclient();
562 if ($tmpcheck != 0 && $tmpcheck != -5) {
563 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
569 if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
570 print
'<tr><td class="titlefield">';
571 print $langs->trans(
'SupplierCode').
'</td><td>';
573 $tmpcheck = $socstat->check_codefournisseur();
574 if ($tmpcheck != 0 && $tmpcheck != -5) {
575 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
590$arrayofselected = is_array($toselect) ? $toselect : array();
594 $param .=
'&mode='.urlencode($mode);
596if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
597 $param .=
'&contextpage='.urlencode($contextpage);
599if ($limit > 0 && $limit != $conf->liste_limit) {
600 $param .=
'&limit='.((int) $limit);
603 $param .=
'&socid='.urlencode((
string) ($socid));
606 $param .=
'&rowid='.urlencode((
string) ($memberid));
608foreach ($search as $key => $val) {
609 if (is_array($search[$key])) {
610 foreach ($search[$key] as $skey) {
612 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
615 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
616 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
617 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
618 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
619 } elseif ($search[$key] !=
'') {
620 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
623if ($optioncss !=
'') {
624 $param .=
'&optioncss='.urlencode($optioncss);
626if ($search_filter && $search_filter !=
'-1') {
627 $param .=
"&search_filter=".urlencode($search_filter);
630include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
632$parameters = array(
'param' => &$param);
633$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
634$param .= $hookmanager->resPrint;
637$arrayofmassactions = array(
639 'approve' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"ValidateAndApprove"),
640 'cancel' =>
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Cancel"),
643 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendMail"),
645if ($permissiontodelete) {
646 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
648if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'prevalidate',
'presend',
'predelete'))) {
649 $arrayofmassactions = array();
651$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
653print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
654if ($optioncss !=
'') {
655 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
657print
'<input type="hidden" name="token" value="'.newToken().
'">';
658print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
659print
'<input type="hidden" name="action" value="list">';
660print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
661print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
662print
'<input type="hidden" name="page" value="'.$page.
'">';
663print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
664print
'<input type="hidden" name="page_y" value="">';
665print
'<input type="hidden" name="mode" value="'.$mode.
'">';
667 print
'<input type="hidden" name="socid" value="'.$socid.
'" >';
668} elseif ($memberid) {
669 print
'<input type="hidden" name="rowid" value="'.$memberid.
'" >';
674$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'));
675$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'));
677$newcardbutton .=
dolGetButtonTitle($langs->trans(
'New'),
'',
'fa fa-plus-circle',
dol_buildpath(
'/partnership/partnership_card.php', 1).
'?action=create&backtopage='.urlencode($_SERVER[
'PHP_SELF'].($socid > 0 ?
'?socid='.$socid :
'')),
'', $permissiontoadd);
680print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
683$topicmail =
"SendPartnershipRef";
684$modelmail =
"partnership_send";
686$trackid =
'pship'.$object->id;
687include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
691 foreach ($fieldstosearchall as $key => $val) {
692 $fieldstosearchall[$key] = $langs->trans($val);
693 $setupstring .= $key.
"=".$val.
";";
695 print
'<!-- Search done like if PARTNERSHIP_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
696 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
704$parameters = array();
705$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
706if (empty($reshook)) {
707 $moreforfilter .= $hookmanager->resPrint;
709 $moreforfilter = $hookmanager->resPrint;
712if (!empty($moreforfilter)) {
713 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
714 print $moreforfilter;
718$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
719$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
720$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
722print
'<div class="div-table-responsive">';
723print
'<table class="tagtable nobottomiftotal liste noborder'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
726if ($managedfor ==
'member') {
727 $arrayfields[
't.fk_member'][
'checked'] = 1;
729 $arrayfields[
't.fk_soc'][
'checked'] = 1;
733print
'<tr class="liste_titre_filter">';
736 print
'<td class="liste_titre maxwidthsearch">';
737 $searchpicto = $form->showFilterButtons(
'left');
741foreach (
$object->fields as $key => $val) {
742 $searchkey = empty($search[$key]) ?
'' : $search[$key];
743 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
744 if ($key ==
'status') {
745 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
746 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
747 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
748 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
749 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
750 } 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'])) {
751 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
753 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
754 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
755 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
756 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);
757 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
758 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
759 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
760 print
'<div class="nowrap">';
761 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
763 print
'<div class="nowrap">';
764 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
766 } elseif ($key ==
'lang') {
767 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
769 print $formadmin->select_language($search[$key],
'search_lang', 0,
null, 1, 0, 0,
'minwidth100imp maxwidth125', 2);
771 print
'<input type="text" class="flat maxwidth75" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
777if ($managedfor ==
'member') {
778 print
'<td class="liste_titre center">';
779 $selectarray = array(
'-1' =>
'',
'withoutsubscription' => $langs->trans(
"WithoutSubscription"),
'uptodate' => $langs->trans(
"UpToDate"),
'outofdate' => $langs->trans(
"OutOfDate"));
780 print $form->selectarray(
'search_filter', $selectarray, $search_filter);
784include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
787$parameters = array(
'arrayfields' => $arrayfields);
788$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
789print $hookmanager->resPrint;
792 print
'<td class="liste_titre maxwidthsearch">';
793 $searchpicto = $form->showFilterButtons();
799$totalarray = array();
800$totalarray[
'nbfield'] = 0;
804print
'<tr class="liste_titre">';
806 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
807 $totalarray[
'nbfield']++;
809foreach (
$object->fields as $key => $val) {
810 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
811 if ($key ==
'status') {
812 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
813 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
814 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
815 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
816 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
817 } 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'])) {
818 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
820 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
821 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
822 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";
823 $totalarray[
'nbfield']++;
827if ($managedfor ==
'member') {
829 $cssforfield =
'center';
830 print
getTitleFieldOfList(
'SubscriptionEndDate', 0, $_SERVER[
'PHP_SELF'],
'd.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
833include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
835$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
836$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
837print $hookmanager->resPrint;
840 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
841 $totalarray[
'nbfield']++;
847$needToFetchEachLine = 0;
848if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
849 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
850 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
851 $needToFetchEachLine++;
860$savnbfield = $totalarray[
'nbfield'];
861$totalarray = array();
862$totalarray[
'nbfield'] = 0;
863$imaxinloop = ($limit ? min($num, $limit) : $num);
865while ($i < $imaxinloop) {
866 $obj = $db->fetch_object($resql);
872 $object->setVarsFromFetchObj($obj);
875 if ($obj->fk_soc > 0) {
876 if (!empty($conf->cache[
'thirdparty'][$obj->fk_soc])) {
877 $companyobj = $conf->cache[
'thirdparty'][$obj->fk_soc];
879 $companyobj =
new Societe($db);
880 $companyobj->fetch($obj->fk_soc);
881 $conf->cache[
'thirdparty'][$obj->fk_soc] = $companyobj;
884 $object->thirdparty = $companyobj;
887 if ($mode ==
'kanban') {
889 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
890 print
'<div class="box-flex-container kanban">';
894 if ($massactionbutton || $massaction) {
896 if (in_array(
$object->id, $arrayofselected)) {
900 print
$object->getKanbanView(
'', array(
'thirdparty' =>
$object->thirdparty,
'selected' => $selected));
901 if ($i == ($imaxinloop - 1)) {
908 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
911 print
'<td class="nowrap center">';
912 if ($massactionbutton || $massaction) {
914 if (in_array(
$object->id, $arrayofselected)) {
917 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
921 $totalarray[
'nbfield']++;
924 foreach (
$object->fields as $key => $val) {
925 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
926 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
927 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
928 } elseif ($key ==
'status') {
929 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
932 if (in_array($val[
'type'], array(
'timestamp'))) {
933 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
934 } elseif ($key ==
'ref') {
935 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
938 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
939 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
943 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
944 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
945 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
946 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
949 if ($key ==
'status') {
950 print
$object->getLibStatut(5);
951 } elseif ($key ==
'rowid') {
958 $totalarray[
'nbfield']++;
960 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
962 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
964 if (!isset($totalarray[
'val'])) {
965 $totalarray[
'val'] = array();
967 if (!isset($totalarray[
'val'][
't.'.$key])) {
968 $totalarray[
'val'][
't.'.$key] = 0;
970 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
975 if ($managedfor ==
'member') {
976 print
'<td class="nowrap center endofsubscriptiondate">';
977 $result = $adherent->fetch(
$object->fk_member);
979 $datefin = $adherent->datefin;
982 if ($adherent->hasDelay()) {
983 $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").
')';
984 print
" ".img_warning($langs->trans(
"SubscriptionLate").$textlate);
987 if ($adherent->subscription ==
'yes') {
988 print $langs->trans(
"SubscriptionNotReceived");
989 if ($adherent->statut > 0) {
990 print
" ".img_warning();
1000 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1002 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1003 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1004 print $hookmanager->resPrint;
1007 print
'<td class="nowrap center">';
1008 if ($massactionbutton || $massaction) {
1010 if (in_array(
$object->id, $arrayofselected)) {
1013 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1017 $totalarray[
'nbfield']++;
1026if ($managedfor !=
'member') {
1027 $totalarray[
'nbfield']++;
1031include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1036 foreach ($arrayfields as $key => $val) {
1037 if (!empty($val[
'checked'])) {
1041 if ($managedfor !=
'member') {
1044 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1050$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1051$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1052print $hookmanager->resPrint;
1054print
'</table>'.
"\n";
1057print
'</form>'.
"\n";
1059if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1060 $hidegeneratedfilelistifempty = 1;
1061 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1062 $hidegeneratedfilelistifempty = 0;
1065 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1069 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1070 $urlsource .= str_replace(
'&',
'&', $param);
1072 $filedir = $diroutputmassaction;
1073 $genallowed = $permissiontoread;
1074 $delallowed = $permissiontoadd;
1076 print $formfile->showdocuments(
'massfilesarea_partnership',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage members of a foundation.
Class to manage members type.
Class to manage third parties objects (customers, suppliers, prospects...)
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
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...
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)
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)
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)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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 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.