[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 33/39: Fix bug SQL check if a periode is clos
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 33/39: Fix bug SQL check if a periode is closed returned wrong value |
Date: |
Sat, 11 Jul 2020 13:20:47 -0400 (EDT) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 066d08fbfa9cfd14e6db0175e11a026d781c527b
Author: Dany De Bontridder <danydb@noalyss.eu>
AuthorDate: Tue Jun 30 18:28:54 2020 +0200
Fix bug SQL check if a periode is closed returned wrong value
---
sql/upgrade.sql | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/sql/upgrade.sql b/sql/upgrade.sql
index e69de29..fb36c0d 100644
--- a/sql/upgrade.sql
+++ b/sql/upgrade.sql
@@ -0,0 +1,44 @@
+CREATE OR REPLACE FUNCTION comptaproc.jrn_check_periode()
+ RETURNS trigger
+ LANGUAGE plpgsql
+AS $function$
+declare
+bClosed bool;
+str_status text;
+ljr_tech_per jrn.jr_tech_per%TYPE;
+ljr_def_id jrn.jr_def_id%TYPE;
+lreturn jrn%ROWTYPE;
+begin
+if TG_OP='UPDATE' then
+ ljr_tech_per :=OLD.jr_tech_per ;
+ NEW.jr_tech_per :=
comptaproc.find_periode(to_char(NEW.jr_date,'DD.MM.YYYY'));
+ ljr_def_id :=OLD.jr_def_id;
+ lreturn :=NEW;
+ if NEW.jr_date = OLD.jr_date then
+ return NEW;
+ end if;
+ if comptaproc.is_closed(NEW.jr_tech_per,NEW.jr_def_id) = true then
+ raise exception 'Periode fermee';
+ end if;
+end if;
+
+if TG_OP='INSERT' then
+ NEW.jr_tech_per :=
comptaproc.find_periode(to_char(NEW.jr_date,'DD.MM.YYYY'));
+ ljr_tech_per :=NEW.jr_tech_per ;
+ ljr_def_id :=NEW.jr_def_id;
+ lreturn :=NEW;
+end if;
+
+if TG_OP='DELETE' then
+ ljr_tech_per :=OLD.jr_tech_per;
+ ljr_def_id :=OLD.jr_def_id;
+ lreturn :=OLD;
+end if;
+
+if comptaproc.is_closed (ljr_tech_per,ljr_def_id) = true then
+ raise exception 'Periode fermee';
+end if;
+
+return lreturn;
+end;$function$
+;
\ No newline at end of file
- [Noalyss-commit] [noalyss] 28/39: update config.inc.example file, (continued)
- [Noalyss-commit] [noalyss] 28/39: update config.inc.example file, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 29/39: Orthographe, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 31/39: Bug : extourne ne fonctionne plus, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 20/39: Install : initialize variabvle, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 34/39: Improve error log, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 30/39: Ergonomie : autoliquidation, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 32/39: Fix Bug : when duplicating an ODS operation, the accounting is cleared if a card is used, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 35/39: Task #0001813: CA – avertissement utilisation poste Info nombre d'utilisation Avoid delete on closed periode, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 36/39: CC Cosmetic, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 39/39: Error concat, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 33/39: Fix bug SQL check if a periode is closed returned wrong value,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 38/39: Improve : logging error, Dany De Bontridder, 2020/07/11
- [Noalyss-commit] [noalyss] 37/39: Javascript object before, Dany De Bontridder, 2020/07/11