Add patch of jeremie

This commit is contained in:
Laurent Destailleur 2008-04-10 18:00:31 +00:00
parent c430b25e5c
commit 2167387eba

View File

@ -45,7 +45,7 @@ accessforbidden();
* Actions * Actions
*/ */
if ($_POST["action"] == 'update_price' && if ($_POST["action"] == 'update_price' &&
! $_POST["cancel"] && $user->rights->produit->creer) ! $_POST["cancel"] && $user->rights->produit->creer)
{ {
$product = new Product($db); $product = new Product($db);
@ -87,7 +87,7 @@ if ($_POST["action"] == 'update_price' &&
$newprice=price2num($_POST["price"],'MU'); $newprice=price2num($_POST["price"],'MU');
$newpricebase=$_POST["price_base_type"]; $newpricebase=$_POST["price_base_type"];
} }
if ($product->update_price($product->id, $newprice, $newpricebase, $user) > 0) if ($product->update_price($product->id, $newprice, $newpricebase, $user) > 0)
{ {
$_GET["action"] = ''; $_GET["action"] = '';
@ -146,7 +146,7 @@ if($conf->global->PRODUIT_MULTIPRICES)
{ {
print '<td>'.price($product->multiprices["$i"]); print '<td>'.price($product->multiprices["$i"]);
} }
if ($product->multiprices_base_type["$i"]) if ($product->multiprices_base_type["$i"])
{ {
print ' '.$langs->trans($product->multiprices_base_type["$i"]); print ' '.$langs->trans($product->multiprices_base_type["$i"]);
@ -178,7 +178,7 @@ print $product->getLibStatut(2);
print '</td></tr>'; print '</td></tr>';
print "</table>\n"; print "</table>\n";
print "</div>\n"; print "</div>\n";
@ -208,7 +208,10 @@ if (! $_GET["action"])
*/ */
if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer) if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
{ {
print_fiche_titre($langs->trans("NewPrice")); $texte = $langs->trans("NewPrice");
$titre = $html->textwithhelp($texte, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), $direction=1, $usehelpcursor=1);
print_fiche_titre($titre);
if (! $conf->global->PRODUIT_MULTIPRICES) if (! $conf->global->PRODUIT_MULTIPRICES)
{ {
@ -217,8 +220,7 @@ if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
print '<input type="hidden" name="id" value="'.$product->id.'">'; print '<input type="hidden" name="id" value="'.$product->id.'">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="15%">'; print '<tr><td width="15%">';
$text=$langs->trans('SellingPrice'); print $langs->trans('SellingPrice');
print $html->textwithhelp($text,$langs->trans("PrecisionUnitIsLimitedToXDecimals",$conf->global->MAIN_MAX_DECIMALS_UNIT),$direction=1,$usehelpcursor=1);
print '</td>'; print '</td>';
if ($product->price_base_type == 'TTC') if ($product->price_base_type == 'TTC')
@ -239,35 +241,41 @@ if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
} }
else else
{ {
for($i=1;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
{ print '<form action="price.php?id='.$product->id.'" method="post">';
print '<form action="price.php?id='.$product->id.'" method="post">'; print '<input type="hidden" name="action" value="update_price">';
print '<input type="hidden" name="action" value="update_price">';
print '<input type="hidden" name="id" value="'.$product->id.'">'; for ( $i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++ ) {
print '<table class="border" width="100%">';
print '<tr><td width="15%">'; print '<input type="hidden" name="id" value="'.$product->id.'">';
$text=$langs->trans('SellingPrice').' '.$i; print '<table class="border" width="100%">';
print $html->textwithhelp($text,$langs->trans("PrecisionUnitIsLimitedToXDecimals",$conf->global->MAIN_MAX_DECIMALS_UNIT),$direction=1,$usehelpcursor=1); print '<tr><td width="15%">';
print '</td>';
print ( $langs->trans('SellingPrice').' '.$i );
if ($product->multiprices_base_type["$i"] == 'TTC') print '</td>';
{
print '<td><input name="price_'.$i.'" size="10" value="'.price($product->multiprices_ttc["$i"]).'">'; if ($product->multiprices_base_type["$i"] == 'TTC') {
}
else print '<td><input name="price_'.$i.'" size="10" value="'.price($product->multiprices_ttc["$i"]).'">';
{
print '<td><input name="price_'.$i.'" size="10" value="'.price($product->multiprices["$i"]).'">'; } else {
}
print '<td><input name="price_'.$i.'" size="10" value="'.price($product->multiprices["$i"]).'">';
print $html->select_PriceBaseType($product->multiprices_base_type["$i"], "multiprices_base_type_".$i);
print '</td></tr>'; }
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'">&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>'; print $html->select_PriceBaseType($product->multiprices_base_type["$i"], "multiprices_base_type_".$i);
print '</table>'; print '</td></tr>';
print '</form>';
} }
print '<tr><td colspan="2"><input type="submit" class="button" value="'.$langs->trans("Save").'">&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
print '</table>';
print '</form>';
} }
} }
@ -318,12 +326,12 @@ if ($result)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("AppliedPricesFrom").'</td>'; print '<td>'.$langs->trans("AppliedPricesFrom").'</td>';
if($conf->global->PRODUIT_MULTIPRICES) if($conf->global->PRODUIT_MULTIPRICES)
{ {
print '<td>'.$langs->trans("MultiPriceLevelsName").'</td>'; print '<td>'.$langs->trans("MultiPriceLevelsName").'</td>';
} }
print '<td align="right">'.$langs->trans("HT").'</td>'; print '<td align="right">'.$langs->trans("HT").'</td>';
print '<td align="right">'.$langs->trans("TTC").'</td>'; print '<td align="right">'.$langs->trans("TTC").'</td>';
print '<td align="center">'.$langs->trans("PriceBase").'</td>'; print '<td align="center">'.$langs->trans("PriceBase").'</td>';
@ -339,7 +347,7 @@ if ($result)
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
// Date // Date
print "<td>".dolibarr_print_date($objp->dp,"dayhour")."</td>"; print "<td>".dolibarr_print_date($objp->dp,"dayhour")."</td>";
// catégorie de Prix // catégorie de Prix
if ($conf->global->PRODUIT_MULTIPRICES) if ($conf->global->PRODUIT_MULTIPRICES)
{ {