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