From 9ca30b4cd4716f6ee4a99751598e3f2b15bc8c24 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 17 Sep 2005 02:32:22 +0000 Subject: [PATCH] =?UTF-8?q?New:=20Ajout=20caract=E9ristique=20"rapprochabl?= =?UTF-8?q?e"=20sur=20les=20comptes=20bancaires.=20Uniformisation=20page?= =?UTF-8?q?=20des=20journaux=20de=20comptes=20Debuggage=20de=20la=20foncti?= =?UTF-8?q?on=20des=20graphiques=20de=20solde?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mysql/migration/1.1.0-2.0.0.sql | 1 + mysql/tables/llx_bank_account.sql | 1 + scripts/banque/graph-solde.php | 68 +++++++++++++++++++++++++------ 3 files changed, 58 insertions(+), 12 deletions(-) diff --git a/mysql/migration/1.1.0-2.0.0.sql b/mysql/migration/1.1.0-2.0.0.sql index b63862cd1d5..00f0c28b091 100644 --- a/mysql/migration/1.1.0-2.0.0.sql +++ b/mysql/migration/1.1.0-2.0.0.sql @@ -462,6 +462,7 @@ alter table llx_bank_account modify domiciliation varchar(255); alter table llx_bank_account add proprio varchar(60) after domiciliation ; alter table llx_bank_account add adresse_proprio varchar(255) after proprio ; alter table llx_bank_account add account_number varchar(8) after clos ; +alter table llx_bank_account add rappro smallint DEFAULT 1 after clos; alter table llx_bank_account modify label varchar(30) unique; update llx_bank_account set account_number = '51' where account_number is null; diff --git a/mysql/tables/llx_bank_account.sql b/mysql/tables/llx_bank_account.sql index b2bb0742c80..7dfd8ad129a 100644 --- a/mysql/tables/llx_bank_account.sql +++ b/mysql/tables/llx_bank_account.sql @@ -43,5 +43,6 @@ create table llx_bank_account adresse_proprio varchar(255), courant smallint DEFAULT 0 NOT NULL, clos smallint DEFAULT 0 NOT NULL, + rappro smallint DEFAULT 1 integer, account_number varchar(8) )type=innodb; diff --git a/scripts/banque/graph-solde.php b/scripts/banque/graph-solde.php index 0907fcd9326..15ce8672fd1 100644 --- a/scripts/banque/graph-solde.php +++ b/scripts/banque/graph-solde.php @@ -1,3 +1,4 @@ +#!/usr/bin/php * @@ -17,21 +18,64 @@ * * $Id$ * $Source$ - * */ -require ("../../htdocs/master.inc.php"); +/** + \file scripts/banque/graph-solde.php + \ingroup banque + \brief Script de génération des images des soldes des comptes +*/ -include_once (JPGRAPH_DIR."jpgraph.php"); -include_once (JPGRAPH_DIR."jpgraph_line.php"); -include_once (JPGRAPH_DIR."jpgraph_bar.php"); -include_once (JPGRAPH_DIR."jpgraph_pie.php"); -include_once (JPGRAPH_DIR."jpgraph_error.php"); -include_once (JPGRAPH_DIR."jpgraph_canvas.php"); + +// Test si mode batch +$sapi_type = php_sapi_name(); +if (substr($sapi_type, 0, 3) == 'cgi') { + echo "Erreur: Vous utilisez l'interpreteur PHP pour le mode CGI. Pour executer mailing-send.php en ligne de commande, vous devez utiliser l'interpreteur PHP pour le mode CLI.\n"; + exit; +} + + +// Recupere root dolibarr +$path=eregi_replace('graph-solde.php','',$_SERVER["PHP_SELF"]); + +require ($path."../../htdocs/master.inc.php"); + +// Vérifie que chemin vers JPGRAHP est connu et defini $jpgraph +if (! defined('JPGRAPH_DIR') && ! defined('JPGRAPH_PATH')) +{ + print 'Erreur: Définissez la constante JPGRAPH_PATH sur la valeur du répertoire contenant JPGraph'; + exit; +} +if (! defined('JPGRAPH_DIR')) define('JPGRAPH_DIR', JPGRAPH_PATH); +$jpgraphdir=JPGRAPH_DIR; +if (! eregi('[\\\/]$',$jpgraphdir)) $jpgraphdir.='/'; + + +include_once ($jpgraphdir."jpgraph.php"); +include_once ($jpgraphdir."jpgraph_line.php"); +include_once ($jpgraphdir."jpgraph_bar.php"); +include_once ($jpgraphdir."jpgraph_pie.php"); +include_once ($jpgraphdir."jpgraph_error.php"); +include_once ($jpgraphdir."jpgraph_canvas.php"); $error = 0; -$opt = getopt("m:y:"); +// Initialise opt, tableau des parametres +if (function_exists("getopt")) +{ + // getopt existe sur ce PHP + $opt = getopt("m:y:"); +} +else +{ + // getopt n'existe sur ce PHP + $opt=array('m'=>$argv[1]); +} + + +// Crée répertoire accueil +create_exdir($conf->banque->dir_images); + $datetime = time(); @@ -191,7 +235,7 @@ foreach ($accounts as $account) $graph->Add($b2plot); $graph->img->SetImgFormat("png"); - $file= DOL_DATA_ROOT."/graph/banque/solde.$account.$year.$month.png"; + $file= $conf->banque->dir_images."/solde.$account.$year.$month.png"; $graph->Stroke($file); } @@ -311,7 +355,7 @@ foreach ($accounts as $account) $graph->Add($b2plot); $graph->img->SetImgFormat("png"); - $file= DOL_DATA_ROOT."/graph/banque/solde.$account.$year.png"; + $file= $conf->banque->dir_images."/solde.$account.$year.png"; $graph->Stroke($file); } @@ -415,7 +459,7 @@ foreach ($accounts as $account) $graph->Add($b2plot); $graph->img->SetImgFormat("png"); - $file= DOL_DATA_ROOT."/graph/banque/solde.$account.png"; + $file= $conf->banque->dir_images."/solde.$account.png"; $graph->Stroke($file); }