altocompta/html/admin/sql/patch/upgrade106.sql

40 lines
1.9 KiB
PL/PgSQL

begin;
update attr_def set ad_text='Compte bancaire' where ad_id=3;
ALTER TABLE mod_payment DROP CONSTRAINT mod_payment_mp_fd_id_fkey ;
ALTER TABLE mod_payment ADD CONSTRAINT mod_payment_mp_fd_id_fkey FOREIGN KEY (mp_fd_id) REFERENCES fiche_def (fd_id) MATCH SIMPLE ON UPDATE cascade ON DELETE cascade;
ALTER TABLE mod_payment DROP CONSTRAINT mod_payment_mp_jrn_def_id_fkey ;
ALTER TABLE mod_payment ADD CONSTRAINT mod_payment_mp_jrn_def_id_fkey FOREIGN KEY (mp_jrn_def_id) REFERENCES jrn_def (jrn_def_id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE fiche_def ADD COLUMN fd_description text;
update fiche_def set fd_description='Achats de marchandises' where fd_id=1;
update fiche_def set fd_description='Catégorie qui contient la liste des clients' where fd_id=2;
update fiche_def set fd_description='Catégorie qui contient la liste des comptes financiers: banque, caisse,...' where fd_id=3;
update fiche_def set fd_description='Catégorie qui contient la liste des fournisseurs' where fd_id=4;
update fiche_def set fd_label='Services & Biens Divers',fd_description='Catégorie qui contient la liste des charges diverses' where fd_id=5;
update fiche_def set fd_description='Catégorie qui contient la liste des prestations, marchandises... que l''on vend ' where fd_id=6;
update jrn_def set jrn_deb_max_line=5 where jrn_deb_max_line is null;
create or replace function comptaproc.check_periode () returns trigger
as
$$
begin
if find_periode(to_char(NEW.p_start,'DD.MM.YYYY')) <> -1 then
raise info 'Overlap periode start % ',NEW.p_start;
return null;
end if;
if find_periode(to_char(NEW.p_end,'DD.MM.YYYY')) <> -1 then
raise info 'Overlap periode end % ',NEW.p_end;
return null;
end if;
return NEW;
end;
$$ language plpgsql
;
create trigger parm_periode_check_periode_trg before update or insert on parm_periode for each row execute procedure check_periode();
update version set val=107;
commit;