From 6eea1f56c977f79e660acd01668b70cea3c8e6b0 Mon Sep 17 00:00:00 2001 From: eldy Date: Wed, 5 Oct 2011 14:29:16 +0200 Subject: [PATCH] More comments. --- htdocs/core/class/hookmanager.class.php | 11 +++++++---- htdocs/product/class/product.class.php | 14 ++++++-------- htdocs/societe/class/societe.class.php | 16 +++++++--------- test/phpunit/AllTests.php | 5 +++++ 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index b59cddc5764..950a060428e 100755 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -51,11 +51,14 @@ class HookManager /** * Init array this->hooks with instantiated controler - * A hook is declared by a module by adding a constant MAIN_MODULE_MYMODULENAME_HOOKS + * + * First, a hook is declared by a module by adding a constant MAIN_MODULE_MYMODULENAME_HOOKS * with value nameofhookkey1:nameofhookkey2:...:nameofhookkeyn. - * This add into conf->hooks_module an entries ('modulename'=>nameofhookkey) - * After this, this->hooks is defined - * @param arraytype Array list of hooked tab/features. For example: thirdpartytab, ... + * This add into conf->hooks_modules an entrie ('modulename'=>nameofhookkey) + * Then, when this function is called, an array this->hooks is defined with instance of controler + * classes that support the hook called + * + * @param arraytype Array list of searched hooks tab/features. For example: 'thirdpartytab', 'thirdparty',... * @return int Always 1 */ function callHooks($arraytype) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e6bb32deb36..277fd8a85ab 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -570,25 +570,23 @@ class Product extends CommonObject } } + // Removed extrafields + //$result=$this->deleteExtraFields($this); + //if ($result < 0) $error++; + if (! $error) { // Actions on extra fields (by external module or standard code) include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'); $hookmanager=new HookManager($this->db); - $hookmanager->callHooks(array('product_extrafields')); + $hookmanager->callHooks(array('product')); $parameters=array(); $action='delete'; - $reshook=$hookmanager->executeHooks('deleteExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + $reshook=$hookmanager->executeHooks('deleteProduct',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if (! empty($hookmanager->error)) { $error++; $this->error=$hookmanager->error; } - else if (empty($reshook)) - { - // TODO - //$result=$this->deleteExtraFields($this); - //if ($result < 0) $error++; - } } // Delete product diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 246444086bc..5e3ccc52321 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -942,25 +942,23 @@ class Societe extends CommonObject } } + // Removed extrafields + //$result=$this->deleteExtraFields($this); + //if ($result < 0) $error++; + if (! $error) { - // Actions on extra fields (by external module or standard code) + // Additionnal action by hooks include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'); $hookmanager=new HookManager($this->db); - $hookmanager->callHooks(array('thirdparty_extrafields')); + $hookmanager->callHooks(array('thirdparty')); $parameters=array(); $action='delete'; - $reshook=$hookmanager->executeHooks('deleteExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + $reshook=$hookmanager->executeHooks('deleteThirdparty',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if (! empty($hookmanager->error)) { $error++; $this->error=$hookmanager->error; } - else if (empty($reshook)) - { - // TODO - //$result=$this->deleteExtraFields($this); - //if ($result < 0) $error++; - } } // Remove third party diff --git a/test/phpunit/AllTests.php b/test/phpunit/AllTests.php index 864315d3c86..f697b33ad6c 100644 --- a/test/phpunit/AllTests.php +++ b/test/phpunit/AllTests.php @@ -45,6 +45,11 @@ $conf->global->MAIN_DISABLE_ALL_MAILS=1; */ class AllTests { + /** + * Function suite to make all PHPUnit tests + * + * @return void + */ public static function suite() { $suite = new PHPUnit_Framework_TestSuite('PHPUnit Framework');