dolibarr  16.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-2021 Frédéric France <frederic.france@netlogic.fr>
7  * Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <https://www.gnu.org/licenses/>.
21  */
22 
29 require '../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
31 require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';
32 require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
33 require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php';
34 require_once DOL_DOCUMENT_ROOT.'/core/lib/sendings.lib.php';
35 require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
36 if (!empty($conf->project->enabled)) {
37  require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
38  require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
39 }
40 if (!empty($conf->stock->enabled)) {
41  require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
42 }
43 if (!empty($conf->propal->enabled)) {
44  require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
45 }
46 if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
47  require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
48 }
49 
50 // Load translation files required by the page
51 $langs->loadLangs(array('orders', 'sendings', 'companies', 'bills', 'propal', 'deliveries', 'stocks', 'productbatch', 'incoterm', 'other'));
52 
53 $id = GETPOST('id', 'int'); // id of order
54 $ref = GETPOST('ref', 'alpha');
55 $action = GETPOST('action', 'aZ09');
56 
57 $hookmanager->initHooks(array('ordershipmentcard'));
58 
59 
60 // Security check
61 $socid = 0;
62 if (!empty($user->socid)) {
63  $socid = $user->socid;
64 }
65 $result = restrictedArea($user, 'commande', $id);
66 
67 $object = new Commande($db);
68 $shipment = new Expedition($db);
69 $extrafields = new ExtraFields($db);
70 
71 // fetch optionals attributes and labels
72 $extrafields->fetch_name_optionals_label($object->table_element);
73 
74 // Load object
75 include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
76 
77 // Security check
78 if ($user->socid) {
79  $socid = $user->socid;
80 }
81 
82 $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
83 
84 
85 
86 /*
87  * Actions
88  */
89 
90 $parameters = array('socid' => $socid);
91 $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
92 if ($reshook < 0) {
93  setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
94 }
95 
96 if (empty($reshook)) {
97  // Categorisation dans projet
98  if ($action == 'classin') {
99  $object->fetch($id);
100  $object->setProject(GETPOST('projectid', 'int'));
101  }
102 
103  if ($action == 'confirm_cloture' && GETPOST('confirm', 'alpha') == 'yes') {
104  $object->fetch($id);
105  $result = $object->cloture($user);
106  } elseif ($action == 'setref_client' && $user->rights->commande->creer) {
107  // Positionne ref commande client
108  $result = $object->set_ref_client($user, GETPOST('ref_client'));
109  if ($result < 0) {
110  setEventMessages($object->error, $object->errors, 'errors');
111  }
112  }
113 
114  if ($action == 'setdatedelivery' && $user->rights->commande->creer) {
115  $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int'));
116 
117  $object->fetch($id);
118  $result = $object->setDeliveryDate($user, $datedelivery);
119  if ($result < 0) {
120  setEventMessages($object->error, $object->errors, 'errors');
121  }
122  }
123  /*
124  if ($action == 'setdeliveryaddress' && $user->rights->commande->creer)
125  {
126  $object = new Commande($db);
127  $object->fetch($id);
128  $object->setDeliveryAddress(GETPOST('delivery_address_id','int'));
129  if ($result < 0)
130  setEventMessages($object->error, $object->errors, 'errors');
131  }
132  */
133  if ($action == 'setmode' && $user->rights->commande->creer) {
134  $object->fetch($id);
135  $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
136  if ($result < 0) {
137  setEventMessages($object->error, $object->errors, 'errors');
138  }
139  }
140 
141  if ($action == 'setavailability' && $user->rights->commande->creer) {
142  $object->fetch($id);
143  $result = $object->availability(GETPOST('availability_id'));
144  if ($result < 0) {
145  setEventMessages($object->error, $object->errors, 'errors');
146  }
147  }
148 
149  if ($action == 'setdemandreason' && $user->rights->commande->creer) {
150  $object->fetch($id);
151  $result = $object->demand_reason(GETPOST('demand_reason_id'));
152  if ($result < 0) {
153  setEventMessages($object->error, $object->errors, 'errors');
154  }
155  }
156 
157  if ($action == 'setconditions' && $user->rights->commande->creer) {
158  $object->fetch($id);
159  $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
160  if ($result < 0) {
161  setEventMessages($object->error, $object->errors, 'errors');
162  }
163  } elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled)) {
164  // Set incoterm
165  $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
166  if ($result < 0) {
167  setEventMessages($object->error, $object->errors, 'errors');
168  }
169  }
170 
171  // shipping method
172  if ($action == 'setshippingmethod' && $user->rights->commande->creer) {
173  $object->fetch($id);
174  $result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
175  if ($result < 0) {
176  setEventMessages($object->error, $object->errors, 'errors');
177  }
178  }
179 
180  // warehouse
181  if ($action == 'setwarehouse' && $user->rights->commande->creer) {
182  $object->fetch($id);
183  $result = $object->setWarehouse(GETPOST('warehouse_id', 'int'));
184  if ($result < 0) {
185  setEventMessages($object->error, $object->errors, 'errors');
186  }
187  }
188 
189  if ($action == 'update_extras') {
190  $object->oldcopy = dol_clone($object);
191 
192  // Fill array 'array_options' with data from update form
193  $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'restricthtml'));
194  if ($ret < 0) {
195  $error++;
196  }
197 
198  if (!$error) {
199  // Actions on extra fields
200  $result = $object->insertExtraFields('SHIPMENT_MODIFY');
201  if ($result < 0) {
202  setEventMessages($object->error, $object->errors, 'errors');
203  $error++;
204  }
205  }
206 
207  if ($error) {
208  $action = 'edit_extras';
209  }
210  }
211 
212  if ($action == 'set_thirdparty' && $user->rights->commande->creer) {
213  $object->fetch($id);
214  $object->setValueFrom('fk_soc', $socid, '', '', 'date', '', $user, 'ORDER_MODIFY');
215 
216  header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
217  exit();
218  }
219 
220  include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
221 }
222 
223 /*
224  * View
225  */
226 
227 $form = new Form($db);
228 $formfile = new FormFile($db);
229 $formproduct = new FormProduct($db);
230 if (!empty($conf->project->enabled)) {
231  $formproject = new FormProjets($db);
232 }
233 
234 $title = $langs->trans('Order')." - ".$langs->trans('Shipments');
235 $help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
236 llxHeader('', $title, $help_url);
237 
238 
239 if ($id > 0 || !empty($ref)) {
240  $object = new Commande($db);
241  if ($object->fetch($id, $ref) > 0) {
242  $object->loadExpeditions(1);
243 
244  $product_static = new Product($db);
245 
246  $soc = new Societe($db);
247  $soc->fetch($object->socid);
248 
249  $author = new User($db);
250  $author->fetch($object->user_author_id);
251 
252  $res = $object->fetch_optionals();
253 
254  $head = commande_prepare_head($object);
255  print dol_get_fiche_head($head, 'shipping', $langs->trans("CustomerOrder"), -1, 'order');
256 
257 
258  $formconfirm = '';
259 
260  // Confirm validation
261  if ($action == 'cloture') {
262  $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".urlencode($id), $langs->trans("CloseShipment"), $langs->trans("ConfirmCloseShipment"), "confirm_cloture");
263  }
264 
265  // Call Hook formConfirm
266  $parameters = array('formConfirm' => $formconfirm);
267  $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
268  if (empty($reshook)) {
269  $formconfirm .= $hookmanager->resPrint;
270  } elseif ($reshook > 0) {
271  $formconfirm = $hookmanager->resPrint;
272  }
273 
274  // Print form confirm
275  print $formconfirm;
276 
277 
278  // Order card
279 
280  $linkback = '<a href="'.DOL_URL_ROOT.'/commande/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '?socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
281 
282 
283  $morehtmlref = '<div class="refidno">';
284  // Ref customer
285  $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1);
286  $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1);
287  // Thirdparty
288  $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$soc->getNomUrl(1);
289  // Project
290  if (!empty($conf->project->enabled)) {
291  $langs->load("projects");
292  $morehtmlref .= '<br>'.$langs->trans('Project').' ';
293  if ($user->rights->commande->creer) {
294  if ($action != 'classify') {
295  $morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
296  }
297  if ($action == 'classify') {
298  //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
299  $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
300  $morehtmlref .= '<input type="hidden" name="action" value="classin">';
301  $morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
302  $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
303  $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
304  $morehtmlref .= '</form>';
305  } else {
306  $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
307  }
308  } else {
309  if (!empty($object->fk_project)) {
310  $proj = new Project($db);
311  $proj->fetch($object->fk_project);
312  $morehtmlref .= ' : '.$proj->getNomUrl(1);
313  if ($proj->title) {
314  $morehtmlref .= ' - '.$proj->title;
315  }
316  } else {
317  $morehtmlref .= '';
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 (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
335  $filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
336  $filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted 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="3">';
343 
344  $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount);
345  $absolute_creditnote = $soc->getAvailableDiscounts('', $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, '', "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  // Note on several rows
392  //print '<td rowspan="'.$nbrow.'" valign="top">'.$langs->trans('NotePublic').' :<br>';
393  //print nl2br($object->note_public);
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="3">';
407  if ($action == 'editavailability') {
408  $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $object->availability_id, 'availability_id', 1);
409  } else {
410  $form->form_availability($_SERVER['PHP_SELF'].'?id='.$object->id, $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->rights->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, $object->shipping_method_id, 'shipping_method_id', 1);
426  } else {
427  $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none');
428  }
429  print '</td>';
430  print '</tr>';
431 
432  // Warehouse
433  if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
434  require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
435  $formproduct = new FormProduct($db);
436  print '<tr><td>';
437  print '<table width="100%" class="nobordernopadding"><tr><td>';
438  print $langs->trans('Warehouse');
439  print '</td>';
440  if ($action != 'editwarehouse' && $user->rights->commande->creer) {
441  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>';
442  }
443  print '</tr></table>';
444  print '</td><td colspan="2">';
445  if ($action == 'editwarehouse') {
446  $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'warehouse_id', 1);
447  } else {
448  $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->warehouse_id, 'none');
449  }
450  print '</td>';
451  print '</tr>';
452  }
453 
454  // Source reason (why we have an order)
455  print '<tr><td height="10">';
456  print '<table class="nobordernopadding" width="100%"><tr><td>';
457  print $langs->trans('Source');
458  print '</td>';
459  if ($action != 'editdemandreason') {
460  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>';
461  }
462  print '</tr></table>';
463  print '</td><td colspan="3">';
464  if ($action == 'editdemandreason') {
465  $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'demand_reason_id', 1);
466  } else {
467  $form->formInputReason($_SERVER['PHP_SELF'].'?id='.$object->id, $object->demand_reason_id, 'none');
468  }
469 
470  // Terms of payment
471  /*
472  print '<tr><td height="10">';
473  print '<table class="nobordernopadding" width="100%"><tr><td>';
474  print $langs->trans('PaymentConditionsShort');
475  print '</td>';
476 
477  if ($action != 'editconditions' && $object->statut == 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>';
478  print '</tr></table>';
479  print '</td><td colspan="2">';
480  if ($action == 'editconditions')
481  {
482  $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'cond_reglement_id');
483  }
484  else
485  {
486  $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->cond_reglement_id,'none');
487  }
488  print '</td></tr>';
489 
490  // Mode of payment
491  print '<tr><td>';
492  print '<table class="nobordernopadding" width="100%"><tr><td>';
493  print $langs->trans('PaymentMode');
494  print '</td>';
495  if ($action != 'editmode' && $object->statut == 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>';
496  print '</tr></table>';
497  print '</td><td colspan="2">';
498  if ($action == 'editmode')
499  {
500  $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'mode_reglement_id');
501  }
502  else
503  {
504  $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id,$object->mode_reglement_id,'none');
505  }
506  print '</td></tr>';*/
507 
508  $tmparray = $object->getTotalWeightVolume();
509  $totalWeight = $tmparray['weight'];
510  $totalVolume = $tmparray['volume'];
511  if ($totalWeight || $totalVolume) {
512  print '<tr><td>'.$langs->trans("CalculatedWeight").'</td>';
513  print '<td>';
514  print showDimensionInBestUnit($totalWeight, 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no');
515  print '</td></tr>';
516  print '<tr><td>'.$langs->trans("CalculatedVolume").'</td>';
517  print '<td>';
518  print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no');
519  print '</td></tr>';
520  }
521 
522  // TODO How record was recorded OrderMode (llx_c_input_method)
523 
524  // Incoterms
525  if (!empty($conf->incoterm->enabled)) {
526  print '<tr><td>';
527  print '<table width="100%" class="nobordernopadding"><tr><td>';
528  print $langs->trans('IncotermLabel');
529  print '<td><td class="right">';
530  if ($user->rights->commande->creer) {
531  print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'/expedition/shipment.php?id='.$object->id.'&action=editincoterm&token='.newToken().'">'.img_edit().'</a>';
532  } else {
533  print '&nbsp;';
534  }
535  print '</td></tr></table>';
536  print '</td>';
537  print '<td colspan="3">';
538  if ($action != 'editincoterm') {
539  print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
540  } else {
541  print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id);
542  }
543  print '</td></tr>';
544  }
545 
546  $expe = new Expedition($db);
547  $extrafields->fetch_name_optionals_label($expe->table_element);
548 
549  // Other attributes
550  $cols = 2;
551  include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
552 
553  print '</table>';
554 
555  print '</div>';
556  print '<div class="fichehalfright">';
557  print '<div class="underbanner clearboth"></div>';
558 
559  print '<table class="border centpercent tableforfield">';
560 
561  if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) {
562  // Multicurrency Amount HT
563  print '<tr><td class="titlefieldmiddle">'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).'</td>';
564  print '<td class="nowrap">'.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
565  print '</tr>';
566 
567  // Multicurrency Amount VAT
568  print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountVAT', 'multicurrency_total_tva', '', $object, 0).'</td>';
569  print '<td class="nowrap">'.price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
570  print '</tr>';
571 
572  // Multicurrency Amount TTC
573  print '<tr><td>'.$form->editfieldkey('MulticurrencyAmountTTC', 'multicurrency_total_ttc', '', $object, 0).'</td>';
574  print '<td class="nowrap">'.price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).'</td>';
575  print '</tr>';
576  }
577 
578  // Total HT
579  print '<tr><td class="titlefieldmiddle">'.$langs->trans('AmountHT').'</td>';
580  print '<td>'.price($object->total_ht, 0, '', 1, -1, -1, $conf->currency).'</td>';
581  print '</tr>';
582 
583  // Total VAT
584  print '<tr><td>'.$langs->trans('AmountVAT').'</td><td>'.price($object->total_tva, 0, '', 1, -1, -1, $conf->currency).'</td>';
585  print '</tr>';
586 
587  // Amount Local Taxes
588  if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) { // Localtax1
589  print '<tr><td>'.$langs->transcountry("AmountLT1", $mysoc->country_code).'</td>';
590  print '<td>'.price($object->total_localtax1, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
591  }
592  if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0) { // Localtax2 IRPF
593  print '<tr><td>'.$langs->transcountry("AmountLT2", $mysoc->country_code).'</td>';
594  print '<td>'.price($object->total_localtax2, 1, '', 1, - 1, - 1, $conf->currency).'</td></tr>';
595  }
596 
597  // Total TTC
598  print '<tr><td>'.$langs->trans('AmountTTC').'</td><td>'.price($object->total_ttc, 0, '', 1, -1, -1, $conf->currency).'</td>';
599  print '</tr>';
600 
601  print '</table>';
602 
603  print '</div>';
604  print '</div>';
605 
606  print '<div class="clearboth"></div><br>';
607 
608 
613  print '<table id="tablelines" class="noborder noshadow" width="100%">';
614 
615  $sql = "SELECT cd.rowid, cd.fk_product, cd.product_type as type, cd.label, cd.description,";
616  $sql .= " cd.price, cd.tva_tx, cd.subprice,";
617  $sql .= " cd.qty, cd.fk_unit,";
618  $sql .= ' cd.date_start,';
619  $sql .= ' cd.date_end,';
620  $sql .= ' cd.special_code,';
621  $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,';
622  $sql .= ' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units,';
623  $sql .= ' p.surface, p.surface_units, p.volume, p.volume_units';
624  $sql .= ', p.tobatch, p.tosell, p.tobuy, p.barcode';
625  $sql .= ', u.short_label as unit_order';
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  //print $sql;
633  dol_syslog("shipment.php", LOG_DEBUG);
634  $resql = $db->query($sql);
635  if ($resql) {
636  $num = $db->num_rows($resql);
637  $i = 0;
638  print '<thead>';
639  print '<tr class="liste_titre">';
640  print '<th>'.$langs->trans("Description").'</th>';
641  print '<th class="center">'.$langs->trans("QtyOrdered").'</th>';
642  print '<th class="center">'.$langs->trans("QtyShipped").'</th>';
643  print '<th class="center">'.$langs->trans("KeepToShip").'</th>';
644  if (!empty($conf->stock->enabled)) {
645  print '<th class="center">'.$langs->trans("RealStock").'</th>';
646  } else {
647  print '<th>&nbsp;</th>';
648  }
649  print "</tr>\n";
650  print '</thead>';
651 
652  $toBeShipped = array();
653  $toBeShippedTotal = 0;
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)) {
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
668  // was not saved.
669  if (!empty($objp->date_start)) {
670  $type = 1;
671  }
672  if (!empty($objp->date_end)) {
673  $type = 1;
674  }
675 
676  print '<tr class="oddeven">';
677 
678  // Product label
679  if ($objp->fk_product > 0) {
680  // Define output language
681  if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
682  $object->fetch_thirdparty();
683 
684  $prod = new Product($db);
685  $prod->id = $objp->fk_product;
686  $prod->entity = $objp->entity;
687  $prod->getMultiLangs();
688 
689  $outputlangs = $langs;
690  $newlang = '';
691  if (empty($newlang) && GETPOST('lang_id', 'aZ09')) {
692  $newlang = GETPOST('lang_id', 'aZ09');
693  }
694  if (empty($newlang)) {
695  $newlang = $object->thirdparty->default_lang;
696  }
697  if (!empty($newlang)) {
698  $outputlangs = new Translate("", $conf);
699  $outputlangs->setDefaultLang($newlang);
700  }
701 
702  $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label;
703  } else {
704  $label = (!empty($objp->label) ? $objp->label : $objp->product_label);
705  }
706 
707  print '<td>';
708  print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
709 
710  // Show product and description
711  $product_static->type = $type;
712  $product_static->id = $objp->fk_product;
713  $product_static->ref = $objp->ref;
714  $product_static->entity = $objp->entity;
715  $product_static->status = $objp->tosell;
716  $product_static->status_buy = $objp->tobuy;
717  $product_static->status_batch = $objp->tobatch;
718  $product_static->barcode = $objp->barcode;
719 
720  $product_static->weight = $objp->weight;
721  $product_static->weight_units = $objp->weight_units;
722  $product_static->length = $objp->length;
723  $product_static->length_units = $objp->length_units;
724  $product_static->width = $objp->width;
725  $product_static->width_units = $objp->width_units;
726  $product_static->height = $objp->height;
727  $product_static->height_units = $objp->height_units;
728  $product_static->surface = $objp->surface;
729  $product_static->surface_units = $objp->surface_units;
730  $product_static->volume = $objp->volume;
731  $product_static->volume_units = $objp->volume_units;
732 
733  $text = $product_static->getNomUrl(1);
734  $text .= ' - '.$label;
735  $description = ($conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($objp->description)).'<br>';
736  $description .= $product_static->show_photos('product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80);
737  print $form->textwithtooltip($text, $description, 3, '', '', $i);
738 
739  // Show range
740  print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end));
741 
742  // Add description in form
743  if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
744  print ($objp->description && $objp->description != $objp->product_label) ? '<br>'.dol_htmlentitiesbr($objp->description) : '';
745  }
746 
747  print '</td>';
748  } else {
749  print "<td>";
750  if ($type == 1) {
751  $text = img_object($langs->trans('Service'), 'service');
752  } else {
753  $text = img_object($langs->trans('Product'), 'product');
754  }
755 
756  if (!empty($objp->label)) {
757  $text .= ' <strong>'.$objp->label.'</strong>';
758  print $form->textwithtooltip($text, $objp->description, 3, '', '', $i);
759  } else {
760  print $text.' '.nl2br($objp->description);
761  }
762 
763  // Show range
764  print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end));
765  print "</td>\n";
766  }
767 
768  // Qty ordered
769  print '<td class="center">'.$objp->qty.($objp->unit_order ? ' '.$objp->unit_order : '').'</td>';
770 
771  // Qty already shipped
772  $qtyProdCom = $objp->qty;
773  print '<td class="center">';
774  // Nb of sending products for this line of order
775  $qtyAlreadyShipped = (!empty($object->expeditions[$objp->rowid]) ? $object->expeditions[$objp->rowid] : 0);
776  print $qtyAlreadyShipped;
777  print ($objp->unit_order ? ' '.$objp->unit_order : '').'</td>';
778 
779  // Qty remains to ship
780  print '<td class="center">';
781  if ($type == 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
782  $toBeShipped[$objp->fk_product] = $objp->qty - $qtyAlreadyShipped;
783  $toBeShippedTotal += $toBeShipped[$objp->fk_product];
784  print $toBeShipped[$objp->fk_product];
785  } else {
786  print '0 ('.$langs->trans("Service").')';
787  }
788  print ($objp->unit_order ? ' '.$objp->unit_order : '').'</td>';
789 
790  if ($objp->fk_product > 0) {
791  $product = new Product($db);
792  $product->fetch($objp->fk_product);
793  $product->load_stock('warehouseopen');
794  }
795 
796  if ($objp->fk_product > 0 && ($type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) && !empty($conf->stock->enabled)) {
797  print '<td class="center">';
798  print $product->stock_reel;
799  if ($product->stock_reel < $toBeShipped[$objp->fk_product]) {
800  print ' '.img_warning($langs->trans("StockTooLow"));
801  if (!empty($conf->global->STOCK_CORRECT_STOCK_IN_SHIPMENT)) {
802  $nbPiece = $toBeShipped[$objp->fk_product] - $product->stock_reel;
803  print ' &nbsp; '.$langs->trans("GoTo").' <a href="'.DOL_URL_ROOT.'/product/stock/product.php?id='.((int) $product->id).'&action=correction&nbpiece='.urlencode($nbPiece).'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.((int) $object->id)).'">'.$langs->trans("CorrectStock").'</a>';
804  }
805  }
806  print '</td>';
807  } else {
808  print '<td>&nbsp;</td>';
809  }
810  print "</tr>\n";
811 
812  // Show subproducts lines
813  if ($objp->fk_product > 0 && !empty($conf->global->PRODUIT_SOUSPRODUITS)) {
814  // Set tree of subproducts in product->sousprods
815  $product->get_sousproduits_arbo();
816  //var_dump($product->sousprods);exit;
817 
818  // Define a new tree with quantiies recalculated
819  $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
820  //var_dump($prods_arbo);
821  if (count($prods_arbo) > 0) {
822  foreach ($prods_arbo as $key => $value) {
823  $img = '';
824  if ($value['stock'] < $value['stock_alert']) {
825  $img = img_warning($langs->trans("StockTooLow"));
826  }
827  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>';
828  print '<td class="center"> '.$value['nb_total'].'</td>';
829  print '<td>&nbsp;</td>';
830  print '<td>&nbsp;</td>';
831  print '<td class="center">'.$value['stock'].' '.$img.'</td></tr>'."\n";
832  }
833  }
834  }
835  }
836  $i++;
837  }
838  $db->free($resql);
839 
840  if (!$num) {
841  print '<tr '.$bc[false].'><td colspan="5">'.$langs->trans("NoArticleOfTypeProduct").'<br>';
842  }
843 
844  print "</table>";
845  } else {
846  dol_print_error($db);
847  }
848 
849  print '</div>';
850 
851 
852  /*
853  * Boutons Actions
854  */
855 
856  if (empty($user->socid)) {
857  print '<div class="tabsAction">';
858 
859  // Bouton expedier sans gestion des stocks
860  if (empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED)) {
861  if ($user->rights->expedition->creer) {
862  print '<a class="butAction" href="'.DOL_URL_ROOT.'/expedition/card.php?action=create&amp;origin=commande&amp;object_id='.$id.'">'.$langs->trans("CreateShipment").'</a>';
863  if ($toBeShippedTotal <= 0) {
864  print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend"));
865  }
866  } else {
867  print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateShipment").'</a>';
868  }
869  }
870  print "</div>";
871  }
872 
873 
874  // Bouton expedier avec gestion des stocks
875 
876  if (!empty($conf->stock->enabled) && $object->statut == Commande::STATUS_DRAFT) {
877  print $langs->trans("ValidateOrderFirstBeforeShipment");
878  }
879 
880  if (!empty($conf->stock->enabled) && ($object->statut > Commande::STATUS_DRAFT && $object->statut < Commande::STATUS_CLOSED)) {
881  if ($user->rights->expedition->creer) {
882  //print load_fiche_titre($langs->trans("CreateShipment"));
883  print '<div class="tabsAction">';
884 
885  print '<form method="GET" action="'.DOL_URL_ROOT.'/expedition/card.php">';
886  print '<input type="hidden" name="action" value="create">';
887  //print '<input type="hidden" name="id" value="'.$object->id.'">';
888  print '<input type="hidden" name="shipping_method_id" value="'.$object->shipping_method_id.'">';
889  print '<input type="hidden" name="origin" value="commande">';
890  print '<input type="hidden" name="origin_id" value="'.$object->id.'">';
891  print '<input type="hidden" name="projectid" value="'.$object->fk_project.'">';
892  //print '<table class="border centpercent">';
893 
894  $langs->load("stocks");
895 
896  //print '<tr>';
897 
898  if (!empty($conf->stock->enabled)) {
899  //print '<td>';
900  print $langs->trans("WarehouseSource");
901  //print '</td>';
902  //print '<td>';
903  print $formproduct->selectWarehouses(!empty($object->warehouse_id) ? $object->warehouse_id : 'ifone', 'entrepot_id', '', 1, 0, 0, '', 0, 0, array(), 'minwidth200');
904  if (count($formproduct->cache_warehouses) <= 0) {
905  print ' &nbsp; '.$langs->trans("WarehouseSourceNotDefined").' <a href="'.DOL_URL_ROOT.'/product/stock/card.php?action=create">'.$langs->trans("AddOne").'</a>';
906  }
907  //print '</td>';
908  }
909  //print '<td class="center">';
910  print '<input type="submit" class="butAction" named="save" value="'.$langs->trans("CreateShipment").'">';
911  if ($toBeShippedTotal <= 0) {
912  print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend"));
913  }
914  //print '</td></tr>';
915 
916  //print "</table>";
917  print "</form>\n";
918 
919  print '</div>';
920 
921  $somethingshown = 1;
922  } else {
923  print '<div class="tabsAction">';
924  print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("CreateShipment").'</a>';
925  print '</div>';
926  }
927  }
928 
929  show_list_sending_receive('commande', $object->id);
930  } else {
931  /* Order not found */
932  setEventMessages($langs->trans("NonExistentOrder"), null, 'errors');
933  }
934 }
935 
936 // End of page
937 llxFooter();
938 $db->close();
Societe
Class to manage third parties objects (customers, suppliers, prospects...)
Definition: societe.class.php:48
restrictedArea
restrictedArea($user, $features, $objectid=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.
Definition: security.lib.php:234
Expedition
Class to manage shipments.
Definition: expedition.class.php:52
llxFooter
llxFooter()
Empty footer.
Definition: wrapper.php:73
Project
Class to manage projects.
Definition: project.class.php:35
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
commande_prepare_head
commande_prepare_head(Commande $object)
Prepare array with list of tabs.
Definition: order.lib.php:34
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4844
Commande\STATUS_CLOSED
const STATUS_CLOSED
Closed (Sent, billed or not)
Definition: commande.class.php:395
Translate
Class to manage translations.
Definition: translate.class.php:30
img_warning
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
Definition: functions.lib.php:4521
FormProjets
Class to manage building of HTML components.
Definition: html.formprojet.class.php:30
$form
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:142
dol_clone
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for each properties) With native =...
Definition: functions.lib.php:1158
img_edit
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
Definition: functions.lib.php:4389
dol_banner_tab
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
Definition: functions.lib.php:2046
$help_url
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:116
price2num
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
Definition: functions.lib.php:5661
show_list_sending_receive
show_list_sending_receive($origin, $origin_id, $filter='')
List sendings and receive receipts.
Definition: sendings.lib.php:227
dol_print_date
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
Definition: functions.lib.php:2514
$formconfirm
$formconfirm
if ($action == 'delbookkeepingyear') {
Definition: listbyaccount.php:576
FormFile
Class to offer components to list and upload files.
Definition: html.formfile.class.php:36
Commande
Class to manage customers orders.
Definition: commande.class.php:46
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1603
dol_get_fiche_head
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
Definition: functions.lib.php:1822
print_date_range
print_date_range($date_start, $date_end, $format='', $outputlangs='')
Format output for start and end date.
Definition: functions.lib.php:8016
FormProduct
Class with static methods for building HTML components related to products Only components common to ...
Definition: html.formproduct.class.php:30
newToken
newToken()
Return the value of token currently saved into session with name 'newtoken'.
Definition: functions.lib.php:10878
Commande\STATUS_DRAFT
const STATUS_DRAFT
Draft status.
Definition: commande.class.php:381
User
Class to manage Dolibarr users.
Definition: user.class.php:44
ExtraFields
Class to manage standard extra fields.
Definition: extrafields.class.php:39
Product
Class to manage products or services.
Definition: product.class.php:46
Form
Class to manage generation of HTML components Only common components must be here.
Definition: html.form.class.php:52
img_object
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
Definition: functions.lib.php:4211
dol_htmlentitiesbr
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...
Definition: functions.lib.php:6991
$resql
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:742
price
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.
Definition: functions.lib.php:5541
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
Product\TYPE_PRODUCT
const TYPE_PRODUCT
Regular product.
Definition: product.class.php:500
dol_mktime
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
Definition: functions.lib.php:2757
showDimensionInBestUnit
showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput='no', $use_short_label=0)
Output a dimension with best unit.
Definition: functions.lib.php:5788
llxHeader
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:59