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