dolibarr  13.0.2
website.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2005 Brice Davoleau <brice.davoleau@gmail.com>
4  * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5  * Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
6  * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
7  * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
8  * Copyright (C) 2015 Marcos GarcĂ­a <marcosgdf@gmail.com>
9  * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program. If not, see <https://www.gnu.org/licenses/>.
23  */
24 
31 require '../main.inc.php';
32 require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
34 require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php';
35 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
36 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
37 
38 $langs->loadLangs(array("companies", "website"));
39 
40 $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
41 $show_files = GETPOST('show_files', 'int');
42 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'websitelist'; // To manage different context of search
43 $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
44 $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
45 
46 $search_status = GETPOST('search_status');
47 
48 // Security check
49 $id = GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('socid', 'int');
50 if ($user->socid) $socid = $user->socid;
51 $result = restrictedArea($user, 'societe', $socid, '&societe');
52 
53 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
54 $sortfield = GETPOST("sortfield", 'alpha');
55 $sortorder = GETPOST("sortorder", 'alpha');
56 $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
57 if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
58 $offset = $limit * $page;
59 $pageprev = $page - 1;
60 $pagenext = $page + 1;
61 if (!$sortfield) $sortfield = 't.login';
62 if (!$sortorder) $sortorder = 'ASC';
63 
64 // Initialize technical objects
65 $object = new Societe($db);
66 $objectwebsiteaccount = new SocieteAccount($db);
67 $extrafields = new ExtraFields($db);
68 $diroutputmassaction = $conf->website->dir_output.'/temp/massgeneration/'.$user->id;
69 $hookmanager->initHooks(array('websitethirdpartylist')); // Note that conf->hooks_modules contains array
70 
71 // Fetch optionals attributes and labels
72 $extrafields->fetch_name_optionals_label($objectwebsiteaccount->table_element);
73 
74 $search_array_options = $extrafields->getOptionalsFromPost($objectwebsiteaccount->table_element, '', 'search_');
75 
76 unset($objectwebsiteaccount->fields['fk_soc']); // Remove this field, we are already on the thirdparty
77 
78 // Initialize array of search criterias
79 $search_all = GETPOST("search_all", 'alpha');
80 $search = array();
81 foreach ($objectwebsiteaccount->fields as $key => $val)
82 {
83  if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha');
84 }
85 
86 // List of fields to search into when doing a "search in all"
87 $fieldstosearchall = array();
88 foreach ($objectwebsiteaccount->fields as $key => $val)
89 {
90  if ($val['searchall']) $fieldstosearchall['t.'.$key] = $val['label'];
91 }
92 
93 // Definition of fields for list
94 $arrayfields = array();
95 foreach ($objectwebsiteaccount->fields as $key => $val)
96 {
97  // If $val['visible']==0, then we never show the field
98  if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>$val['enabled']);
99 }
100 
101 // Extra fields
102 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
103 
104 $object->fields = dol_sort_array($object->fields, 'position');
105 $arrayfields = dol_sort_array($arrayfields, 'position');
106 
107 
108 if ($id > 0)
109 {
110  $result = $object->fetch($id);
111 }
112 
113 
114 /*
115  * Actions
116  */
117 
118 $parameters = array('id'=>$socid);
119 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
120 if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
121 
122 if (empty($reshook))
123 {
124  // Cancel
125  if (GETPOST('cancel', 'alpha') && !empty($backtopage))
126  {
127  header("Location: ".$backtopage);
128  exit;
129  }
130 
131  // Selection of new fields
132  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
133 
134  // Purge search criteria
135  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
136  {
137  foreach ($objectwebsiteaccount->fields as $key => $val)
138  {
139  $search[$key] = '';
140  }
141  $toselect = '';
142  $search_array_options = array();
143  }
144  if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
145  || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha'))
146  {
147  $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
148  }
149 
150  // Mass actions
151  $objectclass = 'WebsiteAccount';
152  $objectlabel = 'WebsiteAccount';
153  $permissiontoread = $user->rights->societe->lire;
154  $permissiontodelete = $user->rights->societe->supprimer;
155  $uploaddir = $conf->societe->dir_output;
156  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
157 }
158 
159 
160 
161 /*
162  * View
163  */
164 
165 $contactstatic = new Contact($db);
166 
167 $form = new Form($db);
168 
169 $langs->load("companies");
170 
171 $title = $langs->trans("WebsiteAccounts");
172 llxHeader('', $title);
173 
174 $param = '';
175 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
176 if ($id > 0) $param .= '&id='.urlencode($id);
177 if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
178 foreach ($search as $key => $val)
179 {
180  $param .= '&search_'.$key.'='.urlencode($search[$key]);
181 }
182 if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
183 // Add $param from extra fields
184 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
185 
186 $head = societe_prepare_head($object);
187 
188 print dol_get_fiche_head($head, 'website', $langs->trans("ThirdParty"), - 1, 'company');
189 
190 $linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
191 
192 dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
193 
194 print '<div class="fichecenter">';
195 
196 print '<div class="underbanner clearboth"></div>';
197 
198 print '<table class="border centpercent">';
199 
200 // Prefix
201 if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
202 {
203  print '<tr><td class="titlefield">'.$langs->trans('Prefix').'</td><td colspan="3">'.$object->prefix_comm.'</td></tr>';
204 }
205 
206 if ($object->client) {
207  print '<tr><td class="titlefield">';
208  print $langs->trans('CustomerCode').'</td><td colspan="3">';
209  print $object->code_client;
210  $tmpcheck = $object->check_codeclient();
211  if ($tmpcheck != 0 && $tmpcheck != -5) {
212  print ' <font class="error">('.$langs->trans("WrongCustomerCode").')</font>';
213  }
214  print '</td></tr>';
215 }
216 
217 if ($object->fournisseur) {
218  print '<tr><td class="titlefield">';
219  print $langs->trans('SupplierCode').'</td><td colspan="3">';
220  print $object->code_fournisseur;
221  $tmpcheck = $object->check_codefournisseur();
222  if ($tmpcheck != 0 && $tmpcheck != -5) {
223  print ' <font class="error">('.$langs->trans("WrongSupplierCode").')</font>';
224  }
225  print '</td></tr>';
226 }
227 
228 print '</table>';
229 
230 print '</div>';
231 
233 
234 $newcardbutton = '';
235 if (!empty($conf->website->enabled)) {
236  if (!empty($user->rights->societe->lire)) {
237  $newcardbutton .= dolGetButtonTitle($langs->trans("AddWebsiteAccount"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id));
238  } else {
239  $newcardbutton .= dolGetButtonTitle($langs->trans("AddAction"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/website/websiteaccount_card.php?action=create&fk_soc='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', 0);
240  }
241 }
242 
243 print '<br>';
244 
245 
246 
247 // Build and execute select
248 // --------------------------------------------------------------------
249 $sql = 'SELECT ';
250 foreach ($objectwebsiteaccount->fields as $key => $val)
251 {
252  $sql .= 't.'.$key.', ';
253 }
254 // Add fields from extrafields
255 if (!empty($extrafields->attributes[$object->table_element]['label']))
256  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
257 // Add fields from hooks
258 $parameters = array();
259 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook
260 $sql .= $hookmanager->resPrint;
261 $sql = preg_replace('/, $/', '', $sql);
262 $sql .= " FROM ".MAIN_DB_PREFIX."societe_account as t";
263 if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
264 if ($objectwebsiteaccount->ismultientitymanaged == 1) $sql .= " WHERE t.entity IN (".getEntity('societeaccount').")";
265 else $sql .= " WHERE 1 = 1";
266 $sql .= " AND fk_soc = ".$object->id;
267 foreach ($search as $key => $val)
268 {
269  $mode_search = (($objectwebsiteaccount->isInt($objectwebsiteaccount->fields[$key]) || $objectwebsiteaccount->isFloat($objectwebsiteaccount->fields[$key])) ? 1 : 0);
270  if ($search[$key] != '') $sql .= natural_search($key, $search[$key], (($key == 'status') ? 2 : $mode_search));
271 }
272 if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
273 // Add where from extra fields
274 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
275 // Add where from hooks
276 $parameters = array();
277 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $objectwebsiteaccount); // Note that $action and $objectwebsiteaccount may have been modified by hook
278 $sql .= $hookmanager->resPrint;
279 
280 /* If a group by is required
281 $sql.= " GROUP BY "
282 foreach($objectwebsiteaccount->fields as $key => $val)
283 {
284  $sql.='t.'.$key.', ';
285 }
286 // Add fields from extrafields
287 if (! empty($extrafields->attributes[$object->table_element]['label'])) {
288  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
289 // Add where from hooks
290 $parameters=array();
291 $reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $objectwebsiteaccount may have been modified by hook
292 $sql.=$hookmanager->resPrint;
293 */
294 
295 $sql .= $db->order($sortfield, $sortorder);
296 
297 // Count total nb of records
298 $nbtotalofrecords = '';
299 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
300 {
301  $result = $db->query($sql);
302  $nbtotalofrecords = $db->num_rows($result);
303  if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0
304  {
305  $page = 0;
306  $offset = 0;
307  }
308 }
309 
310 $sql .= $db->plimit($limit + 1, $offset);
311 
312 $resql = $db->query($sql);
313 if (!$resql)
314 {
315  dol_print_error($db);
316  exit;
317 }
318 
319 $num = $db->num_rows($resql);
320 
321 $arrayofselected = is_array($toselect) ? $toselect : array();
322 
323 // List of mass actions available
324 $arrayofmassactions = array(
325 //'presend'=>$langs->trans("SendByMail"),
326 //'builddoc'=>$langs->trans("PDFMerge"),
327 );
328 if ($user->rights->mymodule->delete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
329 if (in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
330 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
331 
332 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
333 if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
334 print '<input type="hidden" name="token" value="'.newToken().'">';
335 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
336 print '<input type="hidden" name="action" value="list">';
337 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
338 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
339 print '<input type="hidden" name="page" value="'.$page.'">';
340 print '<input type="hidden" name="id" value="'.$id.'">';
341 print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
342 
343 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, $newcardbutton, '', $limit);
344 
345 $topicmail = "Information";
346 $modelmail = "societeaccount";
347 $objecttmp = new SocieteAccount($db);
348 $trackid = 'thi'.$object->id;
349 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
350 
351 /*if ($sall)
352 {
353  foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
354  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'</div>';
355 }*/
356 
357 $moreforfilter = '';
358 /*$moreforfilter.='<div class="divsearchfield">';
359 $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
360 $moreforfilter.= '</div>';*/
361 
362 $parameters = array();
363 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $objectwebsiteaccount); // Note that $action and $objectwebsiteaccount may have been modified by hook
364 if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
365 else $moreforfilter = $hookmanager->resPrint;
366 
367 if (!empty($moreforfilter))
368 {
369  print '<div class="liste_titre liste_titre_bydiv centpercent">';
370  print $moreforfilter;
371  print '</div>';
372 }
373 
374 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
375 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
376 $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
377 
378 print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
379 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
380 
381 
382 // Fields title search
383 // --------------------------------------------------------------------
384 print '<tr class="liste_titre">';
385 foreach ($objectwebsiteaccount->fields as $key => $val)
386 {
387  $align = '';
388  if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align = 'center';
389  if (in_array($val['type'], array('timestamp'))) $align .= ' nowrap';
390  if ($key == 'status') $align .= ($align ? ' ' : '').'center';
391  if (!empty($arrayfields['t.'.$key]['checked'])) print '<td class="liste_titre'.($align ? ' '.$align : '').'"><input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag($search[$key]).'"></td>';
392 }
393 // Extra fields
394 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
395 // Fields from hook
396 $parameters = array('arrayfields'=>$arrayfields);
397 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook
398 print $hookmanager->resPrint;
399 // Action column
400 print '<td class="liste_titre maxwidthsearch">';
401 $searchpicto = $form->showFilterButtons();
402 print $searchpicto;
403 print '</td>';
404 print '</tr>'."\n";
405 
406 
407 // Fields title label
408 // --------------------------------------------------------------------
409 print '<tr class="liste_titre">';
410 foreach ($objectwebsiteaccount->fields as $key => $val)
411 {
412  $align = '';
413  if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align = 'center';
414  if (in_array($val['type'], array('timestamp'))) $align .= 'nowrap';
415  if ($key == 'status') $align .= ($align ? ' ' : '').'center';
416  if (!empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align ? 'class="'.$align.'"' : ''), $sortfield, $sortorder, $align.' ')."\n";
417 }
418 // Extra fields
419 // Extra fields
420 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
421 // Hook fields
422 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
423 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook
424 print $hookmanager->resPrint;
425 print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center ')."\n";
426 print '</tr>'."\n";
427 
428 
429 // Detect if we need a fetch on each output line
430 $needToFetchEachLine = 0;
431 if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0)
432 {
433  foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val)
434  {
435  if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object
436  }
437 }
438 
439 // Loop on record
440 // --------------------------------------------------------------------
441 $i = 0;
442 $totalarray = array();
443 while ($i < min($num, $limit))
444 {
445  $obj = $db->fetch_object($resql);
446  if (empty($obj)) break; // Should not happen
447 
448  // Store properties in $object
449  $objectwebsiteaccount->id = $obj->rowid;
450  $objectwebsiteaccount->login = $obj->login;
451  $objectwebsiteaccount->ref = $obj->login;
452  foreach ($objectwebsiteaccount->fields as $key => $val)
453  {
454  if (property_exists($obj, $key)) $object->$key = $obj->$key;
455  }
456 
457  // Show here line of result
458  print '<tr class="oddeven">';
459  foreach ($objectwebsiteaccount->fields as $key => $val)
460  {
461  $align = '';
462  if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $align = 'center';
463  if (in_array($val['type'], array('timestamp'))) $align .= 'nowrap';
464  if ($key == 'status') $align .= ($align ? ' ' : '').'center';
465  if (!empty($arrayfields['t.'.$key]['checked']))
466  {
467  print '<td';
468  if ($align) print ' class="'.$align.'"';
469  print '>';
470  if ($key == 'login') print $objectwebsiteaccount->getNomUrl(1, '', 0, '', 1);
471  else print $objectwebsiteaccount->showOutputField($val, $key, $obj->$key, '');
472  print '</td>';
473  if (!$i) $totalarray['nbfield']++;
474  if (!empty($val['isameasure']))
475  {
476  if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
477  $totalarray['val']['t.'.$key] += $obj->$key;
478  }
479  }
480  }
481  // Extra fields
482  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
483  // Fields from hook
484  $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
485  $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook
486  print $hookmanager->resPrint;
487  // Action column
488  print '<td class="nowrap center">';
489  if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
490  {
491  $selected = 0;
492  if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
493  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
494  }
495  print '</td>';
496  if (!$i) $totalarray['nbfield']++;
497 
498  print '</tr>';
499 
500  $i++;
501 }
502 
503 // Show total line
504 include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
505 
506 
507 // If no record found
508 if ($num == 0)
509 {
510  $colspan = 1;
511  foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; }
512  print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
513 }
514 
515 
516 $db->free($resql);
517 
518 $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
519 $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $objectwebsiteaccount); // Note that $action and $object may have been modified by hook
520 print $hookmanager->resPrint;
521 
522 print '</table>'."\n";
523 print '</div>'."\n";
524 
525 print '</form>'."\n";
526 
527 if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords))
528 {
529  $hidegeneratedfilelistifempty = 1;
530  if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
531 
532  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
533  $formfile = new FormFile($db);
534 
535  // Show list of available documents
536  $urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
537  $urlsource .= str_replace('&amp;', '&', $param);
538 
539  $filedir = $diroutputmassaction;
540  $genallowed = $user->rights->mymodule->read;
541  $delallowed = $user->rights->mymodule->create;
542 
543  print $formfile->showdocuments('massfilesarea_mymodule', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
544 }
545 
546 // End of page
547 llxFooter();
548 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage contact/addresses.
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.
Class for SocieteAccount.
llxHeader()
Empty header.
Definition: wrapper.php:45
Class to manage standard extra fields.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
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.
Class to manage generation of HTML components Only common components must be here.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
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...
societe_prepare_head(Societe $object)
Return array of tabs to used on pages for third parties cards.
Definition: company.lib.php:42
Class to offer components to list and upload files.
print $_SERVER["PHP_SELF"]
Edit parameters.
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_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
Definition: index.php:89
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1232
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip= '', $forcenowrapcolumntitle=0)
Get title line of an array.
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.
llxFooter()
Empty footer.
Definition: wrapper.php:59
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...