Ajout onglet info sur les socits

This commit is contained in:
Laurent Destailleur 2005-11-11 16:37:53 +00:00
parent d01636d5f4
commit 2960758550
10 changed files with 324 additions and 141 deletions

View File

@ -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;

View File

@ -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";

View File

@ -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

View File

@ -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);
/*
*

View File

@ -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

View File

@ -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);
}
}
}
?>

115
htdocs/societe/info.php Normal file
View File

@ -0,0 +1,115 @@
<?php
/* Copyright (C) 2004-2005 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
* 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 '<table width="100%"><tr><td>';
dolibarr_print_object_info($soc);
print '</td></tr></table>';
print '</div>';
// Juste pour éviter bug IE qui réorganise mal div précédents si celui-ci absent
print '<div class="tabsAction">';
print '</div>';
$db->close();
llxFooter('$Date$ - $Revision$');
?>

View File

@ -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 '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans('Name').'</td><td colspan="3">'.$soc->nom.'</td></tr>';
print '<tr><td>';
print $langs->trans('CustomerCode').'</td><td width="20%">';
print $soc->code_client;
if ($soc->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode");
print '</td><td>'.$langs->trans('Prefix').'</td><td>'.$soc->prefix_comm.'</td></tr>';
print '<tr><td>';
print $langs->trans('CustomerCode').'</td><td width="20%">';
print $soc->code_client;
if ($soc->check_codeclient() <> 0) print ' '.$langs->trans("WrongCustomerCode");
print '</td><td>'.$langs->trans('Prefix').'</td><td>'.$soc->prefix_comm.'</td></tr>';
print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">".nl2br($soc->adresse)."</td></tr>";

View File

@ -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);

View File

@ -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 "<form method=\"post\" action=\"socnote.php\">";