From e1fdb60f4d754eb09167f7d9c7ec4e398089f42b Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Tue, 26 Aug 2003 09:58:14 +0000 Subject: [PATCH] Nettoyage du code --- htdocs/comm/action/fiche.php3 | 3 - htdocs/comm/action/index.php | 2 - htdocs/comm/analyse.php3 | 122 ---------------------------------- htdocs/comm/docsoc.php | 2 - htdocs/comm/fiche.php3 | 1 - htdocs/comm/people.php3 | 1 - htdocs/comm/projet/index.php | 1 - htdocs/comm/socnote.php3 | 10 +-- htdocs/compta/charges.php3 | 4 -- htdocs/compta/config.php3 | 1 - htdocs/compta/fac.php3 | 2 +- htdocs/compta/genfac.php3 | 2 +- htdocs/compta/ligne.php3 | 1 - htdocs/compta/paiement.php3 | 1 - htdocs/compta/pmt.php3 | 2 +- htdocs/compta/pointmort.php3 | 2 +- htdocs/compta/propal.php3 | 2 - htdocs/compta/tva.php3 | 2 - 18 files changed, 9 insertions(+), 152 deletions(-) delete mode 100644 htdocs/comm/analyse.php3 diff --git a/htdocs/comm/action/fiche.php3 b/htdocs/comm/action/fiche.php3 index 36311e9cf3e..f4bfa4bb7d6 100644 --- a/htdocs/comm/action/fiche.php3 +++ b/htdocs/comm/action/fiche.php3 @@ -34,9 +34,6 @@ if ($user->societe_id > 0) $socidp = $user->societe_id; } - -$db = new Db(); - /* * * diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 0068af958a5..410d32a7e7a 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -38,8 +38,6 @@ if ($user->societe_id > 0) llxHeader(); -$db = new Db(); - /* * * diff --git a/htdocs/comm/analyse.php3 b/htdocs/comm/analyse.php3 deleted file mode 100644 index 86978915111..00000000000 --- a/htdocs/comm/analyse.php3 +++ /dev/null @@ -1,122 +0,0 @@ - - * - * $Id$ - * $Source$ - * - * 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. - * - */ - -require("./pre.inc.php3"); -require("../lib/functions.inc.php3"); - - -require("$GLJ_WWW_ROOT/../www/lib/CMailFile.class.php3"); - -$author = $GLOBALS["REMOTE_USER"]; - -llxHeader(); -print ""; -print ""; -print ""; -print ""; -print ""; -print "
Propositions commercialesListeCA PrévisionnelPropal Signées
"; - -$bc[0]="bgcolor=\"#90c090\""; -$bc[1]="bgcolor=\"#b0e0b0\""; - -$db = new Db(); - -if ($sortfield == "") { - $sortfield="lower(p.label)"; -} -if ($sortorder == "") { - $sortorder="ASC"; -} - -$yn["t"] = "oui"; -$yn["f"] = "non"; - -if ($page == -1) { $page = 0 ; } -$limit = 26; -$offset = $limit * $page ; -$pageprev = $page - 1; -$pagenext = $page + 1; - -function calc($st) { - global $db; - $sum = 0; - $sql = "SELECT sum(price-remise) as sum FROM llx_propal WHERE fk_statut = $st"; - if ( $db->query($sql) ) { - if ($db->num_rows()) { - $arr = $db->fetch_array(0); - $sum = $arr[0]; - } - } - return $sum ; -} - -function calcf($st) { - global $db; - $sum = 0; - $sql = "SELECT sum(amount) as sum FROM llx_facture WHERE fk_statut = 1 and paye = $st"; - if ( $db->query($sql) ) { - if ($db->num_rows()) { - $arr = $db->fetch_array(0); - $sum = $arr[0]; - } - } - return $sum ; -} - -/* - * - * - * Liste des propals - * - * - */ -print "

