Look: Uniformisation fiches avec ref

This commit is contained in:
Laurent Destailleur 2007-11-05 22:37:41 +00:00
parent 75d7d0ffd7
commit 62e5efda54
21 changed files with 397 additions and 240 deletions

View File

@ -39,9 +39,11 @@
class Skeleton_class
{
var $db;
var $error='';
var $errors=array();
var $db; // To store db handler
var $error; // To return error code (or message)
var $errors=array(); // To return several error codes (or messages)
var $element='skeleton'; // Id that identify managed objects
var $table_element='skeleton'; // Name of table without prefix where object is stored
var $id;
var $prop1;

View File

@ -34,6 +34,7 @@
\version $Revision$
*/
require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/cotisation.class.php");
@ -42,13 +43,15 @@ require_once(DOL_DOCUMENT_ROOT."/adherents/cotisation.class.php");
\brief Classe permettant la gestion d'un adhérent
*/
class Adherent
class Adherent extends CommonObject
{
var $id;
var $db;
var $error;
var $errors=array();
var $element='member';
var $table_element='adherent';
var $id;
var $ref;
var $prenom;
var $nom;
@ -2076,40 +2079,6 @@ class Adherent
}
}
/**
* \brief Charge les propriétés id_previous et id_next
* \param filter filtre
* \return int <0 si ko, >0 si ok
*/
function load_previous_next_ref($filter='')
{
$sql = "SELECT MAX(rowid)";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent";
$sql.= " WHERE rowid < '".addslashes($this->id)."'";
if (isset($filter)) $sql.=" AND ".$filter;
$result = $this->db->query($sql) ;
if (! $result)
{
$this->error=$this->db->error();
return -1;
}
$row = $this->db->fetch_row($result);
$this->ref_previous = $row[0];
$sql = "SELECT MIN(rowid)";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent";
$sql.= " WHERE rowid > '".addslashes($this->id)."'";
if (isset($filter)) $sql.=" AND ".$filter;
$result = $this->db->query($sql) ;
if (! $result)
{
$this->error=$this->db->error();
return -2;
}
$row = $this->db->fetch_row($result);
$this->ref_next = $row[0];
}
/**
* \brief Initialise le membre avec valeurs fictives aléatoire

View File

@ -495,16 +495,50 @@ class CommonObject
}
/**
* \brief Charge les propriétés ref_previous et ref_next
* \param filter filtre
* \return int <0 si ko, >0 si ok
*/
function load_previous_next_ref($filter='')
{
return 1;
}
/**
* \brief Load properties id_previous and id_next
* \param filter Optional filter
* \param fieldid Nom du champ a utiliser pour select next et previous
* \return int <0 if KO, >0 if OK
*/
function load_previous_next_ref($filter='',$fieldid)
{
if (! $this->table_element)
{
dolibarr_syslog("CommonObject::load_previous_next was called on objet with property table_element not defined");
return -1;
}
$sql = "SELECT MAX(".$fieldid.")";
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " WHERE ".$fieldid." < '".addslashes($this->ref)."'";
if (isset($filter)) $sql.=" AND ".$filter;
$result = $this->db->query($sql) ;
if (! $result)
{
$this->error=$this->db->error();
return -1;
}
$row = $this->db->fetch_row($result);
$this->ref_previous = $row[0];
$sql = "SELECT MIN(".$fieldid.")";
$sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " WHERE ".$fieldid." > '".addslashes($this->ref)."'";
if (isset($filter)) $sql.=" AND ".$filter;
$result = $this->db->query($sql) ;
if (! $result)
{
$this->error=$this->db->error();
return -2;
}
$row = $this->db->fetch_row($result);
$this->ref_next = $row[0];
return 1;
}
/**
* \brief On récupère les id de liste_contact
* \param source Source du contact external (llx_socpeople) ou internal (llx_user)
@ -523,6 +557,7 @@ class CommonObject
}
return $contactAlreadySelected;
}
}
?>

View File

@ -29,14 +29,21 @@
\version $Revision$
*/
require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php");
/**
\class Account
\brief Classe permettant la gestion des comptes bancaires
*/
class Account
class Account extends CommonObject
{
var $rowid;
var $db;
var $error;
var $element='bank_account';
var $table_element='bank_account';
var $rowid;
var $ref;
var $label;
var $type;
@ -425,8 +432,9 @@ class Account
/*
* \brief Charge un compte en memoire depuis la base
* \param id Id du compte à récupérer
* \param ref Ref du compte à récupérer
*/
function fetch($id)
function fetch($id,$ref='')
{
$sql = "SELECT rowid, ref, label, bank, number, courant, clos, rappro, url,";
$sql.= " code_banque, code_guichet, cle_rib, bic, iban_prefix,";
@ -434,7 +442,8 @@ class Account
$sql.= " account_number, currency_code,";
$sql.= " min_allowed, min_desired, comment";
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
$sql.= " WHERE rowid = ".$id;
if ($id) $sql.= " WHERE rowid = ".$id;
if ($ref) $sql.= " WHERE ref = '".addslashes($ref)."'";
dolibarr_syslog("Account::fetch sql=".$sql);
$result = $this->db->query($sql);

View File

@ -119,7 +119,7 @@ $memberstatic=new Adherent($db);
$html = new Form($db);
if ($account > 0)
if ($account || $_GET["ref"])
{
if ($vline)
{
@ -130,7 +130,15 @@ if ($account > 0)
$viewline = 20;
}
$acct = new Account($db);
$result=$acct->fetch($account);
if ($_GET["account"])
{
$result=$acct->fetch($_GET["account"]);
}
if ($_GET["ref"])
{
$result=$acct->fetch(0,$_GET["ref"]);
$account=$acct->id;
}
// Chargement des categories bancaires dans $options
$nbcategories=0;
@ -235,7 +243,22 @@ if ($account > 0)
$head=bank_prepare_head($acct);
dolibarr_fiche_head($head,'journal',$langs->trans("FinancialAccount"),0);
print '<table class="border" width="100%">';
// Ref
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
print $html->showrefnav($acct,'ref','',1,'ref');
print '</td></tr>';
// Label
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
print '<td colspan="3">'.$acct->label.'</td></tr>';
print '</table>';
print '<br>';
if ($mesg) print '<div class="error">'.$mesg.'</div>';
@ -267,13 +290,6 @@ if ($account > 0)
$navig.='</form>';
// Show title
if (! $_GET["action"]=='addline' && ! $_GET["action"]=='delete')
{
$titre=$langs->trans("FinancialAccount")." : ".$acct->label;
print_fiche_titre($titre,$navig);
}
// Confirmation delete
if ($_GET["action"]=='delete')
{
@ -285,6 +301,12 @@ if ($account > 0)
print '<table class="notopnoleftnoright" width="100%">';
// Show title
if (! $_GET["action"]=='addline' && ! $_GET["action"]=='delete')
{
print '<tr><td colspan="9" align="right">'.$navig.'</td></tr>';
}
// Formulaire de saisie d'une opération hors factures
if ($user->rights->banque->modifier && $_GET["action"]=='addline')

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2007 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
@ -17,7 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
@ -54,9 +53,19 @@ if ($user->societe_id > 0)
llxHeader();
$form = new Form($db);
// Récupère info du compte
$acct = new Account($db);
$acct->fetch($_GET["account"]);
if ($_GET["account"])
{
$result=$acct->fetch($_GET["account"]);
}
if ($_GET["ref"])
{
$result=$acct->fetch(0,$_GET["ref"]);
$_GET["account"]=$acct->id;
}
# Ce rapport de trésorerie est basé sur llx_bank (car doit inclure les transactions sans facture)
@ -113,12 +122,27 @@ $head=bank_prepare_head($acct);
dolibarr_fiche_head($head,'annual',$langs->trans("FinancialAccount"),0);
$title=$langs->trans("FinancialAccount")." : ".$acct->label;
$lien=($year_start?"<a href='annuel.php?account=".$acct->id."&year_start=".($year_start-1)."'>".img_previous()."</a> <a href='annuel.php?account=".$acct->id."&year_start=".($year_start+1)."'>".img_next()."</a>":"");
print_fiche_titre($title,$lien);
$lien=($year_start?"<a href='annuel.php?account=".$acct->id."&year_start=".($year_start-1)."'>".img_previous()."</a> ".$langs->trans("Year")." <a href='annuel.php?account=".$acct->id."&year_start=".($year_start+1)."'>".img_next()."</a>":"");
print '<table class="border" width="100%">';
// Ref
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
print $form->showrefnav($acct,'ref','',1,'ref');
print '</td></tr>';
// Label
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
print '<td colspan="3">'.$acct->label.'</td></tr>';
print '</table>';
print '<br>';
// Affiche tableau
print '<table class="noborder" width="100%">';
print '<tr><td colspan="'.(1+($year_end-$year_start+1)*2).'" align="right">'.$lien.'</td></tr>';
print '<tr class="liste_titre"><td rowspan=2>'.$langs->trans("Month").'</td>';
for ($annee = $year_start ; $annee <= $year_end ; $annee++)

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2007 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
@ -18,7 +18,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
@ -95,10 +94,18 @@ $form = new Form($db);
/* */
/* ************************************************************************** */
if ($_GET["id"] && $_GET["action"] != 'edit')
if (($_GET["id"] || $_GET["ref"]) && $_GET["action"] != 'edit')
{
$account = new Account($db, $_GET["id"]);
$account->fetch($_GET["id"]);
$account = new Account($db);
if ($_GET["id"])
{
$result=$account->fetch($_GET["id"]);
}
if ($_GET["ref"])
{
$result=$account->fetch(0,$_GET["ref"]);
$_GET["id"]=$account->id;
}
/*
* Affichage onglets
@ -120,7 +127,9 @@ $form = new Form($db);
// Ref
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'.$account->ref.'</td></tr>';
print '<td colspan="3">';
print $form->showrefnav($account,'ref','',1,'ref');
print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
print '<td colspan="3">'.$account->label.'</td></tr>';

View File

@ -18,7 +18,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
@ -262,10 +261,18 @@ if ($_GET["action"] == 'create')
/* ************************************************************************** */
else
{
if ($_GET["id"] && $_GET["action"] != 'edit')
if (($_GET["id"] || $_GET["ref"]) && $_GET["action"] != 'edit')
{
$account = new Account($db, $_GET["id"]);
$account->fetch($_GET["id"]);
$account = new Account($db);
if ($_GET["id"])
{
$account->fetch($_GET["id"]);
}
if ($_GET["ref"])
{
$account->fetch(0,$_GET["ref"]);
$_GET["id"]=$account->id;
}
/*
* Affichage onglets
@ -288,7 +295,9 @@ else
// Ref
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">'.$account->ref.'</td></tr>';
print '<td colspan="3">';
print $form->showrefnav($account,'ref','',1,'ref');
print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
print '<td colspan="3">'.$account->label.'</td></tr>';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2007 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
@ -17,7 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
@ -42,15 +41,26 @@ $mesg = '';
llxHeader();
if ($account > 0)
$form = new Form($db);
if ($_GET["account"] || $_GET["ref"])
{
$datetime = time();
$year = strftime("%Y", $datetime);
$month = strftime("%m", $datetime);
$day = strftime("%d", $datetime);
$acct = new Account($db);
$acct->fetch($account);
if ($_GET["account"])
{
$result=$acct->fetch($_GET["account"]);
}
if ($_GET["ref"])
{
$result=$acct->fetch(0,$_GET["ref"]);
$account=$acct->id;
}
create_exdir($conf->banque->dir_temp);
@ -61,9 +71,9 @@ if ($account > 0)
$height = 200;
// Calcul de $min et $max
$sql = "SELECT min(".$db->pdate("datev")."),max(".$db->pdate("datev").")";
$sql .= " FROM ".MAIN_DB_PREFIX."bank";
$sql .= " WHERE fk_account = ".$account;
$sql = "SELECT min(".$db->pdate("datev")."), max(".$db->pdate("datev").")";
$sql.= " FROM ".MAIN_DB_PREFIX."bank";
$sql.= " WHERE fk_account = ".$account;
$resql = $db->query($sql);
if ($resql)
{
@ -76,8 +86,13 @@ if ($account > 0)
{
dolibarr_print_error($db);
}
// print strftime("%Y%m%d",$max);
$log="graph.php: min=".$min." max=".$max;
dolibarr_syslog($log);
// Tableau 1
// Chargement du tableau $amounts
// \todo peut etre optimise en virant les date_format
$amounts = array();
@ -97,6 +112,7 @@ if ($account > 0)
$amounts[$row[0]] = $row[1];
$i++;
}
$db->free($resql);
}
else
{
@ -114,6 +130,7 @@ if ($account > 0)
{
$row = $db->fetch_row($resql);
$solde = $row[0];
$db->free($resql);
}
else
{
@ -126,13 +143,19 @@ if ($account > 0)
$datamin = array();
$subtotal = 0;
$day = mktime(1,1,1,$month,1,$year);
$xmonth = substr("00".strftime("%m",$day), -2);
$day = dolibarr_mktime(12,0,0,$month,1,$year);
$xmonth = $month;
$i = 0;
while ($xmonth == $month)
{
$textdate = strftime("%Y%m%d",$day);
$xyear = substr($textdate,0,4);
$xday = substr($textdate,6,2);
$xmonth = substr($textdate,4,2);
//print strftime ("%e %d %m %y",$day)."\n";
$subtotal = $subtotal + (isset($amounts[strftime("%Y%m%d",$day)]) ? $amounts[strftime("%Y%m%d",$day)] : 0);
$subtotal = $subtotal + (isset($amounts[$textdate]) ? $amounts[$textdate] : 0);
if ($day > time())
{
$datas[$i] = ''; // Valeur spéciale permettant de ne pas tracer le graph
@ -143,9 +166,8 @@ if ($account > 0)
}
$datamin[$i] = $acct->min_desired;
//$labels[$i] = strftime("%d",$day);
$labels[$i] = strftime("%d",$day);
$labels[$i] = $xday;
$day += 86400;
$xmonth = substr("00".strftime("%m",$day), -2);
$i++;
}
@ -173,6 +195,16 @@ if ($account > 0)
$px->SetHorizTickIncrement(1);
$px->SetPrecisionY(0);
$px->draw($file);
unset($graph_datas);
unset($px);
unset($datas);
unset($datamin);
unset($labels);
unset($amounts);
// Tableau 2
// Chargement du tableau $amounts
@ -194,6 +226,7 @@ if ($account > 0)
$amounts[$row[0]] = $row[1];
$i++;
}
$db->free($resql);
}
else
{
@ -211,6 +244,7 @@ if ($account > 0)
{
$row = $db->fetch_row($resql);
$solde = $row[0];
$db->free($resql);
}
else
{
@ -223,14 +257,17 @@ if ($account > 0)
$datamin = array();
$subtotal = 0;
$day = mktime(1,1,1,1,1,$year);
$xyear = strftime("%Y",$day);
$now = time();
$day = dolibarr_mktime(12,0,0,1,1,$year);
$i = 0;
while ($xyear == $year)
{
$subtotal = $subtotal + (isset($amounts[strftime("%Y%m%d",$day)]) ? $amounts[strftime("%Y%m%d",$day)] : 0);
//print strftime ("%e %d %m %y",$day)." ".$subtotal."\n<br>";
if ($day > time())
$textdate = strftime("%Y%m%d",$day);
$xyear = substr($textdate,0,4);
$xday = substr($textdate,6,2);
$subtotal = $subtotal + (isset($amounts[$textdate]) ? $amounts[$textdate] : 0);
if ($day > $now)
{
$datas[$i] = ''; // Valeur spéciale permettant de ne pas tracer le graph
}
@ -239,12 +276,11 @@ if ($account > 0)
$datas[$i] = $solde + $subtotal;
}
$datamin[$i] = $acct->min_desired;
if (strftime("%d",$day) == 15)
if ($xday == '15')
{
$labels[$i] = dolibarr_print_date($day,"%b");
}
$day += 86400;
$xyear = strftime("%Y",$day);
$i++;
}
@ -273,7 +309,17 @@ if ($account > 0)
$px->SetPrecisionY(0);
$px->draw($file);
unset($px);
unset($graph_datas);
unset($datas);
unset($datamin);
unset($labels);
unset($amounts);
// Tableau 3
// Chargement du tableau $amounts
// \todo peut etre optimise en virant les date_format
$amounts = array();
@ -312,7 +358,9 @@ if ($account > 0)
$i = 0;
while ($day <= ($max+86400)) // On va au dela du dernier jour
{
$subtotal = $subtotal + (isset($amounts[strftime("%Y%m%d",$day)]) ? $amounts[strftime("%Y%m%d",$day)] : 0);
$textdate=strftime("%Y%m%d",$day);
$subtotal = $subtotal + (isset($amounts[$textdate]) ? $amounts[$textdate] : 0);
//print strftime ("%e %d %m %y",$day)." ".$subtotal."\n<br>";
if ($day > ($max+86400))
{
@ -320,12 +368,12 @@ if ($account > 0)
}
else
{
$datas[$i] = $solde + $subtotal;
$datas[$i] = '' + $solde + $subtotal;
}
$datamin[$i] = $acct->min_desired;
if (strftime("%d",$day) == 1)
if (substr($textdate,6,2) == '01')
{
$labels[$i] = strftime("%m",$day);
$labels[$i] = substr($textdate,4,2);
}
$day += 86400;
$i++;
@ -341,7 +389,7 @@ if ($account > 0)
else $graph_datas[$i]=array(isset($labels[$i])?$labels[$i]:'',$datas[$i]);
}
$px = new DolGraph();
$px->SetData($graph_datas);
$px->SetData($graph_datas);
if ($acct->min_desired) $px->SetLegend(array($langs->transnoentities("Balance"),$langs->transnoentities("BalanceMinimalDesired")));
else $px->SetLegend(array($langs->transnoentities("Balance")));
$px->SetLegendWidthMin(180);
@ -355,7 +403,16 @@ if ($account > 0)
$px->SetPrecisionY(0);
$px->draw($file);
unset($graph_datas);
unset($datas);
unset($datamin);
unset($labels);
unset($amounts);
// Tableau 4
// Chargement du tableau $credits, $debits
$credits = array();
$debits = array();
@ -376,6 +433,7 @@ if ($account > 0)
$credits[$row[0]] = $row[1];
$i++;
}
$db->free($resql);
}
else
{
@ -394,6 +452,7 @@ if ($account > 0)
{
$debits[$row[0]] = abs($row[1]);
}
$db->free($resql);
}
else
{
@ -408,7 +467,7 @@ if ($account > 0)
{
$data_credit[$i] = isset($credits[substr("0".($i+1),-2)]) ? $credits[substr("0".($i+1),-2)] : 0;
$data_debit[$i] = isset($debits[substr("0".($i+1),-2)]) ? $debits[substr("0".($i+1),-2)] : 0;
$labels[$i] = strftime("%b",dolibarr_mktime(1,1,1,$i+1,1,2000));
$labels[$i] = strftime("%b",dolibarr_mktime(12,0,0,$i+1,1,2000));
$datamin[$i] = $acct->min_desired;
}
@ -436,11 +495,34 @@ if ($account > 0)
$px->SetPrecisionY(0);
$px->draw($file);
unset($graph_datas);
unset($px);
unset($debits);
unset($credits);
// Onglets
$head=bank_prepare_head($acct);
dolibarr_fiche_head($head,'graph',$langs->trans("FinancialAccount"),0);
print '<table class="border" width="100%">';
// Ref
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
print $form->showrefnav($acct,'ref','',1,'ref');
print '</td></tr>';
// Label
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
print '<td colspan="3">'.$acct->label.'</td></tr>';
print '</table>';
print '<br>';
print '<table class="notopnoleftnoright" width="100%">';
print '<tr><td align="center">';

View File

@ -64,10 +64,20 @@ $pagenext = $page + 1;
llxHeader();
$html = new Form($db);
// Récupère info du compte
$acct = new Account($db);
$acct->fetch($_GET["account"]);
if ($_GET["account"])
{
$acct->fetch($_GET["account"]);
}
if ($_GET["ref"])
{
$acct->fetch(0,$_GET["ref"]);
$_GET["account"]=$acct->id;
}
if (! isset($_GET["num"]))
{
@ -91,8 +101,25 @@ if (! isset($_GET["num"]))
$head=bank_prepare_head($acct);
dolibarr_fiche_head($head,'statement',$langs->trans("FinancialAccount"),0);
$titre=$langs->trans("FinancialAccount")." : ".$acct->label;
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], "&amp;account=".$_GET["account"], $sortfield, $sortorder,'',$numrows);
print '<table class="border" width="100%">';
// Ref
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
print $html->showrefnav($acct,'ref','',1,'ref');
print '</td></tr>';
// Label
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
print '<td colspan="3">'.$acct->label.'</td></tr>';
print '</table>';
print '<br>';
print_barre_liste('', $page, $_SERVER["PHP_SELF"], "&amp;account=".$_GET["account"], $sortfield, $sortorder,'',$numrows);
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">";
@ -173,6 +200,7 @@ else
}
$ve=$_GET["ve"];
$mesprevnext ="<a href=\"releve.php?rel=prev&amp;num=$num&amp;ve=$ve&amp;account=$acct->id\">".img_previous()."</a> &nbsp;";
$mesprevnext.= $langs->trans("AccountStatement")." $num";
$mesprevnext.=" &nbsp; <a href=\"releve.php?rel=next&amp;num=$num&amp;ve=$ve&amp;account=$acct->id\">".img_next()."</a>";

View File

@ -16,7 +16,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
@ -52,13 +51,14 @@ $mesg='';
*/
llxHeader();
$societestatic = new Societe($db);
$facturestatic=new Facture($db);
$facturefournstatic=new FactureFournisseur($db);
$html = new Form($db);
if ($account > 0)
if ($_REQUEST["account"] || $_REQUEST["ref"])
{
if ($vline)
{
@ -68,8 +68,19 @@ if ($account > 0)
{
$viewline = 20;
}
$acct = new Account($db);
$result=$acct->fetch($account);
if ($_GET["account"])
{
$result=$acct->fetch($_GET["account"]);
}
if ($_GET["ref"])
{
$result=$acct->fetch(0,$_GET["ref"]);
$_GET["account"]=$acct->id;
}
/*
*
*
@ -78,7 +89,23 @@ if ($account > 0)
$head=bank_prepare_head($acct);
dolibarr_fiche_head($head,'cash',$langs->trans("FinancialAccount"),0);
print '<table class="border" width="100%">';
// Ref
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="3">';
print $html->showrefnav($acct,'ref','',1,'ref');
print '</td></tr>';
// Label
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
print '<td colspan="3">'.$acct->label.'</td></tr>';
print '</table>';
print '<br>';
if ($mesg) print '<div class="error">'.$mesg.'</div>';

View File

@ -20,7 +20,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
@ -30,17 +29,20 @@
\version $Revision$
*/
require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php");
/**
\class Contact
\brief Classe permettant la gestion des contacts
*/
class Contact
class Contact extends CommonObject
{
var $db;
var $error;
var $element='contact';
var $table_element='socpeople';
var $id;
var $civilite_id;
var $name;
@ -385,6 +387,7 @@ class Contact
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->civilite_id = $obj->civilite_id;
$this->name = $obj->name;
$this->firstname = $obj->firstname;

View File

@ -366,7 +366,7 @@ if ($user->rights->societe->contact->creer)
// Ref
print '<tr><td>'.$langs->trans("Ref").'</td><td colspan="3">';
print $contact->id;
print $contact->ref;
print '</td></tr>';
// Name

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (c) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (c) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (c) 2004-2007 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
@ -17,7 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
@ -305,15 +304,15 @@ class DolGraph
if (defined('TOTY')) $phplotversion=5;
// Create graph
$this->graph = new PHPlot($this->width, $this->height);
$this->graph->SetIsInline(1);
$this->graph->SetPlotType($this->type);
$this->graph->SetDataValues($this->data);
$graph = new PHPlot($this->width, $this->height);
$graph->SetIsInline(1);
$graph->SetPlotType($this->type);
$graph->SetDataValues($this->data);
// Precision axe y (pas de decimal si 3 chiffres ou plus)
if ($this->PrecisionY > -1)
{
$this->graph->SetPrecisionY($this->PrecisionY);
$graph->SetPrecisionY($this->PrecisionY);
if ($this->PrecisionY == 0) // Si precision de 0
{
// Determine un nombre de ticks qui permet decoupage qui tombe juste
@ -352,15 +351,15 @@ class DolGraph
$maxticks=min(9,$plage);
}
}
$this->graph->SetNumVertTicks($maxticks);
$graph->SetNumVertTicks($maxticks);
// print 'minval='.$minval.' - maxval='.$maxval.' - plage='.$plage.' - maxticks='.$maxticks.'<br>';
}
}
else
{
$this->graph->SetPrecisionY(3-strlen(round($this->GetMaxValueInData())));
$graph->SetPrecisionY(3-strlen(round($this->GetMaxValueInData())));
}
$this->graph->SetPrecisionX(0);
$graph->SetPrecisionX(0);
// Set areas
$top_space=40;
@ -380,52 +379,52 @@ class DolGraph
}
}
$this->graph->SetNewPlotAreaPixels($left_space, $top_space, $this->width - $right_space, $this->height-40);
$graph->SetNewPlotAreaPixels($left_space, $top_space, $this->width - $right_space, $this->height-40);
if (isset($this->MaxValue))
{
$this->graph->SetPlotAreaWorld(0,$this->MinValue,sizeof($this->data),$this->MaxValue);
$graph->SetPlotAreaWorld(0,$this->MinValue,sizeof($this->data),$this->MaxValue);
}
// Define title
if (isset($this->title)) $this->graph->SetTitle($this->title);
if (isset($this->title)) $graph->SetTitle($this->title);
// Défini position du graphe (et legende) au sein de l'image
if (isset($this->Legend) && sizeof($this->Legend))
{
$this->graph->SetLegendPixels($this->width - $right_space+8,40,'');
$this->graph->SetLegend($this->Legend);
$graph->SetLegendPixels($this->width - $right_space+8,40,'');
$graph->SetLegend($this->Legend);
}
if (isset($this->SetShading))
{
$this->graph->SetShading($this->SetShading);
$graph->SetShading($this->SetShading);
}
$this->graph->SetTickLength(6);
$graph->SetTickLength(6);
$this->graph->SetBackgroundColor($this->bgcolor);
$this->graph->SetDataColors($this->datacolor, $this->bordercolor);
$graph->SetBackgroundColor($this->bgcolor);
$graph->SetDataColors($this->datacolor, $this->bordercolor);
if ($this->SetNumXTicks > -1)
{
if ($phplotversion >= 5) // If PHPlot 5, for compatibility
{
$this->graph->SetXLabelType('');
$this->graph->SetNumXTicks($this->SetNumXTicks);
$graph->SetXLabelType('');
$graph->SetNumXTicks($this->SetNumXTicks);
}
else
{
$this->graph->SetNumHorizTicks($this->SetNumXTicks);
$graph->SetNumHorizTicks($this->SetNumXTicks);
}
}
if ($this->SetHorizTickIncrement > -1)
{
// Les ticks sont en mode forc
$this->graph->SetHorizTickIncrement($this->SetHorizTickIncrement);
$graph->SetHorizTickIncrement($this->SetHorizTickIncrement);
if ($phplotversion >= 5) // If PHPlot 5, for compatibility
{
$this->graph->SetXLabelType('');
$this->graph->SetXTickLabelPos('none');
$graph->SetXLabelType('');
$graph->SetXTickLabelPos('none');
}
}
else
@ -433,23 +432,25 @@ class DolGraph
// Les ticks sont en mode automatique
if ($phplotversion >= 5) // If PHPlot 5, for compatibility
{
$this->graph->SetXDataLabelPos('none');
$graph->SetXDataLabelPos('none');
}
}
if ($phplotversion >= 5)
{
// Ne gere la transparence qu'en phplot >= 5
// $this->graph->SetBgImage(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo_2.png','tile');
$this->graph->SetDrawPlotAreaBackground(array(255,255,255));
// $graph->SetBgImage(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo_2.png','tile');
$graph->SetDrawPlotAreaBackground(array(255,255,255));
}
$this->graph->SetPlotBorderType("left"); // Affiche axe y a gauche uniquement
$this->graph->SetVertTickPosition('plotleft'); // Affiche tick axe y a gauche uniquement
$this->graph->SetOutputFile($file);
$graph->SetPlotBorderType("left"); // Affiche axe y a gauche uniquement
$graph->SetVertTickPosition('plotleft'); // Affiche tick axe y a gauche uniquement
$graph->SetOutputFile($file);
// Generate file
$this->graph->DrawGraph();
$graph->DrawGraph();
unset($graph);
}

View File

@ -23,7 +23,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
@ -44,8 +43,11 @@ require_once(DOL_DOCUMENT_ROOT ."/client.class.php");
class Facture extends CommonObject
{
var $db;
var $element='facture';
var $db;
var $error;
var $element='facture';
var $table_element='facture';
var $table;
var $tabledetail;
var $id;
@ -94,7 +96,6 @@ class Facture extends CommonObject
var $nbtodo;
var $nbtodolate;
var $specimen;
var $error;
//! Numero d'erreur de 512 à 1023
var $errno = 0;
/**

View File

@ -3518,14 +3518,15 @@ class Form
* \param object Objet a afficher
* \param paramid Nom du parametre a utiliser pour nommer id dans liens URL
* \param morehtml Code html supplementaire a afficher avant barre nav
* \param shownav Show Condirion
* \param shownav Show Condition
* \param fieldid Nom du champ a utiliser pour select next et previous
* \return string Portion HTML avec ref + boutons nav
*/
function showrefnav($object,$paramid,$morehtml='',$shownav=1)
function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid')
{
$ret='';
$object->load_previous_next_ref($object->next_prev_filter);
$object->load_previous_next_ref($object->next_prev_filter,$fieldid);
$previous_ref = $object->ref_previous?'<a href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_previous).'">'.img_previous().'</a>':'';
$next_ref = $object->ref_next?'<a href="'.$_SERVER["PHP_SELF"].'?'.$paramid.'='.urlencode($object->ref_next).'">'.img_next().'</a>':'';

View File

@ -2129,7 +2129,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
if ($page > 0 || $num > $conf->liste_limit)
{
print '<tr><td class="notopnoleftnoright"><div class="titre">'.$titre.' - '.$langs->trans('page').' '.($page+1);
print '<tr><td class="notopnoleftnoright"><div class="titre">'.$titre.($titre?' - ':'').$langs->trans('page').' '.($page+1);
print '</div></td>';
}
else

View File

@ -20,7 +20,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
@ -30,15 +29,21 @@
\version $Revision$
*/
require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php");
/**
\class Product
\brief Classe permettant la gestion des produits prédéfinis
*/
class Product
class Product extends CommonObject
{
var $db ;
//! Identifiant unique
var $db;
var $error;
var $element='product';
var $table_element='product';
//! Identifiant unique
var $id ;
//! Référence
var $ref;
@ -91,8 +96,6 @@ class Product
var $imgWidth;
var $imgHeight;
//! Intitule de l'erreur
var $error;
//! Numero de l'erreur
//! Numero d'erreur Plage 0256-0511
var $errno = 0;
@ -975,43 +978,6 @@ class Product
}
/**
* \brief Charge les propriétés ref_previous et ref_next
* \param filter filtre
* \return int <0 si ko, >0 si ok
*/
function load_previous_next_ref($filter='')
{
$sql = "SELECT MAX(ref)";
$sql.= " FROM ".MAIN_DB_PREFIX."product";
$sql.= " WHERE ref < '".addslashes($this->ref)."'";
if (isset($filter)) $sql.=" AND ".$filter;
$result = $this->db->query($sql) ;
if (! $result)
{
$this->error=$this->db->error();
return -1;
}
$row = $this->db->fetch_row($result);
$this->ref_previous = $row[0];
$sql = "SELECT MIN(ref)";
$sql.= " FROM ".MAIN_DB_PREFIX."product";
$sql.= " WHERE ref > '".addslashes($this->ref)."'";
if (isset($filter)) $sql.=" AND ".$filter;
$result = $this->db->query($sql) ;
if (! $result)
{
$this->error=$this->db->error();
return -2;
}
$row = $this->db->fetch_row($result);
$this->ref_next = $row[0];
return 1;
}
/**
* \brief Charge tableau des stats propale pour le produit/service
* \param socid Id societe

View File

@ -761,7 +761,7 @@ if ($_GET["id"] || $_GET["ref"])
// Reference
print '<td width="15%">'.$langs->trans("Ref").'</td><td width="85%">';
print $html->showrefnav($product,'ref');
print $html->showrefnav($product,'ref','',1,'ref');
print '</td>';
$nblignes=6;

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
@ -20,7 +20,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**

View File

@ -37,14 +37,19 @@
\version $Revision$
*/
require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php");
/**
\class User
\brief Classe permettant la gestion d'un utilisateur
*/
class User
class User extends CommonObject
{
var $db;
var $db;
var $error;
var $element='user';
var $table_element='user';
var $id;
var $ldap_sid;
@ -81,7 +86,6 @@ class User
var $statut;
var $lang;
var $error;
var $userpref_limite_liste;
var $all_permissions_are_loaded; /**< \private all_permissions_are_loaded */
//! Liste des entrepots auquel a acces l'utilisateur
@ -1733,41 +1737,7 @@ class User
dolibarr_print_error($this->db);
}
}
/**
* \brief Charge les propriétés id_previous et id_next
* \param filter filtre
* \return int <0 si ko, >0 si ok
*/
function load_previous_next_ref($filter='')
{
$sql = "SELECT MAX(rowid)";
$sql.= " FROM ".MAIN_DB_PREFIX."user";
$sql.= " WHERE rowid < '".addslashes($this->id)."'";
if (isset($filter)) $sql.=" AND ".$filter;
$result = $this->db->query($sql) ;
if (! $result)
{
$this->error=$this->db->error();
return -1;
}
$row = $this->db->fetch_row($result);
$this->ref_previous = $row[0];
$sql = "SELECT MIN(rowid)";
$sql.= " FROM ".MAIN_DB_PREFIX."user";
$sql.= " WHERE rowid > '".addslashes($this->id)."'";
if (isset($filter)) $sql.=" AND ".$filter;
$result = $this->db->query($sql) ;
if (! $result)
{
$this->error=$this->db->error();
return -2;
}
$row = $this->db->fetch_row($result);
$this->ref_next = $row[0];
}
}