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';
40 if (!empty($conf->stock->enabled)) {
41 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
43 if (!empty($conf->propal->enabled)) {
44 require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
46 if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
47 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
51 $langs->loadLangs(array(
'orders',
'sendings',
'companies',
'bills',
'propal',
'deliveries',
'stocks',
'productbatch',
'incoterm',
'other'));
55 $action =
GETPOST(
'action',
'aZ09');
57 $hookmanager->initHooks(array(
'ordershipmentcard'));
62 if (!empty($user->socid)) {
63 $socid = $user->socid;
72 $extrafields->fetch_name_optionals_label($object->table_element);
75 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
79 $socid = $user->socid;
90 $parameters = array(
'socid' => $socid);
91 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
96 if (empty($reshook)) {
98 if ($action ==
'classin') {
100 $object->setProject(
GETPOST(
'projectid',
'int'));
103 if ($action ==
'confirm_cloture' &&
GETPOST(
'confirm',
'alpha') ==
'yes') {
105 $result = $object->cloture($user);
106 } elseif ($action ==
'setref_client' && $user->rights->commande->creer) {
108 $result = $object->set_ref_client($user,
GETPOST(
'ref_client'));
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'));
118 $result = $object->setDeliveryDate($user, $datedelivery);
133 if ($action ==
'setmode' && $user->rights->commande->creer) {
135 $result = $object->setPaymentMethods(
GETPOST(
'mode_reglement_id',
'int'));
141 if ($action ==
'setavailability' && $user->rights->commande->creer) {
143 $result = $object->availability(
GETPOST(
'availability_id'));
149 if ($action ==
'setdemandreason' && $user->rights->commande->creer) {
151 $result = $object->demand_reason(
GETPOST(
'demand_reason_id'));
157 if ($action ==
'setconditions' && $user->rights->commande->creer) {
159 $result = $object->setPaymentTerms(
GETPOST(
'cond_reglement_id',
'int'));
163 } elseif ($action ==
'set_incoterms' && !empty($conf->incoterm->enabled)) {
165 $result = $object->setIncoterms(
GETPOST(
'incoterm_id',
'int'),
GETPOST(
'location_incoterms',
'alpha'));
172 if ($action ==
'setshippingmethod' && $user->rights->commande->creer) {
174 $result = $object->setShippingMethod(
GETPOST(
'shipping_method_id',
'int'));
181 if ($action ==
'setwarehouse' && $user->rights->commande->creer) {
183 $result = $object->setWarehouse(
GETPOST(
'warehouse_id',
'int'));
189 if ($action ==
'update_extras') {
193 $ret = $extrafields->setOptionalsFromPost(
null, $object,
GETPOST(
'attribute',
'restricthtml'));
200 $result = $object->insertExtraFields(
'SHIPMENT_MODIFY');
208 $action =
'edit_extras';
212 if ($action ==
'set_thirdparty' && $user->rights->commande->creer) {
214 $object->setValueFrom(
'fk_soc', $socid,
'',
'',
'date',
'', $user,
'ORDER_MODIFY');
216 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
220 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
230 if (!empty($conf->project->enabled)) {
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';
239 if ($id > 0 || !empty($ref)) {
241 if ($object->fetch($id, $ref) > 0) {
242 $object->loadExpeditions(1);
244 $product_static =
new Product($db);
247 $soc->fetch($object->socid);
249 $author =
new User($db);
250 $author->fetch($object->user_author_id);
252 $res = $object->fetch_optionals();
255 print
dol_get_fiche_head($head,
'shipping', $langs->trans(
"CustomerOrder"), -1,
'order');
261 if ($action ==
'cloture') {
262 $formconfirm =
$form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=".urlencode($id), $langs->trans(
"CloseShipment"), $langs->trans(
"ConfirmCloseShipment"),
"confirm_cloture");
267 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
268 if (empty($reshook)) {
270 } elseif ($reshook > 0) {
280 $linkback =
'<a href="'.DOL_URL_ROOT.
'/commande/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'?socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
283 $morehtmlref =
'<div class="refidno">';
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);
288 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$soc->getNomUrl(1);
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> : ';
297 if ($action ==
'classify') {
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>';
306 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
309 if (!empty($object->fk_project)) {
311 $proj->fetch($object->fk_project);
312 $morehtmlref .=
' : '.$proj->getNomUrl(1);
314 $morehtmlref .=
' - '.$proj->title;
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">';
334 if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
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="3">';
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');
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">';
360 if ($object->hasDelay() && empty($object->delivery_date)) {
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,
'',
"setdate_livraison", 1, 0);
382 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
'Modify').
'">';
386 if ($object->hasDelay() && !empty($object->delivery_date)) {
387 print
' '.img_picto($langs->trans(
"Late").
' : '.$object->showDelay(),
"warning");
398 print
'<tr><td height="10">';
399 print
'<table class="nobordernopadding" width="100%"><tr><td>';
400 print $langs->trans(
'AvailabilityPeriod');
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>';
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);
410 $form->form_availability($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->availability_id,
'none', 1);
416 print
'<table width="100%" class="nobordernopadding"><tr><td>';
417 print $langs->trans(
'SendingMethod');
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>';
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);
427 $form->formSelectShippingMethod($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->shipping_method_id,
'none');
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';
437 print
'<table width="100%" class="nobordernopadding"><tr><td>';
438 print $langs->trans(
'Warehouse');
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>';
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);
448 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->warehouse_id,
'none');
455 print
'<tr><td height="10">';
456 print
'<table class="nobordernopadding" width="100%"><tr><td>';
457 print $langs->trans(
'Source');
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>';
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);
467 $form->formInputReason($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->demand_reason_id,
'none');
508 $tmparray = $object->getTotalWeightVolume();
509 $totalWeight = $tmparray[
'weight'];
510 $totalVolume = $tmparray[
'volume'];
511 if ($totalWeight || $totalVolume) {
512 print
'<tr><td>'.$langs->trans(
"CalculatedWeight").
'</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');
516 print
'<tr><td>'.$langs->trans(
"CalculatedVolume").
'</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');
525 if (!empty($conf->incoterm->enabled)) {
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>';
535 print
'</td></tr></table>';
537 print
'<td colspan="3">';
538 if ($action !=
'editincoterm') {
539 print
$form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
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);
547 $extrafields->fetch_name_optionals_label($expe->table_element);
551 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
556 print
'<div class="fichehalfright">';
557 print
'<div class="underbanner clearboth"></div>';
559 print
'<table class="border centpercent tableforfield">';
561 if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) {
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>';
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>';
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>';
579 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
'AmountHT').
'</td>';
580 print
'<td>'.price($object->total_ht, 0,
'', 1, -1, -1, $conf->currency).
'</td>';
584 print
'<tr><td>'.$langs->trans(
'AmountVAT').
'</td><td>'.
price($object->total_tva, 0,
'', 1, -1, -1, $conf->currency).
'</td>';
588 if ($mysoc->localtax1_assuj ==
"1" || $object->total_localtax1 != 0) {
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>';
592 if ($mysoc->localtax2_assuj ==
"1" || $object->total_localtax2 != 0) {
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>';
598 print
'<tr><td>'.$langs->trans(
'AmountTTC').
'</td><td>'.
price($object->total_ttc, 0,
'', 1, -1, -1, $conf->currency).
'</td>';
606 print
'<div class="clearboth"></div><br>';
613 print
'<table id="tablelines" class="noborder noshadow" width="100%">';
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";
634 $resql = $db->query($sql);
636 $num = $db->num_rows(
$resql);
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>';
647 print
'<th> </th>';
652 $toBeShipped = array();
653 $toBeShippedTotal = 0;
655 $objp = $db->fetch_object(
$resql);
657 $parameters = array(
'i' => $i,
'line' => $objp,
'num' => $num);
658 $reshook = $hookmanager->executeHooks(
'printObjectLine', $parameters, $object, $action);
663 if (empty($reshook)) {
665 $type = isset($objp->type) ? $objp->type : $objp->product_type;
669 if (!empty($objp->date_start)) {
672 if (!empty($objp->date_end)) {
676 print
'<tr class="oddeven">';
679 if ($objp->fk_product > 0) {
681 if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
682 $object->fetch_thirdparty();
685 $prod->id = $objp->fk_product;
686 $prod->entity = $objp->entity;
687 $prod->getMultiLangs();
689 $outputlangs = $langs;
691 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
692 $newlang =
GETPOST(
'lang_id',
'aZ09');
694 if (empty($newlang)) {
695 $newlang = $object->thirdparty->default_lang;
697 if (!empty($newlang)) {
699 $outputlangs->setDefaultLang($newlang);
702 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $objp->product_label;
704 $label = (!empty($objp->label) ? $objp->label : $objp->product_label);
708 print
'<a name="'.$objp->rowid.
'"></a>';
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;
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;
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);
740 print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end));
743 if (!empty($conf->global->PRODUIT_DESC_IN_FORM)) {
744 print ($objp->description && $objp->description != $objp->product_label) ?
'<br>'.dol_htmlentitiesbr($objp->description) :
'';
751 $text =
img_object($langs->trans(
'Service'),
'service');
753 $text =
img_object($langs->trans(
'Product'),
'product');
756 if (!empty($objp->label)) {
757 $text .=
' <strong>'.$objp->label.
'</strong>';
758 print
$form->textwithtooltip($text, $objp->description, 3,
'',
'', $i);
760 print $text.
' '.nl2br($objp->description);
764 print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end));
769 print
'<td class="center">'.$objp->qty.($objp->unit_order ?
' '.$objp->unit_order :
'').
'</td>';
772 $qtyProdCom = $objp->qty;
773 print
'<td class="center">';
775 $qtyAlreadyShipped = (!empty($object->expeditions[$objp->rowid]) ? $object->expeditions[$objp->rowid] : 0);
776 print $qtyAlreadyShipped;
777 print ($objp->unit_order ?
' '.$objp->unit_order :
'').
'</td>';
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];
786 print
'0 ('.$langs->trans(
"Service").
')';
788 print ($objp->unit_order ?
' '.$objp->unit_order :
'').
'</td>';
790 if ($objp->fk_product > 0) {
792 $product->fetch($objp->fk_product);
793 $product->load_stock(
'warehouseopen');
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
' '.$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>';
808 print
'<td> </td>';
813 if ($objp->fk_product > 0 && !empty($conf->global->PRODUIT_SOUSPRODUITS)) {
815 $product->get_sousproduits_arbo();
819 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
821 if (count($prods_arbo) > 0) {
822 foreach ($prods_arbo as $key => $value) {
824 if ($value[
'stock'] < $value[
'stock_alert']) {
827 print
'<tr class="oddeven"><td> -> <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> </td>';
830 print
'<td> </td>';
831 print
'<td class="center">'.$value[
'stock'].
' '.$img.
'</td></tr>'.
"\n";
841 print
'<tr '.$bc[
false].
'><td colspan="5">'.$langs->trans(
"NoArticleOfTypeProduct").
'<br>';
856 if (empty($user->socid)) {
857 print
'<div class="tabsAction">';
861 if ($user->rights->expedition->creer) {
862 print
'<a class="butAction" href="'.DOL_URL_ROOT.
'/expedition/card.php?action=create&origin=commande&object_id='.$id.
'">'.$langs->trans(
"CreateShipment").
'</a>';
863 if ($toBeShippedTotal <= 0) {
864 print
' '.img_warning($langs->trans(
"WarningNoQtyLeftToSend"));
867 print
'<a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"CreateShipment").
'</a>';
877 print $langs->trans(
"ValidateOrderFirstBeforeShipment");
881 if ($user->rights->expedition->creer) {
883 print
'<div class="tabsAction">';
885 print
'<form method="GET" action="'.DOL_URL_ROOT.
'/expedition/card.php">';
886 print
'<input type="hidden" name="action" value="create">';
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.
'">';
894 $langs->load(
"stocks");
898 if (!empty($conf->stock->enabled)) {
900 print $langs->trans(
"WarehouseSource");
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
' '.$langs->trans(
"WarehouseSourceNotDefined").
' <a href="'.DOL_URL_ROOT.
'/product/stock/card.php?action=create">'.$langs->trans(
"AddOne").
'</a>';
910 print
'<input type="submit" class="butAction" named="save" value="'.$langs->trans(
"CreateShipment").
'">';
911 if ($toBeShippedTotal <= 0) {
912 print
' '.img_warning($langs->trans(
"WarningNoQtyLeftToSend"));
923 print
'<div class="tabsAction">';
924 print
'<a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"CreateShipment").
'</a>';