diff --git a/html/js/managetable.js b/html/js/managetable.js
index 864b17230..4630700fb 100644
--- a/html/js/managetable.js
+++ b/html/js/managetable.js
@@ -132,6 +132,7 @@ var ManageTable = function (p_table_name)
var row=p_table.insertRow(p_table.rows.length);
row.innerHTML=p_element_row.innerHTML;
row.id=p_element_row.id;
+ row.ctl_pk_id=row.id;
return;
}
// loop for each row , compare the innerHTML of the column with the
@@ -152,6 +153,7 @@ var ManageTable = function (p_table_name)
var row=p_table.insertRow(i);
row.innerHTML=p_element_row.innerHTML;
row.id=p_element_row.id;
+ row.ctl_pk_id=row.id;
return;
}
}
diff --git a/include/class/tva_rate_mtable.class.php b/include/class/tva_rate_mtable.class.php
index b1e5ab62f..0eb277a8f 100644
--- a/include/class/tva_rate_mtable.class.php
+++ b/include/class/tva_rate_mtable.class.php
@@ -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;