From 2960758550be787fd5a81a631220f3df52d1ab71 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 11 Nov 2005 16:37:53 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20onglet=20info=20sur=20les=20soci=E9t=E9?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/comm/fiche.php | 4 ++ htdocs/compta/fiche.php | 24 +++---- htdocs/docsoc.php | 5 ++ htdocs/fourn/fiche.php | 112 +++++++++++++++-------------- htdocs/soc.php | 11 ++- htdocs/societe.class.php | 45 ++++++++++++ htdocs/societe/info.php | 115 ++++++++++++++++++++++++++++++ htdocs/societe/lien.php | 14 ++-- htdocs/societe/notify/fiche.php | 15 ++-- htdocs/socnote.php | 120 +++++++++++++++++--------------- 10 files changed, 324 insertions(+), 141 deletions(-) create mode 100644 htdocs/societe/info.php diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index efe0acf70b1..13cad8c64a3 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -194,6 +194,10 @@ if ($_socid > 0) $head[$h][1] = $langs->trans("Notifications"); $h++; + $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$objsoc->id; + $head[$h][1] = $langs->trans("Info"); + $h++; + if ($user->societe_id == 0) { $head[$h][0] = DOL_URL_ROOT."/bookmarks/fiche.php?action=add&socid=".$objsoc->id."&urlsource=".$_SERVER["PHP_SELF"]."?socid=".$objsoc->id; diff --git a/htdocs/compta/fiche.php b/htdocs/compta/fiche.php index abde85a3b3d..ee33ada1162 100644 --- a/htdocs/compta/fiche.php +++ b/htdocs/compta/fiche.php @@ -36,27 +36,22 @@ $langs->load("companies"); if ($conf->facture->enabled) $langs->load("bills"); if ($conf->projet->enabled) $langs->load("projects"); -/* - * Sécurité accés client - */ +// Sécurité accés client $socid = $_GET["socid"]; if ($user->societe_id > 0) { - $action = ''; - $socid = $user->societe_id; + $action = ''; + $socid = $user->societe_id; } $user->getrights('facture'); -llxHeader(); - - if ($action == 'recontact') { - $dr = mktime(0, 0, 0, $remonth, $reday, $reyear); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."soc_recontact (fk_soc, datere, author) VALUES ($socid, $dr,'". $user->login ."')"; + $dr = mktime(0, 0, 0, $remonth, $reday, $reyear); + $sql = "INSERT INTO ".MAIN_DB_PREFIX."soc_recontact (fk_soc, datere, author) VALUES ($socid, $dr,'". $user->login ."')"; $result = $db->query($sql); } @@ -122,10 +117,11 @@ if ($mode == 'search') } + +llxHeader(); + /* - * * Mode fiche - * */ if ($socid > 0) { @@ -183,6 +179,10 @@ if ($socid > 0) $head[$h][1] = $langs->trans("Notifications"); $h++; + $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$societe->id; + $head[$h][1] = $langs->trans("Info"); + $h++; + if ($user->societe_id == 0) { $head[$h][0] = DOL_URL_ROOT."/index.php?socidp=$societe->id&action=add_bookmark"; diff --git a/htdocs/docsoc.php b/htdocs/docsoc.php index 4e0949dea7e..183eb40fd55 100644 --- a/htdocs/docsoc.php +++ b/htdocs/docsoc.php @@ -134,7 +134,12 @@ if ($socid > 0) $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$societe->id; $head[$h][1] = $langs->trans("Notifications"); + $h++; + $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$societe->id; + $head[$h][1] = $langs->trans("Info"); + $h++; + dolibarr_fiche_head($head, $hselected, $societe->nom); // Construit liste des fichiers diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index 58b115b6d66..1a9f6faab84 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -54,63 +54,67 @@ $societe = new Fournisseur($db); if ( $societe->fetch($socid) ) { - $addons[0][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$socid; - $addons[0][1] = $societe->nom; - - llxHeader('',$langs->trans('SupplierCard').' : '.$societe->nom, $addons); - - /* - * Affichage onglets - */ - $h = 0; - - $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$socid; - $head[$h][1] = $langs->trans('Company'); - $h++; - - if ($societe->client==1) - { - $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$socid; - $head[$h][1] = $langs->trans('Customer'); - $h++; - } - if ($societe->client==2) - { - $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$socid; - $head[$h][1] = $langs->trans('Prospect'); - $h++; - } - if ($societe->fournisseur) - { - $hselected=$h; - $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$socid; - $head[$h][1] = $langs->trans('Supplier'); - $h++; - } - - if ($conf->compta->enabled) { - $langs->load('compta'); - $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$socid; - $head[$h][1] = $langs->trans('Accountancy'); + $addons[0][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$socid; + $addons[0][1] = $societe->nom; + + llxHeader('',$langs->trans('SupplierCard').' : '.$societe->nom, $addons); + + /* + * Affichage onglets + */ + $h = 0; + + $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$socid; + $head[$h][1] = $langs->trans('Company'); $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$societe->id; - $head[$h][1] = $langs->trans('Note'); - $h++; - - if ($user->societe_id == 0) + + if ($societe->client==1) { - $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$societe->id; - $head[$h][1] = $langs->trans('Documents'); - $h++; + $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$socid; + $head[$h][1] = $langs->trans('Customer'); + $h++; } - - $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$societe->id; - $head[$h][1] = $langs->trans('Notifications'); - $h++; - - dolibarr_fiche_head($head, $hselected, $societe->nom); + if ($societe->client==2) + { + $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$socid; + $head[$h][1] = $langs->trans('Prospect'); + $h++; + } + if ($societe->fournisseur) + { + $hselected=$h; + $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$socid; + $head[$h][1] = $langs->trans('Supplier'); + $h++; + } + + if ($conf->compta->enabled) { + $langs->load('compta'); + $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$socid; + $head[$h][1] = $langs->trans('Accountancy'); + $h++; + } + + $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$societe->id; + $head[$h][1] = $langs->trans('Note'); + $h++; + + if ($user->societe_id == 0) + { + $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$societe->id; + $head[$h][1] = $langs->trans('Documents'); + $h++; + } + + $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$societe->id; + $head[$h][1] = $langs->trans('Notifications'); + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$societe->id; + $head[$h][1] = $langs->trans("Info"); + $h++; + + dolibarr_fiche_head($head, $hselected, $societe->nom); /* * diff --git a/htdocs/soc.php b/htdocs/soc.php index e26fb2dca06..122aa8e2acd 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -557,7 +557,6 @@ else /* * Fiche société en mode visu */ - $soc = new Societe($db); $soc->id = $_GET["socid"]; $result=$soc->fetch($_GET["socid"]); @@ -569,8 +568,9 @@ else $h=0; - $head[$h][0] = 'soc.php?socid='.$soc->id; + $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$soc->id; $head[$h][1] = $langs->trans("Company"); + $hselected=$h; $h++; if ($soc->client==1) @@ -612,8 +612,13 @@ else $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$soc->id; $head[$h][1] = $langs->trans("Notifications"); + $h++; - dolibarr_fiche_head($head, 0, $soc->nom); + $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$soc->id; + $head[$h][1] = $langs->trans("Info"); + $h++; + + dolibarr_fiche_head($head, $hselected, $soc->nom); // Confirmation de la suppression de la facture diff --git a/htdocs/societe.class.php b/htdocs/societe.class.php index a82a5998192..a03265c967b 100644 --- a/htdocs/societe.class.php +++ b/htdocs/societe.class.php @@ -1438,6 +1438,51 @@ class Societe { } } + /* + * \brief Charge les informations d'ordre info dans l'objet societe + * \param id id de la societe a charger + */ + function info($id) + { + $sql = "SELECT s.idp, s.nom, ".$this->db->pdate("datec")." as datec, ".$this->db->pdate("datea")." as datea,"; + $sql.= " fk_user_creat, fk_user_modif"; + $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; + $sql.= " WHERE s.idp = ".$id; + + $result=$this->db->query($sql); + if ($result) + { + if ($this->db->num_rows($result)) + { + $obj = $this->db->fetch_object($result); + + $this->id = $obj->idp; + + if ($obj->fk_user_creat) { + $cuser = new User($this->db, $obj->fk_user_creat); + $cuser->fetch(); + $this->user_creation = $cuser; + } + + if ($obj->fk_user_modif) { + $muser = new User($this->db, $obj->fk_user_modif); + $muser->fetch(); + $this->user_modification = $muser; + } + $this->ref = $obj->nom; + $this->date_creation = $obj->datec; + $this->date_modification = $obj->datea; + } + + $this->db->free($result); + + } + else + { + dolibarr_print_error($this->db); + } + } + } ?> diff --git a/htdocs/societe/info.php b/htdocs/societe/info.php new file mode 100644 index 00000000000..5c19356cb8b --- /dev/null +++ b/htdocs/societe/info.php @@ -0,0 +1,115 @@ + + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + */ + +/** + \file htdocs/societe/info.php + \ingroup societe + \brief Page des informations d'une societe + \version $Revision$ +*/ + +require("./pre.inc.php"); +require_once (DOL_DOCUMENT_ROOT."/societe.class.php"); + +$langs->load("companies"); + +llxHeader(); + + +/* + * Visualisation de la fiche + * + */ + +$soc = new Societe($db); +$soc->id = $_GET["socid"]; +$soc->fetch($_GET["socid"]); +$soc->info($_GET["socid"]); + +$h=0; + +$head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$soc->id; +$head[$h][1] = $langs->trans("Company"); +$h++; + +if ($soc->client==1) +{ + $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id; + $head[$h][1] = $langs->trans("Customer"); + $h++; +} +if ($soc->client==2) +{ + $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$soc->id; + $head[$h][1] = $langs->trans("Prospect"); + $h++; +} +if ($soc->fournisseur) +{ + $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$soc->id; + $head[$h][1] = $langs->trans("Supplier");; + $h++; +} + +if ($conf->compta->enabled) { + $langs->load("compta"); + $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$soc->id; + $head[$h][1] = $langs->trans("Accountancy"); + $h++; +} + +$head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$soc->id; +$head[$h][1] = $langs->trans("Note"); +$h++; + +if ($user->societe_id == 0) +{ + $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$soc->id; + $head[$h][1] = $langs->trans("Documents"); + $h++; +} + +$head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$soc->id; +$head[$h][1] = $langs->trans("Notifications"); +$h++; + +$head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$soc->id; +$head[$h][1] = $langs->trans("Info"); +$hselected=$h; +$h++; + +dolibarr_fiche_head($head, $hselected, $soc->nom); + + +print '
'; +dolibarr_print_object_info($soc); +print '
'; + +print ''; + +// Juste pour éviter bug IE qui réorganise mal div précédents si celui-ci absent +print '
'; +print '
'; + +$db->close(); + +llxFooter('$Date$ - $Revision$'); +?> diff --git a/htdocs/societe/lien.php b/htdocs/societe/lien.php index 622a80f5036..188ecca766f 100644 --- a/htdocs/societe/lien.php +++ b/htdocs/societe/lien.php @@ -123,17 +123,17 @@ if($_GET["socid"]) dolibarr_fiche_head($head, $hselected, $soc->nom); /* - * Fiche société en mode visu - */ + * Fiche société en mode visu + */ print ''; print ''; - print ''; + print ''; print ""; diff --git a/htdocs/societe/notify/fiche.php b/htdocs/societe/notify/fiche.php index df0f282da6b..b1b9508b8df 100644 --- a/htdocs/societe/notify/fiche.php +++ b/htdocs/societe/notify/fiche.php @@ -18,7 +18,6 @@ * * $Id$ * $Source$ - * */ /** @@ -32,16 +31,12 @@ require("pre.inc.php"); $langs->load("companies"); -/* - * Sécurité accés client - */ +// Sécurité accés client +$socid = $_GET["socid"]; if ($user->societe_id > 0) { - //$socid = $user->societe_id; - $socid = $_GET["socid"]; + $socid = $user->societe_id; } - -$socid = $_GET["socid"]; $sortorder=$_GET["sortorder"]; $sortfield=$_GET["sortfield"]; @@ -152,6 +147,10 @@ if ( $soc->fetch($soc->id) ) $head[$h][1] = $langs->trans("Notifications"); $hselected=$h; $h++; + + $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$soc->id; + $head[$h][1] = $langs->trans("Info"); + $h++; dolibarr_fiche_head($head, $hselected, $soc->nom); diff --git a/htdocs/socnote.php b/htdocs/socnote.php index 31d918554f5..500389726fc 100644 --- a/htdocs/socnote.php +++ b/htdocs/socnote.php @@ -38,68 +38,74 @@ if ($_POST["action"] == 'add') { $_GET["socid"]=$_POST["socid"]; // Pour retour sur fiche } + + /* * */ + llxHeader(); -if ($_GET["socid"] > 0) { - - $societe = new Societe($db, $_GET["socid"]); - $societe->fetch($_GET["socid"]); - /* - * - */ - $h=0; - - $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Company"); - $h++; - - if ($societe->client==1) - { - $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Customer"); - $h++; - } - - if ($societe->client==2) - { - $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$societe->id; - $head[$h][1] = $langs->trans("Prospect"); - $h++; - } - if ($societe->fournisseur) - { - $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Supplier"); - $h++; - } - - if ($conf->compta->enabled) { - $langs->load("compta"); - $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Accountancy"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Note"); - $hselected = $h; - $h++; - - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Documents"); - $h++; - } - - $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$societe->id; - $head[$h][1] = $langs->trans("Notifications"); - $h++; - - dolibarr_fiche_head($head, $hselected, $societe->nom); +if ($_GET["socid"] > 0) +{ + $societe = new Societe($db, $_GET["socid"]); + $societe->fetch($_GET["socid"]); + + + $h=0; + + $head[$h][0] = DOL_URL_ROOT.'/soc.php?socid='.$societe->id; + $head[$h][1] = $langs->trans("Company"); + $h++; + + if ($societe->client==1) + { + $head[$h][0] = DOL_URL_ROOT.'/comm/fiche.php?socid='.$societe->id; + $head[$h][1] = $langs->trans("Customer"); + $h++; + } + + if ($societe->client==2) + { + $head[$h][0] = DOL_URL_ROOT.'/comm/prospect/fiche.php?id='.$societe->id; + $head[$h][1] = $langs->trans("Prospect"); + $h++; + } + if ($societe->fournisseur) + { + $head[$h][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$societe->id; + $head[$h][1] = $langs->trans("Supplier"); + $h++; + } + + if ($conf->compta->enabled) { + $langs->load("compta"); + $head[$h][0] = DOL_URL_ROOT.'/compta/fiche.php?socid='.$societe->id; + $head[$h][1] = $langs->trans("Accountancy"); + $h++; + } + + $head[$h][0] = DOL_URL_ROOT.'/socnote.php?socid='.$societe->id; + $head[$h][1] = $langs->trans("Note"); + $hselected = $h; + $h++; + + if ($user->societe_id == 0) + { + $head[$h][0] = DOL_URL_ROOT.'/docsoc.php?socid='.$societe->id; + $head[$h][1] = $langs->trans("Documents"); + $h++; + } + + $head[$h][0] = DOL_URL_ROOT.'/societe/notify/fiche.php?socid='.$societe->id; + $head[$h][1] = $langs->trans("Notifications"); + $h++; + + $head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$societe->id; + $head[$h][1] = $langs->trans("Info"); + $h++; + + dolibarr_fiche_head($head, $hselected, $societe->nom); print "";
'.$langs->trans('Name').''.$soc->nom.'
'; - print $langs->trans('CustomerCode').''; - print $soc->code_client; - if ($soc->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode"); - print ''.$langs->trans('Prefix').''.$soc->prefix_comm.'
'; + print $langs->trans('CustomerCode').''; + print $soc->code_client; + if ($soc->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode"); + print ''.$langs->trans('Prefix').''.$soc->prefix_comm.'
".$langs->trans('Address')."".nl2br($soc->adresse)."