Fix: possibility to remove tabs

Fix: add hook in delete function
This commit is contained in:
Regis Houssin 2011-08-17 19:43:18 +00:00
parent 94e0b5c868
commit 78e351cc7c
4 changed files with 43 additions and 22 deletions

View File

@ -23,7 +23,7 @@
* \file htdocs/lib/company.lib.php
* \brief Ensemble de fonctions de base pour le module societe
* \ingroup societe
* \version $Id: company.lib.php,v 1.123 2011/07/31 23:25:41 eldy Exp $
* \version $Id: company.lib.php,v 1.124 2011/08/17 19:43:18 hregis Exp $
*/
/**
@ -190,16 +190,18 @@ function societe_admin_prepare_head($object)
$head[$h][2] = 'general';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/admin/societe_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'attributes';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'company_admin');
$head[$h][0] = DOL_URL_ROOT.'/admin/societe_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'attributes';
$h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'company_admin','remove');
return $head;
}

View File

@ -19,7 +19,7 @@
/**
* \file htdocs/lib/member.lib.php
* \brief Ensemble de fonctions de base pour les adherents
* \version $Id: member.lib.php,v 1.25 2011/07/31 23:26:02 eldy Exp $
* \version $Id: member.lib.php,v 1.26 2011/08/17 19:43:18 hregis Exp $
*
* Ensemble de fonctions de base de dolibarr sous forme d'include
*/
@ -110,6 +110,12 @@ function member_admin_prepare_head($object)
$head[$h][2] = 'general';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'member_admin');
$head[$h][0] = DOL_URL_ROOT.'/adherents/admin/adherent_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'attributes';
@ -119,12 +125,8 @@ function member_admin_prepare_head($object)
$head[$h][1] = $langs->trans("BlankSubscriptionForm");
$head[$h][2] = 'public';
$h++;
// Show more tabs from modules
// Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'member_admin');
complete_head_from_modules($conf,$langs,$object,$head,$h,'member_admin','remove');
return $head;
}

View File

@ -26,7 +26,7 @@
* \file htdocs/societe/class/societe.class.php
* \ingroup societe
* \brief File for third party class
* \version $Id: societe.class.php,v 1.98 2011/08/12 06:55:55 simnandez Exp $
* \version $Id: societe.class.php,v 1.99 2011/08/17 19:43:19 hregis Exp $
*/
require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
@ -219,7 +219,7 @@ class Societe extends CommonObject
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."societe");
$ret = $this->update($this->id,$user,0,1,1);
$ret = $this->update($this->id,$user,0,1,1,'add');
// si un commercial cree un client il lui est affecte automatiquement
if (!$user->rights->societe->client->voir)
@ -368,7 +368,7 @@ class Societe extends CommonObject
* @param allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur
* @return int <0 if KO, >=0 if OK
*/
function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0)
function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0, $action='update')
{
require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
@ -975,8 +975,25 @@ class Societe extends CommonObject
$this->error = $this->db->lasterror();
dol_syslog("Societe::Delete erreur -3 ".$this->error, LOG_ERR);
}
if ($sqr == 4)
{
// 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('thirdparty_extrafields'));
$parameters=array();
$reshook=$hookmanager->executeHooks('deleteExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
//TODO add deleteExtraFields function
//$result=$this->deleteExtraFields($this);
//if ($result > 0) $sqr++;
}
else if ($reshook > 0) $sqr++;
}
if ($sqr == 5)
{
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");

View File

@ -25,7 +25,7 @@
* \file htdocs/societe/soc.php
* \ingroup societe
* \brief Third party card page
* \version $Id: soc.php,v 1.135 2011/08/13 00:48:00 eldy Exp $
* \version $Id: soc.php,v 1.136 2011/08/17 19:43:19 hregis Exp $
*/
require("../main.inc.php");
@ -1013,7 +1013,7 @@ else
}
// Other attributes
$parameters=array();
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('showInputFields',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
@ -1442,7 +1442,7 @@ else
}
// Other attributes
$parameters=array();
$parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('showInputFields',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
@ -1783,7 +1783,7 @@ else
}
// Other attributes
$parameters=array('socid'=>$socid);
$parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('showOutputFields',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
@ -1973,5 +1973,5 @@ else
$db->close();
llxFooter('$Date: 2011/08/13 00:48:00 $ - $Revision: 1.135 $');
llxFooter('$Date: 2011/08/17 19:43:19 $ - $Revision: 1.136 $');
?>