[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 26/32: Fix bug : for new TVA id not taken int
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 26/32: Fix bug : for new TVA id not taken into account but auto-computed |
Date: |
Thu, 5 Jan 2023 14:18:32 -0500 (EST) |
sparkyx pushed a commit to branch devel
in repository noalyss.
commit a76d9d1162bb185a3757ab80bf9e49084d65492a
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Tue Dec 27 16:41:22 2022 +0100
Fix bug : for new TVA id not taken into account but auto-computed
---
include/class/tva_rate_mtable.class.php | 17 ++++++++++-------
include/lib/data_sql.class.php | 2 +-
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/include/class/tva_rate_mtable.class.php
b/include/class/tva_rate_mtable.class.php
index cc22b1233..b1e5ab62f 100644
--- a/include/class/tva_rate_mtable.class.php
+++ b/include/class/tva_rate_mtable.class.php
@@ -220,7 +220,8 @@ class Tva_Rate_MTable extends Manage_Table_SQL
}
}
$new_tva_id=$this->table->tva_id;
- $tva_rate=new Tva_rate_SQL($cn, $this->previous_id);
+ $tva_rate=new Tva_rate_SQL($cn);
+ $tva_rate->setp("tva_id",$new_tva_id);
$tva_rate->setp("tva_rate", $this->table->tva_rate);
$tva_rate->setp("tva_label", $this->table->tva_label);
$tva_rate->setp("tva_comment", $this->table->tva_comment);
@@ -232,13 +233,15 @@ class Tva_Rate_MTable extends Manage_Table_SQL
$tva_rate->setp("tva_poste", $tva_purchase.",".$tva_sale);
$tva_rate->setp("tva_payment_sale", $this->table->tva_payment_sale);
$tva_rate->setp("tva_payment_purchase",
$this->table->tva_payment_purchase);
- $tva_rate->save();
- if ($this->previous_id != $new_tva_id) {
+ if ( $this->previous_id == -1 ) {
+ $tva_rate->insert();
+ } else {
+ $tva_rate->update();
+ }
+ if ( $this->previous_id != - 1 && $this->previous_id != $new_tva_id) {
$cn->exec_sql("update tva_rate set tva_id = $1 where tva_id =
$2",[$new_tva_id,$this->previous_id]);
- $tva_rate->setp("tva_id",$new_tva_id);
- }else
- $this->table->setp("tva_id",$tva_rate->getp("tva_id"));
- $this->table->load();
+ $this->table->setp("tva_id",$new_tva_id);
+ }else $this->table->setp("tva_id",$tva_rate->getp("tva_id"));
}
/**
diff --git a/include/lib/data_sql.class.php b/include/lib/data_sql.class.php
index e79860cf2..0333a9696 100644
--- a/include/lib/data_sql.class.php
+++ b/include/lib/data_sql.class.php
@@ -112,7 +112,7 @@ abstract class Data_SQL
$this->$key=null;
}
$this->$pk=$p_id;
- /* load it */
+ /* load it , if the pk id doesn't exist, it will be turned into -1 */
if ($p_id != -1 )$this->load();
if ( empty($this->date_format) )
$this->date_format="DD.MM.YYYY";
}
- [Noalyss-commit] [noalyss] 21/32: Merge branch 'dev-9035-tva-code', (continued)
- [Noalyss-commit] [noalyss] 21/32: Merge branch 'dev-9035-tva-code', Dany De Bontridder, 2023/01/05
- [Noalyss-commit] [noalyss] 31/32: Merge branch 'devel-venus2', Dany De Bontridder, 2023/01/05
- [Noalyss-commit] [noalyss] 19/32: Improve ManageTable : add a ctl_pk_id as attribute in the row + doc, Dany De Bontridder, 2023/01/05
- [Noalyss-commit] [noalyss] 18/32: Improve install config.inc.php file, Dany De Bontridder, 2023/01/05
- [Noalyss-commit] [noalyss] 15/32: Cosmetic add alert box, Dany De Bontridder, 2023/01/05
- [Noalyss-commit] [noalyss] 03/32: Cosmetic, Dany De Bontridder, 2023/01/05
- [Noalyss-commit] [noalyss] 06/32: Ergonomy : add button Close Cosmetic : color, Dany De Bontridder, 2023/01/05
- [Noalyss-commit] [noalyss] 08/32: Follow Up small bug with the #document_id, Dany De Bontridder, 2023/01/05
- [Noalyss-commit] [noalyss] 09/32: remove comment, Dany De Bontridder, 2023/01/05
- [Noalyss-commit] [noalyss] 29/32: Bug : ledger doesn't exist in 7.4 because the return value, Dany De Bontridder, 2023/01/05
- [Noalyss-commit] [noalyss] 26/32: Fix bug : for new TVA id not taken into account but auto-computed,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 25/32: Forgotten files, Dany De Bontridder, 2023/01/05
- [Noalyss-commit] [noalyss] 16/32: 0Task #002219: Compatibilit PHP 8.2 : Deprecated: Creation of dynamic property ..., Dany De Bontridder, 2023/01/05
- [Noalyss-commit] [noalyss] 17/32: add gitignore file, Dany De Bontridder, 2023/01/05
- [Noalyss-commit] [noalyss] 14/32: Administration : user show email, Dany De Bontridder, 2023/01/05
- [Noalyss-commit] [noalyss] 30/32: Function load : give the return type, Dany De Bontridder, 2023/01/05
- [Noalyss-commit] [noalyss] 05/32: Restore file, Dany De Bontridder, 2023/01/05
- [Noalyss-commit] [noalyss] 04/32: Cosmetic, Dany De Bontridder, 2023/01/05