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 * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/ * or see http://www.gnu.org/
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/lib/fichinter.lib.php * \file htdocs/lib/fichinter.lib.php
\brief Ensemble de fonctions de base pour le module fichinter * \brief Ensemble de fonctions de base pour le module fichinter
\ingroup fichinter * \ingroup fichinter
\version $Revision$ * \version $Id$
*
Ensemble de fonctions de base de dolibarr sous forme d'include * Ensemble de fonctions de base de dolibarr sous forme d'include
*/ */
function fichinter_prepare_head($fichinter) function fichinter_prepare_head($fichinter)
{ {
global $langs, $conf, $user; global $langs, $conf, $user;
$langs->load("fichinter"); $langs->load("fichinter");
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = DOL_URL_ROOT.'/fichinter/fiche.php?id='.$fichinter->id; $head[$h][0] = DOL_URL_ROOT.'/fichinter/fiche.php?id='.$fichinter->id;
$head[$h][1] = $langs->trans("Card"); $head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/fichinter/contact.php?id='.$fichinter->id; $head[$h][0] = DOL_URL_ROOT.'/fichinter/contact.php?id='.$fichinter->id;
$head[$h][1] = $langs->trans('InterventionContact'); $head[$h][1] = $langs->trans('InterventionContact');
$head[$h][2] = 'contact'; $head[$h][2] = 'contact';
$h++; $h++;
if ($conf->use_preview_tabs) if ($conf->use_preview_tabs)
{ {
$head[$h][0] = DOL_URL_ROOT.'/fichinter/apercu.php?id='.$fichinter->id; $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'; $head[$h][2] = 'preview';
$h++; $h++;
} }
$head[$h][0] = DOL_URL_ROOT.'/fichinter/note.php?id='.$fichinter->id; $head[$h][0] = DOL_URL_ROOT.'/fichinter/note.php?id='.$fichinter->id;
$head[$h][1] = $langs->trans('Notes'); $head[$h][1] = $langs->trans('Notes');
$head[$h][2] = 'note'; $head[$h][2] = 'note';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/fichinter/info.php?id='.$fichinter->id; $head[$h][0] = DOL_URL_ROOT.'/fichinter/info.php?id='.$fichinter->id;
$head[$h][1] = $langs->trans('Info'); $head[$h][1] = $langs->trans('Info');
$head[$h][2] = 'info'; $head[$h][2] = 'info';
$h++; $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'; $head[$h][2] = 'info';
$h++; $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; return $head;
} }
@ -85,6 +100,21 @@ function ordersupplier_prepare_head($commande)
$head[$h][2] = 'info'; $head[$h][2] = 'info';
$h++; $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; return $head;
} }

View File

@ -18,12 +18,13 @@
*/ */
/** /**
\file htdocs/lib/invoice.lib.php * \file htdocs/lib/invoice.lib.php
\brief Ensemble de fonctions de base pour le module factures * \brief Ensemble de fonctions de base pour le module factures
\version $Id$ * \ingroup invoice
* \version $Id$ *
Ensemble de fonctions de base de dolibarr sous forme d'include *
*/ * Ensemble de fonctions de base de dolibarr sous forme d'include
*/
function facture_prepare_head($fac) function facture_prepare_head($fac)
{ {
@ -72,6 +73,21 @@ function facture_prepare_head($fac)
$head[$h][2] = 'info'; $head[$h][2] = 'info';
$h++; $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; return $head;
} }

View File

@ -15,18 +15,15 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/ * or see http://www.gnu.org/
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/lib/member.lib.php * \file htdocs/lib/member.lib.php
\brief Ensemble de fonctions de base pour les adhérents * \brief Ensemble de fonctions de base pour les adhérents
\version $Revision$ * \version $Id$
*
Ensemble de fonctions de base de dolibarr sous forme d'include * Ensemble de fonctions de base de dolibarr sous forme d'include
*/ */
function member_prepare_head($member) function member_prepare_head($member)
{ {
@ -68,6 +65,21 @@ function member_prepare_head($member)
$head[$h][2] = 'info'; $head[$h][2] = 'info';
$h++; $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; return $head;
} }

View File

