dolibarr  17.0.4
partnership_list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2021 NextGestion <contact@nextgestion.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
25 // Load Dolibarr environment
26 require '../main.inc.php';
27 
28 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
31 require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
32 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
35 
36 // for other modules
37 //dol_include_once('/othermodule/class/otherobject.class.php');
38 
39 // Load translation files required by the page
40 $langs->loadLangs(array("partnership", "members", "other"));
41 
42 $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
43 $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
44 $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
45 $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
46 $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
47 $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
48 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
49 $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
50 $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
51 $mode = GETPOST('mode', 'aZ');
52 
53 $id = GETPOST('id', 'int');
54 $socid = GETPOST('socid', 'int');
55 $memberid = GETPOST('rowid', 'int');
56 // Load variable for pagination
57 $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
58 $sortfield = GETPOST('sortfield', 'aZ09comma');
59 $sortorder = GETPOST('sortorder', 'aZ09comma');
60 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
61 if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
62  // If $page is not defined, or '' or -1 or if we click on clear filters
63  $page = 0;
64 }
65 $offset = $limit * $page;
66 $pageprev = $page - 1;
67 $pagenext = $page + 1;
68 
69 // Initialize technical objects
70 $object = new Partnership($db);
71 $extrafields = new ExtraFields($db);
72 $adherent = new Adherent($db);
73 $diroutputmassaction = $conf->partnership->dir_output.'/temp/massgeneration/'.$user->id;
74 if ($socid > 0) {
75  $hookmanager->initHooks(array('thirdpartypartnership'));
76 } elseif ($memberid > 0) {
77  $hookmanager->initHooks(array('memberpartnership'));
78 } else {
79  $hookmanager->initHooks(array('partnershiplist')); // Note that conf->hooks_modules contains array
80 }
81 
82 // Fetch optionals attributes and labels
83 $extrafields->fetch_name_optionals_label($object->table_element);
84 //$extrafields->fetch_name_optionals_label($object->table_element_line);
85 
86 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
87 
88 $error = 0;
89 
90 $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
91 
92 if ($managedfor != 'member' && $sortfield == 'd.datefin') $sortfield = '';
93 
94 // Default sort order (if not yet defined by previous GETPOST)
95 if (!$sortfield) {
96  reset($object->fields); // Reset is required to avoid key() to return null.
97  $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
98 }
99 if (!$sortorder) {
100  $sortorder = "ASC";
101 }
102 
103 // Initialize array of search criterias
104 $search_all = GETPOST('search_all', 'alphanohtml');
105 $search = array();
106 foreach ($object->fields as $key => $val) {
107  if (GETPOST('search_'.$key, 'alpha') !== '') {
108  $search[$key] = GETPOST('search_'.$key, 'alpha');
109  }
110  if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
111  $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
112  $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
113  }
114 }
115 $search_filter = GETPOST("search_filter", 'alpha');
116 $filter = GETPOST("filter", 'alpha');
117 if ($filter) {
118  $search_filter = $filter; // For backward compatibility
119 }
120 
121 // List of fields to search into when doing a "search in all"
122 $fieldstosearchall = array();
123 foreach ($object->fields as $key => $val) {
124  if (!empty($val['searchall'])) {
125  $fieldstosearchall['t.'.$key] = $val['label'];
126  }
127 }
128 
129 // Definition of array of fields for columns
130 $arrayfields = array();
131 foreach ($object->fields as $key => $val) {
132  // If $val['visible']==0, then we never show the field
133  if (!empty($val['visible'])) {
134  $visible = (int) dol_eval($val['visible'], 1);
135  $arrayfields['t.'.$key] = array(
136  'label'=>$val['label'],
137  'checked'=>(($visible < 0) ? 0 : 1),
138  'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
139  'position'=>$val['position'],
140  'help'=> isset($val['help']) ? $val['help'] : ''
141  );
142  }
143 }
144 // Extra fields
145 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
146 
147 $object->fields = dol_sort_array($object->fields, 'position');
148 $arrayfields = dol_sort_array($arrayfields, 'position');
149 
150 $permissiontoread = $user->rights->partnership->read;
151 $permissiontoadd = $user->rights->partnership->write;
152 $permissiontodelete = $user->rights->partnership->delete;
153 
154 // Security check - Protection if external user
155 //if ($user->socid > 0) accessforbidden();
156 //if ($user->socid > 0) $socid = $user->socid;
157 //$result = restrictedArea($user, 'partnership', $object->id);
158 if (empty($conf->partnership->enabled)) accessforbidden();
159 if (empty($permissiontoread)) accessforbidden();
160 if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden();
161 if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden();
162 
163 
164 /*
165  * Actions
166  */
167 
168 if (GETPOST('cancel', 'alpha')) {
169  $action = 'list';
170  $massaction = '';
171 }
172 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
173  $massaction = '';
174 }
175 
176 $parameters = array();
177 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
178 if ($reshook < 0) {
179  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
180 }
181 
182 if (empty($reshook)) {
183  // Selection of new fields
184  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
185 
186  // Purge search criteria
187  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
188  foreach ($object->fields as $key => $val) {
189  $search[$key] = '';
190  if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
191  $search[$key.'_dtstart'] = '';
192  $search[$key.'_dtend'] = '';
193  }
194  }
195  $toselect = array();
196  $search_array_options = array();
197  }
198  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
199  || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
200  $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
201  }
202 
203  // Mass actions
204  $objectclass = 'Partnership';
205  $objectlabel = 'Partnership';
206  $uploaddir = $conf->partnership->dir_output;
207  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
208 
209  // Validate and approve
210  if (!$error && $massaction == 'approve' && $permissiontoadd) {
211  $objecttmp = new Partnership($db);
212 
213  $db->begin();
214  $error = 0;
215  $result = 0;
216 
217  foreach ($toselect as $checked) {
218  if ($objecttmp->fetch($checked)) {
219  if ($objecttmp->status == $objecttmp::STATUS_DRAFT) {
220  //$objecttmp->date = dol_now();
221  $result = $objecttmp->validate($user);
222  }
223 
224  if ($result >= 0 && $objecttmp->status == $objecttmp::STATUS_VALIDATED) {
225  $result = $objecttmp->approve($user);
226  if ($result > 0) {
227  setEventMessages($langs->trans("PartnershipRefApproved", $objecttmp->ref), null);
228  } else {
229  setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
230  $error++;
231  }
232  } else {
233  setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
234  $error++;
235  }
236  }
237  }
238 
239  if (!$error) {
240  $db->commit();
241  } else {
242  $db->rollback();
243  }
244  }
245 
246  // Cancel partnership
247  if ($massaction == 'cancel' && $permissiontoadd) {
248  $db->begin();
249 
250  $objecttmp = new $objectclass($db);
251  $nbok = 0;
252  foreach ($toselect as $toselectid) {
253  $result = $objecttmp->fetch($toselectid);
254  if ($result > 0) {
255  $result = $objecttmp->cancel($user, 0);
256  if ($result == 0) {
257  setEventMessages($langs->trans('StatusOfRefMustBe', $objecttmp->ref, $objecttmp->LibStatut($objecttmp::STATUS_APPROVED)), null, 'warnings');
258  $error++;
259  } elseif ($result <= 0) {
260  setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
261  $error++;
262  break;
263  } else {
264  $nbok++;
265  }
266  } else {
267  setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
268  $error++;
269  break;
270  }
271  }
272 
273  if (!$error) {
274  setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
275  $db->commit();
276  } else {
277  $db->rollback();
278  }
279  }
280 }
281 
282 
283 
284 /*
285  * View
286  */
287 
288 $form = new Form($db);
289 
290 $now = dol_now();
291 
292 //$help_url="EN:Module_Partnership|FR:Module_Partnership_FR|ES:Módulo_Partnership";
293 $help_url = '';
294 $title = $langs->trans("Partnerships");
295 $morejs = array();
296 $morecss = array();
297 
298 
299 // Build and execute select
300 // --------------------------------------------------------------------
301 $sql = 'SELECT ';
302 $sql .= $object->getFieldList('t');
303 if ($managedfor == 'member') {
304  $sql .= ', d.datefin, d.fk_adherent_type, dty.subscription';
305 }
306 // Add fields from extrafields
307 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
308  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
309  $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
310  }
311 }
312 // Add fields from hooks
313 $parameters = array();
314 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
315 $sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
316 $sql = preg_replace('/,\s*$/', '', $sql);
317 $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
318 if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
319  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
320 }
321 if ($managedfor == 'member') {
322  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d on (d.rowid = t.fk_member)";
323  $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_type as dty on (dty.rowid = d.fk_adherent_type)";
324 }
325 // Add table from hooks
326 $parameters = array();
327 $reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
328 $sql .= $hookmanager->resPrint;
329 if ($object->ismultientitymanaged == 1) {
330  $sql .= " WHERE t.entity IN (".getEntity($object->element).")";
331 } else {
332  $sql .= " WHERE 1 = 1";
333 }
334 if ($managedfor == 'member') {
335  if ($memberid > 0) {
336  $sql .= " AND t.fk_member = ".((int) $memberid);
337  } else {
338  $sql .= " AND fk_member > 0";
339  }
340 } else {
341  if ($socid > 0) {
342  $sql .= " AND t.fk_soc = ".((int) $socid);
343  } else {
344  $sql .= " AND fk_soc > 0";
345  }
346 }
347 foreach ($search as $key => $val) {
348  if (array_key_exists($key, $object->fields)) {
349  if ($key == 'status' && $search[$key] == -1) {
350  continue;
351  }
352  $mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
353  if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
354  if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
355  $search[$key] = '';
356  }
357  $mode_search = 2;
358  }
359  if ($search[$key] != '') {
360  $sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
361  }
362  } else {
363  if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
364  $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
365  if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
366  if (preg_match('/_dtstart$/', $key)) {
367  $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
368  }
369  if (preg_match('/_dtend$/', $key)) {
370  $sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
371  }
372  }
373  }
374  }
375 }
376 if ($managedfor == 'member') {
377  if ($search_filter == 'withoutsubscription') {
378  $sql .= " AND (d.datefin IS NULL)";
379  }
380  if ($search_filter == 'waitingsubscription') {
381  $sql .= " AND (d.datefin IS NULL AND t.subscription = '1')";
382  }
383  if ($search_filter == 'uptodate') {
384  $sql .= " AND (d.datefin >= '".$db->idate($now)."' OR dty.subscription = '0')";
385  }
386  if ($search_filter == 'outofdate') {
387  $sql .= " AND (d.datefin < '".$db->idate($now)."' AND dty.subscription = '1')";
388  }
389 }
390 if ($search_all) {
391  $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
392 }
393 //$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
394 // Add where from extra fields
395 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
396 // Add where from hooks
397 $parameters = array();
398 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
399 $sql .= $hookmanager->resPrint;
400 
401 /* If a group by is required
402 $sql.= " GROUP BY ";
403 foreach($object->fields as $key => $val) {
404  $sql .= "t.".$db->escape($key).", ";
405 }
406 // Add fields from extrafields
407 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
408  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
409  $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
410  }
411 }
412 // Add where from hooks
413 $parameters=array();
414 $reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters, $object); // Note that $action and $object may have been modified by hook
415 $sql.=$hookmanager->resPrint;
416 $sql=preg_replace('/,\s*$/','', $sql);
417 */
418 
419 // Count total nb of records
420 $nbtotalofrecords = '';
421 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
422  /* The fast and low memory method to get and count full list converts the sql into a sql count */
423  $sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\‍(\‍),=<>\:\-\']+\sFROM/Ui', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
424  $resql = $db->query($sqlforcount);
425  if ($resql) {
426  $objforcount = $db->fetch_object($resql);
427  $nbtotalofrecords = $objforcount->nbtotalofrecords;
428  } else {
429  dol_print_error($db);
430  }
431 
432  if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
433  $page = 0;
434  $offset = 0;
435  }
436  $db->free($resql);
437 }
438 
439 // Complete request and execute it with limit
440 $sql .= $db->order($sortfield, $sortorder);
441 if ($limit) {
442  $sql .= $db->plimit($limit + 1, $offset);
443 }
444 
445 $resql = $db->query($sql);
446 if (!$resql) {
447  dol_print_error($db);
448  exit;
449 }
450 
451 $num = $db->num_rows($resql);
452 
453 
454 // Direct jump if only one record found
455 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
456  $obj = $db->fetch_object($resql);
457  $id = $obj->rowid;
458  header("Location: ".dol_buildpath('/partnership/partnership_card.php', 1).'?id='.$id);
459  exit;
460 }
461 
462 
463 // Output page
464 // --------------------------------------------------------------------
465 
466 llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', '');
467 
468 if ($managedfor == "member") {
469  if ($memberid > 0 && $user->hasRight('adherent', 'lire')) {
470  $langs->load("members");
471 
472  $adhstat = new Adherent($db);
473  $adht = new AdherentType($db);
474  $result = $adhstat->fetch($memberid);
475 
476  if (isModEnabled('notification')) {
477  $langs->load("mails");
478  }
479 
480  $adht->fetch($adhstat->typeid);
481 
482  $head = member_prepare_head($adhstat);
483 
484  print dol_get_fiche_head($head, 'partnerships', $langs->trans("ThirdParty"), -1, 'user');
485 
486  $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
487 
488  dol_banner_tab($object, 'rowid', $linkback);
489 
490  print '<div class="fichecenter">';
491 
492  print '<div class="underbanner clearboth"></div>';
493  print '<table class="border centpercent tableforfield">';
494 
495  // Login
496  if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
497  print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
498  }
499 
500  // Type
501  print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
502 
503  // Morphy
504  print '<tr><td>'.$langs->trans("MemberNature").'</td><td class="valeur" >'.$adhstat->getmorphylib().'</td>';
505  print '</tr>';
506 
507  // Company
508  print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$adhstat->company.'</td></tr>';
509 
510  // Civility
511  print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$adhstat->getCivilityLabel().'&nbsp;</td>';
512  print '</tr>';
513 
514  print '</table>';
515 
516  print '</div>';
517 
518  print dol_get_fiche_end();
519  }
520 } elseif ($managedfor == "thirdparty") {
521  if ($socid && $user->hasRight('societe', 'lire')) {
522  $socstat = new Societe($db);
523  $res = $socstat->fetch($socid);
524  if ($res > 0) {
525  $tmpobject = $object;
526  $object = $socstat; // $object must be of type Societe when calling societe_prepare_head
527  $head = societe_prepare_head($socstat);
528  $object = $tmpobject;
529 
530  print dol_get_fiche_head($head, 'partnerships', $langs->trans("ThirdParty"), -1, 'company');
531 
532  dol_banner_tab($socstat, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom');
533 
534  print '<div class="fichecenter">';
535 
536  print '<div class="underbanner clearboth"></div>';
537  print '<table class="border centpercent tableforfield">';
538 
539  // Type Prospect/Customer/Supplier
540  print '<tr><td class="titlefield">'.$langs->trans('NatureOfThirdParty').'</td><td>';
541  print $socstat->getTypeUrl(1);
542  print '</td></tr>';
543 
544  // Customer code
545  if ($socstat->client && !empty($socstat->code_client)) {
546  print '<tr><td class="titlefield">';
547  print $langs->trans('CustomerCode').'</td><td>';
548  print showValueWithClipboardCPButton(dol_escape_htmltag($socstat->code_client));
549  $tmpcheck = $socstat->check_codeclient();
550  if ($tmpcheck != 0 && $tmpcheck != -5) {
551  print ' <span class="error">('.$langs->trans("WrongCustomerCode").')</span>';
552  }
553  print '</td>';
554  print '</tr>';
555  }
556  // Supplier code
557  if ($socstat->fournisseur && !empty($socstat->code_fournisseur)) {
558  print '<tr><td class="titlefield">';
559  print $langs->trans('SupplierCode').'</td><td>';
560  print showValueWithClipboardCPButton(dol_escape_htmltag($socstat->code_fournisseur));
561  $tmpcheck = $socstat->check_codefournisseur();
562  if ($tmpcheck != 0 && $tmpcheck != -5) {
563  print ' <span class="error">('.$langs->trans("WrongSupplierCode").')</span>';
564  }
565  print '</td>';
566  print '</tr>';
567  }
568 
569  print '</table>';
570  print '</div>';
571  print dol_get_fiche_end();
572  }
573  }
574 }
575 
576 $arrayofselected = is_array($toselect) ? $toselect : array();
577 
578 $param = '';
579 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
580  $param .= '&contextpage='.urlencode($contextpage);
581 }
582 if ($limit > 0 && $limit != $conf->liste_limit) {
583  $param .= '&limit='.urlencode($limit);
584 }
585 if ($socid) {
586  $param .= '&socid='.urlencode($socid);
587 }
588 if ($memberid) {
589  $param .= '&rowid='.urlencode($memberid);
590 }
591 foreach ($search as $key => $val) {
592  if (is_array($search[$key]) && count($search[$key])) {
593  foreach ($search[$key] as $skey) {
594  if ($skey != '') {
595  $param .= '&search_'.$key.'[]='.urlencode($skey);
596  }
597  }
598  } elseif ($search[$key] != '') {
599  $param .= '&search_'.$key.'='.urlencode($search[$key]);
600  }
601 }
602 if ($optioncss != '') {
603  $param .= '&optioncss='.urlencode($optioncss);
604 }
605 if ($search_filter && $search_filter != '-1') {
606  $param .= "&search_filter=".urlencode($search_filter);
607 }
608 // Add $param from extra fields
609 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
610 // Add $param from hooks
611 $parameters = array();
612 $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
613 $param .= $hookmanager->resPrint;
614 
615 // List of mass actions available
616 $arrayofmassactions = array(
617  //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
618  'approve'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("ValidateAndApprove"),
619  'cancel'=>img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"),
620  //'generate_doc'=>img_picto('', 'pdf').$langs->trans("ReGeneratePDF"),
621  //'builddoc'=>img_picto('', 'pdf').$langs->trans("PDFMerge"),
622  'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendMail"),
623 );
624 if ($permissiontodelete) {
625  $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
626 }
627 if (GETPOST('nomassaction', 'int') || in_array($massaction, array('prevalidate', 'presend', 'predelete'))) {
628  $arrayofmassactions = array();
629 }
630 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
631 
632 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
633 if ($optioncss != '') {
634  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
635 }
636 print '<input type="hidden" name="token" value="'.newToken().'">';
637 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
638 print '<input type="hidden" name="action" value="list">';
639 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
640 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
641 print '<input type="hidden" name="page" value="'.$page.'">';
642 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
643 print '<input type="hidden" name="mode" value="'.$mode.'">';
644 if ($socid) {
645  print '<input type="hidden" name="socid" value="'.$socid.'" >';
646 } elseif ($memberid) {
647  print '<input type="hidden" name="rowid" value="'.$memberid.'" >';
648 }
649 $newcardbutton = '';
650 $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/partnership/partnership_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
651 
652 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
653 
654 // Add code for pre mass action (confirmation or email presend form)
655 $topicmail = "SendPartnershipRef";
656 $modelmail = "partnership_send";
657 $objecttmp = new Partnership($db);
658 $trackid = 'pship'.$object->id;
659 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
660 
661 if ($search_all) {
662  $setupstring = '';
663  foreach ($fieldstosearchall as $key => $val) {
664  $fieldstosearchall[$key] = $langs->trans($val);
665  $setupstring .= $key."=".$val.";";
666  }
667  print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
668  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
669 }
670 
671 $moreforfilter = '';
672 /*$moreforfilter.='<div class="divsearchfield">';
673 $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
674 $moreforfilter.= '</div>';*/
675 
676 $parameters = array();
677 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
678 if (empty($reshook)) {
679  $moreforfilter .= $hookmanager->resPrint;
680 } else {
681  $moreforfilter = $hookmanager->resPrint;
682 }
683 
684 if (!empty($moreforfilter)) {
685  print '<div class="liste_titre liste_titre_bydiv centpercent">';
686  print $moreforfilter;
687  print '</div>';
688 }
689 
690 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
691 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
692 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
693 
694 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
695 print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
696 
697 
698 if ($managedfor == 'member') {
699  $arrayfields['t.fk_member']['checked'] = 1;
700 } else {
701  $arrayfields['t.fk_soc']['checked'] = 1;
702 }
703 // Fields title search
704 // --------------------------------------------------------------------
705 print '<tr class="liste_titre">';
706 // Action column
707 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
708  print '<td class="liste_titre maxwidthsearch">';
709  $searchpicto = $form->showFilterButtons('left');
710  print $searchpicto;
711  print '</td>';
712 }
713 foreach ($object->fields as $key => $val) {
714  $searchkey = empty($search[$key]) ? '' : $search[$key];
715  $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
716  if ($key == 'status') {
717  $cssforfield .= ($cssforfield ? ' ' : '').'center';
718  } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
719  $cssforfield .= ($cssforfield ? ' ' : '').'center';
720  } elseif (in_array($val['type'], array('timestamp'))) {
721  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
722  } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
723  $cssforfield .= ($cssforfield ? ' ' : '').'right';
724  }
725  if (!empty($arrayfields['t.'.$key]['checked'])) {
726  print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
727  if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
728  print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
729  } elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
730  print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
731  } elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
732  print '<div class="nowrap">';
733  print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
734  print '</div>';
735  print '<div class="nowrap">';
736  print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
737  print '</div>';
738  } elseif ($key == 'lang') {
739  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
740  $formadmin = new FormAdmin($db);
741  print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
742  } else {
743  print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
744  }
745  print '</td>';
746  }
747 }
748 // End of subscription date
749 if ($managedfor == 'member') {
750  print '<td class="liste_titre center">';
751  $selectarray = array('-1'=>'', 'withoutsubscription'=>$langs->trans("WithoutSubscription"), 'uptodate'=>$langs->trans("UpToDate"), 'outofdate'=>$langs->trans("OutOfDate"));
752  print $form->selectarray('search_filter', $selectarray, $search_filter);
753  print '</td>';
754 }
755 // Extra fields
756 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
757 
758 // Fields from hook
759 $parameters = array('arrayfields'=>$arrayfields);
760 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
761 print $hookmanager->resPrint;
762 // Action column
763 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
764  print '<td class="liste_titre maxwidthsearch">';
765  $searchpicto = $form->showFilterButtons();
766  print $searchpicto;
767  print '</td>';
768 }
769 print '</tr>'."\n";
770 
771 $totalarray = array();
772 $totalarray['nbfield'] = 0;
773 
774 // Fields title label
775 // --------------------------------------------------------------------
776 print '<tr class="liste_titre">';
777 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
778  print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
779 }
780 foreach ($object->fields as $key => $val) {
781  $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
782  if ($key == 'status') {
783  $cssforfield .= ($cssforfield ? ' ' : '').'center';
784  } elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
785  $cssforfield .= ($cssforfield ? ' ' : '').'center';
786  } elseif (in_array($val['type'], array('timestamp'))) {
787  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
788  } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
789  $cssforfield .= ($cssforfield ? ' ' : '').'right';
790  }
791  $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label
792  if (!empty($arrayfields['t.'.$key]['checked'])) {
793  print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
794  $totalarray['nbfield']++;
795  }
796 }
797 // End of subscription date
798 if ($managedfor == 'member') {
799  $key = 'datefin';
800  $cssforfield = 'center';
801  print getTitleFieldOfList('SubscriptionEndDate', 0, $_SERVER['PHP_SELF'], 'd.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
802 }
803 // Extra fields
804 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
805 // Hook fields
806 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
807 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
808 print $hookmanager->resPrint;
809 // Action column
810 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
811  print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
812 }
813 $totalarray['nbfield']++;
814 print '</tr>'."\n";
815 
816 
817 // Detect if we need a fetch on each output line
818 $needToFetchEachLine = 0;
819 if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
820  foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
821  if ($val && preg_match('/\$object/', $val)) {
822  $needToFetchEachLine++; // There is at least one compute field that use $object
823  }
824  }
825 }
826 
827 
828 // Loop on record
829 // --------------------------------------------------------------------
830 $i = 0;
831 $savnbfield = $totalarray['nbfield'];
832 $totalarray = array();
833 $totalarray['nbfield'] = 0;
834 $imaxinloop = ($limit ? min($num, $limit) : $num);
835 while ($i < $imaxinloop) {
836  $obj = $db->fetch_object($resql);
837  if (empty($obj)) {
838  break; // Should not happen
839  }
840 
841  // Store properties in $object
842  $object->setVarsFromFetchObj($obj);
843 
844  if ($mode == 'kanban') {
845  if ($i == 0) {
846  print '<tr><td colspan="'.$savnbfield.'">';
847  print '<div class="box-flex-container">';
848  }
849  // Output Kanban
850  print $object->getKanbanView('');
851  if ($i == ($imaxinloop - 1)) {
852  print '</div>';
853  print '</td></tr>';
854  }
855  } else {
856  // Show here line of result
857  $j = 0;
858  print '<tr data-rowid="'.$object->id.'" class="oddeven">';
859  // Action column
860  if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
861  print '<td class="nowrap center">';
862  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
863  $selected = 0;
864  if (in_array($object->id, $arrayofselected)) {
865  $selected = 1;
866  }
867  print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
868  }
869  print '</td>';
870  }
871  foreach ($object->fields as $key => $val) {
872  $cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
873  if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
874  $cssforfield .= ($cssforfield ? ' ' : '').'center';
875  } elseif ($key == 'status') {
876  $cssforfield .= ($cssforfield ? ' ' : '').'center';
877  }
878 
879  if (in_array($val['type'], array('timestamp'))) {
880  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
881  } elseif ($key == 'ref') {
882  $cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
883  }
884 
885  if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
886  $cssforfield .= ($cssforfield ? ' ' : '').'right';
887  }
888  //if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
889 
890  if (!empty($arrayfields['t.'.$key]['checked'])) {
891  print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '');
892  if (preg_match('/tdoverflow/', $cssforfield)) {
893  print ' title="'.dol_escape_htmltag($object->$key).'"';
894  }
895  print '>';
896  if ($key == 'status') {
897  print $object->getLibStatut(5);
898  } elseif ($key == 'rowid') {
899  print $object->showOutputField($val, $key, $object->id, '');
900  } else {
901  print $object->showOutputField($val, $key, $object->$key, '');
902  }
903  print '</td>';
904  if (!$i) {
905  $totalarray['nbfield']++;
906  }
907  if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
908  if (!$i) {
909  $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
910  }
911  if (!isset($totalarray['val'])) {
912  $totalarray['val'] = array();
913  }
914  if (!isset($totalarray['val']['t.'.$key])) {
915  $totalarray['val']['t.'.$key] = 0;
916  }
917  $totalarray['val']['t.'.$key] += $object->$key;
918  }
919  }
920  }
921  // End of subscription date
922  if ($managedfor == 'member') {
923  print '<td class="nowrap center endofsubscriptiondate">';
924  $result = $adherent->fetch($object->fk_member);
925  if ($result) {
926  $datefin = $adherent->datefin;
927  if ($datefin) {
928  print dol_print_date($datefin, 'day');
929  if ($adherent->hasDelay()) {
930  $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").')';
931  print " ".img_warning($langs->trans("SubscriptionLate").$textlate);
932  }
933  } else {
934  if ($adherent->subscription == 'yes') {
935  print $langs->trans("SubscriptionNotReceived");
936  if ($adherent->statut > 0) {
937  print " ".img_warning();
938  }
939  } else {
940  print '&nbsp;';
941  }
942  }
943  }
944  print '</td>';
945  }
946  // Extra fields
947  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
948  // Fields from hook
949  $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
950  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
951  print $hookmanager->resPrint;
952  // Action column
953  if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
954  print '<td class="nowrap center">';
955  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
956  $selected = 0;
957  if (in_array($object->id, $arrayofselected)) {
958  $selected = 1;
959  }
960  print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
961  }
962  print '</td>';
963  }
964  if (!$i) {
965  $totalarray['nbfield']++;
966  }
967 
968  print '</tr>'."\n";
969  }
970 
971  $i++;
972 }
973 if ($managedfor != 'member') $totalarray['nbfield']++; // End of subscription date
974 
975 // Show total line
976 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
977 
978 // If no record found
979 if ($num == 0) {
980  $colspan = 1;
981  foreach ($arrayfields as $key => $val) {
982  if (!empty($val['checked'])) {
983  $colspan++;
984  }
985  }
986  if ($managedfor != 'member') $colspan++; // End of subscription date
987  print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
988 }
989 
990 
991 $db->free($resql);
992 
993 $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
994 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
995 print $hookmanager->resPrint;
996 
997 print '</table>'."\n";
998 print '</div>'."\n";
999 
1000 print '</form>'."\n";
1001 
1002 if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
1003  $hidegeneratedfilelistifempty = 1;
1004  if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1005  $hidegeneratedfilelistifempty = 0;
1006  }
1007 
1008  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
1009  $formfile = new FormFile($db);
1010 
1011  // Show list of available documents
1012  $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1013  $urlsource .= str_replace('&amp;', '&', $param);
1014 
1015  $filedir = $diroutputmassaction;
1016  $genallowed = $permissiontoread;
1017  $delallowed = $permissiontoadd;
1018 
1019  print $formfile->showdocuments('massfilesarea_partnership', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1020 }
1021 
1022 // End of page
1023 llxFooter();
1024 $db->close();
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:118
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class to manage members of a foundation.
Class to manage members type.
Class to manage standard extra fields.
Class to generate html code for admin pages.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class for Partnership.
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.
Definition: company.lib.php:42
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_eval($s, $returnvalue=0, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print_barre_liste($titre, $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.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
member_prepare_head(Adherent $object)
Return array head with list of tabs to view object informations.
Definition: member.lib.php:33
$nbtotalofrecords
Count total nb of records.
Definition: list.php:329
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.