Author: danydb
Date: 2013-05-21 23:37:22 +0200 (Tue, 21 May 2013)
New Revision: 5298

Modified:
   phpcompta/trunk/html/admin/sql/patch/upgrade106.sql
Log:
task #0000848: Creation d un trigger pour empecher periode qui se chevauchent

Modified: phpcompta/trunk/html/admin/sql/patch/upgrade106.sql
===================================================================
--- phpcompta/trunk/html/admin/sql/patch/upgrade106.sql 2013-05-21 18:39:51 UTC 
(rev 5297)
+++ phpcompta/trunk/html/admin/sql/patch/upgrade106.sql 2013-05-21 21:37:22 UTC 
(rev 5298)
@@ -13,6 +13,27 @@
 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;



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu

_______________________________________________
Phpcompta  est un logiciel libre de comptabilit&#233; en ligne 
(http://www.phpcompta.eu)
Phpcompta-dev mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/phpcompta-dev

Reply via email to