"; -echo ''; - -$po = calc(1); -$ps = calc(2); -$pns = calc(3); - -print ""; -print ""; -print ""; -print ""; -print ""; -print "
Propales
Propales ouvertes".price($po)."
Propales signées".price($ps)."
Total".price($ps + $po )."
Propales non signées".price($pns)."
Total".price($ps + $po + $pns)."
"; - - -print "

"; -echo ''; - -$fnp = calcf(0); -$fp = calcf(1); -print ""; -print ""; -print ""; - -print "
Factures
Factures non payées".price($fnp)."
Factures payées".price($fp)."
Total".price($fnp + $fp )."
"; - - -$db->close(); -llxFooter("Dernière modification $Date$ révision $Revision$"); -?> diff --git a/htdocs/comm/docsoc.php b/htdocs/comm/docsoc.php index 4b8d55281b9..b376f869f4a 100644 --- a/htdocs/comm/docsoc.php +++ b/htdocs/comm/docsoc.php @@ -22,8 +22,6 @@ require("./pre.inc.php3"); llxHeader(); -$db = new Db(); - $upload_dir = SOCIETE_OUTPUTDIR . "/" . $socid ; if (! is_dir($upload_dir)) diff --git a/htdocs/comm/fiche.php3 b/htdocs/comm/fiche.php3 index e7bc7e1af75..ea03bb03c0c 100644 --- a/htdocs/comm/fiche.php3 +++ b/htdocs/comm/fiche.php3 @@ -28,7 +28,6 @@ require("../actioncomm.class.php3"); llxHeader(); $user->getrights('propale'); $user->getrights('projet'); -//$db = new Db(); if ($sortorder == "") { $sortorder="ASC"; diff --git a/htdocs/comm/people.php3 b/htdocs/comm/people.php3 index c04c97ab011..74f6fa2d3a9 100644 --- a/htdocs/comm/people.php3 +++ b/htdocs/comm/people.php3 @@ -22,7 +22,6 @@ require("./pre.inc.php3"); require("../contact.class.php3"); -$db = new Db(); if ($sortorder == "") { $sortfield="lower(s.nom)"; diff --git a/htdocs/comm/projet/index.php b/htdocs/comm/projet/index.php index 1c61e7166ed..48c05bb4f99 100644 --- a/htdocs/comm/projet/index.php +++ b/htdocs/comm/projet/index.php @@ -42,7 +42,6 @@ if($socidp && $user->societe_id == 0) } print ''; -$db = new Db(); /* * Traitements des actions * diff --git a/htdocs/comm/socnote.php3 b/htdocs/comm/socnote.php3 index 17bf3e57785..0de2825ffce 100644 --- a/htdocs/comm/socnote.php3 +++ b/htdocs/comm/socnote.php3 @@ -1,8 +1,5 @@ - * - * $Id$ - * $Source$ +/* Copyright (C) 2001-2003 Rodolphe Quiedeville * * 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,6 +15,9 @@ * 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$ + * */ require("./pre.inc.php3"); @@ -26,7 +26,7 @@ require("./pre.inc.php3"); * */ llxHeader(); -$db = new Db(); + if ($sortorder == "") { $sortfield="lower(s.nom)"; $sortorder="ASC"; diff --git a/htdocs/compta/charges.php3 b/htdocs/compta/charges.php3 index c8204822486..90842f3bdf2 100644 --- a/htdocs/compta/charges.php3 +++ b/htdocs/compta/charges.php3 @@ -23,8 +23,6 @@ require("./pre.inc.php3"); llxHeader(); -$db = new Db(); - function valeur($sql) { global $db; if ( $db->query($sql) ) { @@ -38,8 +36,6 @@ function valeur($sql) { /* * */ -$db = new Db(); - if ($action == 'add_bookmark') { $sql = "INSERT INTO llx_bookmark (fk_soc, dateb, fk_user) VALUES ($socidp, now(),".$user->id.");"; diff --git a/htdocs/compta/config.php3 b/htdocs/compta/config.php3 index 695c38cfbed..abcd3d92b75 100644 --- a/htdocs/compta/config.php3 +++ b/htdocs/compta/config.php3 @@ -23,7 +23,6 @@ require("./pre.inc.php3"); llxHeader(); -$db = new Db(); if ($action == 'add') { diff --git a/htdocs/compta/fac.php3 b/htdocs/compta/fac.php3 index a8d5328b584..bdc38cdbac9 100644 --- a/htdocs/compta/fac.php3 +++ b/htdocs/compta/fac.php3 @@ -26,7 +26,7 @@ print "Factures"; $bc[0]="bgcolor=\"#90c090\""; $bc[1]="bgcolor=\"#b0e0b0\""; -$db = new Db(); + if ($sortfield == "") { $sortfield="lower(p.label)"; } diff --git a/htdocs/compta/genfac.php3 b/htdocs/compta/genfac.php3 index 6b37968702f..ca58b2eed16 100644 --- a/htdocs/compta/genfac.php3 +++ b/htdocs/compta/genfac.php3 @@ -22,7 +22,7 @@ require("./pre.inc.php3"); require("../lib/functions.inc.php3"); llxHeader(); -$db = new Db(); + if ($sortorder == "") { $sortfield="lower(s.nom)"; $sortorder="ASC"; diff --git a/htdocs/compta/ligne.php3 b/htdocs/compta/ligne.php3 index 97f48cdf24b..ad2407f36c7 100644 --- a/htdocs/compta/ligne.php3 +++ b/htdocs/compta/ligne.php3 @@ -23,7 +23,6 @@ require("./pre.inc.php3"); llxHeader(); -$db = new Db(); $sql = "SELECT rowid, number, label FROM llx_compta_account ORDER BY number"; if ( $db->query($sql) ) { diff --git a/htdocs/compta/paiement.php3 b/htdocs/compta/paiement.php3 index de8a68f5101..98d93cde282 100644 --- a/htdocs/compta/paiement.php3 +++ b/htdocs/compta/paiement.php3 @@ -23,7 +23,6 @@ require("./pre.inc.php3"); require("../paiement.class.php"); require("./bank/account.class.php"); -$db = new Db(); /* * Sécurité accés client diff --git a/htdocs/compta/pmt.php3 b/htdocs/compta/pmt.php3 index 66ee5f21b2d..5187ff66858 100644 --- a/htdocs/compta/pmt.php3 +++ b/htdocs/compta/pmt.php3 @@ -30,7 +30,7 @@ llxHeader(); print "Point mort"; -$db = new Db(); + if ($action == 'update') { $datepm = mktime(12, 0 , 0, $pmonth, 1, $pyear); diff --git a/htdocs/compta/pointmort.php3 b/htdocs/compta/pointmort.php3 index 54c72eb5321..4de6fa0accd 100644 --- a/htdocs/compta/pointmort.php3 +++ b/htdocs/compta/pointmort.php3 @@ -169,7 +169,7 @@ llxHeader(); print "Point mort"; -$db = new Db(); + ppt($db, 0); diff --git a/htdocs/compta/propal.php3 b/htdocs/compta/propal.php3 index 76f599597a1..3237b8426cd 100644 --- a/htdocs/compta/propal.php3 +++ b/htdocs/compta/propal.php3 @@ -34,8 +34,6 @@ require("../actioncomm.class.php3"); llxHeader(); -$db = new Db(); - if ($action == 'setstatut') { /* diff --git a/htdocs/compta/tva.php3 b/htdocs/compta/tva.php3 index accc128a2d9..7ea2732b383 100644 --- a/htdocs/compta/tva.php3 +++ b/htdocs/compta/tva.php3 @@ -66,8 +66,6 @@ function pt ($db, $sql, $date) { llxHeader(); -$db = new Db(); - $yearc = strftime("%Y",time());