Fix: Errors with price lower than 0 with some languages
This commit is contained in:
parent
9ec8049e11
commit
5f50893b48
@ -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";
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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)
|
||||
{
|
||||
@ -795,7 +798,7 @@ class Product extends CommonObject
|
||||
function update_price($id, $newprice, $newpricebase, $user, $newvat='',$newminprice='', $level=0)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
|
||||
dolibarr_syslog("Product::update_price id=".$id." newprice=".$newprice." newpricebase=".$newpricebase." newminprice=".$newminprice." level=".$level, LOG_DEBUG);
|
||||
|
||||
if ($newvat == '') $newvat=$this->tva_tx;
|
||||
@ -990,7 +993,7 @@ class Product extends CommonObject
|
||||
if ( $result )
|
||||
{
|
||||
$result = $this->db->fetch_array();
|
||||
|
||||
|
||||
$this->multiprices[$i]=$result["price"];
|
||||
$this->multiprices_ttc[$i]=$result["price_ttc"];
|
||||
$this->multiprices_min[$i]=$result["price_min"];
|
||||
@ -1003,7 +1006,7 @@ class Product extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
$res=$this->load_stock();
|
||||
@ -1654,7 +1657,7 @@ class Product extends CommonObject
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur ";
|
||||
$sql .= " (datec, fk_product, fk_soc, ref_fourn, fk_user_author)";
|
||||
$sql .= " VALUES (".$this->db->idate(mktime()).", ".$this->id.", ".$id_fourn.", '".$ref_fourn."', ".$user->id.")";
|
||||
|
||||
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
$this->product_fourn_id = $this->db->last_insert_id(MAIN_DB_PREFIX."product_fournisseur");
|
||||
@ -2312,7 +2315,7 @@ class Product extends CommonObject
|
||||
$this->stock_reel = $this->stock_reel + $row[0];
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
$this->no_stock = 0;
|
||||
}
|
||||
else
|
||||
@ -2580,10 +2583,10 @@ class Product extends CommonObject
|
||||
$dir = dirname($file).'/'; // Chemin du dossier contenant l'image d'origine
|
||||
$dirthumb = $dir.'/thumbs/'; // Chemin du dossier contenant la vignette
|
||||
$filename = eregi_replace($dir,'',$file); // Nom du fichier
|
||||
|
||||
|
||||
// On efface l'image d'origine
|
||||
unlink($file);
|
||||
|
||||
|
||||
// Si elle existe, on efface la vignette
|
||||
if (eregi('(\.jpg|\.bmp|\.gif|\.png|\.tiff)$',$filename,$regs))
|
||||
{
|
||||
|
||||
@ -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)
|
||||
{
|
||||
@ -240,7 +239,7 @@ if ($_GET["action"] == 'clone' && $user->rights->produit->creer)
|
||||
|
||||
$_error = 1;
|
||||
$_GET["action"] = "";
|
||||
|
||||
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorProductAlreadyExists",$product->ref).'</div>';
|
||||
//dolibarr_print_error($product->db);
|
||||
}
|
||||
@ -641,7 +640,7 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
|
||||
$html->select_array('finished',$statutarray,$_POST["finished"]);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
//Duration
|
||||
if ($_GET["type"] == 1)
|
||||
{
|
||||
@ -868,7 +867,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
print ' '.$langs->trans($product->price_base_type);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Prix mini
|
||||
print '<tr><td>'.$langs->trans("MinPrice").' '.$i.'</td><td>';
|
||||
if ($product->multiprices_base_type["$i"] == 'TTC')
|
||||
@ -879,7 +878,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
{
|
||||
print price($product->multiprices_min["$i"]).' '.$langs->trans($product->multiprices_base_type["$i"]);
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -895,7 +894,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
print price($product->price).' '.$langs->trans($product->price_base_type);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Prix mini
|
||||
print '<tr><td>'.$langs->trans("MinPrice").'</td><td>';
|
||||
if ($product->price_base_type == 'TTC')
|
||||
@ -916,7 +915,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
||||
print $product->getLibStatut(2);
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Description
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>'.nl2br($product->description).'</td></tr>';
|
||||
|
||||
@ -927,7 +926,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
print $product->getLibFinished();
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
|
||||
if ($product->isservice())
|
||||
{
|
||||
// Duration
|
||||
@ -969,7 +968,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
}
|
||||
print "</td></tr>\n";
|
||||
}
|
||||
|
||||
|
||||
// Note
|
||||
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td>'.nl2br($product->note).'</td></tr>';
|
||||
|
||||
@ -1019,7 +1018,7 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
}
|
||||
print '</select>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Description (utilisé dans facture, propale...)
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="2">';
|
||||
print "\n";
|
||||
|
||||
@ -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>
|
||||
@ -154,7 +154,7 @@ if ($conf->global->PRODUIT_MULTIPRICES)
|
||||
print ' '.$langs->trans($product->price_base_type);
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Prix minimum
|
||||
print '<tr><td>'.$langs->trans("MinPrice").' '.$i.'</td><td>';
|
||||
if ($product->multiprices_base_type["$i"] == 'TTC')
|
||||
@ -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">';
|
||||
@ -266,7 +266,7 @@ if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
|
||||
print '<input name="price" size="10" value="'.price($product->price).'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr><td>' ;
|
||||
$text=$langs->trans('MinPrice') ;
|
||||
print $html->textwithhelp($text,$langs->trans("PrecisionUnitIsLimitedToXDecimals",$conf->global->MAIN_MAX_DECIMALS_UNIT),$direction=1,$usehelpcursor=1);
|
||||
@ -325,22 +325,18 @@ if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
|
||||
print '<td><input name="price_min_'.$i.'" size="10" value="'.price($product->multiprices_min["$i"]).'">';
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// VAT
|
||||
print '<tr><td>'.$langs->trans("VATRate").'</td><td>';
|
||||
print $html->select_tva("tva_tx_".$i,$product->multiprices_tva_tx["$i"],$mysoc,'');
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -406,7 +402,7 @@ if ($result)
|
||||
print "<tr $bc[$var]>";
|
||||
// Date
|
||||
print "<td>".dolibarr_print_date($objp->dp,"dayhour")."</td>";
|
||||
|
||||
|
||||
// Price level
|
||||
if ($conf->global->PRODUIT_MULTIPRICES)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user