diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index e59144abc2e..eaff46ddc2c 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -70,7 +70,8 @@ class ProductFournisseur extends Product var $fourn_unitcharges; // old version used a buggy system to calculate margin of a charge field on supplier price. Now margin is on pmp, best supplier price or cost price. var $fk_supplier_price_expression; - + var $supplier_reputation; // reputation of supplier + var $reputations=array(); // list of available supplier reputations /** * Constructor @@ -79,7 +80,11 @@ class ProductFournisseur extends Product */ function __construct($db) { + global $langs; + $this->db = $db; + $langs->load("suppliers"); + $this->reputations= array('-1'=>'', 'FAVORITE'=>$langs->trans('Favorite'),'NOTTHGOOD'=>$langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER'=>$langs->trans('DoNotOrderThisProductToThisSupplier')); } diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 27b3780e2a7..8c389776573 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -77,8 +77,6 @@ if ($id > 0 || $ref) $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); -$reputations=array('-1'=>'', 'FAVORITE'=>$langs->trans('Favorite'),'NOTTHGOOD'=>$langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER'=>$langs->trans('DoNotOrderThisProductToThisSupplier')); - if (! $sortfield) $sortfield="s.nom"; if (! $sortorder) $sortorder="ASC"; @@ -527,7 +525,7 @@ if ($id > 0 || $ref) // Reputation print ''.$langs->trans("SupplierReputation").''; - echo $form->selectarray('supplier_reputation', $reputations, $supplier_reputation?$supplier_reputation:$object->supplier_reputation); + echo $form->selectarray('supplier_reputation', $object->reputations, $supplier_reputation?$supplier_reputation:$object->supplier_reputation); print ''; // Option to define a transport cost on supplier price @@ -673,8 +671,8 @@ if ($id > 0 || $ref) // Reputation print ''; - if (!empty($productfourn->supplier_reputation) && !empty($reputations[$productfourn->supplier_reputation])) { - print $reputations[$productfourn->supplier_reputation]; + if (!empty($productfourn->supplier_reputation) && !empty($object->reputations[$productfourn->supplier_reputation])) { + print $object->reputations[$productfourn->supplier_reputation]; } print''; @@ -700,7 +698,6 @@ if ($id > 0 || $ref) if ($user->rights->produit->creer || $user->rights->service->creer) { print ''.img_edit().""; - print '   '; print ''.img_picto($langs->trans("Remove"),'disable.png').''; }