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->projet->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)) require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
41 if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
42 if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
45 $langs->loadLangs(array(
'orders',
"companies",
"bills",
'propal',
'deliveries',
'stocks',
"productbatch",
'incoterm',
'other'));
49 $action =
GETPOST(
'action',
'aZ09');
51 $hookmanager->initHooks(array(
'ordershipmentcard'));
56 if (!empty($user->socid)) $socid = $user->socid;
63 $extrafields->fetch_name_optionals_label($object->table_element);
66 include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
75 $parameters = array(
'socid' => $socid);
76 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
77 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
82 if ($action ==
'classin')
86 $object->setProject(
GETPOST(
'projectid',
'int'));
89 if ($action ==
'confirm_cloture' &&
GETPOST(
'confirm',
'alpha') ==
'yes')
93 $result = $object->cloture($user);
97 elseif ($action ==
'setref_client' && $user->rights->commande->creer) {
98 $result = $object->set_ref_client($user,
GETPOST(
'ref_client'));
105 if ($action ==
'setdatedelivery' && $user->rights->commande->creer)
108 $datedelivery =
dol_mktime(
GETPOST(
'liv_hour',
'int'),
GETPOST(
'liv_min',
'int'), 0,
GETPOST(
'liv_month',
'int'),
GETPOST(
'liv_day',
'int'),
GETPOST(
'liv_year',
'int'));
111 $result = $object->setDeliveryDate($user, $datedelivery);
127 if ($action ==
'setmode' && $user->rights->commande->creer)
131 $result = $object->setPaymentMethods(
GETPOST(
'mode_reglement_id',
'int'));
136 if ($action ==
'setavailability' && $user->rights->commande->creer) {
139 $result = $object->availability(
GETPOST(
'availability_id'));
144 if ($action ==
'setdemandreason' && $user->rights->commande->creer) {
147 $result = $object->demand_reason(
GETPOST(
'demand_reason_id'));
152 if ($action ==
'setconditions' && $user->rights->commande->creer)
156 $result = $object->setPaymentTerms(
GETPOST(
'cond_reglement_id',
'int'));
162 elseif ($action ==
'set_incoterms' && !empty($conf->incoterm->enabled))
164 $result = $object->setIncoterms(
GETPOST(
'incoterm_id',
'int'),
GETPOST(
'location_incoterms',
'alpha'));
171 if ($action ==
'setshippingmethod' && $user->rights->commande->creer) {
174 $result = $object->setShippingMethod(
GETPOST(
'shipping_method_id',
'int'));
180 if ($action ==
'setwarehouse' && $user->rights->commande->creer) {
183 $result = $object->setWarehouse(
GETPOST(
'warehouse_id',
'int'));
188 if ($action ==
'update_extras')
193 $ret = $extrafields->setOptionalsFromPost(null, $object,
GETPOST(
'attribute',
'restricthtml'));
194 if ($ret < 0) $error++;
199 $result = $object->insertExtraFields(
'SHIPMENT_MODIFY');
208 $action =
'edit_extras';
211 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';
227 $form =
new Form($db);
230 if (!empty($conf->projet->enabled)) { $formproject =
new FormProjets($db); }
232 llxHeader(
'', $langs->trans(
'OrderCard'),
'');
235 if ($id > 0 || !empty($ref))
238 if ($object->fetch($id, $ref) > 0)
240 $object->loadExpeditions(1);
242 $product_static =
new Product($db);
245 $soc->fetch($object->socid);
247 $author =
new User($db);
248 $author->fetch($object->user_author_id);
250 $res = $object->fetch_optionals();
259 if ($action ==
'cloture')
261 $formconfirm = $form->formconfirm(
$_SERVER[
'PHP_SELF'].
"?id=".$id, $langs->trans(
"CloseShipment"), $langs->trans(
"ConfirmCloseShipment"),
"confirm_cloture");
265 $parameters = array(
'formConfirm' => $formconfirm);
266 $reshook = $hookmanager->executeHooks(
'formConfirm', $parameters, $object, $action);
267 if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
268 elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
276 $linkback = '<a href="'.DOL_URL_ROOT.'/commande/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '?socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
279 $morehtmlref = '<div class="refidno">';
281 $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, '
string', '', 0, 1);
282 $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, '
string', '', null, null, '', 1);
284 $morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$soc->getNomUrl(1);
286 if (!empty($conf->projet->enabled))
288 $langs->load(
"projects");
289 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
290 if ($user->rights->commande->creer)
292 if ($action !=
'classify') {
293 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
295 if ($action ==
'classify') {
297 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
298 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
299 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
300 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
301 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
302 $morehtmlref .=
'</form>';
304 $morehtmlref .= $form->form_project(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
307 if (!empty($object->fk_project)) {
309 $proj->fetch($object->fk_project);
310 $morehtmlref .=
'<a href="'.DOL_URL_ROOT.
'/projet/card.php?id='.$object->fk_project.
'" title="'.$langs->trans(
'ShowProject').
'">';
311 $morehtmlref .= $proj->ref;
312 $morehtmlref .=
'</a>';
318 $morehtmlref .=
'</div>';
321 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
324 print '<div class="fichecenter">';
325 print '<div class="fichehalfleft">';
326 print '<div class="underbanner clearboth"></div>';
328 print '<table class="border centpercent tableforfield">';
331 if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
332 $filterabsolutediscount =
"fk_facture_source IS NULL";
333 $filtercreditnote =
"fk_facture_source IS NOT NULL";
335 $filterabsolutediscount =
"fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')";
336 $filtercreditnote =
"fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
339 print '<tr><td class="titlefield">'.$langs->trans(
'Discounts').
'</td><td colspan="3">';
341 $absolute_discount = $soc->getAvailableDiscounts(
'', $filterabsolutediscount);
342 $absolute_creditnote = $soc->getAvailableDiscounts(
'', $filtercreditnote);
343 $absolute_discount =
price2num($absolute_discount,
'MT');
344 $absolute_creditnote =
price2num($absolute_creditnote,
'MT');
348 $backtopage = urlencode(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id);
349 $cannotApplyDiscount = 1;
350 include DOL_DOCUMENT_ROOT.
'/core/tpl/object_discounts.tpl.php';
354 print '<tr><td>'.$langs->trans(
'Date').
'</td>';
355 print '<td colspan="2">';
357 if ($object->hasDelay() && empty($object->delivery_date)) {
358 print ' '.img_picto($langs->trans(
"Late").
' : '.$object->showDelay(),
"warning");
364 print '<tr><td height="10">';
365 print '<table class="nobordernopadding" width="100%"><tr><td>';
366 print $langs->trans(
'DateDeliveryPlanned');
369 if ($action !=
'editdate_livraison')
print '<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editdate_livraison&id='.$object->id.
'">'.
img_edit($langs->trans(
'SetDeliveryDate'), 1).
'</a></td>';
370 print '</tr></table>';
371 print
'</td><td colspan="2">';
372 if ($action ==
'editdate_livraison')
374 print
'<form name="setdate_livraison" action="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'" method="post">';
375 print
'<input type="hidden" name="token" value="'.newToken().
'">';
376 print
'<input type="hidden" name="action" value="setdatedelivery">';
377 print $form->selectDate($object->delivery_date ? $object->delivery_date : -1,
'liv_', 1, 1,
'',
"setdate_livraison", 1, 0);
378 print
'<input type="submit" class="button" value="'.$langs->trans(
'Modify').
'">';
382 if ($object->hasDelay() && !empty($object->delivery_date)) {
383 print
' '.img_picto($langs->trans(
"Late").
' : '.$object->showDelay(),
"warning");
395 print
'<table width="100%" class="nobordernopadding"><tr><td>';
396 print $langs->trans(
'SendingMethod');
398 if ($action !=
'editshippingmethod' && $user->rights->expedition->creer)
399 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editshippingmethod&id='.$object->id.
'">'.
img_edit($langs->trans(
'SetShippingMode'), 1).
'</a></td>';
400 print
'</tr></table>';
401 print
'</td><td colspan="2">';
402 if ($action ==
'editshippingmethod') {
403 $form->formSelectShippingMethod(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->shipping_method_id,
'shipping_method_id', 1);
405 $form->formSelectShippingMethod(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->shipping_method_id,
'none');
411 if (!empty($conf->stock->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
412 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
415 print
'<table width="100%" class="nobordernopadding"><tr><td>';
416 print $langs->trans(
'Warehouse');
418 if ($action !=
'editwarehouse' && $user->rights->commande->creer)
419 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editwarehouse&id='.$object->id.
'">'.
img_edit($langs->trans(
'SetWarehouse'), 1).
'</a></td>';
420 print
'</tr></table>';
421 print
'</td><td colspan="2">';
422 if ($action ==
'editwarehouse') {
423 $formproduct->formSelectWarehouses(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->warehouse_id,
'warehouse_id', 1);
425 $formproduct->formSelectWarehouses(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->warehouse_id,
'none');
470 print
'<tr><td height="10">';
471 print
'<table class="nobordernopadding" width="100%"><tr><td>';
472 print $langs->trans(
'AvailabilityPeriod');
474 if ($action !=
'editavailability')
475 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editavailability&id='.$object->id.
'">'.
img_edit($langs->trans(
'SetAvailability'), 1).
'</a></td>';
476 print
'</tr></table>';
477 print
'</td><td colspan="3">';
478 if ($action ==
'editavailability') {
479 $form->form_availability(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->availability_id,
'availability_id', 1);
481 $form->form_availability(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->availability_id,
'none', 1);
486 print
'<tr><td height="10">';
487 print
'<table class="nobordernopadding" width="100%"><tr><td>';
488 print $langs->trans(
'Source');
490 if ($action !=
'editdemandreason')
491 print
'<td class="right"><a class="editfielda" href="'.$_SERVER[
"PHP_SELF"].
'?action=editdemandreason&id='.$object->id.
'">'.
img_edit($langs->trans(
'SetDemandReason'), 1).
'</a></td>';
492 print
'</tr></table>';
493 print
'</td><td colspan="3">';
494 if ($action ==
'editdemandreason') {
495 $form->formInputReason(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->demand_reason_id,
'demand_reason_id', 1);
497 $form->formInputReason(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->demand_reason_id,
'none');
500 $tmparray = $object->getTotalWeightVolume();
501 $totalWeight = $tmparray[
'weight'];
502 $totalVolume = $tmparray[
'volume'];
503 if ($totalWeight || $totalVolume)
505 print
'<tr><td>'.$langs->trans(
"CalculatedWeight").
'</td>';
507 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');
509 print
'<tr><td>'.$langs->trans(
"CalculatedVolume").
'</td>';
511 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');
518 if (!empty($conf->incoterm->enabled))
521 print
'<table width="100%" class="nobordernopadding"><tr><td>';
522 print $langs->trans(
'IncotermLabel');
523 print
'<td><td class="right">';
524 if ($user->rights->commande->creer) print
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'/expedition/shipment.php?id='.$object->id.
'&action=editincoterm">'.
img_edit().
'</a>';
526 print
'</td></tr></table>';
528 print
'<td colspan="3">';
529 if ($action !=
'editincoterm')
531 print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
533 print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms :
''), (!empty($object->location_incoterms) ? $object->location_incoterms :
''),
$_SERVER[
'PHP_SELF'].
'?id='.$object->id);
539 $extrafields->fetch_name_optionals_label($expe->table_element);
543 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
548 print
'<div class="fichehalfright">';
549 print
'<div class="ficheaddleft">';
550 print
'<div class="underbanner clearboth"></div>';
552 print
'<table class="border centpercent tableforfield">';
554 if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency))
557 print
'<tr><td class="titlefieldmiddle">'.$form->editfieldkey(
'MulticurrencyAmountHT',
'multicurrency_total_ht',
'', $object, 0).
'</td>';
558 print
'<td class="nowrap">'.price($object->multicurrency_total_ht,
'', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).
'</td>';
562 print
'<tr><td>'.$form->editfieldkey(
'MulticurrencyAmountVAT',
'multicurrency_total_tva',
'', $object, 0).
'</td>';
563 print
'<td class="nowrap">'.price($object->multicurrency_total_tva,
'', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).
'</td>';
567 print
'<tr><td>'.$form->editfieldkey(
'MulticurrencyAmountTTC',
'multicurrency_total_ttc',
'', $object, 0).
'</td>';
568 print
'<td class="nowrap">'.price($object->multicurrency_total_ttc,
'', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).
'</td>';
573 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
'AmountHT').
'</td>';
574 print
'<td>'.price($object->total_ht, 0,
'', 1, -1, -1, $conf->currency).
'</td>';
578 print
'<tr><td>'.$langs->trans(
'AmountVAT').
'</td><td>'.
price($object->total_tva, 0,
'', 1, -1, -1, $conf->currency).
'</td>';
582 if ($mysoc->localtax1_assuj ==
"1" || $object->total_localtax1 != 0)
584 print
'<tr><td>'.$langs->transcountry(
"AmountLT1", $mysoc->country_code).
'</td>';
585 print
'<td>'.price($object->total_localtax1, 1,
'', 1, - 1, - 1, $conf->currency).
'</td></tr>';
587 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>';
603 print
'<div class="clearboth"></div><br>';
611 print
'<table class="noborder noshadow" width="100%">';
613 $sql =
"SELECT cd.rowid, cd.fk_product, cd.product_type as type, cd.label, cd.description,";
614 $sql .=
" cd.price, cd.tva_tx, cd.subprice,";
616 $sql .=
' cd.date_start,';
617 $sql .=
' cd.date_end,';
618 $sql .=
' cd.special_code,';
619 $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,';
620 $sql .=
' p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units,';
621 $sql .=
' p.surface, p.surface_units, p.volume, p.volume_units';
622 $sql .=
" FROM ".MAIN_DB_PREFIX.
"commandedet as cd";
623 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON cd.fk_product = p.rowid";
624 $sql .=
" WHERE cd.fk_commande = ".$object->id;
625 $sql .=
" ORDER BY cd.rang, cd.rowid";
629 $resql = $db->query($sql);
632 $num = $db->num_rows(
$resql);
635 print
'<tr class="liste_titre">';
636 print
'<td>'.$langs->trans(
"Description").
'</td>';
637 print
'<td class="center">'.$langs->trans(
"QtyOrdered").
'</td>';
638 print
'<td class="center">'.$langs->trans(
"QtyShipped").
'</td>';
639 print
'<td class="center">'.$langs->trans(
"KeepToShip").
'</td>';
640 if (!empty($conf->stock->enabled))
642 print
'<td class="center">'.$langs->trans(
"RealStock").
'</td>';
644 print
'<td> </td>';
648 $toBeShipped = array();
649 $toBeShippedTotal = 0;
652 $objp = $db->fetch_object(
$resql);
654 $parameters = array(
'i' => $i,
'line' => $objp,
'num' => $num);
655 $reshook = $hookmanager->executeHooks(
'printObjectLine', $parameters, $object, $action);
656 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
661 $type = isset($objp->type) ? $objp->type : $objp->product_type;
665 if (!empty($objp->date_start)) $type = 1;
666 if (!empty($objp->date_end)) $type = 1;
668 print
'<tr class="oddeven">';
671 if ($objp->fk_product > 0)
674 if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
676 $object->fetch_thirdparty();
679 $prod->id = $objp->fk_product;
680 $prod->entity = $objp->entity;
681 $prod->getMultiLangs();
683 $outputlangs = $langs;
685 if (empty($newlang) && !empty($_REQUEST[
'lang_id'])) $newlang = $_REQUEST[
'lang_id'];
686 if (empty($newlang)) $newlang = $object->thirdparty->default_lang;
687 if (!empty($newlang))
690 $outputlangs->setDefaultLang($newlang);
693 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $objp->product_label;
694 }
else $label = (!empty($objp->label) ? $objp->label : $objp->product_label);
697 print
'<a name="'.$objp->rowid.
'"></a>';
700 $product_static->type = $type;
701 $product_static->id = $objp->fk_product;
702 $product_static->ref = $objp->ref;
703 $product_static->entity = $objp->entity;
705 $product_static->weight = $objp->weight;
706 $product_static->weight_units = $objp->weight_units;
707 $product_static->length = $objp->length;
708 $product_static->length_units = $objp->length_units;
709 $product_static->width = $objp->width;
710 $product_static->width_units = $objp->width_units;
711 $product_static->height = $objp->height;
712 $product_static->height_units = $objp->height_units;
713 $product_static->surface = $objp->surface;
714 $product_static->surface_units = $objp->surface_units;
715 $product_static->volume = $objp->volume;
716 $product_static->volume_units = $objp->volume_units;
718 $text = $product_static->getNomUrl(1);
719 $text .=
' - '.$label;
720 $description = ($conf->global->PRODUIT_DESC_IN_FORM ?
'' :
dol_htmlentitiesbr($objp->description)).
'<br>';
721 $description .= $product_static->show_photos(
'product', $conf->product->multidir_output[$product_static->entity], 1, 1, 0, 0, 0, 80);
722 print $form->textwithtooltip($text, $description, 3,
'',
'', $i);
725 print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end));
728 if (!empty($conf->global->PRODUIT_DESC_IN_FORM))
730 print ($objp->description && $objp->description != $objp->product_label) ?
'<br>'.dol_htmlentitiesbr($objp->description) :
'';
736 if ($type == 1) $text =
img_object($langs->trans(
'Service'),
'service');
737 else $text =
img_object($langs->trans(
'Product'),
'product');
739 if (!empty($objp->label)) {
740 $text .=
' <strong>'.$objp->label.
'</strong>';
741 print $form->textwithtooltip($text, $objp->description, 3,
'',
'', $i);
743 print $text.
' '.nl2br($objp->description);
747 print_date_range($db->jdate($objp->date_start), $db->jdate($objp->date_end));
752 print
'<td class="center">'.$objp->qty.
'</td>';
755 $qtyProdCom = $objp->qty;
756 print
'<td class="center">';
758 $qtyAlreadyShipped = (!empty($object->expeditions[$objp->rowid]) ? $object->expeditions[$objp->rowid] : 0);
759 print $qtyAlreadyShipped;
763 print
'<td class="center">';
764 if ($type == 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES))
766 $toBeShipped[$objp->fk_product] = $objp->qty - $qtyAlreadyShipped;
767 $toBeShippedTotal += $toBeShipped[$objp->fk_product];
768 print $toBeShipped[$objp->fk_product];
770 print
'0 ('.$langs->trans(
"Service").
')';
774 if ($objp->fk_product > 0)
777 $product->fetch($objp->fk_product);
778 $product->load_stock(
'warehouseopen');
781 if ($objp->fk_product > 0 && ($type ==
Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) && !empty($conf->stock->enabled))
783 print
'<td class="center">';
784 print $product->stock_reel;
785 if ($product->stock_reel < $toBeShipped[$objp->fk_product])
787 print
' '.img_warning($langs->trans(
"StockTooLow"));
791 print
'<td> </td>';
796 if ($objp->fk_product > 0 && !empty($conf->global->PRODUIT_SOUSPRODUITS))
799 $product->get_sousproduits_arbo();
803 $prods_arbo = $product->get_arbo_each_prod($qtyProdCom);
805 if (count($prods_arbo) > 0)
807 foreach ($prods_arbo as $key => $value)
810 if ($value[
'stock'] < $value[
'stock_alert'])
814 print
'<tr class="oddeven"><td> -> <a href="'.DOL_URL_ROOT.
"/product/card.php?id=".$value[
'id'].
'">'.$value[
'fullpath'].
'</a> ('.$value[
'nb'].
')</td>';
815 print
'<td class="center"> '.$value[
'nb_total'].
'</td>';
816 print
'<td> </td>';
817 print
'<td> </td>';
818 print
'<td class="center">'.$value[
'stock'].
' '.$img.
'</td></tr>'.
"\n";
829 print
'<tr '.$bc[
false].
'><td colspan="5">'.$langs->trans(
"NoArticleOfTypeProduct").
'<br>';
844 if (empty($user->socid))
846 print
'<div class="tabsAction">';
851 if ($user->rights->expedition->creer)
853 print
'<a class="butAction" href="'.DOL_URL_ROOT.
'/expedition/card.php?action=create&origin=commande&object_id='.$id.
'">'.$langs->trans(
"CreateShipment").
'</a>';
854 if ($toBeShippedTotal <= 0)
856 print
' '.img_warning($langs->trans(
"WarningNoQtyLeftToSend"));
859 print
'<a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"CreateShipment").
'</a>';
870 print $langs->trans(
"ValidateOrderFirstBeforeShipment");
875 if ($user->rights->expedition->creer)
878 print
'<div class="tabsAction">';
880 print
'<form method="GET" action="'.DOL_URL_ROOT.
'/expedition/card.php">';
881 print
'<input type="hidden" name="action" value="create">';
883 print
'<input type="hidden" name="shipping_method_id" value="'.$object->shipping_method_id.
'">';
884 print
'<input type="hidden" name="origin" value="commande">';
885 print
'<input type="hidden" name="origin_id" value="'.$object->id.
'">';
886 print
'<input type="hidden" name="projectid" value="'.$object->fk_project.
'">';
889 $langs->load(
"stocks");
893 if (!empty($conf->stock->enabled))
896 print $langs->trans(
"WarehouseSource");
899 print $formproduct->selectWarehouses(!empty($object->warehouse_id) ? $object->warehouse_id :
'ifone',
'entrepot_id',
'', 1, 0, 0,
'', 0, 0, array(),
'minwidth200');
900 if (count($formproduct->cache_warehouses) <= 0)
902 print
' '.$langs->trans(
"WarehouseSourceNotDefined").
' <a href="'.DOL_URL_ROOT.
'/product/stock/card.php?action=create">'.$langs->trans(
"AddOne").
'</a>';
907 print
'<input type="submit" class="butAction" named="save" value="'.$langs->trans(
"CreateShipment").
'">';
908 if ($toBeShippedTotal <= 0)
910 print
' '.img_warning($langs->trans(
"WarningNoQtyLeftToSend"));
921 print
'<div class="tabsAction">';
922 print
'<a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"CreateShipment").
'</a>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
const STATUS_CLOSED
Closed (Sent, billed or not)
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...
Class to manage products or services.
Class to manage Dolibarr users.
dol_clone($object, $native=0)
Create a clone of instance of object (new instance with same value for properties) With native = 0: P...
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...
show_list_sending_receive($origin, $origin_id, $filter= '')
List sendings and receive receipts.
const TYPE_PRODUCT
Regular product.
img_warning($titlealt= 'default', $moreatt= '', $morecss= 'pictowarning')
Show warning logo.
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...
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage projects.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput= 'no')
Output a dimension with best unit.
Class to manage shipments.
Class to manage customers orders.
const STATUS_DRAFT
Draft status.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
Class to manage translations.
commande_prepare_head(Commande $object)
Prepare array with list of tabs.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
print_date_range($date_start, $date_end, $format= '', $outputlangs= '')
Format output for start and end date.
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.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.