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