Readd call to hooks
This commit is contained in:
parent
ea7f702eec
commit
fda52360ef
@ -24,7 +24,7 @@
|
|||||||
* \file htdocs/contact/fiche.php
|
* \file htdocs/contact/fiche.php
|
||||||
* \ingroup societe
|
* \ingroup societe
|
||||||
* \brief Card of a contact
|
* \brief Card of a contact
|
||||||
* \version $Id: fiche.php,v 1.215 2011/06/30 13:25:32 hregis Exp $
|
* \version $Id: fiche.php,v 1.216 2011/06/30 22:38:06 eldy Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("../main.inc.php");
|
require("../main.inc.php");
|
||||||
@ -68,25 +68,28 @@ else
|
|||||||
$result = restrictedArea($user, 'contact', $id, 'socpeople'); // If we create a contact with no company (shared contacts), no check on write permission
|
$result = restrictedArea($user, 'contact', $id, 'socpeople'); // If we create a contact with no company (shared contacts), no check on write permission
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Instantiate hooks of thirdparty module
|
||||||
|
if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
|
||||||
|
{
|
||||||
|
$object->callHooks('contactcard');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// If canvas actions are defined, because on url, or because contact was created with canvas feature on, we use the canvas feature.
|
// If canvas actions are defined, because on url, or because contact was created with canvas feature on, we use the canvas feature.
|
||||||
// If canvas actions are not defined, we use standard feature.
|
// If canvas actions are not defined, we use standard feature.
|
||||||
|
// TODO DO not use this but hooks instead
|
||||||
if (method_exists($objcanvas->control,'doActions'))
|
if (method_exists($objcanvas->control,'doActions'))
|
||||||
{
|
{
|
||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
// When used with CANVAS
|
// When used with CANVAS
|
||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
$objcanvas->doActions($id);
|
$objcanvas->doActions($id);
|
||||||
if (empty($objcanvas->error) && (empty($objcanvas->errors) || sizeof($objcanvas->errors) == 0))
|
if (! empty($objcanvas->error) || (! empty($objcanvas->errors) && sizeof($objcanvas->errors) > 0))
|
||||||
{
|
|
||||||
if ($action=='add') { $objcanvas->action='create'; $action='create'; }
|
|
||||||
if ($action=='update') { $objcanvas->action='view'; $action='view'; }
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$error=$objcanvas->error; $errors=$objcanvas->errors;
|
$error=$objcanvas->error; $errors=$objcanvas->errors;
|
||||||
if ($action=='add') { $objcanvas->action='create'; $action='create'; }
|
if ($action=='add') { $objcanvas->action='create'; $action='create'; }
|
||||||
@ -950,5 +953,5 @@ else
|
|||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter('$Date: 2011/06/30 13:25:32 $ - $Revision: 1.215 $');
|
llxFooter('$Date: 2011/06/30 22:38:06 $ - $Revision: 1.216 $');
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -26,7 +26,7 @@
|
|||||||
* \file htdocs/societe/soc.php
|
* \file htdocs/societe/soc.php
|
||||||
* \ingroup societe
|
* \ingroup societe
|
||||||
* \brief Third party card page
|
* \brief Third party card page
|
||||||
* \version $Id: soc.php,v 1.113 2011/06/30 13:25:33 hregis Exp $
|
* \version $Id: soc.php,v 1.114 2011/06/30 22:38:07 eldy Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("../main.inc.php");
|
require("../main.inc.php");
|
||||||
@ -47,18 +47,21 @@ $langs->load("banks");
|
|||||||
$langs->load("users");
|
$langs->load("users");
|
||||||
if ($conf->notification->enabled) $langs->load("mails");
|
if ($conf->notification->enabled) $langs->load("mails");
|
||||||
|
|
||||||
|
$error=0; $errors=array();
|
||||||
|
|
||||||
$action = GETPOST('action');
|
$action = GETPOST('action');
|
||||||
$confirm = GETPOST('confirm');
|
$confirm = GETPOST('confirm');
|
||||||
|
|
||||||
|
$soc = new Societe($db);
|
||||||
|
$extrafields = new ExtraFields($db);
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$socid = GETPOST("socid");
|
$socid = GETPOST("socid");
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
|
|
||||||
$soc = new Societe($db);
|
|
||||||
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
// Get object canvas (By default, this is not defined, so standard usage of dolibarr)
|
||||||
if (!empty($socid)) $soc->getCanvas($socid);
|
if (!empty($socid)) $soc->getCanvas($socid);
|
||||||
$canvas = (!empty($soc->canvas)?$soc->canvas:GETPOST("canvas"));
|
$canvas = (!empty($soc->canvas)?$soc->canvas:GETPOST("canvas"));
|
||||||
|
|
||||||
if (! empty($canvas))
|
if (! empty($canvas))
|
||||||
{
|
{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/canvas.class.php");
|
||||||
@ -73,15 +76,42 @@ else
|
|||||||
$result = restrictedArea($user, 'societe', $socid);
|
$result = restrictedArea($user, 'societe', $socid);
|
||||||
}
|
}
|
||||||
|
|
||||||
$error=0; $errors=array();
|
// Instantiate hooks of thirdparty module
|
||||||
|
if (is_array($conf->hooks_modules) && !empty($conf->hooks_modules))
|
||||||
|
{
|
||||||
|
$object->callHooks('companycard');
|
||||||
|
}
|
||||||
|
|
||||||
$extrafields = new ExtraFields($db);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Hook of actions
|
||||||
|
if (! empty($object->hooks))
|
||||||
|
{
|
||||||
|
foreach($object->hooks as $hook)
|
||||||
|
{
|
||||||
|
if (! empty($hook['modules']))
|
||||||
|
{
|
||||||
|
foreach($hook['modules'] as $module)
|
||||||
|
{
|
||||||
|
if (method_exists($module,'doActions'))
|
||||||
|
{
|
||||||
|
$reshook+=$module->doActions($object);
|
||||||
|
if (! empty($module->error) || (! empty($module->errors) && sizeof($module->errors) > 0))
|
||||||
|
{
|
||||||
|
$mesg=$module->error; $mesgs[]=$module->errors;
|
||||||
|
if ($action=='add') $action='create';
|
||||||
|
if ($action=='update') $action='edit';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If canvas actions are defined, because on url, or because contact was created with canvas feature on, we use the canvas feature.
|
// If canvas actions are defined, because on url, or because contact was created with canvas feature on, we use the canvas feature.
|
||||||
// If canvas actions are not defined, we use standard feature.
|
// If canvas actions are not defined, we use standard feature.
|
||||||
if (method_exists($objcanvas->control,'doActions'))
|
if (method_exists($objcanvas->control,'doActions'))
|
||||||
@ -91,12 +121,7 @@ if (method_exists($objcanvas->control,'doActions'))
|
|||||||
// -----------------------------------------
|
// -----------------------------------------
|
||||||
$objcanvas->doActions($socid);
|
$objcanvas->doActions($socid);
|
||||||
|
|
||||||
if (empty($objcanvas->error) && (empty($objcanvas->errors) || sizeof($objcanvas->errors) == 0))
|
if (! empty($objcanvas->error) || (! empty($objcanvas->errors) && sizeof($objcanvas->errors) > 0))
|
||||||
{
|
|
||||||
if ($action=='add') { $objcanvas->action='create'; $action='create'; }
|
|
||||||
if ($action=='update') { $objcanvas->action='view'; $action='view'; }
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$error=$objcanvas->error; $errors=$objcanvas->errors;
|
$error=$objcanvas->error; $errors=$objcanvas->errors;
|
||||||
if ($action=='add') { $objcanvas->action='create'; $action='create'; }
|
if ($action=='add') { $objcanvas->action='create'; $action='create'; }
|
||||||
@ -1946,5 +1971,5 @@ else
|
|||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
llxFooter('$Date: 2011/06/30 13:25:33 $ - $Revision: 1.113 $');
|
llxFooter('$Date: 2011/06/30 22:38:07 $ - $Revision: 1.114 $');
|
||||||
?>
|
?>
|
||||||
Loading…
Reference in New Issue
Block a user