Restore previous version

This commit is contained in:
Laurent Destailleur 2008-04-10 18:04:56 +00:00
parent 2167387eba
commit 43bcc207de

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
@ -18,15 +18,13 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/
/**
\file htdocs/product/price.php
\ingroup product
\brief Page de la fiche produit
\version $Revision$
\version $Id$
*/
require("./pre.inc.php");
@ -45,7 +43,7 @@ accessforbidden();
* Actions
*/
if ($_POST["action"] == 'update_price' &&
if ($_POST["action"] == 'update_price' &&
! $_POST["cancel"] && $user->rights->produit->creer)
{
$product = new Product($db);
@ -87,7 +85,7 @@ if ($_POST["action"] == 'update_price' &&
$newprice=price2num($_POST["price"],'MU');
$newpricebase=$_POST["price_base_type"];
}
if ($product->update_price($product->id, $newprice, $newpricebase, $user) > 0)
{
$_GET["action"] = '';
@ -146,7 +144,7 @@ if($conf->global->PRODUIT_MULTIPRICES)
{
print '<td>'.price($product->multiprices["$i"]);
}
if ($product->multiprices_base_type["$i"])
{
print ' '.$langs->trans($product->multiprices_base_type["$i"]);
@ -178,7 +176,7 @@ print $product->getLibStatut(2);
print '</td></tr>';
print "</table>\n";
print "</div>\n";
@ -208,10 +206,7 @@ if (! $_GET["action"])
*/
if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
{
$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);
print_fiche_titre($langs->trans("NewPrice"));
if (! $conf->global->PRODUIT_MULTIPRICES)
{
@ -220,7 +215,8 @@ if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
print '<input type="hidden" name="id" value="'.$product->id.'">';
print '<table class="border" width="100%">';
print '<tr><td width="15%">';
print $langs->trans('SellingPrice');
$text=$langs->trans('SellingPrice');
print $html->textwithhelp($text,$langs->trans("PrecisionUnitIsLimitedToXDecimals",$conf->global->MAIN_MAX_DECIMALS_UNIT),$direction=1,$usehelpcursor=1);
print '</td>';
if ($product->price_base_type == 'TTC')
@ -241,41 +237,35 @@ if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
}
else
{
print '<form action="price.php?id='.$product->id.'" method="post">';
print '<input type="hidden" name="action" value="update_price">';
for ( $i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++ ) {
print '<input type="hidden" name="id" value="'.$product->id.'">';
print '<table class="border" width="100%">';
print '<tr><td width="15%">';
print ( $langs->trans('SellingPrice').' '.$i );
print '</td>';
if ($product->multiprices_base_type["$i"] == 'TTC') {
print '<td><input name="price_'.$i.'" size="10" value="'.price($product->multiprices_ttc["$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"><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>';
for($i=1;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
{
print '<form action="price.php?id='.$product->id.'" method="post">';
print '<input type="hidden" name="action" value="update_price">';
print '<input type="hidden" name="id" value="'.$product->id.'">';
print '<table class="border" width="100%">';
print '<tr><td width="15%">';
$text=$langs->trans('SellingPrice').' '.$i;
print $html->textwithhelp($text,$langs->trans("PrecisionUnitIsLimitedToXDecimals",$conf->global->MAIN_MAX_DECIMALS_UNIT),$direction=1,$usehelpcursor=1);
print '</td>';
if ($product->multiprices_base_type["$i"] == 'TTC')
{
print '<td><input name="price_'.$i.'" size="10" value="'.price($product->multiprices_ttc["$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 '</table>';
print '</form>';
}
}
}
@ -326,12 +316,12 @@ if ($result)
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("AppliedPricesFrom").'</td>';
if($conf->global->PRODUIT_MULTIPRICES)
{
print '<td>'.$langs->trans("MultiPriceLevelsName").'</td>';
}
print '<td align="right">'.$langs->trans("HT").'</td>';
print '<td align="right">'.$langs->trans("TTC").'</td>';
print '<td align="center">'.$langs->trans("PriceBase").'</td>';
@ -347,7 +337,7 @@ if ($result)
print "<tr $bc[$var]>";
// Date
print "<td>".dolibarr_print_date($objp->dp,"dayhour")."</td>";
// catégorie de Prix
if ($conf->global->PRODUIT_MULTIPRICES)
{