check if hooks return false (but not action is taken)

This commit is contained in:
Uwe Steinmann 2021-07-08 14:19:36 +02:00
parent 13f0f6aafb
commit 42f2ce31cf
7 changed files with 15 additions and 15 deletions

View File

@ -52,7 +52,7 @@ class SeedDMS_Controller_EditDocument extends SeedDMS_Controller_Common {
$expires = $this->params['expires']; $expires = $this->params['expires'];
$oldexpires = $document->getExpires(); $oldexpires = $document->getExpires();
if ($expires != $oldexpires) { if ($expires != $oldexpires) {
if(!$this->callHook('preSetExpires', $document, $expires)) { if(false === $this->callHook('preSetExpires', $document, $expires)) {
} }
if(!$document->setExpires($expires)) { if(!$document->setExpires($expires)) {
@ -61,21 +61,21 @@ class SeedDMS_Controller_EditDocument extends SeedDMS_Controller_Common {
$document->verifyLastestContentExpriry(); $document->verifyLastestContentExpriry();
if(!$this->callHook('postSetExpires', $document, $expires)) { if(false === $this->callHook('postSetExpires', $document, $expires)) {
} }
} }
$keywords = $this->params['keywords']; $keywords = $this->params['keywords'];
$oldkeywords = $document->getKeywords(); $oldkeywords = $document->getKeywords();
if ($oldkeywords != $keywords) { if ($oldkeywords != $keywords) {
if(!$this->callHook('preSetKeywords', $document, $keywords, $oldkeywords)) { if(false === $this->callHook('preSetKeywords', $document, $keywords, $oldkeywords)) {
} }
if(!$document->setKeywords($keywords)) { if(!$document->setKeywords($keywords)) {
return false; return false;
} }
if(!$this->callHook('postSetKeywords', $document, $keywords, $oldkeywords)) { if(false === $this->callHook('postSetKeywords', $document, $keywords, $oldkeywords)) {
} }
} }
@ -95,21 +95,21 @@ class SeedDMS_Controller_EditDocument extends SeedDMS_Controller_Common {
if (count($categoriesarr) != count($oldcategories) || if (count($categoriesarr) != count($oldcategories) ||
array_diff($categories, $oldcatsids)) { array_diff($categories, $oldcatsids)) {
if(!$this->callHook('preSetCategories', $document, $categoriesarr, $oldcategories)) { if(false === $this->callHook('preSetCategories', $document, $categoriesarr, $oldcategories)) {
} }
if(!$document->setCategories($categoriesarr)) { if(!$document->setCategories($categoriesarr)) {
return false; return false;
} }
if(!$this->callHook('postSetCategories', $document, $categoriesarr, $oldcategories)) { if(false === $this->callHook('postSetCategories', $document, $categoriesarr, $oldcategories)) {
} }
} }
} elseif($oldcategories) { } elseif($oldcategories) {
if(!$this->callHook('preSetCategories', $document, array(), $oldcategories)) { if(false === $this->callHook('preSetCategories', $document, array(), $oldcategories)) {
} }
if(!$document->setCategories(array())) { if(!$document->setCategories(array())) {
return false; return false;
} }
if(!$this->callHook('postSetCategories', $document, array(), $oldcategories)) { if(false === $this->callHook('postSetCategories', $document, array(), $oldcategories)) {
} }
} }
@ -180,7 +180,7 @@ class SeedDMS_Controller_EditDocument extends SeedDMS_Controller_Common {
return false; return false;
} }
if(!$this->callHook('postEditDocument')) { if(false === $this->callHook('postEditDocument')) {
} }
return true; return true;

View File

@ -108,7 +108,7 @@ class SeedDMS_Controller_EditFolder extends SeedDMS_Controller_Common {
return false; return false;
} }
if(!$this->callHook('postEditFolder')) { if(false === $this->callHook('postEditFolder')) {
} }
return true; return true;

View File

@ -68,7 +68,7 @@ class SeedDMS_Controller_EmptyFolder extends SeedDMS_Controller_Common {
return false; return false;
} }
if(!$this->callHook('postEmptyFolder')) { if(false === $this->callHook('postEmptyFolder')) {
} }
return true; return true;

View File

@ -68,7 +68,7 @@ class SeedDMS_Controller_RemoveDocument extends SeedDMS_Controller_Common {
} }
} }
if(!$this->callHook('postRemoveDocument')) { if(false === $this->callHook('postRemoveDocument')) {
} }
return true; return true;

View File

@ -91,7 +91,7 @@ class SeedDMS_Controller_RemoveFolder extends SeedDMS_Controller_Common {
return false; return false;
} }
if(!$this->callHook('postRemoveFolder')) { if(false === $this->callHook('postRemoveFolder')) {
} }
return true; return true;

View File

@ -42,7 +42,7 @@ class SeedDMS_Controller_TransferDocument extends SeedDMS_Controller_Common {
if (!$document->transferToUser($newuser)) { if (!$document->transferToUser($newuser)) {
return false; return false;
} else { } else {
if(!$this->callHook('postTransferDocument')) { if(false === $this->callHook('postTransferDocument')) {
} }
} }
} }

View File

@ -88,7 +88,7 @@ class SeedDMS_Controller_UpdateDocument extends SeedDMS_Controller_Common {
} }
} }
if(!$this->callHook('postUpdateDocument', $document, $content)) { if(false === $this->callHook('postUpdateDocument', $document, $content)) {
} }
return $content; return $content;