More comments.

This commit is contained in:
eldy 2011-10-05 14:29:16 +02:00
parent f4a3e6a1a7
commit 6eea1f56c9
4 changed files with 25 additions and 21 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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');