Fix: merge array of hookmanager errors
This commit is contained in:
parent
dfb697d794
commit
93e3c3e3f3
@ -30,6 +30,8 @@
|
|||||||
class HookManager
|
class HookManager
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
|
var $error;
|
||||||
|
var $errors=array();
|
||||||
|
|
||||||
// Context hookmanager was created for ('thirdpartycard', 'thirdpartydao', ...)
|
// Context hookmanager was created for ('thirdpartycard', 'thirdpartydao', ...)
|
||||||
var $contextarray=array();
|
var $contextarray=array();
|
||||||
@ -146,7 +148,7 @@ class HookManager
|
|||||||
$resaction+=$actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
|
$resaction+=$actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
|
||||||
if ($resaction < 0 || ! empty($actionclassinstance->error) || (! empty($actionclassinstance->errors) && count($actionclassinstance->errors) > 0))
|
if ($resaction < 0 || ! empty($actionclassinstance->error) || (! empty($actionclassinstance->errors) && count($actionclassinstance->errors) > 0))
|
||||||
{
|
{
|
||||||
$this->error=$actionclassinstance->error; $this->errors=$actionclassinstance->errors;
|
$this->error=$actionclassinstance->error; $this->errors=array_merge($this->errors, (array) $actionclassinstance->errors);
|
||||||
if ($method == 'doActions')
|
if ($method == 'doActions')
|
||||||
{
|
{
|
||||||
if ($action=='add') $action='create'; // TODO this change must be inside the doActions
|
if ($action=='add') $action='create'; // TODO this change must be inside the doActions
|
||||||
|
|||||||
@ -80,7 +80,7 @@ $hookmanager->initHooks(array('thirdpartycard'));
|
|||||||
|
|
||||||
$parameters=array('id'=>$socid, 'objcanvas'=>$objcanvas);
|
$parameters=array('id'=>$socid, 'objcanvas'=>$objcanvas);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
$error=$hookmanager->error; $errors=$hookmanager->errors;
|
$error=$hookmanager->error; $errors=array_merge($errors, (array) $hookmanager->errors);
|
||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user