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.'/fourn/class/fournisseur.commande.class.php';
37require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
38require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
39require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
40require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
41require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
42
51$langs->loadLangs(array("sendings", "receptions", "deliveries", 'companies', 'bills', 'orders'));
52
53$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'shipmentlist'; // To manage different context of search
54
55$socid = GETPOSTINT('socid');
56
57$action = GETPOST('action', 'alpha');
58$massaction = GETPOST('massaction', 'alpha');
59$show_files = GETPOSTINT('show_files');
60$toselect = GETPOST('toselect', 'array');
61$optioncss = GETPOST('optioncss', 'alpha');
62$mode = GETPOST('mode', 'alpha');
63
64
65$search_ref_rcp = GETPOST("search_ref_rcp");
66$search_ref_liv = GETPOST('search_ref_liv');
67$search_ref_supplier = GETPOST('search_ref_supplier');
68$search_company = GETPOST("search_company");
69$search_town = GETPOST('search_town', 'alpha');
70$search_zip = GETPOST('search_zip', 'alpha');
71$search_state = GETPOST("search_state");
72$search_country = GETPOST("search_country", 'aZ09');
73$search_type_thirdparty = GETPOST("search_type_thirdparty", 'intcomma');
74$search_date_delivery_startday = GETPOSTINT('search_date_delivery_startday');
75$search_date_delivery_startmonth = GETPOSTINT('search_date_delivery_startmonth');
76$search_date_delivery_startyear = GETPOSTINT('search_date_delivery_startyear');
77$search_date_delivery_endday = GETPOSTINT('search_date_delivery_endday');
78$search_date_delivery_endmonth = GETPOSTINT('search_date_delivery_endmonth');
79$search_date_delivery_endyear = GETPOSTINT('search_date_delivery_endyear');
80$search_date_delivery_start = dol_mktime(0, 0, 0, $search_date_delivery_startmonth, $search_date_delivery_startday, $search_date_delivery_startyear); // Use tzserver
81$search_date_delivery_end = dol_mktime(23, 59, 59, $search_date_delivery_endmonth, $search_date_delivery_endday, $search_date_delivery_endyear);
82$search_date_create_startday = GETPOSTINT('search_date_create_startday');
83$search_date_create_startmonth = GETPOSTINT('search_date_create_startmonth');
84$search_date_create_startyear = GETPOSTINT('search_date_create_startyear');
85$search_date_create_endday = GETPOSTINT('search_date_create_endday');
86$search_date_create_endmonth = GETPOSTINT('search_date_create_endmonth');
87$search_date_create_endyear = GETPOSTINT('search_date_create_endyear');
88$search_date_create_start = dol_mktime(0, 0, 0, $search_date_create_startmonth, $search_date_create_startday, $search_date_create_startyear); // Use tzserver
89$search_date_create_end = dol_mktime(23, 59, 59, $search_date_create_endmonth, $search_date_create_endday, $search_date_create_endyear);
90$search_billed = GETPOST("search_billed", 'intcomma');
91$search_status = GETPOST('search_status', 'intcomma');
92$search_all = GETPOST('search_all', 'alphanohtml');
93
94$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
95$sortfield = GETPOST('sortfield', 'aZ09comma');
96$sortorder = GETPOST('sortorder', 'aZ09comma');
97$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
98if (!$sortfield) {
99 $sortfield = "e.ref";
100}
101if (!$sortorder) {
102 $sortorder = "DESC";
103}
104if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
105 // If $page is not defined, or '' or -1 or if we click on clear filters
106 $page = 0;
107}
108$offset = $limit * $page;
109$pageprev = $page - 1;
110$pagenext = $page + 1;
111
112$diroutputmassaction = $conf->reception->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id;
113$object = new Reception($db);
114
115// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
116$hookmanager->initHooks(array('receptionlist'));
117$extrafields = new ExtraFields($db);
118
119// Fetch optionals attributes and labels
120$extrafields->fetch_name_optionals_label($object->table_element);
121$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
122
123// List of fields to search into when doing a "search in all"
124$fieldstosearchall = array(
125 'e.ref' => "Ref",
126 'e.ref_supplier' => "RefSupplier",
127 's.nom' => "ThirdParty",
128 'e.note_public' => 'NotePublic',
129);
130if (empty($user->socid)) {
131 $fieldstosearchall["e.note_private"] = "NotePrivate";
132}
133
134$checkedtypetiers = '0';
135$arrayfields = array(
136 'e.ref' => array('label' => $langs->trans("Ref"), 'checked' => '1'),
137 'e.ref_supplier' => array('label' => $langs->trans("RefSupplier"), 'checked' => '1'),
138 's.nom' => array('label' => $langs->trans("ThirdParty"), 'checked' => '1'),
139 's.town' => array('label' => $langs->trans("Town"), 'checked' => '1'),
140 's.zip' => array('label' => $langs->trans("Zip"), 'checked' => '1'),
141 'state.nom' => array('label' => $langs->trans("StateShort"), 'checked' => '0'),
142 'country.code_iso' => array('label' => $langs->trans("Country"), 'checked' => '0'),
143 'typent.code' => array('label' => $langs->trans("ThirdPartyType"), 'checked' => $checkedtypetiers),
144 'e.date_delivery' => array('label' => $langs->trans("DateDeliveryPlanned"), 'checked' => '1'),
145 'e.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => '0', 'position' => 500),
146 'e.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => '0', 'position' => 500),
147 'e.fk_statut' => array('label' => $langs->trans("Status"), 'checked' => '1', 'position' => 1000),
148 'e.billed' => array('label' => $langs->trans("Billed"), 'checked' => '1', 'position' => 1000, 'enabled' => 'getDolGlobalString("WORKFLOW_BILL_ON_RECEPTION") !== "0"')
149);
150
151// Extra fields
152include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
153
154$object->fields = dol_sort_array($object->fields, 'position');
155$arrayfields = dol_sort_array($arrayfields, 'position');
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 $soc = null;
252 $rcp = new Reception($db);
253 // We not allow invoice reception that are in draft status
254 if ($rcp->fetch($id_reception) <= 0 || $rcp->statut == $rcp::STATUS_DRAFT) {
255 $errors[] = $langs->trans('StatusOfRefMustBe', $rcp->ref, $langs->transnoentities("StatusReceptionValidatedShort"));
256 $error++;
257 continue;
258 }
259
260 $objecttmp = new FactureFournisseur($db);
261 if (!empty($createbills_onebythird) && !empty($TFactThird[$rcp->socid])) {
262 // If option "one bill per third" is set, and an invoice for this thirdparty was already created, we reuse it.
263 $objecttmp = $TFactThird[$rcp->socid];
264
265 // Add all links of this new reception to the existing invoice
266 $objecttmp->fetchObjectLinked();
267 $rcp->fetchObjectLinked();
268 if (!empty($rcp->linkedObjectsIds['order_supplier']) && is_array($rcp->linkedObjectsIds['order_supplier'])) {
269 foreach ($rcp->linkedObjectsIds['order_supplier'] as $key => $value) {
270 if (empty($objecttmp->linkedObjectsIds['order_supplier']) || !in_array($value, $objecttmp->linkedObjectsIds['order_supplier'])) { //Don't try to link if already linked
271 $objecttmp->add_object_linked('order_supplier', $value); // add supplier order linked object
272 }
273 }
274 }
275 } else {
276 $cond_reglement_id = 0;
277 $mode_reglement_id = 0;
278 $fk_account = 0;
279 $transport_mode_id = 0;
280 $multicurrency_code = null;
281
282 if (!empty($rcp->cond_reglement_id)) {
283 $cond_reglement_id = $rcp->cond_reglement_id;
284 }
285 if (!empty($rcp->mode_reglement_id)) {
286 $mode_reglement_id = $rcp->mode_reglement_id;
287 }
288 if (!empty($rcp->fk_account)) {
289 $fk_account = $rcp->fk_account;
290 }
291 if (!empty($rcp->transport_mode_id)) {
292 $transport_mode_id = $rcp->transport_mode_id;
293 }
294 if (!empty($rcp->multicurrency_code)) {
295 $multicurrency_code = $rcp->multicurrency_code;
296 }
297
298 if (empty($cond_reglement_id)
299 || empty($mode_reglement_id)
300 || empty($fk_account)
301 || empty($transport_mode_id)
302 || empty($multicurrency_code)
303 ) {
304 if (!isset($rcp->supplier_order)) {
305 $rcp->fetch_origin();
306 }
307
308 // try to get from source of reception (supplier order)
309 if (!empty($rcp->origin_object)) {
310 $supplierOrder = $rcp->origin_object;
311 if (empty($cond_reglement_id) && !empty($supplierOrder->cond_reglement_id)) {
312 $cond_reglement_id = $supplierOrder->cond_reglement_id;
313 }
314 if (empty($mode_reglement_id) && !empty($supplierOrder->mode_reglement_id)) {
315 $mode_reglement_id = $supplierOrder->mode_reglement_id;
316 }
317 if (empty($fk_account) && !empty($supplierOrder->fk_account)) {
318 $fk_account = $supplierOrder->fk_account;
319 }
320 if (empty($transport_mode_id) && !empty($supplierOrder->transport_mode_id)) {
321 $transport_mode_id = $supplierOrder->transport_mode_id;
322 }
323 if (empty($multicurrency_code) && !empty($supplierOrder->multicurrency_code)) {
324 $multicurrency_code = $supplierOrder->multicurrency_code;
325 }
326 }
327
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 0,
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// @phan-suppress-next-line PhanTypeMismatchArgumentNullable
667$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
668$sql .= $hookmanager->resPrint;
669$sql .= " WHERE e.entity IN (".getEntity('reception').")";
670if ($socid) {
671 $sql .= " AND e.fk_soc = ".((int) $socid);
672}
673if ($search_status != '' && $search_status >= 0) {
674 $sql .= " AND e.fk_statut = ".((int) $search_status);
675}
676if ($search_billed != '' && $search_billed >= 0) {
677 $sql .= ' AND e.billed = '.((int) $search_billed);
678}
679if ($search_town) {
680 $sql .= natural_search('s.town', $search_town);
681}
682if ($search_zip) {
683 $sql .= natural_search("s.zip", $search_zip);
684}
685if ($search_state) {
686 $sql .= natural_search("state.nom", $search_state);
687}
688if ($search_country) {
689 $sql .= " AND s.fk_pays IN (".$db->sanitize($search_country).')';
690}
691if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
692 $sql .= " AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).')';
693}
694if ($search_date_delivery_start) {
695 $sql .= " AND e.date_delivery >= '".$db->idate($search_date_delivery_start)."'";
696}
697if ($search_date_delivery_end) {
698 $sql .= " AND e.date_delivery <= '".$db->idate($search_date_delivery_end)."'";
699}
700if ($search_date_create_start) {
701 $sql .= " AND e.date_creation >= '".$db->idate($search_date_create_start)."'";
702}
703if ($search_date_create_end) {
704 $sql .= " AND e.date_creation <= '".$db->idate($search_date_create_end)."'";
705}
706if ($search_ref_rcp) {
707 $sql .= natural_search('e.ref', $search_ref_rcp);
708}
709if ($search_ref_liv) {
710 $sql .= natural_search('l.ref', $search_ref_liv);
711}
712if ($search_company) {
713 $sql .= natural_search('s.nom', $search_company);
714}
715if ($search_ref_supplier) {
716 $sql .= natural_search('e.ref_supplier', $search_ref_supplier);
717}
718if ($search_all) {
719 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
720}
721// Search on sale representative
722/*
723if ($search_sale && $search_sale != '-1') {
724 if ($search_sale == -2) {
725 $sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc)";
726 } elseif ($search_sale > 0) {
727 $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).")";
728 }
729}
730*/
731// Add where from extra fields
732include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
733// Add where from hooks
734$parameters = array();
735$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
736$sql .= $hookmanager->resPrint;
737
738// Add HAVING from hooks
739$parameters = array();
740$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
741$sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
742
743$nbtotalofrecords = '';
744if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
745 /* The fast and low memory method to get and count full list converts the sql into a sql count */
746 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
747 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
748 $resql = $db->query($sqlforcount);
749 if ($resql) {
750 $objforcount = $db->fetch_object($resql);
751 $nbtotalofrecords = $objforcount->nbtotalofrecords;
752 } else {
753 dol_print_error($db);
754 }
755
756 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
757 $page = 0;
758 $offset = 0;
759 }
760 $db->free($resql);
761}
762
763// Complete request and execute it with limit
764$sql .= $db->order($sortfield, $sortorder);
765if ($limit) {
766 $sql .= $db->plimit($limit + 1, $offset);
767}
768
769//print $sql;
770$resql = $db->query($sql);
771if (!$resql) {
772 dol_print_error($db);
773 exit;
774}
775
776$num = $db->num_rows($resql);
777
778$reception = new Reception($db);
779
780$arrayofselected = is_array($toselect) ? $toselect : array();
781
782$param = '';
783if (!empty($mode)) {
784 $param .= '&mode='.urlencode($mode);
785}
786if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
787 $param .= '&contextpage='.urlencode($contextpage);
788}
789if ($limit > 0 && $limit != $conf->liste_limit) {
790 $param .= '&limit='.((int) $limit);
791}
792if ($search_all) {
793 $param .= "&search_all=".urlencode($search_all);
794}
795if ($search_ref_rcp) {
796 $param .= "&search_ref_rcp=".urlencode($search_ref_rcp);
797}
798if ($search_ref_liv) {
799 $param .= "&search_ref_liv=".urlencode($search_ref_liv);
800}
801if ($search_company) {
802 $param .= "&search_company=".urlencode($search_company);
803}
804if ($optioncss != '') {
805 $param .= '&optioncss='.urlencode($optioncss);
806}
807if ($search_billed != '' && $search_billed >= 0) {
808 $param .= "&search_billed=".urlencode((string) ($search_billed));
809}
810if ($search_town) {
811 $param .= "&search_town=".urlencode($search_town);
812}
813if ($search_zip) {
814 $param .= "&search_zip=".urlencode($search_zip);
815}
816if ($search_state) {
817 $param .= "&search_state=".urlencode($search_state);
818}
819if ($search_status != '') {
820 $param .= "&search_status=".urlencode($search_status);
821}
822if ($search_country) {
823 $param .= "&search_country=".urlencode((string) ($search_country));
824}
825if ($search_type_thirdparty) {
826 $param .= "&search_type_thirdparty=".urlencode((string) ($search_type_thirdparty));
827}
828if ($search_date_delivery_startday) {
829 $param .= '&search_date_delivery_startday='.urlencode((string) ($search_date_delivery_startday));
830}
831if ($search_date_delivery_startmonth) {
832 $param .= '&search_date_delivery_startmonth='.urlencode((string) ($search_date_delivery_startmonth));
833}
834if ($search_date_delivery_startyear) {
835 $param .= '&search_date_delivery_startyear='.urlencode((string) ($search_date_delivery_startyear));
836}
837if ($search_date_delivery_endday) {
838 $param .= '&search_date_delivery_endday='.urlencode((string) ($search_date_delivery_endday));
839}
840if ($search_date_delivery_endmonth) {
841 $param .= '&search_date_delivery_endmonth='.urlencode((string) ($search_date_delivery_endmonth));
842}
843if ($search_date_delivery_endyear) {
844 $param .= '&search_date_delivery_endyear='.urlencode((string) ($search_date_delivery_endyear));
845}
846if ($search_date_create_startday) {
847 $param .= '&search_date_create_startday='.urlencode((string) ($search_date_create_startday));
848}
849if ($search_date_create_startmonth) {
850 $param .= '&search_date_create_startmonth='.urlencode((string) ($search_date_create_startmonth));
851}
852if ($search_date_create_startyear) {
853 $param .= '&search_date_create_startyear='.urlencode((string) ($search_date_create_startyear));
854}
855if ($search_date_create_endday) {
856 $param .= '&search_date_create_endday='.urlencode((string) ($search_date_create_endday));
857}
858if ($search_date_create_endmonth) {
859 $param .= '&search_date_create_endmonth='.urlencode((string) ($search_date_create_endmonth));
860}
861if ($search_date_create_endyear) {
862 $param .= '&search_date_create_endyear='.urlencode((string) ($search_date_create_endyear));
863}
864if ($search_ref_supplier) {
865 $param .= "&search_ref_supplier=".urlencode($search_ref_supplier);
866}
867// Add $param from extra fields
868if ($search_array_options) {
869 foreach ($search_array_options as $key => $val) {
870 $crit = $val;
871 $tmpkey = preg_replace('/search_options_/', '', $key);
872 if (is_array($val) && array_key_exists('start', $val) && array_key_exists('end', $val)) {
873 // date range from list filters is stored as array('start' => <timestamp>, 'end' => <timestamp>)
874 // start date
875 $param .= '&search_options_'.$tmpkey.'_startyear='.dol_print_date($val['start'], '%Y');
876 $param .= '&search_options_'.$tmpkey.'_startmonth='.dol_print_date($val['start'], '%m');
877 $param .= '&search_options_'.$tmpkey.'_startday='.dol_print_date($val['start'], '%d');
878 $param .= '&search_options_'.$tmpkey.'_starthour='.dol_print_date($val['start'], '%H');
879 $param .= '&search_options_'.$tmpkey.'_startmin='.dol_print_date($val['start'], '%M');
880 // end date
881 $param .= '&search_options_'.$tmpkey.'_endyear='.dol_print_date($val['end'], '%Y');
882 $param .= '&search_options_'.$tmpkey.'_endmonth='.dol_print_date($val['end'], '%m');
883 $param .= '&search_options_'.$tmpkey.'_endday='.dol_print_date($val['end'], '%d');
884 $param .= '&search_options_'.$tmpkey.'_endhour='.dol_print_date($val['end'], '%H');
885 $param .= '&search_options_'.$tmpkey.'_endmin='.dol_print_date($val['end'], '%M');
886 $val = '';
887 }
888 if ($val != '') {
889 $param .= '&search_options_'.$tmpkey.'='.urlencode($val);
890 }
891 }
892}
893
894
895$arrayofmassactions = array(
896 'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
897 // 'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
898);
899
900if ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight('supplier_invoice', 'creer')) {
901 $arrayofmassactions['createbills'] = $langs->trans("CreateInvoiceForThisReceptions");
902}
903if (in_array($massaction, array('presend', 'createbills'))) {
904 $arrayofmassactions = array();
905}
906$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
907
908// Currently: a sending can't create from sending list
909// $url = DOL_URL_ROOT.'/expedition/card.php?action=create';
910// if (!empty($socid)) $url .= '&socid='.$socid;
911// $newcardbutton = dolGetButtonTitle($langs->trans('NewSending'), '', 'fa fa-plus-circle', $url, '', $user->rights->expedition->creer);
912$newcardbutton = '';
913$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'));
914$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'));
915$newcardbutton .= dolGetButtonTitleSeparator();
916$newcardbutton .= dolGetButtonTitle($langs->trans('NewReception'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/reception/card.php?action=create2', '', $user->hasRight('reception', 'creer'));
917
918$i = 0;
919print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
920if ($optioncss != '') {
921 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
922}
923print '<input type="hidden" name="token" value="'.newToken().'">';
924print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
925print '<input type="hidden" name="action" value="list">';
926print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
927print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
928print '<input type="hidden" name="mode" value="'.$mode.'">';
929
930// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
931print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'dollyrevert', 0, $newcardbutton, '', $limit, 0, 0, 1);
932
933if ($massaction == 'createbills') {
934 //var_dump($_REQUEST);
935 print '<input type="hidden" name="massaction" value="confirm_createbills">';
936
937 print '<table class="noborder centpercent">';
938 print '<tr>';
939 print '<td class="titlefieldmiddle">';
940 print $langs->trans('DateInvoice');
941 print '</td>';
942 print '<td>';
943 print $form->selectDate('', '', 0, 0, 0, '', 1, 1);
944 print '</td>';
945 print '</tr>';
946 print '<tr>';
947 print '<td>';
948 print $langs->trans('CreateOneBillByThird');
949 print '</td>';
950 print '<td>';
951 print $form->selectyesno('createbills_onebythird', '', 1);
952 print '</td>';
953 print '</tr>';
954 print '<tr>';
955 print '<td>';
956 print $langs->trans('ValidateInvoices');
957 print '</td>';
958 print '<td>';
959 if (isModEnabled('stock') && getDolGlobalString('STOCK_CALCULATE_ON_BILL')) {
960 print $form->selectyesno('validate_invoices', 0, 1, 1);
961 print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')';
962 } else {
963 print $form->selectyesno('validate_invoices', 0, 1);
964 }
965 print '</td>';
966 print '</tr>';
967 print '</table>';
968
969 print '<br>';
970 print '<div class="center">';
971 print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('CreateInvoiceForThisReceptions').'"> ';
972 print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
973 print '</div>';
974 print '<br>';
975}
976
977if ($search_all) {
978 foreach ($fieldstosearchall as $key => $val) {
979 $fieldstosearchall[$key] = $langs->trans($val);
980 }
981 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>';
982}
983
984$moreforfilter = '';
985
986if (!empty($moreforfilter)) {
987 print '<div class="liste_titre liste_titre_bydiv centpercent">';
988 print $moreforfilter;
989 $parameters = array('type' => $type);
990 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
991 print $hookmanager->resPrint;
992 print '</div>';
993}
994
995$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
996$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN'));
997if ($massactionbutton) {
998 $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); // This also change content of $arrayfields
999}
1000
1001print '<div class="div-table-responsive">';
1002print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
1003
1004// Fields title search
1005// --------------------------------------------------------------------
1006print '<tr class="liste_titre_filter">';
1007// Action column
1008if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1009 print '<td class="liste_titre center maxwidthsearch">';
1010 $searchpicto = $form->showFilterButtons('left');
1011 print $searchpicto;
1012 print '</td>';
1013}
1014// Ref
1015if (!empty($arrayfields['e.ref']['checked'])) {
1016 print '<td class="liste_titre">';
1017 print '<input class="flat" size="6" type="text" name="search_ref_rcp" value="'.$search_ref_rcp.'">';
1018 print '</td>';
1019}
1020// Ref customer
1021if (!empty($arrayfields['e.ref_supplier']['checked'])) {
1022 print '<td class="liste_titre">';
1023 print '<input class="flat" size="6" type="text" name="search_ref_supplier" value="'.$search_ref_supplier.'">';
1024 print '</td>';
1025}
1026// Thirdparty
1027if (!empty($arrayfields['s.nom']['checked'])) {
1028 print '<td class="liste_titre left">';
1029 print '<input class="flat" type="text" size="8" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
1030 print '</td>';
1031}
1032// Town
1033if (!empty($arrayfields['s.town']['checked'])) {
1034 print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
1035}
1036// Zip
1037if (!empty($arrayfields['s.zip']['checked'])) {
1038 print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
1039}
1040// State
1041if (!empty($arrayfields['state.nom']['checked'])) {
1042 print '<td class="liste_titre">';
1043 print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
1044 print '</td>';
1045}
1046// Country
1047if (!empty($arrayfields['country.code_iso']['checked'])) {
1048 print '<td class="liste_titre center">';
1049 print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
1050 print '</td>';
1051}
1052// Company type
1053if (!empty($arrayfields['typent.code']['checked'])) {
1054 print '<td class="liste_titre maxwidthonsmartphone center">';
1055 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);
1056 print '</td>';
1057}
1058// Date delivery planned
1059if (!empty($arrayfields['e.date_delivery']['checked'])) {
1060 print '<td class="liste_titre center">';
1061 print '<div class="nowrapfordate">';
1062 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'));
1063 print '</div>';
1064 print '<div class="nowrapfordate">';
1065 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'));
1066 print '</div>';
1067 print '</td>';
1068}
1069if (!empty($arrayfields['l.ref']['checked'])) {
1070 // Delivery ref
1071 print '<td class="liste_titre">';
1072 print '<input class="flat" type="text" name="search_ref_liv" value="'.dol_escape_htmltag($search_ref_liv).'"';
1073 print '</td>';
1074}
1075if (!empty($arrayfields['l.date_delivery']['checked'])) {
1076 // Date received
1077 print '<td class="liste_titre center">&nbsp;</td>';
1078}
1079// Extra fields
1080include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
1081
1082// Fields from hook
1083$parameters = array('arrayfields' => $arrayfields);
1084$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
1085print $hookmanager->resPrint;
1086// Date creation
1087if (!empty($arrayfields['e.datec']['checked'])) {
1088 print '<td class="liste_titre center">';
1089 print '<div class="nowrapfordate">';
1090 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'));
1091 print '</div>';
1092 print '<div class="nowrapfordate">';
1093 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'));
1094 print '</div>';
1095 print '</td>';
1096}
1097// Date modification
1098if (!empty($arrayfields['e.tms']['checked'])) {
1099 print '<td class="liste_titre">';
1100 print '</td>';
1101}
1102// Status
1103if (!empty($arrayfields['e.fk_statut']['checked'])) {
1104 print '<td class="liste_titre right parentonrightofpage">';
1105 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');
1106 print '</td>';
1107}
1108// Status billed
1109if (!empty($arrayfields['e.billed']['checked'])) {
1110 print '<td class="liste_titre maxwidthonsmartphone center">';
1111 print $form->selectyesno('search_billed', $search_billed, 1, 0, 1);
1112 print '</td>';
1113}
1114// Action column
1115if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1116 print '<td class="liste_titre middle">';
1117 $searchpicto = $form->showFilterButtons();
1118 print $searchpicto;
1119 print '</td>';
1120}
1121print '</tr>'."\n";
1122
1123$totalarray = array();
1124$totalarray['nbfield'] = 0;
1125
1126// Fields title label
1127// --------------------------------------------------------------------
1128print '<tr class="liste_titre">';
1129// Action column
1130if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1131 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
1132 $totalarray['nbfield']++;
1133}
1134if (!empty($arrayfields['e.ref']['checked'])) {
1135 // @phan-suppress-next-line PhanTypeInvalidDimOffset
1136 print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, '', $sortfield, $sortorder);
1137 $totalarray['nbfield']++;
1138}
1139if (!empty($arrayfields['e.ref_supplier']['checked'])) {
1140 print_liste_field_titre($arrayfields['e.ref_supplier']['label'], $_SERVER["PHP_SELF"], "e.ref_supplier", "", $param, '', $sortfield, $sortorder);
1141 $totalarray['nbfield']++;
1142}
1143if (!empty($arrayfields['s.nom']['checked'])) {
1144 print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder, 'left ');
1145 $totalarray['nbfield']++;
1146}
1147if (!empty($arrayfields['s.town']['checked'])) {
1148 print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
1149 $totalarray['nbfield']++;
1150}
1151if (!empty($arrayfields['s.zip']['checked'])) {
1152 print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
1153 $totalarray['nbfield']++;
1154}
1155if (!empty($arrayfields['state.nom']['checked'])) {
1156 print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
1157 $totalarray['nbfield']++;
1158}
1159if (!empty($arrayfields['country.code_iso']['checked'])) {
1160 print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
1161 $totalarray['nbfield']++;
1162}
1163if (!empty($arrayfields['typent.code']['checked'])) {
1164 print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center ');
1165 $totalarray['nbfield']++;
1166}
1167if (!empty($arrayfields['e.date_delivery']['checked'])) {
1168 print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, '', $sortfield, $sortorder, 'center ');
1169 $totalarray['nbfield']++;
1170}
1171if (!empty($arrayfields['l.ref']['checked'])) {
1172 print_liste_field_titre($arrayfields['l.ref']['label'], $_SERVER["PHP_SELF"], "l.ref", "", $param, '', $sortfield, $sortorder);
1173 $totalarray['nbfield']++;
1174}
1175if (!empty($arrayfields['l.date_delivery']['checked'])) {
1176 print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"], "l.date_delivery", "", $param, '', $sortfield, $sortorder, 'center ');
1177 $totalarray['nbfield']++;
1178}
1179// Extra fields
1180include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
1181// Hook fields
1182$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, '$totalarray' => &$totalarray);
1183$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
1184print $hookmanager->resPrint;
1185if (!empty($arrayfields['e.datec']['checked'])) {
1186 print_liste_field_titre($arrayfields['e.datec']['label'], $_SERVER["PHP_SELF"], "e.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1187 $totalarray['nbfield']++;
1188}
1189if (!empty($arrayfields['e.tms']['checked'])) {
1190 print_liste_field_titre($arrayfields['e.tms']['label'], $_SERVER["PHP_SELF"], "e.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1191 $totalarray['nbfield']++;
1192}
1193if (!empty($arrayfields['e.fk_statut']['checked'])) {
1194 print_liste_field_titre($arrayfields['e.fk_statut']['label'], $_SERVER["PHP_SELF"], "e.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
1195 $totalarray['nbfield']++;
1196}
1197if (!empty($arrayfields['e.billed']['checked'])) {
1198 print_liste_field_titre($arrayfields['e.billed']['label'], $_SERVER["PHP_SELF"], "e.billed", "", $param, '', $sortfield, $sortorder, 'center ');
1199 $totalarray['nbfield']++;
1200}
1201// Action column
1202if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1203 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
1204 $totalarray['nbfield']++;
1205}
1206print "</tr>\n";
1207
1208
1209// Loop on record
1210// --------------------------------------------------------------------
1211$i = 0;
1212$savnbfield = $totalarray['nbfield'];
1213$totalarray = array();
1214$totalarray['nbfield'] = 0;
1215$imaxinloop = ($limit ? min($num, $limit) : $num);
1216while ($i < $imaxinloop) {
1217 $obj = $db->fetch_object($resql);
1218 if (empty($obj)) {
1219 break; // Should not happen
1220 }
1221
1222 $reception->id = $obj->rowid;
1223 $reception->ref = $obj->ref;
1224 //$reception->ref_supplier = $obj->ref_supplier;
1225 $reception->statut = $obj->status;
1226 $reception->status = $obj->status;
1227 $reception->socid = $obj->socid;
1228 $reception->billed = $obj->billed;
1229
1230 $reception->fetch_thirdparty();
1231
1232 $object = $reception;
1233
1234 $companystatic->id = $obj->socid;
1235 $companystatic->ref = $obj->name;
1236 $companystatic->name = $obj->name;
1237
1238 if ($mode == 'kanban') {
1239 if ($i == 0) {
1240 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
1241 print '<div class="box-flex-container kanban">';
1242 }
1243 $object->date_delivery = $obj->delivery_date;
1244 $object->town = $obj->town;
1245
1246 // Output Kanban
1247 $selected = -1;
1248 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1249 $selected = 0;
1250 if (in_array($object->id, $arrayofselected)) {
1251 $selected = 1;
1252 }
1253 }
1254 print $object->getKanbanView('', array('thirdparty' => $companystatic->getNomUrl(1), 'selected' => $selected));
1255 if ($i == min($num, $limit) - 1) {
1256 print '</div>';
1257 print '</td></tr>';
1258 }
1259 } else {
1260 print '<tr class="oddeven">';
1261
1262 // Action column
1263 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1264 print '<td class="nowrap center">';
1265 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1266 $selected = 0;
1267 if (in_array($obj->rowid, $arrayofselected)) {
1268 $selected = 1;
1269 }
1270 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1271 }
1272 print '</td>';
1273 }
1274 // Ref
1275 if (!empty($arrayfields['e.ref']['checked'])) {
1276 print '<td class="nowraponall">';
1277 print $reception->getNomUrl(1);
1278 $filename = dol_sanitizeFileName($reception->ref);
1279 $filedir = $conf->reception->dir_output.'/'.dol_sanitizeFileName($reception->ref);
1280 $urlsource = $_SERVER['PHP_SELF'].'?id='.$reception->id;
1281 print $formfile->getDocumentsLink($reception->element, $filename, $filedir);
1282 print "</td>\n";
1283
1284 if (!$i) {
1285 $totalarray['nbfield']++;
1286 }
1287 }
1288
1289 // Ref supplier
1290 if (!empty($arrayfields['e.ref_supplier']['checked'])) {
1291 print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->ref_supplier).'">';
1292 print dol_escape_htmltag($obj->ref_supplier);
1293 print "</td>\n";
1294 if (!$i) {
1295 $totalarray['nbfield']++;
1296 }
1297 }
1298
1299 // Third party
1300 if (!empty($arrayfields['s.nom']['checked'])) {
1301 print '<td class="tdoverflowmax150">';
1302 print $companystatic->getNomUrl(1);
1303 print '</td>';
1304 if (!$i) {
1305 $totalarray['nbfield']++;
1306 }
1307 }
1308 // Town
1309 if (!empty($arrayfields['s.town']['checked'])) {
1310 print '<td class="nocellnopadd tdoverflowmax200" title="'.dol_escape_htmltag($obj->town).'">';
1311 print dol_escape_htmltag($obj->town);
1312 print '</td>';
1313 if (!$i) {
1314 $totalarray['nbfield']++;
1315 }
1316 }
1317 // Zip
1318 if (!empty($arrayfields['s.zip']['checked'])) {
1319 print '<td class="nocellnopadd center"">';
1320 print dol_escape_htmltag($obj->zip);
1321 print '</td>';
1322 if (!$i) {
1323 $totalarray['nbfield']++;
1324 }
1325 }
1326 // State
1327 if (!empty($arrayfields['state.nom']['checked'])) {
1328 print "<td>".dol_escape_htmltag($obj->state_name)."</td>\n";
1329 if (!$i) {
1330 $totalarray['nbfield']++;
1331 }
1332 }
1333 // Country
1334 if (!empty($arrayfields['country.code_iso']['checked'])) {
1335 print '<td class="center">';
1336 $tmparray = getCountry($obj->fk_pays, 'all');
1337 print dol_escape_htmltag($tmparray['label']);
1338 print '</td>';
1339 if (!$i) {
1340 $totalarray['nbfield']++;
1341 }
1342 }
1343 // Type ent
1344 if (!empty($arrayfields['typent.code']['checked'])) {
1345 print '<td class="center">';
1346 if (!isset($typenArray) || empty($typenArray)) { // @phan-suppress-current-line PhanPluginUndeclaredVariableIsset
1347 $typenArray = $formcompany->typent_array(1);
1348 }
1349 if (isset($typenArray[$obj->typent_code])) {
1350 print $typenArray[$obj->typent_code];
1351 }
1352 print '</td>';
1353 if (!$i) {
1354 $totalarray['nbfield']++;
1355 }
1356 }
1357
1358 // Date delivery planned
1359 if (!empty($arrayfields['e.date_delivery']['checked'])) {
1360 print '<td class="center">';
1361 print dol_print_date($db->jdate($obj->delivery_date), "day");
1362 /*$now = time();
1363 if ( ($now - $db->jdate($obj->date_reception)) > $conf->warnings->lim && $obj->statutid == 1 )
1364 {
1365 }*/
1366 print "</td>\n";
1367 if (!$i) {
1368 $totalarray['nbfield']++;
1369 }
1370 }
1371
1372 if (!empty($arrayfields['l.ref']['checked']) || !empty($arrayfields['l.date_delivery']['checked'])) {
1373 $reception->fetchObjectLinked($reception->id, $reception->element);
1374 $receiving = '';
1375 if (count($reception->linkedObjects['delivery']) > 0) {
1376 $receiving = reset($reception->linkedObjects['delivery']);
1377 }
1378
1379 if (!empty($arrayfields['l.ref']['checked'])) {
1380 // Ref
1381 print '<td>';
1382 print !empty($receiving) ? $receiving->getNomUrl($db) : '';
1383 print '</td>';
1384 }
1385
1386 if (!empty($arrayfields['l.date_delivery']['checked'])) {
1387 // Date received
1388 print '<td class="center">';
1389 print dol_print_date($db->jdate($obj->date_reception), "day");
1390 print '</td>'."\n";
1391 }
1392 }
1393
1394 // Extra fields
1395 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1396
1397 // Fields from hook
1398 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1399 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
1400 print $hookmanager->resPrint;
1401 // Date creation
1402 if (!empty($arrayfields['e.datec']['checked'])) {
1403 print '<td class="center nowraponall">';
1404 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuserrel');
1405 print '</td>';
1406 if (!$i) {
1407 $totalarray['nbfield']++;
1408 }
1409 }
1410 // Date modification
1411 if (!empty($arrayfields['e.tms']['checked'])) {
1412 print '<td class="center nowraponall">';
1413 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuserrel');
1414 print '</td>';
1415 if (!$i) {
1416 $totalarray['nbfield']++;
1417 }
1418 }
1419 // Status
1420 if (!empty($arrayfields['e.fk_statut']['checked'])) {
1421 print '<td class="right nowrap">'.$reception->LibStatut($obj->status, 5).'</td>';
1422 if (!$i) {
1423 $totalarray['nbfield']++;
1424 }
1425 }
1426 // Billed
1427 if (!empty($arrayfields['e.billed']['checked'])) {
1428 print '<td class="center">'.yn($obj->billed).'</td>';
1429 if (!$i) {
1430 $totalarray['nbfield']++;
1431 }
1432 }
1433
1434 // Action column
1435 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1436 print '<td class="nowrap center">';
1437 if ($massactionbutton || $massaction) {
1438 // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1439 $selected = 0;
1440 if (in_array($obj->rowid, $arrayofselected)) {
1441 $selected = 1;
1442 }
1443 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1444 }
1445 print '</td>';
1446 }
1447 if (!$i) {
1448 $totalarray['nbfield']++;
1449 }
1450
1451 print "</tr>\n";
1452 }
1453 $i++;
1454}
1455
1456// If no record found
1457if ($num == 0) {
1458 $colspan = 1;
1459 foreach ($arrayfields as $key => $val) {
1460 if (!empty($val['checked'])) {
1461 $colspan++;
1462 }
1463 }
1464 print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
1465}
1466
1467// Show total line
1468include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1469
1470$parameters = array('arrayfields' => $arrayfields, 'totalarray' => $totalarray, 'sql' => $sql);
1471$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
1472print $hookmanager->resPrint;
1473
1474print "</table>";
1475print "</div>";
1476print '</form>';
1477
1478$db->free($resql);
1479
1480$hidegeneratedfilelistifempty = 1;
1481if ($massaction == 'builddoc' || $action == 'remove_file') {
1482 $hidegeneratedfilelistifempty = 0;
1483}
1484
1485// Show list of available documents
1486$urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1487$urlsource .= str_replace('&amp;', '&', $param);
1488
1489$filedir = $diroutputmassaction;
1490$genallowed = $user->hasRight('reception', 'lire');
1491$delallowed = $user->hasRight('reception', 'creer');
1492$title = '';
1493
1494print $formfile->showdocuments('massfilesarea_receipts', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1495
1496// End of page
1497llxFooter();
1498$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.