Skip to content
Snippets Groups Projects
Commit a84c6f9b authored by fappels's avatar fappels
Browse files

Qual reputation for price supplier

Move available reputation constants from view-controller to class
parent 76bd5e00
No related branches found
No related tags found
No related merge requests found
......@@ -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'));
}
......
......@@ -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 '<tr><td>'.$langs->trans("SupplierReputation").'</td><td>';
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 '</td></tr>';
// Option to define a transport cost on supplier price
......@@ -673,8 +671,8 @@ if ($id > 0 || $ref)
// Reputation
print '<td align="center">';
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'</td>';
......@@ -700,7 +698,6 @@ if ($id > 0 || $ref)
if ($user->rights->produit->creer || $user->rights->service->creer)
{
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$productfourn->fourn_id.'&amp;action=add_price&amp;rowid='.$productfourn->product_fourn_price_id.'">'.img_edit()."</a>";
print ' &nbsp; ';
print '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;socid='.$productfourn->fourn_id.'&amp;action=ask_remove_pf&amp;rowid='.$productfourn->product_fourn_price_id.'">'.img_picto($langs->trans("Remove"),'disable.png').'</a>';
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment