DB_model bugfix:

- update method now is using _manageUDFs instead of directly UDFLib->manageUDFs
- _manageUDFs method now accept the id as third parameter
- if the third parameter of _manageUDFs is null the getUDFs is not
called
- If id parameter of method load is null now a correct parameter is given to
get_where
This commit is contained in:
Paolo
2017-08-23 10:47:12 +02:00
parent 3181d3741e
commit d1fa93a2b6
+11 -4
View File
@@ -111,7 +111,7 @@ class DB_Model extends FHC_Model
if (isError($ent = $this->_isEntitled(PermissionLib::UPDATE_RIGHT))) return $ent;
// If this table has UDF and the validation of them is ok
if (isError($validate = $this->udflib->manageUDFs($data, $this->dbTable, $this->getUDFs($id)))) return $validate;
if (isError($validate = $this->_manageUDFs($data, $this->dbTable, $id))) return $validate;
$tmpId = $id;
@@ -207,7 +207,7 @@ class DB_Model extends FHC_Model
$tmpId = $this->_arrayCombine($this->pk, $id);
}
}
else
elseif ($id != null)
{
$tmpId = array($this->pk => $id);
}
@@ -782,13 +782,20 @@ class DB_Model extends FHC_Model
/**
* Wrapper method for UDFLib->manageUDFs
*/
private function _manageUDFs(&$data, $schemaAndTable, $udfValues = null)
private function _manageUDFs(&$data, $schemaAndTable, $id = null)
{
$manageUDFs = success(true);
if ($this->hasUDF())
{
$manageUDFs = $this->udflib->manageUDFs($data, $this->dbTable, $this->getUDFs($id));
if ($id != null)
{
$manageUDFs = $this->udflib->manageUDFs($data, $this->dbTable, $this->getUDFs($id));
}
else
{
$manageUDFs = $this->udflib->manageUDFs($data, $this->dbTable);
}
}
return $manageUDFs;