Fix: Errors with price lower than 0 with some languages

This commit is contained in:
Laurent Destailleur 2009-01-25 14:30:42 +00:00
parent 9ec8049e11
commit 5f50893b48
6 changed files with 37 additions and 35 deletions

View File

@ -120,7 +120,9 @@ print '</td></tr>';
$var=!$var;
print "<tr ".$bc[$var]."><td width=\"140\"><input ".$bc[$var]." type=\"radio\" name=\"optionlogoutput\" value=\"file\"".($syslogfile?" checked":"")."> ".$langs->trans("SyslogSimpleFile")."</td>";
print '<td colspan="2">'.$langs->trans("SyslogFilename").': <input type="text" class="flat" name="filename" size="60" value="'.$defaultsyslogfile.'"></td></tr>';
print '<td colspan="2">'.$langs->trans("SyslogFilename").': <input type="text" class="flat" name="filename" size="60" value="'.$defaultsyslogfile.'">';
print ' '.img_info($langs->trans("YouCanUseDOL_DATA_ROOT"));
print '</td></tr>';
print "</table>\n";
print "</form>\n";

View File

@ -871,6 +871,7 @@ SyslogFacility=Facility
SyslogLevel=Level
SyslogSimpleFile=File
SyslogFilename=File name and path
YouCanUseDOL_DATA_ROOT=You can user DOL_DATA_ROOT/dolibarr.log for a log file in Dolibarr documents directory.
ErrorUnknownSyslogConstant=Constant %s is not a known syslog constant
##### Donations #####
DonationsSetup=Donation module setup

View File

@ -873,6 +873,7 @@ SyslogFacility=Facility
SyslogLevel=Niveau
SyslogSimpleFile=Fichier
SyslogFilename=Nom et chemin du fichier
YouCanUseDOL_DATA_ROOT=Vous pouvez utiliser DOL_DATA_ROOT/dolibarr.log pour une log dans le répertoire 'documents' de Dolibarr.
ErrorUnknownSyslogConstant=La constante %s n'est pas une constante syslog connue
##### Donations #####
DonationsSetup=Configuration du module Dons

View File

@ -165,6 +165,10 @@ class Product extends CommonObject
// Clean parameters
$this->ref = dol_string_nospecial(trim($this->ref));
$this->libelle = trim($this->libelle);
$this->price_ttc=price2num($this->price_ttc);
$this->price=price2num($this->price);
$this->price_min_ttc=price2num($this->price_min_ttc);
$this->price_min=price2num($this->price_min);
if (empty($this->tva_tx)) $this->tva_tx = 0;
if (empty($this->price)) $this->price = 0;
if (empty($this->price_min)) $this->price_min = 0;
@ -185,13 +189,12 @@ class Product extends CommonObject
$price_ht = price2num($this->price,'MU');
$price_ttc = price2num($this->price * (1 + ($this->tva_tx / 100)),'MU');
}
if (($this->price_min_ttc > 0)&&($this->price_base_type == 'TTC'))
if (($this->price_min_ttc > 0) && ($this->price_base_type == 'TTC'))
{
$price_min_ttc = price2num($this->price_min_ttc,'MU');
$price_min_ht = price2num($this->price_min_ttc / (1 + ($this->tva_tx / 100)),'MU');
}
if (($this->price_min > 0)&&($this->price_base_type != 'TTC'))
if (($this->price_min > 0) && ($this->price_base_type != 'TTC'))
{
$price_min_ht = price2num($this->price_min,'MU');
$price_min_ttc = price2num($this->price_min * (1 + ($this->tva_tx / 100)),'MU');
@ -204,7 +207,7 @@ class Product extends CommonObject
return -1;
}
dolibarr_syslog("Product::Create ref=".$this->ref." price=".$this->price." price_ttc=".$this->price_ttc." tva_tx=".$this->tva_tx." price_base_type=".$this->price_base_type." Categorie : ".$this->catid);
dolibarr_syslog("Product::Create ref=".$this->ref." price=".$this->price." price_ttc=".$this->price_ttc." tva_tx=".$this->tva_tx." price_base_type=".$this->price_base_type." Category : ".$this->catid, LOG_DEBUG);
if ($this->ref)
{

View File

@ -112,8 +112,7 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer)
{
if($_POST["price_".$i])
{
$price = price2num($_POST["price_".$i]);
$product->multiprices["$i"] = $price;
$product->multiprices["$i"] = price2num($_POST["price_".$i],'MU');
$product->multiprices_base_type["$i"] = $_POST["multiprices_base_type_".$i];
}
else
@ -128,7 +127,7 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer)
// Produit spécifique
// $_POST n'est pas utilise dans la classe Product
// mais dans des classes qui hérite de Product
$id = $product->create($user, $_POST);
$id = $product->create($user);
if ($id > 0)
{

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2009 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>
@ -236,7 +236,7 @@ if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
{
print_fiche_titre($langs->trans("NewPrice"),'','');
if (! $conf->global->PRODUIT_MULTIPRICES)
if (empty($conf->global->PRODUIT_MULTIPRICES))
{
print '<form action="price.php?id='.$product->id.'" method="post">';
print '<input type="hidden" name="action" value="update_price">';
@ -337,10 +337,6 @@ if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
print '</form>';
}
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>';
}
}