diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index fa1fe0872ed..df0d5f64851 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2009 Laurent Destailleur + * Copyright (C) 2005-2010 Laurent Destailleur * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2005-2010 Regis Houssin * @@ -28,16 +28,16 @@ */ require("../main.inc.php"); -require_once(DOL_DOCUMENT_ROOT."/expedition/expedition.class.php"); +require_once(DOL_DOCUMENT_ROOT."/expedition/class/expedition.class.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/expedition/pdf/ModelePdfExpedition.class.php"); -require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); -require_once(DOL_DOCUMENT_ROOT."/product/html.formproduct.class.php"); +require_once(DOL_DOCUMENT_ROOT."/core/class/html.formfile.class.php"); +require_once(DOL_DOCUMENT_ROOT."/product/class/html.formproduct.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/product.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/sendings.lib.php"); -if ($conf->produit->enabled || $conf->service->enabled) require_once(DOL_DOCUMENT_ROOT."/product/product.class.php"); -if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/comm/propal/propal.class.php"); -if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); -if ($conf->stock->enabled) require_once(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php"); +if ($conf->product->enabled || $conf->service->enabled) require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); +if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php"); +if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"); +if ($conf->stock->enabled) require_once(DOL_DOCUMENT_ROOT."/product/stock/class/entrepot.class.php"); $langs->load("sendings"); $langs->load("companies"); @@ -48,12 +48,12 @@ $langs->load('stocks'); $langs->load('other'); $langs->load('propal'); -$origin = "expedition"; -$origin_id = isset($_GET["id"])?$_GET["id"]:''; -$id = $origin_id; -$origin = $_GET["origin"]?$_GET["origin"]:$_POST["origin"]; // Example: commande, propal -$origin_id = $_GET["origin_id"]?$_GET["origin_id"]:$_POST["origin_id"]; // Id of order or propal +$origin = $_GET["origin"]?$_GET["origin"]:$_POST["origin"]; // Example: commande, propal +$origin_id = isset($_REQUEST["id"])?$_REQUEST["id"]:''; +if (empty($origin_id)) $origin_id = $_GET["origin_id"]?$_GET["origin_id"]:$_POST["origin_id"]; // Id of order or propal +if (empty($origin_id)) $origin_id = $_GET["object_id"]?$_GET["object_id"]:$_POST["object_id"]; // Id of order or propal +$id = $origin_id; // Security check @@ -72,7 +72,6 @@ if ($_POST["action"] == 'add') // Creation de l'objet expedition $expedition = new Expedition($db); - $expedition->date_expedition = time(); $expedition->note = $_POST["note"]; $expedition->origin = $origin; $expedition->origin_id = $origin_id; @@ -83,8 +82,8 @@ if ($_POST["action"] == 'add') $expedition->size_units = $_POST["size_units"]; $expedition->weight_units = $_POST["weight_units"]; - // On boucle sur chaque ligne du document d'origine pour completer objet expedition - // avec qte a livrer + // On va boucler sur chaque ligne du document d'origine pour completer objet expedition + // avec info diverses + qte a livrer $classname = ucfirst($expedition->origin); $object = new $classname($db); $object->fetch($expedition->origin_id); @@ -92,19 +91,21 @@ if ($_POST["action"] == 'add') $expedition->socid = $object->socid; $expedition->ref_customer = $object->ref_client; - $expedition->date_delivery = $object->date_livraison; + $expedition->date_delivery = $object->date_livraison; // Date delivery planed $expedition->fk_delivery_address = $object->fk_delivery_address; $expedition->expedition_method_id = $_POST["expedition_method_id"]; $expedition->tracking_number = $_POST["tracking_number"]; + //var_dump($_POST);exit; for ($i = 0 ; $i < sizeof($object->lignes) ; $i++) { - $ent = "entl".$i; - $idl = "idl".$i; $qty = "qtyl".$i; - $entrepot_id = $_POST[$ent]?$_POST[$ent]:$_POST["entrepot_id"]; if ($_POST[$qty] > 0) { + $ent = "entl".$i; + $idl = "idl".$i; + $entrepot_id = isset($_POST[$ent])?$_POST[$ent]:$_POST["entrepot_id"]; + $expedition->addline($entrepot_id,$_POST[$idl],$_POST[$qty]); } } @@ -126,7 +127,7 @@ if ($_POST["action"] == 'add') } /* - * Genere un bon de livraison + * Build a receiving receipt */ if ($_GET["action"] == 'create_delivery' && $conf->livraison_bon->enabled && $user->rights->expedition->livraison->creer) { @@ -189,6 +190,72 @@ if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == 'yes') } } +if ($_REQUEST["action"] == 'open') +{ + if ($user->rights->expedition->valider ) + { + $expedition = new Expedition($db); + $expedition->fetch($_GET["id"]); + $result = $expedition->setStatut(0); + if ($result < 0) + { + $mesg = $expedition->error; + } + } +} + +if ($_POST['action'] == 'setdate_livraison' && $user->rights->expedition->creer) +{ + //print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; + $datelivraison=dol_mktime(0, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year']); + + $shipping = new Expedition($db); + $shipping->fetch($_GET['id']); + $result=$shipping->set_date_livraison($user,$datelivraison); + if ($result < 0) + { + $mesg='
'.$shipping->error.'
'; + } +} + +// Action update description of emailing +if ($_REQUEST["action"] == 'settrackingnumber' || $_REQUEST["action"] == 'settrackingurl' +|| $_REQUEST["action"] == 'settrueWeight' +|| $_REQUEST["action"] == 'settrueWidth' +|| $_REQUEST["action"] == 'settrueHeight' +|| $_REQUEST["action"] == 'settrueDepth' +|| $_REQUEST["action"] == 'setexpedition_method_id') +{ + $error=0; + + $shipping = new Expedition($db); + $result=$shipping->fetch($_REQUEST['id']); + if ($result < 0) dol_print_error($db,$shipping->error); + + if ($_REQUEST["action"] == 'settrackingnumber') $shipping->tracking_number = trim($_REQUEST["trackingnumber"]); + if ($_REQUEST["action"] == 'settrackingurl') $shipping->tracking_url = trim($_REQUEST["trackingurl"]); + if ($_REQUEST["action"] == 'settrueWeight') $shipping->trueWeight = trim($_REQUEST["trueWeight"]); + if ($_REQUEST["action"] == 'settrueWidth') $shipping->trueWidth = trim($_REQUEST["trueWidth"]); + if ($_REQUEST["action"] == 'settrueHeight') $shipping->trueHeight = trim($_REQUEST["trueHeight"]); + if ($_REQUEST["action"] == 'settrueDepth') $shipping->trueDepth = trim($_REQUEST["trueDepth"]); + if ($_REQUEST["action"] == 'setexpedition_method_id') $shipping->expedition_method_id = trim($_REQUEST["expedition_method_id"]); + + if (! $error) + { + if ($shipping->update($user) >= 0) + { + Header("Location: fiche.php?id=".$shipping->id); + exit; + } + $mesg=$shipping->error; + } + + $mesg='
'.$mesg.'
'; + $_GET["action"]=""; + $_GET["id"]=$_REQUEST["id"]; +} + + /* * Build doc */ @@ -242,7 +309,6 @@ $formproduct = new FormProduct($db); *********************************************************************/ if ($_GET["action"] == 'create') { - $expe = new Expedition($db); print_fiche_titre($langs->trans("CreateASending")); @@ -262,21 +328,22 @@ if ($_GET["action"] == 'create') $object = new $classname($db); - if ($object->fetch($origin_id)) + if ($object->fetch($origin_id)) // This include the fetch_lines { + //var_dump($object); + $soc = new Societe($db); $soc->fetch($object->socid); $author = new User($db); - $author->id = $object->user_author_id; - $author->fetch(); + $author->fetch($object->user_author_id); if ($conf->stock->enabled) $entrepot = new Entrepot($db); /* * Document source */ - print '
'; + print ''; print ''; print ''; print ''; @@ -290,13 +357,13 @@ if ($_GET["action"] == 'create') // Ref print ''; - if ($conf->commande->enabled) + if ($origin == 'commande' && $conf->commande->enabled) { print $langs->trans("RefOrder").''.img_object($langs->trans("ShowOrder"),'order').' '.$object->ref; } - else + if ($origin == 'propal' && $conf->propal->enabled) { - print $langs->trans("RefProposal").''.img_object($langs->trans("ShowProposal"),'propal').' '.$object->ref; + print $langs->trans("RefProposal").''.img_object($langs->trans("ShowProposal"),'propal').' '.$object->ref; } print ''; print "\n"; @@ -313,13 +380,12 @@ if ($_GET["action"] == 'create') print ''.$soc->getNomUrl(1).''; print ''; - // Date - print "".$langs->trans("Date").""; - print ''.dol_print_date($object->date,"day")."\n"; - // Date delivery planned print ''.$langs->trans("DateDeliveryPlanned").''; - print ''.dol_print_date($object->date_livraison,'day')."\n"; + print ''; + print dol_print_date($object->date_livraison,"day"); + //$html->select_date($object->date_livraison,'date_delivery'); + print "\n"; print ''; // Delivery address @@ -330,53 +396,44 @@ if ($_GET["action"] == 'create') print ''; if (!empty($object->fk_delivery_address)) { - $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$_GET['socid'],'none','commande',$object->id); + $html->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$_GET['socid'],'none','commande',$object->id); } print ''."\n"; } - // Warehouse (id forced) - if ($conf->stock->enabled && $_GET["entrepot_id"]) - { - print ''.$langs->trans("Warehouse").''; - print ''; - $ents = $entrepot->list_array(); - print ''.img_object($langs->trans("ShowWarehouse"),'stock').' '.$ents[$_GET["entrepot_id"]].''; - print ''; - } - if ($object->note && ! $user->societe_id) { - print ''.$langs->trans("NotePrivate").': '.nl2br($object->note).""; + print ''.$langs->trans("NotePrivate").''; + print ''.nl2br($object->note).""; } print ''; print $langs->trans("Weight"); - print ''; - print $formproduct->select_measuring_units("weight_units","weight"); + print ''; + print $formproduct->select_measuring_units("weight_units","weight",$_POST["weight_units"]); print ''; print $langs->trans("Width"); - print ' '; - print ' '; - print $langs->trans("Height"); - print ''; + print ' '; print $formproduct->select_measuring_units("size_units","size"); print ''; + print $langs->trans("Height"); + print ''; + print ''; print $langs->trans("Depth"); - print ''; - print ' '; + print ''; + print ''; // Delivery method print "".$langs->trans("DeliveryMethod").""; print ''; $expe->fetch_delivery_methods(); - $html->select_array("expedition_method_id",$expe->meths,'',1,0,0,0,"",1); + $html->select_array("expedition_method_id",$expe->meths,$_POST["expedition_method_id"],1,0,0,0,"",1); print "\n"; // Tracking number print "".$langs->trans("TrackingNumber").""; print ''; - print ''; + print ''; print "\n"; print ""; @@ -399,21 +456,16 @@ if ($_GET["action"] == 'create') print ''.$langs->trans("Description").''; print ''.$langs->trans("QtyOrdered").''; print ''.$langs->trans("QtyShipped").''; - print ''.$langs->trans("QtyToShip").''; + print ''.$langs->trans("QtyToShip").''; if ($conf->stock->enabled) { - if ($_GET["entrepot_id"]) - { - print ''.$langs->trans("Stock").''; - } - else - { - print ''.$langs->trans("Warehouse").''; - } + print ''.$langs->trans("Warehouse").' / '.$langs->trans("Stock").''; } print "\n"; } + $product_static = new Product($db); + $var=true; $indiceAsked = 0; while ($indiceAsked < $numAsked) @@ -422,37 +474,63 @@ if ($_GET["action"] == 'create') $line = $object->lines[$indiceAsked]; $var=!$var; + + // Show product and description + $type=$line->product_type?$line->product_type:$line->fk_product_type; + // Try to enhance type detection using date_start and date_end for free lines where type + // was not saved. + if (! empty($line->date_start)) $type=1; + if (! empty($line->date_end)) $type=1; + print "\n"; - // Desc + // Product label if ($line->fk_product > 0) { $product->fetch($line->fk_product); + $product->load_stock(); print ''; - print ''; - if ($line->product_type == 1) + print ''; // ancre pour retourner sur la ligne + + // Show product and description + $product_static->type=$line->fk_product_type; + $product_static->id=$line->fk_product; + $product_static->ref=$line->ref; + $product_static->libelle=$line->product_label; + $text=$product_static->getNomUrl(1); + $text.= ' - '.$line->product_label; + $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->desc)); + print $html->textwithtooltip($text,$description,3,'','',$i); + + // Show range + print_date_range($db->jdate($line->date_start),$db->jdate($line->date_end)); + + // Add description in form + if ($conf->global->PRODUIT_DESC_IN_FORM) { - print img_object($langs->trans("ShowService"),"service"); + print ($line->desc && $line->desc!=$line->product_label)?'
'.dol_htmlentitiesbr($line->desc):''; } - else - { - print img_object($langs->trans("ShowProduct"),"product"); - } - print ' '.$product->ref.' - '.$product->libelle; - if ($line->desc) print '
'.dol_nl2br(dol_htmlcleanlastbr($line->desc),1); + print ''; } else - { //var_dump($ligne); - print "".nl2br($line->desc)."\n"; + { + print ""; + if ($type==1) $text = img_object($langs->trans('Service'),'service'); + else $text = img_object($langs->trans('Product'),'product'); + print $text.' '.nl2br($line->desc); + + // Show range + print_date_range($db->jdate($line->date_start),$db->jdate($line->date_end)); + print "\n"; } // Qty print ''.$line->qty.''; $qtyProdCom=$line->qty; - // Sendings + // Qty already sent print ''; $quantityDelivered = $object->expeditions[$line->id]; print $quantityDelivered; @@ -461,81 +539,63 @@ if ($_GET["action"] == 'create') $quantityAsked = $line->qty; $quantityToBeDelivered = $quantityAsked - $quantityDelivered; - if ($conf->stock->enabled && $line->product_type == 0) + $defaultqty=0; + if ($_REQUEST["entrepot_id"]) { - $defaultqty=0; - if ($_GET["entrepot_id"]) - { - $stock = $product->stock_entrepot[$_GET["entrepot_id"]]; - $stock+=0; // Convertit en numerique - $defaultqty=min($quantityToBeDelivered, $stock); - if ($defaultqty < 0) $defaultqty=0; - } + //var_dump($product); + $stock = $product->stock_warehouse[$_REQUEST["entrepot_id"]]->real; + $stock+=0; // Convertit en numerique + $defaultqty=min($quantityToBeDelivered, $stock); + if (($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) || $defaultqty < 0) $defaultqty=0; + } - // Quantity - print ''; + // Quantity to send + print ''; + if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) + { print ''; - print ''; - print ''; + print ''; + } + else print '0'; + print ''; - // Stock - if ($_GET["entrepot_id"]) + // Stock + if ($conf->stock->enabled) + { + print ''; + if ($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - print ''; - print $stock; - if ($stock < $quantityToBeDelivered) + // Show warehous + if ($_REQUEST["entrepot_id"]) { - print ' '.img_warning($langs->trans("StockTooLow")); - } - print ''; - } - else - { - $array=array(); - - $sql = "SELECT e.rowid, e.label, ps.reel"; - $sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps"; - $sql.= ", ".MAIN_DB_PREFIX."entrepot as e"; - $sql.= " WHERE ps.fk_entrepot = e.rowid"; - $sql.= " AND fk_product = '".$product->id."'"; - - $result = $db->query($sql) ; - if ($result) - { - $num = $db->num_rows($result); - $i=0; - if ($num > 0) + $formproduct->selectWarehouses($_REQUEST["entrepot_id"],'entl'.$indiceAsked,'',1,0,$line->fk_product); + //print $stock.' '.$quantityToBeDelivered; + //if ($stock >= 0 && $stock < $quantityToBeDelivered) + if ($stock < $quantityToBeDelivered) { - while ($i < $num) - { - $obj = $db->fetch_object($result); - $array[$obj->rowid] = $obj->label.' ('.$obj->reel.')'; - $i++; - } + print ' '.img_warning($langs->trans("StockTooLow")); } - $db->free($result); } else { - $this->error=$db->error(); - return -1; + $formproduct->selectWarehouses('','entl'.$indiceAsked,'',1,0,$line->fk_product); } - - print ''; - $html->select_array('entl'.$i,$array,'',1,0,0); - print ''; } - + else + { + print $langs->trans("Service"); + } + print ''; } - else + /*else { // Quantity print ''; print ''; - print ''; + print ''; print ''; if ($line->product_type == 1) print ' '; - } + }*/ print "\n"; @@ -582,10 +642,10 @@ else /* */ /* *************************************************************************** */ { - if ($_GET["id"] > 0) + if (! empty($_REQUEST["id"]) || ! empty($_REQUEST["ref"])) { $expedition = new Expedition($db); - $result = $expedition->fetch($_GET["id"]); + $result = $expedition->fetch($_REQUEST["id"],$_REQUEST["ref"]); if ($result < 0) { dol_print_error($db,$expedition->error); @@ -673,7 +733,9 @@ else // Ref print ''.$langs->trans("Ref").''; - print ''.$expedition->ref.''; + print ''; + print $html->showrefnav($expedition,'ref','',1,'ref','ref'); + print ''; // Customer print ''.$langs->trans("Customer").''; @@ -709,14 +771,34 @@ else print ''.$expedition->ref_customer."\n"; print ''; - // Date - print ''.$langs->trans("Date").''; - print ''.dol_print_date($expedition->date,"daytext")."\n"; + // Date creation + print ''.$langs->trans("DateCreation").''; + print ''.dol_print_date($expedition->date_creation,"daytext")."\n"; print ''; - // Date delivery planned - print ''.$langs->trans("DateDeliveryPlanned").''; - print ''.dol_print_date($expedition->date_delivery,'daytext')."\n"; + // Delivery date planed + print ''; + print ''; + + if ($_GET['action'] != 'editdate_livraison') print ''; + print '
'; + print $langs->trans('DateDeliveryPlanned'); + print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'
'; + print ''; + if ($_GET['action'] == 'editdate_livraison') + { + print ''; + print ''; + print ''; + $html->select_date($expedition->date_delivery?$expedition->date_delivery:-1,'liv_','','','',"setdate_livraison"); + print ''; + print '
'; + } + else + { + print $expedition->date_delivery ? dol_print_date($expedition->date_delivery,'daytext') : ' '; + } + print ''; print ''; // Delivery address @@ -727,30 +809,19 @@ else print ''; if (!empty($expedition->fk_delivery_address)) { - $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?id='.$expedition->id,$expedition->fk_delivery_address,$expedition->deliveryaddress->socid,'none','shipment',$expedition->id); + $html->form_address($_SERVER['PHP_SELF'].'?id='.$expedition->id,$expedition->fk_delivery_address,$expedition->deliveryaddress->socid,'none','shipment',$expedition->id); } print ''."\n"; } // Weight - print ''.$langs->trans("TotalWeight").''; - print ''; - if ($expedition->trueWeight) - { - // If sending weigth defined - print $expedition->trueWeight.' '.measuring_units_string($expedition->weight_units,"weight"); - } - else - { - // If sending Weight not defined we use sum of products - // TODO Show in best unit - if ($totalWeight > 0) print $totalWeight.' '.measuring_units_string(0,"weight"); - else print ' '; - } + print ''.$html->editfieldkey("Weight",'trueWeight',$expedition->trueWeight,'id',$expedition->id,$user->rights->expedition->creer).''; + print $html->editfieldval("Weight",'trueWeight',$expedition->trueWeight,'id',$expedition->id,$user->rights->expedition->creer); + print $expedition->weight_units?measuring_units_string($expedition->weight_units,"weight"):''; print ''; // Volume Total - print ''.$langs->trans("TotalVolume").''; + print ''.$langs->trans("Volume").''; print ''; if ($expedition->trueVolume) { @@ -767,17 +838,23 @@ else print "\n"; print ''; - // Taille - print ''.$langs->trans("Size").''; - print ''; - if ($expedition->trueWidth || $expedition->trueHeight || $expedition->trueDepth) - { - // If sending size defined - print $expedition->trueSize.' '.measuring_units_string($expedition->size_units,"size"); - } - else print ' '; - print "\n"; - print ''; + // Width + print ''.$html->editfieldkey("Width",'trueWidth',$expedition->trueWidth,'id',$expedition->id,$user->rights->expedition->creer).''; + print $html->editfieldval("Width",'trueWidth',$expedition->trueWidth,'id',$expedition->id,$user->rights->expedition->creer); + print $expedition->trueWidth?measuring_units_string($expedition->width_units,"size"):''; + print ''; + + // Height + print ''.$html->editfieldkey("Height",'trueHeight',$expedition->trueHeight,'id',$expedition->id,$user->rights->expedition->creer).''; + print $html->editfieldval("Height",'trueHeight',$expedition->trueHeight,'id',$expedition->id,$user->rights->expedition->creer); + print $expedition->trueHeight?measuring_units_string($expedition->height_units,"size"):''; + print ''; + + // Depth + print ''.$html->editfieldkey("Depth",'trueDepth',$expedition->trueDepth,'id',$expedition->id,$user->rights->expedition->creer).''; + print $html->editfieldval("Depth",'trueDepth',$expedition->trueDepth,'id',$expedition->id,$user->rights->expedition->creer); + print $expedition->trueDepth?measuring_units_string($expedition->depth_units,"size"):''; + print ''; // Status print ''.$langs->trans("Status").''; @@ -785,26 +862,47 @@ else print ''; // Sending method - print ''.$langs->trans("SendingMethod").''; - print ''; - if ($expedition->expedition_method_id > 0) + print ''; + print ''; + + if ($_GET['action'] != 'editexpedition_method_id') print ''; + print '
'; + print $langs->trans('SendingMethod'); + print 'id.'">'.img_edit($langs->trans('SetSendingMethod'),1).'
'; + print ''; + if ($_GET['action'] == 'editexpedition_method_id') { - // Get code using getLabelFromKey - $code=$langs->getLabelFromKey($db,$expedition->expedition_method_id,'expedition_methode','rowid','code'); - print $langs->trans("SendingMethod".strtoupper($code)); + print '
'; + print ''; + print ''; + $expedition->fetch_delivery_methods(); + $html->select_array("expedition_method_id",$expedition->meths,$expedition->expedition_method_id,1,0,0,0,"",1); + print ''; + print '
'; + } + else + { + if ($expedition->expedition_method_id > 0) + { + // Get code using getLabelFromKey + $code=$langs->getLabelFromKey($db,$expedition->expedition_method_id,'expedition_methode','rowid','code'); + print $langs->trans("SendingMethod".strtoupper($code)); + } } - else print ' '; print ''; print ''; // Tracking Number - print ''.$langs->trans("TrackingNumber").''; - print ''.$expedition->tracking_number.''; + print ''.$html->editfieldkey("TrackingNumber",'trackingnumber',$expedition->tracking_number,'id',$expedition->id,$user->rights->expedition->creer).''; + print $html->editfieldval("TrackingNumber",'trackingnumber',$expedition->tracking_number,'id',$expedition->id,$user->rights->expedition->creer); + print ''; + if ($expedition->tracking_url) { - print ''.$expedition->tracking_url."\n"; + print ''.$html->editfieldkey("TrackingUrl",'trackingurl',$expedition->tracking_url,'id',$expedition->id,$user->rights->expedition->creer).''; + print $html->editfieldval("TrackingUrl",'trackingurl',$expedition->tracking_url,'id',$expedition->id,$user->rights->expedition->creer); + print ''; } - print ''; print "\n"; @@ -824,8 +922,9 @@ else print ''.$langs->trans("QtyShipped").''; } - print ''.$langs->trans("Weight").''; - print ''.$langs->trans("Volume").''; + print ''.$langs->trans("CalculatedWeight").''; + print ''.$langs->trans("CalculatedVolume").''; + //print ''.$langs->trans("Size").''; if ($conf->stock->enabled) { @@ -839,6 +938,7 @@ else { print ""; + // Predefined product or service if ($lignes[$i]->fk_product > 0) { print ''; @@ -874,18 +974,32 @@ else // Qte a expedier ou expedier print ''.$lignes[$i]->qty_shipped.''; - // Poids - print ''.$lignes[$i]->weight*$lignes[$i]->qty_shipped.' '.measuring_units_string($lignes[$i]->weight_units,"weight").''; + // Weight + print ''; + if ($lignes[$i]->fk_product_type == 0) print $lignes[$i]->weight*$lignes[$i]->qty_shipped.' '.measuring_units_string($lignes[$i]->weight_units,"weight"); + else print ' '; + print ''; // Volume - print ''.$lignes[$i]->volume*$lignes[$i]->qty_shipped.' '.measuring_units_string($lignes[$i]->volume_units,"volume").''; + print ''; + if ($lignes[$i]->fk_product_type == 0) print $lignes[$i]->volume*$lignes[$i]->qty_shipped.' '.measuring_units_string($lignes[$i]->volume_units,"volume"); + else print ' '; + print ''; + + // Size + //print ''.$lignes[$i]->volume*$lignes[$i]->qty_shipped.' '.measuring_units_string($lignes[$i]->volume_units,"volume").''; // Entrepot source if ($conf->stock->enabled) { - $entrepot = new Entrepot($db); - $entrepot->fetch($lignes[$i]->entrepot_id); - print ''.$entrepot->getNomUrl(1).''; + print ''; + if ($lignes[$i]->entrepot_id > 0) + { + $entrepot = new Entrepot($db); + $entrepot->fetch($lignes[$i]->entrepot_id); + print $entrepot->getNomUrl(1); + } + print ''; } @@ -908,6 +1022,11 @@ else { print '
'; + /*if ($expedition->statut > 0 && $user->rights->expedition->valider) + { + print ''.$langs->trans("Modify").''; + }*/ + if ($expedition->statut == 0 && $num_prod > 0) { if ($user->rights->expedition->valider)