[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 06/24: Bug when ledger badly parametrized
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 06/24: Bug when ledger badly parametrized |
Date: |
Tue, 12 Jul 2022 07:05:25 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit bbf995e827c73b4c750b3e5bb9c027cc0e2c6ef3
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Tue May 3 22:53:51 2022 +0200
Bug when ledger badly parametrized
---
html/fid.php | 1 +
html/fid_card.php | 6 ++++--
include/ajax/ajax_card.php | 19 ++++++++++++++-----
include/class/fiche.class.php | 4 ++--
4 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/html/fid.php b/html/fid.php
index 6dc6ae940..1b84cbc98 100644
--- a/html/fid.php
+++ b/html/fid.php
@@ -111,6 +111,7 @@ if ( isset($_SESSION[SESSION_KEY.'isValid']) &&
$_SESSION[SESSION_KEY.'isValid']
break;
default:
+ $d= ( empty($d) )?-1:$d;
$filter_card="and fd_id in ($d)";
}
}
diff --git a/html/fid_card.php b/html/fid_card.php
index 57f783535..dd92aa4a4 100644
--- a/html/fid_card.php
+++ b/html/fid_card.php
@@ -73,9 +73,11 @@ if ( $typecard == 'all')
else if (strpos($typecard,'sql]')==true)
{
$filter_card= str_replace('[sql]', " and ", $typecard);
-} else
+} else
+{
+ $typecard=(empty($typecard))?-1:sql_string($typecard);
$filter_card="and fd_id in ($typecard)";
-
+}
if ( $jrn != -1 )
{
switch ($typecard)
diff --git a/include/ajax/ajax_card.php b/include/ajax/ajax_card.php
index 863e59d7a..ea9b266aa 100644
--- a/include/ajax/ajax_card.php
+++ b/include/ajax/ajax_card.php
@@ -234,26 +234,35 @@ case 'st':
{
case -1:
$l=new Acc_Ledger($cn,$ledger);
+ $array=$l->get_all_fiche_def();
+ $array=(empty($array))?"-1":$array;
$where=' where fd_id in ('.$l->get_all_fiche_def().')';
break;
case 'cred':
$l=new Acc_Ledger($cn,$ledger);
$prop=$l->get_propertie();
- if ( $prop['jrn_def_fiche_cred']=='')$prop=-1;
- $where=' where fd_id in ('.$prop['jrn_def_fiche_cred'].')';
+ if ( empty($prop) || empty($prop['jrn_def_fiche_cred'])=='')
+ {
+ $where ="";
+ }else {
+ $where=' where fd_id in ('.$prop['jrn_def_fiche_cred'].')';
+ }
break;
case 'deb':
$l=new Acc_Ledger($cn,$ledger);
$prop=$l->get_propertie();
- if ( $prop=='')$prop=-1;
- $where=' where fd_id in ('.$prop['jrn_def_fiche_deb'].')';
+ if ( empty($prop) || empty($prop['jrn_def_fiche_deb']) ) {
+ $where = "" ;
+ } else {
+ $where=' where fd_id in ('.$prop['jrn_def_fiche_deb'].')';
+ }
break;
}
}
else
{
/* we filter thanks a given model of card */
- if ( isset($cat))
+ if ( isset($cat) && ! empty($cat))
{
$where=sprintf(' where frd_id in ('.sql_string ($cat).')');
}
diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php
index d3d43fe5f..e17467a65 100644
--- a/include/class/fiche.class.php
+++ b/include/class/fiche.class.php
@@ -1605,7 +1605,7 @@ class Fiche
throw Exception('Erreur pas de valeur pour jrn');
$filter_jrn=$this->cn->make_list("select
jrn_def_fiche_cred from jrn_Def where jrn_def_id=$1",
array($jrn));
- $filter_fd_id=" fd_id in (".$filter_jrn.")";
+ $filter_fd_id=(empty($filter_jrn))?" fd_id in (-1)
":" fd_id in (".$filter_jrn.")";
$and=" and ";
break;
case 'deb':
@@ -1613,7 +1613,7 @@ class Fiche
throw Exception('Erreur pas de valeur pour jrn');
$filter_jrn=$this->cn->make_list("select
jrn_def_fiche_deb from jrn_Def where jrn_def_id=$1",
array($jrn));
- $filter_fd_id=" fd_id in (".$filter_jrn.")";
+ $filter_fd_id=(empty($filter_jrn))?"fd_id in (-1) ":"
fd_id in (".$filter_jrn.")";
$and=" and ";
break;
case 'filter':
- [Noalyss-commit] [noalyss] branch master updated (f8d23563a -> cbc0d3fb7), Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 01/24: Cosmetic : error message when user cannot add card, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 02/24: remove direct access to $_POST and extract, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 03/24: ISelect->display fails if this->value if null, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 06/24: Bug when ledger badly parametrized,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 08/24: Merge branch 'devel', Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 05/24: Security : management , profile access, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 09/24: Supplemental TAX : manage parameter A ledger can have only 1 supplemental tax, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 13/24: code documentation, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 10/24: New : 2178 Additional Tax : input in purchase and sale ledger - tax with positive amount - tax with negative amount - tax in currency, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 11/24: Nouveau #0002178: Cotisation de solidarité Impression : Listing (HTML, CSV et PDF) Impression : Extended (HTML, CSV et PDF) Negatif amount and currency, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 14/24: Additional Tax : database changes, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 16/24: Additional Tax : export operation PDF, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 17/24: Additional Tax : automatic compute, Dany De Bontridder, 2022/07/12
- [Noalyss-commit] [noalyss] 23/24: Bug : supplemental tax cannot be deleted, Dany De Bontridder, 2022/07/12