FIX Can not create contract with numbering module without autogen rule
This commit is contained in:
parent
9a9fd15077
commit
4022d5f529
@ -892,6 +892,7 @@ class Contrat extends CommonObject
|
|||||||
$sql.= ", ".(!empty($this->ref_ext)?("'".$this->db->escape($this->ref_ext)."'"):"NULL");
|
$sql.= ", ".(!empty($this->ref_ext)?("'".$this->db->escape($this->ref_ext)."'"):"NULL");
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
|
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
@ -908,9 +909,8 @@ class Contrat extends CommonObject
|
|||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$modCodeContract = new $module();
|
$modCodeContract = new $module();
|
||||||
|
if (! empty($modCodeContract->code_auto)) {
|
||||||
if (!empty($modCodeContract->code_auto)) {
|
// Force the ref to a draft value if numbering module is an automatic numbering
|
||||||
// Mise a jour ref
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."contrat SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX."contrat SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id;
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
@ -919,9 +919,6 @@ class Contrat extends CommonObject
|
|||||||
$this->ref="(PROV".$this->id.")";
|
$this->ref="(PROV".$this->id.")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$error++;
|
|
||||||
$this->error='Failed to get PROV number';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user