From c9e1acbecbecf2a887a18620654c4dd6796bdb83 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 28 Nov 2010 16:38:20 +0000 Subject: [PATCH] Forgot trigger on jrn_note --- html/admin/sql/patch/upgrade91.sql | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/html/admin/sql/patch/upgrade91.sql b/html/admin/sql/patch/upgrade91.sql index b577a3c56..76212aaef 100644 --- a/html/admin/sql/patch/upgrade91.sql +++ b/html/admin/sql/patch/upgrade91.sql @@ -161,6 +161,31 @@ CREATE INDEX fki_f_end_date ON forecast USING btree (f_end_date); + + +CREATE OR REPLACE FUNCTION comptaproc.jrn_add_note(p_jrid bigint, p_note text) + RETURNS void AS +$BODY$ +declare + tmp bigint; +begin + if length(trim(p_note)) = 0 then + delete from jrn_note where jr_id= p_jrid; + return; + end if; + + select n_id into tmp from jrn_note where jr_id = p_jrid; + + if FOUND then + update jrn_note set n_text=trim(p_note) where jr_id = p_jrid; + else + insert into jrn_note (jr_id,n_text) values ( p_jrid, p_note); + + end if; + + return; +end; +$BODY$ LANGUAGE 'plpgsql' ; update version set val=92; commit; \ No newline at end of file