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.'/core/lib/sendings.lib.php';
53require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
54
55// Load translation files required by the page
56$langs->loadLangs(array("sendings", 'companies', 'bills', 'products', 'orders'));
57
58$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'shipmentlist'; // To manage different context of search
59
60$socid = GETPOSTINT('socid');
61
62$action = GETPOST('action', 'alpha');
63$massaction = GETPOST('massaction', 'alpha');
64$show_files = GETPOSTINT('show_files');
65$toselect = GETPOST('toselect', 'array:int');
66$optioncss = GETPOST('optioncss', 'alpha');
67$mode = GETPOST('mode', 'alpha');
68
69$search_ref_exp = GETPOST("search_ref_exp", 'alpha');
70$search_ref_liv = GETPOST('search_ref_liv', 'alpha');
71$search_ref_customer = GETPOST('search_ref_customer', 'alpha');
72$search_company = GETPOST("search_company", 'alpha');
73$search_shipping_method_ids = GETPOST('search_shipping_method_ids', 'array:int');
74$search_tracking = GETPOST("search_tracking", 'alpha');
75$search_town = GETPOST('search_town', 'alpha');
76$search_zip = GETPOST('search_zip', 'alpha');
77$search_state = GETPOST("search_state", 'alpha');
78$search_country = GETPOST("search_country", 'aZ09');
79$search_type_thirdparty = GETPOST("search_type_thirdparty", 'intcomma');
80$search_billed = GETPOST("search_billed", 'intcomma');
81$search_dateshipping_start = dol_mktime(0, 0, 0, GETPOSTINT('search_dateshipping_startmonth'), GETPOSTINT('search_dateshipping_startday'), GETPOSTINT('search_dateshipping_startyear'));
82$search_dateshipping_end = dol_mktime(23, 59, 59, GETPOSTINT('search_dateshipping_endmonth'), GETPOSTINT('search_dateshipping_endday'), GETPOSTINT('search_dateshipping_endyear'));
83$search_datedelivery_start = dol_mktime(0, 0, 0, GETPOSTINT('search_datedelivery_startmonth'), GETPOSTINT('search_datedelivery_startday'), GETPOSTINT('search_datedelivery_startyear'));
84$search_datedelivery_end = dol_mktime(23, 59, 59, GETPOSTINT('search_datedelivery_endmonth'), GETPOSTINT('search_datedelivery_endday'), GETPOSTINT('search_datedelivery_endyear'));
85$search_datereceipt_start = dol_mktime(0, 0, 0, GETPOSTINT('search_datereceipt_startmonth'), GETPOSTINT('search_datereceipt_startday'), GETPOSTINT('search_datereceipt_startyear'));
86$search_datereceipt_end = dol_mktime(23, 59, 59, GETPOSTINT('search_datereceipt_endmonth'), GETPOSTINT('search_datereceipt_endday'), GETPOSTINT('search_datereceipt_endyear'));
87$search_all = trim(GETPOST('search_all', 'alphanohtml'));
88$search_user = GETPOST('search_user', 'intcomma');
89$search_sale = GETPOST('search_sale', 'intcomma');
90$search_categ_cus = GETPOST("search_categ_cus", 'intcomma');
91$search_product_category = GETPOST('search_product_category', 'intcomma');
92
93$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
94$sortfield = GETPOST('sortfield', 'aZ09comma');
95$sortorder = GETPOST('sortorder', 'aZ09comma');
96$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
97if (!$sortfield) {
98 $sortfield = "e.ref";
99}
100if (!$sortorder) {
101 $sortorder = "DESC";
102}
103if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
104 // If $page is not defined, or '' or -1 or if we click on clear filters
105 $page = 0;
106}
107$offset = $limit * $page;
108$pageprev = $page - 1;
109$pagenext = $page + 1;
110
111$search_status = GETPOST('search_status', 'intcomma');
112$search_signed_status = GETPOST('search_signed_status', 'alpha');
113
114$diroutputmassaction = $conf->expedition->dir_output.'/sending/temp/massgeneration/'.$user->id;
115
116$object = new Expedition($db);
117
118// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
119$hookmanager->initHooks(array('shipmentlist'));
120
121// Fetch optionals attributes and labels
122$extrafields->fetch_name_optionals_label($object->table_element);
123
124$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
125
126// List of fields to search into when doing a "search in all"
127$fieldstosearchall = array(
128 'e.ref' => "Ref",
129 's.nom' => "ThirdParty",
130 'e.note_public' => 'NotePublic',
131 //'e.fk_shipping_method'=>'SendingMethod', // TODO fix this, does not work
132 'e.tracking_number' => "TrackingNumber",
133);
134if (empty($user->socid)) {
135 $fieldstosearchall["e.note_private"] = "NotePrivate";
136}
137
138$checkedtypetiers = '0';
139$arrayfields = array(
140 'e.ref' => array('label' => $langs->trans("Ref"), 'checked' => '1', 'position' => 1),
141 'e.ref_customer' => array('label' => $langs->trans("RefCustomer"), 'checked' => '1', 'position' => 2),
142 's.nom' => array('label' => $langs->trans("ThirdParty"), 'checked' => '1', 'position' => 3),
143 's.town' => array('label' => $langs->trans("Town"), 'checked' => '1', 'position' => 4),
144 's.zip' => array('label' => $langs->trans("Zip"), 'checked' => '-1', 'position' => 5),
145 'state.nom' => array('label' => $langs->trans("StateShort"), 'checked' => '0', 'position' => 6),
146 'country.code_iso' => array('label' => $langs->trans("Country"), 'checked' => '0', 'position' => 7),
147 'typent.code' => array('label' => $langs->trans("ThirdPartyType"), 'checked' => $checkedtypetiers, 'position' => 8),
148 'e.date_delivery' => array('label' => $langs->trans("DateDeliveryPlanned"), 'checked' => '1', 'position' => 9),
149 'e.date_expedition' => array('label' => $langs->trans("DateShipping"), 'checked' => '1', 'position' => 10),
150 'e.fk_shipping_method' => array('label' => $langs->trans('SendingMethod'), 'checked' => '1', 'position' => 11),
151 'e.tracking_number' => array('label' => $langs->trans("TrackingNumber"), 'checked' => '1', 'position' => 12),
152 'e.weight' => array('label' => $langs->trans("Weight"), 'checked' => '0', 'position' => 13),
153 'e.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => '0', 'position' => 500),
154 'e.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => '0', 'position' => 500),
155 'e.fk_statut' => array('label' => $langs->trans("Status"), 'checked' => '1', 'position' => 1000),
156 'e.signed_status' => array('label' => 'Signed status', 'checked' => '0', 'position' => 1001),
157 'l.ref' => array('label' => $langs->trans("DeliveryRef"), 'checked' => '1', 'position' => 1010, 'enabled' => (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') ? '1' : '0')),
158 'l.date_delivery' => array('label' => $langs->trans("DateReceived"), 'position' => 1020, 'checked' => '1', 'enabled' => (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') ? '1' : '0')),
159 'e.billed' => array('label' => $langs->trans("Billed"), 'checked' => '1', 'position' => 1100, 'enabled' => 'getDolGlobalString("WORKFLOW_BILL_ON_SHIPMENT") !== "0"'),
160 'e.note_public' => array('label' => 'NotePublic', 'checked' => '0', 'enabled' => (string) (int) (!getDolGlobalString('MAIN_LIST_HIDE_PUBLIC_NOTES')), 'position' => 135),
161 'e.note_private' => array('label' => 'NotePrivate', 'checked' => '0', 'enabled' => (string) (int) (!getDolGlobalString('MAIN_LIST_HIDE_PRIVATE_NOTES')), 'position' => 140),
162);
163
164// Extra fields
165include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
166
167// Add hook to complete $arrayfields
168$parameters = array('arrayfields' => &$arrayfields);
169$reshook = $hookmanager->executeHooks('completeArrayFields', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
170
171$object->fields = dol_sort_array($object->fields, 'position');
172$arrayfields = dol_sort_array($arrayfields, 'position');
173
174// Security check
175$expeditionid = GETPOSTINT('id');
176if ($user->socid) {
177 $socid = $user->socid;
178}
179$result = restrictedArea($user, 'expedition', $expeditionid, '');
180
181
182
183/*
184 * Actions
185 */
186$error = 0;
187
188if (GETPOST('cancel', 'alpha')) {
189 $action = 'list';
190 $massaction = '';
191}
192if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') {
193 $massaction = '';
194}
195
196$parameters = array('socid' => $socid, 'arrayfields' => &$arrayfields);
197$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
198if ($reshook < 0) {
199 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
200}
201
202include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
203
204// Purge search criteria
205if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
206 $search_user = '';
207 $search_sale = '';
208 $search_product_category = '';
209 $search_ref_exp = '';
210 $search_ref_liv = '';
211 $search_ref_customer = '';
212 $search_company = '';
213 $search_town = '';
214 $search_zip = "";
215 $search_state = "";
216 $search_type = '';
217 $search_country = '';
218 $search_tracking = '';
219 $search_shipping_method_ids = [];
220 $search_type_thirdparty = '';
221 $search_billed = '';
222 $search_dateshipping_start = '';
223 $search_dateshipping_end = '';
224 $search_datedelivery_start = '';
225 $search_datedelivery_end = '';
226 $search_datereceipt_start = '';
227 $search_datereceipt_end = '';
228 $search_status = '';
229 $search_signed_status = '';
230 $toselect = array();
231 $search_array_options = array();
232 $search_categ_cus = 0;
233 $search_all = '';
234}
235
236if (empty($reshook)) {
237 $objectclass = 'Expedition';
238 $objectlabel = 'Sendings';
239 $permissiontoread = $user->hasRight('expedition', 'lire');
240 $permissiontoadd = $user->hasRight('expedition', 'creer');
241 $permissiontodelete = $user->hasRight('expedition', 'supprimer');
242 $uploaddir = $conf->expedition->dir_output.'/sending';
243 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
244
245 if (!$error && $massaction == 'confirm_createbills') { // Create bills from sendings.
246 $sendings = $toselect; // Ids already checked for access by the mass actions include
247 $createbills_onebythird = GETPOST('createbills_onebythird', 'int');
248 $validate_invoices = GETPOST('validate_invoices', 'int');
249
250 $errors = array();
251
252 $TFact = array();
253 $TFactThird = array();
254 $TFactThirdNbLines = array();
255
256 $nb_bills_created = 0;
257 $lastid = 0;
258 $lastref = '';
259
260 $db->begin();
261
262 $nbSendings = is_array($sendings) ? count($sendings) : 1;
263
264 foreach ($sendings as $id_sending) {
265 $expd = new Expedition($db);
266 if ($expd->fetch($id_sending) <= 0) {
267 continue;
268 }
269 $expd->fetch_thirdparty();
270
271 $objecttmp = new Facture($db);
272
273 dol_include_once('/commande/class/commande.class.php');
274 $expdCmdSrc = new Commande($db);
275 $expdCmdSrc->fetch($expd->origin_id);
276
277 if (!empty($createbills_onebythird) && !empty($TFactThird[$expd->socid])) {
278 // If option "one bill per third" is set, and an invoice for this thirdparty was already created, we reuse it.
279 $objecttmp = $TFactThird[$expd->socid];
280 } else {
281 // If we want one invoice per sending or if there is no first invoice yet for this thirdparty.
282 $objecttmp->socid = $expd->socid;
283 $objecttmp->thirdparty = $expd->thirdparty;
284
285 $objecttmp->type = $objecttmp::TYPE_STANDARD;
286 $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);
287 $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);
288
289 $objecttmp->fk_project = $expd->fk_project;
290 $objecttmp->multicurrency_code = !empty($expdCmdSrc->multicurrency_code) ? $expdCmdSrc->multicurrency_code : (!empty($objecttmp->thirdparty->multicurrency_code) ? $objecttmp->thirdparty->multicurrency_code : $expd->multicurrency_code);
291 if (empty($createbills_onebythird)) {
292 $objecttmp->ref_customer = $expd->ref_customer;
293 }
294
295 $datefacture = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'));
296 if (empty($datefacture)) {
297 $datefacture = dol_now();
298 }
299
300 $objecttmp->date = $datefacture;
301 $objecttmp->origin_type = 'shipping';
302 $objecttmp->origin_id = (int) $id_sending;
303
304 $objecttmp->array_options = $expd->array_options; // Copy extrafields
305
306 $res = $objecttmp->create($user);
307
308 if ($res > 0) {
309 $nb_bills_created++;
310 $lastref = $objecttmp->ref;
311 $lastid = $objecttmp->id;
312
313 $TFactThird[$expd->socid] = $objecttmp;
314 $TFactThirdNbLines[$expd->socid] = 0; //init nblines to have lines ordered by expedition and rang
315 } else {
316 $langs->load("errors");
317 $errors[] = $expd->ref.' : '.$langs->trans($objecttmp->errors[0]);
318 $error++;
319 }
320 }
321
322 if ($objecttmp->id > 0) {
323 $res = $objecttmp->add_object_linked($objecttmp->origin_type, $id_sending);
324
325 if ($res == 0) {
326 $errors[] = $expd->ref.' : '.$langs->trans($objecttmp->errors[0]);
327 $error++;
328 }
329
330 $expd->fetchObjectLinked();
331 foreach ($expd->linkedObjectsIds as $sourcetype => $TIds) {
332 if ($sourcetype == 'facture') {
333 continue;
334 }
335 if (!empty($createbills_onebythird) && !empty($TFactThird[$expd->socid])) {
336 $objecttmp->fetchObjectLinked($object->id, 'commande');
337 foreach ($objecttmp->linkedObjectsIds as $tmpSourcetype => $tmpTIds) {
338 if ($tmpSourcetype == $sourcetype) {
339 if (!empty(array_intersect($TIds, $tmpTIds))) {
340 continue 2;
341 }
342 }
343 }
344 }
345
346 $res = $objecttmp->add_object_linked($sourcetype, current($TIds));
347
348 if ($res == 0) {
349 $errors[] = $expd->ref.' : '.$langs->trans($objecttmp->errors[0]);
350 $error++;
351 }
352 }
353
354 if (!$error) {
355 $lines = $expd->lines;
356 if (empty($lines) && method_exists($expd, 'fetch_lines')) {
357 $expd->fetch_lines();
358 $lines = $expd->lines;
359 }
360
361 $fk_parent_line = 0;
362 $num = count($lines);
363
364 for ($i = 0; $i < $num; $i++) {
365 // A standalone shipment line (SHIPMENT_STANDALONE) has no price nor VAT: use the selling price of the product for this customer
366 if (empty($expd->origin_id)) {
367 shippingSetStandaloneLineSellPrice($lines[$i], $expd->thirdparty);
368 }
369
370 $desc = ($lines[$i]->desc ? $lines[$i]->desc : '');
371 // If we build one invoice for several sendings, we must put the ref of sending on the invoice line
372 if (!empty($createbills_onebythird)) {
373 $desc = dol_concatdesc($desc, (!empty($expd->origin_id) ? $langs->trans("Order").': '.$expdCmdSrc->ref. ' - ' : '').$langs->trans("Shipment").': '.$expd->ref.($expd->date_shipping ? ' - '.dol_print_date($expd->date_shipping, 'day') : ''));
374 }
375
376 if ($lines[$i]->subprice < 0 && !getDolGlobalString('INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN')) {
377 // Negative line, we create a discount line
378 $discount = new DiscountAbsolute($db);
379 $discount->socid = $objecttmp->socid;
380 $discount->amount_ht = abs($lines[$i]->total_ht);
381 $discount->amount_tva = abs($lines[$i]->total_tva);
382 $discount->amount_ttc = abs($lines[$i]->total_ttc);
383 $discount->tva_tx = $lines[$i]->tva_tx;
384 $discount->fk_user = $user->id;
385 $discount->description = $desc;
386 $discountid = $discount->create($user);
387 if ($discountid > 0) {
388 $result = $objecttmp->insert_discount($discountid);
389 //$result=$discount->link_to_invoice($lineid,$id);
390 } else {
391 setEventMessages($discount->error, $discount->errors, 'errors');
392 $error++;
393 break;
394 }
395 } else {
396 // Positive line
397 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
398 // Date start
399 $date_start = false;
400 if ($lines[$i]->date_debut_prevue) {
401 $date_start = $lines[$i]->date_debut_prevue;
402 }
403 if ($lines[$i]->date_debut_reel) {
404 $date_start = $lines[$i]->date_debut_reel;
405 }
406 if ($lines[$i]->date_start) {
407 $date_start = $lines[$i]->date_start;
408 }
409 //Date end
410 $date_end = false;
411 if ($lines[$i]->date_fin_prevue) {
412 $date_end = $lines[$i]->date_fin_prevue;
413 }
414 if ($lines[$i]->date_fin_reel) {
415 $date_end = $lines[$i]->date_fin_reel;
416 }
417 if ($lines[$i]->date_end) {
418 $date_end = $lines[$i]->date_end;
419 }
420 // Reset fk_parent_line for no child products and special product
421 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
422 $fk_parent_line = 0;
423 }
424
425 // Extrafields
426 if (method_exists($lines[$i], 'fetch_optionals')) {
427 $lines[$i]->fetch_optionals();
428 $array_options = $lines[$i]->array_options;
429 }
430
431 $objecttmp->context['createfromclone'] = 'createfromclone';
432
433 $rang = ($nbSendings > 1) ? -1 : $lines[$i]->rang;
434 //there may already be rows from previous sendings
435 if (!empty($createbills_onebythird)) {
436 $rang = $TFactThirdNbLines[$expd->socid];
437 }
438
439 $result = $objecttmp->addline(
440 $desc,
441 $lines[$i]->subprice,
442 $lines[$i]->qty,
443 $lines[$i]->tva_tx,
444 $lines[$i]->localtax1_tx,
445 $lines[$i]->localtax2_tx,
446 $lines[$i]->fk_product,
447 $lines[$i]->remise_percent,
449 $date_end,
450 0,
451 (int) $lines[$i]->info_bits,
452 $lines[$i]->fk_remise_except,
453 'HT',
454 0,
455 $product_type,
456 $rang,
457 $lines[$i]->special_code,
458 $objecttmp->origin_type,
459 $lines[$i]->rowid,
460 $fk_parent_line,
461 $lines[$i]->fk_fournprice,
462 $lines[$i]->pa_ht,
463 $lines[$i]->label,
464 !empty($array_options) ? $array_options : '',
465 100,
466 0,
467 $lines[$i]->fk_unit
468 );
469 if ($result > 0) {
470 $lineid = $result;
471 if (!empty($createbills_onebythird)) { //increment rang to keep sending
472 $TFactThirdNbLines[$expd->socid]++;
473 }
474 } else {
475 $lineid = 0;
476 $error++;
477 $errors[] = $objecttmp->error;
478 break;
479 }
480 // Defined the new fk_parent_line
481 if ($result > 0 && $lines[$i]->product_type == 9) {
482 $fk_parent_line = $result;
483 }
484 }
485 }
486 }
487 }
488
489 if (!empty($createbills_onebythird) && empty($TFactThird[$expd->socid])) {
490 $TFactThird[$expd->socid] = $objecttmp;
491 } else {
492 $TFact[$objecttmp->id] = $objecttmp;
493 }
494 }
495
496 // Build doc with all invoices
497 $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
498 $toselect = array();
499
500 if (!$error && $validate_invoices) {
501 $massaction = $action = 'builddoc';
502
503 foreach ($TAllFact as &$objecttmp) {
504 $result = $objecttmp->validate($user);
505 if ($result <= 0) {
506 $error++;
507 setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
508 break;
509 }
510
511 $id = $objecttmp->id; // For builddoc action
512
513 // Builddoc
514 $donotredirect = 1;
515 $upload_dir = $conf->facture->dir_output;
516 $permissiontoadd = $user->hasRight('facture', 'creer');
517
518 // Call action to build doc
519 $savobject = $object;
520 $object = $objecttmp;
521 include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
522 $object = $savobject;
523 }
524
525 $massaction = $action = 'confirm_createbills';
526 }
527
528 if (!$error) {
529 $db->commit();
530
531 if ($nb_bills_created == 1) {
532 $texttoshow = $langs->trans('BillXCreated', '{s1}');
533 $texttoshow = str_replace('{s1}', '<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?id='.urlencode(strval($lastid)).'">'.$lastref.'</a>', $texttoshow);
534 setEventMessages($texttoshow, null, 'mesgs');
535 } else {
536 setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs');
537 }
538
539 // Make a redirect to avoid to bill twice if we make a refresh or back
540 $param = '';
541 if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
542 $param .= '&contextpage='.urlencode($contextpage);
543 }
544 if ($limit > 0 && $limit != $conf->liste_limit) {
545 $param .= '&limit='.((int) $limit);
546 }
547 if ($search_all) {
548 $param .= "&search_all=".urlencode($search_all);
549 }
550 if ($search_ref_exp) {
551 $param .= "&search_ref_exp=".urlencode($search_ref_exp);
552 }
553 if ($search_ref_liv) {
554 $param .= "&search_ref_liv=".urlencode($search_ref_liv);
555 }
556 if ($search_ref_customer) {
557 $param .= "&search_ref_customer=".urlencode($search_ref_customer);
558 }
559 if ($search_user > 0) {
560 $param .= '&search_user='.urlencode($search_user);
561 }
562 if ($search_sale > 0) {
563 $param .= '&search_sale='.urlencode($search_sale);
564 }
565 if ($search_company) {
566 $param .= "&search_company=".urlencode($search_company);
567 }
568 if ($search_shipping_method_ids) {
569 foreach ($search_shipping_method_ids as $value) {
570 $param .= "&search_shipping_method_ids[]=".urlencode($value);
571 }
572 }
573 if ($search_tracking) {
574 $param .= "&search_tracking=".urlencode($search_tracking);
575 }
576 if ($search_town) {
577 $param .= '&search_town='.urlencode($search_town);
578 }
579 if ($search_zip) {
580 $param .= '&search_zip='.urlencode($search_zip);
581 }
582 if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
583 $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty);
584 }
585 if ($search_dateshipping_start) {
586 $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'));
587 }
588 if ($search_dateshipping_end) {
589 $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'));
590 }
591 if ($search_datedelivery_start) {
592 $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'));
593 }
594 if ($search_datedelivery_end) {
595 $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'));
596 }
597 if ($search_datereceipt_start) {
598 $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'));
599 }
600 if ($search_datereceipt_end) {
601 $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'));
602 }
603 if ($search_product_category != '') {
604 $param .= '&search_product_category='.urlencode($search_product_category);
605 }
606 if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
607 $param .= '&search_categ_cus='.urlencode($search_categ_cus);
608 }
609 if ($search_status != '') {
610 $param .= '&search_status='.urlencode($search_status);
611 }
612 if ($search_signed_status != '' && $search_signed_status >= 0) {
613 $param .= '&search_signed_status='.urlencode($search_signed_status);
614 }
615 if ($optioncss != '') {
616 $param .= '&optioncss='.urlencode($optioncss);
617 }
618 if ($search_billed != '') {
619 $param .= '&billed='.urlencode($search_billed);
620 }
621
622 header("Location: ".$_SERVER['PHP_SELF'].'?'.$param);
623 exit;
624 } else {
625 $db->rollback();
626
627 $action = 'create';
628 $_GET["origin"] = GETPOST("origin", 'alpha');
629 $_GET["originid"] = GETPOSTINT("originid");
630 if (!empty($errors)) {
631 setEventMessages(null, $errors, 'errors');
632 } else {
633 setEventMessages("Error", null, 'errors');
634 }
635 $error++;
636 }
637 }
638
639 // If massaction is close
640 if ($massaction == 'classifyclose' && $permissiontoadd) {
641 $error = 0;
642 $selectids = GETPOST('toselect', 'array:int');
643 foreach ($selectids as $selectid) {
644 // $object->fetch($selectid);
645 $object->fetch($selectid);
646 $result = $object->setClosed();
647 if ($result < 0) {
648 setEventMessages($object->error, $object->errors, 'errors');
649 $error++;
650 }
651 }
652
653 $massaction = $action = 'classifyclose';
654
655 if (!$error) {
656 setEventMessage($langs->trans("Close Done"));
657 header('Location: '.$_SERVER["PHP_SELF"]);
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 {
912 dol_print_error($db);
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) {
931 dol_print_error($db);
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 'presend' => img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
1056);
1057if ($user->hasRight('expedition', 'creer')) {
1058 $arrayofmassactions['classifyclose'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("Close");
1059}
1060if ($user->hasRight('facture', 'creer')) {
1061 $arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomerFromSendings");
1062}
1063if (in_array($massaction, array('presend', 'createbills'))) {
1064 $arrayofmassactions = array();
1065}
1066$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
1067
1068// Currently: a sending can't create from sending list
1069// $url = DOL_URL_ROOT.'/expedition/card.php?action=create';
1070// if (!empty($socid)) $url .= '&socid='.$socid;
1071// $newcardbutton = dolGetButtonTitle($langs->trans('NewSending'), '', 'fa fa-plus-circle', $url, '', $user->rights->expedition->creer);
1072$newcardbutton = '';
1073$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'));
1074$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'));
1075$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'));
1076$newcardbutton .= dolGetButtonTitleSeparator();
1077$newcardbutton .= dolGetButtonTitle($langs->trans('NewSending'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/expedition/card.php?action=create', '', $user->hasRight('expedition', 'creer'));
1078
1079$i = 0;
1080print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
1081if ($optioncss != '') {
1082 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
1083}
1084print '<input type="hidden" name="token" value="'.newToken().'">';
1085print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1086print '<input type="hidden" name="action" value="list">';
1087print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
1088print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
1089print '<input type="hidden" name="socid" value="'.$socid.'">';
1090print '<input type="hidden" name="mode" value="'.$mode.'">';
1091
1092// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
1093print_barre_liste($langs->trans('Shipments'), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'dolly', 0, $newcardbutton, '', $limit, 0, 0, 1);
1094
1095$topicmail = "SendShippingRef";
1096$modelmail = "shipping_send";
1097$objecttmp = new Expedition($db);
1098$trackid = 'shi'.$object->id;
1099include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
1100
1101if ($massaction == 'createbills') {
1102 print '<input type="hidden" name="massaction" value="confirm_createbills">';
1103
1104 print '<table class="noborder centpercent">';
1105 print '<tr>';
1106 print '<td class="titlefield">';
1107 print $langs->trans('DateInvoice');
1108 print '</td>';
1109 print '<td>';
1110 print $form->selectDate('', '', 0, 0, 0, '', 1, 1);
1111 print '</td>';
1112 print '</tr>';
1113 print '<tr>';
1114 print '<td>';
1115 print $langs->trans('CreateOneBillByThird');
1116 print '</td>';
1117 print '<td>';
1118 print $form->selectyesno('createbills_onebythird', '', 1);
1119 print '</td>';
1120 print '</tr>';
1121 print '<tr>';
1122 print '<td>';
1123 print $langs->trans('ValidateInvoices');
1124 print '</td>';
1125 print '<td>';
1126 if (!empty($conf->stock->enabled) && getDolGlobalString('STOCK_CALCULATE_ON_BILL')) {
1127 print $form->selectyesno('validate_invoices', 0, 1, true);
1128 $langs->load("errors");
1129 print ' ('.$langs->trans("WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal").')';
1130 } else {
1131 print $form->selectyesno('validate_invoices', 0, 1);
1132 }
1133 if (!empty($conf->workflow->enabled) && getDolGlobalString('WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER')) {
1134 print ' &nbsp; &nbsp; <span class="opacitymedium">'.$langs->trans("IfValidateInvoiceIsNoSendingStayUnbilled").'</span>';
1135 } else {
1136 print ' &nbsp; &nbsp; <span class="opacitymedium">'.$langs->trans("OptionToSetSendingBilledNotEnabled").'</span>';
1137 }
1138 print '</td>';
1139 print '</tr>';
1140 print '</table>';
1141
1142 print '<br>';
1143 print '<div class="center">';
1144 print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('CreateInvoiceForThisCustomerFromSendings').'"> ';
1145 print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
1146 print '</div>';
1147 print '<br>';
1148}
1149
1150if ($search_all) {
1151 foreach ($fieldstosearchall as $key => $val) {
1152 $fieldstosearchall[$key] = $langs->trans($val);
1153 }
1154 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>';
1155}
1156
1157$moreforfilter = '';
1158
1159// If the user can view prospects other than his'
1160if ($user->hasRight('user', 'user', 'lire')) {
1161 $langs->load("commercial");
1162 $moreforfilter .= '<div class="divsearchfield">';
1163 $tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
1164 $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"');
1165 $moreforfilter .= $formother->select_salesrepresentatives($search_sale, 'search_sale', $user, 0, $tmptitle, 'maxwidth200');
1166 $moreforfilter .= '</div>';
1167}
1168// If the user can view other users
1169if ($user->hasRight('user', 'user', 'lire')) {
1170 $moreforfilter .= '<div class="divsearchfield">';
1171 $tmptitle = $langs->trans('LinkedToSpecificUsers');
1172 $moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"');
1173 $moreforfilter .= $form->select_dolusers($search_user, 'search_user', $tmptitle, null, 0, '', '', '0', 0, 0, '', 0, '', 'maxwidth200');
1174 $moreforfilter .= '</div>';
1175}
1176// If the user can view prospects other than his'
1177if (isModEnabled('category') && $user->hasRight('categorie', 'lire') && ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire'))) {
1178 include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
1179 $moreforfilter .= '<div class="divsearchfield">';
1180 $tmptitle = $langs->trans('IncludingProductWithTag');
1181 $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"');
1182 $moreforfilter .= $formother->select_categories(Categorie::TYPE_PRODUCT, (int) $search_product_category, 'search_product_category', 1, $tmptitle);
1183 $moreforfilter .= '</div>';
1184}
1185if (isModEnabled('category') && $user->hasRight('categorie', 'lire')) {
1186 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
1187 $moreforfilter .= '<div class="divsearchfield">';
1188 $tmptitle = $langs->trans('CustomersProspectsCategoriesShort');
1189 $moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"');
1190 $moreforfilter .= $formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $tmptitle);
1191 $moreforfilter .= '</div>';
1192}
1193$parameters = array();
1194$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1195if (empty($reshook)) {
1196 $moreforfilter .= $hookmanager->resPrint;
1197} else {
1198 $moreforfilter = $hookmanager->resPrint;
1199}
1200
1201if (!empty($moreforfilter)) {
1202 print '<div class="liste_titre liste_titre_bydiv centpercent">';
1203 print $moreforfilter;
1204 print '</div>';
1205}
1206
1207$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
1208$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // @phan-suppress-current-line PhanTypeMismatchArgument
1209if ($massactionbutton) {
1210 $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); // This also change content of $arrayfields
1211}
1212
1213print '<div class="div-table-responsive">';
1214print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
1215
1216// Fields title search
1217// --------------------------------------------------------------------
1218print '<tr class="liste_titre_filter">';
1219// Action column
1220if ($conf->main_checkbox_left_column) {
1221 print '<td class="liste_titre center maxwidthsearch">';
1222 $searchpicto = $form->showFilterButtons('left');
1223 print $searchpicto;
1224 print '</td>';
1225}
1226// Ref
1227if (!empty($arrayfields['e.ref']['checked'])) {
1228 print '<td class="liste_titre">';
1229 print '<input class="flat" size="6" type="text" name="search_ref_exp" value="'.$search_ref_exp.'">';
1230 print '</td>';
1231}
1232// Ref customer
1233if (!empty($arrayfields['e.ref_customer']['checked'])) {
1234 print '<td class="liste_titre">';
1235 print '<input class="flat" size="6" type="text" name="search_ref_customer" value="'.$search_ref_customer.'">';
1236 print '</td>';
1237}
1238// Thirdparty
1239if (!empty($arrayfields['s.nom']['checked'])) {
1240 print '<td class="liste_titre left">';
1241 print '<input class="flat" type="text" size="8" name="search_company" value="'.dol_escape_htmltag((string) $search_company).'">';
1242 print '</td>';
1243}
1244// Town
1245if (!empty($arrayfields['s.town']['checked'])) {
1246 print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
1247}
1248// Zip
1249if (!empty($arrayfields['s.zip']['checked'])) {
1250 print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
1251}
1252// State
1253if (!empty($arrayfields['state.nom']['checked'])) {
1254 print '<td class="liste_titre">';
1255 print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
1256 print '</td>';
1257}
1258// Country
1259if (!empty($arrayfields['country.code_iso']['checked'])) {
1260 print '<td class="liste_titre center">';
1261 print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
1262 print '</td>';
1263}
1264// Company type
1265if (!empty($arrayfields['typent.code']['checked'])) {
1266 print '<td class="liste_titre maxwidthonsmartphone center">';
1267 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);
1268 print '</td>';
1269}
1270// Weight
1271if (!empty($arrayfields['e.weight']['checked'])) {
1272 print '<td class="liste_titre maxwidthonsmartphone center">';
1273
1274 print '</td>';
1275}
1276// Date delivery planned
1277if (!empty($arrayfields['e.date_delivery']['checked'])) {
1278 print '<td class="liste_titre center">';
1279 print '<div class="nowrapfordate">';
1280 print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 'search_datedelivery_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1281 print '</div>';
1282 print '<div class="nowrapfordate">';
1283 print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 'search_datedelivery_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1284 print '</div>';
1285 print '</td>';
1286}
1287// Date shipping
1288if (!empty($arrayfields['e.date_expedition']['checked'])) {
1289 print '<td class="liste_titre center">';
1290 print '<div class="nowrapfordate">';
1291 print $form->selectDate($search_dateshipping_start ? $search_dateshipping_start : -1, 'search_dateshipping_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1292 print '</div>';
1293 print '<div class="nowrapfordate">';
1294 print $form->selectDate($search_dateshipping_end ? $search_dateshipping_end : -1, 'search_dateshipping_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1295 print '</div>';
1296 print '</td>';
1297}
1298if (!empty($arrayfields['e.fk_shipping_method']['checked'])) {
1299 // Delivery method
1300 print '<td class="liste_titre center">';
1301 $shipment->fetch_delivery_methods();
1302 print $form->selectarray("search_shipping_method_ids[]", $shipment->meths, $search_shipping_method_ids, 1, 0, 0, 'multiple', 1, 0, 0, '', 'maxwidth150');
1303 print "</td>\n";
1304}
1305// Tracking number
1306if (!empty($arrayfields['e.tracking_number']['checked'])) {
1307 print '<td class="liste_titre center">';
1308 print '<input class="flat" size="6" type="text" name="search_tracking" value="'.dol_escape_htmltag($search_tracking).'">';
1309 print '</td>';
1310}
1311if (!empty($arrayfields['l.ref']['checked'])) {
1312 // Delivery ref
1313 print '<td class="liste_titre">';
1314 print '<input class="flat width75" type="text" name="search_ref_liv" value="'.dol_escape_htmltag($search_ref_liv).'"';
1315 print '</td>';
1316}
1317if (!empty($arrayfields['l.date_delivery']['checked'])) {
1318 // Date reception
1319 print '<td class="liste_titre center">';
1320 print '<div class="nowrapfordate">';
1321 print $form->selectDate($search_datereceipt_start ? $search_datereceipt_start : -1, 'search_datereceipt_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1322 print '</div>';
1323 print '<div class="nowrapfordate">';
1324 print $form->selectDate($search_datereceipt_end ? $search_datereceipt_end : -1, 'search_datereceipt_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1325 print '</div>';
1326 print '</td>';
1327}
1328// Note public
1329if (!empty($arrayfields['e.note_public']['checked'])) {
1330 print '<td class="liste_titre">';
1331 print '</td>';
1332}
1333// Note private
1334if (!empty($arrayfields['e.note_private']['checked'])) {
1335 print '<td class="liste_titre">';
1336 print '</td>';
1337}
1338// Extra fields
1339include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
1340
1341// Fields from hook
1342$parameters = array('arrayfields' => $arrayfields);
1343$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1344print $hookmanager->resPrint;
1345// Date creation
1346if (!empty($arrayfields['e.datec']['checked'])) {
1347 print '<td class="liste_titre">';
1348 print '</td>';
1349}
1350// Date modification
1351if (!empty($arrayfields['e.tms']['checked'])) {
1352 print '<td class="liste_titre">';
1353 print '</td>';
1354}
1355// Status
1356if (!empty($arrayfields['e.fk_statut']['checked'])) {
1357 print '<td class="liste_titre right parentonrightofpage">';
1358 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');
1359 print '</td>';
1360}
1361// Signed status
1362if (!empty($arrayfields['e.signed_status']['checked'])) {
1363 print '<td class="liste_titre center">';
1364 $list_signed_status = $object->getSignedStatusLocalisedArray();
1365 print $form->selectarray('search_signed_status', $list_signed_status, $search_signed_status, 1, 0, 0, '', 1, 0, 0, '', 'search_status');
1366 print '</td>';
1367}
1368// Status billed
1369if (!empty($arrayfields['e.billed']['checked'])) {
1370 print '<td class="liste_titre maxwidthonsmartphone center">';
1371 print $form->selectyesno('search_billed', $search_billed, 1, false, 1);
1372 print '</td>';
1373}
1374// Action column
1375if (!$conf->main_checkbox_left_column) {
1376 print '<td class="liste_titre center maxwidthsearch">';
1377 $searchpicto = $form->showFilterButtons();
1378 print $searchpicto;
1379 print '</td>';
1380}
1381print '</tr>'."\n";
1382
1383$totalarray = array();
1384$totalarray['nbfield'] = 0;
1385
1386// Fields title label
1387// --------------------------------------------------------------------
1388print '<tr class="liste_titre">';
1389// Action column
1390if ($conf->main_checkbox_left_column) {
1391 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
1392 $totalarray['nbfield']++;
1393}
1394if (!empty($arrayfields['e.ref']['checked'])) {
1395 // @phan-suppress-next-line PhanTypeInvalidDimOffset
1396 print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, '', $sortfield, $sortorder);
1397 $totalarray['nbfield']++;
1398}
1399if (!empty($arrayfields['e.ref_customer']['checked'])) {
1400 print_liste_field_titre($arrayfields['e.ref_customer']['label'], $_SERVER["PHP_SELF"], "e.ref_customer", "", $param, '', $sortfield, $sortorder);
1401 $totalarray['nbfield']++;
1402}
1403if (!empty($arrayfields['s.nom']['checked'])) {
1404 print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder, 'left ');
1405 $totalarray['nbfield']++;
1406}
1407if (!empty($arrayfields['s.town']['checked'])) {
1408 print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
1409 $totalarray['nbfield']++;
1410}
1411if (!empty($arrayfields['s.zip']['checked'])) {
1412 print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
1413 $totalarray['nbfield']++;
1414}
1415if (!empty($arrayfields['state.nom']['checked'])) {
1416 print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
1417 $totalarray['nbfield']++;
1418}
1419if (!empty($arrayfields['country.code_iso']['checked'])) {
1420 print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
1421 $totalarray['nbfield']++;
1422}
1423if (!empty($arrayfields['typent.code']['checked'])) {
1424 print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center ');
1425 $totalarray['nbfield']++;
1426}
1427if (!empty($arrayfields['e.weight']['checked'])) {
1428 print_liste_field_titre($arrayfields['e.weight']['label'], $_SERVER["PHP_SELF"], "e.weight", "", $param, '', $sortfield, $sortorder, 'center ');
1429 $totalarray['nbfield']++;
1430}
1431if (!empty($arrayfields['e.date_delivery']['checked'])) {
1432 print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, '', $sortfield, $sortorder, 'center ');
1433 $totalarray['nbfield']++;
1434}
1435if (!empty($arrayfields['e.date_expedition']['checked'])) {
1436 print_liste_field_titre($arrayfields['e.date_expedition']['label'], $_SERVER["PHP_SELF"], "e.date_expedition", "", $param, '', $sortfield, $sortorder, 'center ');
1437 $totalarray['nbfield']++;
1438}
1439if (!empty($arrayfields['e.fk_shipping_method']['checked'])) {
1440 print_liste_field_titre($arrayfields['e.fk_shipping_method']['label'], $_SERVER["PHP_SELF"], "e.fk_shipping_method", "", $param, '', $sortfield, $sortorder, 'center ');
1441 $totalarray['nbfield']++;
1442}
1443if (!empty($arrayfields['e.tracking_number']['checked'])) {
1444 print_liste_field_titre($arrayfields['e.tracking_number']['label'], $_SERVER["PHP_SELF"], "e.tracking_number", "", $param, '', $sortfield, $sortorder, 'center ');
1445 $totalarray['nbfield']++;
1446}
1447if (!empty($arrayfields['l.ref']['checked'])) {
1448 print_liste_field_titre($arrayfields['l.ref']['label'], $_SERVER["PHP_SELF"], "l.ref", "", $param, '', $sortfield, $sortorder);
1449 $totalarray['nbfield']++;
1450}
1451if (!empty($arrayfields['l.date_delivery']['checked'])) {
1452 print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"], "l.date_delivery", "", $param, '', $sortfield, $sortorder, 'center ');
1453 $totalarray['nbfield']++;
1454}
1455if (!empty($arrayfields['e.note_public']['checked'])) {
1456 print_liste_field_titre($arrayfields['e.note_public']['label'], $_SERVER["PHP_SELF"], "e.note_public", "", $param, '', $sortfield, $sortorder, 'right ');
1457}
1458if (!empty($arrayfields['e.note_private']['checked'])) {
1459 print_liste_field_titre($arrayfields['e.note_private']['label'], $_SERVER["PHP_SELF"], "e.note_private", "", $param, '', $sortfield, $sortorder, 'right ');
1460}
1461
1462// Extra fields
1463include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
1464// Hook fields
1465$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, '$totalarray' => &$totalarray);
1466$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1467print $hookmanager->resPrint;
1468if (!empty($arrayfields['e.datec']['checked'])) {
1469 print_liste_field_titre($arrayfields['e.datec']['label'], $_SERVER["PHP_SELF"], "e.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1470 $totalarray['nbfield']++;
1471}
1472if (!empty($arrayfields['e.tms']['checked'])) {
1473 print_liste_field_titre($arrayfields['e.tms']['label'], $_SERVER["PHP_SELF"], "e.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1474 $totalarray['nbfield']++;
1475}
1476if (!empty($arrayfields['e.fk_statut']['checked'])) {
1477 print_liste_field_titre($arrayfields['e.fk_statut']['label'], $_SERVER["PHP_SELF"], "e.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
1478 $totalarray['nbfield']++;
1479}
1480if (!empty($arrayfields['e.signed_status']['checked'])) {
1481 print_liste_field_titre($arrayfields['e.signed_status']['label'], $_SERVER["PHP_SELF"], "e.signed_status", "", $param, '', $sortfield, $sortorder, 'center ');
1482 $totalarray['nbfield']++;
1483}
1484if (!empty($arrayfields['e.billed']['checked'])) {
1485 print_liste_field_titre($arrayfields['e.billed']['label'], $_SERVER["PHP_SELF"], "e.billed", "", $param, '', $sortfield, $sortorder, 'center ');
1486 $totalarray['nbfield']++;
1487}
1488// Action column
1489if (!$conf->main_checkbox_left_column) {
1490 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
1491 $totalarray['nbfield']++;
1492}
1493print "</tr>\n";
1494
1495$typenArray = $formcompany->typent_array(1);
1496
1497// Loop on record
1498// --------------------------------------------------------------------
1499$i = 0;
1500$savnbfield = $totalarray['nbfield'];
1501$totalarray = array();
1502$totalarray['nbfield'] = 0;
1503$imaxinloop = ($limit ? min($num, $limit) : $num);
1504while ($i < $imaxinloop) {
1505 $obj = $db->fetch_object($resql);
1506 if (empty($obj)) {
1507 break; // Should not happen
1508 }
1509
1510 $companystatic->id = $obj->socid;
1511 $companystatic->ref = $obj->name;
1512 $companystatic->name = $obj->name;
1513
1514 $object = new Expedition($db);
1515 $object->fetch($obj->rowid);
1516
1517 if ($mode == 'kanban') {
1518 if ($i == 0) {
1519 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
1520 print '<div class="box-flex-container kanban">';
1521 }
1522 $object->date_delivery = $obj->delivery_date;
1523 $object->town = $obj->town;
1524
1525 // Output Kanban
1526 $selected = -1;
1527 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1528 $selected = 0;
1529 if (in_array($object->id, $arrayofselected)) {
1530 $selected = 1;
1531 }
1532 }
1533 print $object->getKanbanView('', array('thirdparty' => $companystatic->getNomUrl(1), 'selected' => $selected));
1534 if ($i == min($num, $limit) - 1) {
1535 print '</div>';
1536 print '</td></tr>';
1537 }
1538 } else {
1539 print '<tr class="oddeven row-with-select">';
1540
1541 // Action column
1542 if ($conf->main_checkbox_left_column) {
1543 print '<td class="nowrap center">';
1544 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1545 $selected = 0;
1546 if (in_array($obj->rowid, $arrayofselected)) {
1547 $selected = 1;
1548 }
1549 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1550 }
1551 print '</td>';
1552 }
1553 // Ref
1554 if (!empty($arrayfields['e.ref']['checked'])) {
1555 print '<td class="nowraponall">';
1556 print $object->getNomUrl(1, '', 0, 0, 0, -1, 1);
1557 $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, '');
1558 $filename = dol_sanitizeFileName($object->ref);
1559 print $formfile->getDocumentsLink('expedition', $filename, $filedir);
1560 print "</td>\n";
1561 if (!$i) {
1562 $totalarray['nbfield']++;
1563 }
1564 }
1565
1566 // Ref customer
1567 if (!empty($arrayfields['e.ref_customer']['checked'])) {
1568 print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->ref_customer).'">';
1569 print dol_escape_htmltag($obj->ref_customer);
1570 print "</td>\n";
1571 if (!$i) {
1572 $totalarray['nbfield']++;
1573 }
1574 }
1575
1576 // Third party
1577 if (!empty($arrayfields['s.nom']['checked'])) {
1578 print '<td class="tdoverflowmax150">';
1579 print $companystatic->getNomUrl(1);
1580 print '</td>';
1581 if (!$i) {
1582 $totalarray['nbfield']++;
1583 }
1584 }
1585 // Town
1586 if (!empty($arrayfields['s.town']['checked'])) {
1587 print '<td class="nocellnopadd">';
1588 print dol_escape_htmltag($obj->town);
1589 print '</td>';
1590 if (!$i) {
1591 $totalarray['nbfield']++;
1592 }
1593 }
1594 // Zip
1595 if (!empty($arrayfields['s.zip']['checked'])) {
1596 print '<td class="nocellnopadd center">';
1597 print dol_escape_htmltag($obj->zip);
1598 print '</td>';
1599 if (!$i) {
1600 $totalarray['nbfield']++;
1601 }
1602 }
1603 // State
1604 if (!empty($arrayfields['state.nom']['checked'])) {
1605 print '<td class="center">'.$obj->state_name."</td>\n";
1606 if (!$i) {
1607 $totalarray['nbfield']++;
1608 }
1609 }
1610 // Country
1611 if (!empty($arrayfields['country.code_iso']['checked'])) {
1612 print '<td class="center">';
1613 $tmparray = getCountry($obj->fk_pays, 'all');
1614 print dol_escape_htmltag($tmparray['label']);
1615 print '</td>';
1616 if (!$i) {
1617 $totalarray['nbfield']++;
1618 }
1619 }
1620 // Type ent
1621 if (!empty($arrayfields['typent.code']['checked'])) {
1622 print '<td class="center">';
1623 if (isset($typenArray[$obj->typent_code])) {
1624 print $typenArray[$obj->typent_code];
1625 }
1626 print '</td>';
1627 if (!$i) {
1628 $totalarray['nbfield']++;
1629 }
1630 }
1631 // Weight
1632 if (!empty($arrayfields['e.weight']['checked'])) {
1633 print '<td class="center">';
1634 if (empty($object->trueWeight)) {
1635 $tmparray = $object->getTotalWeightVolume();
1636 print showDimensionInBestUnit($tmparray['weight'], 0, "weight", $langs, getDolGlobalInt('MAIN_WEIGHT_DEFAULT_ROUND', -1), getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT', 'no'));
1637 print $form->textwithpicto('', $langs->trans('EstimatedWeight'), 1);
1638 } else {
1639 print $object->trueWeight;
1640 print ($object->trueWeight && $object->weight_units != '') ? ' '.measuringUnitString(0, "weight", $object->weight_units) : '';
1641 }
1642 print '</td>';
1643 if (!$i) {
1644 $totalarray['nbfield']++;
1645 }
1646 }
1647 // Date delivery planned
1648 if (!empty($arrayfields['e.date_delivery']['checked'])) {
1649 print '<td class="center nowraponall">';
1650 print dol_print_date($db->jdate($obj->delivery_date), "dayhour");
1651 print "</td>\n";
1652 if (!$i) {
1653 $totalarray['nbfield']++;
1654 }
1655 }
1656 // Date shipping
1657 if (!empty($arrayfields['e.date_expedition']['checked'])) {
1658 print '<td class="center nowraponall">';
1659 print dol_print_date($db->jdate($obj->date_expedition), "dayhour");
1660 print "</td>\n";
1661 if (!$i) {
1662 $totalarray['nbfield']++;
1663 }
1664 }
1665 if (!empty($arrayfields['e.fk_shipping_method']['checked'])) {
1666 // Get code using getLabelFromKey
1667 $code = $langs->getLabelFromKey($db, (string) $object->shipping_method_id, 'c_shipment_mode', 'rowid', 'code');
1668 print '<td class="center tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans("SendingMethod".strtoupper($code))).'">';
1669 if ($object->shipping_method_id > 0) {
1670 print $langs->trans("SendingMethod".strtoupper($code));
1671 }
1672 print '</td>';
1673 if (!$i) {
1674 $totalarray['nbfield']++;
1675 }
1676 }
1677 // Tracking number
1678 if (!empty($arrayfields['e.tracking_number']['checked'])) {
1679 $object->getUrlTrackingStatus($obj->tracking_number);
1680 print '<td class="center" title="'.dol_escape_htmltag($object->tracking_url).'">'.$object->tracking_url."</td>\n";
1681 if (!$i) {
1682 $totalarray['nbfield']++;
1683 }
1684 }
1685
1686 if (!empty($arrayfields['l.ref']['checked']) || !empty($arrayfields['l.date_delivery']['checked'])) {
1687 $object->fetchObjectLinked();
1688 $receiving = '';
1689 if (array_key_exists('delivery', $object->linkedObjects) && count($object->linkedObjects['delivery']) > 0) {
1690 $receiving = reset($object->linkedObjects['delivery']);
1691 }
1692
1693 if (!empty($arrayfields['l.ref']['checked'])) {
1694 // Ref
1695 print '<td class="nowraponall">';
1696 print !empty($receiving) ? $receiving->getNomUrl($db) : '';
1697 print '</td>';
1698 }
1699
1700 if (!empty($arrayfields['l.date_delivery']['checked'])) {
1701 // Date received
1702 print '<td class="center nowraponall">';
1703 print dol_print_date($db->jdate($obj->date_reception), "day");
1704 print '</td>'."\n";
1705 }
1706 }
1707 // Note public
1708 if (!empty($arrayfields['e.note_public']['checked'])) {
1709 print '<td class="sensiblehtmlcontent center">';
1710 print '<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_public, 5)).'</div>';
1711 print '</td>';
1712 if (!$i) {
1713 $totalarray['nbfield']++;
1714 }
1715 }
1716 // Note private
1717 if (!empty($arrayfields['e.note_private']['checked'])) {
1718 print '<td class="sensiblehtmlcontent center">';
1719 print '<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_private, 5)).'</div>';
1720 print '</td>';
1721 if (!$i) {
1722 $totalarray['nbfield']++;
1723 }
1724 }
1725 // Extra fields
1726 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1727 // Fields from hook
1728 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1729 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1730 print $hookmanager->resPrint;
1731 // Date creation
1732 if (!empty($arrayfields['e.datec']['checked'])) {
1733 print '<td class="center nowraponall">';
1734 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuserrel');
1735 print '</td>';
1736 if (!$i) {
1737 $totalarray['nbfield']++;
1738 }
1739 }
1740 // Date modification
1741 if (!empty($arrayfields['e.tms']['checked'])) {
1742 print '<td class="center nowraponall">';
1743 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuser');
1744 print '</td>';
1745 if (!$i) {
1746 $totalarray['nbfield']++;
1747 }
1748 }
1749 // Status
1750 if (!empty($arrayfields['e.fk_statut']['checked'])) {
1751 print '<td class="right nowrap">'.$object->getLibStatut(5).'</td>';
1752 if (!$i) {
1753 $totalarray['nbfield']++;
1754 }
1755 }
1756 // Signed Status
1757 if (!empty($arrayfields['e.signed_status']['checked'])) {
1758 print '<td class="center">'.$object->getLibSignedStatus(5).'</td>';
1759 if (!$i) {
1760 $totalarray['nbfield']++;
1761 }
1762 }
1763 // Billed
1764 if (!empty($arrayfields['e.billed']['checked'])) {
1765 print '<td class="center">'.yn($obj->billed).'</td>';
1766 if (!$i) {
1767 $totalarray['nbfield']++;
1768 }
1769 }
1770
1771 // Action column
1772 if (!$conf->main_checkbox_left_column) {
1773 print '<td class="nowrap center">';
1774 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1775 $selected = 0;
1776 if (in_array($obj->rowid, $arrayofselected)) {
1777 $selected = 1;
1778 }
1779 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1780 }
1781 print '</td>';
1782 }
1783 if (!$i) {
1784 $totalarray['nbfield']++;
1785 }
1786
1787 print "</tr>\n";
1788 }
1789 $i++;
1790}
1791
1792// If no record found
1793if ($num == 0) {
1794 $colspan = 1;
1795 foreach ($arrayfields as $key => $val) {
1796 if (!empty($val['checked'])) {
1797 $colspan++;
1798 }
1799 }
1800 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1801}
1802
1803$db->free($resql);
1804
1805$parameters = array('arrayfields' => $arrayfields, 'totalarray' => $totalarray, 'sql' => $sql);
1806$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1807print $hookmanager->resPrint;
1808
1809print "</table>";
1810print "</div>";
1811print '</form>';
1812
1813$hidegeneratedfilelistifempty = 1;
1814if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1815 $hidegeneratedfilelistifempty = 0;
1816}
1817
1818// Show list of available documents
1819$urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1820$urlsource .= str_replace('&amp;', '&', $param);
1821
1822$filedir = $diroutputmassaction;
1823$genallowed = $user->hasRight('expedition', 'lire');
1824$delallowed = $user->hasRight('expedition', 'creer');
1825$title = '';
1826
1827print $formfile->showdocuments('massfilesarea_sendings', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1828
1829// End of page
1830llxFooter();
1831$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
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
$object ref
Definition info.php:90
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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.
$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).
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
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.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
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_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Definition html.lib.php:183
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.
shippingSetStandaloneLineSellPrice($line, $buyer)
Complete a line of a standalone shipment (SHIPMENT_STANDALONE, no source order) before it is copied i...