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