dolibarr  17.0.4
list.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2015 ATM Consulting <support@atm-consulting.fr>
3  * Copyright (C) 2019-2020 Open-DSI <support@open-dsi.fr>
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 require_once DOL_DOCUMENT_ROOT.'/intracommreport/class/intracommreport.class.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
30 
31 // Load translation files required by the page
32 $langs->loadLangs(array('intracommreport'));
33 
34 // Get Parameters
35 $action = GETPOST('action', 'alpha');
36 $massaction = GETPOST('massaction', 'alpha');
37 $show_files = GETPOST('show_files', 'int');
38 $confirm = GETPOST('confirm', 'alpha');
39 $toselect = GETPOST('toselect', 'array');
40 
41 $sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
42 $search_ref = GETPOST("search_ref", 'alpha');
43 $search_type = GETPOST("search_type", 'int');
44 $optioncss = GETPOST('optioncss', 'alpha');
45 $type = GETPOST("type", "int");
46 
47 $diroutputmassaction = $conf->product->dir_output.'/temp/massgeneration/'.$user->id;
48 
49 $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
50 $sortfield = GETPOST('sortfield', 'aZ09comma');
51 $sortorder = GETPOST('sortorder', 'aZ09comma');
52 $page = (GETPOST("page", 'int') ?GETPOST("page", 'int') : 0);
53 if (empty($page) || $page == -1) {
54  $page = 0;
55 } // If $page is not defined, or '' or -1
56 $offset = $limit * $page;
57 $pageprev = $page - 1;
58 $pagenext = $page + 1;
59 if (!$sortfield) {
60  $sortfield = "i.ref";
61 }
62 if (!$sortorder) {
63  $sortorder = "ASC";
64 }
65 
66 // Initialize context for list
67 $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'intracommreportlist';
68 if ((string) $type == '1') {
69  $contextpage = 'DESlist'; if ($search_type == '') {
70  $search_type = '1';
71  }
72 }
73 if ((string) $type == '0') {
74  $contextpage = 'DEBlist'; if ($search_type == '') {
75  $search_type = '0';
76  }
77 }
78 
79 // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
80 $object = new IntracommReport($db);
81 $hookmanager->initHooks(array('intracommreportlist'));
82 $extrafields = new ExtraFields($db);
83 $form = new Form($db);
84 
85 /*
86 // fetch optionals attributes and labels
87 $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
88 $search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
89 */
90 
91 if (empty($action)) {
92  $action = 'list';
93 }
94 
95 // Get object canvas (By default, this is not defined, so standard usage of dolibarr)
96 $canvas = GETPOST("canvas");
97 $objcanvas = null;
98 if (!empty($canvas)) {
99  require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php';
100  $objcanvas = new Canvas($db, $action);
101  $objcanvas->getCanvas('product', 'list', $canvas);
102 }
103 
104 // Security check
105 /*
106 if ($search_type=='0') $result=restrictedArea($user, 'produit', '', '', '', '', '', $objcanvas);
107 elseif ($search_type=='1') $result=restrictedArea($user, 'service', '', '', '', '', '', $objcanvas);
108 else $result=restrictedArea($user, 'produit|service', '', '', '', '', '', $objcanvas);
109 */
110 
111 // List of fields to search into when doing a "search in all"
112 $fieldstosearchall = array(
113  'i.ref'=>"Ref",
114  'pfi.ref_fourn'=>"RefSupplier",
115  'i.label'=>"ProductLabel",
116  'i.description'=>"Description",
117  "i.note"=>"Note",
118 );
119 
120 $isInEEC = isInEEC($mysoc);
121 
122 // Definition of fields for lists
123 $arrayfields = array(
124  'i.ref' => array('label'=>$langs->trans("Ref"), 'checked'=>1),
125  'i.label' => array('label'=>$langs->trans("Label"), 'checked'=>1),
126  'i.fk_product_type'=>array('label'=>$langs->trans("Type"), 'checked'=>0, 'enabled'=>(isModEnabled("product") && isModEnabled("service"))),
127 );
128 
129 /*
130 // Extra fields
131 if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']))
132 {
133  foreach($extrafields->attributes[$object->table_element]['label'] as $key => $val)
134  {
135  if (!empty($extrafields->attributes[$object->table_element]['list'][$key]))
136  $arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs((int) $extrafields->attributes[$object->table_element]['list'][$key])!=3 && $extrafields->attributes[$object->table_element]['perms'][$key]));
137  }
138 }
139 */
140 
141 $object->fields = dol_sort_array($object->fields, 'position');
142 $arrayfields = dol_sort_array($arrayfields, 'position');
143 
144 // Security check
145 if ($search_type == '0') {
146  $result = restrictedArea($user, 'produit', '', '', '', '', '', 0);
147 } elseif ($search_type == '1') {
148  $result = restrictedArea($user, 'service', '', '', '', '', '', 0);
149 } else {
150  $result = restrictedArea($user, 'produit|service', '', '', '', '', '', 0);
151 }
152 
153 $permissiontoread = $user->rights->intracommreport->read;
154 $permissiontodelete = $user->rights->intracommreport->delete;
155 
156 
157 /*
158  * Actions
159  */
160 
161 if (GETPOST('cancel', 'alpha')) {
162  $action = 'list';
163  $massaction = '';
164 }
165 if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
166  $massaction = '';
167 }
168 
169 $parameters = array();
170 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
171 if ($reshook < 0) {
172  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
173 }
174 
175 if (empty($reshook)) {
176  // Selection of new fields
177  include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
178 
179  // Purge search criteria
180  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
181  $sall = "";
182  $search_ref = "";
183  $search_label = "";
184  //$search_type=''; // There is 2 types of list: a list of product and a list of services. No list with both. So when we clear search criteria, we must keep the filter on type.
185 
186  $show_childproducts = '';
187  $search_array_options = array();
188  }
189 
190  // Mass actions
191  $objectclass = 'Product';
192  if ((string) $search_type == '1') {
193  $objectlabel = 'Services';
194  }
195  if ((string) $search_type == '0') {
196  $objectlabel = 'Products';
197  }
198 
199  $uploaddir = $conf->product->dir_output;
200  include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
201 }
202 
203 
204 /*
205  * View
206  */
207 
208 $formother = new FormOther($db);
209 
210 $title = $langs->trans('IntracommReportList'.$type);
211 
212 $sql = 'SELECT i.rowid, i.type_declaration, i.type_export, i.periods, i.mode, i.entity';
213 
214 /*
215 // Add fields from extrafields
216 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
217  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
218 }
219 */
220 // Add fields from hooks
221 $parameters = array();
222 $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
223 $sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
224 $sql = preg_replace('/,\s*$/', '', $sql);
225 $sql .= $hookmanager->resPrint;
226 
227 $sqlfields = $sql;
228 
229 $sql .= ' FROM '.MAIN_DB_PREFIX.'intracommreport as i';
230 // if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."intracommreport_extrafields as ef on (i.rowid = ef.fk_object)";
231 $sql .= ' WHERE i.entity IN ('.getEntity('intracommreport').')';
232 if ($sall) {
233  $sql .= natural_search(array_keys($fieldstosearchall), $sall);
234 }
235 // if the type is not 1, we show all products (type = 0,2,3)
236 if (dol_strlen($search_type) && $search_type != '-1') {
237  if ($search_type == 1) {
238  $sql .= " AND i.type = 1";
239  } else {
240  $sql .= " AND i.type = 0";
241  }
242 }
243 
244 /*
245 if ($search_ref) $sql .= natural_search('i.ref', $search_ref);
246 if ($search_label) $sql .= natural_search('i.label', $search_label);
247 if ($search_barcode) $sql .= natural_search('i.barcode', $search_barcode);
248 if (isset($search_tosell) && dol_strlen($search_tosell) > 0 && $search_tosell!=-1) $sql.= " AND i.tosell = ".((int) $search_tosell);
249 if (isset($search_tobuy) && dol_strlen($search_tobuy) > 0 && $search_tobuy!=-1) $sql.= " AND i.tobuy = ".((int) $search_tobuy);
250 if (dol_strlen($canvas) > 0) $sql.= " AND i.canvas = '".$db->escape($canvas)."'";
251 */
252 
253 /*
254 // Add where from extra fields
255 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
256 */
257 // Add where from hooks
258 $parameters = array();
259 $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
260 $sql .= $hookmanager->resPrint;
261 
262 $sql .= " GROUP BY i.rowid, i.type_declaration, i.type_export, i.periods, i.mode, i.entity";
263 
264 /*
265 // Add fields from extrafields
266 if (!empty($extrafields->attributes[$object->table_element]['label'])) {
267  foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : '');
268 }
269 */
270 
271 // Add fields from hooks
272 $parameters = array();
273 $reshook = $hookmanager->executeHooks('printFieldSelect', $parameters); // Note that $action and $object may have been modified by hook
274 $sql .= $hookmanager->resPrint;
275 
276 
277 // Count total nb of records
278 $nbtotalofrecords = '';
279 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
280  /* The fast and low memory method to get and count full list converts the sql into a sql count */
281  $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
282  $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
283  $resql = $db->query($sqlforcount);
284  if ($resql) {
285  $objforcount = $db->fetch_object($resql);
286  $nbtotalofrecords = $objforcount->nbtotalofrecords;
287  } else {
288  dol_print_error($db);
289  }
290 
291  if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
292  $page = 0;
293  $offset = 0;
294  }
295  $db->free($resql);
296 }
297 
298 // Complete request and execute it with limit
299 $sql .= $db->order($sortfield, $sortorder);
300 if ($limit) {
301  $sql .= $db->plimit($limit + 1, $offset);
302 }
303 
304 $resql = $db->query($sql);
305 if (!$resql) {
306  dol_print_error($db);
307  exit;
308 }
309 
310 $num = $db->num_rows($resql);
311 
312 $helpurl = 'EN:Module_IntracommReport|FR:Module_ProDouane';
313 llxHeader('', $title, $helpurl, '');
314 
315 // Displays product removal confirmation
316 if (GETPOST('delreport')) {
317  setEventMessages($langs->trans("IntracommReportDeleted", GETPOST('delreport')), null, 'mesgs');
318 }
319 
320 $arrayofselected = is_array($toselect) ? $toselect : array();
321 
322 $param = '';
323 if (!empty($mode)) {
324  $param .= '&mode='.urlencode($mode);
325 }
326 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
327  $param .= '&contextpage='.urlencode($contextpage);
328 }
329 if ($limit > 0 && $limit != $conf->liste_limit) {
330  $param .= '&limit='.urlencode($limit);
331 }
332 if ($sall) {
333  $param .= "&sall=".urlencode($sall);
334 }
335 if ($search_ref) {
336  $param = "&search_ref=".urlencode($search_ref);
337 }
338 if ($search_label) {
339  $param .= "&search_label=".urlencode($search_label);
340 }
341 if ($optioncss != '') {
342  $param .= '&optioncss='.urlencode($optioncss);
343 }
344 // Add $param from extra fields
345 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
346 // Add $param from hooks
347 $parameters = array();
348 $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
349 $param .= $hookmanager->resPrint;
350 
351 // List of mass actions available
352 $arrayofmassactions = array(
353  'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
354  //'builddoc'=>$langs->trans("PDFMerge"),
355  //'presend'=>$langs->trans("SendByMail"),
356 );
357 if (!empty($permissiontodelete)) {
358  $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
359 }
360 if (in_array($massaction, array('presend', 'predelete'))) {
361  $arrayofmassactions = array();
362 }
363 $massactionbutton = $form->selectMassAction('', $arrayofmassactions);
364 
365 $newcardbutton = '';
366 if ($user->rights->intracommreport->write) {
367  $newcardbutton .= dolGetButtonTitle($langs->trans("NewDeclaration"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/intracommreport/card.php?action=create&amp;type='.$type);
368 }
369 
370 print '<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formulaire">';
371 if ($optioncss != '') {
372  print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
373 }
374 print '<input type="hidden" name="token" value="'.newToken().'">';
375 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
376 print '<input type="hidden" name="action" value="list">';
377 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
378 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
379 print '<input type="hidden" name="page" value="'.$page.'">';
380 print '<input type="hidden" name="type" value="'.$type.'">';
381 if (empty($arrayfields['i.fk_product_type']['checked'])) {
382  print '<input type="hidden" name="search_type" value="'.dol_escape_htmltag($search_type).'">';
383 }
384 
385 print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'intracommreport', 0, $newcardbutton, '', $limit);
386 
387 $topicmail = "Information";
388 $modelmail = "product";
389 $objecttmp = new IntracommReport($db);
390 $trackid = 'prod'.$object->id;
391 include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
392 
393 if ($sall) {
394  foreach ($fieldstosearchall as $key => $val) {
395  $fieldstosearchall[$key] = $langs->trans($val);
396  }
397  print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'</div>';
398 }
399 
400 $parameters = array();
401 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
402 if (empty($reshook)) {
403  $moreforfilter .= $hookmanager->resPrint;
404 } else {
405  $moreforfilter = $hookmanager->resPrint;
406 }
407 
408 if ($moreforfilter) {
409  print '<div class="liste_titre liste_titre_bydiv centpercent">';
410  print $moreforfilter;
411  print '</div>';
412 }
413 
414 $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
415 $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
416 if ($massactionbutton) {
417  $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
418 }
419 
420 print '<div class="div-table-responsive">';
421 print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
422 
423 // Lines with input filters
424 print '<tr class="liste_titre_filter">';
425 if (!empty($arrayfields['i.ref']['checked'])) {
426  print '<td class="liste_titre left">';
427  print '<input class="flat" type="text" name="search_ref" size="8" value="'.dol_escape_htmltag($search_ref).'">';
428  print '</td>';
429 }
430 if (!empty($arrayfields['i.label']['checked'])) {
431  print '<td class="liste_titre left">';
432  print '<input class="flat" type="text" name="search_label" size="12" value="'.dol_escape_htmltag($search_label).'">';
433  print '</td>';
434 }
435 // Type
436 // Type (customer/prospect/supplier)
437 if (!empty($arrayfields['customerorsupplier']['checked'])) {
438  print '<td class="liste_titre maxwidthonsmartphone center">';
439  if ($type != '') {
440  print '<input type="hidden" name="type" value="'.$type.'">';
441  }
442  print $formcompany->selectProspectCustomerType($search_type, 'search_type', 'search_type', 'list');
443  print '</select></td>';
444 }
445 
446 if (!empty($arrayfields['i.fk_product_type']['checked'])) {
447  print '<td class="liste_titre left">';
448  $array = array('-1'=>'&nbsp;', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service'));
449  print $form->selectarray('search_type', $array, $search_type);
450  print '</td>';
451 }
452 
453 /*
454 // Extra fields
455 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
456 */
457 // Fields from hook
458 $parameters = array('arrayfields'=>$arrayfields);
459 $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
460 print $hookmanager->resPrint;
461 // Date creation
462 if (!empty($arrayfields['i.datec']['checked'])) {
463  print '<td class="liste_titre">';
464  print '</td>';
465 }
466 // Date modification
467 if (!empty($arrayfields['i.tms']['checked'])) {
468  print '<td class="liste_titre">';
469  print '</td>';
470 }
471 print '<td class="liste_titre center maxwidthsearch">';
472 $searchpicto = $form->showFilterButtons();
473 print $searchpicto;
474 print '</td>';
475 
476 print '</tr>';
477 
478 print '<tr class="liste_titre">';
479 if (!empty($arrayfields['i.ref']['checked'])) {
480  print_liste_field_titre($arrayfields['i.ref']['label'], $_SERVER["PHP_SELF"], "i.ref", "", $param, "", $sortfield, $sortorder);
481 }
482 if (!empty($arrayfields['i.label']['checked'])) {
483  print_liste_field_titre($arrayfields['i.label']['label'], $_SERVER["PHP_SELF"], "i.label", "", $param, "", $sortfield, $sortorder);
484 }
485 if (!empty($arrayfields['i.fk_product_type']['checked'])) {
486  print_liste_field_titre($arrayfields['i.fk_product_type']['label'], $_SERVER["PHP_SELF"], "i.fk_product_type", "", $param, "", $sortfield, $sortorder);
487 }
488 
489 /*
490 // Extra fields
491 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
492 */
493 // Hook fields
494 $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
495 $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
496 print $hookmanager->resPrint;
497 if (!empty($arrayfields['i.datec']['checked'])) {
498  print_liste_field_titre($arrayfields['i.datec']['label'], $_SERVER["PHP_SELF"], "i.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
499 }
500 if (!empty($arrayfields['i.tms']['checked'])) {
501  print_liste_field_titre($arrayfields['i.tms']['label'], $_SERVER["PHP_SELF"], "i.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
502 }
503 
504 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
505 print "</tr>\n";
506 
507 
508 $intracommreport_static = new IntracommReport($db);
509 
510 $i = 0;
511 $totalarray = array();
512 while ($i < min($num, $limit)) {
513  $obj = $db->fetch_object($resql);
514 
515  $intracommreport_static->id = $obj->rowid;
516  $intracommreport_static->ref = $obj->ref;
517  $intracommreport_static->ref_fourn = $obj->ref_supplier;
518  $intracommreport_static->label = $obj->label;
519  $intracommreport_static->type = $obj->fk_product_type;
520  $intracommreport_static->status_buy = $obj->tobuy;
521  $intracommreport_static->status = $obj->tosell;
522  $intracommreport_static->status_batch = $obj->tobatch;
523  $intracommreport_static->entity = $obj->entity;
524 
525  print '<tr class="oddeven">';
526 
527  // Ref
528  if (!empty($arrayfields['i.ref']['checked'])) {
529  print '<td class="tdoverflowmax200">';
530  print $intracommreport_static->getNomUrl(1);
531  print "</td>\n";
532  if (!$i) {
533  $totalarray['nbfield']++;
534  }
535  }
536  // Label
537  if (!empty($arrayfields['i.label']['checked'])) {
538  print '<td class="tdoverflowmax200">'.dol_trunc($obj->label, 80).'</td>';
539  if (!$i) {
540  $totalarray['nbfield']++;
541  }
542  }
543  // Type
544  if (!empty($arrayfields['i.fk_product_type']['checked'])) {
545  print '<td>'.$obj->fk_product_type.'</td>';
546  if (!$i) {
547  $totalarray['nbfield']++;
548  }
549  }
550  // Action
551  print '<td class="nowrap center">';
552  if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
553  $selected = 0;
554  if (in_array($obj->rowid, $arrayofselected)) {
555  $selected = 1;
556  }
557  print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
558  }
559  print '</td>';
560  if (!$i) {
561  $totalarray['nbfield']++;
562  }
563 
564  print "</tr>\n";
565  $i++;
566 }
567 
568 // If no record found
569 if ($num == 0) {
570  $colspan = 1;
571  foreach ($arrayfields as $key => $val) {
572  if (!empty($val['checked'])) {
573  $colspan++;
574  }
575  }
576  print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
577 }
578 
579 $db->free($resql);
580 
581 print "</table>";
582 print "</div>";
583 print '</form>';
584 
585 // End of page
586 llxFooter();
587 $db->close();
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 canvas.
Class to manage standard extra fields.
Class to manage generation of HTML components Only common components must be here.
Classe permettant la generation de composants html autre Only common components are here.
Class to manage intracomm report.
isInEEC($object)
Return if a country of an object is inside the EEC (European Economic Community)
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_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.
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_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
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...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show 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.
isModEnabled($module)
Is Dolibarr module enabled.
$nbtotalofrecords
Count total nb of records.
Definition: list.php:329
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.