diff --git a/include/constant.php b/include/constant.php index 6cc75512c..4e258c43a 100644 --- a/include/constant.php +++ b/include/constant.php @@ -116,7 +116,7 @@ if (!defined("NOALYSS_PACKAGE_REPOSITORY")) { if (!defined("SYSINFO_DISPLAY")) { define("SYSINFO_DISPLAY", TRUE); } -define("DBVERSION", 184); +define("DBVERSION", 185); define("MONO_DATABASE", 25); define("DBVERSIONREPO", 20); define('NOTFOUND', '--not found--'); diff --git a/include/sql/patch/upgrade184.sql b/include/sql/patch/upgrade184.sql new file mode 100644 index 000000000..9f4028126 --- /dev/null +++ b/include/sql/patch/upgrade184.sql @@ -0,0 +1,50 @@ +begin; + +update menu_ref set me_menu='Journal' where me_code='CFGLED'; + +CREATE OR REPLACE FUNCTION comptaproc.four_upper_letter() + RETURNS trigger +AS $function$ +begin + new.dc_code=transform_to_code(new.dc_code); + new.dc_code:=substr(new.dc_code,1,4); + return new; +END; +$function$ +LANGUAGE plpgsql; + +COMMENT ON FUNCTION comptaproc.four_upper_letter() IS 'Cut to the 4 first letter in uppercase'; + + +DROP TABLE if exists document_component ; + +CREATE TABLE document_component ( + dc_id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY, -- PK + dc_code text NOT NULL, -- Code used in document_modele + dc_comment text not null , -- description + CONSTRAINT document_component_pk PRIMARY KEY (dc_id), + CONSTRAINT document_component_un UNIQUE (dc_code) +); +COMMENT ON TABLE public.document_component IS 'Give the component of NOALYSS that is using is'; + +-- Column comments + +COMMENT ON COLUMN public.document_component.dc_id IS 'PK'; +COMMENT ON COLUMN public.document_component.dc_code IS 'Code used in document_modele'; +COMMENT ON COLUMN public.document_component.dc_comment IS 'Code used in document_modele'; + +-- Table Triggers + +create trigger t_code before insert + or update on + public.document_component for each row execute function comptaproc.four_upper_letter(); + + +INSERT INTO document_component (dc_comment, dc_code) VALUES('Journaux achat', 'ACH'); +INSERT INTO document_component (dc_comment, dc_code) VALUES('Journaux vente', 'VEN'); +INSERT INTO document_component (dc_comment, dc_code) VALUES('Gestion', 'GES'); + +ALTER TABLE public.document_modele ADD CONSTRAINT document_modele_fk FOREIGN KEY (md_affect) REFERENCES public.document_component(dc_code) ON UPDATE CASCADE; + +insert into version (val,v_description) values (185,'Document Component : Type of Document Model in a table'); +commit; \ No newline at end of file diff --git a/sql/upgrade.sql b/sql/upgrade.sql index d167abe17..e69de29bb 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -1,46 +0,0 @@ -update menu_ref set me_menu='Journal' where me_code='CFGLED'; - -CREATE OR REPLACE FUNCTION comptaproc.four_upper_letter() - RETURNS trigger -AS $function$ -begin - new.dc_code=transform_to_code(new.dc_code); - new.dc_code:=substr(new.dc_code,1,4); - return new; -END; -$function$ -LANGUAGE plpgsql; - -COMMENT ON FUNCTION comptaproc.four_upper_letter() IS 'Cut to the 4 first letter in uppercase'; - - -DROP TABLE if exists document_component ; - -CREATE TABLE document_component ( - dc_id int4 NOT NULL GENERATED BY DEFAULT AS IDENTITY, -- PK - dc_code text NOT NULL, -- Code used in document_modele - dc_comment text not null , -- description - CONSTRAINT document_component_pk PRIMARY KEY (dc_id), - CONSTRAINT document_component_un UNIQUE (dc_code) -); -COMMENT ON TABLE public.document_component IS 'Give the component of NOALYSS that is using is'; - --- Column comments - -COMMENT ON COLUMN public.document_component.dc_id IS 'PK'; -COMMENT ON COLUMN public.document_component.dc_code IS 'Code used in document_modele'; -COMMENT ON COLUMN public.document_component.dc_comment IS 'Code used in document_modele'; - --- Table Triggers - -create trigger t_code before insert - or update on - public.document_component for each row execute function comptaproc.four_upper_letter(); - - -INSERT INTO document_component (dc_comment, dc_code) VALUES('Journaux achat', 'ACH'); -INSERT INTO document_component (dc_comment, dc_code) VALUES('Journaux vente', 'VEN'); -INSERT INTO document_component (dc_comment, dc_code) VALUES('Gestion', 'GES'); - -ALTER TABLE public.document_modele ADD CONSTRAINT document_modele_fk FOREIGN KEY (md_affect) REFERENCES public.document_component(dc_code) ON UPDATE CASCADE; - diff --git a/unit-test/create-dossier-test.sh b/unit-test/create-dossier-test.sh index 3360797a9..fb5a27541 100755 --- a/unit-test/create-dossier-test.sh +++ b/unit-test/create-dossier-test.sh @@ -1,7 +1,7 @@ #!/bin/bash -export PGCLUSTER=10/main -DOSSIER_TEST=rel70dossier25 +export PGCLUSTER=12/main +DOSSIER_TEST=rel91dossier25 FILE_TEST=dossier25.sql dropdb $DOSSIER_TEST diff --git a/unit-test/include/class/acc_ledger_sale.Test.php b/unit-test/include/class/acc_ledger_saleTest.php similarity index 100% rename from unit-test/include/class/acc_ledger_sale.Test.php rename to unit-test/include/class/acc_ledger_saleTest.php