dolibarr 23.0.3
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';
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", '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$toselect = GETPOST('toselect', 'array:int');
60$show_files = GETPOSTINT('show_files');
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$search_note_private = GETPOST('search_note_private', 'alpha');
94$search_note_public = GETPOST('search_note_public', 'alpha');
95
96$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
97$sortfield = GETPOST('sortfield', 'aZ09comma');
98$sortorder = GETPOST('sortorder', 'aZ09comma');
99$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
100if (!$sortfield) {
101 $sortfield = "e.ref";
102}
103if (!$sortorder) {
104 $sortorder = "DESC";
105}
106if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
107 // If $page is not defined, or '' or -1 or if we click on clear filters
108 $page = 0;
109}
110$offset = $limit * $page;
111$pageprev = $page - 1;
112$pagenext = $page + 1;
113
114$diroutputmassaction = $conf->reception->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id;
115$object = new Reception($db);
116
117// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
118$hookmanager->initHooks(array('receptionlist'));
119$extrafields = new ExtraFields($db);
120
121// Fetch optionals attributes and labels
122$extrafields->fetch_name_optionals_label($object->table_element);
123$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
124
125// List of fields to search into when doing a "search in all"
126$fieldstosearchall = array(
127 'e.ref' => "Ref",
128 'e.ref_supplier' => "RefSupplier",
129 's.nom' => "ThirdParty",
130 'e.note_public' => 'NotePublic',
131);
132if (empty($user->socid)) {
133 $fieldstosearchall["e.note_private"] = "NotePrivate";
134}
135
136$checkedtypetiers = '0';
137$arrayfields = array(
138 'e.ref' => array('label' => $langs->trans("Ref"), 'checked' => '1'),
139 'e.ref_supplier' => array('label' => $langs->trans("RefSupplier"), 'checked' => '1'),
140 's.nom' => array('label' => $langs->trans("ThirdParty"), 'checked' => '1'),
141 's.town' => array('label' => $langs->trans("Town"), 'checked' => '1'),
142 's.zip' => array('label' => $langs->trans("Zip"), 'checked' => '1'),
143 'state.nom' => array('label' => $langs->trans("StateShort"), 'checked' => '0'),
144 'country.code_iso' => array('label' => $langs->trans("Country"), 'checked' => '0'),
145 'typent.code' => array('label' => $langs->trans("ThirdPartyType"), 'checked' => $checkedtypetiers),
146 'e.date_delivery' => array('label' => $langs->trans("DateDeliveryPlanned"), 'checked' => '1'),
147 'e.datec' => array('label' => $langs->trans("DateCreation"), 'checked' => '0', 'position' => 500),
148 'e.tms' => array('label' => $langs->trans("DateModificationShort"), 'checked' => '0', 'position' => 500),
149 'e.note_public' => array('label' => 'NotePublic', 'checked' => '0', 'position' => 520, 'enabled' => (getDolGlobalInt('MAIN_LIST_HIDE_PUBLIC_NOTES') ? '0' : '1')),
150 'e.note_private' => array('label' => 'NotePrivate', 'checked' => '0', 'position' => 521, 'enabled' => (getDolGlobalInt('MAIN_LIST_HIDE_PRIVATE_NOTES') ? '0' : '1')),
151 'e.fk_statut' => array('label' => $langs->trans("Status"), 'checked' => '1', 'position' => 1000),
152 'e.billed' => array('label' => $langs->trans("Billed"), 'checked' => '1', 'position' => 1000, 'enabled' => 'getDolGlobalString("WORKFLOW_BILL_ON_RECEPTION") !== "0"')
153);
154
155// Extra fields
156include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
157
158$object->fields = dol_sort_array($object->fields, 'position');
159$arrayfields = dol_sort_array($arrayfields, 'position');
160
161$error = 0;
162
163// Security check
164$receptionid = GETPOSTINT('id');
165if ($user->socid) {
166 $socid = $user->socid;
167}
168$result = restrictedArea($user, 'reception', $receptionid, '');
169
170
171/*
172 * Actions
173 */
174
175if (GETPOST('cancel', 'alpha')) {
176 $action = 'list';
177 $massaction = '';
178}
179if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_createbills') {
180 $massaction = '';
181}
182
183$parameters = array('socid' => $socid, 'arrayfields' => &$arrayfields);
184$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
185if ($reshook < 0) {
186 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
187}
188
189include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
190
191// Purge search criteria
192if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
193 $search_ref_supplier = '';
194 $search_ref_rcp = '';
195 $search_ref_liv = '';
196 $search_company = '';
197 $search_town = '';
198 $search_zip = "";
199 $search_state = "";
200 $search_country = '';
201 $search_type_thirdparty = '';
202 $search_date_delivery_startday = '';
203 $search_date_delivery_startmonth = '';
204 $search_date_delivery_startyear = '';
205 $search_date_delivery_endday = '';
206 $search_date_delivery_endmonth = '';
207 $search_date_delivery_endyear = '';
208 $search_date_delivery_start = '';
209 $search_date_delivery_end = '';
210 $search_date_create_startday = '';
211 $search_date_create_startmonth = '';
212 $search_date_create_startyear = '';
213 $search_date_create_endday = '';
214 $search_date_create_endmonth = '';
215 $search_date_create_endyear = '';
216 $search_date_create_start = '';
217 $search_date_create_end = '';
218 $search_billed = '';
219 $search_status = '';
220 $toselect = array();
221 $search_array_options = array();
222}
223
224if (empty($reshook)) {
225 // Mass actions
226 $objectclass = 'Reception';
227 $objectlabel = 'Receptions';
228 $permissiontoread = $user->hasRight('reception', 'lire');
229 $permissiontoadd = $user->hasRight('reception', 'creer');
230 $permissiontodelete = $user->hasRight('reception', 'supprimer');
231 $uploaddir = $conf->reception->multidir_output[$conf->entity];
232 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
233
234 if ($massaction == 'confirm_createbills' && ($user->hasRight("fournisseur", "facture", "creer") || $user->hasRight("supplier_invoice", "creer"))) {
235 $receptions = GETPOST('toselect', 'array:int');
236 $createbills_onebythird = GETPOSTINT('createbills_onebythird');
237 $validate_invoices = GETPOSTINT('validate_invoices');
238
239 $errors = array();
240
241 $TFact = array();
242 $TFactThird = array();
243 '@phan-var FactureFournisseur[] $TFactThird';
244 $TFactThirdNbLines = array();
245
246 $nb_bills_created = 0;
247 $lastid = 0;
248 $lastref = '';
249
250 $db->begin();
251
252 //sort ids to keep order if one bill per third
253 sort($receptions);
254 foreach ($receptions as $id_reception) {
255 $soc = null;
256 $rcp = new Reception($db);
257 // We not allow invoice reception that are in draft status
258 if ($rcp->fetch($id_reception) <= 0 || $rcp->statut == $rcp::STATUS_DRAFT) {
259 $errors[] = $langs->trans('StatusOfRefMustBe', $rcp->ref, $langs->transnoentities("StatusReceptionValidatedShort"));
260 $error++;
261 continue;
262 }
263
264 $objecttmp = new FactureFournisseur($db);
265 if (!empty($createbills_onebythird) && !empty($TFactThird[$rcp->socid])) {
266 // If option "one bill per third" is set, and an invoice for this thirdparty was already created, we reuse it.
267 $objecttmp = $TFactThird[$rcp->socid];
268
269 // Add all links of this new reception to the existing invoice
270 $objecttmp->fetchObjectLinked();
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,
523 $date_start,
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"] = $_POST["origin"]; // Keep this ?
616 $_GET["originid"] = $_POST["originid"]; // Keep this ?
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 {
768 dol_print_error($db);
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) {
787 dol_print_error($db);
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 .= dolGetButtonTitleSeparator();
931$newcardbutton .= dolGetButtonTitle($langs->trans('NewReception'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/reception/card.php?action=create2', '', $user->hasRight('reception', 'creer'));
932
933$i = 0;
934print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
935if ($optioncss != '') {
936 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
937}
938print '<input type="hidden" name="token" value="'.newToken().'">';
939print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
940print '<input type="hidden" name="action" value="list">';
941print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
942print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
943print '<input type="hidden" name="mode" value="'.$mode.'">';
944
945// @phan-suppress-next-line PhanPluginSuspiciousParamOrder
946print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'dollyrevert', 0, $newcardbutton, '', $limit, 0, 0, 1);
947
948if ($massaction == 'createbills') {
949 //var_dump($_REQUEST);
950 print '<input type="hidden" name="massaction" value="confirm_createbills">';
951
952 print '<table class="noborder centpercent">';
953 print '<tr>';
954 print '<td class="titlefieldmiddle">';
955 print $langs->trans('DateInvoice');
956 print '</td>';
957 print '<td>';
958 print $form->selectDate('', '', 0, 0, 0, '', 1, 1);
959 print '</td>';
960 print '</tr>';
961 print '<tr>';
962 print '<td>';
963 print $langs->trans('CreateOneBillByThird');
964 print '</td>';
965 print '<td>';
966 print $form->selectyesno('createbills_onebythird', '', 1);
967 print '</td>';
968 print '</tr>';
969 print '<tr>';
970 print '<td>';
971 print $langs->trans('ValidateInvoices');
972 print '</td>';
973 print '<td>';
974 if (isModEnabled('stock') && getDolGlobalString('STOCK_CALCULATE_ON_BILL')) {
975 print $form->selectyesno('validate_invoices', 0, 1, 1);
976 print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')';
977 } else {
978 print $form->selectyesno('validate_invoices', 0, 1);
979 }
980 print '</td>';
981 print '</tr>';
982 print '</table>';
983
984 print '<br>';
985 print '<div class="center">';
986 print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('CreateInvoiceForThisReceptions').'"> ';
987 print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
988 print '</div>';
989 print '<br>';
990}
991
992if ($search_all) {
993 foreach ($fieldstosearchall as $key => $val) {
994 $fieldstosearchall[$key] = $langs->trans($val);
995 }
996 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).implode(', ', $fieldstosearchall).'</div>';
997}
998
999$moreforfilter = '';
1000
1001if (!empty($moreforfilter)) {
1002 print '<div class="liste_titre liste_titre_bydiv centpercent">';
1003 print $moreforfilter;
1004 $parameters = array('type' => $type);
1005 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1006 print $hookmanager->resPrint;
1007 print '</div>';
1008}
1009
1010$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
1011$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN'));
1012if ($massactionbutton) {
1013 $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); // This also change content of $arrayfields
1014}
1015
1016print '<div class="div-table-responsive">';
1017print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
1018
1019// Fields title search
1020// --------------------------------------------------------------------
1021print '<tr class="liste_titre_filter">';
1022// Action column
1023if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1024 print '<td class="liste_titre center maxwidthsearch">';
1025 $searchpicto = $form->showFilterButtons('left');
1026 print $searchpicto;
1027 print '</td>';
1028}
1029// Ref
1030if (!empty($arrayfields['e.ref']['checked'])) {
1031 print '<td class="liste_titre">';
1032 print '<input class="flat" size="6" type="text" name="search_ref_rcp" value="'.$search_ref_rcp.'">';
1033 print '</td>';
1034}
1035// Ref customer
1036if (!empty($arrayfields['e.ref_supplier']['checked'])) {
1037 print '<td class="liste_titre">';
1038 print '<input class="flat" size="6" type="text" name="search_ref_supplier" value="'.$search_ref_supplier.'">';
1039 print '</td>';
1040}
1041// Thirdparty
1042if (!empty($arrayfields['s.nom']['checked'])) {
1043 print '<td class="liste_titre left">';
1044 print '<input class="flat" type="text" size="8" name="search_company" value="'.dol_escape_htmltag($search_company).'">';
1045 print '</td>';
1046}
1047// Town
1048if (!empty($arrayfields['s.town']['checked'])) {
1049 print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
1050}
1051// Zip
1052if (!empty($arrayfields['s.zip']['checked'])) {
1053 print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
1054}
1055// State
1056if (!empty($arrayfields['state.nom']['checked'])) {
1057 print '<td class="liste_titre">';
1058 print '<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
1059 print '</td>';
1060}
1061// Country
1062if (!empty($arrayfields['country.code_iso']['checked'])) {
1063 print '<td class="liste_titre center">';
1064 print $form->select_country($search_country, 'search_country', '', 0, 'minwidth100imp maxwidth100');
1065 print '</td>';
1066}
1067// Company type
1068if (!empty($arrayfields['typent.code']['checked'])) {
1069 print '<td class="liste_titre maxwidthonsmartphone center">';
1070 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);
1071 print '</td>';
1072}
1073// Date delivery planned
1074if (!empty($arrayfields['e.date_delivery']['checked'])) {
1075 print '<td class="liste_titre center">';
1076 print '<div class="nowrapfordate">';
1077 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'));
1078 print '</div>';
1079 print '<div class="nowrapfordate">';
1080 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'));
1081 print '</div>';
1082 print '</td>';
1083}
1084if (!empty($arrayfields['l.ref']['checked'])) {
1085 // Delivery ref
1086 print '<td class="liste_titre">';
1087 print '<input class="flat" type="text" name="search_ref_liv" value="'.dol_escape_htmltag($search_ref_liv).'"';
1088 print '</td>';
1089}
1090if (!empty($arrayfields['l.date_delivery']['checked'])) {
1091 // Date received
1092 print '<td class="liste_titre center">&nbsp;</td>';
1093}
1094// Extra fields
1095include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
1096
1097// Fields from hook
1098$parameters = array('arrayfields' => $arrayfields);
1099$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
1100print $hookmanager->resPrint;
1101// Date creation
1102if (!empty($arrayfields['e.datec']['checked'])) {
1103 print '<td class="liste_titre center">';
1104 print '<div class="nowrapfordate">';
1105 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'));
1106 print '</div>';
1107 print '<div class="nowrapfordate">';
1108 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'));
1109 print '</div>';
1110 print '</td>';
1111}
1112// Date modification
1113if (!empty($arrayfields['e.tms']['checked'])) {
1114 print '<td class="liste_titre">';
1115 print '</td>';
1116}
1117if (!empty($arrayfields['e.note_public']['checked'])) {
1118 // Note public
1119 print '<td class="liste_titre">';
1120 print '<input class="flat maxwidth75" type="text" name="search_note_public" value="'.dol_escape_htmltag($search_note_public).'">';
1121 print '</td>';
1122}
1123if (!empty($arrayfields['e.note_private']['checked'])) {
1124 // Note private
1125 print '<td class="liste_titre">';
1126 print '<input class="flat maxwidth75" type="text" name="search_note_private" value="'.dol_escape_htmltag($search_note_private).'">';
1127 print '</td>';
1128}
1129// Status
1130if (!empty($arrayfields['e.fk_statut']['checked'])) {
1131 print '<td class="liste_titre right parentonrightofpage">';
1132 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');
1133 print '</td>';
1134}
1135// Status billed
1136if (!empty($arrayfields['e.billed']['checked'])) {
1137 print '<td class="liste_titre maxwidthonsmartphone center">';
1138 print $form->selectyesno('search_billed', $search_billed, 1, 0, 1);
1139 print '</td>';
1140}
1141// Action column
1142if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1143 print '<td class="liste_titre middle">';
1144 $searchpicto = $form->showFilterButtons();
1145 print $searchpicto;
1146 print '</td>';
1147}
1148print '</tr>'."\n";
1149
1150$totalarray = array();
1151$totalarray['nbfield'] = 0;
1152
1153// Fields title label
1154// --------------------------------------------------------------------
1155print '<tr class="liste_titre">';
1156// Action column
1157if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1158 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
1159 $totalarray['nbfield']++;
1160}
1161if (!empty($arrayfields['e.ref']['checked'])) {
1162 // @phan-suppress-next-line PhanTypeInvalidDimOffset
1163 print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, '', $sortfield, $sortorder);
1164 $totalarray['nbfield']++;
1165}
1166if (!empty($arrayfields['e.ref_supplier']['checked'])) {
1167 print_liste_field_titre($arrayfields['e.ref_supplier']['label'], $_SERVER["PHP_SELF"], "e.ref_supplier", "", $param, '', $sortfield, $sortorder);
1168 $totalarray['nbfield']++;
1169}
1170if (!empty($arrayfields['s.nom']['checked'])) {
1171 print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder, 'left ');
1172 $totalarray['nbfield']++;
1173}
1174if (!empty($arrayfields['s.town']['checked'])) {
1175 print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
1176 $totalarray['nbfield']++;
1177}
1178if (!empty($arrayfields['s.zip']['checked'])) {
1179 print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
1180 $totalarray['nbfield']++;
1181}
1182if (!empty($arrayfields['state.nom']['checked'])) {
1183 print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
1184 $totalarray['nbfield']++;
1185}
1186if (!empty($arrayfields['country.code_iso']['checked'])) {
1187 print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
1188 $totalarray['nbfield']++;
1189}
1190if (!empty($arrayfields['typent.code']['checked'])) {
1191 print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center ');
1192 $totalarray['nbfield']++;
1193}
1194if (!empty($arrayfields['e.date_delivery']['checked'])) {
1195 print_liste_field_titre($arrayfields['e.date_delivery']['label'], $_SERVER["PHP_SELF"], "e.date_delivery", "", $param, '', $sortfield, $sortorder, 'center ');
1196 $totalarray['nbfield']++;
1197}
1198if (!empty($arrayfields['l.ref']['checked'])) {
1199 print_liste_field_titre($arrayfields['l.ref']['label'], $_SERVER["PHP_SELF"], "l.ref", "", $param, '', $sortfield, $sortorder);
1200 $totalarray['nbfield']++;
1201}
1202if (!empty($arrayfields['l.date_delivery']['checked'])) {
1203 print_liste_field_titre($arrayfields['l.date_delivery']['label'], $_SERVER["PHP_SELF"], "l.date_delivery", "", $param, '', $sortfield, $sortorder, 'center ');
1204 $totalarray['nbfield']++;
1205}
1206// Extra fields
1207include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
1208// Hook fields
1209$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder, '$totalarray' => &$totalarray);
1210$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
1211print $hookmanager->resPrint;
1212if (!empty($arrayfields['e.datec']['checked'])) {
1213 print_liste_field_titre($arrayfields['e.datec']['label'], $_SERVER["PHP_SELF"], "e.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1214 $totalarray['nbfield']++;
1215}
1216if (!empty($arrayfields['e.tms']['checked'])) {
1217 print_liste_field_titre($arrayfields['e.tms']['label'], $_SERVER["PHP_SELF"], "e.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1218 $totalarray['nbfield']++;
1219}
1220if (!empty($arrayfields['e.note_public']['checked'])) {
1221 print_liste_field_titre($arrayfields['e.note_public']['label'], $_SERVER["PHP_SELF"], "e.note_public", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1222 $totalarray['nbfield']++;
1223}
1224if (!empty($arrayfields['e.note_private']['checked'])) {
1225 print_liste_field_titre($arrayfields['e.note_private']['label'], $_SERVER["PHP_SELF"], "e.note_private", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
1226 $totalarray['nbfield']++;
1227}
1228if (!empty($arrayfields['e.fk_statut']['checked'])) {
1229 print_liste_field_titre($arrayfields['e.fk_statut']['label'], $_SERVER["PHP_SELF"], "e.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
1230 $totalarray['nbfield']++;
1231}
1232if (!empty($arrayfields['e.billed']['checked'])) {
1233 print_liste_field_titre($arrayfields['e.billed']['label'], $_SERVER["PHP_SELF"], "e.billed", "", $param, '', $sortfield, $sortorder, 'center ');
1234 $totalarray['nbfield']++;
1235}
1236// Action column
1237if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1238 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
1239 $totalarray['nbfield']++;
1240}
1241print "</tr>\n";
1242
1243
1244// Loop on record
1245// --------------------------------------------------------------------
1246$i = 0;
1247$savnbfield = $totalarray['nbfield'];
1248$totalarray = array();
1249$totalarray['nbfield'] = 0;
1250$imaxinloop = ($limit ? min($num, $limit) : $num);
1251while ($i < $imaxinloop) {
1252 $obj = $db->fetch_object($resql);
1253 if (empty($obj)) {
1254 break; // Should not happen
1255 }
1256
1257 $reception->id = $obj->rowid;
1258 $reception->ref = $obj->ref;
1259 //$reception->ref_supplier = $obj->ref_supplier;
1260 $reception->statut = $obj->status;
1261 $reception->status = $obj->status;
1262 $reception->socid = $obj->socid;
1263 $reception->billed = $obj->billed;
1264 $reception->note_public = $obj->note_public;
1265 $reception->note_private = $obj->note_private;
1266
1267 $reception->fetch_thirdparty();
1268
1269 $object = $reception;
1270
1271 $companystatic->id = $obj->socid;
1272 $companystatic->ref = $obj->name;
1273 $companystatic->name = $obj->name;
1274
1275 if ($mode == 'kanban') {
1276 if ($i == 0) {
1277 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
1278 print '<div class="box-flex-container kanban">';
1279 }
1280 $object->date_delivery = $obj->delivery_date;
1281 $object->town = $obj->town;
1282
1283 // Output Kanban
1284 $selected = -1;
1285 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1286 $selected = 0;
1287 if (in_array($object->id, $arrayofselected)) {
1288 $selected = 1;
1289 }
1290 }
1291 print $object->getKanbanView('', array('thirdparty' => $companystatic->getNomUrl(1), 'selected' => $selected));
1292 if ($i == min($num, $limit) - 1) {
1293 print '</div>';
1294 print '</td></tr>';
1295 }
1296 } else {
1297 print '<tr class="oddeven">';
1298
1299 // Action column
1300 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1301 print '<td class="nowrap center">';
1302 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1303 $selected = 0;
1304 if (in_array($obj->rowid, $arrayofselected)) {
1305 $selected = 1;
1306 }
1307 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1308 }
1309 print '</td>';
1310 }
1311 // Ref
1312 if (!empty($arrayfields['e.ref']['checked'])) {
1313 print '<td class="nowraponall">';
1314 print $reception->getNomUrl(1);
1315 $filename = dol_sanitizeFileName($reception->ref);
1316 $filedir = $conf->reception->dir_output.'/'.dol_sanitizeFileName($reception->ref);
1317 $urlsource = $_SERVER['PHP_SELF'].'?id='.$reception->id;
1318 print $formfile->getDocumentsLink($reception->element, $filename, $filedir);
1319 print "</td>\n";
1320
1321 if (!$i) {
1322 $totalarray['nbfield']++;
1323 }
1324 }
1325
1326 // Ref supplier
1327 if (!empty($arrayfields['e.ref_supplier']['checked'])) {
1328 print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->ref_supplier).'">';
1329 print dol_escape_htmltag($obj->ref_supplier);
1330 print "</td>\n";
1331 if (!$i) {
1332 $totalarray['nbfield']++;
1333 }
1334 }
1335
1336 // Third party
1337 if (!empty($arrayfields['s.nom']['checked'])) {
1338 print '<td class="tdoverflowmax150">';
1339 print $companystatic->getNomUrl(1);
1340 print '</td>';
1341 if (!$i) {
1342 $totalarray['nbfield']++;
1343 }
1344 }
1345 // Town
1346 if (!empty($arrayfields['s.town']['checked'])) {
1347 print '<td class="nocellnopadd tdoverflowmax200" title="'.dol_escape_htmltag($obj->town).'">';
1348 print dol_escape_htmltag($obj->town);
1349 print '</td>';
1350 if (!$i) {
1351 $totalarray['nbfield']++;
1352 }
1353 }
1354 // Zip
1355 if (!empty($arrayfields['s.zip']['checked'])) {
1356 print '<td class="nocellnopadd center"">';
1357 print dol_escape_htmltag($obj->zip);
1358 print '</td>';
1359 if (!$i) {
1360 $totalarray['nbfield']++;
1361 }
1362 }
1363 // State
1364 if (!empty($arrayfields['state.nom']['checked'])) {
1365 print "<td>".dol_escape_htmltag($obj->state_name)."</td>\n";
1366 if (!$i) {
1367 $totalarray['nbfield']++;
1368 }
1369 }
1370 // Country
1371 if (!empty($arrayfields['country.code_iso']['checked'])) {
1372 print '<td class="center">';
1373 $tmparray = getCountry($obj->fk_pays, 'all');
1374 print dol_escape_htmltag($tmparray['label']);
1375 print '</td>';
1376 if (!$i) {
1377 $totalarray['nbfield']++;
1378 }
1379 }
1380 // Type ent
1381 if (!empty($arrayfields['typent.code']['checked'])) {
1382 print '<td class="center">';
1383 if (!isset($typenArray) || empty($typenArray)) { // @phan-suppress-current-line PhanPluginUndeclaredVariableIsset
1384 $typenArray = $formcompany->typent_array(1);
1385 }
1386 if (isset($typenArray[$obj->typent_code])) {
1387 print $typenArray[$obj->typent_code];
1388 }
1389 print '</td>';
1390 if (!$i) {
1391 $totalarray['nbfield']++;
1392 }
1393 }
1394
1395 // Date delivery planned
1396 if (!empty($arrayfields['e.date_delivery']['checked'])) {
1397 print '<td class="center">';
1398 print dol_print_date($db->jdate($obj->delivery_date), "day");
1399 /*$now = time();
1400 if ( ($now - $db->jdate($obj->date_reception)) > $conf->warnings->lim && $obj->statutid == 1 )
1401 {
1402 }*/
1403 print "</td>\n";
1404 if (!$i) {
1405 $totalarray['nbfield']++;
1406 }
1407 }
1408
1409 if (!empty($arrayfields['l.ref']['checked']) || !empty($arrayfields['l.date_delivery']['checked'])) {
1410 $reception->fetchObjectLinked($reception->id, $reception->element);
1411 $receiving = '';
1412 if (count($reception->linkedObjects['delivery']) > 0) {
1413 $receiving = reset($reception->linkedObjects['delivery']);
1414 }
1415
1416 if (!empty($arrayfields['l.ref']['checked'])) {
1417 // Ref
1418 print '<td>';
1419 print !empty($receiving) ? $receiving->getNomUrl($db) : '';
1420 print '</td>';
1421 }
1422
1423 if (!empty($arrayfields['l.date_delivery']['checked'])) {
1424 // Date received
1425 print '<td class="center">';
1426 print dol_print_date($db->jdate($obj->date_reception), "day");
1427 print '</td>'."\n";
1428 }
1429 }
1430
1431 // Extra fields
1432 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1433
1434 // Fields from hook
1435 $parameters = array('arrayfields' => $arrayfields, 'obj' => $obj, 'i' => $i, 'totalarray' => &$totalarray);
1436 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
1437 print $hookmanager->resPrint;
1438 // Date creation
1439 if (!empty($arrayfields['e.datec']['checked'])) {
1440 print '<td class="center nowraponall">';
1441 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuserrel');
1442 print '</td>';
1443 if (!$i) {
1444 $totalarray['nbfield']++;
1445 }
1446 }
1447 // Date modification
1448 if (!empty($arrayfields['e.tms']['checked'])) {
1449 print '<td class="center nowraponall">';
1450 print dol_print_date($db->jdate($obj->date_modification), 'dayhour', 'tzuserrel');
1451 print '</td>';
1452 if (!$i) {
1453 $totalarray['nbfield']++;
1454 }
1455 }
1456 // Note public
1457 if (!empty($arrayfields['f.note_public']['checked'])) {
1458 print '<td class="sensiblehtmlcontent center">';
1459 print '<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_public, 5)).'</div>';
1460 print '</td>';
1461 if (!$i) {
1462 $totalarray['nbfield']++;
1463 }
1464 }
1465 // Note private
1466 if (!empty($arrayfields['f.note_private']['checked'])) {
1467 print '<td class="sensiblehtmlcontent center">';
1468 print '<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(dolGetFirstLineOfText($obj->note_private, 5)).'</div>';
1469 print '</td>';
1470 if (!$i) {
1471 $totalarray['nbfield']++;
1472 }
1473 }
1474 // Status
1475 if (!empty($arrayfields['e.fk_statut']['checked'])) {
1476 print '<td class="right nowrap">'.$reception->LibStatut($obj->status, 5).'</td>';
1477 if (!$i) {
1478 $totalarray['nbfield']++;
1479 }
1480 }
1481 // Billed
1482 if (!empty($arrayfields['e.billed']['checked'])) {
1483 print '<td class="center">'.yn($obj->billed).'</td>';
1484 if (!$i) {
1485 $totalarray['nbfield']++;
1486 }
1487 }
1488
1489 // Action column
1490 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1491 print '<td class="nowrap center">';
1492 if ($massactionbutton || $massaction) {
1493 // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1494 $selected = 0;
1495 if (in_array($obj->rowid, $arrayofselected)) {
1496 $selected = 1;
1497 }
1498 print '<input id="cb'.$obj->rowid.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.'"'.($selected ? ' checked="checked"' : '').'>';
1499 }
1500 print '</td>';
1501 }
1502 if (!$i) {
1503 $totalarray['nbfield']++;
1504 }
1505
1506 print "</tr>\n";
1507 }
1508 $i++;
1509}
1510
1511// If no record found
1512if ($num == 0) {
1513 $colspan = 1;
1514 foreach ($arrayfields as $key => $val) {
1515 if (!empty($val['checked'])) {
1516 $colspan++;
1517 }
1518 }
1519 print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
1520}
1521
1522// Show total line
1523include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1524
1525$parameters = array('arrayfields' => $arrayfields, 'totalarray' => $totalarray, 'sql' => $sql);
1526$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
1527print $hookmanager->resPrint;
1528
1529print "</table>";
1530print "</div>";
1531print '</form>';
1532
1533$db->free($resql);
1534
1535$hidegeneratedfilelistifempty = 1;
1536if ($massaction == 'builddoc' || $action == 'remove_file') {
1537 $hidegeneratedfilelistifempty = 0;
1538}
1539
1540// Show list of available documents
1541$urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
1542$urlsource .= str_replace('&amp;', '&', $param);
1543
1544$filedir = $diroutputmassaction;
1545$genallowed = $user->hasRight('reception', 'lire');
1546$delallowed = $user->hasRight('reception', 'creer');
1547$title = '';
1548
1549print $formfile->showdocuments('massfilesarea_receipts', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
1550
1551// End of page
1552llxFooter();
1553$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 export.php:1216
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_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.
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.
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...
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_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.