dolibarr 23.0.3
sendings.lib.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
4 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
5 * Copyright (C) 2025 Frédéric France <frederic.france@free.fr>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
26require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
27require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
28require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
29
30
38{
39 global $db, $langs, $conf, $user;
40
41 // Load translation files required by the page
42 $langs->loadLangs(array("sendings"));
43
44 $h = 0;
45 $head = array();
46
47 $head[$h][0] = DOL_URL_ROOT . "/expedition/card.php?id=" . $object->id;
48 $head[$h][1] = $langs->trans("SendingCard");
49 $head[$h][2] = 'shipping';
50 $h++;
51
52 if ($object->status == Expedition::STATUS_DRAFT) {
53 $head[$h][0] = DOL_URL_ROOT . "/expedition/dispatch.php?id=" . $object->id;
54 $head[$h][1] = $langs->trans("ShipmentDistribution");
55 $head[$h][2] = 'dispatch';
56 $h++;
57 }
58
59 if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && $user->hasRight('expedition', 'delivery', 'lire')) {
60 // delivery link
61 $object->fetchObjectLinked($object->id, $object->element);
62 if (isset($object->linkedObjectsIds['delivery']) && is_array($object->linkedObjectsIds['delivery']) && count($object->linkedObjectsIds['delivery']) > 0) { // If there is a delivery
63 // Take first element of array
64 $tmp = reset($object->linkedObjectsIds['delivery']);
65
66 $head[$h][0] = DOL_URL_ROOT . "/delivery/card.php?id=" . ((int) $tmp);
67 $head[$h][1] = $langs->trans("DeliveryCard");
68 $head[$h][2] = 'delivery';
69 $h++;
70 }
71 }
72
73 if (!getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB')) {
74 $objectsrc = $object;
75 if (!getDolGlobalInt('SHIPPING_USE_ITS_OWN_CONTACTS') && $object->origin_type == 'commande' && $object->origin_id > 0) {
76 $objectsrc = new Commande($db);
77 $objectsrc->fetch($object->origin_id);
78 }
79 $nbContact = count($objectsrc->liste_contact(-1, 'internal')) + count($objectsrc->liste_contact(-1, 'external'));
80 $head[$h][0] = DOL_URL_ROOT . "/expedition/contact.php?id=" . ((int) $object->id);
81 $head[$h][1] = $langs->trans("ContactsAddresses");
82 if ($nbContact > 0) {
83 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbContact . '</span>';
84 }
85 $head[$h][2] = 'contact';
86 $h++;
87 }
88
89 // Files
90 require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
91 require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
92 $upload_dir = $conf->expedition->dir_output . "/sending/" . dol_sanitizeFileName($object->ref);
93 $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
94 $nbLinks = Link::count($db, $object->element, $object->id);
95 $head[$h][0] = DOL_URL_ROOT . '/expedition/document.php?id=' . $object->id;
96 $head[$h][1] = $langs->trans('Documents');
97 if (($nbFiles + $nbLinks) > 0) {
98 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . ($nbFiles + $nbLinks) . '</span>';
99 }
100 $head[$h][2] = 'documents';
101 $h++;
102
103 // Notes
104 $nbNote = 0;
105 if (!empty($object->note_private)) {
106 $nbNote++;
107 }
108 if (!empty($object->note_public)) {
109 $nbNote++;
110 }
111 $head[$h][0] = DOL_URL_ROOT . "/expedition/note.php?id=" . $object->id;
112 $head[$h][1] = $langs->trans("Notes");
113 if ($nbNote > 0) {
114 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbNote . '</span>';
115 }
116 $head[$h][2] = 'note';
117 $h++;
118
119 // Events
120 $head[$h][0] = DOL_URL_ROOT . '/expedition/agenda.php?id=' . $object->id;
121 $head[$h][1] = $langs->trans("Events");
122 if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) {
123 $nbEvent = 0;
124 // Enable caching of thirdparty count actioncomm
125 require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';
126 $cachekey = 'count_events_expedition_' . $object->id;
127 $dataretrieved = dol_getcache($cachekey);
128 if (!is_null($dataretrieved)) {
129 $nbEvent = $dataretrieved;
130 } else {
131 $sql = "SELECT COUNT(id) as nb";
132 $sql .= " FROM " . MAIN_DB_PREFIX . "actioncomm";
133 $sql .= " WHERE fk_element = " . ((int) $object->id);
134 $sql .= " AND elementtype = 'shipping'";
135 $resql = $db->query($sql);
136 if ($resql) {
137 $obj = $db->fetch_object($resql);
138 $nbEvent = $obj->nb;
139 } else {
140 dol_syslog('Failed to count actioncomm ' . $db->lasterror(), LOG_ERR);
141 }
142 dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result.
143 }
144
145 $head[$h][1] .= '/';
146 $head[$h][1] .= $langs->trans("Agenda");
147 if ($nbEvent > 0) {
148 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbEvent . '</span>';
149 }
150 }
151 $head[$h][2] = 'agenda';
152 $h++;
153
154 // Show more tabs from modules
155 // Entries must be declared in modules descriptor with line
156 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
157 // $this->tabs = array('entity:-tabname); to remove a tab
158 complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery');
159
160 complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery', 'remove');
161
162 return $head;
163}
164
165
173{
174 global $langs, $db, $conf, $user;
175
176 // Load translation files required by the page
177 $langs->loadLangs(array("sendings"));
178
179 $h = 0;
180 $head = array();
181
182 if (getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && $user->hasRight('expedition', 'lire')) {
183 $head[$h][0] = DOL_URL_ROOT . "/expedition/card.php?id=" . $object->origin_id;
184 $head[$h][1] = $langs->trans("SendingCard");
185 $head[$h][2] = 'shipping';
186 $h++;
187 }
188
189 $head[$h][0] = DOL_URL_ROOT . "/delivery/card.php?id=" . $object->id;
190 $head[$h][1] = $langs->trans("DeliveryCard");
191 $head[$h][2] = 'delivery';
192 $h++;
193
194 // Show more tabs from modules
195 // Entries must be declared in modules descriptor with line
196 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
197 // $this->tabs = array('entity:-tabname); to remove a tab
198 // complete_head_from_modules use $object->id for this link so we temporary change it
199
200 $savObjectId = $object->id;
201
202 // Get parent object
203 $tmpobject = null;
204 if ($object->origin_type) {
205 $tmpobject = new Expedition($db);
206 $tmpobject->fetch($object->origin_id);
207 } else {
208 $tmpobject = $object;
209 }
210
211 if (!getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB')) {
212 $objectsrc = $tmpobject;
213 if ($tmpobject->origin_type == 'commande' && $tmpobject->origin_id > 0) {
214 $objectsrc = new Commande($db);
215 $objectsrc->fetch($tmpobject->origin_id);
216 }
217 $nbContact = count($objectsrc->liste_contact(-1, 'internal')) + count($objectsrc->liste_contact(-1, 'external'));
218 $head[$h][0] = DOL_URL_ROOT . "/expedition/contact.php?id=" . $tmpobject->id;
219 $head[$h][1] = $langs->trans("ContactsAddresses");
220 if ($nbContact > 0) {
221 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbContact . '</span>';
222 }
223 $head[$h][2] = 'contact';
224 $h++;
225 }
226
227 // Files
228 require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
229 require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
230 $upload_dir = $conf->expedition->dir_output . "/sending/" . dol_sanitizeFileName($tmpobject->ref);
231 $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
232 $nbLinks = Link::count($db, $tmpobject->element, $tmpobject->id);
233 $head[$h][0] = DOL_URL_ROOT . '/expedition/document.php?id=' . $tmpobject->id;
234 $head[$h][1] = $langs->trans('Documents');
235 if (($nbFiles + $nbLinks) > 0) {
236 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . ($nbFiles + $nbLinks) . '</span>';
237 }
238 $head[$h][2] = 'documents';
239 $h++;
240
241 // Notes
242 $nbNote = 0;
243 if (!empty($tmpobject->note_private)) {
244 $nbNote++;
245 }
246 if (!empty($tmpobject->note_public)) {
247 $nbNote++;
248 }
249 $head[$h][0] = DOL_URL_ROOT . "/expedition/note.php?id=" . $tmpobject->id;
250 $head[$h][1] = $langs->trans("Notes");
251 if ($nbNote > 0) {
252 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbNote . '</span>';
253 }
254 $head[$h][2] = 'note';
255 $h++;
256
257 // Events
258 $head[$h][0] = DOL_URL_ROOT . '/expedition/agenda.php?id=' . $tmpobject->id;
259 $head[$h][1] = $langs->trans("Events");
260 if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) {
261 $nbEvent = 0;
262 // Enable caching of thirdparty count actioncomm
263 require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';
264 $cachekey = 'count_events_expedition_' . $tmpobject->id;
265 $dataretrieved = dol_getcache($cachekey);
266 if (!is_null($dataretrieved)) {
267 $nbEvent = $dataretrieved;
268 } else {
269 $sql = "SELECT COUNT(id) as nb";
270 $sql .= " FROM " . MAIN_DB_PREFIX . "actioncomm";
271 $sql .= " WHERE fk_element = " . ((int) $tmpobject->id);
272 $sql .= " AND elementtype = 'shipping'";
273 $resql = $db->query($sql);
274 if ($resql) {
275 $obj = $db->fetch_object($resql);
276 $nbEvent = $obj->nb;
277 } else {
278 dol_syslog('Failed to count actioncomm ' . $db->lasterror(), LOG_ERR);
279 }
280 dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result.
281 }
282
283 $head[$h][1] .= '/';
284 $head[$h][1] .= $langs->trans("Agenda");
285 if ($nbEvent > 0) {
286 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbEvent . '</span>';
287 }
288 }
289 $head[$h][2] = 'agenda';
290 $h++;
291
292
293 $object->id = $tmpobject->id;
294
295 complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery');
296
297 complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery', 'remove');
298
299 $object->id = $savObjectId;
300 return $head;
301}
302
311function show_list_sending_receive($origin, $origin_id, $filter = '')
312{
313 global $db, $conf, $langs;
314 global $form;
315
316 $product_static = new Product($db);
317 $expedition = new Expedition($db);
318 $warehousestatic = new Entrepot($db);
319
320 $sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end, obj.special_code,";
321 $sql .= " ed.rowid as edrowid, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_elementdet, ed.fk_entrepot as warehouse_id,";
322 $sql .= " e.rowid as sendingid, e.ref as exp_ref, e.date_creation, e.date_delivery, e.date_expedition, e.billed, e.fk_statut as status, e.signed_status,";
323 $sql .= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch,';
324 $sql .= ' p.description as product_desc';
325 $sql .= " FROM " . MAIN_DB_PREFIX . "expeditiondet as ed,";
326 $sql .= " " . MAIN_DB_PREFIX . "expedition as e,";
327 $sql .= " " . MAIN_DB_PREFIX . $origin . "det as obj"; // for example llx_commandedet
328 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON obj.fk_product = p.rowid";
329 //TODO Add link to expeditiondet_batch
330 $sql .= " WHERE e.entity IN (" . getEntity('expedition') . ")";
331 $sql .= " AND obj.fk_" . $origin . " = " . ((int) $origin_id);
332 $sql .= " AND obj.rowid = ed.fk_elementdet";
333 if (isModEnabled('subtotals')) {
334 $sql .= " AND obj.special_code <> " . SUBTOTALS_SPECIAL_CODE;
335 }
336 $sql .= " AND ed.fk_expedition = e.rowid";
337 if ($filter) {
338 $sql .= $filter;
339 }
340 $sql .= " ORDER BY obj.rowid, obj.fk_product";
341
342 dol_syslog("show_list_sending_receive", LOG_DEBUG);
343 $resql = $db->query($sql);
344 if ($resql) {
345 $num = $db->num_rows($resql);
346 $i = 0;
347
348 if ($num) {
349 if ($filter) {
350 print load_fiche_titre($langs->trans("OtherSendingsForSameOrder"));
351 } else {
352 print load_fiche_titre($langs->trans("SendingsAndReceivingForSameOrder"));
353 }
354
355 print '<div class="div-table-responsive-no-min">';
356 print '<table class="liste centpercent">';
357 print '<tr class="liste_titre">';
358 //print '<td class="left">'.$langs->trans("QtyOrdered").'</td>';
359 print '<td>' . $langs->trans("SendingSheet") . '</td>';
360 print '<td>' . $langs->trans("Description") . '</td>';
361 print '<td class="center">' . $langs->trans("DateCreation") . '</td>';
362 print '<td class="center">' . $langs->trans("DateDeliveryPlanned") . '</td>';
363 print '<td class="center">' . $langs->trans("QtyPreparedOrShipped") . '</td>';
364 if (isModEnabled('stock')) {
365 print '<td>' . $langs->trans("Warehouse") . '</td>';
366 }
367 /*TODO Add link to expeditiondet_batch
368 if (isModEnabled('productbatch'))
369 {
370 print '<td>';
371 print '</td>';
372 }*/
373 if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) {
374 print '<td>' . $langs->trans("DeliveryOrder") . '</td>';
375 //print '<td class="center">'.$langs->trans("QtyReceived").'</td>';
376 print '<td class="right">' . $langs->trans("DeliveryDate") . '</td>';
377 }
378 print "</tr>\n";
379
380 while ($i < $num) {
381 $objp = $db->fetch_object($resql);
382
383 $expedition->id = $objp->expedition_id;
384 $expedition->ref = $objp->exp_ref;
385 $expedition->billed = $objp->billed;
386 $expedition->statut = $objp->status;
387 $expedition->status = $objp->status;
388 $expedition->signed_status = $objp->signed_status;
389
390 print '<tr class="oddeven">';
391
392 // Sending id
393 print '<td class="tdoverflowmax125">';
394 print $expedition->getNomUrl(1);
395 //print '<a href="'.DOL_URL_ROOT.'/expedition/card.php?id='.$objp->expedition_id.'">'.img_object($langs->trans("ShowSending"), 'sending').' '.$objp->exp_ref.'<a>';
396 print '</td>';
397
398 // Description
399 if ($objp->fk_product > 0) {
400 // Define output language
401 if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) {
402 $object = new $origin($db);
403 '@phan-var-force CommonObject $object';
404 $object->fetch($origin_id);
405 $object->fetch_thirdparty();
406
407 $prod = new Product($db);
408 $prod->id = $objp->fk_product;
409 $prod->getMultiLangs();
410
411 $outputlangs = $langs;
412 $newlang = '';
413 if (empty($newlang) && GETPOST('lang_id', 'aZ09')) {
414 $newlang = GETPOST('lang_id', 'aZ09');
415 }
416 if (empty($newlang)) {
417 $newlang = $object->thirdparty->default_lang;
418 }
419 if (!empty($newlang)) {
420 $outputlangs = new Translate("", $conf);
421 $outputlangs->setDefaultLang($newlang);
422 }
423
424 $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label;
425 } else {
426 $label = (!empty($objp->label) ? $objp->label : $objp->product_label);
427 }
428
429 print '<td>';
430
431 // Show product and description
432 $product_static->type = $objp->fk_product_type;
433 $product_static->id = $objp->fk_product;
434 $product_static->ref = $objp->ref;
435 $product_static->status_batch = $objp->product_tobatch;
436
437 $text = $product_static->getNomUrl(1);
438 $text .= ' - ' . $label;
439 $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description));
440 print $form->textwithtooltip($text, $description, 3, 0, '', (string) $i);
441
442 // Show range
443 print_date_range($objp->date_start, $objp->date_end);
444
445 // Add description in form
446 if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
447 print(!empty($objp->description) ? ((empty($objp->product) || $objp->description != $objp->product) ? '<br>' . dol_htmlentitiesbr($objp->description) : '') : '');
448 }
449
450 print '</td>';
451 } else {
452 print "<td>";
453 if ($objp->fk_product_type == 1) {
454 $text = img_object($langs->trans('Service'), 'service');
455 } else {
456 $text = img_object($langs->trans('Product'), 'product');
457 }
458
459 if (!empty($objp->label)) {
460 $text .= ' <strong>' . $objp->label . '</strong>';
461 print $form->textwithtooltip($text, $objp->description, 3, 0, '', (string) $i);
462 } else {
463 print $text . ' ' . nl2br($objp->description);
464 }
465
466 // Show range
467 print_date_range($objp->date_start, $objp->date_end);
468 print "</td>\n";
469 }
470
471 //print '<td class="center">'.$objp->qty_asked.'</td>';
472
473 // Date creation
474 print '<td class="nowrap center">' . dol_print_date($db->jdate($objp->date_creation), 'day') . '</td>';
475
476 // Date shipping creation
477 print '<td class="nowrap center">' . dol_print_date($db->jdate($objp->date_delivery), 'day') . '</td>';
478
479 // Qty shipped
480 print '<td class="center">' . $objp->qty_shipped . '</td>';
481
482 // Warehouse
483 if (isModEnabled('stock')) {
484 print '<td class="tdoverflowmax125">';
485 if ($objp->warehouse_id > 0) {
486 $warehousestatic->fetch($objp->warehouse_id);
487 print $warehousestatic->getNomUrl(1);
488 }
489 print '</td>';
490 }
491
492 // Batch number management
493 /*TODO Add link to expeditiondet_batch
494 if (isModEnabled('productbatch'))
495 {
496 //var_dump($objp->edrowid);
497 $lines[$i]->detail_batch
498 if (isset($lines[$i]->detail_batch))
499 {
500 print '<td>';
501 if ($lines[$i]->product_tobatch)
502 {
503 $detail = '';
504 foreach ($lines[$i]->detail_batch as $dbatch)
505 {
506 $detail.= $langs->trans("Batch").': '.$dbatch->batch;
507 $detail.= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby,"day");
508 $detail.= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby,"day");
509 $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->qty;
510 $detail.= '<br>';
511 }
512 print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"),$detail);
513 }
514 else
515 {
516 print $langs->trans("NA");
517 }
518 print '</td>';
519 } else {
520 print '<td></td>';
521 }
522 }*/
523
524 // Information on receipt
525 if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) {
526 include_once DOL_DOCUMENT_ROOT . '/delivery/class/delivery.class.php';
527 $expedition->fetchObjectLinked($expedition->id, $expedition->element, null, 'delivery');
528 //var_dump($expedition->linkedObjects);
529
530 $receiving = '';
531 if (!empty($expedition->linkedObjects['delivery'])) {
532 $receiving = reset($expedition->linkedObjects['delivery']); // Take first link
533 }
534
535 if (!empty($receiving)) {
537 '@phan-var-force Delivery $receiving';
538 // $expedition->fk_elementdet = id of det line of order
539 // $receiving->fk_origin_line = id of det line of order
540 // $receiving->origin may be 'shipping'
541 // $receiving->origin_id may be id of shipping
542
543 // Ref
544 print '<td>';
545 print $receiving->getNomUrl(1);
546 //print '<a href="'.DOL_URL_ROOT.'/delivery/card.php?id='.$livraison_id.'">'.img_object($langs->trans("ShowReceiving"),'sending').' '.$objp->livraison_ref.'<a>';
547 print '</td>';
548 // Qty received
549 //print '<td class="center">';
550 // TODO No solution for the moment to link a line det of receipt with a line det of shipping,
551 // so no way to know the qty received for this line of shipping.
552 //print $langs->trans("FeatureNotYetAvailable");
553 //print '</td>';
554 // Date shipping real
555 print '<td class="right">';
556 print dol_print_date($receiving->date_delivery, 'day');
557 print '</td>';
558 } else {
559 //print '<td>&nbsp;</td>';
560 print '<td>&nbsp;</td>';
561 print '<td>&nbsp;</td>';
562 }
563 }
564 print '</tr>';
565 $i++;
566 }
567
568 print '</table>';
569 print '</div>';
570 }
571 $db->free($resql);
572 } else {
573 dol_print_error($db);
574 }
575
576 return 1;
577}
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
Class to manage customers orders.
Class to manage warehouses.
const STATUS_DRAFT
Draft status.
Class to manage products or services.
Class to manage translations.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
Definition files.lib.php:64
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
print_date_range($date_start, $date_end, $format='', $outputlangs=null)
Format output for start and end date.
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...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
dol_setcache($memoryid, $data, $expire=0, $filecache=0, $replace=0)
Save data into a memory area shared by all users, all sessions on server.
dol_getcache($memoryid, $filecache=0)
Read a memory area shared by all users, all sessions on server.
delivery_prepare_head($object)
Prepare array with list of tabs.
shipping_prepare_head($object)
Prepare array with list of tabs.