[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 25/44: Currency : SQL quant_fin is adapted
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 25/44: Currency : SQL quant_fin is adapted |
Date: |
Wed, 26 Dec 2018 04:29:54 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit f0220f58163f5fdb9eebaca7e245dcc38ac6d359
Author: Dany De Bontridder <address@hidden>
Date: Wed Nov 28 12:27:16 2018 +0100
Currency : SQL quant_fin is adapted
---
include/sql/patch/upgrade130.sql | 46 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/include/sql/patch/upgrade130.sql b/include/sql/patch/upgrade130.sql
new file mode 100644
index 0000000..cfecdda
--- /dev/null
+++ b/include/sql/patch/upgrade130.sql
@@ -0,0 +1,46 @@
+begin;
+
+CREATE OR REPLACE FUNCTION isnumeric(text) RETURNS BOOLEAN AS $$
+DECLARE x NUMERIC;
+BEGIN
+ x = $1::NUMERIC;
+ RETURN TRUE;
+EXCEPTION WHEN others THEN
+ RETURN FALSE;
+END;
+$$
+STRICT
+LANGUAGE plpgsql IMMUTABLE;
+
+CREATE OR REPLACE FUNCTION isdate(text,text) RETURNS BOOLEAN AS $$
+DECLARE x timestamp;
+BEGIN
+ x := to_date($1,$2);
+ RETURN TRUE;
+EXCEPTION WHEN others THEN
+ RETURN FALSE;
+END;
+$$
+LANGUAGE plpgsql;
+
+ALTER TABLE public.jrn_def ADD currency_id int NULL;
+ALTER TABLE public.jrn_def ALTER COLUMN currency_id SET DEFAULT 0;
+update public.jrn_def set currency_id = 0 ;
+ALTER TABLE public.jrn_def ALTER COLUMN currency_id SET NOT NULL;
+ALTER TABLE public.jrn_def ADD CONSTRAINT jrn_def_currency_fk FOREIGN KEY
(currency_id) REFERENCES public.currency(id);
+
+COMMENT ON COLUMN public.jrn_def.currency_id IS 'Default currency for
financial ledger';
+
+
+alter table quant_fin add j_id bigint;
+
+with j_fin as (
+select jrnx.j_id,quant_fin.qf_id from quant_fin join jrn using (jr_id) join
jrnx on (j_grpt=jr_grpt_id and f_id=qf_other)
+)
+update quant_fin set j_id =j_fin.j_id from j_fin where
j_fin.qf_id=quant_fin.qf_id;
+
+alter table quant_fin add constraint jrnx_j_id_fk foreign key (j_id )
references jrnx(j_id) on delete cascade on update cascade;
+
+
+insert into version (val,v_description) values (131,'Currency : adapt
quant_fin');
+commit;
- [Noalyss-commit] [noalyss] 35/44: predefined operation , find a label for an accounting thx its value, the pk is now an numeric id, (continued)
- [Noalyss-commit] [noalyss] 35/44: predefined operation , find a label for an accounting thx its value, the pk is now an numeric id, Dany De Bontridder, 2018/12/26
- [Noalyss-commit] [noalyss] 17/44: Document : replace properly value in the OOo file, Dany De Bontridder, 2018/12/26
- [Noalyss-commit] [noalyss] 40/44: PHP 7.2 : sizeof attribut, Dany De Bontridder, 2018/12/26
- [Noalyss-commit] [noalyss] 22/44: Exception rethrow, Dany De Bontridder, 2018/12/26
- [Noalyss-commit] [noalyss] 37/44: cfgcurrency : file for the new version : if the file to include does not exist then display a warning and exit, Dany De Bontridder, 2018/12/26
- [Noalyss-commit] [noalyss] 05/44: Bug : cannot set group, Dany De Bontridder, 2018/12/26
- [Noalyss-commit] [noalyss] 21/44: cosmetic, Dany De Bontridder, 2018/12/26
- [Noalyss-commit] [noalyss] 30/44: acc_ledger_fin . translation, Dany De Bontridder, 2018/12/26
- [Noalyss-commit] [noalyss] 29/44: Background color, Dany De Bontridder, 2018/12/26
- [Noalyss-commit] [noalyss] 27/44: Quant_Fin : set the j_id when an operation is recorded, Dany De Bontridder, 2018/12/26
- [Noalyss-commit] [noalyss] 25/44: Currency : SQL quant_fin is adapted,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 31/44: Indentation, Dany De Bontridder, 2018/12/26
- [Noalyss-commit] [noalyss] 32/44: change background, Dany De Bontridder, 2018/12/26
- [Noalyss-commit] [noalyss] 15/44: typo, Dany De Bontridder, 2018/12/26
- [Noalyss-commit] [noalyss] 34/44: predefined operation , invalid value for database::setp, Dany De Bontridder, 2018/12/26
- [Noalyss-commit] [noalyss] 28/44: reverse for quant_fin, Dany De Bontridder, 2018/12/26
- [Noalyss-commit] [noalyss] 36/44: Pre_Operation : add attribut, Dany De Bontridder, 2018/12/26
- [Noalyss-commit] [noalyss] 08/44: Merge branch 'master' of gitlab.noalyss.eu:noalyss/noalyss, Dany De Bontridder, 2018/12/26
- [Noalyss-commit] [noalyss] 44/44: Merge branch 'master' of gitlab.noalyss.eu:noalyss/noalyss, Dany De Bontridder, 2018/12/26
- [Noalyss-commit] [noalyss] 42/44: Doc + typo, Dany De Bontridder, 2018/12/26
- [Noalyss-commit] [noalyss] 39/44: cfgcurrency : file for the new version : if the file to include does not exist then display a warning and exit look also into NOALYSS_INCLUDE, Dany De Bontridder, 2018/12/26