diff --git a/htdocs/core/tpl/freeproductline_create.tpl.php b/htdocs/core/tpl/freeproductline_create.tpl.php index 2bf8a55a3d0..214b1ac1472 100644 --- a/htdocs/core/tpl/freeproductline_create.tpl.php +++ b/htdocs/core/tpl/freeproductline_create.tpl.php @@ -39,9 +39,9 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob - global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
trans('AddNewLine').' - ' ?>trans("FreeZone"); ?> + global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>> +
+ trans('AddNewLine').' - ' ?>trans("FreeZone"); ?> trans('VAT'); ?> trans('PriceUHT'); ?> @@ -83,36 +83,36 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob > - global->MAIN_VIEW_LINE_NUMBER)) { - $coldisplay=2; } - else { - $coldisplay=0; } - ?> +global->MAIN_VIEW_LINE_NUMBER)) { + $coldisplay=2; } +else { + $coldisplay=0; } +?> global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>> - '; - echo $form->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1); - echo ''; + echo ''; + echo $form->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1); + echo ''; - if (is_object($hookmanager)) - { - $parameters=array(); - $reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action); - } + if (is_object($hookmanager)) + { + $parameters=array('fk_parent_line'=>GETPOST('fk_parent_line','int')); + $reshook=$hookmanager->executeHooks('formCreateProductOptions',$parameters,$object,$action); + } - if ((! empty($conf->product->enabled) && ! empty($conf->service->enabled)) || (empty($conf->product->enabled) && empty($conf->service->enabled))) echo '
'; + if ((! empty($conf->product->enabled) && ! empty($conf->service->enabled)) || (empty($conf->product->enabled) && empty($conf->service->enabled))) echo '
'; - // Editor wysiwyg - require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $nbrows=ROWS_2; - $enabled=(! empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); - if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; - $doleditor=new DolEditor('dp_desc',GETPOST('dp_desc'),'',100,'dolibarr_details','',false,true,$enabled,$nbrows,70); - $doleditor->Create(); - ?> + // Editor wysiwyg + require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $nbrows=ROWS_2; + $enabled=(! empty($conf->global->FCKEDITOR_ENABLE_DETAILS)?$conf->global->FCKEDITOR_ENABLE_DETAILS:0); + if (! empty($conf->global->MAIN_INPUT_DESC_HEIGHT)) $nbrows=$conf->global->MAIN_INPUT_DESC_HEIGHT; + $doleditor=new DolEditor('dp_desc',GETPOST('dp_desc'),'',100,'dolibarr_details','',false,true,$enabled,$nbrows,70); + $doleditor->Create(); + ?> margin->enabled) && ! empty($object->element) && in_array($ob else echo $form->load_tva('tva_tx', (isset($_POST["tva_tx"])?$_POST["tva_tx"]:-1), $seller, $buyer); ?> - "> - + "> "> remise_client); ?>" name="remise_percent">% margin->enabled) && ! empty($object->element) && in_array($ob if (! empty($usemargins)) { ?> - "> + + "> rights->margins->creer) @@ -155,21 +154,25 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob } } ?> - - table_element_line=='commandedet') { - $newline = new OrderLine($this->db); - }elseif ($this->table_element_line=='propaldet') { - $newline = new PropaleLigne($this->db); - }elseif ($this->table_element_line=='facturedet') { - $newline = new FactureLigne($this->db); - } - if (is_object($newline)) { - print $newline->showOptionals($extrafieldsline,'edit',array('style'=>$bcnd[$var],'colspan'=>$coldisplay+8)); - } + + + + table_element_line=='commandedet') { + $newline = new OrderLine($this->db); } + elseif ($this->table_element_line=='propaldet') { + $newline = new PropaleLigne($this->db); + } + elseif ($this->table_element_line=='facturedet') { + $newline = new FactureLigne($this->db); + } + if (is_object($newline)) { + print $newline->showOptionals($extrafieldsline,'edit',array('style'=>$bcnd[$var],'colspan'=>$coldisplay+8)); + } + } ?> @@ -182,13 +185,14 @@ if (! empty($conf->service->enabled) && $dateSelector) if (! empty($usemargins)) { $colspan++; // For the buying price - if($conf->global->DISPLAY_MARGIN_RATES) $colspan++; - if($conf->global->DISPLAY_MARK_RATES) $colspan++; + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; + if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; } ?> > - "> + element) && $object->element == 'contrat') { print $langs->trans("DateStartPlanned").' '; @@ -212,101 +216,108 @@ if (! empty($conf->service->enabled) && $dateSelector) -margin->enabled && $user->rights->margins->creer) -{ -?> - +global->MAIN_MAX_DECIMALS_SHOWN; ?>; - var main_rounding = global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT); ?>; - - var amount = num.toString().replace(',','.'); // should be useless - var nbdec = 0; - var rounding = main_rounding; - var pos = amount.indexOf('.'); - var decpart = ''; - if (pos >= 0) - decpart = amount.substr(pos+1).replace('/0+$/i',''); // Supprime les 0 de fin de partie decimale - nbdec = decpart.length; - if (nbdec > rounding) - rounding = nbdec; - // Si on depasse max - if (rounding > main_max_dec_shown) - { - rounding = main_max_dec_shown; - } - //amount = parseFloat(amount) + (1 / Math.pow(100, rounding)); // to avoid floating-point errors - return parseFloat(amount).toFixed(rounding); -} - -function formatFloat(num) { - return roundFloat(num).replace('.', ','); -} - - - +?> diff --git a/htdocs/core/tpl/passwordforgotten.tpl.php b/htdocs/core/tpl/passwordforgotten.tpl.php index 638a6ac5969..428001e7141 100644 --- a/htdocs/core/tpl/passwordforgotten.tpl.php +++ b/htdocs/core/tpl/passwordforgotten.tpl.php @@ -117,7 +117,7 @@ if (! empty($hookmanager->resArray['options'])) { if (! empty($conf->dol_no_mouse_hover)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_no_mouse_hover='.$conf->dol_no_mouse_hover; if (! empty($conf->dol_use_jmobile)) $moreparam.=(strpos($moreparam,'?')===false?'?':'&').'dol_use_jmobile='.$conf->dol_use_jmobile; - print '('.$langs->trans('BackToLoginPage').')'; + print '('.$langs->trans('BackToLoginPage').')'; ?> diff --git a/htdocs/core/tpl/predefinedproductline_create.tpl.php b/htdocs/core/tpl/predefinedproductline_create.tpl.php index 7fdc03d5169..3306e995d58 100644 --- a/htdocs/core/tpl/predefinedproductline_create.tpl.php +++ b/htdocs/core/tpl/predefinedproductline_create.tpl.php @@ -1,6 +1,6 @@ - * Copyright (C) 2010-2012 Laurent Destailleur + * Copyright (C) 2010-2013 Laurent Destailleur * Copyright (C) 2012-2013 Christophe Battarel * Copyright (C) 2013 Florian Henry * @@ -17,7 +17,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . * - * * Need to have following variables defined: * $conf * $langs @@ -39,15 +38,6 @@ if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($ob - - - global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>> trans('Qty'); ?> trans('ReductionShort'); ?> - - global->MARGIN_TYPE == "1") - echo $langs->trans('BuyingPrice'); - else - echo $langs->trans('CostPrice'); - - if ($user->rights->margins->creer) + $colspan = 4; + if (! empty($usemargins)) { - if(! empty($conf->global->DISPLAY_MARGIN_RATES)) + ?> + + global->MARGIN_TYPE == "1") + echo $langs->trans('BuyingPrice'); + else + echo $langs->trans('CostPrice'); + ?> + + rights->margins->creer) { - echo ''.$langs->trans('MarginRate').''; + if(! empty($conf->global->DISPLAY_MARGIN_RATES)) + { + echo ''.$langs->trans('MarginRate').''; + } + if(! empty($conf->global->DISPLAY_MARK_RATES)) + { + echo ''.$langs->trans('MarkRate').''; + } } - if(! empty($conf->global->DISPLAY_MARK_RATES)) + else { - echo ''.$langs->trans('MarkRate').''; + if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; + if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; } } - else - { - if (! empty($conf->global->DISPLAY_MARGIN_RATES)) $colspan++; - if (! empty($conf->global->DISPLAY_MARK_RATES)) $colspan++; - } ?> - -   > global->MAIN_VIEW_LINE_NUMBER)) { - $coldisplay=4; } + $coldisplay=4; } else { - $coldisplay=3; } + $coldisplay=3; } ?> + global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="4"' : ' colspan="3"'); ?>> + + + '; @@ -128,8 +127,9 @@ else { $doleditor->Create(); ?> + - % + % - " name="addline"> + table_element_line=='commandedet') { $newline = new OrderLine($this->db); - }elseif ($this->table_element_line=='propaldet') { + } + elseif ($this->table_element_line=='propaldet') { $newline = new PropaleLigne($this->db); } elseif ($this->table_element_line=='facturedet') { @@ -209,9 +210,9 @@ if (! empty($conf->service->enabled) && $dateSelector) else { echo $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; - echo $form->select_date('','date_start_predef',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addpredefinedproduct"); + echo $form->select_date('','date_start_predef',empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,1,"addpredefinedproduct"); echo ' '.$langs->trans('to').' '; - echo $form->select_date('','date_end_predef',$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE,1,"addpredefinedproduct"); + echo $form->select_date('','date_end_predef',empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?0:1,1,"addpredefinedproduct"); } ?> @@ -223,40 +224,39 @@ if (! empty($conf->service->enabled) && $dateSelector) rights->margins->creer) { ?> 0 if OK */ - function find_min_price_product_fournisseur($prodid) + function find_min_price_product_fournisseur($prodid, $qty=0) { global $conf; @@ -444,6 +445,7 @@ class ProductFournisseur extends Product $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")"; $sql.= " AND pfp.fk_product = ".$prodid; $sql.= " AND pfp.fk_soc = s.rowid"; + if ($qty > 0) $sql.= " AND pfp.quantity <= ".$qty; $sql.= " ORDER BY pfp.unitprice"; $sql.= $this->db->plimit(1); @@ -496,16 +498,18 @@ class ProductFournisseur extends Product /** * Display price of product * - * @return string String with supplier price + * @param int $showunitprice Show "Unit price" into output string + * @param int $showsuptitle Show "Supplier" into output string + * @return string String with supplier price */ - function display_price_product_fournisseur() + function display_price_product_fournisseur($showunitprice=1,$showsuptitle=1) { global $langs; $langs->load("suppliers"); - $out=price($this->fourn_unitprice).' '.$langs->trans("HT").'   ('.$langs->trans("Supplier").': '.$this->getSocNomUrl(1).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.')'; + $out=($showunitprice?price($this->fourn_unitprice).' '.$langs->trans("HT").'   (':'').($showsuptitle?$langs->trans("Supplier").': ':'').$this->getSocNomUrl(1).' / '.$langs->trans("SupplierRef").': '.$this->fourn_ref.($showunitprice?')':''); return $out; } } -?> +?> \ No newline at end of file diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 115bd66ae48..48a2614deb0 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -81,6 +81,8 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece else { dol_syslog('No dispatch for line '.$key.' as no warehouse choosed'); + $text = $langs->transnoentities('Warehouse').', '.$langs->transnoentities('Line').'' .($reg[1]-1); + setEventMessage($langs->trans('ErrorFieldRequired',$text), 'errors'); } } } @@ -190,8 +192,8 @@ if ($id > 0 || ! empty($ref)) print ""; - if ($mesg) print $mesg; - else print '
'; + //if ($mesg) print $mesg; + print '
'; $disabled=1; @@ -271,41 +273,47 @@ if ($id > 0 || ! empty($ref)) } else { - $nbproduct++; - $remaintodispatch=($objp->qty - $products_dispatched[$objp->fk_product]); // Calculation of dispatched if ($remaintodispatch < 0) $remaintodispatch=0; - - $var=!$var; - print ""; - print ''; - print ''.img_object($langs->trans("ShowProduct"),'product').' '.$objp->ref.''; - print ' - '.$objp->label; - // To show detail cref and description value, we must make calculation by cref - //print ($objp->cref?' ('.$objp->cref.')':''); - //if ($objp->description) print '
'.nl2br($objp->description); - print ''; - print ''; - print "\n"; - - print ''.$objp->qty.''; - print ''.$products_dispatched[$objp->fk_product].''; - - // Dispatch - print ''; - - // Warehouse - print ''; - if (count($listwarehouses)) + if ($remaintodispatch) { - print $form->selectarray("entrepot_".$i, $listwarehouses, '', $disabled, 0, 0, '', 0, 0, $disabled); + $nbproduct++; + + $var=!$var; + print ""; + print ''; + print ''.img_object($langs->trans("ShowProduct"),'product').' '.$objp->ref.''; + print ' - '.$objp->label; + // To show detail cref and description value, we must make calculation by cref + //print ($objp->cref?' ('.$objp->cref.')':''); + //if ($objp->description) print '
'.nl2br($objp->description); + print ''; + print ''; + print "\n"; + + print ''.$objp->qty.''; + print ''.$products_dispatched[$objp->fk_product].''; + + // Dispatch + print ''; + + // Warehouse + print ''; + if (count($listwarehouses)>1) + { + print $form->selectarray("entrepot_".$i, $listwarehouses, '', 1, 0, 0, '', 0, 0, $disabled); + } + elseif (count($listwarehouses)==1) + { + print $form->selectarray("entrepot_".$i, $listwarehouses, '', 0, 0, 0, '', 0, 0, $disabled); + } + else + { + print $langs->trans("NoWarehouseDefined"); + } + print "\n"; + print "\n"; } - else - { - print $langs->trans("NoWarehouseDefined"); - } - print "\n"; - print "\n"; } $i++; } @@ -338,6 +346,8 @@ if ($id > 0 || ! empty($ref)) print ''; } + + dol_fiche_end(); // List of already dispatching $sql = "SELECT p.ref, p.label,"; @@ -359,7 +369,9 @@ if ($id > 0 || ! empty($ref)) if ($num > 0) { print "
\n"; - + + print_titre($langs->trans("ReceivingForSameOrder")); + print ''; print ''; @@ -399,19 +411,6 @@ if ($id > 0 || ! empty($ref)) { dol_print_error($db); } - - dol_fiche_end(); - - - /** - * Boutons actions - */ - if ($user->societe_id == 0 && $commande->statut < 3 && ($_GET["action"] <> 'valid' || $_GET['action'] == 'builddoc')) - { - //print '
'; - - //print "
"; - } } else { diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 8500fc31ac6..7aad675d0ba 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -108,4 +108,5 @@ NbOfProductBeforePeriod=Quantity of product %s in stock before selected period ( NbOfProductAfterPeriod=Quantity of product %s in stock after selected period (> %s) MassStockMovement=Mass stock movement SelectProductInAndOutWareHouse=Select a product, a quantity, a source warehouse and a target warehouse, then click "%s". Once this is done for all required movements, click onto "%s". -RecordMovement=Record transfert \ No newline at end of file +RecordMovement=Record transfert +ReceivingForSameOrder=Receivings for this order \ No newline at end of file diff --git a/htdocs/langs/es_ES/stocks.lang b/htdocs/langs/es_ES/stocks.lang index 7fa650aeac6..cf6e5941587 100644 --- a/htdocs/langs/es_ES/stocks.lang +++ b/htdocs/langs/es_ES/stocks.lang @@ -47,7 +47,7 @@ PMPValue=Valor (PMP) PMPValueShort=PMP EnhancedValueOfWarehouses=Valor de stocks UserWarehouseAutoCreate=Crear automáticamente existencias/almacén propio del usuario en la creación del usuario -QtyDispatched=Cantidad desglosada +QtyDispatched=Cantidad recibida OrderDispatch=Recepción de stocks RuleForStockManagementDecrease=Regla de gestión de decrementos de stock RuleForStockManagementIncrease=Regla de gestión de incrementos de stock @@ -61,7 +61,7 @@ ReStockOnDeleteInvoice=Incrementa los stocks físicos en la eliminación de fact OrderStatusNotReadyToDispatch=El pedido aún no está o no tiene un estado que permita un desglose de stock. StockDiffPhysicTeoric=Motivo de la diferencia entre valores físicos y teóricos NoPredefinedProductToDispatch=No hay productos predefinidos en este objeto. Por lo tanto no se puede realizar un desglose de stock. -DispatchVerb=Desglosar +DispatchVerb=Validar recepción StockLimitShort=Límite StockLimit=Stock límite para alertas PhysicalStock=Stock físico @@ -96,16 +96,17 @@ Replenishment=Reaprovisionamiento ReplenishmentOrders=Ordenes de reaprovisionamiento UseVirtualStock=Usar stock virtual en lugar de stock físico RuleForStockReplenishment=Regla para el reaprovisionamiento de stock -SelectProductWithNotNullQty=Seleccione al menos un proveedor y un producto con una cantidad válida -AlertOnly= Sólo alertas -WarehouseForStockDecrease=El almacén %s será utilizado para el decremento de stock -WarehouseForStockIncrease=El almacén %s será utilizado para el incremento de stock +SelectProductWithNotNullQty=Seleccie al menos un producto con una cantidad distinta de cero y un proveedor +AlertOnly=Sólo alertas +WarehouseForStockDecrease=Para el decremento de stock se usará el almacén %s +WarehouseForStockIncrease=Para el incremento de stock se usará el almacén %s ForThisWarehouse=Para este almacén -ReplenishmentStatusDesc=Esta es la lista de todos los productos con un stock físico menor que el stock deseado (o un valor de alerta si el checkbox "sólo alertas" está marcado) y que sugiere crear pedidos de proveedor para rellenar la diferencia. -ReplenishmentOrdersDesc=Esta es la lista de todos los pedidos de proveedor abiertos -Replenishments=Reaprovisionamientos -NbOfProductBeforePeriod=Cantidad de producto %s en stock antes del periodo seleccionado (< %s) -NbOfProductAfterPeriod=Cantidad de producto %s en stock después del periodo seleccionado (< %s) -MassStockMovement=Movimiento de stock masivo -SelectProductInAndOutWareHouse=Seleccione un producto, una cantidad, un almacén de origen y un almacén de destino, después pulse "%s". Una vez esto sea realizado para todos los movimientos requeridos, pulse en "%s". +ReplenishmentStatusDesc=Este listado le permite ver productos con un stock inferior a la cantidad mínima deseada (o valor de alerta si el checkbok "Sólo alertas" está activado) y le sugiere crear los pedidos a proveedores para completar la diferencia. +ReplenishmentOrdersDesc=Este es el listado de pedidos a proveedores en curso +Replenishments=Reaprovisionamiento +NbOfProductBeforePeriod=Cantidad del producto %s en stock antes del periodo seleccionado (< %s) +NbOfProductAfterPeriod=Cantidad del producto %s en stock después del periodo seleccionado (> %s) +MassStockMovement=Movimientos de stock en masa +SelectProductInAndOutWareHouse=Selecccione un producto, una cantidad, un almacén origen y un almacén destino, seguidamente haga clic "%s". Una vez seleccionados todos los movimientos, haga clic en "%s". RecordMovement=Registrar transferencias +ReceivingForSameOrder=Recepciones de este pedido \ No newline at end of file diff --git a/htdocs/langs/fr_FR/stocks.lang b/htdocs/langs/fr_FR/stocks.lang index 4d7fd8b6769..a39576f86f3 100644 --- a/htdocs/langs/fr_FR/stocks.lang +++ b/htdocs/langs/fr_FR/stocks.lang @@ -109,3 +109,4 @@ NbOfProductAfterPeriod=Quantité du produit %s en stock après la périod MassStockMovement=Mouvement de stock en masse SelectProductInAndOutWareHouse=Sélectionner un produit, une quantité à transférer, un entrepôt source et destination et cliquer sur "%s". Une fois tous les mouvements choisis, cliquer sur "%s". RecordMovement=Enregistrer transferts +ReceivingForSameOrder=Réceptions pour cette commande \ No newline at end of file diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 0176effbb18..8a6745da13f 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -2194,9 +2194,9 @@ class Product extends CommonObject $product = new Product($this->db); //var_dump($prod); - foreach($prod as $id_product => $desc_pere) // nom_pere is 0 or id of sub_product + foreach($prod as $id_product => $desc_pere) // $id_product is 0 (there is no mode sub_product) or an id of a sub_product { - if (is_array($desc_pere)) // If this parent desc is an array, this is an array of childs + if (is_array($desc_pere)) // If desc_pere is an array, this means it's a child { $id=(! empty($desc_pere[0]) ? $desc_pere[0] :''); $nb=(! empty($desc_pere[1]) ? $desc_pere[1] :''); @@ -2205,20 +2205,23 @@ class Product extends CommonObject if ($multiply < 1) $multiply=1; //print "XXX We add id=".$id." - label=".$label." - nb=".$nb." - multiply=".$multiply." fullpath=".$compl_path.$label."\n"; - $this->fetch($id); - $this->load_stock(); + $this->fetch($id); // Load product + $this->load_stock(); // Load stock $this->res[]= array( 'id'=>$id, // Id product + 'ref'=>$this->ref, // Ref product 'nb'=>$nb, // Nb of units that compose parent product 'nb_total'=>$nb*$multiply, // Nb of units for all nb of product - 'stock'=>$this->stock_warehouse[1]->real, // Stock + 'stock'=>$this->stock_reel, // Stock 'stock_alert'=>$this->seuil_stock_alerte, // Stock alert - 'fullpath' => $compl_path.$label, // Label + 'label'=>$label, + 'fullpath'=>$compl_path.$label, // Label 'type'=>$type, // Nb of units that compose parent product - 'desiredstock' => $this->desiredstock + 'desiredstock'=>$this->desiredstock, + 'level'=>$level ); - // Recursive call if child is an array + // Recursive call if there is childs to child if (is_array($desc_pere['childs'])) { //print 'YYY We go down for '.$desc_pere[3]." -> \n"; diff --git a/htdocs/product/composition/fiche.php b/htdocs/product/composition/fiche.php index b56f3ce6227..f94f831cc63 100644 --- a/htdocs/product/composition/fiche.php +++ b/htdocs/product/composition/fiche.php @@ -53,10 +53,11 @@ $mesg = ''; $product = new Product($db); $productid=0; -if ($id || $ref) +if ($id > 0 || ! empty($ref)) { $result = $product->fetch($id,$ref); $productid=$product->id; + $id=$product->id; } @@ -119,6 +120,10 @@ if ($cancel == $langs->trans("Cancel")) * View */ +$product_fourn = new ProductFournisseur($db); +$productstatic = new Product($db); +$form = new Form($db); + // action recherche des produits par mot-cle et/ou par categorie if ($action == 'search') { @@ -153,8 +158,6 @@ if ($action == 'search') } //print $sql; -$productstatic = new Product($db); -$form = new Form($db); llxHeader("","",$langs->trans("CardProduct".$product->type)); @@ -285,9 +288,36 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; + if (empty($conf->global->PRODUIT_MULTIPRICES)) + { + // Price + print ''; + + // Price minimum + print ''; + } + // Number of subproducts $prodsfather = $product->getFather(); //Parent Products - $product->get_sousproduits_arbo(); + $product->get_sousproduits_arbo(); // Defined $product->sousprod $prods_arbo=$product->get_arbo_each_prod(); $nbofsubproducts=count($prods_arbo); print ''; // List of subproducts - if(count($prods_arbo) > 0) + if (count($prods_arbo) > 0) { print ''; } @@ -328,7 +387,7 @@ if ($id > 0 || ! empty($ref)) if (count($prodsfather) > 0) { print '
'.$langs->trans("Label").''.$product->libelle.'
'.$langs->trans("SellingPrice").''; + if ($object->price_base_type == 'TTC') + { + print price($object->price_ttc).' '.$langs->trans($object->price_base_type); + } + else + { + print price($object->price).' '.$langs->trans($object->price_base_type); + } + print '
'.$langs->trans("MinPrice").''; + if ($object->price_base_type == 'TTC') + { + print price($object->price_min_ttc).' '.$langs->trans($object->price_base_type); + } + else + { + print price($object->price_min).' '.$langs->trans($object->price_base_type); + } + print '
'.$langs->trans("AssociatedProductsNumber").''; @@ -296,26 +326,55 @@ if ($id > 0 || ! empty($ref)) print '
'; - print ''.$langs->trans("ProductAssociationList").'
'; - print ''; + print $langs->trans("ProductAssociationList").'
'; + print '
'; foreach($prods_arbo as $value) { $productstatic->id=$value['id']; $productstatic->type=$value['type']; - $productstatic->ref=$value['fullpath']; - if (! empty($conf->stock->enabled)) $productstatic->load_stock(); - //var_dump($value); //print '
'.$productstatic->ref.'
'; //print $productstatic->getNomUrl(1).'
'; - //print $value[0]; // This contains a tr line. + //var_dump($value); print ''; - print ''; - if (! empty($conf->stock->enabled)) print ''; + if ($value['level'] <= 1) + { + $productstatic->ref=$value['fullpath']; + print ''; + print ''; + $totalline=price2num($value['nb'] * $product_fourn->fourn_unitprice, 'MT'); + $total+=$totalline; + print ''; + if (! empty($conf->stock->enabled)) print ''; // Real stock + } + else { + $productstatic->ref=$value['label']; + print ''; + print ''; // Real stock + } print ''; } + print ''; + print ''; + print ''; + if (! empty($conf->stock->enabled)) print ''; + print ''; print '
'.$productstatic->getNomUrl(1,'composition').' ('.$value['nb'].')    '.$langs->trans("Stock").' : '.$productstatic->stock_reel.''.$productstatic->getNomUrl(1,'composition').' ('.$value['nb'].')  '; + if ($product_fourn->find_min_price_product_fournisseur($productstatic->id, $value['nb']) > 0) + { + print $langs->trans("BuyingPriceMinShort").': '; + if ($product_fourn->product_fourn_price_id > 0) print $product_fourn->display_price_product_fournisseur(0,0); + else print $langs->trans("NotDefined"); + } + print ''.price($totalline,'','',0,0,-1,$conf->currency).''.$langs->trans("Stock").': '.$value['stock'].''; + for ($i=0; $i < $value['level']; $i++) + { + print '       '; + } + print $productstatic->getNomUrl(1,'composition').' ('.$value['nb'].')  '; + print ''; + if (! empty($conf->stock->enabled)) print '
'.$langs->trans("BuyingPriceMin").': '.price($total,'','',0,0,-1,$conf->currency).' 
'; print '
'; - print ''.$langs->trans("ProductParentList").'
'; + print $langs->trans("ProductParentList").'
'; print ''; foreach($prodsfather as $value) { @@ -393,7 +452,7 @@ if ($id > 0 || ! empty($ref)) print ''; if ($resql) { @@ -457,7 +516,7 @@ if ($id > 0 || ! empty($ref)) } print ''; - print ''; + print ''; print ''; } $i++;
'.$langs->trans("Ref").''; print ''.$langs->trans("Label").''; print ''.$langs->trans("AddDel").''; - print ''.$langs->trans("Quantity").''; + print ''.$langs->trans("Qty").''; print '
'; print '