From c293f353eaa587a3ddd7fd1b1c3ab14584f08f77 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 28 Feb 2004 18:29:57 +0000 Subject: [PATCH] =?UTF-8?q?Conditionnement=20de=20l'acc=E8s=20=E0=20la=20p?= =?UTF-8?q?age=20sur=20les=20nouveaux=20droits=20de=20banque->lire=20Le=20?= =?UTF-8?q?type=20d'=E9criture=20ne=20s'affichait=20pas=20dans=20le=20r=E9?= =?UTF-8?q?sultat.=20Le=20compte=20bancaire=20affich=E9=20=E9tait=20un=20n?= =?UTF-8?q?um=E9ro=20au=20lieu=20de=20son=20nom=20dans=20le=20r=E9sultat.?= =?UTF-8?q?=20Possibilit=E9=20de=20chercher=20sur=20le=20d=E9bit=20comme?= =?UTF-8?q?=20le=20cr=E9dit.=20Les=20champs=20du=20formulaire=20de=20reche?= =?UTF-8?q?rche=20sont=20correctement=20positionn=E9s=20par=20rapport=20au?= =?UTF-8?q?x=20champs=20de=20r=E9ponses.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/compta/bank/search.php | 79 ++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 29 deletions(-) diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php index c223baaec85..ac2940ea71e 100644 --- a/htdocs/compta/bank/search.php +++ b/htdocs/compta/bank/search.php @@ -1,6 +1,7 @@ + * Copyright (C) 2004 Laurent Destailleur * * 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 @@ -24,11 +25,12 @@ require("./pre.inc.php"); require("./bank.lib.php"); -$user->getrights('compta'); +$user->getrights('banque'); -if (!$user->admin && !$user->rights->compta->bank) +if (!$user->rights->banque->lire) accessforbidden(); + llxHeader(); if ($vline) { @@ -38,49 +40,55 @@ if ($vline) { } print_titre("Recherche écriture bancaire"); +print '
'; -print ""; print ''; -print ""; +print ""; print ""; print ""; print ""; -print ""; -print ""; -print "\n"; +print ""; +print ""; +print "\n"; ?> -"; ?> - + + - - + -query($sql) ) { $nbline = $db->result (0, 0); $db->free(); } +// Defini la liste des catégories dans $options $sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."bank_categ;"; $result = $db->query($sql); if ($result) { @@ -95,17 +103,24 @@ if ($result) { $db->free(); } -$sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_account, b.fk_type"; -$sql .= " FROM ".MAIN_DB_PREFIX."bank as b "; -$sql .= " WHERE fk_type like '" . $type . "'"; +$sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_account, b.fk_type, ba.label as labelaccount"; +$sql .= " FROM ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba"; +$sql .= " WHERE b.fk_account=ba.rowid"; + +$sql .= " AND fk_type like '" . $type . "'"; $si=0; -if ($credit) { +$debit = ereg_replace(',','.',$debit); +$credit = ereg_replace(',','.',$credit); +if (is_numeric($debit)) { $si++; - $sqlw[$si] .= " b.amount " . $credit; + $sqlw[$si] .= " b.amount = " . -$debit; +} +if (is_numeric($credit)) { + $si++; + $sqlw[$si] .= " b.amount = " . $credit; } - if ($description) { $si++; $sqlw[$si] .= " b.label like '%" . $description . "%'"; @@ -144,21 +159,27 @@ if ($result) print "\n"; } - print "\n"; + print "\n"; - print "\n"; + print "\n"; print ""; $i++; } + $db->free(); } else { - print $db->error() .'
' . $sql .'error() .'
' . $sql .'
'; } print "
DateDescriptionDebitCreditTypeCompte
TypeCompte
  - +> - + +> + +> + +
 ".price($objp->amount)."".$obj->fktype."".$objp->fk_type."".$objp->fk_account."".$objp->labelaccount."
"; +if (! $num) { +print "Aucune réponse trouvée."; +} + + $db->close(); llxFooter("Dernière modification $Date$ révision $Revision$");