dolibarr 25.0.0-alpha
list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2016-2021 Ferran Marcet <fmarcet@2byte.es>
6 * Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
7 * Copyright (C) 2020 Thibault FOUCART <support@ptibogxiv.net>
8 * Copyright (C) 2023 Christophe Battarel <christophe@altairis.fr>
9 * Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
10 * Copyright (C) 2024 Benjamin Falière <benjamin.faliere@altairis.fr>
11 * Copyright (C) 2024 Vincent Maury <vmaury@timgroup.fr>
12 * Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
13 * Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 3 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program. If not, see <https://www.gnu.org/licenses/>.
27 */
28
35// Load Dolibarr environment
36require '../main.inc.php';
45require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
46require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
47require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
48require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
49require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
50require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
51require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
52require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
53
54// Load translation files required by the page
55$langs->loadLangs(array("sendings", 'companies', 'bills', 'products', 'orders'));
56
57$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'shipmentlist'; // To manage different context of search
58
59$socid = GETPOSTINT('socid');
60
61$action = GETPOST('action', 'alpha');
62$massaction = GETPOST('massaction', 'alpha');
63$show_files = GETPOSTINT('show_files');
64$toselect = GETPOST('toselect', 'array:int');
65$optioncss = GETPOST('optioncss', 'alpha');
66$mode = GETPOST('mode', 'alpha');
67
68$search_ref_exp = GETPOST("search_ref_exp", 'alpha');
69$search_ref_liv = GETPOST('search_ref_liv', 'alpha');
70$search_ref_customer = GETPOST('search_ref_customer', 'alpha');
71$search_company = GETPOST("search_company", 'alpha');
72$search_shipping_method_ids = GETPOST('search_shipping_method_ids', 'array:int');
73$search_tracking = GETPOST("search_tracking", 'alpha');
74$search_town = GETPOST('search_town', 'alpha');
75$search_zip = GETPOST('search_zip', 'alpha');
76$search_state = GETPOST("search_state", 'alpha');
77$search_country = GETPOST("search_country", 'aZ09');
78$search_type_thirdparty = GETPOST("search_type_thirdparty", 'intcomma');
79$search_billed = GETPOST("search_billed", 'intcomma');
80$search_dateshipping_start = dol_mktime(0, 0, 0, GETPOSTINT('search_dateshipping_startmonth'), GETPOSTINT('search_dateshipping_startday'), GETPOSTINT('search_dateshipping_startyear'));
81$search_dateshipping_end = dol_mktime(23, 59, 59, GETPOSTINT('search_dateshipping_endmonth'), GETPOSTINT('search_dateshipping_endday'), GETPOSTINT('search_dateshipping_endyear'));
82$search_datedelivery_start = dol_mktime(0, 0, 0, GETPOSTINT('search_datedelivery_startmonth'), GETPOSTINT('search_datedelivery_startday'), GETPOSTINT('search_datedelivery_startyear'));
83$search_datedelivery_end = dol_mktime(23, 59, 59, GETPOSTINT('search_datedelivery_endmonth'), GETPOSTINT('search_datedelivery_endday'), GETPOSTINT('search_datedelivery_endyear'));
84$search_datereceipt_start = dol_mktime(0, 0, 0, GETPOSTINT('search_datereceipt_startmonth'), GETPOSTINT('search_datereceipt_startday'), GETPOSTINT('search_datereceipt_startyear'));
85$search_datereceipt_end = dol_mktime(23, 59, 59, GETPOSTINT('search_datereceipt_endmonth'), GETPOSTINT('search_datereceipt_endday'), GETPOSTINT('search_datereceipt_endyear'));
86$search_all = trim(GETPOST('search_all', 'alphanohtml'));
87$search_user = GETPOST('search_user', 'intcomma');
88$search_sale = GETPOST('search_sale', 'intcomma');
89$search_categ_cus = GETPOST("search_categ_cus", 'intcomma');
90$search_product_category = GETPOST('search_product_category', 'intcomma');
91
92$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
93$sortfield = GETPOST('sortfield', 'aZ09comma');
94$sortorder = GETPOST('sortorder', 'aZ09comma');
95$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
96if (!$sortfield) {
97 $sortfield = "e.ref";
98}
99if (!$sortorder) {
100 $sortorder = "DESC";
101}
102if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
103 // If $page is not defined, or '' or -1 or if we click on clear filters
104 $page = 0;
105}
106$offset = $limit * $page;
107$pageprev = $page - 1;
108$pagenext = $page + 1;
109
110$search_status = GETPOST('search_status', 'intcomma');
111$search_signed_status = GETPOST('search_signed_status', 'alpha');
112
113$diroutputmassaction = $conf->expedition->dir_output.'/sending/temp/massgeneration/'.$user->id;
114
115$object = new Expedition($db);
116
117// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
118$hookmanager->initHooks(array('shipmentlist'));
119
120// Fetch optionals attributes and labels
121$extrafields->fetch_name_optionals_label($object->table_element);
122
123$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
124
125// List of fields to search into when doing a "search in all"
126$fieldstosearchall = array(
127 'e.ref' => "Ref",
128 's.nom' => "ThirdParty",
129 'e.note_public' => 'NotePublic',
130 //'e.fk_shipping_method'=>'SendingMethod', // TODO fix this, does not work
131 'e.tracking_number' => "TrackingNumber",
132);
133if (empty($user->socid)) {
134 $fieldstosearchall["e.note_private"] = "NotePrivate";
135}
136
137$checkedtypetiers = '0';
138$arrayfields = array(
139 'e.ref' => array('label' => $langs->trans("Ref"), 'checked' => '1', 'position' => 1),
140 'e.ref_customer' => array('label' => $langs->trans("RefCustomer"), 'checked' => '1', 'position' => 2),
141 's.nom' => array('label' => $langs->trans("ThirdParty"), 'checked' => '1', 'position' => 3),
142 's.town' => array('label' => $langs->trans("Town"), 'checked' => '1', 'position' => 4),
143 's.zip' => array('label' => $langs->trans("Zip"), 'checked' => '-1', 'position' => 5),
144 'state.nom' => array('label' => $langs->trans("StateShort"), 'checked' => '0', 'position' => 6),
145 'country.code_iso' => array('label' => $langs->trans("Country"), 'checked' => '0', 'position' => 7),
146 'typent.code' => array('label' => $langs->trans("ThirdPartyType"), 'checked' => $checkedtypetiers, 'position' => 8),
147 'e.date_delivery' => array('label' => $langs->trans("DateDeliveryPlanned"), 'checked' => '1', 'position' => 9),
148 'e.date_expedition' => array('label' => $langs->trans("DateShipping"), 'checked' => '1', 'position' => 10),
149 'e.fk_shipping_method' => array('label' => $langs->trans('SendingMethod'), 'checked' => '1', 'position' => 11),
150 'e.tracking_number' => array('label' => $langs->trans("TrackingNumber"), 'checked' => '1', 'position' => 12),
151 'e.weight' => array('label' => $langs->trans("Weight"), 'checked' => '0', 'position' => 13),
152 'e.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => '0', 'position' => 500),
153 'e.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => '0', 'position' => 500),
154 'e.fk_statut' => array('label' => $langs->trans("Status"), 'checked' => '1', 'position' => 1000),
155 'e.signed_status' => array('label' => 'Signed status', 'checked' => '0', 'position' => 1001),
156 'l.ref' => array('label' => $langs->trans("DeliveryRef"), 'checked' => '1', 'position' => 1010, 'enabled' => (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') ? '1' : '0')),
157 'l.date_delivery' => array('label' => $langs->trans("DateReceived"), 'position' => 1020, 'checked' => '1', 'enabled' => (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') ? '1' : '0')),
158 'e.billed' => array('label' => $langs->trans("Billed"), 'checked' => '1', 'position' => 1100, 'enabled' => 'getDolGlobalString("WORKFLOW_BILL_ON_SHIPMENT") !== "0"'),
159 'e.note_public' => array('label' => 'NotePublic', 'checked' => '0', 'enabled' => (string) (int) (!getDolGlobalString('MAIN_LIST_HIDE_PUBLIC_NOTES')), 'position' => 135),
160 'e.note_private' => array('label' => 'NotePrivate', 'checked' => '0', 'enabled' => (string) (int) (!getDolGlobalString('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'position' => 140),
161);
162
163// Extra fields
164include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
165
166// Add hook to complete $arrayfields
167$parameters = array('arrayfields' => &$arrayfields);
168$reshook = $hookmanager->executeHooks('completeArrayFields', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
169
170$object->fields = dol_sort_array($object->fields, 'position');
171$arrayfields = dol_sort_array($arrayfields, 'position');
172
173// Security check
174$expeditionid = GETPOSTINT('id');
175if ($user->socid) {
176 $socid = $user->socid;
177}
178$result = restrictedArea($user, 'expedition', $expeditionid, '');
179
180
181
182/*
183 * Actions
184 */
185$error = 0;
186
187if (GETPOST('cancel', 'alpha')) {
188 $action = 'list';
189 $massaction = '';
190}
191if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') {
192 $massaction = '';
193}
194
195$parameters = array('socid' => $socid, 'arrayfields' => &$arrayfields);
196$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
197if ($reshook < 0) {
198 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
199}
200
201include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
202
203// Purge search criteria
204if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
205 $search_user = '';
206 $search_sale = '';
207 $search_product_category = '';
208 $search_ref_exp = '';
209 $search_ref_liv = '';
210 $search_ref_customer = '';
211 $search_company = '';
212 $search_town = '';
213 $search_zip = "";
214 $search_state = "";
215 $search_type = '';
216 $search_country = '';
217 $search_tracking = '';
218 $search_shipping_method_ids = [];
219 $search_type_thirdparty = '';
220 $search_billed = '';
221 $search_dateshipping_start = '';
222 $search_dateshipping_end = '';
223 $search_datedelivery_start = '';
224 $search_datedelivery_end = '';
225 $search_datereceipt_start = '';
226 $search_datereceipt_end = '';
227 $search_status = '';
228 $search_signed_status = '';
229 $toselect = array();
230 $search_array_options = array();
231 $search_categ_cus = 0;
232 $search_all = '';
233}
234
235if (empty($reshook)) {
236 $objectclass = 'Expedition';
237 $objectlabel = 'Sendings';
238 $permissiontoread = $user->hasRight('expedition', 'lire');
239 $permissiontoadd = $user->hasRight('expedition', 'creer');
240 $permissiontodelete = $user->hasRight('expedition', 'supprimer');
241 $uploaddir = $conf->expedition->dir_output.'/sending';
242 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
243
244 if ($massaction == 'confirm_createbills') { // Create bills from sendings.
245 $sendings = GETPOST('toselect', 'array:int');
246 $createbills_onebythird = GETPOST('createbills_onebythird', 'int');
247 $validate_invoices = GETPOST('validate_invoices', 'int');
248
249 $errors = array();
250
251 $TFact = array();
252 $TFactThird = array();
253 $TFactThirdNbLines = array();
254
255 $nb_bills_created = 0;
256 $lastid = 0;
257 $lastref = '';
258
259 $db->begin();
260
261 $nbSendings = is_array($sendings) ? count($sendings) : 1;
262
263 foreach ($sendings as $id_sending) {
264 $expd = new Expedition($db);
265 if ($expd->fetch($id_sending) <= 0) {
266 continue;
267 }
268 $expd->fetch_thirdparty();
269
270 $objecttmp = new Facture($db);
271
272 dol_include_once('/commande/class/commande.class.php');
273 $expdCmdSrc = new Commande($db);
274 $expdCmdSrc->fetch($expd->origin_id);
275
276 if (!empty($createbills_onebythird) && !empty($TFactThird[$expd->socid])) {
277 // If option "one bill per third" is set, and an invoice for this thirdparty was already created, we reuse it.
278 $objecttmp = $TFactThird[$expd->socid];
279 } else {
280 // If we want one invoice per sending or if there is no first invoice yet for this thirdparty.
281 $objecttmp->socid = $expd->socid;
282 $objecttmp->thirdparty = $expd->thirdparty;
283
284 $objecttmp->type = $objecttmp::TYPE_STANDARD;
285 $objecttmp->cond_reglement_id = !empty($expdCmdSrc->cond_reglement_id) ? $expdCmdSrc->cond_reglement_id : (!empty($objecttmp->thirdparty->cond_reglement_id) ? $objecttmp->thirdparty->cond_reglement_id : 1);
286 $objecttmp->mode_reglement_id = !empty($expdCmdSrc->mode_reglement_id) ? $expdCmdSrc->mode_reglement_id : (!empty($objecttmp->thirdparty->mode_reglement_id) ? $objecttmp->thirdparty->mode_reglement_id : 0);
287
288 $objecttmp->fk_project = $expd->fk_project;
289 $objecttmp->multicurrency_code = !empty($expdCmdSrc->multicurrency_code) ? $expdCmdSrc->multicurrency_code : (!empty($objecttmp->thirdparty->multicurrency_code) ? $objecttmp->thirdparty->multicurrency_code : $expd->multicurrency_code);
290 if (empty($createbills_onebythird)) {
291 $objecttmp->ref_customer = $expd->ref_customer;
292 }
293
294 $datefacture = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'));
295 if (empty($datefacture)) {
296 $datefacture = dol_now();
297 }
298
299 $objecttmp->date = $datefacture;
300 $objecttmp->origin_type = 'shipping';
301 $objecttmp->origin_id = (int) $id_sending;
302
303 $objecttmp->array_options = $expd->array_options; // Copy extrafields
304
305 $res = $objecttmp->create($user);
306
307 if ($res > 0) {
308 $nb_bills_created++;
309 $lastref = $objecttmp->ref;
310 $lastid = $objecttmp->id;
311
312 $TFactThird[$expd->socid] = $objecttmp;
313 $TFactThirdNbLines[$expd->socid] = 0; //init nblines to have lines ordered by expedition and rang
314 } else {
315 $langs->load("errors");
316 $errors[] = $expd->ref.' : '.$langs->trans($objecttmp->errors[0]);
317 $error++;
318 }
319 }
320
321 if ($objecttmp->id > 0) {
322 $res = $objecttmp->add_object_linked($objecttmp->origin_type, $id_sending);
323
324 if ($res == 0) {
325 $errors[] = $expd->ref.' : '.$langs->trans($objecttmp->errors[0]);
326 $error++;
327 }
328
329 $expd->fetchObjectLinked();
330 foreach ($expd->linkedObjectsIds as $sourcetype => $TIds) {
331 if ($sourcetype == 'facture') {
332 continue;
333 }
334 if (!empty($createbills_onebythird) && !empty($TFactThird[$expd->socid])) {
335 $objecttmp->fetchObjectLinked($object->id, 'commande');
336 foreach ($objecttmp->linkedObjectsIds as $tmpSourcetype => $tmpTIds) {
337 if ($tmpSourcetype == $sourcetype) {
338 if (!empty(array_intersect($TIds, $tmpTIds))) {
339 continue 2;
340 }
341 }
342 }
343 }
344
345 $res = $objecttmp->add_object_linked($sourcetype, current($TIds));
346
347 if ($res == 0) {
348 $errors[] = $expd->ref.' : '.$langs->trans($objecttmp->errors[0]);
349 $error++;
350 }
351 }
352
353 if (!$error) {
354 $lines = $expd->lines;
355 if (empty($lines) && method_exists($expd, 'fetch_lines')) {
356 $expd->fetch_lines();
357 $lines = $expd->lines;
358 }
359
360 $fk_parent_line = 0;
361 $num = count($lines);
362
363 for ($i = 0; $i < $num; $i++) {
364 $desc = ($lines[$i]->desc ? $lines[$i]->desc : '');
365 // If we build one invoice for several sendings, we must put the ref of sending on the invoice line
366 if (!empty($createbills_onebythird)) {
367 $desc = dol_concatdesc($desc, $langs->trans("Order").': '.$expdCmdSrc->ref. ' - '. $langs->trans("Shipment").': '.$expd->ref.($expd->date_shipping ? ' - '.dol_print_date($expd->date_shipping, 'day') : ''));
368 }
369
370 if ($lines[$i]->subprice < 0 && !getDolGlobalString('INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN')) {
371 // Negative line, we create a discount line
372 $discount = new DiscountAbsolute($db);
373 $discount->socid = $objecttmp->socid;
374 $discount->amount_ht = abs($lines[$i]->total_ht);
375 $discount->amount_tva = abs($lines[$i]->total_tva);
376 $discount->amount_ttc = abs($lines[$i]->total_ttc);
377 $discount->tva_tx = $lines[$i]->tva_tx;
378 $discount->fk_user = $user->id;
379 $discount->description = $desc;
380 $discountid = $discount->create($user);
381 if ($discountid > 0) {
382 $result = $objecttmp->insert_discount($discountid);
383 //$result=$discount->link_to_invoice($lineid,$id);
384 } else {
385 setEventMessages($discount->error, $discount->errors, 'errors');
386 $error++;
387 break;
388 }
389 } else {
390 // Positive line
391 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
392 // Date start
393 $date_start = false;
394 if ($lines[$i]->date_debut_prevue) {
395 $date_start = $lines[$i]->date_debut_prevue;
396 }
397 if ($lines[$i]->date_debut_reel) {
398 $date_start = $lines[$i]->date_debut_reel;
399 }
400 if ($lines[$i]->date_start) {
401 $date_start = $lines[$i]->date_start;
402 }
403 //Date end
404 $date_end = false;
405 if ($lines[$i]->date_fin_prevue) {
406 $date_end = $lines[$i]->date_fin_prevue;
407 }
408 if ($lines[$i]->date_fin_reel) {
409 $date_end = $lines[$i]->date_fin_reel;
410 }
411 if ($lines[$i]->date_end) {
412 $date_end = $lines[$i]->date_end;
413 }
414 // Reset fk_parent_line for no child products and special product
415 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
416 $fk_parent_line = 0;
417 }
418
419 // Extrafields
420 if (method_exists($lines[$i], 'fetch_optionals')) {
421 $lines[$i]->fetch_optionals();
422 $array_options = $lines[$i]->array_options;
423 }
424
425 $objecttmp->context['createfromclone'] = 'createfromclone';
426
427 $rang = ($nbSendings > 1) ? -1 : $lines[$i]->rang;
428 //there may already be rows from previous sendings
429 if (!empty($createbills_onebythird)) {
430 $rang = $TFactThirdNbLines[$expd->socid];
431 }
432
433 $result = $objecttmp->addline(
434 $desc,
435 $lines[$i]->subprice,
436 $lines[$i]->qty,
437 $lines[$i]->tva_tx,
438 $lines[$i]->localtax1_tx,
439 $lines[$i]->localtax2_tx,
440 $lines[$i]->fk_product,
441 $lines[$i]->remise_percent,
443 $date_end,
444 0,
445 (int) $lines[$i]->info_bits,
446 $lines[$i]->fk_remise_except,
447 'HT',
448 0,
449 $product_type,
450 $rang,
451 $lines[$i]->special_code,
452 $objecttmp->origin_type,
453 $lines[$i]->rowid,
454 $fk_parent_line,
455 $lines[$i]->fk_fournprice,
456 $lines[$i]->pa_ht,
457 $lines[$i]->label,
458 !empty($array_options) ? $array_options : '',
459 100,
460 0,
461 $lines[$i]->fk_unit
462 );
463 if ($result > 0) {
464 $lineid = $result;
465 if (!empty($createbills_onebythird)) { //increment rang to keep sending
466 $TFactThirdNbLines[$expd->socid]++;
467 }
468 } else {
469 $lineid = 0;
470 $error++;
471 $errors[] = $objecttmp->error;
472 break;
473 }
474 // Defined the new fk_parent_line
475 if ($result > 0 && $lines[$i]->product_type == 9) {
476 $fk_parent_line = $result;
477 }
478 }
479 }
480 }
481 }
482
483 if (!empty($createbills_onebythird) && empty($TFactThird[$expd->socid])) {
484 $TFactThird[$expd->socid] = $objecttmp;
485 } else {
486 $TFact[$objecttmp->id] = $objecttmp;
487 }
488 }
489
490 // Build doc with all invoices
491 $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
492 $toselect = array();
493
494 if (!$error && $validate_invoices) {
495 $massaction = $action = 'builddoc';
496
497 foreach ($TAllFact as &$objecttmp) {
498 $result = $objecttmp->validate($user);
499 if ($result <= 0) {
500 $error++;
501 setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
502 break;
503 }
504
505 $id = $objecttmp->id; // For builddoc action
506
507 // Builddoc
508 $donotredirect = 1;
509 $upload_dir = $conf->facture->dir_output;
510 $permissiontoadd = $user->hasRight('facture', 'creer');
511
512 // Call action to build doc
513 $savobject = $object;
514 $object = $objecttmp;
515 include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
516 $object = $savobject;
517 }
518
519 $massaction = $action = 'confirm_createbills';
520 }
521
522 if (!$error) {
523 $db->commit();
524
525 if ($nb_bills_created == 1) {
526 $texttoshow = $langs->trans('BillXCreated', '{s1}');
527 $texttoshow = str_replace('{s1}', '<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?id='.urlencode(strval($lastid)).'">'.$lastref.'</a>', $texttoshow);
528 setEventMessages($texttoshow, null, 'mesgs');
529 } else {
530 setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs');
531 }
532
533 // Make a redirect to avoid to bill twice if we make a refresh or back
534 $param = '';
535 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
536 $param .= '&contextpage='.urlencode($contextpage);
537 }
538 if ($limit > 0 && $limit != $conf->liste_limit) {
539 $param .= '&limit='.((int) $limit);
540 }
541 if ($search_all) {
542 $param .= "&search_all=".urlencode($search_all);
543 }
544 if ($search_ref_exp) {
545 $param .= "&search_ref_exp=".urlencode($search_ref_exp);
546 }
547 if ($search_ref_liv) {
548 $param .= "&search_ref_liv=".urlencode($search_ref_liv);
549 }
550 if ($search_ref_customer) {
551 $param .= "&search_ref_customer=".urlencode($search_ref_customer);
552 }
553 if ($search_user > 0) {
554 $param .= '&search_user='.urlencode($search_user);
555 }
556 if ($search_sale > 0) {
557 $param .= '&search_sale='.urlencode($search_sale);
558 }
559 if ($search_company) {
560 $param .= "&search_company=".urlencode($search_company);
561 }
562 if ($search_shipping_method_ids) {
563 foreach ($search_shipping_method_ids as $value) {
564 $param .= "&search_shipping_method_ids[]=".urlencode($value);
565 }
566 }
567 if ($search_tracking) {
568 $param .= "&search_tracking=".urlencode($search_tracking);
569 }
570 if ($search_town) {
571 $param .= '&search_town='.urlencode($search_town);
572 }
573 if ($search_zip) {
574 $param .= '&search_zip='.urlencode($search_zip);
575 }
576 if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
577 $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty);
578 }
579 if ($search_dateshipping_start) {
580 $param .= '&search_dateshipping_startday='.urlencode(dol_print_date($search_dateshipping_start, '%d')).'&search_dateshipping_startmonth='.urlencode(dol_print_date($search_dateshipping_start, '%m')).'&search_dateshipping_startyear='.urlencode(dol_print_date($search_dateshipping_start, '%Y'));
581 }
582 if ($search_dateshipping_end) {
583 $param .= '&search_dateshipping_endday='.urlencode(dol_print_date($search_dateshipping_end, '%d')).'&search_dateshipping_endmonth='.urlencode(dol_print_date($search_dateshipping_end, '%m')).'&search_dateshipping_endyear='.urlencode(dol_print_date($search_dateshipping_end, '%Y'));
584 }
585 if ($search_datedelivery_start) {
586 $param .= '&search_datedelivery_startday='.urlencode(dol_print_date($search_datedelivery_start, '%d')).'&search_datedelivery_startmonth='.urlencode(dol_print_date($search_datedelivery_start, '%m')).'&search_datedelivery_startyear='.urlencode(dol_print_date($search_datedelivery_start, '%Y'));
587 }
588 if ($search_datedelivery_end) {
589 $param .= '&search_datedelivery_endday='.urlencode(dol_print_date($search_datedelivery_end, '%d')).'&search_datedelivery_endmonth='.urlencode(dol_print_date($search_datedelivery_end, '%m')).'&search_datedelivery_endyear='.urlencode(dol_print_date($search_datedelivery_end, '%Y'));
590 }
591 if ($search_datereceipt_start) {
592 $param .= '&search_datereceipt_startday='.urlencode(dol_print_date($search_datereceipt_start, '%d')).'&search_datereceipt_startmonth='.urlencode(dol_print_date($search_datereceipt_start, '%m')).'&search_datereceipt_startyear='.urlencode(dol_print_date($search_datereceipt_start, '%Y'));
593 }
594 if ($search_datereceipt_end) {
595 $param .= '&search_datereceipt_endday='.urlencode(dol_print_date($search_datereceipt_end, '%d')).'&search_datereceipt_endmonth='.urlencode(dol_print_date($search_datereceipt_end, '%m')).'&search_datereceipt_endyear='.urlencode(dol_print_date($search_datereceipt_end, '%Y'));
596 }
597 if ($search_product_category != '') {
598 $param .= '&search_product_category='.urlencode($search_product_category);
599 }
600 if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
601 $param .= '&search_categ_cus='.urlencode($search_categ_cus);
602 }
603 if ($search_status != '') {
604 $param .= '&search_status='.urlencode($search_status);
605 }
606 if ($search_signed_status != '' && $search_signed_status >= 0) {
607 $param .= '&search_signed_status='.urlencode($search_signed_status);
608 }
609 if ($optioncss != '') {
610 $param .= '&optioncss='.urlencode($optioncss);
611 }
612 if ($search_billed != '') {
613 $param .= '&billed='.urlencode($search_billed);
614 }
615
616 header("Location: ".$_SERVER['PHP_SELF'].'?'.$param);
617 exit;
618 } else {
619 $db->rollback();
620
621 $action = 'create';
622 $_GET["origin"] = GETPOST("origin", 'alpha');
623 $_GET["originid"] = GETPOSTINT("originid");
624 if (!empty($errors)) {
625 setEventMessages(null, $errors, 'errors');
626 } else {
627 setEventMessages("Error", null, 'errors');
628 }
629 $error++;
630 }
631 }
632
633 // If massaction is close
634 if ($massaction == 'classifyclose') {
635 $error = 0;
636 $selectids = GETPOST('toselect', 'array:int');
637 foreach ($selectids as $selectid) {
638 // $object->fetch($selectid);
639 $object->fetch($selectid);
640 $result = $object->setClosed();
641 }
642
643 $massaction = $action = 'classifyclose';
644
645 if ($result < 0) {
646 $error++;
647 }
648
649
650 if (!$error) {
651 $db->commit();
652
653 setEventMessage($langs->trans("Close Done"));
654 header('Location: '.$_SERVER["PHP_SELF"]);
655 exit;
656 } else {
657 $db->rollback();
658 exit;
659 }
660 }
661}
662
663/*
664 * View
665 */
666
667$now = dol_now();
668
669$form = new Form($db);
670$formother = new FormOther($db);
671$formfile = new FormFile($db);
672$companystatic = new Societe($db);
673$formcompany = new FormCompany($db);
674$shipment = new Expedition($db);
675
676$title = $langs->trans('Shipments');
677$help_url = 'EN:Module_Shipments|FR:Module_Exp&eacute;ditions|ES:M&oacute;dulo_Expediciones';
678
679$sql = 'SELECT';
680if ($search_all || $search_user > 0) {
681 $sql = 'SELECT DISTINCT';
682}
683$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_expedition, e.date_delivery as delivery_date, e.fk_statut, e.signed_status, e.billed, e.tracking_number, e.fk_shipping_method,";
684if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) {
685 // Link for delivery fields ref and date. Does not duplicate the line because we should always have only 1 link or 0 per shipment
686 $sql .= " l.date_delivery as date_reception,";
687}
688$sql .= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, ";
689$sql .= " typent.code as typent_code,";
690$sql .= " state.code_departement as state_code, state.nom as state_name,";
691$sql .= " e.date_creation as date_creation, e.tms as date_modification,e.note_public, e.note_private,";
692$sql .= " u.login";
693// Add fields from extrafields
694if (!empty($extrafields->attributes[$object->table_element]['label'])) {
695 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
696 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
697 }
698}
699// Add fields from hooks
700$parameters = array();
701$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
702$sql .= $hookmanager->resPrint;
703
704$sqlfields = $sql; // $sql fields to remove for count total
705
706$sql .= " FROM ".MAIN_DB_PREFIX."expedition as e";
707if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
708 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (e.rowid = ef.fk_object)";
709}
710if ($search_all) {
711 $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'expeditiondet as ed ON e.rowid=ed.fk_expedition';
712}
713$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
714$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
715$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
716$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
717if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) {
718 // Link for delivery fields ref and date. Does not duplicate the line because we should always have only 1 link or 0 per shipment
719 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'shipping' AND ee.targettype = 'delivery'";
720 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.rowid = ee.fk_target";
721}
722$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON e.fk_user_author = u.rowid';
723if ($search_user > 0) { // Get link to order to get the order id in eesource.fk_source
724 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as eesource ON eesource.fk_target = e.rowid AND eesource.targettype = 'shipping' AND eesource.sourcetype = 'commande'";
725}
726if ($search_user > 0) {
727 $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
728 $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
729}
730
731// Add table from hooks
732$parameters = array();
733$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
734$sql .= $hookmanager->resPrint;
735
736$sql .= " WHERE e.entity IN (".getEntity('expedition').")";
737
738if ($socid > 0) {
739 $sql .= " AND s.rowid = ".((int) $socid);
740}
741if ($socid) {
742 $sql .= " AND e.fk_soc = ".((int) $socid);
743}
744if ($search_status != '' && $search_status >= 0) {
745 $sql .= " AND e.fk_statut = ".((int) $search_status);
746}
747if ($search_signed_status != '' && $search_signed_status >= 0) {
748 $sql .= " AND e.signed_status = ".((int) $search_signed_status);
749}
750if ($search_ref_customer != '') {
751 $sql .= natural_search('e.ref_customer', $search_ref_customer);
752}
753if ($search_billed != '' && $search_billed >= 0) {
754 $sql .= " AND e.billed = ".((int) $search_billed);
755}
756if ($search_town) {
757 $sql .= natural_search('s.town', $search_town);
758}
759if ($search_zip) {
760 $sql .= natural_search("s.zip", $search_zip);
761}
762if ($search_state) {
763 $sql .= natural_search("state.nom", $search_state);
764}
765if ($search_country) {
766 $sql .= " AND s.fk_pays IN (".$db->sanitize($search_country).')';
767}
768if (!empty($search_shipping_method_ids)) {
769 $sql .= " AND e.fk_shipping_method IN (".$db->sanitize(implode(',', $search_shipping_method_ids)).')';
770}
771if ($search_tracking) {
772 $sql .= natural_search("e.tracking_number", $search_tracking);
773}
774if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
775 $sql .= " AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).')';
776}
777if ($search_user > 0) {
778 // The contact on a shipment is also the contact of the order.
779 $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = eesource.fk_source AND ec.fk_socpeople = ".((int) $search_user);
780}
781if ($search_company) {
782 $sql .= natural_search('s.nom', $search_company);
783}
784if ($search_ref_exp) {
785 $sql .= natural_search('e.ref', $search_ref_exp);
786}
787if ($search_dateshipping_start) {
788 $sql .= " AND e.date_expedition >= '".$db->idate($search_dateshipping_start)."'";
789}
790if ($search_dateshipping_end) {
791 $sql .= " AND e.date_expedition <= '".$db->idate($search_dateshipping_end)."'";
792}
793if ($search_datedelivery_start) {
794 $sql .= " AND e.date_delivery >= '".$db->idate($search_datedelivery_start)."'";
795}
796if ($search_datedelivery_end) {
797 $sql .= " AND e.date_delivery <= '".$db->idate($search_datedelivery_end)."'";
798}
799if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) {
800 if ($search_ref_liv) {
801 $sql .= natural_search('l.ref', $search_ref_liv);
802 }
803 if ($search_datereceipt_start) {
804 $sql .= " AND l.date_delivery >= '".$db->idate($search_datereceipt_start)."'";
805 }
806 if ($search_datereceipt_end) {
807 $sql .= " AND l.date_delivery <= '".$db->idate($search_datereceipt_end)."'";
808 }
809}
810if ($search_all) {
811 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
812}
813// Search on sale representative
814if ($search_sale && $search_sale != '-1') {
815 if ($search_sale == -2) {
816 $sql .= " AND ".getSalesRepresentativeSqlFilter('e.fk_soc', 0, 1);
817 } elseif ($search_sale > 0) {
818 $sql .= " AND ".getSalesRepresentativeSqlFilter('e.fk_soc', (int) $search_sale);
819 }
820}
821// Search for tag/category ($searchCategoryCustomerList is an array of ID)
822$searchCategoryCustomerOperator = GETPOSTINT('search_category_customer_operator');
823$searchCategoryCustomerList = array($search_categ_cus);
824if (!empty($searchCategoryCustomerList)) {
825 $searchCategoryCustomerSqlList = array();
826 $listofcategoryid = '';
827 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
828 if (intval($searchCategoryCustomer) == -2) {
829 $searchCategoryCustomerSqlList[] = "NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as cs WHERE s.rowid = cs.fk_soc)";
830 } elseif (intval($searchCategoryCustomer) > 0) {
831 if ($searchCategoryCustomerOperator == 0) {
832 $searchCategoryCustomerSqlList[] = " EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as cs WHERE s.rowid = cs.fk_soc AND cs.fk_categorie = ".((int) $searchCategoryCustomer).")";
833 } else {
834 $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryCustomer);
835 }
836 }
837 }
838 if ($listofcategoryid) {
839 $searchCategoryCustomerSqlList[] = " EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as cs WHERE s.rowid = cs.fk_soc AND cs.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
840 }
841 if ($searchCategoryCustomerOperator == 1) {
842 if (!empty($searchCategoryCustomerSqlList)) {
843 $sql .= " AND (".implode(' OR ', $searchCategoryCustomerSqlList).")";
844 }
845 } else {
846 if (!empty($searchCategoryCustomerSqlList)) {
847 $sql .= " AND (".implode(' AND ', $searchCategoryCustomerSqlList).")";
848 }
849 }
850}
851// Search for tag/category ($searchCategoryProductList is an array of ID)
852$searchCategoryProductOperator = GETPOSTINT('search_category_product_operator');
853$searchCategoryProductList = array($search_product_category);
854if (!empty($searchCategoryProductList)) {
855 $searchCategoryProductSqlList = array();
856 $listofcategoryid = '';
857 foreach ($searchCategoryProductList as $searchCategoryProduct) {
858 if (intval($searchCategoryProduct) == -2) {
859 $searchCategoryProductSqlList[] = "NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."commandedet as cd WHERE ed.fk_expedition = e.rowid AND ed.fk_elementdet = cd.rowid AND cd.fk_product = ck.fk_product)";
860 } elseif (intval($searchCategoryProduct) > 0) {
861 if ($searchCategoryProductOperator == 0) {
862 $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."commandedet as cd WHERE ed.fk_expedition = e.rowid AND ed.fk_elementdet = cd.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")";
863 } else {
864 $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);
865 }
866 }
867 }
868 if ($listofcategoryid) {
869 $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."commandedet as cd WHERE ed.fk_expedition = e.rowid AND ed.fk_elementdet = cd.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
870 }
871 if ($searchCategoryProductOperator == 1) {
872 if (!empty($searchCategoryProductSqlList)) {
873 $sql .= " AND (".implode(' OR ', $searchCategoryProductSqlList).")";
874 }
875 } else {
876 if (!empty($searchCategoryProductSqlList)) {
877 $sql .= " AND (".implode(' AND ', $searchCategoryProductSqlList).")";
878 }
879 }
880}
881// Add where from extra fields
882include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
883
884// Add where from hooks
885$parameters = array();
886$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
887if (empty($reshook)) {
888 $sql .= $hookmanager->resPrint;
889} else {
890 $sql = $hookmanager->resPrint;
891}
892
893// Add HAVING from hooks
894$parameters = array();
895$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
896if (empty($reshook)) {
897 $sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
898} else {
899 $sql = $hookmanager->resPrint;
900}
901
902$nbtotalofrecords = '';
903if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
904 /* The fast and low memory method to get and count full list converts the sql into a sql count */
905 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
906 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
907 $resql = $db->query($sqlforcount);
908 if ($resql) {
909 $objforcount = $db->fetch_object($resql);
910 $nbtotalofrecords = $objforcount->nbtotalofrecords;
911 } else {
913 }
914
915 if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
916 $page = 0;
917 $offset = 0;
918 }
919 $db->free($resql);
920}
921
922// Complete request and execute it with limit
923$sql .= $db->order($sortfield, $sortorder);
924if ($limit) {
925 $sql .= $db->plimit($limit + 1, $offset);
926}
927
928//print $sql;
929$resql = $db->query($sql);
930if (!$resql) {
932 exit;
933}
934
935$num = $db->num_rows($resql);
936
937// Redirect to expedition card if there is only one result for global search
938if ($num == 1 && getDolGlobalInt('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
939 $obj = $db->fetch_object($resql);
940 $id = $obj->rowid;
941 header("Location: ".DOL_URL_ROOT.'/expedition/card.php?id='.$id);
942 exit;
943}
944
945if ($socid > 0) {
946 $soc = new Societe($db);
947 $soc->fetch($socid);
948 if (empty($search_company)) {
949 $search_company = $soc->name;
950 }
951}
952
953// Output page
954// --------------------------------------------------------------------
955
956llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'bodyforlist mod-expedition page-list');
957
958$arrayofselected = is_array($toselect) ? $toselect : array();
959
960$param = '';
961if ($socid > 0) {
962 $param .= '&socid='.urlencode((string) ($socid));
963}
964if (!empty($mode)) {
965 $param .= '&mode='.urlencode($mode);
966}
967if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
968 $param .= '&contextpage='.urlencode($contextpage);
969}
970if ($limit > 0 && $limit != $conf->liste_limit) {
971 $param .= '&limit='.((int) $limit);
972}
973if ($search_all) {
974 $param .= "&search_all=".urlencode($search_all);
975}
976if ($search_ref_exp) {
977 $param .= "&search_ref_exp=".urlencode($search_ref_exp);
978}
979if ($search_ref_liv) {
980 $param .= "&search_ref_liv=".urlencode($search_ref_liv);
981}
982if ($search_ref_customer) {
983 $param .= "&search_ref_customer=".urlencode($search_ref_customer);
984}
985if ($search_user > 0) {
986 $param .= '&search_user='.urlencode((string) ($search_user));
987}
988if ($search_sale > 0) {
989 $param .= '&search_sale='.urlencode((string) ($search_sale));
990}
991if ($search_company) {
992 $param .= "&search_company=".urlencode($search_company);
993}
994if ($search_shipping_method_ids) {
995 foreach ($search_shipping_method_ids as $value) {
996 $param .= "&search_shipping_method_ids[]=".urlencode($value);
997 }
998}
999if ($search_tracking) {
1000 $param .= "&search_tracking=".urlencode($search_tracking);
1001}
1002if ($search_town) {
1003 $param .= '&search_town='.urlencode($search_town);
1004}
1005if ($search_zip) {
1006 $param .= '&search_zip='.urlencode($search_zip);
1007}
1008if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
1009 $param .= '&search_type_thirdparty='.urlencode((string) ($search_type_thirdparty));
1010}
1011if ($search_dateshipping_start) {
1012 $param .= '&search_dateshipping_startday='.urlencode(dol_print_date($search_dateshipping_start, '%d')).'&search_dateshipping_startmonth='.urlencode(dol_print_date($search_dateshipping_start, '%m')).'&search_dateshipping_startyear='.urlencode(dol_print_date($search_dateshipping_start, '%Y'));
1013}
1014if ($search_dateshipping_end) {
1015 $param .= '&search_dateshipping_endday='.urlencode(dol_print_date($search_dateshipping_end, '%d')).'&search_dateshipping_endmonth='.urlencode(dol_print_date($search_dateshipping_end, '%m')).'&search_dateshipping_endyear='.urlencode(dol_print_date($search_dateshipping_end, '%Y'));
1016}
1017if ($search_datedelivery_start) {
1018 $param .= '&search_datedelivery_startday='.urlencode(dol_print_date($search_datedelivery_start, '%d')).'&search_datedelivery_startmonth='.urlencode(dol_print_date($search_datedelivery_start, '%m')).'&search_datedelivery_startyear='.urlencode(dol_print_date($search_datedelivery_start, '%Y'));
1019}
1020if ($search_datedelivery_end) {
1021 $param .= '&search_datedelivery_endday='.urlencode(dol_print_date($search_datedelivery_end, '%d')).'&search_datedelivery_endmonth='.urlencode(dol_print_date($search_datedelivery_end, '%m')).'&search_datedelivery_endyear='.urlencode(dol_print_date($search_datedelivery_end, '%Y'));
1022}
1023if ($search_datereceipt_start) {
1024 $param .= '&search_datereceipt_startday='.urlencode(dol_print_date($search_datereceipt_start, '%d')).'&search_datereceipt_startmonth='.urlencode(dol_print_date($search_datereceipt_start, '%m')).'&search_datereceipt_startyear='.urlencode(dol_print_date($search_datereceipt_start, '%Y'));
1025}
1026if ($search_datereceipt_end) {
1027 $param .= '&search_datereceipt_endday='.urlencode(dol_print_date($search_datereceipt_end, '%d')).'&search_datereceipt_endmonth='.urlencode(dol_print_date($search_datereceipt_end, '%m')).'&search_datereceipt_endyear='.urlencode(dol_print_date($search_datereceipt_end, '%Y'));
1028}
1029if ($search_product_category != '') {
1030 $param .= '&search_product_category='.urlencode((string) ($search_product_category));
1031}
1032if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
1033 $param .= '&search_categ_cus='.urlencode((string) ($search_categ_cus));
1034}
1035if ($search_status != '') {
1036 $param .= '&search_status='.urlencode($search_status);
1037}
1038if ($search_signed_status != '' && $search_signed_status >= 0) {
1039 $param .= '&search_signed_status='.urlencode($search_signed_status);
1040}
1041if ($optioncss != '') {
1042 $param .= '&optioncss='.urlencode($optioncss);
1043}
1044// Add $param from extra fields
1045include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
1046
1047// Add $param from hooks
1048$parameters = array('param' => &$param);
1049$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1050$param .= $hookmanager->resPrint;
1051
1052$arrayofmassactions = array(
1053 'generate_doc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
1054 'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
1055 'classifyclose' => img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("Close"),
1056 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
1057);
1058if ($user->hasRight('facture', 'creer')) {
1059 $arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomerFromSendings");
1060}
1061if (in_array($massaction, array('presend', 'createbills'))) {
1062 $arrayofmassactions = array();
1063}
1064$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
1065
1066// Currently: a sending can't create from sending list
1067// $url = DOL_URL_ROOT.'/expedition/card.php?action=create';
1068// if (!empty($socid)) $url .= '&socid='.$socid;
1069// $newcardbutton = dolGetButtonTitle($langs->trans('NewSending'), '', 'fa fa-plus-circle', $url, '', $user->rights->expedition->creer);
1070$newcardbutton = '';
1071$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'));
1072$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'));
1073$newcardbutton .= dolGetButtonTitle($langs->trans('Statistics'), '', 'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.'/expedition/stats/index.php?mode=statistics'.preg_replace('/(&|\?)*(mode|groupby)=[^&]+/', '', $param), '', ($mode == 'statistics' ? 2 : 1), array('morecss' => 'reposition'));
1074$newcardbutton .= dolGetButtonTitleSeparator();
1075$newcardbutton .= dolGetButtonTitle($langs->trans('NewSending'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/expedition/card.php?action=create2', '', $user->hasRight('expedition', 'creer'));
1076
1077$i = 0;
1078print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
1079if ($optioncss != '') {
1080 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
1081}
1082print '<input type="hidden" name="token" value="'.newToken().'">';
1083print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1084print '<input type="hidden" name="action" value="list">';
1085print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
1086print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
1087print '<input type="hidden" name="socid" value="'.$socid.'">';
1088print '<input type="hidden" name="mode" value="'.$mode.'">';
1089
1090// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1091print_barre_liste($langs->trans('Shipments'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'dolly', 0, $newcardbutton, '', $limit, 0, 0, 1);
1092
1093$topicmail = "SendShippingRef";
1094$modelmail = "shipping_send";
1095$objecttmp = new Expedition($db);
1096$trackid = 'shi'.$object->id;
1097include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
1098
1099if ($massaction == 'createbills') {
1100 print '<input type="hidden" name="massaction" value="confirm_createbills">';
1101
1102 print '<table class="noborder centpercent">';
1103 print '<tr>';
1104 print '<td class="titlefield">';
1105 print $langs->trans('DateInvoice');
1106 print '</td>';
1107 print '<td>';
1108 print $form->selectDate('', '', 0, 0, 0, '', 1, 1);
1109 print '</td>';
1110 print '</tr>';
1111 print '<tr>';
1112 print '<td>';
1113 print $langs->trans('CreateOneBillByThird');
1114 print '</td>';
1115 print '<td>';
1116 print $form->selectyesno('createbills_onebythird', '', 1);
1117 print '</td>';
1118 print '</tr>';
1119 print '<tr>';
1120 print '<td>';
1121 print $langs->trans('ValidateInvoices');
1122 print '</td>';
1123 print '<td>';
1124 if (!empty($conf->stock->enabled) && getDolGlobalString('STOCK_CALCULATE_ON_BILL')) {
1125 print $form->selectyesno('validate_invoices', 0, 1, true);
1126 $langs->load("errors");
1127 print ' ('.$langs->trans("WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal").')';
1128 } else {
1129 print $form->selectyesno('validate_invoices', 0, 1);
1130 }
1131 if (!empty($conf->workflow->enabled) && getDolGlobalString('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER')) {
1132 print ' &nbsp; &nbsp; <span class="opacitymedium">'.$langs->trans("IfValidateInvoiceIsNoSendingStayUnbilled").'</span>';
1133 } else {
1134 print ' &nbsp; &nbsp; <span class="opacitymedium">'.$langs->trans("OptionToSetSendingBilledNotEnabled").'</span>';
1135 }
1136 print '</td>';
1137 print '</tr>';
1138 print '</table>';
1139
1140 print '<br>';
1141 print '<div class="center">';
1142 print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('CreateInvoiceForThisCustomerFromSendings').'"> ';
1143 print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
1144 print '</div>';
1145 print '<br>';
1146}
1147
1148if ($search_all) {
1149 foreach ($fieldstosearchall as $key => $val) {
1150 $fieldstosearchall[$key] = $langs->trans($val);
1151 }
1152 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>';
1153}
1154
1155$moreforfilter = '';
1156
1157// If the user can view prospects other than his'
1158if ($user->hasRight('user', 'user', 'lire')) {
1159 $langs->load("commercial");
1160 $moreforfilter .= '<div class="divsearchfield">';
1161 $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
1162 $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"');
1163 $moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth200');
1164 $moreforfilter .= '</div>';
1165}
1166// If the user can view other users
1167if ($user->hasRight('user', 'user', 'lire')) {
1168 $moreforfilter .= '<div class="divsearchfield">';
1169 $tmptitle = $langs->trans('LinkedToSpecificUsers');
1170 $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"');
1171 $moreforfilter .= $form->select_dolusers($search_user, 'search_user', $tmptitle, null, 0, '', '', '0', 0, 0, '', 0, '', 'maxwidth200');
1172 $moreforfilter .= '</div>';
1173}
1174// If the user can view prospects other than his'
1175if (isModEnabled('category') && $user->hasRight('categorie', 'lire') && ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire'))) {
1176 include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
1177 $moreforfilter .= '<div class="divsearchfield">';
1178 $tmptitle = $langs->trans('IncludingProductWithTag');
1179 $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"');
1180 $moreforfilter .= $formother->select_categories(Categorie::TYPE_PRODUCT, (int) $search_product_category, 'search_product_category', 1, $tmptitle);
1181 $moreforfilter .= '</div>';
1182}
1183if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
1184 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
1185 $moreforfilter .= '<div class="divsearchfield">';
1186 $tmptitle = $langs->trans('CustomersProspectsCategoriesShort');
1187 $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"');
1188 $moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle);
1189 $moreforfilter .= '</div>';
1190}
1191$parameters = array();
1192$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1193if (empty($reshook)) {
1194 $moreforfilter .= $hookmanager->resPrint;
1195} else {
1196 $moreforfilter = $hookmanager->resPrint;
1197}
1198
1199if (!empty($moreforfilter)) {
1200 print '<div class="liste_titre liste_titre_bydiv centpercent">';
1201 print $moreforfilter;
1202 print '</div>';
1203}
1204
1205$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
1206$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // @phan-suppress-current-line PhanTypeMismatchArgument
1207if ($massactionbutton) {
1208 $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); // This also change content of $arrayfields
1209}
1210
1211print '<div class="div-table-responsive">';
1212print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
1213
1214// Fields title search
1215// --------------------------------------------------------------------
1216print '<tr class="liste_titre_filter">';
1217// Action column
1218if ($conf->main_checkbox_left_column) {
1219 print '<td class="liste_titre center maxwidthsearch">';
1220 $searchpicto = $form->showFilterButtons('left');
1221 print $searchpicto;
1222 print '</td>';
1223}
1224// Ref
1225if (!empty($arrayfields['e.ref']['checked'])) {
1226 print '<td class="liste_titre">';
1227 print '<input class="flat" size="6" type="text" name="search_ref_exp" value="'.$search_ref_exp.'">';
1228 print '</td>';
1229}
1230// Ref customer
1231if (!empty($arrayfields['e.ref_customer']['checked'])) {
1232 print '<td class="liste_titre">';
1233 print '<input class="flat" size="6" type="text" name="search_ref_customer" value="'.$search_ref_customer.'">';
1234 print '</td>';
1235}
1236// Thirdparty
1237if (!empty($arrayfields['s.nom']['checked'])) {
1238 print '<td class="liste_titre left">';
1239 print '<input class="flat" type="text" size="8" name="search_company" value="'.dol_escape_htmltag((string) $search_company).'">';
1240 print '</td>';
1241}
1242// Town
1243if (!empty($arrayfields['s.town']['checked'])) {
1244 print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
1245}
1246// Zip
1247if (!empty($arrayfields['s.zip']['checked'])) {
1248 print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
1249}
1250// State
1251if (!empty($arrayfields['state.nom']['checked'])) {
1252 print '<td class="liste_titre">';
1253 print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
1254 print '</td>';
1255}
1256// Country
1257if (!empty($arrayfields['country.code_iso']['checked'])) {
1258 print '<td class="liste_titre center">';
1259 print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
1260 print '</td>';
1261}
1262// Company type
1263if (!empty($arrayfields['typent.code']['checked'])) {
1264 print '<td class="liste_titre maxwidthonsmartphone center">';
1265 print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, getDolGlobalString('SOCIETE_SORT_ON_TYPEENT', 'ASC'), 'maxwidth75', 1);
1266 print '</td>';
1267}
1268// Weight
1269if (!empty($arrayfields['e.weight']['checked'])) {
1270 print '<td class="liste_titre maxwidthonsmartphone center">';
1271
1272 print '</td>';
1273}
1274// Date delivery planned
1275if (!empty($arrayfields['e.date_delivery']['checked'])) {
1276 print '<td class="liste_titre center">';
1277 print '<div class="nowrapfordate">';
1278 print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1279 print '</div>';
1280 print '<div class="nowrapfordate">';
1281 print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1282 print '</div>';
1283 print '</td>';
1284}
1285// Date shipping
1286if (!empty($arrayfields['e.date_expedition']['checked'])) {
1287 print '<td class="liste_titre center">';
1288 print '<div class="nowrapfordate">';
1289 print $form->selectDate($search_dateshipping_start ? $search_dateshipping_start : -1, 'search_dateshipping_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1290 print '</div>';
1291 print '<div class="nowrapfordate">';
1292 print $form->selectDate($search_dateshipping_end ? $search_dateshipping_end : -1, 'search_dateshipping_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1293 print '</div>';
1294 print '</td>';
1295}
1296if (!empty($arrayfields['e.fk_shipping_method']['checked'])) {
1297 // Delivery method
1298 print '<td class="liste_titre center">';
1299 $shipment->fetch_delivery_methods();
1300 print $form->selectarray("search_shipping_method_ids[]", $shipment->meths, $search_shipping_method_ids, 1, 0, 0, 'multiple', 1, 0, 0, '', 'maxwidth150');
1301 print "</td>\n";
1302}
1303// Tracking number
1304if (!empty($arrayfields['e.tracking_number']['checked'])) {
1305 print '<td class="liste_titre center">';
1306 print '<input class="flat" size="6" type="text" name="search_tracking" value="'.dol_escape_htmltag($search_tracking).'">';
1307 print '</td>';
1308}
1309if (!empty($arrayfields['l.ref']['checked'])) {
1310 // Delivery ref
1311 print '<td class="liste_titre">';
1312 print '<input class="flat width75" type="text" name="search_ref_liv" value="'.dol_escape_htmltag($search_ref_liv).'"';
1313 print '</td>';
1314}
1315if (!empty($arrayfields['l.date_delivery']['checked'])) {
1316 // Date reception
1317 print '<td class="liste_titre center">';
1318 print '<div class="nowrapfordate">';
1319 print $form->selectDate($search_datereceipt_start ? $search_datereceipt_start : -1, 'search_datereceipt_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1320 print '</div>';
1321 print '<div class="nowrapfordate">';
1322 print $form->selectDate($search_datereceipt_end ? $search_datereceipt_end : -1, 'search_datereceipt_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1323 print '</div>';
1324 print '</td>';
1325}
1326// Note public
1327if (!empty($arrayfields['e.note_public']['checked'])) {
1328 print '<td class="liste_titre">';
1329 print '</td>';
1330}
1331// Note private
1332if (!empty($arrayfields['e.note_private']['checked'])) {
1333 print '<td class="liste_titre">';
1334 print '</td>';
1335}
1336// Extra fields
1337include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
1338
1339// Fields from hook
1340$parameters = array('arrayfields' => $arrayfields);
1341$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1342print $hookmanager->resPrint;
1343// Date creation
1344if (!empty($arrayfields['e.datec']['checked'])) {
1345 print '<td class="liste_titre">';
1346 print '</td>';
1347}
1348// Date modification
1349if (!empty($arrayfields['e.tms']['checked'])) {
1350 print '<td class="liste_titre">';
1351 print '</td>';
1352}
1353// Status
1354if (!empty($arrayfields['e.fk_statut']['checked'])) {
1355 print '<td class="liste_titre right parentonrightofpage">';
1356 print $form->selectarray('search_status', array('0' => $langs->trans('StatusSendingDraftShort'), '1' => $langs->trans('StatusSendingValidatedShort'), '2' => $langs->trans('StatusSendingProcessedShort')), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage');
1357 print '</td>';
1358}
1359// Signed status
1360if (!empty($arrayfields['e.signed_status']['checked'])) {
1361 print '<td class="liste_titre center">';
1362 $list_signed_status = $object->getSignedStatusLocalisedArray();
1363 print $form->selectarray('search_signed_status', $list_signed_status, $search_signed_status, 1, 0, 0, '', 1, 0, 0, '', 'search_status');
1364 print '</td>';
1365}
1366// Status billed
1367if (!empty($arrayfields['e.billed']['checked'])) {
1368 print '<td class="liste_titre maxwidthonsmartphone center">';
1369 print $form->selectyesno('search_billed', $search_billed, 1, false, 1);
1370 print '</td>';
1371}
1372// Action column
1373if (!$conf->main_checkbox_left_column) {
1374 print '<td class="liste_titre center maxwidthsearch">';
1375 $searchpicto = $form->showFilterButtons();
1376 print $searchpicto;
1377 print '</td>';
1378}
1379print '</tr>'."\n";
1380
1381$totalarray = array();
1382$totalarray['nbfield'] = 0;
1383
1384// Fields title label
1385// --------------------------------------------------------------------
1386print '<tr class="liste_titre">';
1387// Action column
1388if ($conf->main_checkbox_left_column) {
1389 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
1390 $totalarray['nbfield']++;
1391}
1392if (!empty($arrayfields['e.ref']['checked'])) {
1393 // @phan-suppress-next-line PhanTypeInvalidDimOffset
1394 print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, '', $sortfield, $sortorder);
1395 $totalarray['nbfield']++;
1396}
1397if (!empty($arrayfields['e.ref_customer']['checked'])) {
1398 print_liste_field_titre($arrayfields['e.ref_customer']['label'], $_SERVER["PHP_SELF"], "e.ref_customer", "", $param, '', $sortfield, $sortorder);
1399 $totalarray['nbfield']++;
1400}
1401if (!empty($arrayfields['s.nom']['checked'])) {
1402 print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder, 'left ');
1403 $totalarray['nbfield']++;
1404}
1405if (!empty($arrayfields['s.town']['checked'])) {
1406 print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
1407 $totalarray['nbfield']++;
1408}
1409if (!empty($arrayfields['s.zip']['checked'])) {
1410 print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
1411 $totalarray['nbfield']++;
1412}
1413if (!empty($arrayfields['state.nom']['checked'])) {
1414 print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
1415 $totalarray['nbfield']++;
1416}
1417if (!empty($arrayfields['country.code_iso']['checked'])) {
1418 print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
1419 $totalarray['nbfield']++;
1420}
1421if (!empty($arrayfields['typent.code']['checked'])) {
1422 print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center ');
1423 $totalarray['nbfield']++;
1424}
1425if (!empty($arrayfields['e.weight']['checked'])) {
1426 print_liste_field_titre($arrayfields['e.weight']['label'], $_SERVER["PHP_SELF"], "e.weight", "", $param, '', $sortfield, $sortorder, 'center ');
1427 $totalarray['nbfield']++;
1428}
1429if (!empty($arrayfields['e.date_delivery']['checked'])) {
1430 print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, '', $sortfield, $sortorder, 'center ');
1431 $totalarray['nbfield']++;
1432}
1433if (!empty($arrayfields['e.date_expedition']['checked'])) {
1434 print_liste_field_titre($arrayfields['e.date_expedition']['label'], $_SERVER["PHP_SELF"], "e.date_expedition", "", $param, '', $sortfield, $sortorder, 'center ');
1435 $totalarray['nbfield']++;
1436}
1437if (!empty($arrayfields['e.fk_shipping_method']['checked'])) {
1438 print_liste_field_titre($arrayfields['e.fk_shipping_method']['label'], $_SERVER["PHP_SELF"], "e.fk_shipping_method", "", $param, '', $sortfield, $sortorder, 'center ');
1439 $totalarray['nbfield']++;
1440}
1441if (!empty($arrayfields['e.tracking_number']['checked'])) {
1442 print_liste_field_titre($arrayfields['e.tracking_number']['label'], $_SERVER["PHP_SELF"], "e.tracking_number", "", $param, '', $sortfield, $sortorder, 'center ');
1443 $totalarray['nbfield']++;
1444}
1445if (!empty($arrayfields['l.ref']['checked'])) {
1446 print_liste_field_titre($arrayfields['l.ref']['label'], $_SERVER["PHP_SELF"], "l.ref", "", $param, '', $sortfield, $sortorder);
1447 $totalarray['nbfield']++;
1448}
1449if (!empty($arrayfields['l.date_delivery']['checked'])) {
1450 print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"], "l.date_delivery", "", $param, '', $sortfield, $sortorder, 'center ');
1451 $totalarray['nbfield']++;
1452}
1453if (!empty($arrayfields['e.note_public']['checked'])) {
1454 print_liste_field_titre($arrayfields['e.note_public']['label'], $_SERVER["PHP_SELF"], "e.note_public", "", $param, '', $sortfield, $sortorder, 'right ');
1455}
1456if (!empty($arrayfields['e.note_private']['checked'])) {
1457 print_liste_field_titre($arrayfields['e.note_private']['label'], $_SERVER["PHP_SELF"], "e.note_private", "", $param, '', $sortfield, $sortorder, 'right ');
1458}
1459
1460// Extra fields
1461include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
1462// Hook fields
1463$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, '$totalarray' => &$totalarray);
1464$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1465print $hookmanager->resPrint;
1466if (!empty($arrayfields['e.datec']['checked'])) {
1467 print_liste_field_titre($arrayfields['e.datec']['label'], $_SERVER["PHP_SELF"], "e.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1468 $totalarray['nbfield']++;
1469}
1470if (!empty($arrayfields['e.tms']['checked'])) {
1471 print_liste_field_titre($arrayfields['e.tms']['label'], $_SERVER["PHP_SELF"], "e.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1472 $totalarray['nbfield']++;
1473}
1474if (!empty($arrayfields['e.fk_statut']['checked'])) {
1475 print_liste_field_titre($arrayfields['e.fk_statut']['label'], $_SERVER["PHP_SELF"], "e.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
1476 $totalarray['nbfield']++;
1477}
1478if (!empty($arrayfields['e.signed_status']['checked'])) {
1479 print_liste_field_titre($arrayfields['e.signed_status']['label'], $_SERVER["PHP_SELF"], "e.signed_status", "", $param, '', $sortfield, $sortorder, 'center ');
1480 $totalarray['nbfield']++;
1481}
1482if (!empty($arrayfields['e.billed']['checked'])) {
1483 print_liste_field_titre($arrayfields['e.billed']['label'], $_SERVER["PHP_SELF"], "e.billed", "", $param, '', $sortfield, $sortorder, 'center ');
1484 $totalarray['nbfield']++;
1485}
1486// Action column
1487if (!$conf->main_checkbox_left_column) {
1488 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
1489 $totalarray['nbfield']++;
1490}
1491print "</tr>\n";
1492
1493$typenArray = $formcompany->typent_array(1);
1494
1495// Loop on record
1496// --------------------------------------------------------------------
1497$i = 0;
1498$savnbfield = $totalarray['nbfield'];
1499$totalarray = array();
1500$totalarray['nbfield'] = 0;
1501$imaxinloop = ($limit ? min($num, $limit) : $num);
1502while ($i < $imaxinloop) {
1503 $obj = $db->fetch_object($resql);
1504 if (empty($obj)) {
1505 break; // Should not happen
1506 }
1507
1508 $companystatic->id = $obj->socid;
1509 $companystatic->ref = $obj->name;
1510 $companystatic->name = $obj->name;
1511
1512 $object = new Expedition($db);
1513 $object->fetch($obj->rowid);
1514
1515 if ($mode == 'kanban') {
1516 if ($i == 0) {
1517 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
1518 print '<div class="box-flex-container kanban">';
1519 }
1520 $object->date_delivery = $obj->delivery_date;
1521 $object->town = $obj->town;
1522
1523 // Output Kanban
1524 $selected = -1;
1525 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1526 $selected = 0;
1527 if (in_array($object->id, $arrayofselected)) {
1528 $selected = 1;
1529 }
1530 }
1531 print $object->getKanbanView('', array('thirdparty' => $companystatic->getNomUrl(1), 'selected' => $selected));
1532 if ($i == min($num, $limit) - 1) {
1533 print '</div>';
1534 print '</td></tr>';
1535 }
1536 } else {
1537 print '<tr class="oddeven row-with-select">';
1538
1539 // Action column
1540 if ($conf->main_checkbox_left_column) {
1541 print '<td class="nowrap center">';
1542 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1543 $selected = 0;
1544 if (in_array($obj->rowid, $arrayofselected)) {
1545 $selected = 1;
1546 }
1547 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1548 }
1549 print '</td>';
1550 }
1551 // Ref
1552 if (!empty($arrayfields['e.ref']['checked'])) {
1553 print '<td class="nowraponall">';
1554 print $object->getNomUrl(1);
1555 $filedir = ($conf->expedition->multidir_output[$object->entity ?? $conf->entity] ? $conf->expedition->multidir_output[$object->entity ?? $conf->entity] : $conf->expedition->dir_output).'/sending/'.get_exdir(0, 0, 0, 1, $object, '');
1556 $filename = dol_sanitizeFileName($object->ref);
1557 print $formfile->getDocumentsLink('expedition', $filename, $filedir);
1558 print "</td>\n";
1559 if (!$i) {
1560 $totalarray['nbfield']++;
1561 }
1562 }
1563
1564 // Ref customer
1565 if (!empty($arrayfields['e.ref_customer']['checked'])) {
1566 print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->ref_customer).'">';
1567 print dol_escape_htmltag($obj->ref_customer);
1568 print "</td>\n";
1569 if (!$i) {
1570 $totalarray['nbfield']++;
1571 }
1572 }
1573
1574 // Third party
1575 if (!empty($arrayfields['s.nom']['checked'])) {
1576 print '<td class="tdoverflowmax150">';
1577 print $companystatic->getNomUrl(1);
1578 print '</td>';
1579 if (!$i) {
1580 $totalarray['nbfield']++;
1581 }
1582 }
1583 // Town
1584 if (!empty($arrayfields['s.town']['checked'])) {
1585 print '<td class="nocellnopadd">';
1586 print dol_escape_htmltag($obj->town);
1587 print '</td>';
1588 if (!$i) {
1589 $totalarray['nbfield']++;
1590 }
1591 }
1592 // Zip
1593 if (!empty($arrayfields['s.zip']['checked'])) {
1594 print '<td class="nocellnopadd center">';
1595 print dol_escape_htmltag($obj->zip);
1596 print '</td>';
1597 if (!$i) {
1598 $totalarray['nbfield']++;
1599 }
1600 }
1601 // State
1602 if (!empty($arrayfields['state.nom']['checked'])) {
1603 print '<td class="center">'.$obj->state_name."</td>\n";
1604 if (!$i) {
1605 $totalarray['nbfield']++;
1606 }
1607 }
1608 // Country
1609 if (!empty($arrayfields['country.code_iso']['checked'])) {
1610 print '<td class="center">';
1611 $tmparray = getCountry($obj->fk_pays, 'all');
1612 print dol_escape_htmltag($tmparray['label']);
1613 print '</td>';
1614 if (!$i) {
1615 $totalarray['nbfield']++;
1616 }
1617 }
1618 // Type ent
1619 if (!empty($arrayfields['typent.code']['checked'])) {
1620 print '<td class="center">';
1621 if (isset($typenArray[$obj->typent_code])) {
1622 print $typenArray[$obj->typent_code];
1623 }
1624 print '</td>';
1625 if (!$i) {
1626 $totalarray['nbfield']++;
1627 }
1628 }
1629 // Weight
1630 if (!empty($arrayfields['e.weight']['checked'])) {
1631 print '<td class="center">';
1632 if (empty($object->trueWeight)) {
1633 $tmparray = $object->getTotalWeightVolume();
1634 print showDimensionInBestUnit($tmparray['weight'], 0, "weight", $langs, getDolGlobalInt('MAIN_WEIGHT_DEFAULT_ROUND', -1), getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT', 'no'));
1635 print $form->textwithpicto('', $langs->trans('EstimatedWeight'), 1);
1636 } else {
1637 print $object->trueWeight;
1638 print ($object->trueWeight && $object->weight_units != '') ? ' '.measuringUnitString(0, "weight", $object->weight_units) : '';
1639 }
1640 print '</td>';
1641 if (!$i) {
1642 $totalarray['nbfield']++;
1643 }
1644 }
1645 // Date delivery planned
1646 if (!empty($arrayfields['e.date_delivery']['checked'])) {
1647 print '<td class="center nowraponall">';
1648 print dol_print_date($db->jdate($obj->delivery_date), "dayhour");
1649 print "</td>\n";
1650 if (!$i) {
1651 $totalarray['nbfield']++;
1652 }
1653 }
1654 // Date shipping
1655 if (!empty($arrayfields['e.date_expedition']['checked'])) {
1656 print '<td class="center nowraponall">';
1657 print dol_print_date($db->jdate($obj->date_expedition), "dayhour");
1658 print "</td>\n";
1659 if (!$i) {
1660 $totalarray['nbfield']++;
1661 }
1662 }
1663 if (!empty($arrayfields['e.fk_shipping_method']['checked'])) {
1664 // Get code using getLabelFromKey
1665 $code = $langs->getLabelFromKey($db, (string) $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code');
1666 print '<td class="center tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans("SendingMethod".strtoupper($code))).'">';
1667 if ($object->shipping_method_id > 0) {
1668 print $langs->trans("SendingMethod".strtoupper($code));
1669 }
1670 print '</td>';
1671 if (!$i) {
1672 $totalarray['nbfield']++;
1673 }
1674 }
1675 // Tracking number
1676 if (!empty($arrayfields['e.tracking_number']['checked'])) {
1677 $object->getUrlTrackingStatus($obj->tracking_number);
1678 print '<td class="center" title="'.dol_escape_htmltag($object->tracking_url).'">'.$object->tracking_url."</td>\n";
1679 if (!$i) {
1680 $totalarray['nbfield']++;
1681 }
1682 }
1683
1684 if (!empty($arrayfields['l.ref']['checked']) || !empty($arrayfields['l.date_delivery']['checked'])) {
1685 $object->fetchObjectLinked();
1686 $receiving = '';
1687 if (array_key_exists('delivery', $object->linkedObjects) && count($object->linkedObjects['delivery']) > 0) {
1688 $receiving = reset($object->linkedObjects['delivery']);
1689 }
1690
1691 if (!empty($arrayfields['l.ref']['checked'])) {
1692 // Ref
1693 print '<td class="nowraponall">';
1694 print !empty($receiving) ? $receiving->getNomUrl($db) : '';
1695 print '</td>';
1696 }
1697
1698 if (!empty($arrayfields['l.date_delivery']['checked'])) {
1699 // Date received
1700 print '<td class="center nowraponall">';
1701 print dol_print_date($db->jdate($obj->date_reception), "day");
1702 print '</td>'."\n";
1703 }
1704 }
1705 // Note public
1706 if (!empty($arrayfields['e.note_public']['checked'])) {
1707 print '<td class="sensiblehtmlcontent center">';
1708 print '<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_public, 5)).'</div>';
1709 print '</td>';
1710 if (!$i) {
1711 $totalarray['nbfield']++;
1712 }
1713 }
1714 // Note private
1715 if (!empty($arrayfields['e.note_private']['checked'])) {
1716 print '<td class="sensiblehtmlcontent center">';
1717 print '<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_private, 5)).'</div>';
1718 print '</td>';
1719 if (!$i) {
1720 $totalarray['nbfield']++;
1721 }
1722 }
1723 // Extra fields
1724 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1725 // Fields from hook
1726 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1727 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1728 print $hookmanager->resPrint;
1729 // Date creation
1730 if (!empty($arrayfields['e.datec']['checked'])) {
1731 print '<td class="center nowraponall">';
1732 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuserrel');
1733 print '</td>';
1734 if (!$i) {
1735 $totalarray['nbfield']++;
1736 }
1737 }
1738 // Date modification
1739 if (!empty($arrayfields['e.tms']['checked'])) {
1740 print '<td class="center nowraponall">';
1741 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
1742 print '</td>';
1743 if (!$i) {
1744 $totalarray['nbfield']++;
1745 }
1746 }
1747 // Status
1748 if (!empty($arrayfields['e.fk_statut']['checked'])) {
1749 print '<td class="right nowrap">'.$object->getLibStatut(5).'</td>';
1750 if (!$i) {
1751 $totalarray['nbfield']++;
1752 }
1753 }
1754 // Signed Status
1755 if (!empty($arrayfields['e.signed_status']['checked'])) {
1756 print '<td class="center">'.$object->getLibSignedStatus(5).'</td>';
1757 if (!$i) {
1758 $totalarray['nbfield']++;
1759 }
1760 }
1761 // Billed
1762 if (!empty($arrayfields['e.billed']['checked'])) {
1763 print '<td class="center">'.yn($obj->billed).'</td>';
1764 if (!$i) {
1765 $totalarray['nbfield']++;
1766 }
1767 }
1768
1769 // Action column
1770 if (!$conf->main_checkbox_left_column) {
1771 print '<td class="nowrap center">';
1772 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1773 $selected = 0;
1774 if (in_array($obj->rowid, $arrayofselected)) {
1775 $selected = 1;
1776 }
1777 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1778 }
1779 print '</td>';
1780 }
1781 if (!$i) {
1782 $totalarray['nbfield']++;
1783 }
1784
1785 print "</tr>\n";
1786 }
1787 $i++;
1788}
1789
1790// If no record found
1791if ($num == 0) {
1792 $colspan = 1;
1793 foreach ($arrayfields as $key => $val) {
1794 if (!empty($val['checked'])) {
1795 $colspan++;
1796 }
1797 }
1798 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1799}
1800
1801$db->free($resql);
1802
1803$parameters = array('arrayfields' => $arrayfields, 'totalarray' => $totalarray, 'sql' => $sql);
1804$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1805print $hookmanager->resPrint;
1806
1807print "</table>";
1808print "</div>";
1809print '</form>';
1810
1811$hidegeneratedfilelistifempty = 1;
1812if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1813 $hidegeneratedfilelistifempty = 0;
1814}
1815
1816// Show list of available documents
1817$urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1818$urlsource .= str_replace('&amp;', '&', $param);
1819
1820$filedir = $diroutputmassaction;
1821$genallowed = $user->hasRight('expedition', 'lire');
1822$delallowed = $user->hasRight('expedition', 'creer');
1823$title = '';
1824
1825print $formfile->showdocuments('massfilesarea_sendings', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1826
1827// End of page
1828llxFooter();
1829$db->close();
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
$totalarray
Definition list.php:501
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
Class to manage customers orders.
Class to manage absolute discounts.
Class to manage invoices.
Class to build HTML component for third parties management Only common components are here.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class to help generate other html components Only common components are here.
Class to manage third parties objects (customers, suppliers, prospects...)
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
$date_start
Variables from include:
dol_now($mode='gmt')
Return date for now.
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...
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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...
if(!function_exists( 'dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
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.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0, $attop=0)
Set event message in dol_events session object.
showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput='no', $use_short_label=0)
Output a dimension with best unit.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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...
Definition html.lib.php:172
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
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.