Fix: protège contre numéro de relevé égale à chaine vide ou espace
This commit is contained in:
parent
2c829deb5c
commit
2767f816be
@ -214,8 +214,8 @@ class Account
|
|||||||
|
|
||||||
$datev = $date;
|
$datev = $date;
|
||||||
|
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, dateo, datev, label, amount, fk_user_author, num_chq,fk_account, fk_type)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank (datec, dateo, datev, label, amount, fk_user_author, num_chq, fk_account, fk_type)";
|
||||||
$sql.= " VALUES (now(), '".$date."', '$datev', '$label', '" . ereg_replace(',','.',$amount) . "', '".$user->id."' ,'$num_chq', '".$this->rowid."', '$oper')";
|
$sql.= " VALUES (now(), '".$date."', '$datev', '$label', '" . price2num($amount) . "', '".$user->id."' ,'$num_chq', '".$this->rowid."', '$oper')";
|
||||||
|
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -128,9 +128,12 @@ if ($_POST["action"] == 'type')
|
|||||||
|
|
||||||
if ($_POST["action"] == 'num_releve')
|
if ($_POST["action"] == 'num_releve')
|
||||||
{
|
{
|
||||||
|
$num_rel=trim($_POST["num_rel"]);
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
|
||||||
$sql.= " SET num_releve='".$_POST["num_rel"]."'";
|
$sql.= " SET num_releve=".($num_rel?"'".$num_rel."'":"null");
|
||||||
$sql.= " WHERE rowid = ".$rowid;
|
$sql.= " WHERE rowid = ".$rowid;
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
|
|||||||
@ -36,21 +36,22 @@ $user->getrights('compta');
|
|||||||
if (! $user->rights->banque->modifier) accessforbidden();
|
if (! $user->rights->banque->modifier) accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
llxHeader();
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action rapprochement
|
* Action rapprochement
|
||||||
*/
|
*/
|
||||||
if ($_POST["action"] == 'rappro')
|
if ($_POST["action"] == 'rappro')
|
||||||
{
|
{
|
||||||
if ($_POST["num_releve"] > 0)
|
// Definition, nettoyage parametres
|
||||||
|
$valrappro=1;
|
||||||
|
$num_releve=trim($_POST["num_releve"]);
|
||||||
|
|
||||||
|
if ($num_releve)
|
||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$valrappro=1;
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
|
||||||
$sql.= " set rappro=".$valrappro.", num_releve=".$_POST["num_releve"].",";
|
$sql.= " set rappro=".$valrappro.", num_releve='".$_POST["num_releve"]."',";
|
||||||
$sql.= " fk_user_rappro=".$user->id;
|
$sql.= " fk_user_rappro=".$user->id;
|
||||||
$sql.= " WHERE rowid=".$_POST["rowid"];
|
$sql.= " WHERE rowid=".$_POST["rowid"];
|
||||||
|
|
||||||
@ -59,7 +60,8 @@ if ($_POST["action"] == 'rappro')
|
|||||||
{
|
{
|
||||||
if ($cat1 && $_POST["action"])
|
if ($cat1 && $_POST["action"])
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ) VALUES ($rowid, $cat1)";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_class (lineid, fk_categ)";
|
||||||
|
$sql.= " VALUES ($rowid, $cat1)";
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@ -89,9 +91,10 @@ if ($_POST["action"] == 'rappro')
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action suppression ecriture
|
* Action suppression ecriture
|
||||||
*/
|
*/
|
||||||
if ($_GET["action"] == 'del') {
|
if ($_GET["action"] == 'del')
|
||||||
|
{
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE rowid=".$_GET["rowid"];
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank WHERE rowid=".$_GET["rowid"];
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if (! $resql) {
|
if (! $resql) {
|
||||||
@ -99,6 +102,8 @@ if ($_GET["action"] == 'del') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Charge categories
|
||||||
$sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."bank_categ ORDER BY label";
|
$sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."bank_categ ORDER BY label";
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
$options="";
|
$options="";
|
||||||
@ -115,9 +120,12 @@ if ($resql) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
llxHeader();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage liste des transactions à rapprocher
|
* Affichage liste des transactions à rapprocher
|
||||||
*/
|
*/
|
||||||
$acct = new Account($db);
|
$acct = new Account($db);
|
||||||
$acct->fetch($_GET["account"]);
|
$acct->fetch($_GET["account"]);
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2003 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -181,8 +181,21 @@ else
|
|||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
// Recherche date valeur minimum pour ce relevé
|
||||||
$sql = "SELECT sum(amount) FROM ".MAIN_DB_PREFIX."bank WHERE num_releve < $num AND fk_account = ".$acct->id;
|
/*
|
||||||
|
$datemin=0;
|
||||||
|
$sql = "SELECT MIN(datev) FROM ".MAIN_DB_PREFIX."bank";
|
||||||
|
$sql.= " WHERE num_releve = '".$num."' AND fk_account = ".$acct->id;
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$datemin = $db->result(0, 0);
|
||||||
|
$db->free($resql);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
// Calcul du solde de départ du relevé
|
||||||
|
$sql = "SELECT sum(amount) FROM ".MAIN_DB_PREFIX."bank";
|
||||||
|
$sql.= " WHERE num_releve < ".$num." AND fk_account = ".$acct->id;
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -190,6 +203,7 @@ else
|
|||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Recherche les écritures pour le relevé
|
||||||
$sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do,".$db->pdate("b.datev")." as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type";
|
$sql = "SELECT b.rowid,".$db->pdate("b.dateo")." as do,".$db->pdate("b.datev")." as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq, b.fk_type";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
$sql .= " FROM ".MAIN_DB_PREFIX."bank as b";
|
||||||
$sql .= " WHERE num_releve='".$num."'";
|
$sql .= " WHERE num_releve='".$num."'";
|
||||||
@ -271,7 +285,8 @@ else
|
|||||||
// Catégories
|
// Catégories
|
||||||
if ($ve)
|
if ($ve)
|
||||||
{
|
{
|
||||||
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."bank_categ as ct, ".MAIN_DB_PREFIX."bank_class as cl WHERE ct.rowid=cl.fk_categ AND cl.lineid=$objp->rowid";
|
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."bank_categ as ct, ".MAIN_DB_PREFIX."bank_class as cl";
|
||||||
|
$sql.= " WHERE ct.rowid=cl.fk_categ AND cl.lineid=".$objp->rowid;
|
||||||
$resc = $db->query($sql);
|
$resc = $db->query($sql);
|
||||||
if ($resc)
|
if ($resc)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user