diff --git a/htdocs/compta/bank/bankcateg.class.php b/htdocs/compta/bank/bankcateg.class.php
new file mode 100644
index 00000000000..92f989ca9ed
--- /dev/null
+++ b/htdocs/compta/bank/bankcateg.class.php
@@ -0,0 +1,378 @@
+
+ *
+ * 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.
+ */
+
+/**
+ * \file compta/bank/bankcateg.class.php
+ * \ingroup banque
+ * \brief This file is CRUD class file (Create/Read/Update/Delete) for bank categories
+ * \version $Id$
+ * \author Laurent Destailleur
+ * \remarks Initialy built by build_class_from_table on 2009-01-02 15:26
+ */
+
+// Put here all includes required by your class file
+//require_once(DOL_DOCUMENT_ROOT."/commonobject.class.php");
+//require_once(DOL_DOCUMENT_ROOT."/societe.class.php");
+//require_once(DOL_DOCUMENT_ROOT."/product.class.php");
+
+
+/**
+ * \class Bank_categ
+ * \brief Put here description of your class
+ * \remarks Initialy built by build_class_from_table on 2009-01-02 15:26
+ */
+class BankCateg // extends CommonObject
+{
+ 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='bank_categ'; //!< Id that identify managed objects
+ //var $table_element='bank_categ'; //!< Name of table without prefix where object is stored
+
+ var $id;
+
+ var $label;
+
+
+
+
+ /**
+ * \brief Constructor
+ * \param DB Database handler
+ */
+ function BankCateg($DB)
+ {
+ $this->db = $DB;
+ return 1;
+ }
+
+
+ /**
+ * \brief Create in database
+ * \param user User that create
+ * \param notrigger 0=launch triggers after, 1=disable triggers
+ * \return int <0 if KO, Id of created object if OK
+ */
+ function create($user, $notrigger=0)
+ {
+ global $conf, $langs;
+ $error=0;
+
+ // Clean parameters
+
+ if (isset($this->label)) $this->label=trim($this->label);
+
+
+
+ // Check parameters
+ // Put here code to add control on parameters values
+
+ // Insert request
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_categ(";
+
+ $sql.= "label";
+
+
+ $sql.= ") VALUES (";
+
+ $sql.= " ".(! isset($this->label)?'NULL':"'".addslashes($this->label)."'")."";
+
+
+ $sql.= ")";
+
+ $this->db->begin();
+
+ dolibarr_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG);
+ $resql=$this->db->query($sql);
+ if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
+
+ if (! $error)
+ {
+ $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."bank_categ");
+
+ if (! $notrigger)
+ {
+ // Uncomment this and change MYOBJECT to your own tag if you
+ // want this action call a trigger.
+
+ //// Call triggers
+ //include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
+ //$interface=new Interfaces($this->db);
+ //$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
+ //if ($result < 0) { $error++; $this->errors=$interface->errors; }
+ //// End call triggers
+ }
+ }
+
+ // Commit or rollback
+ if ($error)
+ {
+ foreach($this->errors as $errmsg)
+ {
+ dolibarr_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
+ $this->error.=($this->error?', '.$errmsg:$errmsg);
+ }
+ $this->db->rollback();
+ return -1*$error;
+ }
+ else
+ {
+ $this->db->commit();
+ return $this->id;
+ }
+ }
+
+
+ /**
+ * \brief Load object in memory from database
+ * \param id id object
+ * \return int <0 if KO, >0 if OK
+ */
+ function fetch($id)
+ {
+ global $langs;
+ $sql = "SELECT";
+ $sql.= " t.rowid,";
+
+ $sql.= " t.label";
+
+
+ $sql.= " FROM ".MAIN_DB_PREFIX."bank_categ as t";
+ $sql.= " WHERE t.rowid = ".$id;
+
+ dolibarr_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG);
+ $resql=$this->db->query($sql);
+ if ($resql)
+ {
+ if ($this->db->num_rows($resql))
+ {
+ $obj = $this->db->fetch_object($resql);
+
+ $this->id = $obj->rowid;
+
+ $this->label = $obj->label;
+
+
+ }
+ $this->db->free($resql);
+
+ return 1;
+ }
+ else
+ {
+ $this->error="Error ".$this->db->lasterror();
+ dolibarr_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR);
+ return -1;
+ }
+ }
+
+
+ /**
+ * \brief Update database
+ * \param user User that modify
+ * \param notrigger 0=launch triggers after, 1=disable triggers
+ * \return int <0 if KO, >0 if OK
+ */
+ function update($user=0, $notrigger=0)
+ {
+ global $conf, $langs;
+ $error=0;
+
+ // Clean parameters
+
+ if (isset($this->label)) $this->label=trim($this->label);
+
+
+
+ // Check parameters
+ // Put here code to add control on parameters values
+
+ // Update request
+ $sql = "UPDATE ".MAIN_DB_PREFIX."bank_categ SET";
+
+ $sql.= " label=".(isset($this->label)?"'".addslashes($this->label)."'":"null")."";
+
+
+ $sql.= " WHERE rowid=".$this->id;
+
+ $this->db->begin();
+
+ dolibarr_syslog(get_class($this)."::update sql=".$sql, LOG_DEBUG);
+ $resql = $this->db->query($sql);
+ if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
+
+ if (! $error)
+ {
+ if (! $notrigger)
+ {
+ // Uncomment this and change MYOBJECT to your own tag if you
+ // want this action call a trigger.
+
+ //// Call triggers
+ //include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
+ //$interface=new Interfaces($this->db);
+ //$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
+ //if ($result < 0) { $error++; $this->errors=$interface->errors; }
+ //// End call triggers
+ }
+ }
+
+ // Commit or rollback
+ if ($error)
+ {
+ foreach($this->errors as $errmsg)
+ {
+ dolibarr_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
+ $this->error.=($this->error?', '.$errmsg:$errmsg);
+ }
+ $this->db->rollback();
+ return -1*$error;
+ }
+ else
+ {
+ $this->db->commit();
+ return 1;
+ }
+ }
+
+
+ /**
+ * \brief Delete object in database
+ * \param user User that delete
+ * \param notrigger 0=launch triggers after, 1=disable triggers
+ * \return int <0 if KO, >0 if OK
+ */
+ function delete($user, $notrigger=0)
+ {
+ global $conf, $langs;
+ $error=0;
+
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_categ";
+ $sql.= " WHERE rowid=".$this->id;
+
+ $this->db->begin();
+
+ dolibarr_syslog(get_class($this)."::delete sql=".$sql);
+ $resql = $this->db->query($sql);
+ if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
+
+ if (! $error)
+ {
+ if (! $notrigger)
+ {
+ // Uncomment this and change MYOBJECT to your own tag if you
+ // want this action call a trigger.
+
+ //// Call triggers
+ //include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
+ //$interface=new Interfaces($this->db);
+ //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
+ //if ($result < 0) { $error++; $this->errors=$interface->errors; }
+ //// End call triggers
+ }
+ }
+
+ // Commit or rollback
+ if ($error)
+ {
+ foreach($this->errors as $errmsg)
+ {
+ dolibarr_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
+ $this->error.=($this->error?', '.$errmsg:$errmsg);
+ }
+ $this->db->rollback();
+ return -1*$error;
+ }
+ else
+ {
+ $this->db->commit();
+ return 1;
+ }
+ }
+
+
+
+ /**
+ * \brief Load an object from its id and create a new one in database
+ * \param fromid Id of object to clone
+ * \return int New id of clone
+ */
+ function createFromClone($fromid)
+ {
+ global $user,$langs;
+
+ $error=0;
+
+ $object=new Bank_categ($this->db);
+
+ $this->db->begin();
+
+ // Load source object
+ $object->fetch($fromid);
+ $object->id=0;
+ $object->statut=0;
+
+ // Clear fields
+ // ...
+
+ // Create clone
+ $result=$object->create($user);
+
+ // Other options
+ if ($result < 0)
+ {
+ $this->error=$object->error;
+ $error++;
+ }
+
+ if (! $error)
+ {
+
+
+
+ }
+
+ // End
+ if (! $error)
+ {
+ $this->db->commit();
+ return $object->id;
+ }
+ else
+ {
+ $this->db->rollback();
+ return -1;
+ }
+ }
+
+
+ /**
+ * \brief Initialise object with example values
+ * \remarks id must be 0 if object instance is a specimen.
+ */
+ function initAsSpecimen()
+ {
+ $this->id=0;
+
+ $this->label='';
+
+
+ }
+
+}
+?>
diff --git a/htdocs/compta/bank/budget.php b/htdocs/compta/bank/budget.php
index fca24518014..6e40d5362ef 100644
--- a/htdocs/compta/bank/budget.php
+++ b/htdocs/compta/bank/budget.php
@@ -38,134 +38,58 @@ if (!$user->rights->banque->lire)
*
*/
+$companystatic=new Societe($db);
+
llxHeader();
-if ($_GET["bid"] == 0)
+
+// List movements bu category for bank transactions
+print_fiche_titre($langs->trans("BankTransactionByCategories"));
+
+print '
';
+print "";
+print '| '.$langs->trans("Rubrique").' | ';
+print ''.$langs->trans("Nb").' | ';
+print ''.$langs->trans("Total").' | ';
+print ''.$langs->trans("Average").' | ';
+print "
\n";
+
+$sql = "SELECT sum(d.amount) as somme, count(*) as nombre, c.label, c.rowid ";
+$sql .= " FROM ".MAIN_DB_PREFIX."bank_categ as c, ".MAIN_DB_PREFIX."bank_class as l, ".MAIN_DB_PREFIX."bank as d";
+$sql .= " WHERE d.rowid=l.lineid AND c.rowid = l.fk_categ GROUP BY c.label, c.rowid ORDER BY c.label";
+
+$result = $db->query($sql);
+if ($result)
{
- /*
- * Liste mouvements par catégories d'écritures financières
- */
- print_fiche_titre($langs->trans("BankTransactionByCategories"));
+ $num = $db->num_rows($result);
+ $i = 0; $total = 0;
- print '';
- print "";
- print '| '.$langs->trans("Description").' | ';
- print ''.$langs->trans("Nb").' | ';
- print ''.$langs->trans("Total").' | ';
- print ''.$langs->trans("Average").' | ';
- print "
\n";
-
- $sql = "SELECT sum(d.amount) as somme, count(*) as nombre, c.label, c.rowid ";
- $sql .= " FROM ".MAIN_DB_PREFIX."bank_categ as c, ".MAIN_DB_PREFIX."bank_class as l, ".MAIN_DB_PREFIX."bank as d";
- $sql .= " WHERE d.rowid=l.lineid AND c.rowid = l.fk_categ GROUP BY c.label, c.rowid ORDER BY c.label";
-
- $result = $db->query($sql);
- if ($result)
+ $var=true;
+ while ($i < $num)
{
- $num = $db->num_rows($result);
- $i = 0; $total = 0;
-
- $var=true;
- while ($i < $num)
- {
- $objp = $db->fetch_object($result);
- $var=!$var;
- print "";
- print "| rowid\">$objp->label | ";
- print ''.$objp->nombre.' | ';
- print ''.price(abs($objp->somme))." | ";
- print ''.price(abs($objp->somme / $objp->nombre))." | ";
- print "
";
- $i++;
- $total = $total + abs($objp->somme);
- }
- $db->free($result);
-
- print '| '.$langs->trans("Total").' | ';
- print ''.price($total).' | |
';
+ $objp = $db->fetch_object($result);
+ $var=!$var;
+ print "";
+ print "| rowid\">$objp->label | ";
+ print ''.$objp->nombre.' | ';
+ print ''.price(abs($objp->somme))." | ";
+ print ''.price(abs(price2num($objp->somme / $objp->nombre,'MT')))." | ";
+ print "
";
+ $i++;
+ $total = $total + abs($objp->somme);
}
- else
- {
- dolibarr_print_error($db);
- }
- print "
";
+ $db->free($result);
+ print '| '.$langs->trans("Total").' | ';
+ print ''.price($total).' | |
';
}
else
{
- /*
- * Rapport mouvements pour une catégorie donnée
- */
- $sql = "SELECT label FROM ".MAIN_DB_PREFIX."bank_categ WHERE rowid=".$_GET["bid"];
- $resql=$db->query($sql);
- if ($resql)
- {
- if ($db->num_rows($resql))
- {
- $obj=$db->fetch_object($resql);
- $budget_name = $obj->label;
- }
- $db->free($resql);
- }
-
- print_fiche_titre($langs->trans("BankTransactionForCategory",$budget_name));
-
- print '';
- print "";
- print '| '.$langs->trans("Date").' | ';
- print ''.$langs->trans("Bank").' | ';
- print ''.$langs->trans("Description").' | '.$langs->trans("Amount").' | | ';
- print "
\n";
-
- $sql = "SELECT b.amount, b.label, ".$db->pdate("b.dateo")." as do, b.rowid, ba.label as labelcompte, ba.rowid as bankid";
- $sql.= " FROM ".MAIN_DB_PREFIX."bank_class as l, ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba";
- $sql.= " WHERE b.rowid=l.lineid AND l.fk_categ=".$_GET["bid"];
- $sql.= " AND b.fk_account = ba.rowid";
- $sql.= " ORDER BY b.dateo DESC";
-
- $result = $db->query($sql);
- if ($result)
- {
- $num = $db->num_rows($result);
- $i = 0; $total = 0;
-
- $var=True;
- while ($i < $num)
- {
- $objp = $db->fetch_object($result);
- $var=!$var;
- print "";
- print "| ".dolibarr_print_date($objp->do,'day')." | \n";
-
- print "bankid\">$objp->labelcompte | ";
-
- // Description
- print "rowid\">".img_object($langs->trans("ShowPayment"),"payment").' ';
- $reg=array();
- eregi('\((.+)\)',$objp->label,$reg); // Si texte entouré de parenthèe on tente recherche de traduction
- if ($reg[1] && $langs->trans($reg[1])!=$reg[1]) print $langs->trans($reg[1]);
- else print dolibarr_trunc($objp->label,60);
- print ' | ';
-
- // Montant
- print "".price(0 - $objp->amount)." | | ";
- print "
";
- $i++;
- $total = $total + (0 - $objp->amount);
- }
- $db->free();
- print '| '.$langs->trans("Total")." | ".price(abs($total))." | ".$langs->trans("Currency".$conf->monnaie)." |
";
- }
- else
- {
- dolibarr_print_error($db);
- }
- print "
";
-
+ dolibarr_print_error($db);
}
+print "
";
$db->close();
llxFooter('$Date$ - $Revision$');
-
?>
diff --git a/htdocs/compta/bank/pre.inc.php b/htdocs/compta/bank/pre.inc.php
index b854354231d..7c00bb8f1d6 100644
--- a/htdocs/compta/bank/pre.inc.php
+++ b/htdocs/compta/bank/pre.inc.php
@@ -67,8 +67,8 @@ function llxHeader($head = "")
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/fiche.php?action=create",$langs->trans("MenuNewFinancialAccount"),1,$user->rights->banque->configurer);
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/categ.php",$langs->trans("Rubriques"),1,$user->rights->banque->configurer);
- $menu->add_submenu(DOL_URL_ROOT."/compta/bank/search.php",$langs->trans("SearchTransaction"),1,$user->rights->banque->lire);
- $menu->add_submenu(DOL_URL_ROOT."/compta/bank/budget.php",$langs->trans("ByRubriques"),1,$user->rights->banque->lire);
+ $menu->add_submenu(DOL_URL_ROOT."/compta/bank/search.php",$langs->trans("ListTransactions"),1,$user->rights->banque->lire);
+ $menu->add_submenu(DOL_URL_ROOT."/compta/bank/budget.php",$langs->trans("ListTransactionsByCategory"),1,$user->rights->banque->lire);
if ($user->rights->banque->transfer)
{
diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php
index f4001a35992..ba3455fb601 100644
--- a/htdocs/compta/bank/search.php
+++ b/htdocs/compta/bank/search.php
@@ -18,29 +18,51 @@
*/
/**
- \file htdocs/compta/bank/search.php
- \ingroup banque
- \brief Page de recherche de transactions bancaires
- \version $Id$
-*/
+ * \file htdocs/compta/bank/search.php
+ * \ingroup banque
+ * \brief List of bank transactions
+ * \version $Id$
+ */
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/societe.class.php");
+require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php");
+require_once(DOL_DOCUMENT_ROOT."/compta/bank/bankcateg.class.php");
if (!$user->rights->banque->lire)
- accessforbidden();
+accessforbidden();
-$description=$_POST["description"];
-$debit=$_POST["debit"];
-$credit=$_POST["credit"];
-$type=$_POST["type"];
-$account=$_POST["account"];
+$description=$_REQUEST["description"];
+$debit=$_REQUEST["debit"];
+$credit=$_REQUEST["credit"];
+$type=$_REQUEST["type"];
+$account=$_REQUEST["account"];
+
+$param='';
+if (! empty($_REQUEST["description"])) $param.='&description='.$_REQUEST["description"];
+if (! empty($_REQUEST["type"])) $param.='&type='.$_REQUEST["type"];
+if (! empty($_REQUEST["debit"])) $param.='&debit='.$_REQUEST["debit"];
+if (! empty($_REQUEST["credit"])) $param.='&credit='.$_REQUEST["credit"];
+if (! empty($_REQUEST["account"])) $param.='&account='.$_REQUEST["account"];
+if (! empty($_REQUEST["bid"])) $param.='&bid='.$_REQUEST["bid"];
+
+$page =$_GET['page'];
+$sortorder=$_GET['sortorder'];
+$sortfield=$_GET['sortfield'];
+$limit = $conf->liste_limit;
+$offset = $limit * $page ;
+if (! $sortorder) $sortorder='DESC';
+if (! $sortfield) $sortfield='b.dateo';
/*
* View
*/
+$companystatic=new Societe($db);
+$bankaccountstatic=new Account($db);
+
llxHeader();
$html = new Form($db);
@@ -48,161 +70,159 @@ $html = new Form($db);
if ($vline) $viewline = $vline;
else $viewline = 50;
-
-print_fiche_titre($langs->trans("SearchBankMovement"));
-
-print '';
-print '';
-print '| '.$langs->trans("Date").' | ';
-print ''.$langs->trans("Description").' | ';
-print ''.$langs->trans("Debit").' | ';
-print ''.$langs->trans("Credit").' | ';
-print ''.$langs->trans("Type").' | ';
-print ''.$langs->trans("Account").' | ';
-print "
\n";
-
-print '
";
-
// Si accès issu d'une recherche et rien de trouvé
-if ($_POST["action"] == "search" && ! $num) {
- print "Aucune écriture bancaire répondant aux critères n'a été trouvée.";
+if ($_POST["action"] == "search" && ! $num)
+{
+ print $langs->trans("NoRecordFound");
}
diff --git a/htdocs/includes/menus/init_menu_auguria.sql b/htdocs/includes/menus/init_menu_auguria.sql
index 5831b76744b..6008008f6b5 100644
--- a/htdocs/includes/menus/init_menu_auguria.sql
+++ b/htdocs/includes/menus/init_menu_auguria.sql
@@ -231,8 +231,8 @@ insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`,
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 2600__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/compta/bank/index.php?leftmenu=bank', 'MenuBankCash', 0, 'banks', '$user->rights->banque->lire', '', 0, 10);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 2601__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/fiche.php?action=create', 'MenuNewFinancialAccount', 1, 'banks', '$user->rights->banque->configurer', '', 0, 0);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 2602__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/categ.php', 'Categories', 1, 'banks', '$user->rights->banque->configurer', '', 0, 1);
-insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 2603__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/search.php', 'SearchTransaction', 1, 'banks', '$user->rights->banque->lire', '', 0, 2);
-insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 2604__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/budget.php', 'ByRubriques', 1, 'banks', '$user->rights->banque->lire', '', 0, 3);
+insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 2603__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/search.php', 'ListTransactions', 1, 'banks', '$user->rights->banque->lire', '', 0, 2);
+insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 2604__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/budget.php', 'ListTransactionsByCategory', 1, 'banks', '$user->rights->banque->lire', '', 0, 3);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 2606__+MAX_llx_menu__, 'accountancy', '', 2600__+MAX_llx_menu__, '/compta/bank/virement.php', 'BankTransfers', 1, 'banks', '$user->rights->banque->modifier', '', 0, 5);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 2700__+MAX_llx_menu__, 'accountancy', '', 6__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca&mainmenu=accountancy', 'Reportings', 0, 'main', '$user->rights->compta->resultat->lire || $user->rights->comptaexpert->comptarapport->lire', '', 0, 11);
insert into `llx_menu` (`menu_handler`, `type`, `rowid`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ('auguria', 'left', 2701__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca', 'Résultat / Exercice', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->comptaexpert->comptarapport->lire', '', 0, 0);
diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang
index 486fe04e8fa..06fc2a6afce 100644
--- a/htdocs/langs/en_US/banks.lang
+++ b/htdocs/langs/en_US/banks.lang
@@ -73,12 +73,14 @@ ByCategories=By categories
ByRubriques=By categories
BankTransactionByCategories=Bank transactions by categories
BankTransactionForCategory=Bank transactions for category %s
-RemoveFromRubrique=Remove link with categorie
+RemoveFromRubrique=Remove link with category
RemoveFromRubriqueConfirm=Are you sure you want to remove link between the transaction and the category ?
ListBankTransactions=List of bank transactions
IdTransaction=Transaction ID
BankTransactions=Bank transactions
SearchTransaction=Search transaction
+ListTransactions=List transactions
+ListTransactionsByCategory=List transaction/category
TransactionsToConciliate=Transactions to conciliate
Conciliable=Conciliable
Conciliate=Conciliate
diff --git a/htdocs/langs/fr_FR/banks.lang b/htdocs/langs/fr_FR/banks.lang
index 339b40c2b56..eed4b39a54f 100644
--- a/htdocs/langs/fr_FR/banks.lang
+++ b/htdocs/langs/fr_FR/banks.lang
@@ -77,8 +77,10 @@ RemoveFromRubrique=Supprimer lien avec rubrique
RemoveFromRubriqueConfirm=Etes-vous sur de vouloir supprimer le lien entre la transaction et la rubrique ?
ListBankTransactions=Liste des transactions
IdTransaction=Id transaction
-BankTransactions=Transactions bancaires
+BankTransactions=Ecritures bancaires
SearchTransaction=Recherche écriture
+ListTransactions=Liste écritures
+ListTransactionsByCategory=Liste écritures/rubrique
TransactionsToConciliate=Ecritures à rapprocher
Conciliable=Rapprochable
Conciliate=Rapprocher
diff --git a/htdocs/translate.class.php b/htdocs/translate.class.php
index 62a9b517321..048c3897eaa 100644
--- a/htdocs/translate.class.php
+++ b/htdocs/translate.class.php
@@ -526,7 +526,7 @@ class Translate {
* \brief Return a label for a key. Store key-label in a cache.
* \param db Database handler
* \param key Key to get label
- * \param tablename Table name
+ * \param tablename Table name without prefix
* \param fieldkey Field for key
* \param fieldlabel Field for label
* \return string Label
@@ -543,9 +543,9 @@ class Translate {
}
// Check in cache
- if (! empty($this->cache_labels[$tablename][$key]))
+ if (isset($this->cache_labels[$tablename][$key])) // Can be defined to 0 or ''
{
- return $this->cache_labels[$tablename][$key]; // Found in cache
+ return $this->cache_labels[$tablename][$key]; // Found in cache
}
$sql = "SELECT ".$fieldlabel." as label";
@@ -556,7 +556,8 @@ class Translate {
if ($resql)
{
$obj = $db->fetch_object($resql);
- $this->cache_labels[$tablename][$key]=$obj->label;
+ if ($obj) $this->cache_labels[$tablename][$key]=$obj->label;
+ else $this->cache_labels[$tablename][$key]='';
$db->free($resql);
return $this->cache_labels[$tablename][$key];
}