dolibarr 25.0.0-alpha
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-2026 MDW <mdeweerd@users.noreply.github.com>
5 * Copyright (C) 2025-2026 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
41function shippingGetStandaloneDispatchSourceLine($object, $sourceLineId, $lineId, $productId)
42{
43 if (!getDolGlobalString('SHIPMENT_STANDALONE') || $object->id <= 0 || $object->origin_id > 0 || $object->status != Expedition::STATUS_DRAFT || $productId <= 0) {
44 return null;
45 }
46
47 $sourceLine = null;
48 $dispatchLine = null;
49 foreach ($object->lines as $line) {
50 if ((int) $line->fk_expedition !== (int) $object->id) {
51 continue;
52 }
53 if ((int) $line->id === $sourceLineId) {
54 $sourceLine = $line;
55 }
56 if ((int) $line->id === $lineId) {
57 $dispatchLine = $line;
58 }
59 }
60
61 if ($sourceLine === null || $sourceLine->fk_parent > 0 || (int) $sourceLine->fk_product !== $productId) {
62 return null;
63 }
64 if ($lineId > 0 && ($dispatchLine === null || (int) $dispatchLine->fk_product !== $productId
65 || ($lineId !== $sourceLineId && (int) $dispatchLine->fk_parent !== $sourceLineId))) {
66 return null;
67 }
68
69 return $sourceLine;
70}
71
72
80{
81 global $db, $langs, $conf, $user;
82
83 // Load translation files required by the page
84 $langs->loadLangs(array("sendings"));
85
86 $h = 0;
87 $head = array();
88
89 $head[$h][0] = DOL_URL_ROOT . "/expedition/card.php?id=" . $object->id;
90 $head[$h][1] = $langs->trans("SendingCard");
91 $head[$h][2] = 'shipping';
92 $h++;
93
94 if ($object->status == Expedition::STATUS_DRAFT) {
95 $head[$h][0] = DOL_URL_ROOT . "/expedition/dispatch.php?id=" . $object->id;
96 $head[$h][1] = $langs->trans("ShipmentDistribution");
97 $head[$h][2] = 'dispatch';
98 $h++;
99 }
100
101 if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY') && $user->hasRight('expedition', 'delivery', 'lire')) {
102 // delivery link
103 $object->fetchObjectLinked($object->id, $object->element);
104 if (isset($object->linkedObjectsIds['delivery']) && is_array($object->linkedObjectsIds['delivery']) && count($object->linkedObjectsIds['delivery']) > 0) { // If there is a delivery
105 // Take first element of array
106 $tmp = reset($object->linkedObjectsIds['delivery']);
107
108 $head[$h][0] = DOL_URL_ROOT . "/delivery/card.php?id=" . ((int) $tmp);
109 $head[$h][1] = $langs->trans("DeliveryCard");
110 $head[$h][2] = 'delivery';
111 $h++;
112 }
113 }
114
115 if (!getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB')) {
116 $objectsrc = $object;
117 if (!getDolGlobalInt('SHIPPING_USE_ITS_OWN_CONTACTS') && $object->origin_type == 'commande' && $object->origin_id > 0) {
118 $objectsrc = new Commande($db);
119 $objectsrc->fetch($object->origin_id);
120 }
121 $nbContact = count($objectsrc->liste_contact(-1, 'internal')) + count($objectsrc->liste_contact(-1, 'external'));
122 $head[$h][0] = DOL_URL_ROOT . "/expedition/contact.php?id=" . ((int) $object->id);
123 $head[$h][1] = $langs->trans("ContactsAddresses");
124 if ($nbContact > 0) {
125 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbContact . '</span>';
126 }
127 $head[$h][2] = 'contact';
128 $h++;
129 }
130
131 // Files
132 require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
133 require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
134 $upload_dir = $conf->expedition->dir_output . "/sending/" . dol_sanitizeFileName($object->ref);
135 $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
136 $nbLinks = Link::count($db, $object->element, $object->id);
137 $head[$h][0] = DOL_URL_ROOT . '/expedition/document.php?id=' . $object->id;
138 $head[$h][1] = $langs->trans('Documents');
139 if (($nbFiles + $nbLinks) > 0) {
140 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . ($nbFiles + $nbLinks) . '</span>';
141 }
142 $head[$h][2] = 'documents';
143 $h++;
144
145 // Notes
146 $nbNote = 0;
147 if (!empty($object->note_private)) {
148 $nbNote++;
149 }
150 if (!empty($object->note_public)) {
151 $nbNote++;
152 }
153 $head[$h][0] = DOL_URL_ROOT . "/expedition/note.php?id=" . $object->id;
154 $head[$h][1] = $langs->trans("Notes");
155 if ($nbNote > 0) {
156 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbNote . '</span>';
157 }
158 $head[$h][2] = 'note';
159 $h++;
160
161 // Events
162 $head[$h][0] = DOL_URL_ROOT . '/expedition/agenda.php?id=' . $object->id;
163 $head[$h][1] = $langs->trans("Events");
164 if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) {
165 $nbEvent = 0;
166 // Enable caching of thirdparty count actioncomm
167 require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';
168 $cachekey = 'count_events_expedition_' . $object->id;
169 $dataretrieved = dol_getcache($cachekey);
170 if (!is_null($dataretrieved)) {
171 $nbEvent = $dataretrieved;
172 } else {
173 $sql = "SELECT COUNT(id) as nb";
174 $sql .= " FROM " . MAIN_DB_PREFIX . "actioncomm";
175 $sql .= " WHERE fk_element = " . ((int) $object->id);
176 $sql .= " AND elementtype = 'shipping'";
177 $resql = $db->query($sql);
178 if ($resql) {
179 $obj = $db->fetch_object($resql);
180 $nbEvent = $obj->nb;
181 } else {
182 dol_syslog('Failed to count actioncomm ' . $db->lasterror(), LOG_ERR);
183 }
184 dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result.
185 }
186
187 $head[$h][1] .= '/';
188 $head[$h][1] .= $langs->trans("Agenda");
189 if ($nbEvent > 0) {
190 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbEvent . '</span>';
191 }
192 }
193 $head[$h][2] = 'agenda';
194 $h++;
195
196 // Show more tabs from modules
197 // Entries must be declared in modules descriptor with line
198 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
199 // $this->tabs = array('entity:-tabname); to remove a tab
200 complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery');
201
202 complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery', 'remove');
203
204 return $head;
205}
206
207
215{
216 global $langs, $db, $conf, $user;
217
218 // Load translation files required by the page
219 $langs->loadLangs(array("sendings"));
220
221 $h = 0;
222 $head = array();
223
224 if (getDolGlobalInt('MAIN_SUBMODULE_EXPEDITION') && $user->hasRight('expedition', 'lire')) {
225 $head[$h][0] = DOL_URL_ROOT . "/expedition/card.php?id=" . $object->origin_id;
226 $head[$h][1] = $langs->trans("SendingCard");
227 $head[$h][2] = 'shipping';
228 $h++;
229 }
230
231 $head[$h][0] = DOL_URL_ROOT . "/delivery/card.php?id=" . $object->id;
232 $head[$h][1] = $langs->trans("DeliveryCard");
233 $head[$h][2] = 'delivery';
234 $h++;
235
236 // Show more tabs from modules
237 // Entries must be declared in modules descriptor with line
238 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
239 // $this->tabs = array('entity:-tabname); to remove a tab
240 // complete_head_from_modules use $object->id for this link so we temporary change it
241
242 $savObjectId = $object->id;
243
244 // Get parent object
245 $tmpobject = null;
246 if ($object->origin_type) {
247 $tmpobject = new Expedition($db);
248 $tmpobject->fetch($object->origin_id);
249 } else {
250 $tmpobject = $object;
251 }
252
253 if (!getDolGlobalString('MAIN_DISABLE_CONTACTS_TAB')) {
254 $objectsrc = $tmpobject;
255 if ($tmpobject->origin_type == 'commande' && $tmpobject->origin_id > 0) {
256 $objectsrc = new Commande($db);
257 $objectsrc->fetch($tmpobject->origin_id);
258 }
259 $nbContact = count($objectsrc->liste_contact(-1, 'internal')) + count($objectsrc->liste_contact(-1, 'external'));
260 $head[$h][0] = DOL_URL_ROOT . "/expedition/contact.php?id=" . $tmpobject->id;
261 $head[$h][1] = $langs->trans("ContactsAddresses");
262 if ($nbContact > 0) {
263 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbContact . '</span>';
264 }
265 $head[$h][2] = 'contact';
266 $h++;
267 }
268
269 // Files
270 require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
271 require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
272 $upload_dir = $conf->expedition->dir_output . "/sending/" . dol_sanitizeFileName($tmpobject->ref);
273 $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
274 $nbLinks = Link::count($db, $tmpobject->element, $tmpobject->id);
275 $head[$h][0] = DOL_URL_ROOT . '/expedition/document.php?id=' . $tmpobject->id;
276 $head[$h][1] = $langs->trans('Documents');
277 if (($nbFiles + $nbLinks) > 0) {
278 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . ($nbFiles + $nbLinks) . '</span>';
279 }
280 $head[$h][2] = 'documents';
281 $h++;
282
283 // Notes
284 $nbNote = 0;
285 if (!empty($tmpobject->note_private)) {
286 $nbNote++;
287 }
288 if (!empty($tmpobject->note_public)) {
289 $nbNote++;
290 }
291 $head[$h][0] = DOL_URL_ROOT . "/expedition/note.php?id=" . $tmpobject->id;
292 $head[$h][1] = $langs->trans("Notes");
293 if ($nbNote > 0) {
294 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbNote . '</span>';
295 }
296 $head[$h][2] = 'note';
297 $h++;
298
299 // Events
300 $head[$h][0] = DOL_URL_ROOT . '/expedition/agenda.php?id=' . $tmpobject->id;
301 $head[$h][1] = $langs->trans("Events");
302 if (isModEnabled('agenda') && ($user->hasRight('agenda', 'myactions', 'read') || $user->hasRight('agenda', 'allactions', 'read'))) {
303 $nbEvent = 0;
304 // Enable caching of thirdparty count actioncomm
305 require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php';
306 $cachekey = 'count_events_expedition_' . $tmpobject->id;
307 $dataretrieved = dol_getcache($cachekey);
308 if (!is_null($dataretrieved)) {
309 $nbEvent = $dataretrieved;
310 } else {
311 $sql = "SELECT COUNT(id) as nb";
312 $sql .= " FROM " . MAIN_DB_PREFIX . "actioncomm";
313 $sql .= " WHERE fk_element = " . ((int) $tmpobject->id);
314 $sql .= " AND elementtype = 'shipping'";
315 $resql = $db->query($sql);
316 if ($resql) {
317 $obj = $db->fetch_object($resql);
318 $nbEvent = $obj->nb;
319 } else {
320 dol_syslog('Failed to count actioncomm ' . $db->lasterror(), LOG_ERR);
321 }
322 dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result.
323 }
324
325 $head[$h][1] .= '/';
326 $head[$h][1] .= $langs->trans("Agenda");
327 if ($nbEvent > 0) {
328 $head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbEvent . '</span>';
329 }
330 }
331 $head[$h][2] = 'agenda';
332 $h++;
333
334
335 $object->id = $tmpobject->id;
336
337 complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery');
338
339 complete_head_from_modules($conf, $langs, $object, $head, $h, 'delivery', 'remove');
340
341 $object->id = $savObjectId;
342 return $head;
343}
344
353function show_list_sending_receive($origin, $origin_id, $filter = '')
354{
355 global $db, $conf, $langs;
356 global $form;
357
358 $product_static = new Product($db);
359 $expedition = new Expedition($db);
360 $warehousestatic = new Entrepot($db);
361
362 $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,";
363 $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,";
364 $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,";
365 $sql .= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch,';
366 $sql .= ' p.description as product_desc';
367 $sql .= " FROM " . MAIN_DB_PREFIX . "expeditiondet as ed,";
368 $sql .= " " . MAIN_DB_PREFIX . "expedition as e,";
369 $sql .= " " . MAIN_DB_PREFIX . $db->sanitize($origin) . "det as obj"; // for example llx_commandedet
370 $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON obj.fk_product = p.rowid";
371 //TODO Add link to expeditiondet_batch
372 $sql .= " WHERE e.entity IN (" . getEntity('expedition') . ")";
373 $sql .= " AND obj.fk_" . $db->sanitize($origin) . " = " . ((int) $origin_id);
374 $sql .= " AND obj.rowid = ed.fk_elementdet";
375 if (isModEnabled('subtotals')) {
376 $sql .= " AND obj.special_code <> " . SUBTOTALS_SPECIAL_CODE;
377 }
378 $sql .= " AND ed.fk_expedition = e.rowid";
379 if ($filter) {
380 $sql .= $filter; // @phan-suppress-current-line SqlInjection
381 }
382 $sql .= " ORDER BY obj.rowid, obj.fk_product";
383
384 dol_syslog("show_list_sending_receive", LOG_DEBUG);
385 $resql = $db->query($sql);
386 if ($resql) {
387 $num = $db->num_rows($resql);
388 $i = 0;
389
390 if ($num) {
391 if ($filter) {
392 print load_fiche_titre($langs->trans("OtherSendingsForSameOrder"));
393 } else {
394 print load_fiche_titre($langs->trans("SendingsAndReceivingForSameOrder"));
395 }
396
397 print '<div class="div-table-responsive-no-min">';
398 print '<table class="liste centpercent">';
399 print '<tr class="liste_titre">';
400 //print '<td class="left">'.$langs->trans("QtyOrdered").'</td>';
401 print '<td>' . $langs->trans("SendingSheet") . '</td>';
402 print '<td>' . $langs->trans("Description") . '</td>';
403 print '<td class="center">' . $langs->trans("DateCreation") . '</td>';
404 print '<td class="center">' . $langs->trans("DateDeliveryPlanned") . '</td>';
405 print '<td class="center">' . $langs->trans("QtyPreparedOrShipped") . '</td>';
406 if (isModEnabled('stock')) {
407 print '<td>' . $langs->trans("Warehouse") . '</td>';
408 }
409 /*TODO Add link to expeditiondet_batch
410 if (isModEnabled('productbatch'))
411 {
412 print '<td>';
413 print '</td>';
414 }*/
415 if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) {
416 print '<td>' . $langs->trans("DeliveryOrder") . '</td>';
417 //print '<td class="center">'.$langs->trans("QtyReceived").'</td>';
418 print '<td class="right">' . $langs->trans("DeliveryDate") . '</td>';
419 }
420 print "</tr>\n";
421
422 while ($i < $num) {
423 $objp = $db->fetch_object($resql);
424
425 $expedition->id = $objp->expedition_id;
426 $expedition->ref = $objp->exp_ref;
427 $expedition->billed = $objp->billed;
428 $expedition->statut = $objp->status;
429 $expedition->status = $objp->status;
430 $expedition->signed_status = $objp->signed_status;
431
432 print '<tr class="oddeven">';
433
434 // Sending id
435 print '<td class="tdoverflowmax125">';
436 print $expedition->getNomUrl(1);
437 //print '<a href="'.DOL_URL_ROOT.'/expedition/card.php?id='.$objp->expedition_id.'">'.img_object($langs->trans("ShowSending"), 'sending').' '.$objp->exp_ref.'<a>';
438 print '</td>';
439
440 // Description
441 if ($objp->fk_product > 0) {
442 // Define output language
443 if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) {
444 $object = new $origin($db);
445 '@phan-var-force CommonObject $object';
446 $object->fetch($origin_id);
447 $object->fetch_thirdparty();
448
449 $prod = new Product($db);
450 $prod->id = $objp->fk_product;
451 $prod->getMultiLangs();
452
453 $outputlangs = $langs;
454 $newlang = '';
455 if (GETPOST('lang_id', 'aZ09')) {
456 $newlang = GETPOST('lang_id', 'aZ09');
457 }
458 if (empty($newlang)) {
459 $newlang = $object->thirdparty->default_lang;
460 }
461 if (!empty($newlang)) {
462 $outputlangs = new Translate("", $conf);
463 $outputlangs->setDefaultLang($newlang);
464 }
465
466 $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label;
467 } else {
468 $label = (!empty($objp->label) ? $objp->label : $objp->product_label);
469 }
470
471 print '<td>';
472
473 // Show product and description
474 $product_static->type = $objp->fk_product_type;
475 $product_static->id = $objp->fk_product;
476 $product_static->ref = $objp->ref;
477 $product_static->status_batch = $objp->product_tobatch;
478
479 $text = $product_static->getNomUrl(1);
480 $text .= ' - ' . $label;
481 $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description));
482 print $form->textwithtooltip($text, $description, 3, 0, '', (string) $i);
483
484 // Show range
485 print_date_range($objp->date_start, $objp->date_end);
486
487 // Add description in form
488 if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
489 print(!empty($objp->description) ? ((empty($objp->product) || $objp->description != $objp->product) ? '<br>' . dol_htmlentitiesbr($objp->description) : '') : '');
490 }
491
492 print '</td>';
493 } else {
494 print "<td>";
495 if ($objp->fk_product_type == 1) {
496 $text = img_object($langs->trans('Service'), 'service');
497 } else {
498 $text = img_object($langs->trans('Product'), 'product');
499 }
500
501 if (!empty($objp->label)) {
502 $text .= ' <strong>' . $objp->label . '</strong>';
503 print $form->textwithtooltip($text, $objp->description, 3, 0, '', (string) $i);
504 } else {
505 print $text . ' ' . nl2br($objp->description);
506 }
507
508 // Show range
509 print_date_range($objp->date_start, $objp->date_end);
510 print "</td>\n";
511 }
512
513 //print '<td class="center">'.$objp->qty_asked.'</td>';
514
515 // Date creation
516 print '<td class="nowrap center">' . dol_print_date($db->jdate($objp->date_creation), 'day') . '</td>';
517
518 // Date shipping creation
519 print '<td class="nowrap center">' . dol_print_date($db->jdate($objp->date_delivery), 'day') . '</td>';
520
521 // Qty shipped
522 print '<td class="center">' . $objp->qty_shipped . '</td>';
523
524 // Warehouse
525 if (isModEnabled('stock')) {
526 print '<td class="tdoverflowmax125">';
527 if ($objp->warehouse_id > 0) {
528 $warehousestatic->fetch($objp->warehouse_id);
529 print $warehousestatic->getNomUrl(1);
530 }
531 print '</td>';
532 }
533
534 // Batch number management
535 /*TODO Add link to expeditiondet_batch
536 if (isModEnabled('productbatch'))
537 {
538 //var_dump($objp->edrowid);
539 $lines[$i]->detail_batch
540 if (isset($lines[$i]->detail_batch))
541 {
542 print '<td>';
543 if ($lines[$i]->product_tobatch)
544 {
545 $detail = '';
546 foreach ($lines[$i]->detail_batch as $dbatch)
547 {
548 $detail.= $langs->trans("Batch").': '.$dbatch->batch;
549 $detail.= ' - '.$langs->trans("SellByDate").': '.dol_print_date($dbatch->sellby,"day");
550 $detail.= ' - '.$langs->trans("EatByDate").': '.dol_print_date($dbatch->eatby,"day");
551 $detail.= ' - '.$langs->trans("Qty").': '.$dbatch->qty;
552 $detail.= '<br>';
553 }
554 print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"),$detail);
555 }
556 else
557 {
558 print $langs->trans("NA");
559 }
560 print '</td>';
561 } else {
562 print '<td></td>';
563 }
564 }*/
565
566 // Information on receipt
567 if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) {
568 include_once DOL_DOCUMENT_ROOT . '/delivery/class/delivery.class.php';
569 $expedition->fetchObjectLinked($expedition->id, $expedition->element, null, 'delivery');
570 //var_dump($expedition->linkedObjects);
571
572 $receiving = '';
573 if (!empty($expedition->linkedObjects['delivery'])) {
574 $receiving = reset($expedition->linkedObjects['delivery']); // Take first link
575 }
576
577 if (!empty($receiving)) {
579 '@phan-var-force Delivery $receiving';
580 // $expedition->fk_elementdet = id of det line of order
581 // $receiving->fk_origin_line = id of det line of order
582 // $receiving->origin may be 'shipping'
583 // $receiving->origin_id may be id of shipping
584
585 // Ref
586 print '<td>';
587 print $receiving->getNomUrl(1);
588 //print '<a href="'.DOL_URL_ROOT.'/delivery/card.php?id='.$livraison_id.'">'.img_object($langs->trans("ShowReceiving"),'sending').' '.$objp->livraison_ref.'<a>';
589 print '</td>';
590 // Qty received
591 //print '<td class="center">';
592 // TODO No solution for the moment to link a line det of receipt with a line det of shipping,
593 // so no way to know the qty received for this line of shipping.
594 //print $langs->trans("FeatureNotYetAvailable");
595 //print '</td>';
596 // Date shipping real
597 print '<td class="right">';
598 print dol_print_date($receiving->date_delivery, 'day');
599 print '</td>';
600 } else {
601 //print '<td>&nbsp;</td>';
602 print '<td>&nbsp;</td>';
603 print '<td>&nbsp;</td>';
604 }
605 }
606 print '</tr>';
607 $i++;
608 }
609
610 print '</table>';
611 print '</div>';
612 }
613 $db->free($resql);
614 } else {
615 dol_print_error($db);
616 }
617
618 return 1;
619}
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
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:65
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
print_date_range($date_start, $date_end, $format='', $outputlangs=null)
Format output for start and end date.
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).
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.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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.
shippingGetStandaloneDispatchSourceLine($object, $sourceLineId, $lineId, $productId)
Resolve a standalone dispatch group from the loaded shipment lines.