From 0c1912448f951b47a280a711c669d29b34ea8ab1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Jan 2008 08:39:25 +0000 Subject: [PATCH] Qual: Mutualisation code redondant --- htdocs/comm/fiche.php | 4 +--- htdocs/compta/fiche.php | 4 +--- htdocs/fourn/fiche.php | 10 +++------- htdocs/lib/company.lib.php | 16 ++++++++++++++-- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 76bcccd936d..564a0f4debd 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -31,7 +31,6 @@ require_once("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); if ($conf->facture->enabled) require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); @@ -46,7 +45,7 @@ if ($conf->fichinter->enabled) $langs->load("interventions"); $socid = isset($_GET["socid"])?$_GET["socid"]:''; -// S�curit� d'acc�s client et commerciaux +// Securite d'acces client et commerciaux $socid = restrictedArea($user, 'societe', $socid); $sortorder=$_GET["sortorder"]; @@ -129,7 +128,6 @@ if ($mode == 'search') { llxHeader('',$langs->trans('CustomerCard')); -$actionstatic=new ActionComm($db); $facturestatic=new Facture($db); $contactstatic = new Contact($db); $userstatic=new User($db); diff --git a/htdocs/compta/fiche.php b/htdocs/compta/fiche.php index da328ec7a59..d8e2d5812bc 100644 --- a/htdocs/compta/fiche.php +++ b/htdocs/compta/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-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 @@ -29,7 +29,6 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); -require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); $langs->load("companies"); @@ -101,7 +100,6 @@ if ($mode == 'search') llxHeader(); -$actionstatic=new ActionComm($db); $facturestatic=new Facture($db); $contactstatic = new Contact($db); diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index 94748a78cb3..cc8e9717780 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -1,7 +1,7 @@ - * Copyright (C) 2003 �ric Seigne - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2003 Eric Seigne + * Copyright (C) 2004-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,20 +18,17 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id$ - * $Source$ */ /** \file htdocs/fourn/fiche.php \ingroup fournisseur, facture \brief Page de fiche fournisseur - \version $Revision$ */ require('./pre.inc.php'); require_once(DOL_DOCUMENT_ROOT."/contact.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); -require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); $user->getrights(); @@ -42,7 +39,7 @@ $langs->load('orders'); $langs->load('companies'); $langs->load('commercial'); -// S�curit� acc�s client +// Securite acces client $socid = isset($_GET["socid"])?$_GET["socid"]:''; if ($user->societe_id > 0) { @@ -75,7 +72,6 @@ if (!$user->rights->commercial->client->voir && $socid && !$user->societe_id > 0 * Mode fiche */ $societe = new Fournisseur($db); -$actionstatic = new ActionComm($db); $contactstatic = new Contact($db); if ( $societe->fetch($socid) ) diff --git a/htdocs/lib/company.lib.php b/htdocs/lib/company.lib.php index 27260082074..5fc1d886274 100644 --- a/htdocs/lib/company.lib.php +++ b/htdocs/lib/company.lib.php @@ -130,9 +130,15 @@ function societe_prepare_head($objsoc) function show_actions_todo($conf,$langs,$db,$objsoc) { + global $bc; + if ($conf->agenda->enabled) { - print_titre($langs->trans("ActionsOnCompany")); + require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); + $actionstatic=new ActionComm($db); + $userstatic=new User($db); + + print_titre($langs->trans("ActionsOnCompany")); print ''; print ''; @@ -250,9 +256,15 @@ function show_actions_todo($conf,$langs,$db,$objsoc) function show_actions_done($conf,$langs,$db,$objsoc) { + global $bc; + if ($conf->agenda->enabled) { - print '
'; + require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); + $actionstatic=new ActionComm($db); + $userstatic=new User($db); + + print '
'; print ''; print ''; print '';
'.$langs->trans("ActionsDoneShort").'