[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 10/34: Bug : default accounting override exis
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 10/34: Bug : default accounting override existing one |
Date: |
Sun, 5 Feb 2023 04:41:40 -0500 (EST) |
sparkyx pushed a commit to branch devel
in repository noalyss.
commit 1a20f95ca0ce60049111e53fbf64128d9ab3f63c
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Wed Jan 11 16:35:14 2023 +0100
Bug : default accounting override existing one
---
include/class/card_property.class.php | 4 +--
unit-test/include/class/card_propertyTest.php | 47 +++++++++++++++++++++++++++
2 files changed, 49 insertions(+), 2 deletions(-)
diff --git a/include/class/card_property.class.php
b/include/class/card_property.class.php
index 45b362f74..6ee51211c 100644
--- a/include/class/card_property.class.php
+++ b/include/class/card_property.class.php
@@ -49,11 +49,11 @@ class Card_Property
var $cn;
//!< cn database connexion
protected $display_mode;
- //!< display mode determine if there link
+ //!< display mode values are large , window , display Property depending
of this mode.
function __construct($cn, $ad_id=0)
{
$this->cn=$cn;
- $this->ad_id=0;
+ $this->ad_id=$ad_id;
$this->display_mode='window';
}
public function __toString(): string
diff --git a/unit-test/include/class/card_propertyTest.php
b/unit-test/include/class/card_propertyTest.php
index 48f82bd20..4e8e89898 100644
--- a/unit-test/include/class/card_propertyTest.php
+++ b/unit-test/include/class/card_propertyTest.php
@@ -217,4 +217,51 @@ class Card_PropertyTest extends TestCase
'count of card properties must be the same than the card
category (fiche_def )');
}
+ /**
+ * @testdox Build Input for automatic account , for a new card , the
account is null
+ * @return void
+ */
+ public function testBuildInput1()
+ {
+ $g_connection=Dossier::connect();
+
+
+ $property=new \Card_Property($g_connection,ATTR_DEF_ACCOUNT);
+ $g_connection->exec_sql("update fiche_def set fd_create_account=true
where fd_id=25");
+ $fiche_def=new \Fiche_Def($g_connection,25);
+
+ $result=$property->build_input($fiche_def);
+
+ /*
+ $file_result=__CLASS__."-".__FUNCTION__.".txt";
+ $file_target='target-'.$file_result;
+
\Noalyss\Facility::save_file(__DIR__."/file",$file_result,var_export($result,true));
+
$this->assertFileEquals(__DIR__."/file/$file_target",__DIR__."/file/$file_result","Card_Property::build_input
failed");
+ */
+ $this->assertEquals("",$result["input"]->value," Accounting incorrect
");
+
+ }
+ /**
+ * @testdox Build Input for default account , for a new card , the account
is the account of the category
+ * @return void
+ */
+
+ public function testBuildInput2()
+ {
+ $g_connection=Dossier::connect();
+ $g_connection->exec_sql("update fiche_def set fd_create_account=false
where fd_id=25");
+
+ $property=new \Card_Property($g_connection,ATTR_DEF_ACCOUNT);
+ $fiche_def=new \Fiche_Def($g_connection,25);
+ $result=$property->build_input($fiche_def);
+ $g_connection->exec_sql("update fiche_def set fd_create_account=true
where fd_id=25");
+ /*
+ $file_result=__CLASS__."-".__FUNCTION__.".txt";
+ $file_target='target-'.$file_result;
+
\Noalyss\Facility::save_file(__DIR__."/file",$file_result,var_export($result,true));
+
$this->assertFileEquals(__DIR__."/file/$file_target",__DIR__."/file/$file_result","Card_Property::build_input
failed");
+ */
+ $this->assertEquals("600",$result["input"]->value," Accounting
incorrect ");
+ }
+
}
- [Noalyss-commit] [noalyss] branch devel updated (4b0ee7b0e -> 1ba959b43), Dany De Bontridder, 2023/02/05
- [Noalyss-commit] [noalyss] 04/34: NEW #0002205 Mode maintenance, Dany De Bontridder, 2023/02/05
- [Noalyss-commit] [noalyss] 07/34: Improve security : replace $_POST by Http_Input, Dany De Bontridder, 2023/02/05
- [Noalyss-commit] [noalyss] 01/34: Fix bug : new document w/o description Change print_r by var_export Improve PHPUNIT, Dany De Bontridder, 2023/02/05
- [Noalyss-commit] [noalyss] 03/34: Bug : default accounting override existing one, Dany De Bontridder, 2023/02/05
- [Noalyss-commit] [noalyss] 10/34: Bug : default accounting override existing one,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 13/34: Improve security : function isAdmin recheck the password, Dany De Bontridder, 2023/02/05
- [Noalyss-commit] [noalyss] 17/34: Fix : if there is no stock there is an exception instead of a warning, Dany De Bontridder, 2023/02/05
- [Noalyss-commit] [noalyss] 15/34: Fix : the select range select also the hidden element, Dany De Bontridder, 2023/02/05
- [Noalyss-commit] [noalyss] 05/34: Fix : generate_random_string returns always same value , due to a change in srand(), Dany De Bontridder, 2023/02/05
- [Noalyss-commit] [noalyss] 21/34: Cosmetic : improve CSS for enrich text, Dany De Bontridder, 2023/02/05
- [Noalyss-commit] [noalyss] 26/34: Task #0002219: Compatibilit PHP 8.2, Dany De Bontridder, 2023/02/05
- [Noalyss-commit] [noalyss] 28/34: Task #0002209: CG – Dans le menu d'actions sur une opération, remplacer «Effacer» par «Supprimer», Dany De Bontridder, 2023/02/05
- [Noalyss-commit] [noalyss] 09/34: Bug : default accounting override existing one, Dany De Bontridder, 2023/02/05
- [Noalyss-commit] [noalyss] 06/34: Improve security : function isAdmin recheck the password, Dany De Bontridder, 2023/02/05
- [Noalyss-commit] [noalyss] 08/34: Fix : the select range select also the hidden element, Dany De Bontridder, 2023/02/05