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