diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 934be1f5a41..3b952b099ef 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -82,28 +82,13 @@ if ($id > 0 || ! empty($ref)) $picto=($object->type== Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'margin', $titre, 0, $picto); - print ''; - - // Reference - print ''; - print ''; - print ''; - - // Libelle - print ''; - print ''; - - // Status (to sell) - print ''; - - // Status (to buy) - print ''; + dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + + + print '
'; + + print '
'; + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object,'ref','',1,'ref'); - print '
'.$langs->trans("Label").''.$object->label.'
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; - print $object->getLibStatut(2,0); - print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'; - print $object->getLibStatut(2,1); - print '
'; // Total Margin print '
'.$langs->trans("TotalMargin").''; @@ -125,7 +110,11 @@ if ($id > 0 || ! empty($ref)) } print "
"; - print ''; + + print ''; + print '
'; + + dol_fiche_end(); if ($user->rights->facture->lire) { diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index bd2730edda0..9f2f745ad0c 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -73,21 +73,21 @@ if ($socid > 0) dol_fiche_head($head, 'margin', $langs->trans("ThirdParty"),0,'company'); - print ''; - - print ''; - print ''; - - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field - { - print ''; - } + dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom'); + + print '
'; + + print '
'; + print '
'.$langs->trans('ThirdPartyName').''; - print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom'); - print '
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; + + // Alias names (commercial, trademark or alias names) + print '"; if ($object->client) { - print ''; @@ -123,7 +123,11 @@ if ($socid > 0) } print "
'.$langs->trans('AliasNames').''; + print $object->name_alias; + print "
'; + print '
'; print $langs->trans('CustomerCode').''; print $object->code_client; if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; @@ -96,7 +96,7 @@ if ($socid > 0) if ($object->fournisseur) { - print '
'; + print '
'; print $langs->trans('SupplierCode').''; print $object->code_fournisseur; if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; @@ -104,7 +104,7 @@ if ($socid > 0) } // Total Margin - print '
'.$langs->trans("TotalMargin").''; + print '
'.$langs->trans("TotalMargin").''; print ''; // set by jquery (see below) print '
"; + + dol_fiche_end(); + print ''; + print '
'; $sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client,"; diff --git a/htdocs/product/document.php b/htdocs/product/document.php index baf736b47e5..93a5c21862d 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -195,33 +195,21 @@ if ($object->id) } - print ''; - - // Ref - print ''; - print ''; - print ''; - - // Label - print ''; - - // Status (to sell) - print ''; - - // Status (to buy) - print ''; + dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + + print '
'; + + print '
'; + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object,'ref','',1,'ref'); - print '
'.$langs->trans("Label").''.$object->label.'
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; - print $object->getLibStatut(2,0); - print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'; - print $object->getLibStatut(2,1); - print '
'; print ''; print ''; print '
'.$langs->trans("NbOfAttachedFiles").''.count($filearray).'
'.$langs->trans("TotalSizeOfAttachedFiles").''.$totalsize.' '.$langs->trans("bytes").'
'; print ''; + print '
'; + + dol_fiche_end(); $modulepart = 'produit'; $permission = (($object->type == Product::TYPE_PRODUCT && $user->rights->produit->creer) || ($object->type == Product::TYPE_SERVICE && $user->rights->service->creer)); diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 526b67b123c..dfbd5679ac4 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -264,21 +264,15 @@ if ($id > 0 || $ref) $picto=($object->type== Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'suppliers', $titre, 0, $picto); - - print ''; - - // Reference - print ''; - print ''; - print ''; - - // Label - print ''; + dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + + print '
'; + + print '
'; + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($object,'ref','',1,'ref'); - print '
'.$langs->trans("Label").''.$object->label.'
'; // Minimum Price - print ''; + print ''; print ''; - // Status (to buy) - print ''; - print '
'.$langs->trans("BuyingPriceMin").'
'.$langs->trans("BuyingPriceMin").''; $product_fourn = new ProductFournisseur($db); if ($product_fourn->find_min_price_product_fournisseur($object->id) > 0) @@ -288,14 +282,13 @@ if ($id > 0 || $ref) } print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'; - print $object->getLibStatut(2,1); - print '
'; - print "\n"; + print ''; + print '
'; + + dol_fiche_end(); + // Form to add or update a price if (($action == 'add_price' || $action == 'updateprice' ) && ($user->rights->produit->creer || $user->rights->service->creer)) diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 69802f51d57..e1e1eeab0fe 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -402,34 +402,13 @@ $titre = $langs->trans("CardProduct" . $object->type); $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); dol_fiche_head($head, 'price', $titre, 0, $picto); -print ''; +dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); -// Ref -print ''; -print ''; -print ''; -// Label -print ''; +print '
'; -$isphoto = $object->is_photo_available($conf->product->multidir_output [$object->entity]); - -$nblignes = 5; -if ($isphoto) { - // Photo - print '
'; -} - -print ''; - -// Status (to sell) -print ''; +print '
'; +print '
' . $langs->trans("Ref") . ''; -print $form->showrefnav($object, 'ref', '', 1, 'ref'); -print '
' . $langs->trans("Label") . '' . $object->label . ''; - print $object->show_photos($conf->product->multidir_output [$object->entity], 1, 1, 0, 0, 0, 80); - print '
' . $langs->trans("Status") . ' (' . $langs->trans("Sell") . ')'; -print $object->getLibStatut(2, 0); -print '
'; // MultiPrix if (! empty($conf->global->PRODUIT_MULTIPRICES)) @@ -442,7 +421,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) $soc->fetch($socid); // Selling price - print '' . $langs->trans("SellingPrice") . ''; + print ''; print ''; + print ''; } else { // TVA - print ''; + print ''; } print ''; @@ -605,7 +584,7 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) else { // TVA - print ''; + print ''; // Price print '
' . $langs->trans("SellingPrice") . ''; if ($object->multiprices_base_type["$soc->price_level"] == 'TTC') { print price($object->multiprices_ttc["$soc->price_level"]); @@ -483,12 +462,12 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility { // We show only vat for level 1 - print '
' . $langs->trans("VATRate") . '' . vatrate($object->multiprices_tva_tx [1], true) . '
' . $langs->trans("VATRate") . '' . vatrate($object->multiprices_tva_tx [1], true) . '
' . $langs->trans("VATRate") . '' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . '
' . $langs->trans("VATRate") . '' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . '
'.$langs->trans("PriceLevel").''.$langs->trans("SellingPrice").''.$langs->trans("MinPrice").'
' . $langs->trans("VATRate") . '' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . '
' . $langs->trans("VATRate") . '' . vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true) . '
' . $langs->trans("SellingPrice") . ''; @@ -703,6 +682,10 @@ else print "
\n"; +print ''; +print '
'; + + dol_fiche_end(); diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index dfa0cf0c55c..c37424e548b 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -72,24 +72,24 @@ if ($cancel) $action=''; // Set stock limit if ($action == 'setstocklimit') { - $product = new Product($db); - $result=$product->fetch($id); - $product->seuil_stock_alerte=$stocklimit; - $result=$product->update($product->id,$user,0,'update'); + $object = new Product($db); + $result=$object->fetch($id); + $object->seuil_stock_alerte=$stocklimit; + $result=$object->update($object->id,$user,0,'update'); if ($result < 0) - setEventMessage($product->error, 'errors'); + setEventMessage($object->error, 'errors'); $action=''; } // Set desired stock if ($action == 'setdesiredstock') { - $product = new Product($db); - $result=$product->fetch($id); - $product->desiredstock=$desiredstock; - $result=$product->update($product->id,$user,0,'update'); + $object = new Product($db); + $result=$object->fetch($id); + $object->desiredstock=$desiredstock; + $result=$object->update($object->id,$user,0,'update'); if ($result < 0) - setEventMessage($product->error, 'errors'); + setEventMessage($object->error, 'errors'); $action=''; } @@ -112,10 +112,10 @@ if ($action == "correct_stock" && ! $cancel) if (! empty($conf->productbatch->enabled)) { - $product = new Product($db); - $result=$product->fetch($id); + $object = new Product($db); + $result=$object->fetch($id); - if ($product->hasbatch() && (! GETPOST("sellby")) && (! GETPOST("eatby")) && (! GETPOST("batch_number"))) { + if ($object->hasbatch() && (! GETPOST("sellby")) && (! GETPOST("eatby")) && (! GETPOST("batch_number"))) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("atleast1batchfield")), null, 'errors'); $error++; $action='correction'; @@ -127,13 +127,13 @@ if ($action == "correct_stock" && ! $cancel) $priceunit=price2num(GETPOST("unitprice")); if (is_numeric(GETPOST("nbpiece")) && $id) { - if (empty($product)) { - $product = new Product($db); - $result=$product->fetch($id); + if (empty($object)) { + $object = new Product($db); + $result=$object->fetch($id); } - if ($product->hasbatch()) + if ($object->hasbatch()) { - $result=$product->correct_stock_batch( + $result=$object->correct_stock_batch( $user, GETPOST("id_entrepot"), GETPOST("nbpiece"), @@ -148,7 +148,7 @@ if ($action == "correct_stock" && ! $cancel) } else { - $result=$product->correct_stock( + $result=$object->correct_stock( $user, GETPOST("id_entrepot"), GETPOST("nbpiece"), @@ -168,13 +168,13 @@ if ($action == "correct_stock" && ! $cancel) } else { - header("Location: ".$_SERVER["PHP_SELF"]."?id=".$product->id); + header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); exit; } } else { - setEventMessage($product->error,'errors'); + setEventMessage($object->error,'errors'); $action='correction'; } } @@ -207,20 +207,20 @@ if ($action == "transfert_stock" && ! $cancel) { if ($id) { - $product = new Product($db); - $result=$product->fetch($id); + $object = new Product($db); + $result=$object->fetch($id); $db->begin(); - $product->load_stock(); // Load array product->stock_warehouse + $object->load_stock(); // Load array product->stock_warehouse // Define value of products moved $pricesrc=0; - //if (isset($product->stock_warehouse[GETPOST("id_entrepot_source")]->pmp)) $pricesrc=$product->stock_warehouse[GETPOST("id_entrepot_source")]->pmp; - if (isset($product->pmp)) $pricesrc=$product->pmp; + //if (isset($object->stock_warehouse[GETPOST("id_entrepot_source")]->pmp)) $pricesrc=$object->stock_warehouse[GETPOST("id_entrepot_source")]->pmp; + if (isset($object->pmp)) $pricesrc=$object->pmp; $pricedest=$pricesrc; - if ($product->hasbatch()) + if ($object->hasbatch()) { $pdluo = new Productbatch($db); @@ -251,7 +251,7 @@ if ($action == "transfert_stock" && ! $cancel) if (! $error) { // Remove stock - $result1=$product->correct_stock_batch( + $result1=$object->correct_stock_batch( $user, $srcwarehouseid, GETPOST("nbpiece",'int'), @@ -262,7 +262,7 @@ if ($action == "transfert_stock" && ! $cancel) GETPOST('inventorycode') ); // Add stock - $result2=$product->correct_stock_batch( + $result2=$object->correct_stock_batch( $user, GETPOST("id_entrepot_destination",'int'), GETPOST("nbpiece",'int'), @@ -277,7 +277,7 @@ if ($action == "transfert_stock" && ! $cancel) else { // Remove stock - $result1=$product->correct_stock( + $result1=$object->correct_stock( $user, GETPOST("id_entrepot_source"), GETPOST("nbpiece"), @@ -288,7 +288,7 @@ if ($action == "transfert_stock" && ! $cancel) ); // Add stock - $result2=$product->correct_stock( + $result2=$object->correct_stock( $user, GETPOST("id_entrepot_destination"), GETPOST("nbpiece"), @@ -309,13 +309,13 @@ if ($action == "transfert_stock" && ! $cancel) } else { - header("Location: product.php?id=".$product->id); + header("Location: product.php?id=".$object->id); exit; } } else { - setEventMessages($product->error, $product->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); $action='transfert'; } @@ -370,70 +370,45 @@ if ($action == 'updateline' && GETPOST('save') == $langs->trans('Save')) * View */ +$form = new Form($db); $formproduct=new FormProduct($db); if ($id > 0 || $ref) { - $product = new Product($db); - $result = $product->fetch($id,$ref); - $product->load_stock(); + $object = new Product($db); + $result = $object->fetch($id,$ref); + $object->load_stock(); $help_url='EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; - llxHeader("",$langs->trans("CardProduct".$product->type),$help_url); + llxHeader("",$langs->trans("CardProduct".$object->type),$help_url); if ($result > 0) { - $head=product_prepare_head($product); - $titre=$langs->trans("CardProduct".$product->type); - $picto=($product->type==Product::TYPE_SERVICE?'service':'product'); + $head=product_prepare_head($object); + $titre=$langs->trans("CardProduct".$object->type); + $picto=($object->type==Product::TYPE_SERVICE?'service':'product'); dol_fiche_head($head, 'stock', $titre, 0, $picto); dol_htmloutput_events(); - $form = new Form($db); - - print ''; - - // Ref - print ''; - print ''; - print ''; - - // Label - print ''; - print ''; - - // Status (to sell) - print ''; - - // Status (to buy) - print ''; - + dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + + print '
'; + + print '
'; + print '
'.$langs->trans("Ref").''; - print $form->showrefnav($product,'ref','',1,'ref'); - print '
'.$langs->trans("Label").''.$product->label.'
'.$langs->trans("Status").' ('.$langs->trans("Sell").')'; - if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { - print ajax_object_onoff($product, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); - } else { - print $product->getLibStatut(2,0); - } - print '
'.$langs->trans("Status").' ('.$langs->trans("Buy").')'; - if (! empty($conf->use_javascript_ajax) && $user->rights->produit->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { - print ajax_object_onoff($product, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); - } else { - print $product->getLibStatut(2,1); - } - print '
'; + if ($conf->productbatch->enabled) { print ''; } // PMP print ''; print ''; print ''; @@ -441,14 +416,13 @@ if ($id > 0 || $ref) print ''; print ''; - $object = $product; if (empty($conf->global->PRODUIT_MULTIPRICES)) { // Price @@ -483,17 +457,17 @@ if ($id > 0 || $ref) } // Stock alert threshold - print ''; // Desired stock - print ''; // Real stock - $product->load_stock(); + $object->load_stock(); $text_stock_options = ''; $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)?$langs->trans("DeStockOnShipment").'
':''); $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER)?$langs->trans("DeStockOnValidateOrder").'
':''); @@ -504,15 +478,15 @@ if ($id > 0 || $ref) print ''; - print ''; print ''; // Calculating a theorical value print ''; - print "'; @@ -528,36 +502,36 @@ if ($id > 0 || $ref) if (! empty($conf->commande->enabled)) { if ($found) print '
'; else $found=1; - print $langs->trans("ProductQtyInCustomersOrdersRunning").': '.$product->stats_commande['qty']; - $result=$product->load_stats_commande(0,'0'); - if ($result < 0) dol_print_error($db,$product->error); - print ' ('.$langs->trans("ProductQtyInDraft").': '.$product->stats_commande['qty'].')'; + print $langs->trans("ProductQtyInCustomersOrdersRunning").': '.$object->stats_commande['qty']; + $result=$object->load_stats_commande(0,'0'); + if ($result < 0) dol_print_error($db,$object->error); + print ' ('.$langs->trans("ProductQtyInDraft").': '.$object->stats_commande['qty'].')'; } // Number of product from customer order already sent (partial shipping) if (! empty($conf->expedition->enabled)) { if ($found) print '
'; else $found=1; - $result=$product->load_stats_sending(0,'2'); - print $langs->trans("ProductQtyInShipmentAlreadySent").': '.$product->stats_expedition['qty']; + $result=$object->load_stats_sending(0,'2'); + print $langs->trans("ProductQtyInShipmentAlreadySent").': '.$object->stats_expedition['qty']; } // Number of supplier order running if (! empty($conf->fournisseur->enabled)) { if ($found) print '
'; else $found=1; - $result=$product->load_stats_commande_fournisseur(0,'3,4'); - print $langs->trans("ProductQtyInSuppliersOrdersRunning").': '.$product->stats_commande_fournisseur['qty']; - $result=$product->load_stats_commande_fournisseur(0,'0,1,2'); - if ($result < 0) dol_print_error($db,$product->error); - print ' ('.$langs->trans("ProductQtyInDraftOrWaitingApproved").': '.$product->stats_commande_fournisseur['qty'].')'; + $result=$object->load_stats_commande_fournisseur(0,'3,4'); + print $langs->trans("ProductQtyInSuppliersOrdersRunning").': '.$object->stats_commande_fournisseur['qty']; + $result=$object->load_stats_commande_fournisseur(0,'0,1,2'); + if ($result < 0) dol_print_error($db,$object->error); + print ' ('.$langs->trans("ProductQtyInDraftOrWaitingApproved").': '.$object->stats_commande_fournisseur['qty'].')'; } // Number of product from supplier order already received (partial receipt) if (! empty($conf->fournisseur->enabled)) { if ($found) print '
'; else $found=1; - print $langs->trans("ProductQtyInSuppliersShipmentAlreadyRecevied").': '.$product->stats_reception['qty']; + print $langs->trans("ProductQtyInSuppliersShipmentAlreadyRecevied").': '.$object->stats_reception['qty']; } print ''; @@ -565,7 +539,7 @@ if ($id > 0 || $ref) // Last movement $sql = "SELECT max(m.datem) as datem"; $sql.= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m"; - $sql.= " WHERE m.fk_product = '".$product->id."'"; + $sql.= " WHERE m.fk_product = '".$object->id."'"; $resqlbis = $db->query($sql); if ($resqlbis) { @@ -580,18 +554,21 @@ if ($id > 0 || $ref) if ($lastmovementdate) { print dol_print_date($lastmovementdate,'dayhour').' '; - print '('.$langs->trans("FullList").')'; + print '('.$langs->trans("FullList").')'; } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print ""; print "
'.$langs->trans("ManageLotSerial").''; - print $product->getLibStatut(0,2); + print $object->getLibStatut(0,2); print '
'.$langs->trans("AverageUnitPricePMP").''; - if ($product->pmp > 0) print price($product->pmp).' '.$langs->trans("HT"); + if ($object->pmp > 0) print price($object->pmp).' '.$langs->trans("HT"); print '
'.$langs->trans("BuyingPriceMin").''; $product_fourn = new ProductFournisseur($db); - if ($product_fourn->find_min_price_product_fournisseur($product->id) > 0) + if ($product_fourn->find_min_price_product_fournisseur($object->id) > 0) { if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur(); else print $langs->trans("NotDefined"); } print '
'.$form->editfieldkey("StockLimit",'stocklimit',$product->seuil_stock_alerte,$product,$user->rights->produit->creer).''; - print $form->editfieldval("StockLimit",'stocklimit',$product->seuil_stock_alerte,$product,$user->rights->produit->creer); + print '
'.$form->editfieldkey("StockLimit",'stocklimit',$object->seuil_stock_alerte,$object,$user->rights->produit->creer).''; + print $form->editfieldval("StockLimit",'stocklimit',$object->seuil_stock_alerte,$object,$user->rights->produit->creer); print '
'.$form->editfieldkey("DesiredStock",'desiredstock',$product->desiredstock,$product,$user->rights->produit->creer).''; - print $form->editfieldval("DesiredStock",'desiredstock',$product->desiredstock,$product,$user->rights->produit->creer); + print '
'.$form->editfieldkey("DesiredStock",'desiredstock',$object->desiredstock,$object,$user->rights->produit->creer).''; + print $form->editfieldval("DesiredStock",'desiredstock',$object->desiredstock,$object,$user->rights->produit->creer); print '
'; print $form->textwithtooltip($langs->trans("PhysicalStock"), $text_stock_options, 2, 1, img_picto('', 'info'), '', 2); print ''.$product->stock_reel; - if ($product->seuil_stock_alerte && ($product->stock_reel < $product->seuil_stock_alerte)) print ' '.img_warning($langs->trans("StockLowerThanLimit")); + print ''.$object->stock_reel; + if ($object->seuil_stock_alerte && ($object->stock_reel < $object->seuil_stock_alerte)) print ' '.img_warning($langs->trans("StockLowerThanLimit")); print '
'.$langs->trans("VirtualStock").'".(empty($product->stock_theorique)?0:$product->stock_theorique); - if ($product->stock_theorique < $product->seuil_stock_alerte) { + print "".(empty($object->stock_theorique)?0:$object->stock_theorique); + if ($object->stock_theorique < $object->seuil_stock_alerte) { print ' '.img_warning($langs->trans("StockLowerThanLimit")); } print '
"; + print ''; + print '
'; + + dol_fiche_end(); } - print ''; /* * Correct stock @@ -618,7 +595,7 @@ if ($id > 0 || $ref) if ($_GET["action"] == "definir") { print load_fiche_titre($langs->trans("SetStock")); - print "
id\" method=\"post\">\n"; + print "id\" method=\"post\">\n"; print ''; print ''; print ''; @@ -645,19 +622,19 @@ else /* ************************************************************************** */ -if (empty($action) && $product->id) +if (empty($action) && $object->id) { print "
\n"; if ($user->rights->stock->mouvement->creer) { - print ''.$langs->trans("StockCorrection").''; + print ''.$langs->trans("StockCorrection").''; } - //if (($user->rights->stock->mouvement->creer) && ! $product->hasbatch()) + //if (($user->rights->stock->mouvement->creer) && ! $object->hasbatch()) if ($user->rights->stock->mouvement->creer) { - print ''.$langs->trans("StockMovement").''; + print ''.$langs->trans("StockMovement").''; } print '
'; @@ -678,7 +655,7 @@ print ''; print ''; print ''; print ''; -if ((! empty($conf->productbatch->enabled)) && $product->hasbatch()) +if ((! empty($conf->productbatch->enabled)) && $object->hasbatch()) { print ''; print ''; @@ -695,7 +672,7 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = ps.fk_product"; $sql.= " WHERE ps.reel != 0"; $sql.= " AND ps.fk_entrepot = e.rowid"; $sql.= " AND e.entity IN (".getEntity('stock', 1).")"; -$sql.= " AND ps.fk_product = ".$product->id; +$sql.= " AND ps.fk_product = ".$object->id; $sql.= " ORDER BY e.label"; $entrepotstatic=new Entrepot($db); @@ -718,25 +695,25 @@ if ($resql) print ''; print ''; // PMP - print ''; + print ''; // Value purchase - print ''; + print ''; // Sell price print ''; // Value sell print ''; + if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($object->price*$obj->reel,'MT'),1).''; else print $langs->trans("Variable"); print ''; ; $total += $obj->reel; - if (price2num($product->pmp)) $totalwithpmp += $obj->reel; - $totalvalue = $totalvalue + ($product->pmp*$obj->reel); - $totalvaluesell = $totalvaluesell + ($product->price*$obj->reel); + if (price2num($object->pmp)) $totalwithpmp += $obj->reel; + $totalvalue = $totalvalue + ($object->pmp*$obj->reel); + $totalvaluesell = $totalvaluesell + ($object->price*$obj->reel); //Batch Detail - if ((! empty($conf->productbatch->enabled)) && $product->hasbatch()) + if ((! empty($conf->productbatch->enabled)) && $object->hasbatch()) { $details=Productbatch::findAll($db,$obj->product_stock_id); if ($details<0) dol_print_error($db); @@ -762,7 +739,7 @@ if ($resql) { print "\n".'
'.$langs->trans("EstimatedStockValueShort").''.$langs->trans("SellPriceMin").''.$langs->trans("EstimatedStockValueSellShort").'
'.$langs->trans("batch_number").''.$entrepotstatic->getNomUrl(1).''.$obj->reel.($obj->reel<0?' '.img_warning():'').''.(price2num($product->pmp)?price2num($product->pmp,'MU'):'').''.(price2num($object->pmp)?price2num($object->pmp,'MU'):'').''.(price2num($product->pmp)?price(price2num($product->pmp*$obj->reel,'MT')):'').''.(price2num($object->pmp)?price(price2num($object->pmp*$obj->reel,'MT')):'').''; - if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price,'MU'),1); + if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($object->price,'MU'),1); else print $langs->trans("Variable"); print ''; - if (empty($conf->global->PRODUIT_MULTI_PRICES)) print price(price2num($product->price*$obj->reel,'MT'),1).'
'; print img_picto($langs->trans("Tranfer"),'uparrow','class="hideonsmartphone"').' '; - print 'id.'">'.$langs->trans("StockMovement").''; + print 'id.'">'.$langs->trans("StockMovement").''; // Disabled, because edition of stock content must use the "Correct stock menu". // Do not use this, or data will be wrong (bad tracking of movement label, inventory code, ... //print 'id.'#'.$pdluo->id.'">'; diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index dc102d8eb05..b1121731293 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -21,7 +21,9 @@ load("productbatch"); + if (! is_object($product)) $product=$object; + + $langs->load("productbatch"); if (empty($id)) $id = $object->id; diff --git a/htdocs/product/stock/tpl/stocktransfer.tpl.php b/htdocs/product/stock/tpl/stocktransfer.tpl.php index de947a75014..93c3135e5f1 100644 --- a/htdocs/product/stock/tpl/stocktransfer.tpl.php +++ b/htdocs/product/stock/tpl/stocktransfer.tpl.php @@ -21,7 +21,11 @@ load("productbatch"); + + $pdluoid=GETPOST('pdluoid','int'); $pdluo = new Productbatch($db); diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index 413cb589dff..96187fad8dd 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -58,9 +58,9 @@ if ($cancel == $langs->trans("Cancel")) if ($action == 'delete' && GETPOST('langtodelete','alpha')) { - $product = new Product($db); - $product->fetch($id); - $product->delMultiLangs(GETPOST('langtodelete','alpha')); + $object = new Product($db); + $object->fetch($id); + $object->delMultiLangs(GETPOST('langtodelete','alpha')); } // Add translation @@ -68,33 +68,33 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && ($user->rights->produit->creer || $user->rights->service->creer)) { - $product = new Product($db); - $product->fetch($id); + $object = new Product($db); + $object->fetch($id); $current_lang = $langs->getDefaultLang(); // update de l'objet if ( $_POST["forcelangprod"] == $current_lang ) { - $product->label = $_POST["libelle"]; - $product->description = dol_htmlcleanlastbr($_POST["desc"]); - $product->note = dol_htmlcleanlastbr($_POST["note"]); + $object->label = $_POST["libelle"]; + $object->description = dol_htmlcleanlastbr($_POST["desc"]); + $object->note = dol_htmlcleanlastbr($_POST["note"]); } else { - $product->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"]; - $product->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]); - $product->multilangs[$_POST["forcelangprod"]]["note"] = dol_htmlcleanlastbr($_POST["note"]); + $object->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"]; + $object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]); + $object->multilangs[$_POST["forcelangprod"]]["note"] = dol_htmlcleanlastbr($_POST["note"]); } // sauvegarde en base - if ( $product->setMultiLangs() > 0 ) + if ( $object->setMultiLangs() > 0 ) { $action = ''; } else { $action = 'add'; - setEventMessage($product->error,'errors'); + setEventMessage($object->error,'errors'); } } @@ -103,34 +103,34 @@ if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && ($user->rights->produit->creer || $user->rights->service->creer)) { - $product = new Product($db); - $product->fetch($id); + $object = new Product($db); + $object->fetch($id); $current_lang = $langs->getDefaultLang(); - foreach ( $product->multilangs as $key => $value ) // enregistrement des nouvelles valeurs dans l'objet + foreach ( $object->multilangs as $key => $value ) // enregistrement des nouvelles valeurs dans l'objet { if ( $key == $current_lang ) { - $product->label = $_POST["libelle-".$key]; - $product->description = dol_htmlcleanlastbr($_POST["desc-".$key]); - $product->note = dol_htmlcleanlastbr($_POST["note-".$key]); + $object->label = $_POST["libelle-".$key]; + $object->description = dol_htmlcleanlastbr($_POST["desc-".$key]); + $object->note = dol_htmlcleanlastbr($_POST["note-".$key]); } else { - $product->multilangs[$key]["label"] = $_POST["libelle-".$key]; - $product->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-".$key]); - $product->multilangs[$key]["note"] = dol_htmlcleanlastbr($_POST["note-".$key]); + $object->multilangs[$key]["label"] = $_POST["libelle-".$key]; + $object->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-".$key]); + $object->multilangs[$key]["note"] = dol_htmlcleanlastbr($_POST["note-".$key]); } } - if ( $product->setMultiLangs() > 0 ) + if ( $object->setMultiLangs() > 0 ) { $action = ''; } else { $action = 'edit'; - setEventMessage($product->error,'errors'); + setEventMessage($object->error,'errors'); } } @@ -139,24 +139,24 @@ if ($action == 'vdelete' && $cancel != $langs->trans("Cancel") && ($user->rights->produit->creer || $user->rights->service->creer)) { - $product = new Product($db); - $product->fetch($id); + $object = new Product($db); + $object->fetch($id); $langtodelete=GETPOST('langdel','alpha'); - if ( $product->delMultiLangs($langtodelete) > 0 ) + if ( $object->delMultiLangs($langtodelete) > 0 ) { $action = ''; } else { $action = 'edit'; - setEventMessage($product->error,'errors'); + setEventMessage($object->error,'errors'); } } -$product = new Product($db); -$result = $product->fetch($id,$ref); +$object = new Product($db); +$result = $object->fetch($id,$ref); /* @@ -168,20 +168,10 @@ llxHeader("","",$langs->trans("Translation")); $form = new Form($db); $formadmin=new FormAdmin($db); -$head=product_prepare_head($product); -$titre=$langs->trans("CardProduct".$product->type); -$picto=($product->type==Product::TYPE_SERVICE?'service':'product'); -dol_fiche_head($head, 'translation', $titre, 0, $picto); +$head=product_prepare_head($object); +$titre=$langs->trans("CardProduct".$object->type); +$picto=($object->type==Product::TYPE_SERVICE?'service':'product'); -print ''; - -// Reference -print ''; -print ''; -print ''; -print '
'.$langs->trans("Ref").''; -print $form->showrefnav($product,'ref','',1,'ref'); -print '
'; if ($action == 'edit') { @@ -191,33 +181,40 @@ if ($action == 'edit') print ''; print ''; print ''; - print ''; + print ''; - if (! empty($product->multilangs)) + dol_fiche_head($head, 'translation', $titre, 0, $picto); + + dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + + if (! empty($object->multilangs)) { - foreach ($product->multilangs as $key => $value) + foreach ($object->multilangs as $key => $value) { - print "
".$langs->trans('Language_'.$key)." :
"; + $s=picto_from_langcode($key); + print "
".($s?$s.' ':'')." ".$langs->trans('Language_'.$key).": ".'
'.img_delete('', '')."
"; + print ''; - print ''; + print ''; print ''; print ''; - print ''; print '
'.$langs->trans('Label').'
'.$langs->trans('Label').'
'.$langs->trans('Description').''; - $doleditor = new DolEditor("desc-$key", $product->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80); + $doleditor = new DolEditor("desc-$key", $object->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80); $doleditor->Create(); print '
'.$langs->trans('Note').''; - $doleditor = new DolEditor("note-$key", $product->multilangs[$key]["note"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80); + $doleditor = new DolEditor("note-$key", $object->multilangs[$key]["note"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80); $doleditor->Create(); print '
'.$langs->trans("Delete").'
'; } } - print '
'; + dol_fiche_end(); + + print '
'; print ''; print '     '; print ''; @@ -228,25 +225,30 @@ if ($action == 'edit') } else { - $cnt_trans = 0; - if (! empty($product->multilangs)) + dol_fiche_head($head, 'translation', $titre, 0, $picto); + + dol_banner_tab($object, 'ref', '', ($user->societe_id?0:1), 'ref'); + + $cnt_trans = 0; + if (! empty($object->multilangs)) { - foreach ($product->multilangs as $key => $value) + foreach ($object->multilangs as $key => $value) { $cnt_trans++; $s=picto_from_langcode($key); - print "
".($s?$s.' ':'')." ".$langs->trans('Language_'.$key).": ".''.img_delete('', '')."
"; + print "
".($s?$s.' ':'')." ".$langs->trans('Language_'.$key).": ".''.img_delete('', '')."
"; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print '
'.$langs->trans('Label').''.$product->multilangs[$key]["label"].'
'.$langs->trans('Description').''.$product->multilangs[$key]["description"].'
'.$langs->trans('Note').''.$product->multilangs[$key]["note"].'
'.$langs->trans('Label').''.$object->multilangs[$key]["label"].'
'.$langs->trans('Description').''.$object->multilangs[$key]["description"].'
'.$langs->trans('Note').''.$object->multilangs[$key]["note"].'
'; } } if (! $cnt_trans) print '
'. $langs->trans('NoTranslation'); + + dol_fiche_end(); } -print "
\n"; /* ************************************************************************** */ @@ -260,8 +262,8 @@ print "\n
\n"; if ($action == '') if ($user->rights->produit->creer || $user->rights->service->creer) { - print ''.$langs->trans("Add").''; - print ''.$langs->trans("Update").''; + print ''.$langs->trans("Add").''; + print ''.$langs->trans("Update").''; } print "\n
\n"; @@ -284,7 +286,7 @@ if ($action == 'add' && ($user->rights->produit->creer || $user->rights->service print ''; print ''; print ''; print '
'.$langs->trans('Language').''; - print $formadmin->select_language('','forcelangprod',0,$product->multilangs,1); + print $formadmin->select_language('','forcelangprod',0,$object->multilangs,1); print '
'.$langs->trans('Label').'
'.$langs->trans('Description').'';