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 '
';
}
print '';
- print '