From f5931aa6f0d4ecc265dd2d777d0b6f3e4410f534 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Dec 2008 20:12:44 +0000 Subject: [PATCH] Can add tabs from an external module on all entities --- htdocs/lib/fichinter.lib.php | 66 +++++++++------- htdocs/lib/fourn.lib.php | 30 ++++++++ htdocs/lib/invoice.lib.php | 28 +++++-- htdocs/lib/member.lib.php | 30 +++++--- htdocs/lib/order.lib.php | 143 +++++++++++++++++++---------------- htdocs/lib/product.lib.php | 4 + htdocs/lib/propal.lib.php | 55 +++++++++----- 7 files changed, 230 insertions(+), 126 deletions(-) diff --git a/htdocs/lib/fichinter.lib.php b/htdocs/lib/fichinter.lib.php index fe679093936..aa080d62c36 100644 --- a/htdocs/lib/fichinter.lib.php +++ b/htdocs/lib/fichinter.lib.php @@ -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; } ?> diff --git a/htdocs/lib/fourn.lib.php b/htdocs/lib/fourn.lib.php index de2f492a796..9ae2744f0af 100644 --- a/htdocs/lib/fourn.lib.php +++ b/htdocs/lib/fourn.lib.php @@ -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; } diff --git a/htdocs/lib/invoice.lib.php b/htdocs/lib/invoice.lib.php index e5071ebca88..df83af24279 100644 --- a/htdocs/lib/invoice.lib.php +++ b/htdocs/lib/invoice.lib.php @@ -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; } diff --git a/htdocs/lib/member.lib.php b/htdocs/lib/member.lib.php index 9e84b7c5440..4cbb16543d7 100644 --- a/htdocs/lib/member.lib.php +++ b/htdocs/lib/member.lib.php @@ -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; } diff --git a/htdocs/lib/order.lib.php b/htdocs/lib/order.lib.php index 39de04ab135..bca416a1e7d 100644 --- a/htdocs/lib/order.lib.php +++ b/htdocs/lib/order.lib.php @@ -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; } ?> diff --git a/htdocs/lib/product.lib.php b/htdocs/lib/product.lib.php index 1e730baf8e6..95584bc708a 100644 --- a/htdocs/lib/product.lib.php +++ b/htdocs/lib/product.lib.php @@ -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; diff --git a/htdocs/lib/propal.lib.php b/htdocs/lib/propal.lib.php index b65fa101cfb..dbc12ae1eea 100644 --- a/htdocs/lib/propal.lib.php +++ b/htdocs/lib/propal.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2008 Laurent Destailleur * * 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; }