[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 21/73: Fix : warning when Acc_Param not set p
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 21/73: Fix : warning when Acc_Param not set properly for BANK, CASH, |
Date: |
Fri, 28 May 2021 05:26:25 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 9d680016c8cbcb9368925b1ae5b2a49bf2e5ce72
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Fri Apr 16 14:52:55 2021 +0200
Fix : warning when Acc_Param not set properly for BANK, CASH,
---
include/class/fiche.class.php | 19 ++++++++++++++-----
unit-test/include/class/fiche.Test.php | 15 +++++++++++++++
2 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php
index 9c3db32..17d3254 100644
--- a/include/class/fiche.class.php
+++ b/include/class/fiche.class.php
@@ -62,6 +62,7 @@ class Fiche
$this->quick_code='';
$this->attribut=array();
$this->f_enable='1';
+
}
public function get_id()
{
@@ -1933,8 +1934,8 @@ class Fiche
}
// Get The result Array
$step_tiers=$this->get_by_category($offset,$search.$filter_amount,'name');
-
- if ( $all_tiers == 0 || count($step_tiers)==0 ) return "";
+
+ if ( $all_tiers == 0 || empty($step_tiers ) ) { return ""; }
$r="";
$r.=$bar;
@@ -1966,12 +1967,19 @@ class Fiche
$odd="";
$odd = ($i % 2 == 0 ) ? ' odd ': ' even ';
$accounting=$tiers->strAttribut(ATTR_DEF_ACCOUNT);
- if ( ! empty($accounting) && $p_action == 'bank' &&
$amount['debit'] < $amount['credit'] ){
- if ( strpos($accounting,$bank->p_value)===0 ||
strpos($accounting,$cash->p_value)===0 || strpos($accounting,$cc->p_value)===0){
+ if ( ! empty($accounting) && $p_action == 'bank'
+ && $amount['debit'] < $amount['credit']
+ &&
+ ( /** the accounting is a financial account *****/
+ (!empty ($bank->value) &&
strpos($accounting,$bank->p_value)===0 )
+ || (!empty ($cash->value) &&
strpos($accounting,$cash->p_value)===0 )
+ || ( !empty ($cc->value) &&
strpos($accounting,$cc->p_value)===0)
+ )
+ )
+ {
//put in red if c>d
$odd.=" notice ";
}
- }
$odd=' class="'.$odd.'"';
@@ -2019,6 +2027,7 @@ class Fiche
$r.="</tfoot>";
$r.="</TABLE>";
$r.=$bar;
+
return $r;
}
/*!
diff --git a/unit-test/include/class/fiche.Test.php
b/unit-test/include/class/fiche.Test.php
index 20758ca..56d3843 100644
--- a/unit-test/include/class/fiche.Test.php
+++ b/unit-test/include/class/fiche.Test.php
@@ -110,4 +110,19 @@ class FicheTest extends TestCase
$this->assertTrue(true,"Inject SQL command found");
}
}
+ /**
+ * @covers Fiche->Summary
+ * @covers Fiche->get_by_category
+ * @covers Fiche::GetByDef
+ */
+ public function testSummary()
+ {
+ $_REQUEST['ac']="CARD";
+ $this->object->fiche_def_ref=-1;
+ $r=$this->object->summary();
+ $this->assertEquals('',$r);
+ $this->object->fiche_def_ref=9;
+ $r=$this->object->summary();
+ $this->assertContains('</TABLE>',$r);
+ }
}
- [Noalyss-commit] [noalyss] branch master updated (709bc17 -> 2fca23e), Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 03/73: typo, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 02/73: Improve ##0001905 company parameter, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 04/73: comptability version 7.0, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 13/73: SQL file for action, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 07/73: cosmetic col. alignment, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 11/73: Sendmail : improve , add abilities to add headers, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 23/73: remove debug info, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 21/73: Fix : warning when Acc_Param not set properly for BANK, CASH,,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 19/73: Merge branch 'dev-8104', Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 35/73: improve cosmetic, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 01/73: Nouveau logo, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 09/73: CSS : position dashboard and ledger name, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 12/73: Cosmetic, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 22/73: Fix bug : not TVA asked, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 20/73: Cosmetic : place of login, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 31/73: Task #0001961: Devise, cosmetic align number, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 33/73: CURRENCY : conversion problem, Dany De Bontridder, 2021/05/28
- [Noalyss-commit] [noalyss] 32/73: Fix bug Forecast, Dany De Bontridder, 2021/05/28