[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 03/15: Fix : PHP compatibility with count Fix
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 03/15: Fix : PHP compatibility with count Fix : Dossier::set_current Code cleaning , |
Date: |
Mon, 25 Jan 2021 18:56:19 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 52cc9a97995065c68cfe28acf192446d204cec2e
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Thu Jan 21 06:37:46 2021 +0100
Fix : PHP compatibility with count
Fix : Dossier::set_current
Code cleaning ,
---
include/class/acc_ledger.class.php | 3 ++-
include/class/acc_ledger_search.class.php | 5 +++--
include/class/dossier.class.php | 2 +-
include/compta_fin_rec.inc.php | 12 +++++++++---
include/compta_fin_saldo.inc.php | 4 ++--
5 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/include/class/acc_ledger.class.php
b/include/class/acc_ledger.class.php
index e9683ee..ae10b90 100644
--- a/include/class/acc_ledger.class.php
+++ b/include/class/acc_ledger.class.php
@@ -1388,12 +1388,13 @@ class Acc_Ledger extends jrn_def_sql
/**
* @brief get the first ledger
* @param type
- * @return the j_id
+ * @return the j_id or null if no user available
*/
public function get_first($p_type, $p_access=3)
{
global $g_user;
$all=$g_user->get_ledger($p_type, $p_access);
+ if (empty ($all)) return NULL;
return $all[0];
}
diff --git a/include/class/acc_ledger_search.class.php
b/include/class/acc_ledger_search.class.php
index b435c8d..a85dfc5 100644
--- a/include/class/acc_ledger_search.class.php
+++ b/include/class/acc_ledger_search.class.php
@@ -1198,7 +1198,8 @@ class Acc_Ledger_Search
echo HtmlInput::title_box(_("Journaux"), $p_div."jrn_search");
echo '<div style="padding:5px">';
echo '<form method="GET" id="'.$p_div.'search_frm" onsubmit="return
hide_ledger_choice(\''.$p_div.'search_frm\')">';
- echo HtmlInput::hidden('nb_jrn', count($p_array));
+ $nb_array=(empty($p_array))?0:count($p_array);
+ echo HtmlInput::hidden('nb_jrn', $nb_array);
echo _('Filtre ').HtmlInput::filter_table($p_div.'tb_jrn', '0,1,2', 2);
echo HtmlInput::anchor_action(_('Inverser sel'),'
toggle_checkbox(\''."{$p_div}search_frm".'\')','sel_'.$p_div,"nav");
echo "-";
@@ -1222,7 +1223,7 @@ class Acc_Ledger_Search
echo '</td>';
echo '</tr>';
- for ($e=0;$e<count($p_array);$e++)
+ for ($e=0;$e<$nb_array;$e++)
{
$row=$p_array[$e];
// if ( $row['jrn_enable']==0) continue;
diff --git a/include/class/dossier.class.php b/include/class/dossier.class.php
index 25e0425..031f915 100644
--- a/include/class/dossier.class.php
+++ b/include/class/dossier.class.php
@@ -418,7 +418,7 @@ class Dossier
*/
static function set_current($p_dossier) {
- put_global(["gDossier"=>$p_dossier]);
+ put_global([ [ "key"=>"gDossier","value"=>$p_dossier]]);
self::check();
}
diff --git a/include/compta_fin_rec.inc.php b/include/compta_fin_rec.inc.php
index 8b53fa8..6fc2dd9 100644
--- a/include/compta_fin_rec.inc.php
+++ b/include/compta_fin_rec.inc.php
@@ -134,11 +134,17 @@ $Ledger = new Acc_Ledger_Fin($cn, 0);
if (!isset($_REQUEST['p_jrn']))
{
$a = $Ledger->get_first('fin');
- $Ledger->id = $a['jrn_def_id'];
+ if ( isset($a['jrn_def_id'])) {
+ $Ledger->id = $a['jrn_def_id'];
+ } else {
+ $Ledger->id=0;
+ }
}
else
- $Ledger->id = $_REQUEST['p_jrn'];
-$jrn_priv = $g_user->get_ledger_access($Ledger->id);
+{
+ $Ledger->id =$http->request("p_jrn","number",0);
+}
+$jrn_priv = ($Ledger->id == 0)?"X":$g_user->get_ledger_access($Ledger->id);
if (isset($_GET["p_jrn"]) && $jrn_priv == "X")
{
NoAccess();
diff --git a/include/compta_fin_saldo.inc.php b/include/compta_fin_saldo.inc.php
index 42b6e9b..cc0d957 100644
--- a/include/compta_fin_saldo.inc.php
+++ b/include/compta_fin_saldo.inc.php
@@ -62,9 +62,9 @@ $filter_year=" j_tech_per in (select p_id from parm_periode
where p_exercice='
$idx=0;
bcscale(2);
$tot_extrait=0; $tot_diff=0; $tot_operation=0;
-
+$nb_array=(empty($array))?0:count($array);
// for each account
-for ($i=0; $i<count($array); $i++)
+for ($i=0; $i<$nb_array; $i++)
{
if ($array[$i]->id==0)
{
- [Noalyss-commit] [noalyss] branch master updated (a7b8d81 -> ce0a8f8), Dany De Bontridder, 2021/01/25
- [Noalyss-commit] [noalyss] 01/15: Tache 0001885: postes utilisables dans Opération ODS, Dany De Bontridder, 2021/01/25
- [Noalyss-commit] [noalyss] 08/15: New #0001887: ANCGL ajout champs numéro action, Dany De Bontridder, 2021/01/25
- [Noalyss-commit] [noalyss] 05/15: NEW #0001886: ANC/ANCIMP/ANCGL >> Export PDF, Dany De Bontridder, 2021/01/25
- [Noalyss-commit] [noalyss] 04/15: DEBUG : show file name, Dany De Bontridder, 2021/01/25
- [Noalyss-commit] [noalyss] 10/15: Improve : Select_Box , placement, Dany De Bontridder, 2021/01/25
- [Noalyss-commit] [noalyss] 02/15: Security : constructor can take info from request, Dany De Bontridder, 2021/01/25
- [Noalyss-commit] [noalyss] 03/15: Fix : PHP compatibility with count Fix : Dossier::set_current Code cleaning ,,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 07/15: NEW #0001886: ANC/ANCIMP/ANCGL >> Export PDF Place properly the select_box, Dany De Bontridder, 2021/01/25
- [Noalyss-commit] [noalyss] 06/15: Bug : javascript message were unavailable, Dany De Bontridder, 2021/01/25
- [Noalyss-commit] [noalyss] 09/15: Cosmetic & code cleaning, Dany De Bontridder, 2021/01/25
- [Noalyss-commit] [noalyss] 11/15: Improve : ANCGL , type of export mandatory, Dany De Bontridder, 2021/01/25
- [Noalyss-commit] [noalyss] 12/15: Improve : add a function for detection SQL inject, Dany De Bontridder, 2021/01/25
- [Noalyss-commit] [noalyss] 14/15: Merge branch 'dev-8-cosmetic', Dany De Bontridder, 2021/01/25
- [Noalyss-commit] [noalyss] 15/15: Merge branch 'dev-8-select-box', Dany De Bontridder, 2021/01/25
- [Noalyss-commit] [noalyss] 13/15: Cosmetic fix : count_by_modele, Dany De Bontridder, 2021/01/25