This commit is contained in:
Laurent Destailleur 2020-04-03 15:48:54 +02:00
parent e9bddf5c26
commit 372d719693

View File

@ -551,6 +551,7 @@ class MyObject extends CommonObject
} }
$this->newref = $num; $this->newref = $num;
if (! empty($num)) {
// Validate // Validate
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql .= " SET ref = '".$this->db->escape($num)."',"; $sql .= " SET ref = '".$this->db->escape($num)."',";
@ -575,6 +576,7 @@ class MyObject extends CommonObject
if ($result < 0) $error++; if ($result < 0) $error++;
// End call triggers // End call triggers
} }
}
if (!$error) if (!$error)
{ {
@ -946,6 +948,7 @@ class MyObject extends CommonObject
return ''; return '';
} }
if (class_exists($classname)) {
$obj = new $classname(); $obj = new $classname();
$numref = $obj->getNextValue($this); $numref = $obj->getNextValue($this);
@ -959,10 +962,14 @@ class MyObject extends CommonObject
//dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error); //dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error);
return ""; return "";
} }
} else {
print $langs->trans("Error")." ".$langs->trans("ClassNotFound");
return "";
}
} }
else else
{ {
print $langs->trans("Error")." ".$langs->trans("Error_MYMODULE_MYOBJECT_ADDON_NotDefined"); print $langs->trans("ErrorNumberingModuleNotSetup", $this->element);
return ""; return "";
} }
} }