28require
'../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/lib/member.lib.php';
34require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
35require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
36require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent_type.class.php';
37require_once DOL_DOCUMENT_ROOT.
'/partnership/class/partnership.class.php';
43$langs->loadLangs(array(
"partnership",
"members",
"other"));
45$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
46$massaction =
GETPOST(
'massaction',
'alpha');
48$confirm =
GETPOST(
'confirm',
'alpha');
49$cancel =
GETPOST(
'cancel',
'alpha');
50$toselect =
GETPOST(
'toselect',
'array');
51$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
52$backtopage =
GETPOST(
'backtopage',
'alpha');
53$optioncss =
GETPOST(
'optioncss',
'aZ');
61$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
62$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
64if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
68$offset = $limit * $page;
76$diroutputmassaction = $conf->partnership->dir_output.
'/temp/massgeneration/'.$user->id;
78 $hookmanager->initHooks(array(
'thirdpartypartnership',
'globalcard'));
79} elseif ($memberid > 0) {
80 $hookmanager->initHooks(array(
'memberpartnership',
'globalcard'));
82 $hookmanager->initHooks(array(
'partnershiplist'));
86$extrafields->fetch_name_optionals_label(
$object->table_element);
89$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
95if ($managedfor !=
'member' && $sortfield ==
'd.datefin') {
100$non_object_fields = array(
101 'town' => array(
'type' =>
'varchar(128)',
'label' =>
'Town',
'enabled' => 1,
'position' => 51,
'notnull' => 0,
'visible' => 1,
'alwayseditable' => 1,
'searchall' => 1,),
102 'country' => array(
'type' =>
'integer',
'label' =>
'Country',
'enabled' => 1,
'position' => 51,
'notnull' => 0,
'visible' => 1,
'alwayseditable' => 1,
'css' =>
'maxwidth500 widthcentpercentminusxx',
'searchall' => 1,)
106$all_fields_list = array_merge(
$object->fields, $non_object_fields);
110 reset($all_fields_list);
111 $sortfield =
"t.".key($all_fields_list);
118$search_all =
GETPOST(
'search_all',
'alphanohtml');
120foreach ($all_fields_list as $key => $val) {
121 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
122 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
124 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
129$search_filter =
GETPOST(
"search_filter",
'alpha');
130$filter =
GETPOST(
"filter",
'alpha');
132 $search_filter = $filter;
136$fieldstosearchall = array();
137foreach ($non_object_fields as $key => $val) {
138 if (!empty($val[
'searchall'])) {
139 $fieldstosearchall[
't.'.$key] = $val[
'label'];
144$arrayfields = array();
145foreach ($all_fields_list as $key => $val) {
147 if (!empty($val[
'visible'])) {
148 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
149 $arrayfields[
't.'.$key] = array(
150 'label' => $val[
'label'],
151 'checked' => (($visible < 0) ? 0 : 1),
152 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
153 'position' => $val[
'position'],
154 'help' => isset($val[
'help']) ? $val[
'help'] :
''
159include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
165$permissiontoread = $user->hasRight(
'partnership',
'read');
166$permissiontoadd = $user->hasRight(
'partnership',
'write');
167$permissiontodelete = $user->hasRight(
'partnership',
'delete');
173if (empty($conf->partnership->enabled)) {
176if (empty($permissiontoread)) {
179if (
$object->id > 0 && !(
$object->fk_member > 0) && $managedfor ==
'member') {
182if (
$object->id > 0 && !(
$object->fk_soc > 0) && $managedfor ==
'thirdparty') {
191if (
GETPOST(
'cancel',
'alpha')) {
195if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
199$parameters = array();
200$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
205if (empty($reshook)) {
207 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
210 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
211 foreach ($all_fields_list as $key => $val) {
213 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
214 $search[$key.
'_dtstart'] =
'';
215 $search[$key.
'_dtend'] =
'';
219 $search_array_options = array();
221 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
222 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
227 $objectclass =
'Partnership';
228 $objectlabel =
'Partnership';
229 $uploaddir = $conf->partnership->dir_output;
230 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
233 if (!$error && $massaction ==
'approve' && $permissiontoadd) {
240 foreach ($toselect as $checked) {
241 if ($objecttmp->fetch($checked)) {
242 if ($objecttmp->status == $objecttmp::STATUS_DRAFT) {
244 $result = $objecttmp->validate($user);
247 if ($result >= 0 && $objecttmp->status == $objecttmp::STATUS_VALIDATED) {
248 $result = $objecttmp->approve($user);
250 setEventMessages($langs->trans(
"PartnershipRefApproved", $objecttmp->ref),
null);
270 if ($massaction ==
'cancel' && $permissiontoadd) {
273 $objecttmp =
new $objectclass($db);
275 foreach ($toselect as $toselectid) {
276 $result = $objecttmp->fetch($toselectid);
278 $result = $objecttmp->cancel($user, 0);
280 setEventMessages($langs->trans(
'StatusOfRefMustBe', $objecttmp->ref, $objecttmp->LibStatut($objecttmp::STATUS_APPROVED)),
null,
'warnings');
282 } elseif ($result <= 0) {
311$form =
new Form($db);
312$companystatic =
new Societe($db);
318$title = $langs->trans(
"Partnerships");
326$sql .=
$object->getFieldList(
't');
327if ($managedfor ==
'member') {
328 $sql .=
', d.datefin, d.fk_adherent_type, dty.subscription';
331if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
332 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
333 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
337$parameters = array();
338$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
339$sql .= $hookmanager->resPrint;
340$sql = preg_replace(
'/,\s*$/',
'', $sql);
344$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
345if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
346 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
348if ($managedfor ==
'member') {
349 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent as d on (d.rowid = t.fk_member)";
350 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent_type as dty on (dty.rowid = d.fk_adherent_type)";
352 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as d on (d.rowid = t.fk_soc)";
355$parameters = array();
356$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
357$sql .= $hookmanager->resPrint;
358if (
$object->ismultientitymanaged == 1) {
359 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element).
")";
361 $sql .=
" WHERE 1 = 1";
363if ($managedfor ==
'member') {
365 $sql .=
" AND t.fk_member = ".((int) $memberid);
367 $sql .=
" AND fk_member > 0";
371 $sql .=
" AND t.fk_soc = ".((int) $socid);
373 $sql .=
" AND fk_soc > 0";
376foreach ($search as $key => $val) {
377 if (array_key_exists($key,
$object->fields)) {
378 if ($key ==
'status' && $search[$key] == -1) {
382 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
383 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
388 if ($search[$key] !=
'') {
389 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
392 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
393 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
394 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
395 if (preg_match(
'/_dtstart$/', $key)) {
396 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
398 if (preg_match(
'/_dtend$/', $key)) {
399 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
403 if ($key ==
'country' && $search[$key] !=
'') {
404 if ($managedfor ==
'member') {
405 $sql .=
" AND d.country = '".$db->escape($val).
"'";
407 $sql .=
" AND d.fk_pays = '".$db->escape($val).
"'";
411 if ($key ==
'town' && $search[$key] !=
'') {
416if ($managedfor ==
'member') {
417 if ($search_filter ==
'withoutsubscription') {
418 $sql .=
" AND (d.datefin IS NULL)";
420 if ($search_filter ==
'waitingsubscription') {
421 $sql .=
" AND (d.datefin IS NULL AND t.subscription = '1')";
423 if ($search_filter ==
'uptodate') {
424 $sql .=
" AND (d.datefin >= '".$db->idate($now).
"' OR dty.subscription = '0')";
426 if ($search_filter ==
'outofdate') {
427 $sql .=
" AND (d.datefin < '".$db->idate($now).
"' AND dty.subscription = '1')";
431 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
435include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
437$parameters = array();
438$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
439$sql .= $hookmanager->resPrint;
460$nbtotalofrecords =
'';
463 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
464 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
465 $resql = $db->query($sqlforcount);
467 $objforcount = $db->fetch_object($resql);
468 $nbtotalofrecords = $objforcount->nbtotalofrecords;
473 if (($page * $limit) > $nbtotalofrecords) {
481$sql .= $db->order($sortfield, $sortorder);
483 $sql .= $db->plimit($limit + 1, $offset);
486$resql = $db->query($sql);
492$num = $db->num_rows($resql);
496if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
497 $obj = $db->fetch_object($resql);
499 header(
"Location: ".
dol_buildpath(
'/partnership/partnership_card.php', 1).
'?id='.$id);
507llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-partnership page-list');
509if ($managedfor ==
"member") {
510 if ($memberid > 0 && $user->hasRight(
'adherent',
'lire')) {
511 $langs->load(
"members");
515 $result = $adhstat->fetch($memberid);
517 $adht->fetch($adhstat->typeid);
521 print
dol_get_fiche_head($head,
'partnerships', $langs->trans(
"ThirdParty"), -1,
'user');
523 $linkback =
'<a href="'.DOL_URL_ROOT.
'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
525 dol_banner_tab($object,
'rowid', $linkback);
527 print
'<div class="fichecenter">';
529 print
'<div class="underbanner clearboth"></div>';
530 print
'<table class="border centpercent tableforfield">';
534 print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</td><td class="valeur">'.
$object->login.
' </td></tr>';
538 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td class="valeur">'.$adht->getNomUrl(1).
"</td></tr>\n";
541 print
'<tr><td>'.$langs->trans(
"MemberNature").
'</td><td class="valeur" >'.$adhstat->getmorphylib().
'</td>';
545 print
'<tr><td>'.$langs->trans(
"Company").
'</td><td class="valeur">'.$adhstat->company.
'</td></tr>';
548 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td class="valeur">'.$adhstat->getCivilityLabel().
' </td>';
557} elseif ($managedfor ==
"thirdparty") {
558 if ($socid && $user->hasRight(
'societe',
'lire')) {
560 $res = $socstat->fetch($socid);
567 print
dol_get_fiche_head($head,
'partnerships', $langs->trans(
"ThirdParty"), -1,
'company');
569 dol_banner_tab($socstat,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
571 print
'<div class="fichecenter">';
573 print
'<div class="underbanner clearboth"></div>';
574 print
'<table class="border centpercent tableforfield">';
577 print
'<tr><td class="titlefield">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
578 print $socstat->getTypeUrl(1);
582 if ($socstat->client && !empty($socstat->code_client)) {
583 print
'<tr><td class="titlefield">';
584 print $langs->trans(
'CustomerCode').
'</td><td>';
586 $tmpcheck = $socstat->check_codeclient();
587 if ($tmpcheck != 0 && $tmpcheck != -5) {
588 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
594 if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
595 print
'<tr><td class="titlefield">';
596 print $langs->trans(
'SupplierCode').
'</td><td>';
598 $tmpcheck = $socstat->check_codefournisseur();
599 if ($tmpcheck != 0 && $tmpcheck != -5) {
600 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
615$arrayofselected = is_array($toselect) ? $toselect : array();
619 $param .=
'&mode='.urlencode($mode);
621if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
622 $param .=
'&contextpage='.urlencode($contextpage);
624if ($limit > 0 && $limit != $conf->liste_limit) {
625 $param .=
'&limit='.((int) $limit);
628 $param .=
'&socid='.urlencode((
string) ($socid));
631 $param .=
'&rowid='.urlencode((
string) ($memberid));
633foreach ($search as $key => $val) {
634 if (is_array($search[$key])) {
635 foreach ($search[$key] as $skey) {
637 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
640 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
641 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
642 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
643 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
644 } elseif ($search[$key] !=
'') {
645 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
648if ($optioncss !=
'') {
649 $param .=
'&optioncss='.urlencode($optioncss);
651if ($search_filter && $search_filter !=
'-1') {
652 $param .=
"&search_filter=".urlencode($search_filter);
655include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
657$parameters = array(
'param' => &$param);
658$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
659$param .= $hookmanager->resPrint;
662$arrayofmassactions = array(
664 'approve' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"ValidateAndApprove"),
665 'cancel' =>
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Cancel"),
668 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendMail"),
670if ($permissiontodelete) {
671 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
673if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'prevalidate',
'presend',
'predelete'))) {
674 $arrayofmassactions = array();
676$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
678print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
679if ($optioncss !=
'') {
680 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
682print
'<input type="hidden" name="token" value="'.newToken().
'">';
683print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
684print
'<input type="hidden" name="action" value="list">';
685print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
686print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
687print
'<input type="hidden" name="page" value="'.$page.
'">';
688print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
689print
'<input type="hidden" name="page_y" value="">';
690print
'<input type="hidden" name="mode" value="'.$mode.
'">';
692 print
'<input type="hidden" name="socid" value="'.$socid.
'" >';
693} elseif ($memberid) {
694 print
'<input type="hidden" name="rowid" value="'.$memberid.
'" >';
699$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'));
700$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'));
702$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);
705print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
708$topicmail =
"SendPartnershipRef";
709$modelmail =
"partnership_send";
711$trackid =
'pship'.$object->id;
712include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
716 foreach ($fieldstosearchall as $key => $val) {
717 $fieldstosearchall[$key] = $langs->trans($val);
718 $setupstring .= $key.
"=".$val.
";";
720 print
'<!-- Search done like if PARTNERSHIP_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
721 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
729$parameters = array();
730$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
731if (empty($reshook)) {
732 $moreforfilter .= $hookmanager->resPrint;
734 $moreforfilter = $hookmanager->resPrint;
737if (!empty($moreforfilter)) {
738 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
739 print $moreforfilter;
743$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
744$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
745$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
747print
'<div class="div-table-responsive">';
748print
'<table class="tagtable nobottomiftotal liste noborder'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
751if ($managedfor ==
'member') {
752 $arrayfields[
't.fk_member'][
'checked'] = 1;
754 $arrayfields[
't.fk_soc'][
'checked'] = 1;
758print
'<tr class="liste_titre_filter">';
761 print
'<td class="liste_titre maxwidthsearch">';
762 $searchpicto = $form->showFilterButtons(
'left');
766foreach ($all_fields_list as $key => $val) {
767 $searchkey = empty($search[$key]) ?
'' : $search[$key];
768 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
769 if ($key ==
'status') {
770 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
771 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
772 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
773 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
774 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
775 } 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'])) {
776 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
778 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
779 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
780 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
781 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);
782 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
783 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
784 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
785 print
'<div class="nowrap">';
786 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
788 print
'<div class="nowrap">';
789 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
791 } elseif ($key ==
'lang') {
792 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
794 print $formadmin->select_language($search[$key],
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
795 } elseif ($key ==
'country') {
796 print $form->select_country(in_array($key, $search) ? $search[$key] : 0,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
798 print
'<input type="text" class="flat maxwidth'.($val[
'type'] ==
'integer' ?
'50' :
'75').
'" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
804if ($managedfor ==
'member') {
805 print
'<td class="liste_titre center">';
806 $selectarray = array(
'-1' =>
'',
'withoutsubscription' => $langs->trans(
"WithoutSubscription"),
'uptodate' => $langs->trans(
"UpToDate"),
'outofdate' => $langs->trans(
"OutOfDate"));
807 print $form->selectarray(
'search_filter', $selectarray, $search_filter);
811include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
814$parameters = array(
'arrayfields' => $arrayfields);
815$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
816print $hookmanager->resPrint;
819 print
'<td class="liste_titre maxwidthsearch">';
820 $searchpicto = $form->showFilterButtons();
826$totalarray = array();
827$totalarray[
'nbfield'] = 0;
831print
'<tr class="liste_titre">';
833 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
834 $totalarray[
'nbfield']++;
836foreach ($all_fields_list as $key => $val) {
837 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
838 if ($key ==
'status') {
839 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
840 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
841 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
842 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
843 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
844 } 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'])) {
845 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
847 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
848 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
849 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";
850 $totalarray[
'nbfield']++;
854if ($managedfor ==
'member') {
856 $cssforfield =
'center';
857 print
getTitleFieldOfList(
'SubscriptionEndDate', 0, $_SERVER[
'PHP_SELF'],
'd.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
860include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
862$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
863$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
864print $hookmanager->resPrint;
867 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
868 $totalarray[
'nbfield']++;
874$needToFetchEachLine = 0;
875if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
876 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
877 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
878 $needToFetchEachLine++;
887$savnbfield = $totalarray[
'nbfield'];
888$totalarray = array();
889$totalarray[
'nbfield'] = 0;
890$imaxinloop = ($limit ? min($num, $limit) : $num);
892while ($i < $imaxinloop) {
893 $obj = $db->fetch_object($resql);
899 $object->setVarsFromFetchObj($obj);
902 if ($obj->fk_soc > 0) {
903 if (!empty($conf->cache[
'thirdparty'][$obj->fk_soc])) {
904 $companyobj = $conf->cache[
'thirdparty'][$obj->fk_soc];
906 $companyobj =
new Societe($db);
907 $companyobj->fetch($obj->fk_soc);
908 $conf->cache[
'thirdparty'][$obj->fk_soc] = $companyobj;
911 $object->thirdparty = $companyobj;
914 if ($managedfor ==
'member') {
915 if ($obj->fk_member > 0) {
916 $result = $adherent->fetch($obj->fk_member);
920 if ($mode ==
'kanban') {
922 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
923 print
'<div class="box-flex-container kanban">';
927 if ($massactionbutton || $massaction) {
929 if (in_array(
$object->id, $arrayofselected)) {
933 print
$object->getKanbanView(
'', array(
'thirdparty' =>
$object->thirdparty,
'selected' => $selected));
934 if ($i == ($imaxinloop - 1)) {
941 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
944 print
'<td class="nowrap center">';
945 if ($massactionbutton || $massaction) {
947 if (in_array(
$object->id, $arrayofselected)) {
950 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
954 $totalarray[
'nbfield']++;
957 foreach ($all_fields_list as $key => $val) {
958 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
959 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
960 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
961 } elseif ($key ==
'status') {
962 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
965 if (in_array($val[
'type'], array(
'timestamp'))) {
966 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
967 } elseif ($key ==
'ref') {
968 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
971 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
972 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
976 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
977 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
978 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
979 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
982 if ($key ==
'status') {
983 print
$object->getLibStatut(5);
984 } elseif ($key ==
'country') {
985 if ($managedfor ==
'member') {
986 if (!empty($adherent->country_code)) {
987 print $langs->trans(
"Country".$adherent->country_code);
990 if (!empty(
$object->thirdparty->country_code)) {
991 print $langs->trans(
"Country".
$object->thirdparty->country_code);
994 } elseif ($key ==
'town') {
995 if ($managedfor ==
'member') {
996 print $adherent->town;
998 print
$object->thirdparty->town;
1000 } elseif ($key ==
'rowid') {
1007 $totalarray[
'nbfield']++;
1009 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
1011 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
1013 if (!isset($totalarray[
'val'])) {
1014 $totalarray[
'val'] = array();
1016 if (!isset($totalarray[
'val'][
't.'.$key])) {
1017 $totalarray[
'val'][
't.'.$key] = 0;
1019 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
1024 if ($managedfor ==
'member') {
1025 print
'<td class="nowrap center endofsubscriptiondate">';
1026 $result = $adherent->fetch(
$object->fk_member);
1028 $datefin = $adherent->datefin;
1031 if ($adherent->hasDelay()) {
1032 $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").
')';
1033 print
" ".img_warning($langs->trans(
"SubscriptionLate").$textlate);
1036 if ($adherent->subscription ==
'yes') {
1037 print $langs->trans(
"SubscriptionNotReceived");
1038 if ($adherent->statut > 0) {
1039 print
" ".img_warning();
1049 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1051 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1052 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1053 print $hookmanager->resPrint;
1056 print
'<td class="nowrap center">';
1057 if ($massactionbutton || $massaction) {
1059 if (in_array(
$object->id, $arrayofselected)) {
1062 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1066 $totalarray[
'nbfield']++;
1075if ($managedfor !=
'member') {
1076 $totalarray[
'nbfield']++;
1080include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1085 foreach ($arrayfields as $key => $val) {
1086 if (!empty($val[
'checked'])) {
1090 if ($managedfor !=
'member') {
1093 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1099$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1100$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1101print $hookmanager->resPrint;
1103print
'</table>'.
"\n";
1106print
'</form>'.
"\n";
1108if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1109 $hidegeneratedfilelistifempty = 1;
1110 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1111 $hidegeneratedfilelistifempty = 0;
1114 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1118 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1119 $urlsource .= str_replace(
'&',
'&', $param);
1121 $filedir = $diroutputmassaction;
1122 $genallowed = $permissiontoread;
1123 $delallowed = $permissiontoadd;
1125 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($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_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)
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.
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_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.