[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[5512] addons/1.3/b_units/trunk/sql/modules/ Business_Unit.sql



Revision: 5512
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=5512&view=rev
Author:   einhverfr
Date:     2013-01-08 00:41:32 +0000 (Tue, 08 Jan 2013)
Log Message:
-----------
Correcting load errors with b_units backport

Modified Paths:
--------------
    addons/1.3/b_units/trunk/sql/modules/Business_Unit.sql

Modified: addons/1.3/b_units/trunk/sql/modules/Business_Unit.sql
===================================================================
--- addons/1.3/b_units/trunk/sql/modules/Business_Unit.sql	2013-01-07 15:03:38 UTC (rev 5511)
+++ addons/1.3/b_units/trunk/sql/modules/Business_Unit.sql	2013-01-08 00:41:32 UTC (rev 5512)
@@ -190,26 +190,26 @@
 CREATE OR REPLACE FUNCTION eca_bu_trigger() RETURNS TRIGGER AS
 $$
 BEGIN
-  IF TG_OP = 'INSERT'
+  IF TG_OP = 'INSERT' THEN
       INSERT INTO business_unit(class_id, description, credit_id)
       VALUES (7 - NEW.entity_class, NEW.meta_number, NEW.id);
-  ELSIF TG_OP = 'UPDATE'
+  ELSIF TG_OP = 'UPDATE' THEN
       IF new.meta_number <> old.meta_number THEN
          UPDATE business_unit SET description = new.meta_number
           WHERE class_id = 7 - NEW.entity_class
                 AND credit_id = new.id;
       END IF;
-  ELSIF TG_OP = 'DELETE'
+  ELSIF TG_OP = 'DELETE' THEN
       DELETE FROM business_unit WHERE class_id = 7 - NEW.entity_class
                   AND credit_id = old_id;
-      RETURN;
+      RETURN OLD;
   END IF;
   RETURN NEW;
 END;
 $$ LANGUAGE PLPGSQL;
 
-DROP TRIGGER IF EXISTS eca_maintain_b_units CASCADE;
-DROP TRIGGER IF EXISTS eca_maintain_b_units_del CASCADE;
+DROP TRIGGER IF EXISTS eca_maintain_b_units ON entity_credit_account;
+DROP TRIGGER IF EXISTS eca_maintain_b_units_del ON entity_credit_account;
 
 CREATE TRIGGER eca_maintain_b_units AFTER INSERT OR UPDATE 
        ON entity_credit_account

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.