diff --git a/include/constant.php b/include/constant.php index c6c0d23ca..b8d723d9c 100644 --- a/include/constant.php +++ b/include/constant.php @@ -107,7 +107,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) { if ( ! defined ("SYSINFO_DISPLAY")) { define ("SYSINFO_DISPLAY",TRUE); } -define ("DBVERSION",145); +define ("DBVERSION",146); define ("MONO_DATABASE",25); define ("DBVERSIONREPO",18); define ('NOTFOUND','--not found--'); diff --git a/include/database/attr_def_sql.class.php b/include/database/attr_def_sql.class.php new file mode 100644 index 000000000..450a1203a --- /dev/null +++ b/include/database/attr_def_sql.class.php @@ -0,0 +1,68 @@ +table="public.attr_def"; + $this->primary_key="ad_id"; + /* + * List of columns + */ + $this->name=array( + "id"=>"ad_id" + , "desc"=>"ad_text" + , "type"=>"ad_type" + , "size"=>"ad_size" + , "extra"=>"ad_extra" + , "search_followup"=>"ad_search_followup" + ); + /* + * Type of columns + */ + $this->type=array( + "ad_id"=>"numeric" + , "ad_text"=>"text" + , "ad_type"=>"text" + , "ad_size"=>"text" + , "ad_extra"=>"text" + , "ad_search_followup"=>"numeric" + ); + + + $this->default=array( + "ad_id"=>"auto" + ); + + $this->date_format="DD.MM.YYYY"; + parent::__construct($p_cn, $p_id); + } + +} diff --git a/include/sql/patch/upgrade145.sql b/include/sql/patch/upgrade145.sql new file mode 100644 index 000000000..98b6fffef --- /dev/null +++ b/include/sql/patch/upgrade145.sql @@ -0,0 +1,32 @@ +begin; + +ALTER TABLE public.document_option ADD do_option varchar NULL; +COMMENT ON COLUMN public.document_option.do_option IS 'Option for the detail'; + +alter table attr_def add column ad_search_followup int; +alter table attr_def alter column ad_search_followup set default 1; +update attr_def set ad_search_followup=1; +comment on column attr_def.ad_search_followup is '1 : search available from followup , 0 : search not available in followup'; + + +create table jnt_document_option_contact +( +jdoc_id bigserial primary key, +jdoc_enable int not null, +document_type_id bigint references document_type (dt_id) on delete cascade on update cascade, +contact_option_ref_id bigint references contact_option_ref(cor_id) on delete cascade on update cascade +); +ALTER TABLE public.jnt_document_option_contact ADD CONSTRAINT jnt_document_option_contact_un UNIQUE (document_type_id,contact_option_ref_id); +ALTER TABLE public.jnt_document_option_contact ADD CONSTRAINT jnt_document_option_contact_check CHECK (jdoc_enable in (0,1)); + +insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (54,'Actif','check','1'); +insert into attr_min(frd_id,ad_id) select frd_id , 54 from fiche_def_ref ; +insert into jnt_fic_attr (fd_id,ad_id,jnt_order) select fd_id,54,30 from fiche_def; +insert into fiche_detail (f_id,ad_id,ad_value) select f_id, 54,1 from fiche_detail where ad_id=1 and f_id not in (select f_id from fiche_detail where ad_id=54); +insert into menu_ref(me_code,me_menu,me_file,me_type) values ('CSV:FollowUpContactOption','Export action suivi','export_follow_up_contact_csv.php','PR'); +insert into profile_menu (me_code,p_id,p_type_display) select 'CSV:FollowUpContactOption',p_id,'P' from profile; + + + +insert into version (val,v_description) values (146,'Export CSV for Multiple card, contact option by document type'); +commit; diff --git a/sql/upgrade.sql b/sql/upgrade.sql index 4d158ddaa..e69de29bb 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -1,25 +0,0 @@ -ALTER TABLE public.document_option ADD do_option varchar NULL; -COMMENT ON COLUMN public.document_option.do_option IS 'Option for the detail'; - -alter table attr_def add column ad_search_followup int; -alter table attr_def alter column ad_search_followup set default 1; -update attr_def set ad_search_followup=1; -comment on column attr_def.ad_search_followup is '1 : search available from followup , 0 : search not available in followup' - - -create table jnt_document_option_contact -( -jdoc_id bigserial primary key, -jdoc_enable int not null, -document_type_id bigint references document_type (dt_id) on delete cascade on update cascade, -contact_option_ref_id bigint references contact_option_ref(cor_id) on delete cascade on update cascade -); -ALTER TABLE public.jnt_document_option_contact ADD CONSTRAINT jnt_document_option_contact_un UNIQUE (document_type_id,contact_option_ref_id); -ALTER TABLE public.jnt_document_option_contact ADD CONSTRAINT jnt_document_option_contact_check CHECK (jdoc_enable in (0,1)); - -insert into attr_def(ad_id,ad_text,ad_type,ad_size) values (54,'Actif','check','1'); -insert into attr_min(frd_id,ad_id) select frd_id , 54 from fiche_def_ref ; -insert into jnt_fic_attr (fd_id,ad_id,jnt_order) select fd_id,54,30 from fiche_def; -insert into fiche_detail (f_id,ad_id,ad_value) select f_id, 54,1 from fiche_detail where ad_id=1; -insert into menu_ref(me_code,me_menu,me_file,me_type) values ('CSV:FollowUpContactOption','Export action suivi','export_follow_up_contact_csv.php','PR'); -insert into profile_menu (me_code,p_id,p_type_display) select 'CSV:FollowUpContactOption',p_id,'P' from profile;