merge with rel310C
This commit is contained in:
parent
2bddf09d9c
commit
aefc4b1eb8
77 changed files with 1189 additions and 1205 deletions
|
|
@ -12,6 +12,7 @@ INSERT INTO parm_poste (p_value, p_type) VALUES (492, 'PAS');
|
|||
INSERT INTO parm_poste (p_value, p_type) VALUES (493, 'PAS');
|
||||
INSERT INTO parm_poste (p_value, p_type) VALUES (2409, 'ACTINV');
|
||||
INSERT INTO parm_poste (p_value, p_type) VALUES (2, 'ACT');
|
||||
INSERT INTO parm_poste (p_value, p_type) VALUES (2409, 'ACTINV');
|
||||
INSERT INTO parm_poste (p_value, p_type) VALUES (3, 'ACT');
|
||||
INSERT INTO parm_poste (p_value, p_type) VALUES (5, 'ACT');
|
||||
INSERT INTO parm_poste (p_value, p_type) VALUES (491, 'ACT');
|
||||
|
|
|
|||
|
|
@ -223,13 +223,6 @@ CREATE SEQUENCE bud_card_bc_id_seq
|
|||
|
||||
ALTER TABLE public.bud_card_bc_id_seq OWNER TO phpcompta;
|
||||
|
||||
--
|
||||
-- Name: bud_card_bc_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: phpcompta
|
||||
--
|
||||
|
||||
ALTER SEQUENCE bud_card_bc_id_seq OWNED BY bud_card.bc_id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: bc_id; Type: DEFAULT; Schema: public; Owner: phpcompta
|
||||
--
|
||||
|
|
@ -322,12 +315,6 @@ CREATE SEQUENCE bud_detail_bd_id_seq
|
|||
|
||||
ALTER TABLE public.bud_detail_bd_id_seq OWNER TO phpcompta;
|
||||
|
||||
--
|
||||
-- Name: bud_detail_bd_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: phpcompta
|
||||
--
|
||||
|
||||
ALTER SEQUENCE bud_detail_bd_id_seq OWNED BY bud_detail.bd_id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: bd_id; Type: DEFAULT; Schema: public; Owner: phpcompta
|
||||
|
|
@ -424,13 +411,6 @@ CREATE SEQUENCE bud_detail_periode_bdp_id_seq
|
|||
|
||||
ALTER TABLE public.bud_detail_periode_bdp_id_seq OWNER TO phpcompta;
|
||||
|
||||
--
|
||||
-- Name: bud_detail_periode_bdp_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: phpcompta
|
||||
--
|
||||
|
||||
ALTER SEQUENCE bud_detail_periode_bdp_id_seq OWNED BY bud_detail_periode.bdp_id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: bdp_id; Type: DEFAULT; Schema: public; Owner: phpcompta
|
||||
--
|
||||
|
|
@ -682,7 +662,7 @@ begin
|
|||
nLength:=length(str_value);
|
||||
while nLength > 0 loop
|
||||
n_value:=to_number(str_value,'99999999999999999999999999999');
|
||||
select into str_type p_type from parm_poste where p_value=n_value;
|
||||
select p_type into str_type from parm_poste where p_value=n_value;
|
||||
if FOUND then
|
||||
return str_type;
|
||||
end if;
|
||||
|
|
|
|||
43
html/admin/sql/patch/upgrade37.sql
Normal file
43
html/admin/sql/patch/upgrade37.sql
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
begin;
|
||||
|
||||
CREATE OR REPLACE FUNCTION jrn_check_periode()
|
||||
RETURNS "trigger" AS
|
||||
$BODY$
|
||||
declare
|
||||
bClosed bool;
|
||||
str_status text;
|
||||
ljr_tech_per jrn.jr_tech_per%TYPE;
|
||||
ljr_def_id jrn.jr_def_id%TYPE;
|
||||
lreturn jrn%ROWTYPE;
|
||||
begin
|
||||
if TG_OP='INSERT' then
|
||||
ljr_tech_per :=NEW.jr_tech_per;
|
||||
ljr_def_id :=NEW.jr_def_id;
|
||||
lreturn :=NEW;
|
||||
end if;
|
||||
|
||||
if TG_OP='DELETE' then
|
||||
ljr_tech_per :=OLD.jr_tech_per;
|
||||
ljr_def_id :=OLD.jr_def_id;
|
||||
lreturn :=OLD;
|
||||
end if;
|
||||
|
||||
select p_closed into bClosed from parm_periode
|
||||
where p_id=ljr_tech_per;
|
||||
|
||||
if bClosed = true then
|
||||
raise exception 'Periode fermee';
|
||||
end if;
|
||||
|
||||
select status into str_status from jrn_periode
|
||||
where p_id =ljr_tech_per and jrn_def_id=ljr_def_id;
|
||||
|
||||
if str_status <> 'OP' then
|
||||
raise exception 'Periode fermee';
|
||||
end if;
|
||||
|
||||
return lreturn;
|
||||
end;$BODY$
|
||||
LANGUAGE 'plpgsql' VOLATILE;
|
||||
update version set val=38;
|
||||
commit;
|
||||
28
html/admin/sql/patch/upgrade38.sql
Normal file
28
html/admin/sql/patch/upgrade38.sql
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
begin;
|
||||
CREATE OR REPLACE FUNCTION find_pcm_type(pp_value "numeric")
|
||||
RETURNS text AS
|
||||
$BODY$
|
||||
declare
|
||||
str_type text;
|
||||
str_value text;
|
||||
n_value numeric;
|
||||
nLength integer;
|
||||
begin
|
||||
str_value:=trim(to_char(pp_value,'99999999999999999999999999999'));
|
||||
nLength:=length(str_value);
|
||||
while nLength > 0 loop
|
||||
n_value:=to_number(str_value,'99999999999999999999999999999');
|
||||
select p_type into str_type from parm_poste where p_value=n_value;
|
||||
if FOUND then
|
||||
return str_type;
|
||||
end if;
|
||||
nLength:=nLength-1;
|
||||
str_value:=substring(str_value from 1 for nLength);
|
||||
end loop;
|
||||
return 'CON';
|
||||
end;
|
||||
$BODY$
|
||||
LANGUAGE 'plpgsql' VOLATILE;
|
||||
|
||||
update version set val=39;
|
||||
commit;
|
||||
40
html/admin/sql/patch/upgrade39.sql
Normal file
40
html/admin/sql/patch/upgrade39.sql
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
begin;
|
||||
create table info_def (
|
||||
id_type text primary key,
|
||||
id_description text null
|
||||
);
|
||||
|
||||
comment on table info_def is 'Contains the types of additionnal info we can add to a operation';
|
||||
create or replace function info_def_ins_upd() returns trigger
|
||||
AS
|
||||
$$
|
||||
declare
|
||||
row_info_def info_def%ROWTYPE;
|
||||
str_type text;
|
||||
begin
|
||||
row_info_def:=NEW;
|
||||
str_type:=upper(trim(NEW.id_type));
|
||||
str_type:=replace(str_type,' ','');
|
||||
str_type:=replace(str_type,',','');
|
||||
str_type:=replace(str_type,';','');
|
||||
if length(str_type) =0 then
|
||||
raise exception 'id_type cannot be null';
|
||||
end if;
|
||||
row_info_def.id_type:=str_type;
|
||||
return row_info_def;
|
||||
end;
|
||||
$$ language plpgsql;
|
||||
create trigger info_def_ins_upd_t before insert or update on info_def for each row execute procedure info_def_ins_upd();
|
||||
|
||||
create table jrn_info (
|
||||
ji_id serial primary key,
|
||||
jr_id integer not null,
|
||||
id_type text not null,
|
||||
ji_value text
|
||||
);
|
||||
alter table jrn_info add constraint fk_jrn foreign key (jr_id) references jrn(jr_id) on delete cascade on update cascade;
|
||||
alter table jrn_info add constraint fk_info_def foreign key (id_type) references info_def(id_type) on delete cascade on update cascade;
|
||||
insert into info_def values ('BON_COMMANDE','Numero de bon de commande') ,('OTHER','Info diverses');
|
||||
insert into attr_def values(30,'Numero de client');
|
||||
update version set val=40;
|
||||
commit;
|
||||
49
html/admin/sql/patch/upgrade40.sql
Normal file
49
html/admin/sql/patch/upgrade40.sql
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
begin;
|
||||
|
||||
insert into parm_code values ('DEP_PRIV',4890,'Depense a charge du gerant');
|
||||
insert into attr_def values (31,'Depense à charge du gérant (partie privée)');
|
||||
alter table quant_purchase add qp_dep_priv numeric(20,4) default 0.0;
|
||||
|
||||
CREATE FUNCTION insert_quant_purchase(p_internal text, p_j_id numeric, p_fiche character varying, p_quant numeric, p_price numeric, p_vat numeric, p_vat_code integer, p_nd_amount numeric, p_nd_tva numeric, p_nd_tva_recup numeric,p_dep_priv numeric , p_client character varying) RETURNS void
|
||||
AS $$
|
||||
declare
|
||||
fid_client integer;
|
||||
fid_good integer;
|
||||
begin
|
||||
select f_id into fid_client from
|
||||
attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=upper(p_client);
|
||||
select f_id into fid_good from
|
||||
attr_value join jnt_fic_att_value using (jft_id) where ad_id=23 and av_text=upper(p_fiche);
|
||||
insert into quant_purchase
|
||||
(qp_internal,
|
||||
j_id,
|
||||
qp_fiche,
|
||||
qp_quantite,
|
||||
qp_price,
|
||||
qp_vat,
|
||||
qp_vat_code,
|
||||
qp_nd_amount,
|
||||
qp_nd_tva,
|
||||
qp_nd_tva_recup,
|
||||
qp_supplier,
|
||||
qp_dep_priv)
|
||||
values
|
||||
(p_internal,
|
||||
p_j_id,
|
||||
fid_good,
|
||||
p_quant,
|
||||
p_price,
|
||||
p_vat,
|
||||
p_vat_code,
|
||||
p_nd_amount,
|
||||
p_nd_tva,
|
||||
p_nd_tva_recup,
|
||||
fid_client,
|
||||
p_dep_priv);
|
||||
return;
|
||||
end;
|
||||
$$
|
||||
LANGUAGE plpgsql;
|
||||
|
||||
update version set val=41;
|
||||
commit;
|
||||
Loading…
Add table
Add a link
Reference in a new issue