dolibarr 22.0.5
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', 'deliveries', '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$extrafields = new ExtraFields($db);
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) { // 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="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> ';
308 }
309 $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');
310 } else {
311 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
312 $proj = new Project($db);
313 $proj->fetch($objectsrc->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
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 require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
431 $formproduct = new FormProduct($db);
432 print '<tr><td>';
433 print '<table width="100%" class="nobordernopadding"><tr><td>';
434 print $langs->trans('Warehouse');
435 print '</td>';
436 if ($action != 'editwarehouse' && $permissiontoadd) {
437 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>';
438 }
439 print '</tr></table>';
440 print '</td><td colspan="2">';
441 if ($action == 'editwarehouse') {
442 $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1);
443 } else {
444 $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none');
445 }
446 print '</td>';
447 print '</tr>';
448 }
449
450 // Source reason (why we have an order)
451 print '<tr><td height="10">';
452 print '<table class="nobordernopadding" width="100%"><tr><td>';
453 print $langs->trans('Source');
454 print '</td>';
455 if ($action != 'editdemandreason') {
456 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>';
457 }
458 print '</tr></table>';
459 print '</td><td colspan="2">';
460 if ($action == 'editdemandreason') {
461 $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->demand_reason_id, 'demand_reason_id', 1);
462 } else {
463 $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, (string) $object->demand_reason_id, 'none');
464 }
465
466 // Terms of payment
467 /*
468 print '<tr><td height="10">';
469 print '<table class="nobordernopadding" width="100%"><tr><td>';
470 print $langs->trans('PaymentConditionsShort');
471 print '</td>';
472
473 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>';
474 print '</tr></table>';
475 print '</td><td colspan="2">';
476 if ($action == 'editconditions')
477 {
478 $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id');
479 }
480 else
481 {
482 $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none');
483 }
484 print '</td></tr>';
485
486 // Mode of payment
487 print '<tr><td>';
488 print '<table class="nobordernopadding" width="100%"><tr><td>';
489 print $langs->trans('PaymentMode');
490 print '</td>';
491 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>';
492 print '</tr></table>';
493 print '</td><td colspan="2">';
494 if ($action == 'editmode')
495 {
496 $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id');
497 }
498 else
499 {
500 $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none');
501 }
502 print '</td></tr>';*/
503
504 $tmparray = $object->getTotalWeightVolume();
505 $totalWeight = $tmparray['weight'];
506 $totalVolume = $tmparray['volume'];
507 if ($totalWeight || $totalVolume) {
508 print '<tr><td>'.$langs->trans("CalculatedWeight").'</td>';
509 print '<td colspan="2">';
510 print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, getDolGlobalInt('MAIN_WEIGHT_DEFAULT_ROUND', -1), getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT', 'no'));
511 print '</td></tr>';
512 print '<tr><td>'.$langs->trans("CalculatedVolume").'</td>';
513 print '<td colspan="2">';
514 print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, getDolGlobalInt('MAIN_VOLUME_DEFAULT_ROUND', -1), getDolGlobalString('MAIN_VOLUME_DEFAULT_UNIT', 'no'));
515 print '</td></tr>';
516 }
517
518 // TODO How record was recorded OrderMode (llx_c_input_method)
519
520 // Incoterms
521 if (isModEnabled('incoterm')) {
522 print '<tr><td>';
523 print '<table width="100%" class="nobordernopadding"><tr><td>';
524 print $langs->trans('IncotermLabel');
525 print '<td><td class="right">';
526 if ($permissiontoadd) {
527 print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'/expedition/shipment.php?id='.$object->id.'&action=editincoterm&token='.newToken().'">'.img_edit().'</a>';
528 } else {
529 print '&nbsp;';
530 }
531 print '</td></tr></table>';
532 print '</td>';
533 print '<td colspan="2">';
534 if ($action != 'editincoterm') {
535 print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
536 } else {
537 print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id);
538 }
539 print '</td></tr>';
540 }
541
542 $expe = new Expedition($db);
543 $extrafields->fetch_name_optionals_label($expe->table_element);
544
545 // Other attributes
546 $cols = 2;
547 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
548
549 print '</table>';
550
551 print '</div>';
552 print '<div class="fichehalfright">';
553 print '<div class="underbanner clearboth"></div>';
554
555 print '<table class="border centpercent tableforfield">';
556
557 if (isModEnabled("multicurrency") && ($object->multicurrency_code != $conf->currency)) {
558 // Multicurrency Amount HT
559 print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
560 print '<td class="nowrap">'.price($object->multicurrency_total_ht, 0, $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
561 print '</tr>';
562
563 // Multicurrency Amount VAT
564 print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>';
565 print '<td class="nowrap">'.price($object->multicurrency_total_tva, 0, $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
566 print '</tr>';
567
568 // Multicurrency Amount TTC
569 print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>';
570 print '<td class="nowrap">'.price($object->multicurrency_total_ttc, 0, $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
571 print '</tr>';
572 }
573
574 // Total HT
575 print '<tr><td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>';
576 print '<td>'.price($object->total_ht, 0, '', 1, -1, -1, $conf->currency).'</td>';
577 print '</tr>';
578
579 // Total VAT
580 print '<tr><td>'.$langs->trans('AmountVAT').'</td><td>'.price($object->total_tva, 0, '', 1, -1, -1, $conf->currency).'</td>';
581 print '</tr>';
582
583 // Amount Local Taxes
584 if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1
585 print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
586 print '<td>'.price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
587 }
588 if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF
589 print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
590 print '<td>'.price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
591 }
592
593 // Total TTC
594 print '<tr><td>'.$langs->trans('AmountTTC').'</td><td>'.price($object->total_ttc, 0, '', 1, -1, -1, $conf->currency).'</td>';
595 print '</tr>';
596
597 print '</table>';
598
599 print '</div>';
600 print '</div>';
601
602 print '<div class="clearboth"></div><br>';
603
604
609 print '<div class="div-table-responsive-no-min">';
610 print '<table id="tablelines" class="noborder noshadow centpercent">';
611
612 $sql = "SELECT cd.rowid, cd.fk_product, cd.product_type as type, cd.label, cd.description,";
613 $sql .= " cd.price, cd.tva_tx, cd.subprice,";
614 $sql .= " cd.qty, cd.fk_unit, cd.rang,";
615 $sql .= ' cd.date_start,';
616 $sql .= ' cd.date_end,';
617 $sql .= ' cd.special_code, cd.extraparams,';
618 $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,';
619 $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units,';
620 $sql .= ' p.surface, p.surface_units, p.volume, p.volume_units';
621 $sql .= ', p.tobatch, p.tosell, p.tobuy, p.barcode';
622 $sql .= ', u.short_label as unit_order';
623 $sql .= ', p.stockable_product';
624 $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as cd";
625 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
626 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_units as u ON cd.fk_unit = u.rowid";
627 $sql .= " WHERE cd.fk_commande = ".((int) $object->id);
628 $sql .= " ORDER BY cd.rang, cd.rowid";
629
630 $toBeShipped = array();
631 $toBeShippedTotal = 0;
632
633 //print $sql;
634 dol_syslog("shipment.php", LOG_DEBUG);
635 $resql = $db->query($sql);
636 if ($resql) {
637 $num = $db->num_rows($resql);
638 $i = 0;
639 print '<thead>';
640 print '<tr class="liste_titre">';
641 if (getDolGlobalString('MAIN_VIEW_LINE_NUMBER')) {
642 print '<th>'.$langs->trans("Rank").'</th>';
643 }
644 print '<th>'.$langs->trans("Description").'</th>';
645 print '<th class="center">'.$langs->trans("QtyOrdered").'</th>';
646 print '<th class="center">'.$langs->trans("QtyShipped").'</th>';
647 print '<th class="center">'.$langs->trans("KeepToShip").'</th>';
648 if (isModEnabled('stock')) {
649 print '<th class="center">'.$langs->trans("RealStock").'</th>';
650 } else {
651 print '<th>&nbsp;</th>';
652 }
653 print "</tr>\n";
654 print '</thead>';
655
656 while ($i < $num) {
657 $objp = $db->fetch_object($resql);
658
659 $parameters = array('i' => $i, 'line' => $objp, 'num' => $num);
660 $reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action);
661 if ($reshook < 0) {
662 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
663 }
664
665 if (empty($reshook) && $objp->special_code != SUBTOTALS_SPECIAL_CODE) {
666 // Show product and description
667 $type = isset($objp->type) ? $objp->type : $objp->product_type;
668
669 // Try to enhance type detection using date_start and date_end for free lines where type
670 // 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 $description = (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE') ? '' : dol_htmlentitiesbr($objp->description)).'<br>';
743 $description .= $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80);
744 print $form->textwithtooltip($text, $description, 3, 0, '', (string) $i);
745
746 // Show range
747 print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end));
748
749 // Add description in form
750 if (getDolGlobalInt('PRODUIT_DESC_IN_FORM_ACCORDING_TO_DEVICE')) {
751 print ($objp->description && $objp->description != $objp->product_label) ? '<br>'.dol_htmlentitiesbr($objp->description) : '';
752 }
753
754 print '</td>';
755 } else {
756 print "<td>";
757 if ($type == 1) {
758 $text = img_object($langs->trans('Service'), 'service');
759 } else {
760 $text = img_object($langs->trans('Product'), 'product');
761 }
762
763 if (!empty($objp->label)) {
764 $text .= ' <strong>'.$objp->label.'</strong>';
765 print $form->textwithtooltip($text, $objp->description, 3, 0, '', (string) $i);
766 } else {
767 print $text.' '.nl2br($objp->description);
768 }
769
770 // Show range
771 print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end));
772 print "</td>\n";
773 }
774
775 // Qty ordered
776 print '<td class="center">'.$objp->qty.($objp->unit_order ? ' '.$objp->unit_order : '').'</td>';
777
778 // Qty already shipped
779 $qtyProdCom = $objp->qty;
780 print '<td class="center">';
781 // Nb of sending products for this line of order
782 $qtyAlreadyShipped = (!empty($object->expeditions[$objp->rowid]) ? $object->expeditions[$objp->rowid] : 0);
783 print $qtyAlreadyShipped;
784 print($objp->unit_order ? ' '.$objp->unit_order : '').'</td>';
785
786 // Qty remains to ship
787 print '<td class="center">';
788 if ($type == 0 || getDolGlobalString('STOCK_SUPPORTS_SERVICES') || getDolGlobalString('SHIPMENT_SUPPORTS_SERVICES')) {
789 $toBeShipped[$objp->fk_product] = $objp->qty - $qtyAlreadyShipped;
790 $toBeShippedTotal += $toBeShipped[$objp->fk_product];
791 print $toBeShipped[$objp->fk_product];
792 } else {
793 print '0 <span class="opacitymedium">('.$langs->trans("Service").')</span>';
794 }
795 print($objp->unit_order ? ' '.$objp->unit_order : '').'</td>';
796
797 if ($objp->fk_product > 0) {
798 $product = new Product($db);
799 $product->fetch($objp->fk_product);
800 $product->load_stock('warehouseopen');
801 }
802
803 if ($objp->fk_product > 0 && ($type == Product::TYPE_PRODUCT || getDolGlobalString('STOCK_SUPPORTS_SERVICES')) && isModEnabled('stock')) {
804 print '<td class="center">';
805 if ($objp->stockable_product == Product::ENABLED_STOCK) {
806 print $product->stock_reel;
807 if ($product->stock_reel < $toBeShipped[$objp->fk_product]) {
808 print ' ' . img_warning($langs->trans("StockTooLow"));
809 if (getDolGlobalString('STOCK_CORRECT_STOCK_IN_SHIPMENT')) {
810 $nbPiece = $toBeShipped[$objp->fk_product] - $product->stock_reel;
811 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>';
812 }
813 }
814 } else {
815 print img_warning().' '.$langs->trans('StockDisabled');
816 }
817 print '</td>';
818 } elseif ($objp->fk_product > 0 && $type == Product::TYPE_SERVICE && getDolGlobalString('SHIPMENT_SUPPORTS_SERVICES') && isModEnabled('stock')) {
819 print '<td class="center"><span class="opacitymedium">('.$langs->trans("Service").')</span></td>';
820 } else {
821 print '<td>&nbsp;</td>';
822 }
823 print "</tr>\n";
824
825 // Show subproducts lines
826 if ($objp->fk_product > 0 && getDolGlobalString('PRODUIT_SOUSPRODUITS')) {
827 // Set tree of subproducts in product->sousprods
828 $product->get_sousproduits_arbo();
829 //var_dump($product->sousprods);exit;
830
831 // Define a new tree with quantiies recalculated
832 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
833 //var_dump($prods_arbo);
834 if (count($prods_arbo) > 0) {
835 foreach ($prods_arbo as $key => $value) {
836 $img = '';
837 if ($value['stock'] < $value['stock_alert']) {
838 $img = img_warning($langs->trans("StockTooLow"));
839 }
840 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>';
841 print '<td class="center"> '.$value['nb_total'].'</td>';
842 print '<td>&nbsp;</td>';
843 print '<td>&nbsp;</td>';
844 print '<td class="center">'.$value['stock'].' '.$img.'</td></tr>'."\n";
845 }
846 }
847 }
848 } elseif (empty($reshook) && $objp->special_code == SUBTOTALS_SPECIAL_CODE) {
849 $line = $objp;
850 require dol_buildpath('/core/tpl/subtotal_expedition_view.tpl.php');
851 }
852 $i++;
853 }
854 $db->free($resql);
855
856 if (!$num) {
857 print '<tr><td colspan="5"><span class="opacitymedium">'.$langs->trans("NoArticleOfTypeProduct").'</span></td></tr>';
858 }
859 } else {
860 dol_print_error($db);
861 }
862
863 print "</table>";
864 print '</div>';
865
866
867 /*
868 * Boutons Actions
869 */
870
871 if (empty($user->socid)) {
872 print '<div class="tabsAction">';
873
874 // Bouton expedier sans gestion des stocks
875 if (!isModEnabled('stock') && ($object->status > Commande::STATUS_DRAFT && $object->status < Commande::STATUS_CLOSED)) {
876 if ($user->hasRight('expedition', 'creer')) {
877 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>';
878 if ($toBeShippedTotal <= 0) {
879 print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend"));
880 }
881 } else {
882 print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateShipment").'</a>';
883 }
884 }
885 print "</div>";
886 }
887
888
889 // Button to create a shipment
890
891 if (isModEnabled('stock') && $object->status == Commande::STATUS_DRAFT) {
892 print $langs->trans("ValidateOrderFirstBeforeShipment");
893 }
894
895 if (isModEnabled('stock') && ($object->status > Commande::STATUS_DRAFT && $object->status < Commande::STATUS_CLOSED)) {
896 if ($user->hasRight('expedition', 'creer')) {
897 //print load_fiche_titre($langs->trans("CreateShipment"));
898 print '<div class="tabsAction">';
899
900 print '<form method="GET" action="'.DOL_URL_ROOT.'/expedition/card.php">';
901 print '<input type="hidden" name="action" value="create">';
902 //print '<input type="hidden" name="id" value="'.$object->id.'">';
903 print '<input type="hidden" name="shipping_method_id" value="'.$object->shipping_method_id.'">';
904 print '<input type="hidden" name="origin" value="commande">';
905 print '<input type="hidden" name="origin_id" value="'.$object->id.'">';
906 print '<input type="hidden" name="projectid" value="'.$object->fk_project.'">';
907
908 $langs->load("stocks");
909
910 print '<div class="center formconsumeproduce">';
911
912 if (isModEnabled('stock')) {
913 print $langs->trans("WarehouseSource");
914 print $formproduct->selectWarehouses(empty($object->warehouse_id) ? 'ifone' : $object->warehouse_id, 'entrepot_id', '', 1, 0, 0, $langs->trans("Any"), 0, 0, array(), 'minwidth200');
915 if (count($formproduct->cache_warehouses) <= 0) {
916 print ' &nbsp; '.$langs->trans("WarehouseSourceNotDefined").' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create">'.$langs->trans("AddOne").'</a>';
917 }
918 }
919 print '<input type="submit" class="butAction marginbottomonly margintoponly" name="save" value="'.$langs->trans("CreateShipment").'">';
920 if ($toBeShippedTotal <= 0) {
921 print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend"));
922 }
923 print '<br><br>';
924 print '</div>';
925 print "</form>\n";
926
927 print '</div>';
928 } else {
929 print '<div class="tabsAction">';
930 print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">'.$langs->trans("CreateShipment").'</a>';
931 print '</div>';
932 }
933 }
934
935 show_list_sending_receive('commande', $object->id);
936 } else {
937 /* Order not found */
938 setEventMessages($langs->trans("NonExistentOrder"), null, 'errors');
939 }
940}
941
942// End of page
943llxFooter();
944$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:67
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.
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.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
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.
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
commande_prepare_head(Commande $object)
Prepare array with list of tabs.
Definition order.lib.php:35
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.