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';
48$langs->loadLangs(array(
"partnership",
"members",
"other"));
50$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
51$massaction =
GETPOST(
'massaction',
'alpha');
53$confirm =
GETPOST(
'confirm',
'alpha');
54$cancel =
GETPOST(
'cancel',
'alpha');
55$toselect =
GETPOST(
'toselect',
'array');
56$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
57$backtopage =
GETPOST(
'backtopage',
'alpha');
58$optioncss =
GETPOST(
'optioncss',
'aZ');
66$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
67$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
69if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
73$offset = $limit * $page;
81$diroutputmassaction =
$conf->partnership->dir_output.
'/temp/massgeneration/'.$user->id;
83 $hookmanager->initHooks(array(
'thirdpartypartnership',
'globalcard'));
84} elseif ($memberid > 0) {
85 $hookmanager->initHooks(array(
'memberpartnership',
'globalcard'));
87 $hookmanager->initHooks(array(
'partnershiplist'));
91$extrafields->fetch_name_optionals_label(
$object->table_element);
94$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
100if ($managedfor !=
'member' && $sortfield ==
'd.datefin') {
105$non_object_fields = array(
106 'town' => array(
'type' =>
'varchar(128)',
'label' =>
'Town',
'enabled' => 1,
'position' => 51,
'notnull' => 0,
'visible' => 1,
'alwayseditable' => 1,
'searchall' => 1,),
107 'country' => array(
'type' =>
'integer',
'label' =>
'Country',
'enabled' => 1,
'position' => 51,
'notnull' => 0,
'visible' => 1,
'alwayseditable' => 1,
'css' =>
'maxwidth500 widthcentpercentminusxx',
'searchall' => 1,)
111$all_fields_list = array_merge(
$object->fields, $non_object_fields);
115 reset($all_fields_list);
116 $sortfield =
"t.".key($all_fields_list);
123$search_all =
GETPOST(
'search_all',
'alphanohtml');
125foreach ($all_fields_list as $key => $val) {
126 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
127 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
129 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
134$search_filter =
GETPOST(
"search_filter",
'alpha');
135$filter =
GETPOST(
"filter",
'alpha');
137 $search_filter = $filter;
141$fieldstosearchall = array();
142foreach ($non_object_fields as $key => $val) {
143 if (!empty($val[
'searchall'])) {
144 $fieldstosearchall[
't.'.$key] = $val[
'label'];
149$arrayfields = array();
150foreach ($all_fields_list as $key => $val) {
152 if (!empty($val[
'visible'])) {
153 $visible = (int)
dol_eval((
string) $val[
'visible'], 1);
154 $arrayfields[
't.'.$key] = array(
155 'label' => $val[
'label'],
156 'checked' => (($visible < 0) ? 0 : 1),
157 'enabled' => (abs($visible) != 3 && (bool)
dol_eval($val[
'enabled'], 1)),
158 'position' => $val[
'position'],
159 'help' => isset($val[
'help']) ? $val[
'help'] :
''
164include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
170$permissiontoread = $user->hasRight(
'partnership',
'read');
171$permissiontoadd = $user->hasRight(
'partnership',
'write');
172$permissiontodelete = $user->hasRight(
'partnership',
'delete');
178if (empty(
$conf->partnership->enabled)) {
181if (empty($permissiontoread)) {
184if (
$object->id > 0 && !(
$object->fk_member > 0) && $managedfor ==
'member') {
187if (
$object->id > 0 && !(
$object->fk_soc > 0) && $managedfor ==
'thirdparty') {
196if (
GETPOST(
'cancel',
'alpha')) {
200if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
204$parameters = array();
205$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
210if (empty($reshook)) {
212 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
215 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
216 foreach ($all_fields_list as $key => $val) {
218 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
219 $search[$key.
'_dtstart'] =
'';
220 $search[$key.
'_dtend'] =
'';
224 $search_array_options = array();
226 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
227 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
232 $objectclass =
'Partnership';
233 $objectlabel =
'Partnership';
234 $uploaddir =
$conf->partnership->dir_output;
235 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
238 if (!$error && $massaction ==
'approve' && $permissiontoadd) {
245 foreach ($toselect as $checked) {
246 if ($objecttmp->fetch($checked)) {
247 if ($objecttmp->status == $objecttmp::STATUS_DRAFT) {
249 $result = $objecttmp->validate($user);
252 if ($result >= 0 && $objecttmp->status == $objecttmp::STATUS_VALIDATED) {
253 $result = $objecttmp->approve($user);
255 setEventMessages($langs->trans(
"PartnershipRefApproved", $objecttmp->ref),
null);
275 if ($massaction ==
'cancel' && $permissiontoadd) {
278 $objecttmp =
new $objectclass($db);
280 foreach ($toselect as $toselectid) {
281 $result = $objecttmp->fetch($toselectid);
283 $result = $objecttmp->cancel($user, 0);
285 setEventMessages($langs->trans(
'StatusOfRefMustBe', $objecttmp->ref, $objecttmp->LibStatut($objecttmp::STATUS_APPROVED)),
null,
'warnings');
287 } elseif ($result <= 0) {
316$form =
new Form($db);
317$companystatic =
new Societe($db);
323$title = $langs->trans(
"Partnerships");
331$sql .=
$object->getFieldList(
't');
332if ($managedfor ==
'member') {
333 $sql .=
', d.datefin, d.fk_adherent_type, dty.subscription';
336if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
337 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
338 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
342$parameters = array();
343$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
344$sql .= $hookmanager->resPrint;
345$sql = preg_replace(
'/,\s*$/',
'', $sql);
349$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as t";
350if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
351 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (t.rowid = ef.fk_object)";
353if ($managedfor ==
'member') {
354 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent as d on (d.rowid = t.fk_member)";
355 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"adherent_type as dty on (dty.rowid = d.fk_adherent_type)";
357 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as d on (d.rowid = t.fk_soc)";
360$parameters = array();
361$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
362$sql .= $hookmanager->resPrint;
363if (
$object->ismultientitymanaged == 1) {
364 $sql .=
" WHERE t.entity IN (".getEntity(
$object->element).
")";
366 $sql .=
" WHERE 1 = 1";
368if ($managedfor ==
'member') {
370 $sql .=
" AND t.fk_member = ".((int) $memberid);
372 $sql .=
" AND fk_member > 0";
376 $sql .=
" AND t.fk_soc = ".((int) $socid);
378 $sql .=
" AND fk_soc > 0";
381foreach ($search as $key => $val) {
382 if (array_key_exists($key,
$object->fields)) {
383 if ($key ==
'status' && $search[$key] == -1) {
387 if ((strpos(
$object->fields[$key][
'type'],
'integer:') === 0) || (strpos(
$object->fields[$key][
'type'],
'sellist:') === 0) || !empty(
$object->fields[$key][
'arrayofkeyval'])) {
388 if ($search[$key] ==
'-1' || ($search[$key] ===
'0' && (empty(
$object->fields[$key][
'arrayofkeyval']) || !array_key_exists(
'0',
$object->fields[$key][
'arrayofkeyval'])))) {
393 if ($search[$key] !=
'') {
394 $sql .=
natural_search(
"t.".$db->escape($key), $search[$key], (($key ==
'status') ? 2 : $mode_search));
397 if (preg_match(
'/(_dtstart|_dtend)$/', $key) && $search[$key] !=
'') {
398 $columnName = preg_replace(
'/(_dtstart|_dtend)$/',
'', $key);
399 if (preg_match(
'/^(date|timestamp|datetime)/',
$object->fields[$columnName][
'type'])) {
400 if (preg_match(
'/_dtstart$/', $key)) {
401 $sql .=
" AND t.".$db->escape($columnName).
" >= '".$db->idate($search[$key]).
"'";
403 if (preg_match(
'/_dtend$/', $key)) {
404 $sql .=
" AND t.".$db->escape($columnName).
" <= '".$db->idate($search[$key]).
"'";
408 if ($key ==
'country' && $search[$key] !=
'') {
409 if ($managedfor ==
'member') {
410 $sql .=
" AND d.country = '".$db->escape($val).
"'";
412 $sql .=
" AND d.fk_pays = '".$db->escape($val).
"'";
416 if ($key ==
'town' && $search[$key] !=
'') {
421if ($managedfor ==
'member') {
422 if ($search_filter ==
'withoutsubscription') {
423 $sql .=
" AND (d.datefin IS NULL)";
425 if ($search_filter ==
'waitingsubscription') {
426 $sql .=
" AND (d.datefin IS NULL AND t.subscription = '1')";
428 if ($search_filter ==
'uptodate') {
429 $sql .=
" AND (d.datefin >= '".$db->idate($now).
"' OR dty.subscription = '0')";
431 if ($search_filter ==
'outofdate') {
432 $sql .=
" AND (d.datefin < '".$db->idate($now).
"' AND dty.subscription = '1')";
436 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
440include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
442$parameters = array();
443$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
444$sql .= $hookmanager->resPrint;
465$nbtotalofrecords =
'';
468 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
469 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
470 $resql = $db->query($sqlforcount);
472 $objforcount = $db->fetch_object($resql);
473 $nbtotalofrecords = $objforcount->nbtotalofrecords;
478 if (($page * $limit) > $nbtotalofrecords) {
486$sql .= $db->order($sortfield, $sortorder);
488 $sql .= $db->plimit($limit + 1, $offset);
491$resql = $db->query($sql);
497$num = $db->num_rows($resql);
501if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
502 $obj = $db->fetch_object($resql);
504 header(
"Location: ".
dol_buildpath(
'/partnership/partnership_card.php', 1).
'?id='.$id);
512llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-partnership page-list');
514if ($managedfor ==
"member") {
515 if ($memberid > 0 && $user->hasRight(
'adherent',
'lire')) {
516 $langs->load(
"members");
520 $result = $adhstat->fetch($memberid);
522 $adht->fetch($adhstat->typeid);
526 print
dol_get_fiche_head($head,
'partnerships', $langs->trans(
"ThirdParty"), -1,
'user');
528 $linkback =
'<a href="'.DOL_URL_ROOT.
'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
530 dol_banner_tab($object,
'rowid', $linkback);
532 print
'<div class="fichecenter">';
534 print
'<div class="underbanner clearboth"></div>';
535 print
'<table class="border centpercent tableforfield">';
539 print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
' / '.$langs->trans(
"Id").
'</td><td class="valeur">'.
$object->login.
' </td></tr>';
543 print
'<tr><td class="titlefield">'.$langs->trans(
"Type").
'</td><td class="valeur">'.$adht->getNomUrl(1).
"</td></tr>\n";
546 print
'<tr><td>'.$langs->trans(
"MemberNature").
'</td><td class="valeur" >'.$adhstat->getmorphylib().
'</td>';
550 print
'<tr><td>'.$langs->trans(
"Company").
'</td><td class="valeur">'.$adhstat->company.
'</td></tr>';
553 print
'<tr><td>'.$langs->trans(
"UserTitle").
'</td><td class="valeur">'.$adhstat->getCivilityLabel().
' </td>';
562} elseif ($managedfor ==
"thirdparty") {
563 if ($socid && $user->hasRight(
'societe',
'lire')) {
565 $res = $socstat->fetch($socid);
572 print
dol_get_fiche_head($head,
'partnerships', $langs->trans(
"ThirdParty"), -1,
'company');
574 dol_banner_tab($socstat,
'socid',
'', ($user->socid ? 0 : 1),
'rowid',
'nom');
576 print
'<div class="fichecenter">';
578 print
'<div class="underbanner clearboth"></div>';
579 print
'<table class="border centpercent tableforfield">';
582 print
'<tr><td class="titlefield">'.$langs->trans(
'NatureOfThirdParty').
'</td><td>';
583 print $socstat->getTypeUrl(1);
587 if ($socstat->client && !empty($socstat->code_client)) {
588 print
'<tr><td class="titlefield">';
589 print $langs->trans(
'CustomerCode').
'</td><td>';
591 $tmpcheck = $socstat->check_codeclient();
592 if ($tmpcheck != 0 && $tmpcheck != -5) {
593 print
' <span class="error">('.$langs->trans(
"WrongCustomerCode").
')</span>';
599 if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
600 print
'<tr><td class="titlefield">';
601 print $langs->trans(
'SupplierCode').
'</td><td>';
603 $tmpcheck = $socstat->check_codefournisseur();
604 if ($tmpcheck != 0 && $tmpcheck != -5) {
605 print
' <span class="error">('.$langs->trans(
"WrongSupplierCode").
')</span>';
620$arrayofselected = is_array($toselect) ? $toselect : array();
624 $param .=
'&mode='.urlencode($mode);
626if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
627 $param .=
'&contextpage='.urlencode($contextpage);
629if ($limit > 0 && $limit !=
$conf->liste_limit) {
630 $param .=
'&limit='.((int) $limit);
633 $param .=
'&socid='.urlencode((
string) ($socid));
636 $param .=
'&rowid='.urlencode((
string) ($memberid));
638foreach ($search as $key => $val) {
639 if (is_array($search[$key])) {
640 foreach ($search[$key] as $skey) {
642 $param .=
'&search_'.$key.
'[]='.urlencode($skey);
645 } elseif (preg_match(
'/(_dtstart|_dtend)$/', $key) && !empty($val)) {
646 $param .=
'&search_'.$key.
'month='.(
GETPOSTINT(
'search_'.$key.
'month'));
647 $param .=
'&search_'.$key.
'day='.(
GETPOSTINT(
'search_'.$key.
'day'));
648 $param .=
'&search_'.$key.
'year='.(
GETPOSTINT(
'search_'.$key.
'year'));
649 } elseif ($search[$key] !=
'') {
650 $param .=
'&search_'.$key.
'='.urlencode($search[$key]);
653if ($optioncss !=
'') {
654 $param .=
'&optioncss='.urlencode($optioncss);
656if ($search_filter && $search_filter !=
'-1') {
657 $param .=
"&search_filter=".urlencode($search_filter);
660include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
662$parameters = array(
'param' => &$param);
663$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
664$param .= $hookmanager->resPrint;
667$arrayofmassactions = array(
669 'approve' =>
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"ValidateAndApprove"),
670 'cancel' =>
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"Cancel"),
673 'presend' =>
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendMail"),
675if ($permissiontodelete) {
676 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
678if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'prevalidate',
'presend',
'predelete'))) {
679 $arrayofmassactions = array();
681$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
683print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
684if ($optioncss !=
'') {
685 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
687print
'<input type="hidden" name="token" value="'.newToken().
'">';
688print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
689print
'<input type="hidden" name="action" value="list">';
690print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
691print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
692print
'<input type="hidden" name="page" value="'.$page.
'">';
693print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
694print
'<input type="hidden" name="page_y" value="">';
695print
'<input type="hidden" name="mode" value="'.$mode.
'">';
697 print
'<input type="hidden" name="socid" value="'.$socid.
'" >';
698} elseif ($memberid) {
699 print
'<input type="hidden" name="rowid" value="'.$memberid.
'" >';
704$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'));
705$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'));
707$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);
710print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'object_'.
$object->picto, 0, $newcardbutton,
'', $limit, 0, 0, 1);
713$topicmail =
"SendPartnershipRef";
714$modelmail =
"partnership_send";
716$trackid =
'pship'.$object->id;
717include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
721 foreach ($fieldstosearchall as $key => $val) {
722 $fieldstosearchall[$key] = $langs->trans($val);
723 $setupstring .= $key.
"=".$val.
";";
725 print
'<!-- Search done like if PARTNERSHIP_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
726 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>'.
"\n";
734$parameters = array();
735$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
736if (empty($reshook)) {
737 $moreforfilter .= $hookmanager->resPrint;
739 $moreforfilter = $hookmanager->resPrint;
742if (!empty($moreforfilter)) {
743 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
744 print $moreforfilter;
748$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
749$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
750$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
752print
'<div class="div-table-responsive">';
753print
'<table class="tagtable nobottomiftotal liste noborder'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
756if ($managedfor ==
'member') {
757 $arrayfields[
't.fk_member'][
'checked'] = 1;
759 $arrayfields[
't.fk_soc'][
'checked'] = 1;
763print
'<tr class="liste_titre_filter">';
766 print
'<td class="liste_titre maxwidthsearch">';
767 $searchpicto = $form->showFilterButtons(
'left');
771foreach ($all_fields_list as $key => $val) {
772 $searchkey = empty($search[$key]) ?
'' : $search[$key];
773 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
774 if ($key ==
'status') {
775 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
776 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
777 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
778 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
779 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
780 } 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'])) {
781 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
783 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
784 print
'<td class="liste_titre'.($cssforfield ?
' '.$cssforfield :
'').($key ==
'status' ?
' parentonrightofpage' :
'').
'">';
785 if (!empty($val[
'arrayofkeyval']) && is_array($val[
'arrayofkeyval'])) {
786 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);
787 } elseif ((strpos($val[
'type'],
'integer:') === 0) || (strpos($val[
'type'],
'sellist:') === 0)) {
788 print
$object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] :
''),
'',
'',
'search_', $cssforfield.
' maxwidth250', 1);
789 } elseif (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
790 print
'<div class="nowrap">';
791 print $form->selectDate($search[$key.
'_dtstart'] ? $search[$key.
'_dtstart'] :
'',
"search_".$key.
"_dtstart", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
793 print
'<div class="nowrap">';
794 print $form->selectDate($search[$key.
'_dtend'] ? $search[$key.
'_dtend'] :
'',
"search_".$key.
"_dtend", 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
796 } elseif ($key ==
'lang') {
797 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
799 print $formadmin->select_language($search[$key],
'search_lang', 0, array(), 1, 0, 0,
'minwidth100imp maxwidth125', 2);
800 } elseif ($key ==
'country') {
801 print $form->select_country(in_array($key, $search) ? $search[$key] : 0,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
803 print
'<input type="text" class="flat maxwidth'.($val[
'type'] ==
'integer' ?
'50' :
'75').
'" name="search_'.$key.
'" value="'.
dol_escape_htmltag(isset($search[$key]) ? $search[$key] :
'').
'">';
809if ($managedfor ==
'member') {
810 print
'<td class="liste_titre center">';
811 $selectarray = array(
'-1' =>
'',
'withoutsubscription' => $langs->trans(
"WithoutSubscription"),
'uptodate' => $langs->trans(
"UpToDate"),
'outofdate' => $langs->trans(
"OutOfDate"));
812 print $form->selectarray(
'search_filter', $selectarray, $search_filter);
816include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
819$parameters = array(
'arrayfields' => $arrayfields);
820$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
821print $hookmanager->resPrint;
824 print
'<td class="liste_titre maxwidthsearch">';
825 $searchpicto = $form->showFilterButtons();
831$totalarray = array();
832$totalarray[
'nbfield'] = 0;
836print
'<tr class="liste_titre">';
838 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
839 $totalarray[
'nbfield']++;
841foreach ($all_fields_list as $key => $val) {
842 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
843 if ($key ==
'status') {
844 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
845 } elseif (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
846 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
847 } elseif (in_array($val[
'type'], array(
'timestamp'))) {
848 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
849 } 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'])) {
850 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
852 $cssforfield = preg_replace(
'/small\s*/',
'', $cssforfield);
853 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
854 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";
855 $totalarray[
'nbfield']++;
859if ($managedfor ==
'member') {
861 $cssforfield =
'center';
862 print
getTitleFieldOfList(
'SubscriptionEndDate', 0, $_SERVER[
'PHP_SELF'],
'd.'.$key,
'', $param, ($cssforfield ?
'class="'.$cssforfield.
'"' :
''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.
' ' :
'')).
"\n";
865include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
867$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
868$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
869print $hookmanager->resPrint;
872 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
873 $totalarray[
'nbfield']++;
879$needToFetchEachLine = 0;
880if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
881 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
882 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
883 $needToFetchEachLine++;
892$savnbfield = $totalarray[
'nbfield'];
893$totalarray = array();
894$totalarray[
'nbfield'] = 0;
895$imaxinloop = ($limit ? min($num, $limit) : $num);
897while ($i < $imaxinloop) {
898 $obj = $db->fetch_object($resql);
904 $object->setVarsFromFetchObj($obj);
907 if ($obj->fk_soc > 0) {
908 if (!empty(
$conf->cache[
'thirdparty'][$obj->fk_soc])) {
909 $companyobj =
$conf->cache[
'thirdparty'][$obj->fk_soc];
911 $companyobj =
new Societe($db);
912 $companyobj->fetch($obj->fk_soc);
913 $conf->cache[
'thirdparty'][$obj->fk_soc] = $companyobj;
916 $object->thirdparty = $companyobj;
919 if ($managedfor ==
'member') {
920 if ($obj->fk_member > 0) {
921 $result = $adherent->fetch($obj->fk_member);
925 if ($mode ==
'kanban') {
927 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
928 print
'<div class="box-flex-container kanban">';
932 if ($massactionbutton || $massaction) {
934 if (in_array(
$object->id, $arrayofselected)) {
938 print
$object->getKanbanView(
'', array(
'thirdparty' =>
$object->thirdparty,
'selected' => $selected));
939 if ($i == ($imaxinloop - 1)) {
946 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
949 print
'<td class="nowrap center">';
950 if ($massactionbutton || $massaction) {
952 if (in_array(
$object->id, $arrayofselected)) {
955 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
959 $totalarray[
'nbfield']++;
962 foreach ($all_fields_list as $key => $val) {
963 $cssforfield = (empty($val[
'csslist']) ? (empty($val[
'css']) ?
'' : $val[
'css']) : $val[
'csslist']);
964 if (in_array($val[
'type'], array(
'date',
'datetime',
'timestamp'))) {
965 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
966 } elseif ($key ==
'status') {
967 $cssforfield .= ($cssforfield ?
' ' :
'').
'center';
970 if (in_array($val[
'type'], array(
'timestamp'))) {
971 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
972 } elseif ($key ==
'ref') {
973 $cssforfield .= ($cssforfield ?
' ' :
'').
'nowrap';
976 if (in_array($val[
'type'], array(
'double(24,8)',
'double(6,3)',
'integer',
'real',
'price')) && !in_array($key, array(
'rowid',
'status')) && empty($val[
'arrayofkeyval'])) {
977 $cssforfield .= ($cssforfield ?
' ' :
'').
'right';
981 if (!empty($arrayfields[
't.'.$key][
'checked'])) {
982 print
'<td'.($cssforfield ?
' class="'.$cssforfield.(preg_match(
'/tdoverflow/', $cssforfield) ?
' classfortooltip' :
'').
'"' :
'');
983 if (preg_match(
'/tdoverflow/', $cssforfield) && !in_array($val[
'type'], array(
'ip',
'url')) && !is_numeric(
$object->$key)) {
984 print
' title="'.dol_escape_htmltag(
$object->$key).
'"';
987 if ($key ==
'status') {
988 print
$object->getLibStatut(5);
989 } elseif ($key ==
'country') {
990 if ($managedfor ==
'member') {
991 if (!empty($adherent->country_code)) {
992 print $langs->trans(
"Country".$adherent->country_code);
995 if (!empty(
$object->thirdparty->country_code)) {
996 print $langs->trans(
"Country".
$object->thirdparty->country_code);
999 } elseif ($key ==
'town') {
1000 if ($managedfor ==
'member') {
1001 print $adherent->town;
1003 print
$object->thirdparty->town;
1005 } elseif ($key ==
'rowid') {
1012 $totalarray[
'nbfield']++;
1014 if (!empty($val[
'isameasure']) && $val[
'isameasure'] == 1) {
1016 $totalarray[
'pos'][$totalarray[
'nbfield']] =
't.'.$key;
1018 if (!isset($totalarray[
'val'])) {
1019 $totalarray[
'val'] = array();
1021 if (!isset($totalarray[
'val'][
't.'.$key])) {
1022 $totalarray[
'val'][
't.'.$key] = 0;
1024 $totalarray[
'val'][
't.'.$key] +=
$object->$key;
1029 if ($managedfor ==
'member') {
1030 print
'<td class="nowrap center endofsubscriptiondate">';
1031 $result = $adherent->fetch(
$object->fk_member);
1033 $datefin = $adherent->datefin;
1036 if ($adherent->hasDelay()) {
1037 $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").
')';
1038 print
" ".img_warning($langs->trans(
"SubscriptionLate").$textlate);
1041 if ($adherent->subscription ==
'yes') {
1042 print $langs->trans(
"SubscriptionNotReceived");
1043 if ($adherent->statut > 0) {
1044 print
" ".img_warning();
1054 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1056 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1057 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1058 print $hookmanager->resPrint;
1061 print
'<td class="nowrap center">';
1062 if ($massactionbutton || $massaction) {
1064 if (in_array(
$object->id, $arrayofselected)) {
1067 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1071 $totalarray[
'nbfield']++;
1080if ($managedfor !=
'member') {
1081 $totalarray[
'nbfield']++;
1085include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1090 foreach ($arrayfields as $key => $val) {
1091 if (!empty($val[
'checked'])) {
1095 if ($managedfor !=
'member') {
1098 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1104$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1105$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1106print $hookmanager->resPrint;
1108print
'</table>'.
"\n";
1111print
'</form>'.
"\n";
1113if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
1114 $hidegeneratedfilelistifempty = 1;
1115 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
1116 $hidegeneratedfilelistifempty = 0;
1119 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
1123 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1124 $urlsource .= str_replace(
'&',
'&', $param);
1126 $filedir = $diroutputmassaction;
1127 $genallowed = $permissiontoread;
1128 $delallowed = $permissiontoadd;
1130 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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.