diff --git a/include/constant.php b/include/constant.php index e81d73934..806867ebb 100644 --- a/include/constant.php +++ b/include/constant.php @@ -28,7 +28,7 @@ global $version_noalyss; define('NOALYSS_VERSION', 9300 ); // Database schema version -define("DBVERSION", 202); +define("DBVERSION", 203); // version for MONO_DATABASE define("MONO_DATABASE", 25); diff --git a/include/sql/patch/upgrade202.sql b/include/sql/patch/upgrade202.sql new file mode 100644 index 000000000..d183afa61 --- /dev/null +++ b/include/sql/patch/upgrade202.sql @@ -0,0 +1,25 @@ +begin; + +alter table tva_rate add column tva_reverse_account account_type; +alter table tva_rate add constraint fk_tva_reverse_account foreign key (tva_reverse_account) references tmp_pcmn(pcm_val) on delete set null on update cascade ; + +comment on column tva_rate.tva_reverse_account is 'Accouting for reversed VAT'; + +drop VIEW public.v_tva_rate; + +CREATE OR REPLACE VIEW public.v_tva_rate +AS SELECT tva_id, + tva_rate, + tva_code, + tva_label, + tva_comment, + tva_reverse_account, + split_part(tva_poste, ','::text, 1) AS tva_purchase, + split_part(tva_poste, ','::text, 2) AS tva_sale, + tva_both_side, + tva_payment_purchase, + tva_payment_sale +FROM tva_rate; + +insert into version (val,v_description) values (203,'C0TVA force accounting for autoreverse VAT'); +commit; diff --git a/sql/upgrade.sql b/sql/upgrade.sql index 59784c8b5..bfacd4c4d 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -1,23 +1,3 @@ + -- change color selected menu -update parm_appearance set a_value='#000074' where a_code='MENU1-SELECTED' and a_value='#7191ea'; - -alter table tva_rate add column tva_reverse_account account_type; -alter table tva_rate add constraint fk_tva_reverse_account foreign key (tva_reverse_account) references tmp_pcmn(pcm_val) on delete set null on update cascade ; - -comment on column tva_rate.tva_reverse_account is 'Accouting for reversed VAT'; - -drop VIEW public.v_tva_rate; - -CREATE OR REPLACE VIEW public.v_tva_rate -AS SELECT tva_id, - tva_rate, - tva_code, - tva_label, - tva_comment, - tva_reverse_account, - split_part(tva_poste, ','::text, 1) AS tva_purchase, - split_part(tva_poste, ','::text, 2) AS tva_sale, - tva_both_side, - tva_payment_purchase, - tva_payment_sale - FROM tva_rate; \ No newline at end of file +update parm_appearance set a_value='#000074' where a_code='MENU1-SELECTED' and a_value='#7191ea'; \ No newline at end of file