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