Task #9643: Works in Products
This commit is contained in:
parent
8f4973f3da
commit
03dcfb0443
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -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 '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input name="libelle" size="40" value="'.$_POST["libelle"].'"></td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").'</td><td>';
|
||||
// On sell
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Sell").')'.'</td><td>';
|
||||
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||
$html->select_array('statut',$statutarray,$_POST["statut"]);
|
||||
print '</td></tr>';
|
||||
|
||||
// To buy
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Status").' ('.$langs->trans("Buy").')'.'</td><td>';
|
||||
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||
$html->select_array('statut_buy',$statutarray,$_POST["statut_buy"]);
|
||||
print '</td></tr>';
|
||||
|
||||
// Stock min level
|
||||
if ($_GET["type"] != 1 && $conf->stock->enabled)
|
||||
@ -882,7 +890,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input name="libelle" size="40" value="'.$product->libelle.'"></td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">';
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')'.'</td><td colspan="2">';
|
||||
print '<select class="flat" name="statut">';
|
||||
if ($product->status)
|
||||
{
|
||||
@ -896,6 +904,22 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
}
|
||||
print '</select>';
|
||||
print '</td></tr>';
|
||||
|
||||
// To Buy
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')'.'</td><td colspan="2">';
|
||||
print '<select class="flat" name="statut_buy">';
|
||||
if ($product->status_buy)
|
||||
{
|
||||
print '<option value="1" selected="true">'.$langs->trans("OnSell").'</option>';
|
||||
print '<option value="0">'.$langs->trans("NotOnSell").'</option>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<option value="1">'.$langs->trans("OnSell").'</option>';
|
||||
print '<option value="0" selected="true">'.$langs->trans("NotOnSell").'</option>';
|
||||
}
|
||||
print '</select>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Description (used in invoice, propal...)
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="2">';
|
||||
@ -1075,8 +1099,13 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
print '</td></tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
||||
print $product->getLibStatut(2);
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')'.'</td><td>';
|
||||
print $product->getLibStatut(2,0);
|
||||
print '</td></tr>';
|
||||
|
||||
// To buy
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')'.'</td><td>';
|
||||
print $product->getLibStatut(2,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Description
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
* 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 '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">';
|
||||
print $product->getLibStatut(2);
|
||||
print $product->getLibStatut(2,1);
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user