Fix: Bug on mutliprices
This commit is contained in:
parent
c0b9a302ff
commit
df65583749
@ -61,6 +61,7 @@ class Product extends CommonObject
|
||||
var $multiprices=array();
|
||||
var $multiprices_ttc=array();
|
||||
var $multiprices_base_type=array();
|
||||
var $multiprices_tva_tx=array();
|
||||
//! Taux de TVA
|
||||
var $tva_tx;
|
||||
//! Type 0 for regular product, 1 for service, 2 for assembly kit, 3 for stock kit
|
||||
@ -342,7 +343,7 @@ class Product extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Retourne le texte de l'erreur
|
||||
* \brief Retourne le texte de l'erreur
|
||||
*/
|
||||
function error()
|
||||
{
|
||||
@ -354,11 +355,11 @@ class Product extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
\brief Mise a jour du produit en base
|
||||
\param id id du produit
|
||||
\param user utilisateur qui effectue l'insertion
|
||||
\return int 1 si ok, -1 si ref deja existante, -2 autre erreur
|
||||
*/
|
||||
* \brief Mise a jour du produit en base
|
||||
* \param id id du produit
|
||||
* \param user utilisateur qui effectue l'insertion
|
||||
* \return int 1 si ok, -1 si ref deja existante, -2 autre erreur
|
||||
*/
|
||||
function update($id, $user)
|
||||
{
|
||||
global $langs, $conf;
|
||||
@ -630,7 +631,7 @@ class Product extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* \ brief Charge toutes les traductions du produit
|
||||
* \brief Charge toutes les traductions du produit
|
||||
*/
|
||||
function getMultiLangs($langue='')
|
||||
{
|
||||
@ -1032,6 +1033,7 @@ class Product extends CommonObject
|
||||
$this->multiprices_min[$i]=$result["price_min"];
|
||||
$this->multiprices_min_ttc[$i]=$result["price_min_ttc"];
|
||||
$this->multiprices_base_type[$i]=$result["price_base_type"];
|
||||
$this->multiprices_tva_tx[$i]=$result["tva_tx"];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -722,37 +722,28 @@ if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->righ
|
||||
print '<table class="border" width="100%">';
|
||||
if($conf->global->PRODUIT_MULTIPRICES)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("SellingPrice").' 1</td>';
|
||||
print '<td><input name="price" size="10" value="'.$product->price.'">';
|
||||
print $html->select_PriceBaseType($product->price_base_type, "price_base_type");
|
||||
print '</td></tr>';
|
||||
for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("SellingPrice").' '.$i.'</td>';
|
||||
print '<td><input name="price_'.$i.'" size="10" value="'.$product->multiprices["$i"].'">';
|
||||
print $html->select_PriceBaseType($product->multiprices_base_type["$i"], "multiprices_base_type_".$i);
|
||||
print '</td></tr>';
|
||||
}
|
||||
// We do no show price array on create when multiprices enabled.
|
||||
// We must set them on prices tab.
|
||||
}
|
||||
// PRIX
|
||||
else
|
||||
{
|
||||
// PRIX
|
||||
print '<tr><td>'.$langs->trans("SellingPrice").'</td>';
|
||||
print '<td><input name="price" size="10" value="'.$product->price.'">';
|
||||
print $html->select_PriceBaseType($product->price_base_type, "price_base_type");
|
||||
print '</td></tr>';
|
||||
|
||||
// MIN PRICE
|
||||
print '<tr><td>'.$langs->trans("MinPrice").'</td>';
|
||||
print '<td><input name="price_min" size="10" value="'.$product->price_min.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// VAT
|
||||
print '<tr><td width="20%">'.$langs->trans("VATRate").'</td><td>';
|
||||
print $html->select_tva("tva_tx",$conf->defaulttx,$mysoc,'');
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// MIN PRICE
|
||||
print '<tr><td>'.$langs->trans("MinPrice").'</td>';
|
||||
print '<td><input name="price_min" size="10" value="'.$product->price_min.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
// VAT
|
||||
print '<tr><td width="20%">'.$langs->trans("VATRate").'</td><td>';
|
||||
print $html->select_tva("tva_tx",$conf->defaulttx,$mysoc,'');
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
@ -916,6 +907,9 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
print price($product->multiprices_min["$soc->price_level"]).' '.$langs->trans($product->multiprices_base_type["$soc->price_level"]);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// TVA
|
||||
print '<tr><td>'.$langs->trans("VATRate").'</td><td>'.vatrate($product->multiprices_tva_tx["$soc->price_level"],true).'</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -953,6 +947,9 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
print price($product->multiprices_min["$i"]).' '.$langs->trans($product->multiprices_base_type["$i"]);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// TVA
|
||||
print '<tr><td>'.$langs->trans("VATRate").' '.$i.'</td><td>'.vatrate($product->multiprices_tva_tx["$i"],true).'</td></tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -981,10 +978,10 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
print price($product->price_min).' '.$langs->trans($product->price_base_type);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// TVA
|
||||
print '<tr><td>'.$langs->trans("VATRate").'</td><td>'.vatrate($product->tva_tx,true).'</td></tr>';
|
||||
// TVA
|
||||
print '<tr><td>'.$langs->trans("VATRate").'</td><td>'.vatrate($product->tva_tx,true).'</td></tr>';
|
||||
}
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
||||
|
||||
@ -179,6 +179,9 @@ if($conf->global->PRODUIT_MULTIPRICES)
|
||||
print price($product->multiprices_min["$soc->price_level"]).' '.$langs->trans($product->multiprices_base_type["$soc->price_level"]);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// TVA
|
||||
print '<tr><td>'.$langs->trans("VATRate").'</td><td>'.vatrate($product->multiprices_tva_tx["$soc->price_level"],true).'</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -216,6 +219,9 @@ if($conf->global->PRODUIT_MULTIPRICES)
|
||||
print price($product->multiprices_min["$i"]).' '.$langs->trans($product->multiprices_base_type["$i"]);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// TVA
|
||||
print '<tr><td>'.$langs->trans("VATRate").' '.$i.'</td><td>'.vatrate($product->multiprices_tva_tx["$i"],true).'</td></tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -244,10 +250,11 @@ else
|
||||
print price($product->price_min).' '.$langs->trans($product->price_base_type);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// TVA
|
||||
print '<tr><td>'.$langs->trans("VATRate").'</td><td colspan="2">'.vatrate($product->tva_tx,true).'</td></tr>';
|
||||
// TVA
|
||||
print '<tr><td>'.$langs->trans("VATRate").'</td><td colspan="2">'.vatrate($product->tva_tx,true).'</td></tr>';
|
||||
|
||||
}
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user