forked from Wavyzz/dolibarr
Erg: Les fonctions compte bancaires sont regroupes en onglets
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2006 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
|
||||
@@ -32,12 +32,11 @@ require("./pre.inc.php");
|
||||
if (!$user->rights->banque->configurer)
|
||||
accessforbidden();
|
||||
|
||||
llxHeader();
|
||||
|
||||
|
||||
/*
|
||||
* Actions ajout cat<61>gorie
|
||||
*/
|
||||
* Actions ajout cat<61>gorie
|
||||
*/
|
||||
if ($_POST["action"] == 'add')
|
||||
{
|
||||
if ($_POST["label"])
|
||||
@@ -53,8 +52,8 @@ if ($_POST["action"] == 'add')
|
||||
}
|
||||
|
||||
/*
|
||||
* Action suppression cat<61>gorie
|
||||
*/
|
||||
* Action suppression cat<61>gorie
|
||||
*/
|
||||
if ( $_REQUEST['action'] == 'delete' )
|
||||
{
|
||||
if ( $_REQUEST['categid'] )
|
||||
@@ -69,11 +68,18 @@ if ( $_REQUEST['action'] == 'delete' )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Affichage liste des cat<61>gories
|
||||
*/
|
||||
|
||||
print_titre($langs->trans("Categories"));
|
||||
llxHeader();
|
||||
|
||||
|
||||
print_fiche_titre($langs->trans("Categories"));
|
||||
|
||||
|
||||
print '<form method="post" action="categ.php">';
|
||||
print "<input type=\"hidden\" name=\"action\" value=\"add\">";
|
||||
print '<table class="noborder" width="100%">';
|
||||
@@ -95,9 +101,9 @@ if ($result)
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/bank/budget.php?bid='.$objp->rowid.'">'.$objp->rowid.'</td>';
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/compta/bank/budget.php?bid='.$objp->rowid.'">'.$objp->rowid.'</a></td>';
|
||||
print "<td>$objp->label</td>";
|
||||
print '<td style="text-align: center;"><a href="categ.php?categid='.$objp->rowid.'&action=delete"'.img_delete().'</a></td>';
|
||||
print '<td style="text-align: center;"><a href="categ.php?categid='.$objp->rowid.'&action=delete">'.img_delete().'</a></td>';
|
||||
print "</tr>";
|
||||
$i++;
|
||||
}
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 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
|
||||
* 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.
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/compta/bank/config.php
|
||||
\ingroup banque
|
||||
\brief Page de configuration des comptes bancaires
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/bank.lib.php");
|
||||
|
||||
if (!$user->rights->banque->configurer)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
llxHeader();
|
||||
|
||||
print_titre($langs->trans("AccountSetup"));
|
||||
print '<br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Ref")."</td><td>".$langs->trans("Type")."</td><td>".$langs->trans("Bank").'</td>';
|
||||
print '<td align="left">'.$langs->trans("AccountIdShort").'</a></td>';
|
||||
print '<td align="center">'.$langs->trans("Conciliable").'</a></td>';
|
||||
print '<td align="right">'.$langs->trans("Status").'</a></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$sql = "SELECT rowid, label, number, bank, courant as type, clos, rappro";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
|
||||
$sql.= " ORDER BY label";
|
||||
|
||||
$result = $db->query($sql);
|
||||
$var=false;
|
||||
if ($result)
|
||||
{
|
||||
$accountstatic=new Account($db);
|
||||
|
||||
$var=True;
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0; $total = 0;
|
||||
|
||||
$sep = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
$accountstatic->id=$objp->rowid;
|
||||
$accountstatic->label=$objp->label;
|
||||
print '<td>'.$accountstatic->getNomUrl(1).'</td>';
|
||||
print '<td>'.$accountstatic->type_lib[$objp->type].'</td>';
|
||||
print '<td>'.$objp->bank.' </td><td>'.$objp->number.' </td>';
|
||||
print '<td align="center">'.yn($objp->rappro).'</td>';
|
||||
print '<td align="right">'.$accountstatic->LibStatut($objp->clos,5).'</td></tr>';
|
||||
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
|
||||
/*
|
||||
* Boutons d'actions
|
||||
*/
|
||||
print "<br><div class=\"tabsAction\">\n";
|
||||
if ($user->rights->banque->configurer)
|
||||
{
|
||||
print '<a class="tabAction" href="fiche.php?action=create">'.$langs->trans("NewFinancialAccount").'</a>';
|
||||
print '<a class="tabAction" href="categ.php">'.$langs->trans("Categories").'</a>';
|
||||
}
|
||||
print "</div>";
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
?>
|
||||
@@ -320,7 +320,9 @@ else
|
||||
print '<td colspan="3">'.$account->min_desired.'</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Web").'</td><td colspan="3">';
|
||||
print '<a href="'.$account->url.'" target="_gobank">'.$account->url.'</a>';
|
||||
if ($account->url) print '<a href="'.$account->url.'" target="_gobank">';
|
||||
print $account->url;
|
||||
if ($account->url) print '</a>';
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
|
||||
|
||||
@@ -87,4 +87,9 @@ if ($account > 0)
|
||||
print "\n</div>\n";
|
||||
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter('$Date$ - $Revision$');
|
||||
|
||||
?>
|
||||
|
||||
@@ -56,10 +56,12 @@ function llxHeader($head = "")
|
||||
while ($i < $numr)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$menu->add(DOL_URL_ROOT."/compta/bank/account.php?account=".$objp->rowid, $objp->label);
|
||||
$menu->add(DOL_URL_ROOT."/compta/bank/fiche.php?id=".$objp->rowid, $objp->label);
|
||||
/*
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/annuel.php?account=".$objp->rowid ,$langs->trans("IOMonthlyReporting"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/graph.php?account=".$objp->rowid ,$langs->trans("Graph"));
|
||||
if ($objp->courant != 2) $menu->add_submenu(DOL_URL_ROOT."/compta/bank/releve.php?account=".$objp->rowid ,$langs->trans("AccountStatements"));
|
||||
*/
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
@@ -67,6 +69,9 @@ function llxHeader($head = "")
|
||||
}
|
||||
$menu->add(DOL_URL_ROOT."/compta/bank/index.php",$langs->trans("MenuBankCash"));
|
||||
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/fiche.php?action=create",$langs->trans("MenuNewFinancialAccount"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/categ.php",$langs->trans("Categories"));
|
||||
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/search.php",$langs->trans("SearchTransaction"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/budget.php",$langs->trans("ByCategories"));
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/bilan.php","Bilan");
|
||||
@@ -76,11 +81,6 @@ function llxHeader($head = "")
|
||||
$menu->add_submenu(DOL_URL_ROOT."/compta/bank/virement.php",$langs->trans("Virements"));
|
||||
}
|
||||
|
||||
if ($user->rights->banque->configurer)
|
||||
{
|
||||
$menu->add(DOL_URL_ROOT."/compta/bank/config.php",$langs->trans("MenuSetupBank"));
|
||||
}
|
||||
|
||||
if ($conf->global->COMPTA_ONLINE_PAYMENT_BPLC)
|
||||
{
|
||||
$menu->add(DOL_URL_ROOT."/compta/bank/bplc.php","Transactions BPLC");
|
||||
|
||||
@@ -448,8 +448,6 @@ class MenuLeft {
|
||||
if ($leftmenu=="ca") $newmenu->add_submenu(DOL_URL_ROOT."/compta/stats/cabyuser.php?leftmenu=ca",$langs->trans("ByUsers"),2,$user->rights->compta->resultat->lire||$user->rights->comptaexpert->comptarapport->lire);
|
||||
}
|
||||
|
||||
$newmenu->add(DOL_URL_ROOT."/compta/bank/config.php",$langs->trans("MenuSetupBank"),0,$user->rights->banque->configurer);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ StandingOrderProcessed=Processed
|
||||
NewAccount=New account
|
||||
NewBankAccount=New bank account
|
||||
NewFinancialAccount=New financial account
|
||||
MenuNewFinancialAccount=New financial account
|
||||
NewCurrentAccount=New current account
|
||||
NewSavingAccount=New saving account
|
||||
NewCashAccount=New cash account
|
||||
|
||||
@@ -44,6 +44,7 @@ StandingOrderProcessed=Trait
|
||||
NewAccount=Nouveau compte
|
||||
NewBankAccount=Nouveau compte bancaire
|
||||
NewFinancialAccount=Nouveau compte financier
|
||||
MenuNewFinancialAccount=Nouveau compte
|
||||
NewCurrentAccount=Nouveau compte courant
|
||||
NewSavingAccount=Nouveau compte <20>pargne
|
||||
NewCashAccount=Nouveau compte caisse
|
||||
|
||||
126
htdocs/lib/bank.lib.php
Normal file
126
htdocs/lib/bank.lib.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006 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
|
||||
* 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.
|
||||
* or see http://www.gnu.org/
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/lib/bank.lib.php
|
||||
\brief Ensemble de fonctions de base pour le module banque
|
||||
\ingroup banque
|
||||
\version $Revision$
|
||||
|
||||
Ensemble de fonctions de base de dolibarr sous forme d'include
|
||||
*/
|
||||
|
||||
function bank_prepare_head($obj)
|
||||
{
|
||||
global $langs, $conf, $user;
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/bank/fiche.php?id='.$obj->id;
|
||||
$head[$h][1] = $langs->trans("AccountCard");
|
||||
$head[$h][2] = 'bankname';
|
||||
$h++;
|
||||
|
||||
if ($obj->type == 0 || $obj->type == 1)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT.'/compta/bank/bankid_fr.php?id='.$obj->id;
|
||||
$head[$h][1] = $langs->trans("RIB");
|
||||
$head[$h][2] = 'bankid';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/compta/bank/account.php?account=".$obj->id;
|
||||
$head[$h][1] = $langs->trans("Transactions");
|
||||
$head[$h][2] = 'journal';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/compta/bank/annuel.php?account=".$obj->id;
|
||||
$head[$h][1] = $langs->trans("IOMonthlyReporting");
|
||||
$head[$h][2] = 'annual';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/compta/bank/graph.php?account=".$obj->id;
|
||||
$head[$h][1] = $langs->trans("Graph");
|
||||
$head[$h][2] = 'graph';
|
||||
$h++;
|
||||
|
||||
if ($obj->courant != 2)
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/compta/bank/releve.php?account=".$obj->id;
|
||||
$head[$h][1] = $langs->trans("AccountStatement");
|
||||
$head[$h][2] = 'statement';
|
||||
$h++;
|
||||
}
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
\brief Verifie le RIB d'un compte bancaire grace <20> sa cl<63>
|
||||
\param code_banque code banque
|
||||
\param code_guichet code guichet
|
||||
\param num_compte numero de compte
|
||||
\param cle cle
|
||||
\param iban Ne sert pas pour le calcul de cle mais sert pour determiner le pays
|
||||
\return int true si les infos sont bonnes, false si la cl<63> ne correspond pas
|
||||
*/
|
||||
function verif_rib($code_banque , $code_guichet , $num_compte , $cle, $iban)
|
||||
{
|
||||
if (eregi("^FR",$iban))
|
||||
{ // Cas de la France
|
||||
|
||||
$coef = array(62, 34, 3) ;
|
||||
|
||||
// Concatenation des differents codes.
|
||||
$rib = strtolower(trim($code_banque).trim($code_guichet).trim($num_compte).trim($cle));
|
||||
|
||||
// On remplace les eventuelles lettres par des chiffres.
|
||||
|
||||
//Ne marche pas
|
||||
//$rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz","12345678912345678912345678");
|
||||
|
||||
$rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz","12345678912345678923456789");
|
||||
|
||||
// Separation du rib en 3 groupes de 7 + 1 groupe de 2.
|
||||
// Multiplication de chaque groupe par les coef du tableau
|
||||
for ($i=0, $s=0; $i<3; $i++)
|
||||
{
|
||||
$code = substr($rib, 7 * $i, 7) ;
|
||||
$s += (0 + $code) * $coef[$i] ;
|
||||
}
|
||||
|
||||
// Soustraction du modulo 97 de $s <20> 97 pour obtenir la cl<63> RIB
|
||||
$cle_rib = 97 - ($s % 97) ;
|
||||
|
||||
if ($cle_rib == $cle)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user