Can add tabs from an external module on all entities

This commit is contained in:
Laurent Destailleur 2008-12-11 20:12:44 +00:00
parent 02a4e8e1e0
commit f5931aa6f0
7 changed files with 230 additions and 126 deletions

View File

@ -16,38 +16,35 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/
*
* $Id$
* $Source$
*/
/**
\file htdocs/lib/fichinter.lib.php
\brief Ensemble de fonctions de base pour le module fichinter
\ingroup fichinter
\version $Revision$
Ensemble de fonctions de base de dolibarr sous forme d'include
*/
* \file htdocs/lib/fichinter.lib.php
* \brief Ensemble de fonctions de base pour le module fichinter
* \ingroup fichinter
* \version $Id$
*
* Ensemble de fonctions de base de dolibarr sous forme d'include
*/
function fichinter_prepare_head($fichinter)
{
global $langs, $conf, $user;
$langs->load("fichinter");
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/fichinter/fiche.php?id='.$fichinter->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/fichinter/contact.php?id='.$fichinter->id;
global $langs, $conf, $user;
$langs->load("fichinter");
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/fichinter/fiche.php?id='.$fichinter->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/fichinter/contact.php?id='.$fichinter->id;
$head[$h][1] = $langs->trans('InterventionContact');
$head[$h][2] = 'contact';
$h++;
if ($conf->use_preview_tabs)
{
$head[$h][0] = DOL_URL_ROOT.'/fichinter/apercu.php?id='.$fichinter->id;
@ -55,18 +52,33 @@ function fichinter_prepare_head($fichinter)
$head[$h][2] = 'preview';
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/fichinter/note.php?id='.$fichinter->id;
$head[$h][1] = $langs->trans('Notes');
$head[$h][2] = 'note';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/fichinter/info.php?id='.$fichinter->id;
$head[$h][1] = $langs->trans('Info');
$head[$h][2] = 'info';
$h++;
return $head;
// More tabs from modules
if (is_array($conf->tabs_modules['intervention']))
{
$i=0;
foreach ($conf->tabs_modules['intervention'] as $value)
{
$values=split(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = eregi_replace('__ID__',$fichinter->id,$values[3]);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;
}
}
return $head;
}
?>

View File

@ -50,6 +50,21 @@ function facturefourn_prepare_head($fac)
$head[$h][2] = 'info';
$h++;
// More tabs from modules
if (is_array($conf->tabs_modules['supplier_invoice']))
{
$i=0;
foreach ($conf->tabs_modules['supplier_invoice'] as $value)
{
$values=split(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = eregi_replace('__ID__',$fac->id,$values[3]);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;
}
}
return $head;
}
@ -85,6 +100,21 @@ function ordersupplier_prepare_head($commande)
$head[$h][2] = 'info';
$h++;
// More tabs from modules
if (is_array($conf->tabs_modules['supplier_order']))
{
$i=0;
foreach ($conf->tabs_modules['supplier_order'] as $value)
{
$values=split(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = eregi_replace('__ID__',$commande->id,$values[3]);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;
}
}
return $head;
}

View File

@ -18,12 +18,13 @@
*/
/**
\file htdocs/lib/invoice.lib.php
\brief Ensemble de fonctions de base pour le module factures
\version $Id$
Ensemble de fonctions de base de dolibarr sous forme d'include
*/
* \file htdocs/lib/invoice.lib.php
* \brief Ensemble de fonctions de base pour le module factures
* \ingroup invoice
* \version $Id$ *
*
* Ensemble de fonctions de base de dolibarr sous forme d'include
*/
function facture_prepare_head($fac)
{
@ -72,6 +73,21 @@ function facture_prepare_head($fac)
$head[$h][2] = 'info';
$h++;
// More tabs from modules
if (is_array($conf->tabs_modules['invoice']))
{
$i=0;
foreach ($conf->tabs_modules['invoice'] as $value)
{
$values=split(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = eregi_replace('__ID__',$fac->id,$values[3]);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;
}
}
return $head;
}

View File

@ -15,18 +15,15 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/
*
* $Id$
* $Source$
*/
/**
\file htdocs/lib/member.lib.php
\brief Ensemble de fonctions de base pour les adhérents
\version $Revision$
Ensemble de fonctions de base de dolibarr sous forme d'include
*/
* \file htdocs/lib/member.lib.php
* \brief Ensemble de fonctions de base pour les adhérents
* \version $Id$
*
* Ensemble de fonctions de base de dolibarr sous forme d'include
*/
function member_prepare_head($member)
{
@ -68,6 +65,21 @@ function member_prepare_head($member)
$head[$h][2] = 'info';
$h++;
// More tabs from modules
if (is_array($conf->tabs_modules['member']))
{
$i=0;
foreach ($conf->tabs_modules['member'] as $value)
{
$values=split(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = eregi_replace('__ID__',$member->id,$values[3]);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;
}
}
return $head;
}

View File

@ -27,70 +27,85 @@
function commande_prepare_head($commande)
{
global $langs, $conf, $user;
if ($conf->expedition->enabled) $langs->load("sendings");
$langs->load("orders");
$h = 0;
$head = array();
if ($conf->commande->enabled && $user->rights->commande->lire)
{
$head[$h][0] = DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id;
$head[$h][1] = $langs->trans("OrderCard");
$head[$h][2] = 'order';
$h++;
}
if (($conf->expedition_bon->enabled && $user->rights->expedition->lire)
|| ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire))
{
$head[$h][0] = DOL_URL_ROOT.'/expedition/commande.php?id='.$commande->id;
if ($conf->expedition_bon->enabled) $text=$langs->trans("Sendings");
if ($conf->livraison_bon->enabled) $text.='/'.$langs->trans("Receivings");
$head[$h][1] = $text;
$head[$h][2] = 'shipping';
$h++;
}
// Commande à facturer
if ($conf->facture->enabled)
{
$head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id;
$head[$h][1] = $langs->trans("Compta");
$head[$h][2] = 'accountancy';
$h++;
}
if ($conf->use_preview_tabs)
{
$head[$h][0] = DOL_URL_ROOT.'/commande/apercu.php?id='.$commande->id;
$head[$h][1] = $langs->trans("Preview");
$head[$h][2] = 'preview';
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$commande->id;
$head[$h][1] = $langs->trans('OrderContact');
$head[$h][2] = 'contact';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$commande->id;
$head[$h][1] = $langs->trans('Documents');
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/commande/note.php?id='.$commande->id;
$head[$h][1] = $langs->trans('Notes');
$head[$h][2] = 'note';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/commande/info.php?id='.$commande->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
return $head;
global $langs, $conf, $user;
if ($conf->expedition->enabled) $langs->load("sendings");
$langs->load("orders");
$h = 0;
$head = array();
if ($conf->commande->enabled && $user->rights->commande->lire)
{
$head[$h][0] = DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id;
$head[$h][1] = $langs->trans("OrderCard");
$head[$h][2] = 'order';
$h++;
}
if (($conf->expedition_bon->enabled && $user->rights->expedition->lire)
|| ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire))
{
$head[$h][0] = DOL_URL_ROOT.'/expedition/commande.php?id='.$commande->id;
if ($conf->expedition_bon->enabled) $text=$langs->trans("Sendings");
if ($conf->livraison_bon->enabled) $text.='/'.$langs->trans("Receivings");
$head[$h][1] = $text;
$head[$h][2] = 'shipping';
$h++;
}
// Commande à facturer
if ($conf->facture->enabled)
{
$head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id;
$head[$h][1] = $langs->trans("Compta");
$head[$h][2] = 'accountancy';
$h++;
}
if ($conf->use_preview_tabs)
{
$head[$h][0] = DOL_URL_ROOT.'/commande/apercu.php?id='.$commande->id;
$head[$h][1] = $langs->trans("Preview");
$head[$h][2] = 'preview';
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$commande->id;
$head[$h][1] = $langs->trans('OrderContact');
$head[$h][2] = 'contact';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$commande->id;
$head[$h][1] = $langs->trans('Documents');
$head[$h][2] = 'documents';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/commande/note.php?id='.$commande->id;
$head[$h][1] = $langs->trans('Notes');
$head[$h][2] = 'note';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/commande/info.php?id='.$commande->id;
$head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info';
$h++;
// More tabs from modules
if (is_array($conf->tabs_modules['order']))
{
$i=0;
foreach ($conf->tabs_modules['order'] as $value)
{
$values=split(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = eregi_replace('__ID__',$commande->id,$values[3]);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;
}
}
return $head;
}
?>

View File

@ -21,8 +21,12 @@
/**
* \file htdocs/lib/product.lib.php
* \brief Ensemble de fonctions de base pour le module produit et service
* \ingroup product
* \version $Id$
*
* Ensemble de fonctions de base de dolibarr sous forme d'include
*/
function product_prepare_head($product, $user)
{
global $langs, $conf;

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -18,13 +18,13 @@
*/
/**
\file htdocs/lib/propal.lib.php
\brief Ensemble de fonctions de base pour le module propal
\ingroup propal
\version $Id$
Ensemble de fonctions de base de dolibarr sous forme d'include
*/
* \file htdocs/lib/propal.lib.php
* \brief Ensemble de fonctions de base pour le module propal
* \ingroup propal
* \version $Id$
*
* Ensemble de fonctions de base de dolibarr sous forme d'include
*/
function propal_prepare_head($propal)
{
@ -39,19 +39,19 @@ function propal_prepare_head($propal)
$head[$h][1] = $langs->trans('CommercialCard');
$head[$h][2] = 'comm';
$h++;
if ((!$conf->commande->enabled &&
if ((!$conf->commande->enabled &&
(($conf->expedition_bon->enabled && $user->rights->expedition->lire)
|| ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire))))
{
$langs->load("sendings");
$head[$h][0] = DOL_URL_ROOT.'/expedition/propal.php?propalid='.$propal->id;
if ($conf->expedition_bon->enabled) $text=$langs->trans("Sendings");
if ($conf->livraison_bon->enabled) $text.='/'.$langs->trans("Receivings");
$head[$h][1] = $text;
$head[$h][2] = 'shipping';
$h++;
}
|| ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire))))
{
$langs->load("sendings");
$head[$h][0] = DOL_URL_ROOT.'/expedition/propal.php?propalid='.$propal->id;
if ($conf->expedition_bon->enabled) $text=$langs->trans("Sendings");
if ($conf->livraison_bon->enabled) $text.='/'.$langs->trans("Receivings");
$head[$h][1] = $text;
$head[$h][2] = 'shipping';
$h++;
}
$head[$h][0] = DOL_URL_ROOT.'/compta/propal.php?propalid='.$propal->id;
$head[$h][1] = $langs->trans('AccountancyCard');
@ -86,6 +86,21 @@ function propal_prepare_head($propal)
$head[$h][2] = 'info';
$h++;
// More tabs from modules
if (is_array($conf->tabs_modules['propal']))
{
$i=0;
foreach ($conf->tabs_modules['propal'] as $value)
{
$values=split(':',$value);
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = eregi_replace('__ID__',$propal->id,$values[3]);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;
}
}
return $head;
}