dolibarr 23.0.4
shipment.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2012-2015 Juanjo Menent <jmenent@2byte.es>
6 * Copyright (C) 2018-2025 Frédéric France <frederic.france@free.fr>
7 * Copyright (C) 2018-2022 Philippe Grand <philippe.grand@atoo-net.com>
8 * Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
30// Load Dolibarr environment
31require '../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
33require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
34require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
35require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
36require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php';
37require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
38if (isModEnabled('project')) {
39 require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
40 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
41}
42if (isModEnabled('stock')) {
43 require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
44}
45if (isModEnabled("propal")) {
46 require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
47}
48if (isModEnabled("product") || isModEnabled("service")) {
49 require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
50}
51
61// Load translation files required by the page
62$langs->loadLangs(array('orders', 'sendings', 'companies', 'bills', 'propal', 'stocks', 'productbatch', 'incoterm', 'other'));
63
64$order_id = GETPOSTINT('id'); // id of order
65$ref = GETPOST('ref', 'alpha');
66$action = GETPOST('action', 'aZ09');
67
68$hookmanager->initHooks(array('ordershipmentcard'));
69
70
71// Security check
72$socid = 0;
73if (!empty($user->socid)) {
74 $socid = $user->socid;
75}
76
77$object = new Commande($db);
78$shipment = new Expedition($db);
79$extrafields = new ExtraFields($db);
80
81// fetch optionals attributes and labels
82$extrafields->fetch_name_optionals_label($object->table_element);
83
84// Load object
85include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be 'include', not 'include_once'
86
87$result = restrictedArea($user, 'commande', $order_id); // After the fetch: the page may be called with the ref only, the security check must be done on the object found
88
89// Security check
90if ($user->socid) {
91 $socid = $user->socid;
92}
93
94$result = restrictedArea($user, 'expedition', 0, ''); // We use 0 for id, because there is no particular shipment on this tab, only id of order is known
95
96$permissiontoread = $user->hasRight('expedition', 'lire');
97$permissiontoadd = $user->hasRight('expedition', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
98$permissiontodelete = $user->hasRight('expedition', 'supprimer') || ($permissiontoadd && ((int) $object->status == $object::STATUS_DRAFT));
99$permissionnote = $user->hasRight('expedition', 'creer'); // Used by the include of actions_setnotes.inc.php
100$permissiondellink = $user->hasRight('expedition', 'creer'); // Used by the include of actions_dellink.inc.php
101$permissiontoeditextra = $permissiontoadd;
102if (GETPOST('attribute', 'aZ09') && isset($extrafields->attributes[$object->table_element]['perms'][GETPOST('attribute', 'aZ09')])) {
103 // For action 'update_extras', is there a specific permission set for the attribute to update
104 $permissiontoeditextra = dol_eval((string) $extrafields->attributes[$object->table_element]['perms'][GETPOST('attribute', 'aZ09')]);
105}
106
107
108/*
109 * Actions
110 */
111$error = 0;
112$parameters = array('socid' => $socid);
113$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
114if ($reshook < 0) {
115 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
116}
117
118if (empty($reshook)) {
119 // Categorisation dans projet
120 if ($action == 'classin' && $permissiontoadd) {
121 $object->fetch($order_id);
122 $object->setProject(GETPOSTINT('projectid'));
123 }
124
125 if ($action == 'confirm_cloture' && GETPOST('confirm', 'alpha') == 'yes' && $permissiontoadd) {
126 $object->fetch($order_id);
127 $result = $object->cloture($user);
128 } elseif ($action == 'setref_client' && $permissiontoadd) {
129 // Positionne ref commande client
130 $result = $object->set_ref_client($user, GETPOST('ref_client'));
131 if ($result < 0) {
132 setEventMessages($object->error, $object->errors, 'errors');
133 }
134 }
135
136 if ($action == 'setdatedelivery' && $permissiontoadd) {
137 $datedelivery = dol_mktime(GETPOSTINT('liv_hour'), GETPOSTINT('liv_min'), 0, GETPOSTINT('liv_month'), GETPOSTINT('liv_day'), GETPOSTINT('liv_year'));
138
139 $object->fetch($order_id);
140 $result = $object->setDeliveryDate($user, $datedelivery);
141 if ($result < 0) {
142 setEventMessages($object->error, $object->errors, 'errors');
143 }
144 }
145 if ($action == 'setmode' && $permissiontoadd) {
146 $object->fetch($order_id);
147 $result = $object->setPaymentMethods(GETPOSTINT('mode_reglement_id'));
148 if ($result < 0) {
149 setEventMessages($object->error, $object->errors, 'errors');
150 }
151 }
152
153 if ($action == 'setavailability' && $permissiontoadd) {
154 $object->fetch($order_id);
155 $result = $object->availability(GETPOSTINT('availability_id'));
156 if ($result < 0) {
157 setEventMessages($object->error, $object->errors, 'errors');
158 }
159 }
160
161 if ($action == 'setdemandreason' && $permissiontoadd) {
162 $object->fetch($order_id);
163 $result = $object->demand_reason(GETPOSTINT('demand_reason_id'));
164 if ($result < 0) {
165 setEventMessages($object->error, $object->errors, 'errors');
166 }
167 }
168
169 if ($action == 'setconditions' && $permissiontoadd) {
170 $object->fetch($order_id);
171 $result = $object->setPaymentTerms(GETPOSTINT('cond_reglement_id'));
172 if ($result < 0) {
173 setEventMessages($object->error, $object->errors, 'errors');
174 }
175 } elseif ($action == 'set_incoterms' && isModEnabled('incoterm') && $permissiontoadd) {
176 // Set incoterm
177 $result = $object->setIncoterms(GETPOSTINT('incoterm_id'), GETPOST('location_incoterms'));
178 if ($result < 0) {
179 setEventMessages($object->error, $object->errors, 'errors');
180 }
181 }
182
183 // shipping method
184 if ($action == 'setshippingmethod' && $permissiontoadd) {
185 $object->fetch($order_id);
186 $result = $object->setShippingMethod(GETPOSTINT('shipping_method_id'));
187 if ($result < 0) {
188 setEventMessages($object->error, $object->errors, 'errors');
189 }
190 }
191
192 // warehouse
193 if ($action == 'setwarehouse' && $permissiontoadd) {
194 $object->fetch($order_id);
195 $result = $object->setWarehouse(GETPOSTINT('warehouse_id'));
196 if ($result < 0) {
197 setEventMessages($object->error, $object->errors, 'errors');
198 }
199 }
200
201 if ($action == 'update_extras' && $permissiontoeditextra) {
202 $object->oldcopy = dol_clone($object, 2); // @phan-suppress-current-line PhanTypeMismatchProperty
203
204 $attribute_name = GETPOST('attribute', 'aZ09');
205
206 // Fill array 'array_options' with data from update form
207 $ret = $extrafields->setOptionalsFromPost(null, $object, $attribute_name);
208 if ($ret < 0) {
209 $error++;
210 }
211
212 if (!$error) {
213 $result = $object->updateExtraField($attribute_name, 'SHIPPING_MODIFY');
214 if ($result < 0) {
215 setEventMessages($object->error, $object->errors, 'errors');
216 $error++;
217 }
218 }
219
220 if ($error) {
221 $action = 'edit_extras';
222 }
223 }
224
225 if ($action == 'set_thirdparty' && $permissiontoadd) {
226 $object->fetch($order_id);
227 $object->setValueFrom('fk_soc', $socid, '', null, 'date', '', $user, 'ORDER_MODIFY');
228
229 header('Location: '.$_SERVER["PHP_SELF"].'?id='.$order_id);
230 exit();
231 }
232
233 include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
234}
235
236
237/*
238 * View
239 */
240
241$form = new Form($db);
242$formfile = new FormFile($db);
243$formproduct = new FormProduct($db);
244if (isModEnabled('project')) {
245 $formproject = new FormProjets($db);
246}
247
248$title = $object->ref." - ".$langs->trans('Shipments');
249$help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
250llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-expedition page-shipment');
251
252
253if ($order_id > 0 || !empty($ref)) {
254 $object = new Commande($db);
255 if ($object->fetch($order_id, $ref) > 0) {
256 $object->loadExpeditions(1);
257
258 $product_static = new Product($db);
259
260 $soc = new Societe($db);
261 $soc->fetch($object->socid);
262
263 $author = new User($db);
264 $author->fetch($object->user_author_id);
265
266 $head = commande_prepare_head($object);
267 print dol_get_fiche_head($head, 'shipping', $langs->trans("CustomerOrder"), -1, 'order');
268
269
270 $formconfirm = '';
271
272 // Confirm validation
273 if ($action == 'cloture') {
274 $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".urlencode((string) ($order_id)), $langs->trans("CloseShipment"), $langs->trans("ConfirmCloseShipment"), "confirm_cloture");
275 }
276
277 // Call Hook formConfirm
278 $parameters = array('formConfirm' => $formconfirm);
279 $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
280 if (empty($reshook)) {
281 $formconfirm .= $hookmanager->resPrint;
282 } elseif ($reshook > 0) {
283 $formconfirm = $hookmanager->resPrint;
284 }
285
286 // Print form confirm
287 print $formconfirm;
288
289
290 // Order card
291
292 $linkback = '<a href="'.DOL_URL_ROOT.'/commande/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '?socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
293
294
295 $morehtmlref = '<div class="refidno">';
296 // Ref customer
297 $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_client, $object, $permissiontoadd, 'string', '', 0, 1);
298 $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_client, $object, $permissiontoadd, 'string', '', null, null, '', 1);
299 // Thirdparty
300 $morehtmlref .= '<br>'.$soc->getNomUrl(1);
301 // Project
302 if (isModEnabled('project')) {
303 $langs->load("projects");
304 $morehtmlref .= '<br>';
305 if (0) { // @phpstan-ignore-line Do not change on shipment
306 $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"');
307 if ($action != 'classify') {
308 $morehtmlref .= '<a class="editfielda" href="'.dolBuildUrl($_SERVER['PHP_SELF'], ['action' => 'classify', 'id' => $object->id], true).'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
309 }
310 $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $objectsrc->socid, (string) $objectsrc->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300');
311 } else {
312 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
313 $proj = new Project($db);
314 $proj->fetch($objectsrc->fk_project);
315 $morehtmlref .= $proj->getNomUrl(1);
316 if ($proj->title) {
317 $morehtmlref .= '<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).'</span>';
318 }
319 }
320 }
321 }
322 $morehtmlref .= '</div>';
323
324
325 dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
326
327
328 print '<div class="fichecenter">';
329 print '<div class="fichehalfleft">';
330 print '<div class="underbanner clearboth"></div>';
331
332 print '<table class="border centpercent tableforfield">';
333
334 // Discounts for third party
335 if (getDolGlobalString('FACTURE_DEPOSITS_ARE_JUST_PAYMENTS')) {
336 $filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be subtracted to payments only and not to total of final invoice
337 $filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be subtracted to payments only and not to total of final invoice
338 } else {
339 $filterabsolutediscount = "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')";
340 $filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
341 }
342
343 print '<tr><td class="titlefield">'.$langs->trans('Discounts').'</td><td colspan="2">';
344
345 $absolute_discount = $soc->getAvailableDiscounts(null, $filterabsolutediscount);
346 $absolute_creditnote = $soc->getAvailableDiscounts(null, $filtercreditnote);
347 $absolute_discount = price2num($absolute_discount, 'MT');
348 $absolute_creditnote = price2num($absolute_creditnote, 'MT');
349
350 $thirdparty = $soc;
351 $discount_type = 0;
352 $backtopage = urlencode($_SERVER["PHP_SELF"].'?id='.$object->id);
353 $cannotApplyDiscount = 1;
354 include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
355 print '</td></tr>';
356
357 // Date
358 print '<tr><td>'.$langs->trans('Date').'</td>';
359 print '<td colspan="2">';
360 print dol_print_date($object->date, 'day');
361 if ($object->hasDelay() && empty($object->delivery_date)) { // If there is a delivery date planned, warning should be on this date
362 print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
363 }
364 print '</td>';
365 print '</tr>';
366
367 // Delivery date planned
368 print '<tr><td height="10">';
369 print '<table class="nobordernopadding" width="100%"><tr><td>';
370 print $langs->trans('DateDeliveryPlanned');
371 print '</td>';
372
373 if ($action != 'editdate_livraison') {
374 print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetDeliveryDate'), 1).'</a></td>';
375 }
376 print '</tr></table>';
377 print '</td><td colspan="2">';
378 if ($action == 'editdate_livraison') {
379 print '<form name="setdate_livraison" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="post">';
380 print '<input type="hidden" name="token" value="'.newToken().'">';
381 print '<input type="hidden" name="action" value="setdatedelivery">';
382 print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', 1, 1, 0, "setdate_livraison", 1, 0);
383 print '<input type="submit" class="button button-edit" value="'.$langs->trans('Modify').'">';
384 print '</form>';
385 } else {
386 print dol_print_date($object->delivery_date, 'dayhour');
387 if ($object->hasDelay() && !empty($object->delivery_date)) {
388 print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
389 }
390 }
391 print '</td>';
392 print '</tr>';
393
394 // Delivery delay
395 print '<tr><td height="10">';
396 print '<table class="nobordernopadding" width="100%"><tr><td>';
397 print $langs->trans('AvailabilityPeriod');
398 print '</td>';
399 if ($action != 'editavailability') {
400 print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editavailability&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetAvailability'), 1).'</a></td>';
401 }
402 print '</tr></table>';
403 print '</td><td colspan="2">';
404 if ($action == 'editavailability') {
405 $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->availability_id, 'availability_id', 1);
406 } else {
407 $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->availability_id, 'none', 1);
408 }
409 print '</td></tr>';
410
411 // Shipping Method
412 print '<tr><td>';
413 print '<table width="100%" class="nobordernopadding"><tr><td>';
414 print $langs->trans('SendingMethod');
415 print '</td>';
416 if ($action != 'editshippingmethod' && $user->hasRight('expedition', 'creer')) {
417 print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'), 1).'</a></td>';
418 }
419 print '</tr></table>';
420 print '</td><td colspan="2">';
421 if ($action == 'editshippingmethod') {
422 $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->shipping_method_id, 'shipping_method_id', 1);
423 } else {
424 $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->shipping_method_id, 'none');
425 }
426 print '</td>';
427 print '</tr>';
428
429 // Warehouse
430 if (isModEnabled('stock') && getDolGlobalString('WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')) {
431 require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
432 $formproduct = new FormProduct($db);
433 print '<tr><td>';
434 print '<table width="100%" class="nobordernopadding"><tr><td>';
435 print $langs->trans('Warehouse');
436 print '</td>';
437 if ($action != 'editwarehouse' && $permissiontoadd) {
438 print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editwarehouse&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetWarehouse'), 1).'</a></td>';
439 }
440 print '</tr></table>';
441 print '</td><td colspan="2">';
442 if ($action == 'editwarehouse') {
443 $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1);
444 } else {
445 $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none');
446 }
447 print '</td>';
448 print '</tr>';
449 }
450
451 // Source reason (why we have an order)
452 print '<tr><td height="10">';
453 print '<table class="nobordernopadding" width="100%"><tr><td>';
454 print $langs->trans('Source');
455 print '</td>';
456 if ($action != 'editdemandreason') {
457 print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdemandreason&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetDemandReason'), 1).'</a></td>';
458 }
459 print '</tr></table>';
460 print '</td><td colspan="2">';
461 if ($action == 'editdemandreason') {
462 $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->demand_reason_id, 'demand_reason_id', 1);
463 } else {
464 $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->demand_reason_id, 'none');
465 }
466
467 // Terms of payment
468 /*
469 print '<tr><td height="10">';
470 print '<table class="nobordernopadding" width="100%"><tr><td>';
471 print $langs->trans('PaymentConditionsShort');
472 print '</td>';
473
474 if ($action != 'editconditions' && $object->status == Expedition::STATUS_VALIDATED) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editconditions&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
475 print '</tr></table>';
476 print '</td><td colspan="2">';
477 if ($action == 'editconditions')
478 {
479 $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id');
480 }
481 else
482 {
483 $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none');
484 }
485 print '</td></tr>';
486
487 // Mode of payment
488 print '<tr><td>';
489 print '<table class="nobordernopadding" width="100%"><tr><td>';
490 print $langs->trans('PaymentMode');
491 print '</td>';
492 if ($action != 'editmode' && $object->status == Expedition::STATUS_VALIDATED) print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editmode&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
493 print '</tr></table>';
494 print '</td><td colspan="2">';
495 if ($action == 'editmode')
496 {
497 $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id');
498 }
499 else
500 {
501 $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none');
502 }
503 print '</td></tr>';*/
504
505 $tmparray = $object->getTotalWeightVolume();
506 $totalWeight = $tmparray['weight'];
507 $totalVolume = $tmparray['volume'];
508 if ($totalWeight || $totalVolume) {
509 print '<tr><td>'.$langs->trans("CalculatedWeight").'</td>';
510 print '<td colspan="2">';
511 print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, getDolGlobalInt('MAIN_WEIGHT_DEFAULT_ROUND', -1), getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT', 'no'));
512 print '</td></tr>';
513 print '<tr><td>'.$langs->trans("CalculatedVolume").'</td>';
514 print '<td colspan="2">';
515 print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, getDolGlobalInt('MAIN_VOLUME_DEFAULT_ROUND', -1), getDolGlobalString('MAIN_VOLUME_DEFAULT_UNIT', 'no'));
516 print '</td></tr>';
517 }
518
519 // TODO How record was recorded OrderMode (llx_c_input_method)
520
521 // Incoterms
522 if (isModEnabled('incoterm')) {
523 print '<tr><td>';
524 print '<table width="100%" class="nobordernopadding"><tr><td>';
525 print $langs->trans('IncotermLabel');
526 print '<td><td class="right">';
527 if ($permissiontoadd) {
528 print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'/expedition/shipment.php?id='.$object->id.'&action=editincoterm&token='.newToken().'">'.img_edit().'</a>';
529 } else {
530 print '&nbsp;';
531 }
532 print '</td></tr></table>';
533 print '</td>';
534 print '<td colspan="2">';
535 if ($action != 'editincoterm') {
536 print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
537 } else {
538 print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id);
539 }
540 print '</td></tr>';
541 }
542
543 $expe = new Expedition($db);
544 $extrafields->fetch_name_optionals_label($expe->table_element);
545
546 // Other attributes
547 $cols = 2;
548 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
549
550 print '</table>';
551
552 print '</div>';
553 print '<div class="fichehalfright">';
554 print '<div class="underbanner clearboth"></div>';
555
556 print '<table class="border centpercent tableforfield">';
557
558 if (isModEnabled("multicurrency") && ($object->multicurrency_code != $conf->currency)) {
559 // Multicurrency Amount HT
560 print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
561 print '<td class="nowrap">'.price($object->multicurrency_total_ht, 0, $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
562 print '</tr>';
563
564 // Multicurrency Amount VAT
565 print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>';
566 print '<td class="nowrap">'.price($object->multicurrency_total_tva, 0, $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
567 print '</tr>';
568
569 // Multicurrency Amount TTC
570 print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>';
571 print '<td class="nowrap">'.price($object->multicurrency_total_ttc, 0, $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
572 print '</tr>';
573 }
574
575 // Total HT
576 print '<tr><td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>';
577 print '<td>'.price($object->total_ht, 0, '', 1, -1, -1, $conf->currency).'</td>';
578 print '</tr>';
579
580 // Total VAT
581 print '<tr><td>'.$langs->trans('AmountVAT').'</td><td>'.price($object->total_tva, 0, '', 1, -1, -1, $conf->currency).'</td>';
582 print '</tr>';
583
584 // Amount Local Taxes
585 if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1
586 print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
587 print '<td>'.price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
588 }
589 if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF
590 print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
591 print '<td>'.price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
592 }
593
594 // Total TTC
595 print '<tr><td>'.$langs->trans('AmountTTC').'</td><td>'.price($object->total_ttc, 0, '', 1, -1, -1, $conf->currency).'</td>';
596 print '</tr>';
597
598 print '</table>';
599
600 print '</div>';
601 print '</div>';
602
603 print '<div class="clearboth"></div><br>';
604
605
610 print '<div class="div-table-responsive-no-min">';
611 print '<table id="tablelines" class="noborder noshadow centpercent">';
612
613 $sql = "SELECT cd.rowid, cd.fk_product, cd.product_type as type, cd.label, cd.description,";
614 $sql .= " cd.price, cd.tva_tx, cd.subprice,";
615 $sql .= " cd.qty, cd.fk_unit, cd.rang,";
616 $sql .= ' cd.date_start,';
617 $sql .= ' cd.date_end,';
618 $sql .= ' cd.special_code, cd.extraparams,';
619 $sql .= ' p.rowid as prodid, p.label as product_label, p.entity, p.ref, p.fk_product_type as product_type, p.description as product_desc,';
620 $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units,';
621 $sql .= ' p.surface, p.surface_units, p.volume, p.volume_units';
622 $sql .= ', p.tobatch, p.tosell, p.tobuy, p.barcode';
623 $sql .= ', u.short_label as unit_order';
624 $sql .= ', p.stockable_product';
625 $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
626 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
627 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_units as u ON cd.fk_unit = u.rowid";
628 $sql .= " WHERE cd.fk_commande = ".((int) $object->id);
629 $sql .= " ORDER BY cd.rang, cd.rowid";
630
631 $toBeShipped = array();
632 $toBeShippedTotal = 0;
633
634 //print $sql;
635 dol_syslog("shipment.php", LOG_DEBUG);
636 $resql = $db->query($sql);
637 if ($resql) {
638 $num = $db->num_rows($resql);
639 $i = 0;
640 print '<thead>';
641 print '<tr class="liste_titre">';
642 if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
643 print '<th>'.$langs->trans("Rank").'</th>';
644 }
645 print '<th>'.$langs->trans("Description").'</th>';
646 print '<th class="center">'.$langs->trans("QtyOrdered").'</th>';
647 print '<th class="center">'.$langs->trans("QtyShipped").'</th>';
648 print '<th class="center">'.$langs->trans("KeepToShip").'</th>';
649 if (isModEnabled('stock')) {
650 print '<th class="center">'.$langs->trans("RealStock").'</th>';
651 } else {
652 print '<th>&nbsp;</th>';
653 }
654 print "</tr>\n";
655 print '</thead>';
656
657 while ($i < $num) {
658 $objp = $db->fetch_object($resql);
659
660 $parameters = array('i' => $i, 'line' => $objp, 'num' => $num);
661 $reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action);
662 if ($reshook < 0) {
663 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
664 }
665
666 if (empty($reshook) && $objp->special_code != SUBTOTALS_SPECIAL_CODE) {
667 // Show product and description
668 $type = isset($objp->type) ? $objp->type : $objp->product_type;
669
670 // Try to enhance type detection using date_start and date_end for free lines where type was not saved.
671 if (!empty($objp->date_start)) {
672 $type = 1;
673 }
674 if (!empty($objp->date_end)) {
675 $type = 1;
676 }
677
678 print '<tr class="oddeven">';
679
680 // Rank
681 if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
682 print '<td class="center">'.$objp->rang.'</td>';
683 }
684
685 // Product label
686 if ($objp->fk_product > 0) {
687 // Define output language
688 if (getDolGlobalInt('MAIN_MULTILANGS') && getDolGlobalString('PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE')) {
689 $object->fetch_thirdparty();
690
691 $prod = new Product($db);
692 $prod->id = $objp->fk_product;
693 $prod->entity = $objp->entity;
694 $prod->getMultiLangs();
695
696 $outputlangs = $langs;
697 $newlang = '';
698 if (empty($newlang) && GETPOST('lang_id', 'aZ09')) {
699 $newlang = GETPOST('lang_id', 'aZ09');
700 }
701 if (empty($newlang)) {
702 $newlang = $object->thirdparty->default_lang;
703 }
704 if (!empty($newlang)) {
705 $outputlangs = new Translate("", $conf);
706 $outputlangs->setDefaultLang($newlang);
707 }
708
709 $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label;
710 } else {
711 $label = (!empty($objp->label) ? $objp->label : $objp->product_label);
712 }
713
714 print '<td>';
715 print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
716
717 // Show product and description
718 $product_static->type = $type;
719 $product_static->id = $objp->fk_product;
720 $product_static->ref = $objp->ref;
721 $product_static->entity = $objp->entity;
722 $product_static->status = $objp->tosell;
723 $product_static->status_buy = $objp->tobuy;
724 $product_static->status_batch = $objp->tobatch;
725 $product_static->barcode = $objp->barcode;
726
727 $product_static->weight = $objp->weight;
728 $product_static->weight_units = $objp->weight_units;
729 $product_static->length = $objp->length;
730 $product_static->length_units = $objp->length_units;
731 $product_static->width = $objp->width;
732 $product_static->width_units = $objp->width_units;
733 $product_static->height = $objp->height;
734 $product_static->height_units = $objp->height_units;
735 $product_static->surface = $objp->surface;
736 $product_static->surface_units = $objp->surface_units;
737 $product_static->volume = $objp->volume;
738 $product_static->volume_units = $objp->volume_units;
739
740 $text = $product_static->getNomUrl(1);
741 $text .= ' - '.$label;
742
743 $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description));
744 $photos = $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity ?? $conf->entity], 1, 1, 0, 0, 0, 80);
745 if (strpos($photos, '<img') !== false) {
746 $description .= ($description ? '<br>' : '').$photos;
747 }
748 print $form->textwithtooltip($text, $description, 3, 0, '', (string) $i);
749
750 // Show range
751 print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end));
752
753 // Add description in form
754 if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
755 print ($objp->description && $objp->description != $objp->product_label) ? '<br>'.dol_htmlentitiesbr($objp->description) : '';
756 }
757
758 print '</td>';
759 } else {
760 print "<td>";
761 if ($type == 1) {
762 $text = img_object($langs->trans('Service'), 'service');
763 } else {
764 $text = img_object($langs->trans('Product'), 'product');
765 }
766
767 if (!empty($objp->label)) {
768 $text .= ' <strong>'.$objp->label.'</strong>';
769 print $form->textwithtooltip($text, $objp->description, 3, 0, '', (string) $i);
770 } else {
771 print $text.' '.nl2br($objp->description);
772 }
773
774 // Show range
775 print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end));
776 print "</td>\n";
777 }
778
779 // Qty ordered
780 print '<td class="center">'.$objp->qty.($objp->unit_order ? ' '.$objp->unit_order : '').'</td>';
781
782 // Qty already shipped
783 $qtyProdCom = $objp->qty;
784 print '<td class="center">';
785 // Nb of sending products for this line of order
786 $qtyAlreadyShipped = (!empty($object->expeditions[$objp->rowid]) ? $object->expeditions[$objp->rowid] : 0);
787 print $qtyAlreadyShipped;
788 print($objp->unit_order ? ' '.$objp->unit_order : '').'</td>';
789
790 // Qty remains to ship
791 print '<td class="center">';
792 if ($type == 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES') || getDolGlobalString('SHIPMENT_SUPPORTS_SERVICES')) {
793 $toBeShipped[$objp->fk_product] = $objp->qty - $qtyAlreadyShipped;
794 $toBeShippedTotal += $toBeShipped[$objp->fk_product];
795 print $toBeShipped[$objp->fk_product];
796 } else {
797 print '0 <span class="opacitymedium">('.$langs->trans("Service").')</span>';
798 }
799 print($objp->unit_order ? ' '.$objp->unit_order : '').'</td>';
800
801 if ($objp->fk_product > 0) {
802 $product = new Product($db);
803 $product->fetch($objp->fk_product);
804 $product->load_stock('warehouseopen');
805 }
806
807 if ($objp->fk_product > 0 && ($type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) && isModEnabled('stock')) {
808 print '<td class="center">';
809 if ($objp->stockable_product == Product::ENABLED_STOCK) {
810 print $product->stock_reel;
811 if ($product->stock_reel < $toBeShipped[$objp->fk_product]) {
812 print ' ' . img_warning($langs->trans("StockTooLow"));
813 if (getDolGlobalString('STOCK_CORRECT_STOCK_IN_SHIPMENT')) {
814 $nbPiece = $toBeShipped[$objp->fk_product] - $product->stock_reel;
815 print ' &nbsp; ' . $langs->trans("GoTo") . ' <a href="' . DOL_URL_ROOT . '/product/stock/product.php?id=' . ((int) $product->id) . '&action=correction&token=' . newToken() . '&nbpiece=' . urlencode((string) ($nbPiece)) . '&backtopage=' . urlencode((string) ($_SERVER["PHP_SELF"] . '?id=' . ((int) $object->id))) . '">' . $langs->trans("CorrectStock") . '</a>';
816 }
817 }
818 } else {
819 print img_warning().' '.$langs->trans('StockDisabled');
820 }
821 print '</td>';
822 } elseif ($objp->fk_product > 0 && $type == Product::TYPE_SERVICE && getDolGlobalString('SHIPMENT_SUPPORTS_SERVICES') && isModEnabled('stock')) {
823 print '<td class="center"><span class="opacitymedium">('.$langs->trans("Service").')</span></td>';
824 } else {
825 print '<td>&nbsp;</td>';
826 }
827 print "</tr>\n";
828
829 // Show subproducts lines
830 if ($objp->fk_product > 0 && getDolGlobalString('PRODUIT_SOUSPRODUITS')) {
831 // Set tree of subproducts in product->sousprods
832 $product->get_sousproduits_arbo();
833 //var_dump($product->sousprods);exit;
834
835 // Define a new tree with quantiies recalculated
836 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
837 //var_dump($prods_arbo);
838 if (count($prods_arbo) > 0) {
839 foreach ($prods_arbo as $key => $value) {
840 $img = '';
841 if ($value['stock'] < $value['stock_alert']) {
842 $img = img_warning($langs->trans("StockTooLow"));
843 }
844 print '<tr class="oddeven"><td>&nbsp; &nbsp; &nbsp; -> <a href="'.DOL_URL_ROOT."/product/card.php?id=".$value['id'].'">'.$value['fullpath'].'</a> ('.$value['nb'].')</td>';
845 print '<td class="center"> '.$value['nb_total'].'</td>';
846 print '<td>&nbsp;</td>';
847 print '<td>&nbsp;</td>';
848 print '<td class="center">'.$value['stock'].' '.$img.'</td></tr>'."\n";
849 }
850 }
851 }
852 } elseif (empty($reshook) && $objp->special_code == SUBTOTALS_SPECIAL_CODE) {
853 $line = $objp;
854 require dol_buildpath('/core/tpl/subtotal_expedition_view.tpl.php');
855 }
856 $i++;
857 }
858 $db->free($resql);
859
860 if (!$num) {
861 print '<tr><td colspan="5"><span class="opacitymedium">'.$langs->trans("NoArticleOfTypeProduct").'</span></td></tr>';
862 }
863 } else {
864 dol_print_error($db);
865 }
866
867 print "</table>";
868 print '</div>';
869
870
871 /*
872 * Boutons Actions
873 */
874
875 if (empty($user->socid)) {
876 print '<div class="tabsAction">';
877
878 // Bouton expedier sans gestion des stocks
879 if (!isModEnabled('stock') && ($object->status > Commande::STATUS_DRAFT && $object->status < Commande::STATUS_CLOSED)) {
880 if ($user->hasRight('expedition', 'creer')) {
881 print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/card.php?action=create&amp;origin=commande&amp;object_id='.$order_id.'">'.$langs->trans("CreateShipment").'</a>';
882 if ($toBeShippedTotal <= 0) {
883 print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend"));
884 }
885 } else {
886 print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateShipment").'</a>';
887 }
888 }
889 print "</div>";
890 }
891
892
893 // Button to create a shipment
894
895 if (isModEnabled('stock') && $object->status == Commande::STATUS_DRAFT) {
896 print $langs->trans("ValidateOrderFirstBeforeShipment");
897 }
898
899 if (isModEnabled('stock') && ($object->status > Commande::STATUS_DRAFT && $object->status < Commande::STATUS_CLOSED)) {
900 if ($user->hasRight('expedition', 'creer')) {
901 //print load_fiche_titre($langs->trans("CreateShipment"));
902 print '<div class="tabsAction">';
903
904 print '<form method="GET" action="'.DOL_URL_ROOT.'/expedition/card.php">';
905 print '<input type="hidden" name="action" value="create">';
906 //print '<input type="hidden" name="id" value="'.$object->id.'">';
907 print '<input type="hidden" name="shipping_method_id" value="'.$object->shipping_method_id.'">';
908 print '<input type="hidden" name="origin" value="commande">';
909 print '<input type="hidden" name="origin_id" value="'.$object->id.'">';
910 print '<input type="hidden" name="projectid" value="'.$object->fk_project.'">';
911
912 $langs->load("stocks");
913
914 print '<div class="center formconsumeproduce">';
915
916 if (isModEnabled('stock')) {
917 print $langs->trans("WarehouseSource");
918 print $formproduct->selectWarehouses(empty($object->warehouse_id) ? 'ifone' : $object->warehouse_id, 'entrepot_id', '', 1, 0, 0, $langs->trans("Any"), 0, 0, array(), 'minwidth200');
919 if (count($formproduct->cache_warehouses) <= 0) {
920 print ' &nbsp; '.$langs->trans("WarehouseSourceNotDefined").' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create">'.$langs->trans("AddOne").'</a>';
921 }
922 }
923 print '<input type="submit" class="butAction marginbottomonly margintoponly" name="save" value="'.$langs->trans("CreateShipment").'">';
924 if ($toBeShippedTotal <= 0) {
925 print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend"));
926 }
927
928 print '</div>';
929 print "</form>\n";
930
931 print '</div>';
932 } else {
933 print '<div class="tabsAction">';
934 print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("CreateShipment").'</a>';
935 print '</div>';
936 }
937 }
938
939 show_list_sending_receive('commande', $object->id);
940 } else {
941 /* Order not found */
942 setEventMessages($langs->trans("NonExistentOrder"), null, 'errors');
943 }
944}
945
946// End of page
947llxFooter();
948$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
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 customers orders.
const STATUS_CLOSED
Closed (Sent, billed or not)
const STATUS_DRAFT
Draft status.
Class to manage standard extra fields.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Class with static methods for building HTML components related to products Only components common to ...
Class to manage building of HTML components.
Class to manage products or services.
const TYPE_PRODUCT
Regular product.
const TYPE_SERVICE
Service.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage translations.
Class to manage Dolibarr users.
global $mysoc
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.
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)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_eval($s, $returnvalue=1, $hideerrors=1, $onlysimplestring='1')
Replace eval function to add more security.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput='no', $use_short_label=0)
Output a dimension with best unit.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
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...
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.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
commande_prepare_head(Commande $object)
Prepare array with list of tabs.
Definition order.lib.php:36
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.