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 class Skeleton_class
{ {
var $db; var $db; // To store db handler
var $error=''; var $error; // To return error code (or message)
var $errors=array(); 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 $id;
var $prop1; var $prop1;

View File

@ -34,6 +34,7 @@
\version $Revision$ \version $Revision$
*/ */
require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
require_once(DOL_DOCUMENT_ROOT."/adherents/cotisation.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 \brief Classe permettant la gestion d'un adhérent
*/ */
class Adherent class Adherent extends CommonObject
{ {
var $id;
var $db; var $db;
var $error; var $error;
var $errors=array(); var $errors=array();
var $element='member';
var $table_element='adherent';
var $id;
var $ref; var $ref;
var $prenom; var $prenom;
var $nom; 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 * \brief Initialise le membre avec valeurs fictives aléatoire

View File

@ -495,15 +495,49 @@ class CommonObject
} }
/** /**
* \brief Charge les propriétés ref_previous et ref_next * \brief Load properties id_previous and id_next
* \param filter filtre * \param filter Optional filter
* \return int <0 si ko, >0 si ok * \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='') */
{ function load_previous_next_ref($filter='',$fieldid)
return 1; {
} 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 * \brief On récupère les id de liste_contact
@ -523,6 +557,7 @@ class CommonObject
} }
return $contactAlreadySelected; return $contactAlreadySelected;
} }
} }
?> ?>

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* 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 * 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 * 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. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$ * $Id$
* $Source$
*/ */
/** /**
@ -54,9 +53,19 @@ if ($user->societe_id > 0)
llxHeader(); llxHeader();
$form = new Form($db);
// Récupère info du compte // Récupère info du compte
$acct = new Account($db); $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) # 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); dolibarr_fiche_head($head,'annual',$langs->trans("FinancialAccount"),0);
$title=$langs->trans("FinancialAccount")." : ".$acct->label; $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>":""); $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_fiche_titre($title,$lien);
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 // Affiche tableau
print '<table class="noborder" width="100%">'; 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>'; print '<tr class="liste_titre"><td rowspan=2>'.$langs->trans("Month").'</td>';
for ($annee = $year_start ; $annee <= $year_end ; $annee++) for ($annee = $year_start ; $annee <= $year_end ; $annee++)

View File

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

View File

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

View File

@ -64,10 +64,20 @@ $pagenext = $page + 1;
llxHeader(); llxHeader();
$html = new Form($db);
// Récupère info du compte // Récupère info du compte
$acct = new Account($db); $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"])) if (! isset($_GET["num"]))
{ {
@ -91,8 +101,25 @@ if (! isset($_GET["num"]))
$head=bank_prepare_head($acct); $head=bank_prepare_head($acct);
dolibarr_fiche_head($head,'statement',$langs->trans("FinancialAccount"),0); dolibarr_fiche_head($head,'statement',$langs->trans("FinancialAccount"),0);
$titre=$langs->trans("FinancialAccount")." : ".$acct->label; print '<table class="border" width="100%">';
print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], "&amp;account=".$_GET["account"], $sortfield, $sortorder,'',$numrows);
// 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 '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
@ -173,6 +200,7 @@ else
} }
$ve=$_GET["ve"]; $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 ="<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.= $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>"; $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. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$ * $Id$
* $Source$
*/ */
/** /**
@ -52,13 +51,14 @@ $mesg='';
*/ */
llxHeader(); llxHeader();
$societestatic = new Societe($db); $societestatic = new Societe($db);
$facturestatic=new Facture($db); $facturestatic=new Facture($db);
$facturefournstatic=new FactureFournisseur($db); $facturefournstatic=new FactureFournisseur($db);
$html = new Form($db); $html = new Form($db);
if ($account > 0) if ($_REQUEST["account"] || $_REQUEST["ref"])
{ {
if ($vline) if ($vline)
{ {
@ -68,8 +68,19 @@ if ($account > 0)
{ {
$viewline = 20; $viewline = 20;
} }
$acct = new Account($db); $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,6 +89,22 @@ if ($account > 0)
$head=bank_prepare_head($acct); $head=bank_prepare_head($acct);
dolibarr_fiche_head($head,'cash',$langs->trans("FinancialAccount"),0); 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>'; 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. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$ * $Id$
* $Source$
*/ */
/** /**
@ -30,16 +29,19 @@
\version $Revision$ \version $Revision$
*/ */
require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php");
/** /**
\class Contact \class Contact
\brief Classe permettant la gestion des contacts \brief Classe permettant la gestion des contacts
*/ */
class Contact extends CommonObject
class Contact
{ {
var $db; var $db;
var $error; var $error;
var $element='contact';
var $table_element='socpeople';
var $id; var $id;
var $civilite_id; var $civilite_id;
@ -385,6 +387,7 @@ class Contact
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->rowid;
$this->civilite_id = $obj->civilite_id; $this->civilite_id = $obj->civilite_id;
$this->name = $obj->name; $this->name = $obj->name;
$this->firstname = $obj->firstname; $this->firstname = $obj->firstname;

View File

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

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (c) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* 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 * 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 * 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. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$ * $Id$
* $Source$
*/ */
/** /**
@ -305,15 +304,15 @@ class DolGraph
if (defined('TOTY')) $phplotversion=5; if (defined('TOTY')) $phplotversion=5;
// Create graph // Create graph
$this->graph = new PHPlot($this->width, $this->height); $graph = new PHPlot($this->width, $this->height);
$this->graph->SetIsInline(1); $graph->SetIsInline(1);
$this->graph->SetPlotType($this->type); $graph->SetPlotType($this->type);
$this->graph->SetDataValues($this->data); $graph->SetDataValues($this->data);
// Precision axe y (pas de decimal si 3 chiffres ou plus) // Precision axe y (pas de decimal si 3 chiffres ou plus)
if ($this->PrecisionY > -1) if ($this->PrecisionY > -1)
{ {
$this->graph->SetPrecisionY($this->PrecisionY); $graph->SetPrecisionY($this->PrecisionY);
if ($this->PrecisionY == 0) // Si precision de 0 if ($this->PrecisionY == 0) // Si precision de 0
{ {
// Determine un nombre de ticks qui permet decoupage qui tombe juste // Determine un nombre de ticks qui permet decoupage qui tombe juste
@ -352,15 +351,15 @@ class DolGraph
$maxticks=min(9,$plage); $maxticks=min(9,$plage);
} }
} }
$this->graph->SetNumVertTicks($maxticks); $graph->SetNumVertTicks($maxticks);
// print 'minval='.$minval.' - maxval='.$maxval.' - plage='.$plage.' - maxticks='.$maxticks.'<br>'; // print 'minval='.$minval.' - maxval='.$maxval.' - plage='.$plage.' - maxticks='.$maxticks.'<br>';
} }
} }
else 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 // Set areas
$top_space=40; $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)) 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 // 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 // Défini position du graphe (et legende) au sein de l'image
if (isset($this->Legend) && sizeof($this->Legend)) if (isset($this->Legend) && sizeof($this->Legend))
{ {
$this->graph->SetLegendPixels($this->width - $right_space+8,40,''); $graph->SetLegendPixels($this->width - $right_space+8,40,'');
$this->graph->SetLegend($this->Legend); $graph->SetLegend($this->Legend);
} }
if (isset($this->SetShading)) 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); $graph->SetBackgroundColor($this->bgcolor);
$this->graph->SetDataColors($this->datacolor, $this->bordercolor); $graph->SetDataColors($this->datacolor, $this->bordercolor);
if ($this->SetNumXTicks > -1) if ($this->SetNumXTicks > -1)
{ {
if ($phplotversion >= 5) // If PHPlot 5, for compatibility if ($phplotversion >= 5) // If PHPlot 5, for compatibility
{ {
$this->graph->SetXLabelType(''); $graph->SetXLabelType('');
$this->graph->SetNumXTicks($this->SetNumXTicks); $graph->SetNumXTicks($this->SetNumXTicks);
} }
else else
{ {
$this->graph->SetNumHorizTicks($this->SetNumXTicks); $graph->SetNumHorizTicks($this->SetNumXTicks);
} }
} }
if ($this->SetHorizTickIncrement > -1) if ($this->SetHorizTickIncrement > -1)
{ {
// Les ticks sont en mode forc // Les ticks sont en mode forc
$this->graph->SetHorizTickIncrement($this->SetHorizTickIncrement); $graph->SetHorizTickIncrement($this->SetHorizTickIncrement);
if ($phplotversion >= 5) // If PHPlot 5, for compatibility if ($phplotversion >= 5) // If PHPlot 5, for compatibility
{ {
$this->graph->SetXLabelType(''); $graph->SetXLabelType('');
$this->graph->SetXTickLabelPos('none'); $graph->SetXTickLabelPos('none');
} }
} }
else else
@ -433,23 +432,25 @@ class DolGraph
// Les ticks sont en mode automatique // Les ticks sont en mode automatique
if ($phplotversion >= 5) // If PHPlot 5, for compatibility if ($phplotversion >= 5) // If PHPlot 5, for compatibility
{ {
$this->graph->SetXDataLabelPos('none'); $graph->SetXDataLabelPos('none');
} }
} }
if ($phplotversion >= 5) if ($phplotversion >= 5)
{ {
// Ne gere la transparence qu'en phplot >= 5 // Ne gere la transparence qu'en phplot >= 5
// $this->graph->SetBgImage(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo_2.png','tile'); // $graph->SetBgImage(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo_2.png','tile');
$this->graph->SetDrawPlotAreaBackground(array(255,255,255)); $graph->SetDrawPlotAreaBackground(array(255,255,255));
} }
$this->graph->SetPlotBorderType("left"); // Affiche axe y a gauche uniquement $graph->SetPlotBorderType("left"); // Affiche axe y a gauche uniquement
$this->graph->SetVertTickPosition('plotleft'); // Affiche tick axe y a gauche uniquement $graph->SetVertTickPosition('plotleft'); // Affiche tick axe y a gauche uniquement
$this->graph->SetOutputFile($file); $graph->SetOutputFile($file);
// Generate 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. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$ * $Id$
* $Source$
*/ */
/** /**
@ -44,8 +43,11 @@ require_once(DOL_DOCUMENT_ROOT ."/client.class.php");
class Facture extends CommonObject class Facture extends CommonObject
{ {
var $db; var $db;
var $element='facture'; var $error;
var $element='facture';
var $table_element='facture';
var $table; var $table;
var $tabledetail; var $tabledetail;
var $id; var $id;
@ -94,7 +96,6 @@ class Facture extends CommonObject
var $nbtodo; var $nbtodo;
var $nbtodolate; var $nbtodolate;
var $specimen; var $specimen;
var $error;
//! Numero d'erreur de 512 à 1023 //! Numero d'erreur de 512 à 1023
var $errno = 0; var $errno = 0;
/** /**

View File

@ -3518,14 +3518,15 @@ class Form
* \param object Objet a afficher * \param object Objet a afficher
* \param paramid Nom du parametre a utiliser pour nommer id dans liens URL * \param paramid Nom du parametre a utiliser pour nommer id dans liens URL
* \param morehtml Code html supplementaire a afficher avant barre nav * \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 * \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=''; $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>':''; $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>':''; $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) 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>'; print '</div></td>';
} }
else else

View File

@ -20,7 +20,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* *
* $Id$ * $Id$
* $Source$
*/ */
/** /**
@ -30,15 +29,21 @@
\version $Revision$ \version $Revision$
*/ */
require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php");
/** /**
\class Product \class Product
\brief Classe permettant la gestion des produits prédéfinis \brief Classe permettant la gestion des produits prédéfinis
*/ */
class Product extends CommonObject
class Product
{ {
var $db ; var $db;
//! Identifiant unique var $error;
var $element='product';
var $table_element='product';
//! Identifiant unique
var $id ; var $id ;
//! Référence //! Référence
var $ref; var $ref;
@ -91,8 +96,6 @@ class Product
var $imgWidth; var $imgWidth;
var $imgHeight; var $imgHeight;
//! Intitule de l'erreur
var $error;
//! Numero de l'erreur //! Numero de l'erreur
//! Numero d'erreur Plage 0256-0511 //! Numero d'erreur Plage 0256-0511
var $errno = 0; 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 * \brief Charge tableau des stats propale pour le produit/service
* \param socid Id societe * \param socid Id societe

View File

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

View File

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

View File

@ -37,14 +37,19 @@
\version $Revision$ \version $Revision$
*/ */
require_once(DOL_DOCUMENT_ROOT ."/commonobject.class.php");
/** /**
\class User \class User
\brief Classe permettant la gestion d'un utilisateur \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 $id;
var $ldap_sid; var $ldap_sid;
@ -81,7 +86,6 @@ class User
var $statut; var $statut;
var $lang; var $lang;
var $error;
var $userpref_limite_liste; var $userpref_limite_liste;
var $all_permissions_are_loaded; /**< \private all_permissions_are_loaded */ var $all_permissions_are_loaded; /**< \private all_permissions_are_loaded */
//! Liste des entrepots auquel a acces l'utilisateur //! Liste des entrepots auquel a acces l'utilisateur
@ -1734,40 +1738,6 @@ class User
} }
} }
/**
* \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];
}
} }