diff --git a/htdocs/langs/ca_ES/products.lang b/htdocs/langs/ca_ES/products.lang index 8f2fd4fcbeb..5c5b2a1dd60 100644 --- a/htdocs/langs/ca_ES/products.lang +++ b/htdocs/langs/ca_ES/products.lang @@ -45,12 +45,18 @@ Stock= Stock Stocks= Stocks Movement= Moviment Movements= Moviments +Sell= Vendes +Buy= Compres OnSell= En venda NotOnSell= Fora de venda ProductStatusOnSell= En venda ProductStatusNotOnSell= Fora de venda ProductStatusOnSellShort= En venta ProductStatusNotOnSellShort= Fora de venda +ProductStatusOnBuy= En compra +ProductStatusNotOnBuy= Fora de compra +ProductStatusOnBuyShort= En compra +ProductStatusNotOnBuyShort= Fora de compra UpdatePrice= Canviar preu AppliedPricesFrom= Preu de venda vàlid a partir de SellingPrice= Preu de venda diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index e68754ff8bc..2c8d533903f 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -45,12 +45,18 @@ Stock=Stock Stocks=Stocks Movement=Movement Movements=Movements +Sell=Sales +Buy=Purchases OnSell=Available NotOnSell=Obsolete ProductStatusOnSell=Available ProductStatusNotOnSell=Obsolete ProductStatusOnSellShort=Available ProductStatusNotOnSellShort=Obsolete +ProductStatusOnBuy=Available +ProductStatusNotOnBuy=Obsolete +ProductStatusOnBuyShort=Available +ProductStatusNotOnBuyShort=Obsolete UpdatePrice=Update price AppliedPricesFrom=Applied prices from SellingPrice=Selling price diff --git a/htdocs/langs/es_AR/products.lang b/htdocs/langs/es_AR/products.lang index 055d839d4e5..43ec6999213 100755 --- a/htdocs/langs/es_AR/products.lang +++ b/htdocs/langs/es_AR/products.lang @@ -45,12 +45,18 @@ Stock= Stock Stocks= Stocks Movement= Movimiento Movements= Movimientos +Sell= Ventas +Buy= Compras OnSell= En venta NotOnSell= Fuera de venta ProductStatusOnSell= En venta ProductStatusNotOnSell= Fuera de venta ProductStatusOnSellShort= En venta ProductStatusNotOnSellShort= Fuera de venta +ProductStatusOnBuy= En compra +ProductStatusNotOnBuy= Fuera de compra +ProductStatusOnBuyShort= En compra +ProductStatusNotOnBuyShort= Fuera compra UpdatePrice= Cambiar precio AppliedPricesFrom= Precio de venta válido a partir de SellingPrice= Precio de venta diff --git a/htdocs/langs/es_ES/products.lang b/htdocs/langs/es_ES/products.lang index 2b007c21636..9d5f82720d6 100644 --- a/htdocs/langs/es_ES/products.lang +++ b/htdocs/langs/es_ES/products.lang @@ -45,12 +45,18 @@ Stock= Stock Stocks= Stocks Movement= Movimiento Movements= Movimientos +Sell= Ventas +Buy= Compras OnSell= En venta NotOnSell= Fuera de venta ProductStatusOnSell= En venta ProductStatusNotOnSell= Fuera de venta ProductStatusOnSellShort= En venta ProductStatusNotOnSellShort= Fuera de venta +ProductStatusOnBuy= En compra +ProductStatusNotOnBuy= Fuera de compra +ProductStatusOnBuyShort= En compra +ProductStatusNotOnBuyShort= Fuera compra UpdatePrice= Cambiar precio AppliedPricesFrom= Precio de venta válido a partir de SellingPrice= Precio de venta diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index e18ebc02cda..c3bd107a8fa 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -45,12 +45,18 @@ Stock=Stock Stocks=Stocks Movement=Mouvement Movements=Mouvements +Sell=Vente +Buy=Achat OnSell=En vente NotOnSell=Hors vente ProductStatusOnSell=En vente ProductStatusNotOnSell=Hors vente ProductStatusOnSellShort=En vente ProductStatusNotOnSellShort=Hors vente +ProductStatusOnBuy=En achat +ProductStatusNotOnBuy=Hors achat +ProductStatusOnBuyShort=En achat +ProductStatusNotOnBuyShort=Hors achat UpdatePrice=Changer le prix AppliedPricesFrom=Prix de vente pratiqués à partir du SellingPrice=Prix de vente diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e62fac7ac93..22c941a6320 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -86,6 +86,8 @@ class Product extends CommonObject var $duration_unit; // Statut indique si le produit est en vente '1' ou non '0' var $status; + // Status indicate whether the product is available for purchase '1' or not '0' + var $status_buy; // Statut indique si le produit est un produit fini '1' ou une matiere premiere '0' var $finished; @@ -148,6 +150,7 @@ class Product extends CommonObject $this->db = $DB; $this->id = $id ; $this->status = 0; + $this->status_buy = 0; $this->nbphoto = 0; $this->stock_reel = 0; $this->seuil_stock_alerte = 0; @@ -207,6 +210,7 @@ class Product extends CommonObject if (empty($this->price)) $this->price = 0; if (empty($this->price_min)) $this->price_min = 0; if (empty($this->status)) $this->status = 0; + if (empty($this->status_buy)) $this->status_buy = 0; if (empty($this->finished)) $this->finished = 0; if (empty($this->hidden)) $this->hidden = 0; @@ -446,6 +450,7 @@ class Product extends CommonObject $sql.= ",localtax2_tx = " . $this->localtax2_tx; $sql.= ",tosell = " . $this->status; + $sql.= ",tobuy = " . $this->status_buy; $sql.= ",finished = " . ($this->finished<0 ? "null" : $this->finished); $sql.= ",hidden = " . ($this->hidden<0 ? "null" : $this->hidden); $sql.= ",weight = " . ($this->weight!='' ? "'".$this->weight."'" : 'null'); @@ -968,7 +973,7 @@ class Product extends CommonObject $sql = "SELECT rowid, ref, label, description, note, price, price_ttc,"; $sql.= " price_min, price_min_ttc, price_base_type, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, tosell,"; - $sql.= " fk_product_type, duration, seuil_stock_alerte, canvas,"; + $sql.= " tobuy, fk_product_type, duration, seuil_stock_alerte, canvas,"; $sql.= " weight, weight_units, length, length_units, surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished, hidden,"; $sql.= " accountancy_code_buy, accountancy_code_sell, stock, pmp,"; $sql.= " import_key"; @@ -1001,6 +1006,7 @@ class Product extends CommonObject $this->type = $result["fk_product_type"]; $this->status = $result["tosell"]; + $this->status_buy = $result["tobuy"]; $this->finished = $result["finished"]; $this->hidden = $result["hidden"]; $this->duration = $result["duration"]; @@ -2185,11 +2191,15 @@ class Product extends CommonObject /** * \brief Return label of status of object * \param mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * \param type 0=Shell, 1=Buy * \return string Label of status */ - function getLibStatut($mode=0) + function getLibStatut($mode=0, $type=0) { - return $this->LibStatut($this->status,$mode); + if($type==0) + return $this->LibStatut($this->status,$mode,$type); + else + return $this->LibStatut($this->status_buy,$mode,$type); } /** @@ -2198,24 +2208,25 @@ class Product extends CommonObject * \param mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * \return string Label of status */ - function LibStatut($status,$mode=0) + function LibStatut($status,$mode=0,$type=0) { global $langs; $langs->load('products'); + if ($mode == 0) { - if ($status == 0) return $langs->trans('ProductStatusNotOnSellShort'); - if ($status == 1) return $langs->trans('ProductStatusOnSellShort'); + if ($status == 0) return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')); + if ($status == 1) return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')); } if ($mode == 1) { - if ($status == 0) return $langs->trans('ProductStatusNotOnSell'); - if ($status == 1) return $langs->trans('ProductStatusOnSell'); + if ($status == 0) return ($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')); + if ($status == 1) return ($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')); } if ($mode == 2) { - if ($status == 0) return img_picto($langs->trans('ProductStatusNotOnSell'),'statut5').' '.$langs->trans('ProductStatusNotOnSell'); - if ($status == 1) return img_picto($langs->trans('ProductStatusOnSell'),'statut4').' '.$langs->trans('ProductStatusOnSell'); + if ($status == 0) return img_picto($langs->trans('ProductStatusNotOnSell'),'statut5').' '.($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuy')); + if ($status == 1) return img_picto($langs->trans('ProductStatusOnSell'),'statut4').' '.($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuy')); } if ($mode == 3) { @@ -2224,13 +2235,13 @@ class Product extends CommonObject } if ($mode == 4) { - if ($status == 0) return img_picto($langs->trans('ProductStatusNotOnSell'),'statut5').' '.$langs->trans('ProductStatusNotOnSell'); - if ($status == 1) return img_picto($langs->trans('ProductStatusOnSell'),'statut4').' '.$langs->trans('ProductStatusOnSell'); + if ($status == 0) return img_picto($langs->trans('ProductStatusNotOnSell'),'statut5').' '.($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')); + if ($status == 1) return img_picto($langs->trans('ProductStatusOnSell'),'statut4').' '.($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')); } if ($mode == 5) { - if ($status == 0) return $langs->trans('ProductStatusNotOnSell').' '.img_picto($langs->trans('ProductStatusNotOnSell'),'statut5'); - if ($status == 1) return $langs->trans('ProductStatusOnSell').' '.img_picto($langs->trans('ProductStatusOnSell'),'statut4'); + if ($status == 0) return $langs->trans('ProductStatusNotOnSellShort').' '.img_picto($langs->trans('ProductStatusNotOnSell'),'statut5'); + if ($status == 1) return $langs->trans('ProductStatusOnSellShort').' '.img_picto($langs->trans('ProductStatusOnSell'),'statut4'); } return $langs->trans('Unknown'); } @@ -2848,7 +2859,11 @@ class Product extends CommonObject // Status $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); $this->tpl['status'] = $html->selectarray('statut',$statutarray,$this->status); - + + //To Buy + $statutarray=array('1' => $langs->trans("Yes"), '0' => $langs->trans("No")); + $this->tpl['tobuy'] = $html->selectarray('tobuy',$statutarray,$this->status_buy); + // Hidden if ($this->user->rights->produit->hidden) { diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index e39c4b25101..7a61c7ae7a1 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -156,6 +156,7 @@ if ($_POST["action"] == 'add' && ($user->rights->produit->creer || $user->rights $product->type = $_POST["type"]; $product->status = $_POST["statut"]; + $product->status_buy = $_POST["statut_buy"]; $product->description = dol_htmlcleanlastbr($_POST["desc"]); $product->note = dol_htmlcleanlastbr($_POST["note"]); $product->duration_value = $_POST["duration_value"]; @@ -234,6 +235,7 @@ if ($_POST["action"] == 'update' && ($user->rights->produit->creer || $user->rig $product->description = dol_htmlcleanlastbr($_POST["desc"]); $product->note = dol_htmlcleanlastbr($_POST["note"]); $product->status = $_POST["statut"]; + $product->status_buy = $_POST["statut_buy"]; $product->seuil_stock_alerte = $_POST["seuil_stock_alerte"]; $product->duration_value = $_POST["duration_value"]; $product->duration_unit = $_POST["duration_unit"]; @@ -665,11 +667,17 @@ if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->righ // Label print ''.$langs->trans("Label").''; - // Status - print ''.$langs->trans("Status").''; + // On sell + print ''.$langs->trans("Status").' ('.$langs->trans("Sell").')'.''; $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); $html->select_array('statut',$statutarray,$_POST["statut"]); print ''; + + // To buy + print ''.$langs->trans("Status").' ('.$langs->trans("Buy").')'.''; + $statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell")); + $html->select_array('statut_buy',$statutarray,$_POST["statut_buy"]); + print ''; // Stock min level if ($_GET["type"] != 1 && $conf->stock->enabled) @@ -882,7 +890,7 @@ if ($_GET["id"] || $_GET["ref"]) print ''.$langs->trans("Label").''; // Status - print ''.$langs->trans("Status").''; + print ''.$langs->trans("Status").' ('.$langs->trans("Sell").')'.''; print ''; print ''; + + // To Buy + print ''.$langs->trans("Status").' ('.$langs->trans("Buy").')'.''; + print ''; + print ''; // Description (used in invoice, propal...) print ''.$langs->trans("Description").''; @@ -1075,8 +1099,13 @@ if ($_GET["id"] || $_GET["ref"]) print ''; // Statut - print ''.$langs->trans("Status").''; - print $product->getLibStatut(2); + print ''.$langs->trans("Status").' ('.$langs->trans("Sell").')'.''; + print $product->getLibStatut(2,0); + print ''; + + // To buy + print ''.$langs->trans("Status").' ('.$langs->trans("Buy").')'.''; + print $product->getLibStatut(2,1); print ''; // Description diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 7e921a8c9d0..54fda38de0c 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2004 Eric Seigne * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2010 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -222,7 +223,7 @@ if ($_GET["id"] || $_GET["ref"]) // Statut print ''.$langs->trans("Status").''; - print $product->getLibStatut(2); + print $product->getLibStatut(2,1); print ''; print '';