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