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