From 1a1f2d42da3e0b022629bc9822a99d7c0f0107d6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 21 Apr 2006 23:49:12 +0000 Subject: [PATCH] Qual: Factorisation/Reduction du code --- htdocs/comm/recap-client.php | 65 +++------------------------------- htdocs/compta/recap-compta.php | 65 +++------------------------------- htdocs/fourn/recap-fourn.php | 65 +++------------------------------- 3 files changed, 15 insertions(+), 180 deletions(-) diff --git a/htdocs/comm/recap-client.php b/htdocs/comm/recap-client.php index d1ed319fca0..1ce073ae773 100644 --- a/htdocs/comm/recap-client.php +++ b/htdocs/comm/recap-client.php @@ -28,7 +28,8 @@ */ require("./pre.inc.php"); -include_once(DOL_DOCUMENT_ROOT."/facture.class.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); $langs->load("companies"); if ($conf->facture->enabled) $langs->load("bills"); @@ -61,67 +62,11 @@ if ($socid > 0) /* * Affichage onglets */ - $h = 0; + $head = societe_prepare_head($societe); + + dolibarr_fiche_head($head, 'customer', $societe->nom); - $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"); - $hselected=$h; - $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 || $conf->comptaexpert->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"); - $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++; - - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT."/index.php?socidp=$societe->id&action=add_bookmark"; - $head[$h][1] = img_object($langs->trans("BookmarkThisPage"),'bookmark'); - $head[$h][2] = 'image'; - } - - dolibarr_fiche_head($head, $hselected, $societe->nom); - - /* - * - */ print "\n"; print '
'; diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index 60749d02cbc..e96d9cbe808 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -28,7 +28,8 @@ */ require("./pre.inc.php"); -include_once(DOL_DOCUMENT_ROOT."/facture.class.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); $langs->load("companies"); if ($conf->facture->enabled) $langs->load("bills"); @@ -61,67 +62,11 @@ if ($socid > 0) /* * Affichage onglets */ - $h = 0; + $head = societe_prepare_head($societe); + + dolibarr_fiche_head($head, 'compta', $societe->nom); - $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 || $conf->comptaexpert->enabled) - { - $langs->load("compta"); - $hselected=$h; - $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"); - $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++; - - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT."/index.php?socidp=$societe->id&action=add_bookmark"; - $head[$h][1] = img_object($langs->trans("BookmarkThisPage"),'bookmark'); - $head[$h][2] = 'image'; - } - - dolibarr_fiche_head($head, $hselected, $societe->nom); - - /* - * - */ print "\n"; print '
'; diff --git a/htdocs/fourn/recap-fourn.php b/htdocs/fourn/recap-fourn.php index aef629e6a0f..1212e453241 100644 --- a/htdocs/fourn/recap-fourn.php +++ b/htdocs/fourn/recap-fourn.php @@ -28,7 +28,8 @@ */ require("./pre.inc.php"); -include_once(DOL_DOCUMENT_ROOT."/facture.class.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); $langs->load("companies"); if ($conf->facture->enabled) $langs->load("bills"); @@ -61,67 +62,11 @@ if ($socid > 0) /* * Affichage onglets */ - $h = 0; + $head = societe_prepare_head($societe); + + dolibarr_fiche_head($head, 'supplier', $societe->nom); - $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"); - $hselected=$h; - $h++; - } - - if ($conf->compta->enabled || $conf->comptaexpert->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"); - $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++; - - if ($user->societe_id == 0) - { - $head[$h][0] = DOL_URL_ROOT."/index.php?socidp=$societe->id&action=add_bookmark"; - $head[$h][1] = img_object($langs->trans("BookmarkThisPage"),'bookmark'); - $head[$h][2] = 'image'; - } - - dolibarr_fiche_head($head, $hselected, $societe->nom); - - /* - * - */ print "\n"; print '
';