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';
42if (isModEnabled(
'stock')) {
43 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
45if (isModEnabled(
"propal")) {
46 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
48if (isModEnabled(
"product") || isModEnabled(
"service")) {
49 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
62$langs->loadLangs(array(
'orders',
'sendings',
'companies',
'bills',
'propal',
'deliveries',
'stocks',
'productbatch',
'incoterm',
'other'));
66$action =
GETPOST(
'action',
'aZ09');
68$hookmanager->initHooks(array(
'ordershipmentcard'));
73if (!empty($user->socid)) {
74 $socid = $user->socid;
83$extrafields->fetch_name_optionals_label(
$object->table_element);
86include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
90 $socid = $user->socid;
95$permissiontoread = $user->hasRight(
'expedition',
'lire');
96$permissiontoadd = $user->hasRight(
'expedition',
'creer');
97$permissiontodelete = $user->hasRight(
'expedition',
'supprimer') || ($permissiontoadd && ((int)
$object->status == $object::STATUS_DRAFT));
98$permissionnote = $user->hasRight(
'expedition',
'creer');
99$permissiondellink = $user->hasRight(
'expedition',
'creer');
100$permissiontoeditextra = $permissiontoadd;
101if (
GETPOST(
'attribute',
'aZ09') && isset($extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')])) {
103 $permissiontoeditextra =
dol_eval((
string) $extrafields->attributes[
$object->table_element][
'perms'][
GETPOST(
'attribute',
'aZ09')]);
111$parameters = array(
'socid' => $socid);
112$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
117if (empty($reshook)) {
119 if ($action ==
'classin' && $permissiontoadd) {
124 if ($action ==
'confirm_cloture' &&
GETPOST(
'confirm',
'alpha') ==
'yes' && $permissiontoadd) {
126 $result =
$object->cloture($user);
127 } elseif ($action ==
'setref_client' && $permissiontoadd) {
135 if ($action ==
'setdatedelivery' && $permissiontoadd) {
139 $result =
$object->setDeliveryDate($user, $datedelivery);
144 if ($action ==
'setmode' && $permissiontoadd) {
152 if ($action ==
'setavailability' && $permissiontoadd) {
160 if ($action ==
'setdemandreason' && $permissiontoadd) {
168 if ($action ==
'setconditions' && $permissiontoadd) {
174 } elseif ($action ==
'set_incoterms' && isModEnabled(
'incoterm') && $permissiontoadd) {
183 if ($action ==
'setshippingmethod' && $permissiontoadd) {
192 if ($action ==
'setwarehouse' && $permissiontoadd) {
200 if ($action ==
'update_extras' && $permissiontoeditextra) {
203 $attribute_name =
GETPOST(
'attribute',
'aZ09');
206 $ret = $extrafields->setOptionalsFromPost(
null, $object, $attribute_name);
212 $result =
$object->updateExtraField($attribute_name,
'SHIPPING_MODIFY');
220 $action =
'edit_extras';
224 if ($action ==
'set_thirdparty' && $permissiontoadd) {
226 $object->setValueFrom(
'fk_soc', $socid,
'',
null,
'date',
'', $user,
'ORDER_MODIFY');
228 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$order_id);
232 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
240$form =
new Form($db);
243if (isModEnabled(
'project')) {
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');
252if ($order_id > 0 || !empty($ref)) {
254 if (
$object->fetch($order_id, $ref) > 0) {
257 $product_static =
new Product($db);
262 $author =
new User($db);
263 $author->fetch(
$object->user_author_id);
266 print
dol_get_fiche_head($head,
'shipping', $langs->trans(
"CustomerOrder"), -1,
'order');
272 if ($action ==
'cloture') {
273 $formconfirm = $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=".urlencode((
string) ($order_id)), $langs->trans(
"CloseShipment"), $langs->trans(
"ConfirmCloseShipment"),
"confirm_cloture");
277 $parameters = array(
'formConfirm' => $formconfirm);
278 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
279 if (empty($reshook)) {
280 $formconfirm .= $hookmanager->resPrint;
281 } elseif ($reshook > 0) {
282 $formconfirm = $hookmanager->resPrint;
291 $linkback =
'<a href="'.DOL_URL_ROOT.
'/commande/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'?socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
294 $morehtmlref =
'<div class="refidno">';
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);
299 $morehtmlref .=
'<br>'.$soc->getNomUrl(1);
301 if (isModEnabled(
'project')) {
302 $langs->load(
"projects");
303 $morehtmlref .=
'<br>';
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> ';
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');
311 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
313 $proj->fetch($objectsrc->fk_project);
314 $morehtmlref .= $proj->getNomUrl(1);
316 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
321 $morehtmlref .=
'</div>';
324 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
327 print
'<div class="fichecenter">';
328 print
'<div class="fichehalfleft">';
329 print
'<div class="underbanner clearboth"></div>';
331 print
'<table class="border centpercent tableforfield">';
335 $filterabsolutediscount =
"fk_facture_source IS NULL";
336 $filtercreditnote =
"fk_facture_source IS NOT NULL";
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)%')";
342 print
'<tr><td class="titlefield">'.$langs->trans(
'Discounts').
'</td><td colspan="2">';
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');
351 $backtopage = urlencode($_SERVER[
"PHP_SELF"].
'?id='.
$object->id);
352 $cannotApplyDiscount = 1;
353 include DOL_DOCUMENT_ROOT.
'/core/tpl/object_discounts.tpl.php';
357 print
'<tr><td>'.$langs->trans(
'Date').
'</td>';
358 print
'<td colspan="2">';
361 print
' '.img_picto($langs->trans(
"Late").
' : '.
$object->showDelay(),
"warning");
367 print
'<tr><td height="10">';
368 print
'<table class="nobordernopadding" width="100%"><tr><td>';
369 print $langs->trans(
'DateDeliveryPlanned');
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>';
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').
'">';
387 print
' '.img_picto($langs->trans(
"Late").
' : '.
$object->showDelay(),
"warning");
394 print
'<tr><td height="10">';
395 print
'<table class="nobordernopadding" width="100%"><tr><td>';
396 print $langs->trans(
'AvailabilityPeriod');
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>';
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);
406 $form->form_availability($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
string)
$object->availability_id,
'none', 1);
412 print
'<table width="100%" class="nobordernopadding"><tr><td>';
413 print $langs->trans(
'SendingMethod');
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>';
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);
423 $form->formSelectShippingMethod($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
string)
$object->shipping_method_id,
'none');
429 if (isModEnabled(
'stock') &&
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')) {
430 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
433 print
'<table width="100%" class="nobordernopadding"><tr><td>';
434 print $langs->trans(
'Warehouse');
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>';
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);
444 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.
$object->id,
$object->warehouse_id,
'none');
451 print
'<tr><td height="10">';
452 print
'<table class="nobordernopadding" width="100%"><tr><td>';
453 print $langs->trans(
'Source');
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>';
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);
463 $form->formInputReason($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (
string)
$object->demand_reason_id,
'none');
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">';
512 print
'<tr><td>'.$langs->trans(
"CalculatedVolume").
'</td>';
513 print
'<td colspan="2">';
521 if (isModEnabled(
'incoterm')) {
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>';
531 print
'</td></tr></table>';
533 print
'<td colspan="2">';
534 if ($action !=
'editincoterm') {
535 print $form->textwithpicto(
$object->display_incoterms(),
$object->label_incoterms, 1);
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);
543 $extrafields->fetch_name_optionals_label($expe->table_element);
547 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
552 print
'<div class="fichehalfright">';
553 print
'<div class="underbanner clearboth"></div>';
555 print
'<table class="border centpercent tableforfield">';
557 if (isModEnabled(
"multicurrency") && (
$object->multicurrency_code !=
$conf->currency)) {
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>';
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>';
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>';
575 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
'AmountHT').
'</td>';
576 print
'<td>'.price(
$object->total_ht, 0,
'', 1, -1, -1,
$conf->currency).
'</td>';
580 print
'<tr><td>'.$langs->trans(
'AmountVAT').
'</td><td>'.
price(
$object->total_tva, 0,
'', 1, -1, -1,
$conf->currency).
'</td>';
584 if ($mysoc->localtax1_assuj ==
"1" ||
$object->total_localtax1 != 0) {
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>';
588 if ($mysoc->localtax2_assuj ==
"1" ||
$object->total_localtax2 != 0) {
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>';
594 print
'<tr><td>'.$langs->trans(
'AmountTTC').
'</td><td>'.
price(
$object->total_ttc, 0,
'', 1, -1, -1,
$conf->currency).
'</td>';
602 print
'<div class="clearboth"></div><br>';
609 print
'<div class="div-table-responsive-no-min">';
610 print
'<table id="tablelines" class="noborder noshadow centpercent">';
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";
630 $toBeShipped = array();
631 $toBeShippedTotal = 0;
635 $resql = $db->query($sql);
637 $num = $db->num_rows($resql);
640 print
'<tr class="liste_titre">';
642 print
'<th>'.$langs->trans(
"Rank").
'</th>';
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>';
651 print
'<th> </th>';
657 $objp = $db->fetch_object($resql);
659 $parameters = array(
'i' => $i,
'line' => $objp,
'num' => $num);
660 $reshook = $hookmanager->executeHooks(
'printObjectLine', $parameters, $object, $action);
665 if (empty($reshook) && $objp->special_code != SUBTOTALS_SPECIAL_CODE) {
667 $type = isset($objp->type) ? $objp->type : $objp->product_type;
671 if (!empty($objp->date_start)) {
674 if (!empty($objp->date_end)) {
678 print
'<tr class="oddeven">';
682 print
'<td class="center">'.$objp->rang.
'</td>';
686 if ($objp->fk_product > 0) {
692 $prod->id = $objp->fk_product;
693 $prod->entity = $objp->entity;
694 $prod->getMultiLangs();
696 $outputlangs = $langs;
698 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
699 $newlang =
GETPOST(
'lang_id',
'aZ09');
701 if (empty($newlang)) {
702 $newlang =
$object->thirdparty->default_lang;
704 if (!empty($newlang)) {
706 $outputlangs->setDefaultLang($newlang);
709 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $objp->product_label;
711 $label = (!empty($objp->label) ? $objp->label : $objp->product_label);
715 print
'<a name="'.$objp->rowid.
'"></a>';
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;
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;
740 $text = $product_static->getNomUrl(1);
741 $text .=
' - '.$label;
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);
747 print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end));
751 print ($objp->description && $objp->description != $objp->product_label) ?
'<br>'.dol_htmlentitiesbr($objp->description) :
'';
758 $text =
img_object($langs->trans(
'Service'),
'service');
760 $text =
img_object($langs->trans(
'Product'),
'product');
763 if (!empty($objp->label)) {
764 $text .=
' <strong>'.$objp->label.
'</strong>';
765 print $form->textwithtooltip($text, $objp->description, 3, 0,
'', (
string) $i);
767 print $text.
' '.nl2br($objp->description);
771 print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end));
776 print
'<td class="center">'.$objp->qty.($objp->unit_order ?
' '.$objp->unit_order :
'').
'</td>';
779 $qtyProdCom = $objp->qty;
780 print
'<td class="center">';
782 $qtyAlreadyShipped = (!empty(
$object->expeditions[$objp->rowid]) ?
$object->expeditions[$objp->rowid] : 0);
783 print $qtyAlreadyShipped;
784 print($objp->unit_order ?
' '.$objp->unit_order :
'').
'</td>';
787 print
'<td class="center">';
789 $toBeShipped[$objp->fk_product] = $objp->qty - $qtyAlreadyShipped;
790 $toBeShippedTotal += $toBeShipped[$objp->fk_product];
791 print $toBeShipped[$objp->fk_product];
793 print
'0 <span class="opacitymedium">('.$langs->trans(
"Service").
')</span>';
795 print($objp->unit_order ?
' '.$objp->unit_order :
'').
'</td>';
797 if ($objp->fk_product > 0) {
799 $product->fetch($objp->fk_product);
800 $product->load_stock(
'warehouseopen');
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"));
810 $nbPiece = $toBeShipped[$objp->fk_product] - $product->stock_reel;
811 print
' ' . $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>';
815 print
img_warning().
' '.$langs->trans(
'StockDisabled');
819 print
'<td class="center"><span class="opacitymedium">('.$langs->trans(
"Service").
')</span></td>';
821 print
'<td> </td>';
828 $product->get_sousproduits_arbo();
832 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
834 if (count($prods_arbo) > 0) {
835 foreach ($prods_arbo as $key => $value) {
837 if ($value[
'stock'] < $value[
'stock_alert']) {
840 print
'<tr class="oddeven"><td> -> <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> </td>';
843 print
'<td> </td>';
844 print
'<td class="center">'.$value[
'stock'].
' '.$img.
'</td></tr>'.
"\n";
848 } elseif (empty($reshook) && $objp->special_code == SUBTOTALS_SPECIAL_CODE) {
850 require
dol_buildpath(
'/core/tpl/subtotal_expedition_view.tpl.php');
857 print
'<tr><td colspan="5"><span class="opacitymedium">'.$langs->trans(
"NoArticleOfTypeProduct").
'</span></td></tr>';
871 if (empty($user->socid)) {
872 print
'<div class="tabsAction">';
876 if ($user->hasRight(
'expedition',
'creer')) {
877 print
'<a class="butAction" href="'.DOL_URL_ROOT.
'/expedition/card.php?action=create&origin=commande&object_id='.$order_id.
'">'.$langs->trans(
"CreateShipment").
'</a>';
878 if ($toBeShippedTotal <= 0) {
879 print
' '.img_warning($langs->trans(
"WarningNoQtyLeftToSend"));
882 print
'<a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"CreateShipment").
'</a>';
892 print $langs->trans(
"ValidateOrderFirstBeforeShipment");
896 if ($user->hasRight(
'expedition',
'creer')) {
898 print
'<div class="tabsAction">';
900 print
'<form method="GET" action="'.DOL_URL_ROOT.
'/expedition/card.php">';
901 print
'<input type="hidden" name="action" value="create">';
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.
'">';
908 $langs->load(
"stocks");
910 print
'<div class="center formconsumeproduce">';
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
' '.$langs->trans(
"WarehouseSourceNotDefined").
' <a href="'.DOL_URL_ROOT.
'/product/stock/card.php?action=create">'.$langs->trans(
"AddOne").
'</a>';
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"));
929 print
'<div class="tabsAction">';
930 print
'<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NotAllowed")).
'">'.$langs->trans(
"CreateShipment").
'</a>';
935 show_list_sending_receive(
'commande',
$object->id);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
Class to manage customers orders.
const STATUS_CLOSED
Closed (Sent, billed or not)
const STATUS_DRAFT
Draft status.
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...
commande_prepare_head(Commande $object)
Prepare array with list of tabs.
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.