mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-09 13:06:14 +00:00
fix call of hooks, add new variable 'lasterror'
This commit is contained in:
parent
ca0d66863d
commit
c6f85fc6e9
|
@ -188,10 +188,22 @@ class SeedDMS_Core_DMS {
|
||||||
*/
|
*/
|
||||||
public $callbacks;
|
public $callbacks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string last error message. This can be set by hooks to pass an
|
||||||
|
* error message from the hook to the application which has called the
|
||||||
|
* method containing the hook. For example SeedDMS_Core_Document::remove()
|
||||||
|
* calls the hook 'onPreRemoveDocument'. The hook function can set $dms->lasterror
|
||||||
|
* which can than be read when SeedDMS_Core_Document::remove() fails.
|
||||||
|
* This variable could be set in any SeedDMS_Core class, but is currently
|
||||||
|
* only set by hooks.
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public $lasterror;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var SeedDMS_Core_DMS
|
* @var SeedDMS_Core_DMS
|
||||||
*/
|
*/
|
||||||
public $_dms;
|
// public $_dms;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -381,6 +393,7 @@ class SeedDMS_Core_DMS {
|
||||||
$this->classnames['user'] = 'SeedDMS_Core_User';
|
$this->classnames['user'] = 'SeedDMS_Core_User';
|
||||||
$this->classnames['group'] = 'SeedDMS_Core_Group';
|
$this->classnames['group'] = 'SeedDMS_Core_Group';
|
||||||
$this->callbacks = array();
|
$this->callbacks = array();
|
||||||
|
$this->lasterror = '';
|
||||||
$this->version = '@package_version@';
|
$this->version = '@package_version@';
|
||||||
if($this->version[0] == '@')
|
if($this->version[0] == '@')
|
||||||
$this->version = '5.1.16';
|
$this->version = '5.1.16';
|
||||||
|
@ -2033,8 +2046,8 @@ class SeedDMS_Core_DMS {
|
||||||
$user = $this->getUser($this->db->getInsertID('tblUsers'));
|
$user = $this->getUser($this->db->getInsertID('tblUsers'));
|
||||||
|
|
||||||
/* Check if 'onPostAddUser' callback is set */
|
/* Check if 'onPostAddUser' callback is set */
|
||||||
if(isset($this->_dms->callbacks['onPostAddUser'])) {
|
if(isset($this->callbacks['onPostAddUser'])) {
|
||||||
foreach($this->_dms->callbacks['onPostUser'] as $callback) {
|
foreach($this->callbacks['onPostUser'] as $callback) {
|
||||||
/** @noinspection PhpStatementHasEmptyBodyInspection */
|
/** @noinspection PhpStatementHasEmptyBodyInspection */
|
||||||
if(!call_user_func($callback[0], $callback[1], $user)) {
|
if(!call_user_func($callback[0], $callback[1], $user)) {
|
||||||
}
|
}
|
||||||
|
@ -2096,8 +2109,8 @@ class SeedDMS_Core_DMS {
|
||||||
$group = $this->getGroup($this->db->getInsertID('tblGroups'));
|
$group = $this->getGroup($this->db->getInsertID('tblGroups'));
|
||||||
|
|
||||||
/* Check if 'onPostAddGroup' callback is set */
|
/* Check if 'onPostAddGroup' callback is set */
|
||||||
if(isset($this->_dms->callbacks['onPostAddGroup'])) {
|
if(isset($this->callbacks['onPostAddGroup'])) {
|
||||||
foreach($this->_dms->callbacks['onPostAddGroup'] as $callback) {
|
foreach($this->callbacks['onPostAddGroup'] as $callback) {
|
||||||
/** @noinspection PhpStatementHasEmptyBodyInspection */
|
/** @noinspection PhpStatementHasEmptyBodyInspection */
|
||||||
if(!call_user_func($callback[0], $callback[1], $group)) {
|
if(!call_user_func($callback[0], $callback[1], $group)) {
|
||||||
}
|
}
|
||||||
|
@ -2188,8 +2201,8 @@ class SeedDMS_Core_DMS {
|
||||||
$category = $this->getKeywordCategory($this->db->getInsertID('tblKeywordCategories'));
|
$category = $this->getKeywordCategory($this->db->getInsertID('tblKeywordCategories'));
|
||||||
|
|
||||||
/* Check if 'onPostAddKeywordCategory' callback is set */
|
/* Check if 'onPostAddKeywordCategory' callback is set */
|
||||||
if(isset($this->_dms->callbacks['onPostAddKeywordCategory'])) {
|
if(isset($this->callbacks['onPostAddKeywordCategory'])) {
|
||||||
foreach($this->_dms->callbacks['onPostAddKeywordCategory'] as $callback) {
|
foreach($this->callbacks['onPostAddKeywordCategory'] as $callback) {
|
||||||
/** @noinspection PhpStatementHasEmptyBodyInspection */
|
/** @noinspection PhpStatementHasEmptyBodyInspection */
|
||||||
if(!call_user_func($callback[0], $callback[1], $category)) {
|
if(!call_user_func($callback[0], $callback[1], $category)) {
|
||||||
}
|
}
|
||||||
|
@ -2265,8 +2278,8 @@ class SeedDMS_Core_DMS {
|
||||||
$category = $this->getDocumentCategory($this->db->getInsertID('tblCategory'));
|
$category = $this->getDocumentCategory($this->db->getInsertID('tblCategory'));
|
||||||
|
|
||||||
/* Check if 'onPostAddDocumentCategory' callback is set */
|
/* Check if 'onPostAddDocumentCategory' callback is set */
|
||||||
if(isset($this->_dms->callbacks['onPostAddDocumentCategory'])) {
|
if(isset($this->callbacks['onPostAddDocumentCategory'])) {
|
||||||
foreach($this->_dms->callbacks['onPostAddDocumentCategory'] as $callback) {
|
foreach($this->callbacks['onPostAddDocumentCategory'] as $callback) {
|
||||||
/** @noinspection PhpStatementHasEmptyBodyInspection */
|
/** @noinspection PhpStatementHasEmptyBodyInspection */
|
||||||
if(!call_user_func($callback[0], $callback[1], $category)) {
|
if(!call_user_func($callback[0], $callback[1], $category)) {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user