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