From 3fc1d7ee1730704419664961f1b8107ae8c9efb8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 27 Feb 2004 19:20:05 +0000 Subject: [PATCH] =?UTF-8?q?Correction=20=E9chec=20de=20l'insertion=20d'une?= =?UTF-8?q?=20=E9criture=20bancaire=20hors=20transaction.=20Longueur=20du?= =?UTF-8?q?=20champ=20de=20recherche=20identique=20au=20champ=20de=20saisi?= =?UTF-8?q?=20=E9quivalent.=20La=20suppression=20d'une=20=E9criture=20banc?= =?UTF-8?q?aire=20ne=20ramenait=20pas=20sur=20la=20m=EAme=20page.=20Une=20?= =?UTF-8?q?recherche=20sur=20le=20montant=20n'affichait=20pas=20le=20monta?= =?UTF-8?q?nt=20dans=20le=20r=E9sultat.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/compta/bank/account.php | 79 +++++++++++++--------------------- 1 file changed, 31 insertions(+), 48 deletions(-) diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 1d2e8430399..a1a55d108a1 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -27,71 +27,49 @@ require("./pre.inc.php"); if (!$user->rights->banque->lire) accessforbidden(); - -$account=isset($_GET["account"])?isset($_GET["account"]):$HTTP_POST_VARS["account"]; -$vline=isset($_GET["vline"])?isset($_GET["vline"]):$HTTP_POST_VARS["vline"]; -$action=isset($_GET["action"])?isset($_GET["action"]):$HTTP_POST_VARS["action"]; - +$account=isset($_GET["account"])?$_GET["account"]:$_POST["account"]; +$vline=isset($_GET["vline"])?$_GET["vline"]:$_POST["vline"]; +$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; +$page=isset($_GET["page"])?$_GET["page"]:0; if ($action == 'add' && $account) { - if ($credit > 0) + + if ($_POST["credit"] > 0) { - $amount = $credit ; + $amount = $_POST["credit"]; } else { - $amount = - $debit ; + $amount = - $_POST["credit"]; } - $dateop = "$dateoy" . "$dateo"; + $dateop = $_POST["dateoy"].$_POST["dateo"]; + $operation=$_POST["operation"]; + $label=$_POST["label"]; + $operation=$_POST["operation"]; + $num_chq=$_POST["num_chq"]; + $cat1=$_POST["cat1"]; + $acct=new Account($db,$account); - $insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq,$cat1); + $insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, $cat1); + + //print "

Account: insertid=$insertid - " . $action . " : ".$_GET["account"] . " - " . $_POST["account"]." - ".$account."

\n"; if ($insertid == '') { - print "

Probleme d'insertion : ".$db->error(); + print "Erreur: Probleme d'insertion : ".$db->error(); } else { - Header("Location: $PHP_SELF?account=" . $acct->id); + Header("Location: $PHP_SELF?account=" . $account); } - /* - if ($num_chq) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, dateo, label, amount, author, num_chq,fk_account, fk_type)"; - $sql .= " VALUES (now(), '$dateop', '$label', '$amount','$author','$num_chq','$account','$operation')"; - } - else - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, dateo, label, amount, author,fk_account,fk_type)"; - $sql .= " VALUES (now(), '$dateop', '$label', '$amount','$author','$account','$operation')"; - } - - $result = $db->query($sql); - if ($result) - { - $rowid = $db->last_insert_id(); - if ($cat1) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES ($rowid, $cat1)"; - $result = $db->query($sql); - } - Header("Location: $PHP_SELF?account=$account"); - } - else - { - print $db->error(); - print "

$sql"; - } - */ } if ($action == 'del' && $account && $user->rights->banque->modifier) { $acct=new Account($db,$account); $acct->deleteline($rowid); - //bank_delete_line($db, $rowid); } /*********************************************************************************** @@ -102,7 +80,7 @@ if ($action == 'del' && $account && $user->rights->banque->modifier) llxHeader(); -//print "

Account: " . $account . "o" . $account . "

\n"; +//print "

Page: $page - Account: " . $_GET["account"] . " - " . $HTTP_POST_VARS["account"]."

\n"; if ($account > 0) { @@ -144,6 +122,10 @@ if ($account > 0) $sql_rech = " AND lower(b.label) like '%".strtolower($HTTP_POST_VARS["req_desc"])."%'"; $mode_search = 1; } + else + { + $mode_search = 0; + } /* * * @@ -183,7 +165,7 @@ if ($account > 0) $page = 0; $limitsql = $nbline; } - //print "$viewline $nbline $limitsql"; + //print "$page $viewline $nbline $limitsql"; /* * Formulaire de recherche @@ -204,9 +186,9 @@ if ($account > 0) print 'Page suivante'; } print ''; - print ' '; - print ''; - print ''; + print ' '; + print ''; + print ''; print ''; print ''; if ($user->rights->banque->modifier) @@ -235,6 +217,7 @@ if ($account > 0) print 'DateTypeDescription'; print 'DébitCréditSolde'; print 'Relevé'; + // DEBUG // print "$nbline$viewlinetotal_lines $total_lineslimitsql $limitsql"; @@ -331,7 +314,7 @@ llxFooter("Dernière modification $Date$ révision $Revision$num_rows(); $i = 0; $total = 0;