@ -27,70 +27,85 @@
function commande_prepare_head($commande) function commande_prepare_head($commande)
{ {
global $langs, $conf, $user; global $langs, $conf, $user;
if ($conf->expedition->enabled) $langs->load("sendings"); if ($conf->expedition->enabled) $langs->load("sendings");
$langs->load("orders"); $langs->load("orders");
$h = 0; $h = 0;
$head = array(); $head = array();
if ($conf->commande->enabled && $user->rights->commande->lire) if ($conf->commande->enabled && $user->rights->commande->lire)
{ {
$head[$h][0] = DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id; $head[$h][0] = DOL_URL_ROOT.'/commande/fiche.php?id='.$commande->id;
$head[$h][1] = $langs->trans("OrderCard"); $head[$h][1] = $langs->trans("OrderCard");
$head[$h][2] = 'order'; $head[$h][2] = 'order';
$h++; $h++;
} }
if (($conf->expedition_bon->enabled && $user->rights->expedition->lire) if (($conf->expedition_bon->enabled && $user->rights->expedition->lire)
|| ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire)) || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire))
{ {
$head[$h][0] = DOL_URL_ROOT.'/expedition/commande.php?id='.$commande->id; $head[$h][0] = DOL_URL_ROOT.'/expedition/commande.php?id='.$commande->id;
if ($conf->expedition_bon->enabled) $text=$langs->trans("Sendings"); if ($conf->expedition_bon->enabled) $text=$langs->trans("Sendings");
if ($conf->livraison_bon->enabled) $text.='/'.$langs->trans("Receivings"); if ($conf->livraison_bon->enabled) $text.='/'.$langs->trans("Receivings");
$head[$h][1] = $text; $head[$h][1] = $text;
$head[$h][2] = 'shipping'; $head[$h][2] = 'shipping';
$h++; $h++;
} }
// Commande à facturer // Commande à facturer
if ($conf->facture->enabled) if ($conf->facture->enabled)
{ {
$head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id; $head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id;
$head[$h][1] = $langs->trans("Compta"); $head[$h][1] = $langs->trans("Compta");
$head[$h][2] = 'accountancy'; $head[$h][2] = 'accountancy';
$h++; $h++;
} }
if ($conf->use_preview_tabs) if ($conf->use_preview_tabs)
{ {
$head[$h][0] = DOL_URL_ROOT.'/commande/apercu.php?id='.$commande->id; $head[$h][0] = DOL_URL_ROOT.'/commande/apercu.php?id='.$commande->id;
$head[$h][1] = $langs->trans("Preview"); $head[$h][1] = $langs->trans("Preview");
$head[$h][2] = 'preview'; $head[$h][2] = 'preview';
$h++; $h++;
} }
$head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$commande->id; $head[$h][0] = DOL_URL_ROOT.'/commande/contact.php?id='.$commande->id;
$head[$h][1] = $langs->trans('OrderContact'); $head[$h][1] = $langs->trans('OrderContact');
$head[$h][2] = 'contact'; $head[$h][2] = 'contact';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$commande->id; $head[$h][0] = DOL_URL_ROOT.'/commande/document.php?id='.$commande->id;
$head[$h][1] = $langs->trans('Documents'); $head[$h][1] = $langs->trans('Documents');
$head[$h][2] = 'documents'; $head[$h][2] = 'documents';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/commande/note.php?id='.$commande->id; $head[$h][0] = DOL_URL_ROOT.'/commande/note.php?id='.$commande->id;
$head[$h][1] = $langs->trans('Notes'); $head[$h][1] = $langs->trans('Notes');
$head[$h][2] = 'note'; $head[$h][2] = 'note';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/commande/info.php?id='.$commande->id; $head[$h][0] = DOL_URL_ROOT.'/commande/info.php?id='.$commande->id;
$head[$h][1] = $langs->trans("Info"); $head[$h][1] = $langs->trans("Info");
$head[$h][2] = 'info'; $head[$h][2] = 'info';
$h++; $h++;
return $head; // 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 * \file htdocs/lib/product.lib.php
* \brief Ensemble de fonctions de base pour le module produit et service * \brief Ensemble de fonctions de base pour le module produit et service
* \ingroup product
* \version $Id$ * \version $Id$
*
* Ensemble de fonctions de base de dolibarr sous forme d'include
*/ */
function product_prepare_head($product, $user) function product_prepare_head($product, $user)
{ {
global $langs, $conf; global $langs, $conf;

View File

@ -1,5 +1,5 @@
<?php <?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 * 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 * it under the terms of the GNU General Public License as published by
@ -18,13 +18,13 @@
*/ */
/** /**
\file htdocs/lib/propal.lib.php * \file htdocs/lib/propal.lib.php
\brief Ensemble de fonctions de base pour le module propal * \brief Ensemble de fonctions de base pour le module propal
\ingroup propal * \ingroup propal
\version $Id$ * \version $Id$
*
Ensemble de fonctions de base de dolibarr sous forme d'include * Ensemble de fonctions de base de dolibarr sous forme d'include
*/ */
function propal_prepare_head($propal) function propal_prepare_head($propal)
{ {
@ -39,19 +39,19 @@ function propal_prepare_head($propal)
$head[$h][1] = $langs->trans('CommercialCard'); $head[$h][1] = $langs->trans('CommercialCard');
$head[$h][2] = 'comm'; $head[$h][2] = 'comm';
$h++; $h++;
if ((!$conf->commande->enabled && if ((!$conf->commande->enabled &&
(($conf->expedition_bon->enabled && $user->rights->expedition->lire) (($conf->expedition_bon->enabled && $user->rights->expedition->lire)
|| ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire)))) || ($conf->livraison_bon->enabled && $user->rights->expedition->livraison->lire))))
{ {
$langs->load("sendings"); $langs->load("sendings");
$head[$h][0] = DOL_URL_ROOT.'/expedition/propal.php?propalid='.$propal->id; $head[$h][0] = DOL_URL_ROOT.'/expedition/propal.php?propalid='.$propal->id;
if ($conf->expedition_bon->enabled) $text=$langs->trans("Sendings"); if ($conf->expedition_bon->enabled) $text=$langs->trans("Sendings");
if ($conf->livraison_bon->enabled) $text.='/'.$langs->trans("Receivings"); if ($conf->livraison_bon->enabled) $text.='/'.$langs->trans("Receivings");
$head[$h][1] = $text; $head[$h][1] = $text;
$head[$h][2] = 'shipping'; $head[$h][2] = 'shipping';
$h++; $h++;
} }
$head[$h][0] = DOL_URL_ROOT.'/compta/propal.php?propalid='.$propal->id; $head[$h][0] = DOL_URL_ROOT.'/compta/propal.php?propalid='.$propal->id;
$head[$h][1] = $langs->trans('AccountancyCard'); $head[$h][1] = $langs->trans('AccountancyCard');
@ -86,6 +86,21 @@ function propal_prepare_head($propal)
$head[$h][2] = 'info'; $head[$h][2] = 'info';
$h++; $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; return $head;
} }