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