Fix CFGTVA : id cannot be a float
This commit is contained in:
parent
743efc3223
commit
336ba04312
2 changed files with 28 additions and 7 deletions
|
|
@ -306,12 +306,19 @@ class Tva_Rate_MTable extends Manage_Table_SQL
|
|||
{
|
||||
$this->set_error("tva_both_side", _("Choix incorrect"));
|
||||
}
|
||||
|
||||
$flag = true;
|
||||
if ( isNumber($this->table->tva_id) == 0 || $this->table->tva_id != round($this->table->tva_id) )
|
||||
{
|
||||
$this->set_error("tva_id",_("Valeur invalide"));
|
||||
$flag=false;
|
||||
}
|
||||
// Check if old tva_id was not overwritting something
|
||||
if ( $this->previous_id != $this->table->tva_id && $cn->get_value("select count(*) from tva_rate where tva_id=$1",[$this->table->tva_id]) > 0)
|
||||
if ( $flag && $this->previous_id != $this->table->tva_id && $cn->get_value("select count(*) from tva_rate where tva_id=$1",[$this->table->tva_id]) > 0)
|
||||
{
|
||||
$this->set_error("tva_id",_("Code TVA déjà utilisé"));
|
||||
}
|
||||
// Check that tva_id is a integer not a float
|
||||
|
||||
if ($this->count_error()!=0)
|
||||
return false;
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue