dolibarr 21.0.4
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@capnetworks.com>
5 * Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
6 * Copyright (C) 2023-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
7 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
8 * Copyright (C) 2024 Benjamin Falière <benjamin.faliere@altairis.fr>
9 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <https://www.gnu.org/licenses/>.
23 */
24
31// Load Dolibarr environment
32require '../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.'/reception/class/reception.class.php';
34require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
35require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
36require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
37require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
38require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
39require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
40require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
41
50$langs->loadLangs(array("sendings", "receptions", "deliveries", 'companies', 'bills', 'orders'));
51
52$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'shipmentlist'; // To manage different context of search
53
54$socid = GETPOSTINT('socid');
55
56$action = GETPOST('action', 'alpha');
57$massaction = GETPOST('massaction', 'alpha');
58$toselect = GETPOST('toselect', 'array');
59$optioncss = GETPOST('optioncss', 'alpha');
60$mode = GETPOST('mode', 'alpha');
61
62
63$search_ref_rcp = GETPOST("search_ref_rcp");
64$search_ref_liv = GETPOST('search_ref_liv');
65$search_ref_supplier = GETPOST('search_ref_supplier');
66$search_company = GETPOST("search_company");
67$search_town = GETPOST('search_town', 'alpha');
68$search_zip = GETPOST('search_zip', 'alpha');
69$search_state = GETPOST("search_state");
70$search_country = GETPOST("search_country", 'aZ09');
71$search_type_thirdparty = GETPOST("search_type_thirdparty", 'intcomma');
72$search_date_delivery_startday = GETPOSTINT('search_date_delivery_startday');
73$search_date_delivery_startmonth = GETPOSTINT('search_date_delivery_startmonth');
74$search_date_delivery_startyear = GETPOSTINT('search_date_delivery_startyear');
75$search_date_delivery_endday = GETPOSTINT('search_date_delivery_endday');
76$search_date_delivery_endmonth = GETPOSTINT('search_date_delivery_endmonth');
77$search_date_delivery_endyear = GETPOSTINT('search_date_delivery_endyear');
78$search_date_delivery_start = dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear); // Use tzserver
79$search_date_delivery_end = dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
80$search_date_create_startday = GETPOSTINT('search_date_create_startday');
81$search_date_create_startmonth = GETPOSTINT('search_date_create_startmonth');
82$search_date_create_startyear = GETPOSTINT('search_date_create_startyear');
83$search_date_create_endday = GETPOSTINT('search_date_create_endday');
84$search_date_create_endmonth = GETPOSTINT('search_date_create_endmonth');
85$search_date_create_endyear = GETPOSTINT('search_date_create_endyear');
86$search_date_create_start = dol_mktime(0, 0, 0, $search_date_create_startmonth, $search_date_create_startday, $search_date_create_startyear); // Use tzserver
87$search_date_create_end = dol_mktime(23, 59, 59, $search_date_create_endmonth, $search_date_create_endday, $search_date_create_endyear);
88$search_billed = GETPOST("search_billed", 'intcomma');
89$search_status = GETPOST('search_status', 'intcomma');
90$search_all = GETPOST('search_all', 'alphanohtml');
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$diroutputmassaction = $conf->reception->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id;
111$object = new Reception($db);
112
113// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
114$hookmanager->initHooks(array('receptionlist'));
115$extrafields = new ExtraFields($db);
116
117// Fetch optionals attributes and labels
118$extrafields->fetch_name_optionals_label($object->table_element);
119$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
120
121// List of fields to search into when doing a "search in all"
122$fieldstosearchall = array(
123 'e.ref' => "Ref",
124 'e.ref_supplier' => "RefSupplier",
125 's.nom' => "ThirdParty",
126 'e.note_public' => 'NotePublic',
127);
128if (empty($user->socid)) {
129 $fieldstosearchall["e.note_private"] = "NotePrivate";
130}
131
132$checkedtypetiers = 0;
133$arrayfields = array(
134 'e.ref' => array('label' => $langs->trans("Ref"), 'checked' => 1),
135 'e.ref_supplier' => array('label' => $langs->trans("RefSupplier"), 'checked' => 1),
136 's.nom' => array('label' => $langs->trans("ThirdParty"), 'checked' => 1),
137 's.town' => array('label' => $langs->trans("Town"), 'checked' => 1),
138 's.zip' => array('label' => $langs->trans("Zip"), 'checked' => 1),
139 'state.nom' => array('label' => $langs->trans("StateShort"), 'checked' => 0),
140 'country.code_iso' => array('label' => $langs->trans("Country"), 'checked' => 0),
141 'typent.code' => array('label' => $langs->trans("ThirdPartyType"), 'checked' => $checkedtypetiers),
142 'e.date_delivery' => array('label' => $langs->trans("DateDeliveryPlanned"), 'checked' => 1),
143 'e.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => 0, 'position' => 500),
144 'e.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => 0, 'position' => 500),
145 'e.fk_statut' => array('label' => $langs->trans("Status"), 'checked' => 1, 'position' => 1000),
146 'e.billed' => array('label' => $langs->trans("Billed"), 'checked' => 1, 'position' => 1000, 'enabled' => 'getDolGlobalString("WORKFLOW_BILL_ON_RECEPTION") !== "0"')
147);
148
149// Extra fields
150include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
151
152$object->fields = dol_sort_array($object->fields, 'position');
153$arrayfields = dol_sort_array($arrayfields, 'position');
154'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan
155
156$error = 0;
157
158// Security check
159$receptionid = GETPOSTINT('id');
160if ($user->socid) {
161 $socid = $user->socid;
162}
163$result = restrictedArea($user, 'reception', $receptionid, '');
164
165
166/*
167 * Actions
168 */
169
170if (GETPOST('cancel', 'alpha')) {
171 $action = 'list';
172 $massaction = '';
173}
174if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_createbills') {
175 $massaction = '';
176}
177
178$parameters = array('socid' => $socid, 'arrayfields' => &$arrayfields);
179$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
180if ($reshook < 0) {
181 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
182}
183
184include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
185
186// Purge search criteria
187if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
188 $search_ref_supplier = '';
189 $search_ref_rcp = '';
190 $search_ref_liv = '';
191 $search_company = '';
192 $search_town = '';
193 $search_zip = "";
194 $search_state = "";
195 $search_country = '';
196 $search_type_thirdparty = '';
197 $search_date_delivery_startday = '';
198 $search_date_delivery_startmonth = '';
199 $search_date_delivery_startyear = '';
200 $search_date_delivery_endday = '';
201 $search_date_delivery_endmonth = '';
202 $search_date_delivery_endyear = '';
203 $search_date_delivery_start = '';
204 $search_date_delivery_end = '';
205 $search_date_create_startday = '';
206 $search_date_create_startmonth = '';
207 $search_date_create_startyear = '';
208 $search_date_create_endday = '';
209 $search_date_create_endmonth = '';
210 $search_date_create_endyear = '';
211 $search_date_create_start = '';
212 $search_date_create_end = '';
213 $search_billed = '';
214 $search_status = '';
215 $toselect = array();
216 $search_array_options = array();
217}
218
219if (empty($reshook)) {
220 // Mass actions
221 $objectclass = 'Reception';
222 $objectlabel = 'Receptions';
223 $permissiontoread = $user->hasRight('reception', 'lire');
224 $permissiontoadd = $user->hasRight('reception', 'creer');
225 $permissiontodelete = $user->hasRight('reception', 'supprimer');
226 $uploaddir = $conf->reception->multidir_output[$conf->entity];
227 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
228
229 if ($massaction == 'confirm_createbills' && ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer"))) {
230 $receptions = GETPOST('toselect', 'array');
231 $createbills_onebythird = GETPOSTINT('createbills_onebythird');
232 $validate_invoices = GETPOSTINT('validate_invoices');
233
234 $errors = array();
235
236 $TFact = array();
237 $TFactThird = array();
238 '@phan-var FactureFournisseur[] $TFactThird';
239 $TFactThirdNbLines = array();
240
241 $nb_bills_created = 0;
242 $lastid = 0;
243 $lastref = '';
244
245 $db->begin();
246
247 //sort ids to keep order if one bill per third
248 sort($receptions);
249 foreach ($receptions as $id_reception) {
250 $rcp = new Reception($db);
251 // We not allow invoice reception that are in draft status
252 if ($rcp->fetch($id_reception) <= 0 || $rcp->statut == $rcp::STATUS_DRAFT) {
253 $errors[] = $langs->trans('StatusOfRefMustBe', $rcp->ref, $langs->transnoentities("StatusReceptionValidatedShort"));
254 $error++;
255 continue;
256 }
257
258 $objecttmp = new FactureFournisseur($db);
259 if (!empty($createbills_onebythird) && !empty($TFactThird[$rcp->socid])) {
260 // If option "one bill per third" is set, and an invoice for this thirdparty was already created, we reuse it.
261 $objecttmp = $TFactThird[$rcp->socid];
262
263 // Add all links of this new reception to the existing invoice
264 $objecttmp->fetchObjectLinked();
265 $rcp->fetchObjectLinked();
266 if (!empty($rcp->linkedObjectsIds['order_supplier']) && is_array($rcp->linkedObjectsIds['order_supplier'])) {
267 foreach ($rcp->linkedObjectsIds['order_supplier'] as $key => $value) {
268 if (empty($objecttmp->linkedObjectsIds['order_supplier']) || !in_array($value, $objecttmp->linkedObjectsIds['order_supplier'])) { //Don't try to link if already linked
269 $objecttmp->add_object_linked('order_supplier', $value); // add supplier order linked object
270 }
271 }
272 }
273 } else {
274 $cond_reglement_id = 0;
275 $mode_reglement_id = 0;
276 $fk_account = 0;
277 $transport_mode_id = 0;
278 $multicurrency_code = null;
279
280 if (!empty($rcp->cond_reglement_id)) {
281 $cond_reglement_id = $rcp->cond_reglement_id;
282 }
283 if (!empty($rcp->mode_reglement_id)) {
284 $mode_reglement_id = $rcp->mode_reglement_id;
285 }
286 if (!empty($rcp->fk_account)) {
287 $fk_account = $rcp->fk_account;
288 }
289 if (!empty($rcp->transport_mode_id)) {
290 $transport_mode_id = $rcp->transport_mode_id;
291 }
292 if (!empty($rcp->multicurrency_code)) {
293 $multicurrency_code = $rcp->multicurrency_code;
294 }
295
296 if (empty($cond_reglement_id)
297 || empty($mode_reglement_id)
298 || empty($fk_account)
299 || empty($transport_mode_id)
300 || empty($multicurrency_code)
301 ) {
302 if (!isset($rcp->supplier_order)) {
303 $rcp->fetch_origin();
304 }
305
306 // try to get from source of reception (supplier order)
307 if (!empty($rcp->origin_object)) {
308 $supplierOrder = $rcp->origin_object;
309 if (empty($cond_reglement_id) && !empty($supplierOrder->cond_reglement_id)) {
310 $cond_reglement_id = $supplierOrder->cond_reglement_id;
311 }
312 if (empty($mode_reglement_id) && !empty($supplierOrder->mode_reglement_id)) {
313 $mode_reglement_id = $supplierOrder->mode_reglement_id;
314 }
315 if (empty($fk_account) && !empty($supplierOrder->fk_account)) {
316 $fk_account = $supplierOrder->fk_account;
317 }
318 if (empty($transport_mode_id) && !empty($supplierOrder->transport_mode_id)) {
319 $transport_mode_id = $supplierOrder->transport_mode_id;
320 }
321 if (empty($multicurrency_code) && !empty($supplierOrder->multicurrency_code)) {
322 $multicurrency_code = $supplierOrder->multicurrency_code;
323 }
324 }
325
326 $soc = null;
327 // try get from third party of reception
328 if (!empty($rcp->thirdparty)) {
329 $soc = $rcp->thirdparty;
330 if (empty($cond_reglement_id) && !empty($soc->cond_reglement_supplier_id)) {
331 $cond_reglement_id = $soc->cond_reglement_supplier_id;
332 }
333 if (empty($mode_reglement_id) && !empty($soc->mode_reglement_supplier_id)) {
334 $mode_reglement_id = $soc->mode_reglement_supplier_id;
335 }
336 if (empty($fk_account) && !empty($soc->fk_account)) {
337 $fk_account = $soc->fk_account;
338 }
339 if (empty($transport_mode_id) && !empty($soc->transport_mode_id)) {
340 $transport_mode_id = $soc->transport_mode_id;
341 }
342 if (empty($multicurrency_code) && !empty($soc->multicurrency_code)) {
343 $multicurrency_code = $soc->multicurrency_code;
344 }
345 }
346 }
347
348 // If we want one invoice per reception or if there is no first invoice yet for this thirdparty.
349 $objecttmp->socid = $rcp->socid;
350 $objecttmp->type = $objecttmp::TYPE_STANDARD;
351 $objecttmp->cond_reglement_id = $cond_reglement_id;
352 $objecttmp->mode_reglement_id = $mode_reglement_id;
353 $objecttmp->fk_account = $fk_account;
354 $objecttmp->transport_mode_id = $transport_mode_id;
355 $objecttmp->multicurrency_code = $multicurrency_code;
356
357 // if the VAT reverse-charge is activated by default in supplier card to resume the information
358 if (is_object($soc)) {
359 $objecttmp->vat_reverse_charge = $soc->vat_reverse_charge;
360 }
361
362 $objecttmp->fk_project = $rcp->fk_project;
363 //$objecttmp->multicurrency_code = $rcp->multicurrency_code;
364 if (empty($createbills_onebythird)) {
365 $objecttmp->ref_supplier = $rcp->ref;
366 } else {
367 // Set a unique value for the invoice for the n reception
368 $objecttmp->ref_supplier = $langs->trans("Reception").' '.dol_print_date(dol_now(), 'dayhourlog').'-'.$rcp->socid;
369 }
370
371 $datefacture = dol_mktime(12, 0, 0, GETPOSTINT('remonth'), GETPOSTINT('reday'), GETPOSTINT('reyear'));
372 if (empty($datefacture)) {
373 $datefacture = dol_now();
374 }
375
376 $objecttmp->date = $datefacture;
377 $objecttmp->origin = 'reception';
378 $objecttmp->origin_id = $id_reception;
379
380 // Auto calculation of date due if not filled by user
381 if (empty($objecttmp->date_echeance)) {
382 $objecttmp->date_echeance = $objecttmp->calculate_date_lim_reglement();
383 }
384
385 $objecttmp->array_options = $rcp->array_options; // Copy extrafields
386
387 // Set $objecttmp->linked_objects with all links order_supplier existing on reception, so same links will be added to the generated supplier invoice
388 $rcp->fetchObjectLinked();
389 if (count($rcp->linkedObjectsIds['order_supplier']) > 0) {
390 foreach ($rcp->linkedObjectsIds['order_supplier'] as $key => $value) {
391 $objecttmp->linked_objects['order_supplier'] = $value;
392 }
393 }
394
395 $res = $objecttmp->create($user); // This should create the supplier invoice + links into $objecttmp->linked_objects + add a link to ->origin_id
396
397 //var_dump($objecttmp->error);exit;
398 if ($res > 0) {
399 $nb_bills_created++;
400 $lastref = $objecttmp->ref;
401 $lastid = $objecttmp->id;
402
403 $TFactThird[$rcp->socid] = $objecttmp;
404 $TFactThirdNbLines[$rcp->socid] = 0; //init nblines to have lines ordered by expedition and rang
405 } else {
406 $langs->load("errors");
407 $errors[] = $rcp->ref.' : '.$langs->trans($objecttmp->error);
408 $error++;
409 }
410 }
411
412 if ($objecttmp->id > 0) {
413 if (!isset($rcp->origin_object)) {
414 $rcp->fetch_origin();
415 }
416 if ($rcp->origin_object->multicurrency_code != $objecttmp->multicurrency_code) {
417 $errors[] = $rcp->ref." : ".$langs->trans("ReceptionMustBeInTheSameCurrencyThanOther");
418 }
419
420 $res = $objecttmp->add_object_linked($objecttmp->origin, $id_reception);
421
422 if ($res == 0) {
423 $errors[] = $objecttmp->error;
424 $error++;
425 }
426
427 if (!$error) {
428 $lines = $rcp->lines;
429 if (empty($lines) && method_exists($rcp, 'fetch_lines')) {
430 $rcp->fetch_lines();
431 $lines = $rcp->lines;
432 }
433
434 $fk_parent_line = 0;
435 $num = count($lines);
436
437 for ($i = 0; $i < $num; $i++) {
438 $desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
439 // If we build one invoice for several reception, we must put the ref of reception on the invoice line
440 if (!empty($createbills_onebythird)) {
441 $desc = dol_concatdesc($desc, $langs->trans("Reception").' '.$rcp->ref);
442 $desc .= (!empty($rcp->date_reception) ? ' - '.dol_print_date($rcp->date_reception, 'day') : '');
443 }
444
445 if ($lines[$i]->subprice < 0) {
446 // Negative line, we create a discount line
447 $discount = new DiscountAbsolute($db);
448 $discount->fk_soc = $objecttmp->socid;
449 $discount->socid = $objecttmp->socid;
450 $discount->amount_ht = abs($lines[$i]->total_ht);
451 $discount->amount_tva = abs($lines[$i]->total_tva);
452 $discount->amount_ttc = abs($lines[$i]->total_ttc);
453 $discount->tva_tx = $lines[$i]->tva_tx;
454 $discount->fk_user = $user->id;
455 $discount->description = $desc;
456 $discountid = $discount->create($user);
457 if ($discountid > 0) {
458 $result = $objecttmp->insert_discount($discountid);
459 //$result=$discount->link_to_invoice($lineid,$id);
460 } else {
461 setEventMessages($discount->error, $discount->errors, 'errors');
462 $error++;
463 break;
464 }
465 } else {
466 // Positive line
467 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
468 // Date start
469 $date_start = false;
470 if ($lines[$i]->date_debut_prevue) {
471 $date_start = $lines[$i]->date_debut_prevue;
472 }
473 if ($lines[$i]->date_debut_reel) {
474 $date_start = $lines[$i]->date_debut_reel;
475 }
476 if ($lines[$i]->date_start) {
477 $date_start = $lines[$i]->date_start;
478 }
479 //Date end
480 $date_end = false;
481 if ($lines[$i]->date_fin_prevue) {
482 $date_end = $lines[$i]->date_fin_prevue;
483 }
484 if ($lines[$i]->date_fin_reel) {
485 $date_end = $lines[$i]->date_fin_reel;
486 }
487 if ($lines[$i]->date_end) {
488 $date_end = $lines[$i]->date_end;
489 }
490 // Reset fk_parent_line for no child products and special product
491 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
492 $fk_parent_line = 0;
493 }
494
495 // Extrafields
496 if (method_exists($lines[$i], 'fetch_optionals')) {
497 $lines[$i]->fetch_optionals();
498 $array_options = $lines[$i]->array_options;
499 }
500
501 $objecttmp->context['createfromclone'] = 'createfromclone';
502
503 $rang = $i;
504 //there may already be rows from previous receptions
505 if (!empty($createbills_onebythird)) {
506 $rang = $TFactThirdNbLines[$rcp->socid];
507 }
508
509 $result = $objecttmp->addline(
510 $desc,
511 $lines[$i]->subprice,
512 $lines[$i]->tva_tx,
513 $lines[$i]->localtax1_tx,
514 $lines[$i]->localtax2_tx,
515 $lines[$i]->qty,
516 $lines[$i]->fk_product,
517 $lines[$i]->remise_percent,
518 $date_start,
519 $date_end,
520 0,
521 $lines[$i]->info_bits,
522 'HT',
523 $product_type,
524 $rang,
525 false,
526 array(),
527 null,
528 $lines[$i]->rowid,
529 $lines[$i]->multicurrency_subprice,
530 $lines[$i]->ref_supplier
531 );
532
533 $rcp->add_object_linked('facture_fourn_det', $result);
534
535 if ($result > 0) {
536 $lineid = $result;
537 if (!empty($createbills_onebythird)) { //increment rang to keep order
538 $TFactThirdNbLines[$rcp->socid]++;
539 }
540 } else {
541 $lineid = 0;
542 $error++;
543 break;
544 }
545 // Defined the new fk_parent_line
546 if ($result > 0 && $lines[$i]->product_type == 9) {
547 $fk_parent_line = $result;
548 }
549 }
550 }
551 }
552 }
553
554 //$rcp->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module.
555
556 if (!empty($createbills_onebythird) && empty($TFactThird[$rcp->socid])) {
557 $TFactThird[$rcp->socid] = $objecttmp;
558 } else {
559 $TFact[$objecttmp->id] = $objecttmp;
560 }
561 }
562
563 // Build doc with all invoices
564 $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
565 $toselect = array();
566
567 if (!$error && $validate_invoices) {
568 $massaction = $action = 'builddoc';
569 foreach ($TAllFact as &$objecttmp) {
570 $result = $objecttmp->validate($user);
571 if ($result <= 0) {
572 $error++;
573 setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
574 break;
575 }
576
577 $id = $objecttmp->id; // For builddoc action
578 $lastref = $objecttmp->ref; // generated ref
579 $object = $objecttmp;
580
581 // Fac builddoc
582 $donotredirect = 1;
583 $upload_dir = $conf->fournisseur->facture->dir_output;
584 $permissiontoadd = ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight('supplier_invoice', 'creer'));
585
586 // Call action to build doc
587 $savobject = $object;
588 $object = $objecttmp;
589 include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
590 $object = $savobject;
591 }
592
593 $massaction = $action = 'confirm_createbills';
594 }
595
596 if (!$error) {
597 $db->commit();
598
599 if ($nb_bills_created == 1) {
600 $texttoshow = $langs->trans('BillXCreated', '{s1}');
601 $texttoshow = str_replace('{s1}', '<a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?id='.urlencode((string) ($lastid)).'">'.$lastref.'</a>', $texttoshow);
602 setEventMessages($texttoshow, null, 'mesgs');
603 } else {
604 setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs');
605 }
606 } else {
607 $db->rollback();
608
609 $action = 'create';
610 $_GET["origin"] = $_POST["origin"]; // Keep this ?
611 $_GET["originid"] = $_POST["originid"]; // Keep this ?
612 setEventMessages($object->error, $errors, 'errors');
613 $error++;
614 }
615 }
616}
617
618
619/*
620 * View
621 */
622
623$now = dol_now();
624
625$form = new Form($db);
626$companystatic = new Societe($db);
627$reception = new Reception($db);
628$formcompany = new FormCompany($db);
629$formfile = new FormFile($db);
630
631$title = $langs->trans('Receptions');
632$helpurl = 'EN:Module_Receptions|FR:Module_Receptions|ES:M&oacute;dulo_Receptiones';
633llxHeader('', $title, $helpurl, '', 0, 0, '', '', '', 'bodyforlist mod-reception page-list');
634
635$sql = "SELECT e.rowid, e.ref, e.ref_supplier, e.date_reception as date_reception, e.date_delivery as delivery_date, l.date_delivery as date_reception2, e.fk_statut as status, e.billed,";
636$sql .= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client,";
637$sql .= " typent.code as typent_code,";
638$sql .= " state.code_departement as state_code, state.nom as state_name,";
639$sql .= " e.date_creation as date_creation, e.tms as date_modification";
640// Add fields from extrafields
641if (!empty($extrafields->attributes[$object->table_element]['label'])) {
642 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
643 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
644 }
645}
646// Add fields from hooks
647$parameters = array();
648$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
649$sql .= $hookmanager->resPrint;
650
651$sqlfields = $sql; // $sql fields to remove for count total
652
653$sql .= " FROM ".MAIN_DB_PREFIX."reception as e";
654if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
655 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (e.rowid = ef.fk_object)";
656}
657$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
658$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
659$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
660$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
661$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'reception' AND ee.targettype = 'delivery'";
662$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."delivery as l ON l.rowid = ee.fk_target";
663// Add table from hooks
664$parameters = array();
665$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
666$sql .= $hookmanager->resPrint;
667$sql .= " WHERE e.entity IN (".getEntity('reception').")";
668if ($socid) {
669 $sql .= " AND e.fk_soc = ".((int) $socid);
670}
671if ($search_status != '' && $search_status >= 0) {
672 $sql .= " AND e.fk_statut = ".((int) $search_status);
673}
674if ($search_billed != '' && $search_billed >= 0) {
675 $sql .= ' AND e.billed = '.((int) $search_billed);
676}
677if ($search_town) {
678 $sql .= natural_search('s.town', $search_town);
679}
680if ($search_zip) {
681 $sql .= natural_search("s.zip", $search_zip);
682}
683if ($search_state) {
684 $sql .= natural_search("state.nom", $search_state);
685}
686if ($search_country) {
687 $sql .= " AND s.fk_pays IN (".$db->sanitize($search_country).')';
688}
689if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
690 $sql .= " AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).')';
691}
692if ($search_date_delivery_start) {
693 $sql .= " AND e.date_delivery >= '".$db->idate($search_date_delivery_start)."'";
694}
695if ($search_date_delivery_end) {
696 $sql .= " AND e.date_delivery <= '".$db->idate($search_date_delivery_end)."'";
697}
698if ($search_date_create_start) {
699 $sql .= " AND e.date_creation >= '".$db->idate($search_date_create_start)."'";
700}
701if ($search_date_create_end) {
702 $sql .= " AND e.date_creation <= '".$db->idate($search_date_create_end)."'";
703}
704if ($search_ref_rcp) {
705 $sql .= natural_search('e.ref', $search_ref_rcp);
706}
707if ($search_ref_liv) {
708 $sql .= natural_search('l.ref', $search_ref_liv);
709}
710if ($search_company) {
711 $sql .= natural_search('s.nom', $search_company);
712}
713if ($search_ref_supplier) {
714 $sql .= natural_search('e.ref_supplier', $search_ref_supplier);
715}
716if ($search_all) {
717 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
718}
719// Search on sale representative
720/*
721if ($search_sale && $search_sale != '-1') {
722 if ($search_sale == -2) {
723 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc)";
724 } elseif ($search_sale > 0) {
725 $sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user = ".((int) $search_sale).")";
726 }
727}
728*/
729// Add where from extra fields
730include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
731// Add where from hooks
732$parameters = array();
733$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
734$sql .= $hookmanager->resPrint;
735
736// Add HAVING from hooks
737$parameters = array();
738$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
739$sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
740
741$nbtotalofrecords = '';
742if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
743 /* The fast and low memory method to get and count full list converts the sql into a sql count */
744 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
745 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
746 $resql = $db->query($sqlforcount);
747 if ($resql) {
748 $objforcount = $db->fetch_object($resql);
749 $nbtotalofrecords = $objforcount->nbtotalofrecords;
750 } else {
751 dol_print_error($db);
752 }
753
754 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
755 $page = 0;
756 $offset = 0;
757 }
758 $db->free($resql);
759}
760
761// Complete request and execute it with limit
762$sql .= $db->order($sortfield, $sortorder);
763if ($limit) {
764 $sql .= $db->plimit($limit + 1, $offset);
765}
766
767//print $sql;
768$resql = $db->query($sql);
769if (!$resql) {
770 dol_print_error($db);
771 exit;
772}
773
774$num = $db->num_rows($resql);
775
776$reception = new Reception($db);
777
778$arrayofselected = is_array($toselect) ? $toselect : array();
779
780$param = '';
781if (!empty($mode)) {
782 $param .= '&mode='.urlencode($mode);
783}
784if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
785 $param .= '&contextpage='.urlencode($contextpage);
786}
787if ($limit > 0 && $limit != $conf->liste_limit) {
788 $param .= '&limit='.((int) $limit);
789}
790if ($search_all) {
791 $param .= "&search_all=".urlencode($search_all);
792}
793if ($search_ref_rcp) {
794 $param .= "&search_ref_rcp=".urlencode($search_ref_rcp);
795}
796if ($search_ref_liv) {
797 $param .= "&search_ref_liv=".urlencode($search_ref_liv);
798}
799if ($search_company) {
800 $param .= "&search_company=".urlencode($search_company);
801}
802if ($optioncss != '') {
803 $param .= '&optioncss='.urlencode($optioncss);
804}
805if ($search_billed != '' && $search_billed >= 0) {
806 $param .= "&search_billed=".urlencode((string) ($search_billed));
807}
808if ($search_town) {
809 $param .= "&search_town=".urlencode($search_town);
810}
811if ($search_zip) {
812 $param .= "&search_zip=".urlencode($search_zip);
813}
814if ($search_state) {
815 $param .= "&search_state=".urlencode($search_state);
816}
817if ($search_status != '') {
818 $param .= "&search_status=".urlencode($search_status);
819}
820if ($search_country) {
821 $param .= "&search_country=".urlencode((string) ($search_country));
822}
823if ($search_type_thirdparty) {
824 $param .= "&search_type_thirdparty=".urlencode((string) ($search_type_thirdparty));
825}
826if ($search_date_delivery_startday) {
827 $param .= '&search_date_delivery_startday='.urlencode((string) ($search_date_delivery_startday));
828}
829if ($search_date_delivery_startmonth) {
830 $param .= '&search_date_delivery_startmonth='.urlencode((string) ($search_date_delivery_startmonth));
831}
832if ($search_date_delivery_startyear) {
833 $param .= '&search_date_delivery_startyear='.urlencode((string) ($search_date_delivery_startyear));
834}
835if ($search_date_delivery_endday) {
836 $param .= '&search_date_delivery_endday='.urlencode((string) ($search_date_delivery_endday));
837}
838if ($search_date_delivery_endmonth) {
839 $param .= '&search_date_delivery_endmonth='.urlencode((string) ($search_date_delivery_endmonth));
840}
841if ($search_date_delivery_endyear) {
842 $param .= '&search_date_delivery_endyear='.urlencode((string) ($search_date_delivery_endyear));
843}
844if ($search_date_create_startday) {
845 $param .= '&search_date_create_startday='.urlencode((string) ($search_date_create_startday));
846}
847if ($search_date_create_startmonth) {
848 $param .= '&search_date_create_startmonth='.urlencode((string) ($search_date_create_startmonth));
849}
850if ($search_date_create_startyear) {
851 $param .= '&search_date_create_startyear='.urlencode((string) ($search_date_create_startyear));
852}
853if ($search_date_create_endday) {
854 $param .= '&search_date_create_endday='.urlencode((string) ($search_date_create_endday));
855}
856if ($search_date_create_endmonth) {
857 $param .= '&search_date_create_endmonth='.urlencode((string) ($search_date_create_endmonth));
858}
859if ($search_date_create_endyear) {
860 $param .= '&search_date_create_endyear='.urlencode((string) ($search_date_create_endyear));
861}
862if ($search_ref_supplier) {
863 $param .= "&search_ref_supplier=".urlencode($search_ref_supplier);
864}
865// Add $param from extra fields
866if ($search_array_options) {
867 foreach ($search_array_options as $key => $val) {
868 $crit = $val;
869 $tmpkey = preg_replace('/search_options_/', '', $key);
870 if (is_array($val) && array_key_exists('start', $val) && array_key_exists('end', $val)) {
871 // date range from list filters is stored as array('start' => <timestamp>, 'end' => <timestamp>)
872 // start date
873 $param .= '&search_options_'.$tmpkey.'_startyear='.dol_print_date($val['start'], '%Y');
874 $param .= '&search_options_'.$tmpkey.'_startmonth='.dol_print_date($val['start'], '%m');
875 $param .= '&search_options_'.$tmpkey.'_startday='.dol_print_date($val['start'], '%d');
876 $param .= '&search_options_'.$tmpkey.'_starthour='.dol_print_date($val['start'], '%H');
877 $param .= '&search_options_'.$tmpkey.'_startmin='.dol_print_date($val['start'], '%M');
878 // end date
879 $param .= '&search_options_'.$tmpkey.'_endyear='.dol_print_date($val['end'], '%Y');
880 $param .= '&search_options_'.$tmpkey.'_endmonth='.dol_print_date($val['end'], '%m');
881 $param .= '&search_options_'.$tmpkey.'_endday='.dol_print_date($val['end'], '%d');
882 $param .= '&search_options_'.$tmpkey.'_endhour='.dol_print_date($val['end'], '%H');
883 $param .= '&search_options_'.$tmpkey.'_endmin='.dol_print_date($val['end'], '%M');
884 $val = '';
885 }
886 if ($val != '') {
887 $param .= '&search_options_'.$tmpkey.'='.urlencode($val);
888 }
889 }
890}
891
892
893$arrayofmassactions = array(
894 'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
895 // 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
896);
897
898if ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight('supplier_invoice', 'creer')) {
899 $arrayofmassactions['createbills'] = $langs->trans("CreateInvoiceForThisReceptions");
900}
901if (in_array($massaction, array('presend', 'createbills'))) {
902 $arrayofmassactions = array();
903}
904$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
905
906// Currently: a sending can't create from sending list
907// $url = DOL_URL_ROOT.'/expedition/card.php?action=create';
908// if (!empty($socid)) $url .= '&socid='.$socid;
909// $newcardbutton = dolGetButtonTitle($langs->trans('NewSending'), '', 'fa fa-plus-circle', $url, '', $user->rights->expedition->creer);
910$newcardbutton = '';
911$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'));
912$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'));
913$newcardbutton .= dolGetButtonTitleSeparator();
914$newcardbutton .= dolGetButtonTitle($langs->trans('NewReception'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/reception/card.php?action=create2', '', $user->hasRight('reception', 'creer'));
915
916$i = 0;
917print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
918if ($optioncss != '') {
919 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
920}
921print '<input type="hidden" name="token" value="'.newToken().'">';
922print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
923print '<input type="hidden" name="action" value="list">';
924print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
925print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
926print '<input type="hidden" name="mode" value="'.$mode.'">';
927
928// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
929print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'dollyrevert', 0, $newcardbutton, '', $limit, 0, 0, 1);
930
931if ($massaction == 'createbills') {
932 //var_dump($_REQUEST);
933 print '<input type="hidden" name="massaction" value="confirm_createbills">';
934
935 print '<table class="noborder centpercent">';
936 print '<tr>';
937 print '<td class="titlefieldmiddle">';
938 print $langs->trans('DateInvoice');
939 print '</td>';
940 print '<td>';
941 print $form->selectDate('', '', 0, 0, 0, '', 1, 1);
942 print '</td>';
943 print '</tr>';
944 print '<tr>';
945 print '<td>';
946 print $langs->trans('CreateOneBillByThird');
947 print '</td>';
948 print '<td>';
949 print $form->selectyesno('createbills_onebythird', '', 1);
950 print '</td>';
951 print '</tr>';
952 print '<tr>';
953 print '<td>';
954 print $langs->trans('ValidateInvoices');
955 print '</td>';
956 print '<td>';
957 if (isModEnabled('stock') && getDolGlobalString('STOCK_CALCULATE_ON_BILL')) {
958 print $form->selectyesno('validate_invoices', 0, 1, 1);
959 print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')';
960 } else {
961 print $form->selectyesno('validate_invoices', 0, 1);
962 }
963 print '</td>';
964 print '</tr>';
965 print '</table>';
966
967 print '<br>';
968 print '<div class="center">';
969 print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('CreateInvoiceForThisReceptions').'"> ';
970 print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
971 print '</div>';
972 print '<br>';
973}
974
975if ($search_all) {
976 foreach ($fieldstosearchall as $key => $val) {
977 $fieldstosearchall[$key] = $langs->trans($val);
978 }
979 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>';
980}
981
982$moreforfilter = '';
983
984if (!empty($moreforfilter)) {
985 print '<div class="liste_titre liste_titre_bydiv centpercent">';
986 print $moreforfilter;
987 $parameters = array('type' => $type);
988 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
989 print $hookmanager->resPrint;
990 print '</div>';
991}
992
993$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
994$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN'));
995if ($massactionbutton) {
996 $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); // This also change content of $arrayfields
997}
998
999print '<div class="div-table-responsive">';
1000print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
1001
1002// Fields title search
1003// --------------------------------------------------------------------
1004print '<tr class="liste_titre_filter">';
1005// Action column
1006if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1007 print '<td class="liste_titre center maxwidthsearch">';
1008 $searchpicto = $form->showFilterButtons('left');
1009 print $searchpicto;
1010 print '</td>';
1011}
1012// Ref
1013if (!empty($arrayfields['e.ref']['checked'])) {
1014 print '<td class="liste_titre">';
1015 print '<input class="flat" size="6" type="text" name="search_ref_rcp" value="'.$search_ref_rcp.'">';
1016 print '</td>';
1017}
1018// Ref customer
1019if (!empty($arrayfields['e.ref_supplier']['checked'])) {
1020 print '<td class="liste_titre">';
1021 print '<input class="flat" size="6" type="text" name="search_ref_supplier" value="'.$search_ref_supplier.'">';
1022 print '</td>';
1023}
1024// Thirdparty
1025if (!empty($arrayfields['s.nom']['checked'])) {
1026 print '<td class="liste_titre left">';
1027 print '<input class="flat" type="text" size="8" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
1028 print '</td>';
1029}
1030// Town
1031if (!empty($arrayfields['s.town']['checked'])) {
1032 print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
1033}
1034// Zip
1035if (!empty($arrayfields['s.zip']['checked'])) {
1036 print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
1037}
1038// State
1039if (!empty($arrayfields['state.nom']['checked'])) {
1040 print '<td class="liste_titre">';
1041 print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
1042 print '</td>';
1043}
1044// Country
1045if (!empty($arrayfields['country.code_iso']['checked'])) {
1046 print '<td class="liste_titre center">';
1047 print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
1048 print '</td>';
1049}
1050// Company type
1051if (!empty($arrayfields['typent.code']['checked'])) {
1052 print '<td class="liste_titre maxwidthonsmartphone center">';
1053 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' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1);
1054 print '</td>';
1055}
1056// Date delivery planned
1057if (!empty($arrayfields['e.date_delivery']['checked'])) {
1058 print '<td class="liste_titre center">';
1059 print '<div class="nowrapfordate">';
1060 print $form->selectDate($search_date_delivery_start ? $search_date_delivery_start : -1, 'search_date_delivery_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1061 print '</div>';
1062 print '<div class="nowrapfordate">';
1063 print $form->selectDate($search_date_delivery_end ? $search_date_delivery_end : -1, 'search_date_delivery_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1064 print '</div>';
1065 print '</td>';
1066}
1067if (!empty($arrayfields['l.ref']['checked'])) {
1068 // Delivery ref
1069 print '<td class="liste_titre">';
1070 print '<input class="flat" type="text" name="search_ref_liv" value="'.dol_escape_htmltag($search_ref_liv).'"';
1071 print '</td>';
1072}
1073if (!empty($arrayfields['l.date_delivery']['checked'])) {
1074 // Date received
1075 print '<td class="liste_titre center">&nbsp;</td>';
1076}
1077// Extra fields
1078include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
1079
1080// Fields from hook
1081$parameters = array('arrayfields' => $arrayfields);
1082$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
1083print $hookmanager->resPrint;
1084// Date creation
1085if (!empty($arrayfields['e.datec']['checked'])) {
1086 print '<td class="liste_titre center">';
1087 print '<div class="nowrapfordate">';
1088 print $form->selectDate($search_date_create_start ? $search_date_create_start : -1, 'search_date_create_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
1089 print '</div>';
1090 print '<div class="nowrapfordate">';
1091 print $form->selectDate($search_date_create_end ? $search_date_create_end : -1, 'search_date_create_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
1092 print '</div>';
1093 print '</td>';
1094}
1095// Date modification
1096if (!empty($arrayfields['e.tms']['checked'])) {
1097 print '<td class="liste_titre">';
1098 print '</td>';
1099}
1100// Status
1101if (!empty($arrayfields['e.fk_statut']['checked'])) {
1102 print '<td class="liste_titre right parentonrightofpage">';
1103 print $form->selectarray('search_status', array('0' => $langs->trans('StatusReceptionDraftShort'), '1' => $langs->trans('StatusReceptionValidatedShort'), '2' => $langs->trans('StatusReceptionProcessedShort')), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage');
1104 print '</td>';
1105}
1106// Status billed
1107if (!empty($arrayfields['e.billed']['checked'])) {
1108 print '<td class="liste_titre maxwidthonsmartphone center">';
1109 print $form->selectyesno('search_billed', $search_billed, 1, 0, 1);
1110 print '</td>';
1111}
1112// Action column
1113if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1114 print '<td class="liste_titre middle">';
1115 $searchpicto = $form->showFilterButtons();
1116 print $searchpicto;
1117 print '</td>';
1118}
1119print '</tr>'."\n";
1120
1121$totalarray = array();
1122$totalarray['nbfield'] = 0;
1123
1124// Fields title label
1125// --------------------------------------------------------------------
1126print '<tr class="liste_titre">';
1127// Action column
1128if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1129 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
1130 $totalarray['nbfield']++;
1131}
1132if (!empty($arrayfields['e.ref']['checked'])) {
1133 // @phan-suppress-next-line PhanTypeInvalidDimOffset
1134 print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, '', $sortfield, $sortorder);
1135 $totalarray['nbfield']++;
1136}
1137if (!empty($arrayfields['e.ref_supplier']['checked'])) {
1138 print_liste_field_titre($arrayfields['e.ref_supplier']['label'], $_SERVER["PHP_SELF"], "e.ref_supplier", "", $param, '', $sortfield, $sortorder);
1139 $totalarray['nbfield']++;
1140}
1141if (!empty($arrayfields['s.nom']['checked'])) {
1142 print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder, 'left ');
1143 $totalarray['nbfield']++;
1144}
1145if (!empty($arrayfields['s.town']['checked'])) {
1146 print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
1147 $totalarray['nbfield']++;
1148}
1149if (!empty($arrayfields['s.zip']['checked'])) {
1150 print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
1151 $totalarray['nbfield']++;
1152}
1153if (!empty($arrayfields['state.nom']['checked'])) {
1154 print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
1155 $totalarray['nbfield']++;
1156}
1157if (!empty($arrayfields['country.code_iso']['checked'])) {
1158 print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
1159 $totalarray['nbfield']++;
1160}
1161if (!empty($arrayfields['typent.code']['checked'])) {
1162 print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center ');
1163 $totalarray['nbfield']++;
1164}
1165if (!empty($arrayfields['e.date_delivery']['checked'])) {
1166 print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, '', $sortfield, $sortorder, 'center ');
1167 $totalarray['nbfield']++;
1168}
1169if (!empty($arrayfields['l.ref']['checked'])) {
1170 print_liste_field_titre($arrayfields['l.ref']['label'], $_SERVER["PHP_SELF"], "l.ref", "", $param, '', $sortfield, $sortorder);
1171 $totalarray['nbfield']++;
1172}
1173if (!empty($arrayfields['l.date_delivery']['checked'])) {
1174 print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"], "l.date_delivery", "", $param, '', $sortfield, $sortorder, 'center ');
1175 $totalarray['nbfield']++;
1176}
1177// Extra fields
1178include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
1179// Hook fields
1180$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, '$totalarray' => &$totalarray);
1181$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
1182print $hookmanager->resPrint;
1183if (!empty($arrayfields['e.datec']['checked'])) {
1184 print_liste_field_titre($arrayfields['e.datec']['label'], $_SERVER["PHP_SELF"], "e.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1185 $totalarray['nbfield']++;
1186}
1187if (!empty($arrayfields['e.tms']['checked'])) {
1188 print_liste_field_titre($arrayfields['e.tms']['label'], $_SERVER["PHP_SELF"], "e.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1189 $totalarray['nbfield']++;
1190}
1191if (!empty($arrayfields['e.fk_statut']['checked'])) {
1192 print_liste_field_titre($arrayfields['e.fk_statut']['label'], $_SERVER["PHP_SELF"], "e.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
1193 $totalarray['nbfield']++;
1194}
1195if (!empty($arrayfields['e.billed']['checked'])) {
1196 print_liste_field_titre($arrayfields['e.billed']['label'], $_SERVER["PHP_SELF"], "e.billed", "", $param, '', $sortfield, $sortorder, 'center ');
1197 $totalarray['nbfield']++;
1198}
1199// Action column
1200if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1201 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
1202 $totalarray['nbfield']++;
1203}
1204print "</tr>\n";
1205
1206
1207// Loop on record
1208// --------------------------------------------------------------------
1209$i = 0;
1210$savnbfield = $totalarray['nbfield'];
1211$totalarray = array();
1212$totalarray['nbfield'] = 0;
1213$imaxinloop = ($limit ? min($num, $limit) : $num);
1214while ($i < $imaxinloop) {
1215 $obj = $db->fetch_object($resql);
1216 if (empty($obj)) {
1217 break; // Should not happen
1218 }
1219
1220 $reception->id = $obj->rowid;
1221 $reception->ref = $obj->ref;
1222 //$reception->ref_supplier = $obj->ref_supplier;
1223 $reception->statut = $obj->status;
1224 $reception->status = $obj->status;
1225 $reception->socid = $obj->socid;
1226 $reception->billed = $obj->billed;
1227
1228 $reception->fetch_thirdparty();
1229
1230 $object = $reception;
1231
1232 $companystatic->id = $obj->socid;
1233 $companystatic->ref = $obj->name;
1234 $companystatic->name = $obj->name;
1235
1236 if ($mode == 'kanban') {
1237 if ($i == 0) {
1238 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
1239 print '<div class="box-flex-container kanban">';
1240 }
1241 $object->date_delivery = $obj->delivery_date;
1242 $object->town = $obj->town;
1243
1244 // Output Kanban
1245 $selected = -1;
1246 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1247 $selected = 0;
1248 if (in_array($object->id, $arrayofselected)) {
1249 $selected = 1;
1250 }
1251 }
1252 print $object->getKanbanView('', array('thirdparty' => $companystatic->getNomUrl(1), 'selected' => $selected));
1253 if ($i == min($num, $limit) - 1) {
1254 print '</div>';
1255 print '</td></tr>';
1256 }
1257 } else {
1258 print '<tr class="oddeven">';
1259
1260 // Action column
1261 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1262 print '<td class="nowrap center">';
1263 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1264 $selected = 0;
1265 if (in_array($obj->rowid, $arrayofselected)) {
1266 $selected = 1;
1267 }
1268 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1269 }
1270 print '</td>';
1271 }
1272 // Ref
1273 if (!empty($arrayfields['e.ref']['checked'])) {
1274 print '<td class="nowraponall">';
1275 print $reception->getNomUrl(1);
1276 $filename = dol_sanitizeFileName($reception->ref);
1277 $filedir = $conf->reception->dir_output.'/'.dol_sanitizeFileName($reception->ref);
1278 $urlsource = $_SERVER['PHP_SELF'].'?id='.$reception->id;
1279 print $formfile->getDocumentsLink($reception->element, $filename, $filedir);
1280 print "</td>\n";
1281
1282 if (!$i) {
1283 $totalarray['nbfield']++;
1284 }
1285 }
1286
1287 // Ref supplier
1288 if (!empty($arrayfields['e.ref_supplier']['checked'])) {
1289 print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->ref_supplier).'">';
1290 print dol_escape_htmltag($obj->ref_supplier);
1291 print "</td>\n";
1292 if (!$i) {
1293 $totalarray['nbfield']++;
1294 }
1295 }
1296
1297 // Third party
1298 if (!empty($arrayfields['s.nom']['checked'])) {
1299 print '<td class="tdoverflowmax150">';
1300 print $companystatic->getNomUrl(1);
1301 print '</td>';
1302 if (!$i) {
1303 $totalarray['nbfield']++;
1304 }
1305 }
1306 // Town
1307 if (!empty($arrayfields['s.town']['checked'])) {
1308 print '<td class="nocellnopadd tdoverflowmax200" title="'.dol_escape_htmltag($obj->town).'">';
1309 print dol_escape_htmltag($obj->town);
1310 print '</td>';
1311 if (!$i) {
1312 $totalarray['nbfield']++;
1313 }
1314 }
1315 // Zip
1316 if (!empty($arrayfields['s.zip']['checked'])) {
1317 print '<td class="nocellnopadd center"">';
1318 print dol_escape_htmltag($obj->zip);
1319 print '</td>';
1320 if (!$i) {
1321 $totalarray['nbfield']++;
1322 }
1323 }
1324 // State
1325 if (!empty($arrayfields['state.nom']['checked'])) {
1326 print "<td>".dol_escape_htmltag($obj->state_name)."</td>\n";
1327 if (!$i) {
1328 $totalarray['nbfield']++;
1329 }
1330 }
1331 // Country
1332 if (!empty($arrayfields['country.code_iso']['checked'])) {
1333 print '<td class="center">';
1334 $tmparray = getCountry($obj->fk_pays, 'all');
1335 print dol_escape_htmltag($tmparray['label']);
1336 print '</td>';
1337 if (!$i) {
1338 $totalarray['nbfield']++;
1339 }
1340 }
1341 // Type ent
1342 if (!empty($arrayfields['typent.code']['checked'])) {
1343 print '<td class="center">';
1344 if (!isset($typenArray) || empty($typenArray)) {
1345 $typenArray = $formcompany->typent_array(1);
1346 }
1347 if (isset($typenArray[$obj->typent_code])) {
1348 print $typenArray[$obj->typent_code];
1349 }
1350 print '</td>';
1351 if (!$i) {
1352 $totalarray['nbfield']++;
1353 }
1354 }
1355
1356 // Date delivery planned
1357 if (!empty($arrayfields['e.date_delivery']['checked'])) {
1358 print '<td class="center">';
1359 print dol_print_date($db->jdate($obj->delivery_date), "day");
1360 /*$now = time();
1361 if ( ($now - $db->jdate($obj->date_reception)) > $conf->warnings->lim && $obj->statutid == 1 )
1362 {
1363 }*/
1364 print "</td>\n";
1365 if (!$i) {
1366 $totalarray['nbfield']++;
1367 }
1368 }
1369
1370 if (!empty($arrayfields['l.ref']['checked']) || !empty($arrayfields['l.date_delivery']['checked'])) {
1371 $reception->fetchObjectLinked($reception->id, $reception->element);
1372 $receiving = '';
1373 if (count($reception->linkedObjects['delivery']) > 0) {
1374 $receiving = reset($reception->linkedObjects['delivery']);
1375 }
1376
1377 if (!empty($arrayfields['l.ref']['checked'])) {
1378 // Ref
1379 print '<td>';
1380 print !empty($receiving) ? $receiving->getNomUrl($db) : '';
1381 print '</td>';
1382 }
1383
1384 if (!empty($arrayfields['l.date_delivery']['checked'])) {
1385 // Date received
1386 print '<td class="center">';
1387 print dol_print_date($db->jdate($obj->date_reception), "day");
1388 print '</td>'."\n";
1389 }
1390 }
1391
1392 // Extra fields
1393 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1394
1395 // Fields from hook
1396 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1397 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
1398 print $hookmanager->resPrint;
1399 // Date creation
1400 if (!empty($arrayfields['e.datec']['checked'])) {
1401 print '<td class="center nowraponall">';
1402 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuserrel');
1403 print '</td>';
1404 if (!$i) {
1405 $totalarray['nbfield']++;
1406 }
1407 }
1408 // Date modification
1409 if (!empty($arrayfields['e.tms']['checked'])) {
1410 print '<td class="center nowraponall">';
1411 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuserrel');
1412 print '</td>';
1413 if (!$i) {
1414 $totalarray['nbfield']++;
1415 }
1416 }
1417 // Status
1418 if (!empty($arrayfields['e.fk_statut']['checked'])) {
1419 print '<td class="right nowrap">'.$reception->LibStatut($obj->status, 5).'</td>';
1420 if (!$i) {
1421 $totalarray['nbfield']++;
1422 }
1423 }
1424 // Billed
1425 if (!empty($arrayfields['e.billed']['checked'])) {
1426 print '<td class="center">'.yn($obj->billed).'</td>';
1427 if (!$i) {
1428 $totalarray['nbfield']++;
1429 }
1430 }
1431
1432 // Action column
1433 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1434 print '<td class="nowrap center">';
1435 if ($massactionbutton || $massaction) {
1436 // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1437 $selected = 0;
1438 if (in_array($obj->rowid, $arrayofselected)) {
1439 $selected = 1;
1440 }
1441 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1442 }
1443 print '</td>';
1444 }
1445 if (!$i) {
1446 $totalarray['nbfield']++;
1447 }
1448
1449 print "</tr>\n";
1450 }
1451 $i++;
1452}
1453
1454// If no record found
1455if ($num == 0) {
1456 $colspan = 1;
1457 foreach ($arrayfields as $key => $val) {
1458 if (!empty($val['checked'])) {
1459 $colspan++;
1460 }
1461 }
1462 print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
1463}
1464
1465// Show total line
1466include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1467
1468$parameters = array('arrayfields' => $arrayfields, 'totalarray' => $totalarray, 'sql' => $sql);
1469$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
1470print $hookmanager->resPrint;
1471
1472print "</table>";
1473print "</div>";
1474print '</form>';
1475
1476$db->free($resql);
1477
1478$hidegeneratedfilelistifempty = 1;
1479if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
1480 $hidegeneratedfilelistifempty = 0;
1481}
1482
1483// Show list of available documents
1484$urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1485$urlsource .= str_replace('&amp;', '&', $param);
1486
1487$filedir = $diroutputmassaction;
1488$genallowed = $user->hasRight('reception', 'lire');
1489$delallowed = $user->hasRight('reception', 'creer');
1490$title = '';
1491
1492print $formfile->showdocuments('massfilesarea_receipts', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1493
1494// End of page
1495llxFooter();
1496$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 absolute discounts.
Class to manage standard extra fields.
Class to manage suppliers invoices.
Class to build HTML component for third parties management Only common components are here.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class to manage receptions.
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.
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...
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...
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.
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.