[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb:[6003] addons/1.3/b_units/trunk/sql/modules/ Business_Unit.sql
- Subject: SF.net SVN: ledger-smb:[6003] addons/1.3/b_units/trunk/sql/modules/ Business_Unit.sql
- From: ..hidden..
- Date: Thu, 12 Sep 2013 14:16:01 +0000
Revision: 6003
http://sourceforge.net/p/ledger-smb/code/6003
Author: einhverfr
Date: 2013-09-12 14:16:00 +0000 (Thu, 12 Sep 2013)
Log Message:
-----------
Updating business unit logic from trunk, for new trigger logic
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-09-12 11:05:23 UTC (rev 6002)
+++ addons/1.3/b_units/trunk/sql/modules/Business_Unit.sql 2013-09-12 14:16:00 UTC (rev 6003)
@@ -157,7 +157,6 @@
description = in_description,
start_date = in_start_date,
end_date = in_end_date,
- parent_id = in_parent_id,
credit_id = in_credit_id
WHERE id = in_id;
@@ -173,12 +172,8 @@
t_id := currval('business_unit_id_seq');
END IF;
-RAISE NOTICE 'ID: %', t_id;
-
SELECT * INTO retval FROM business_unit WHERE id = t_id;
-RAISE NOTICE 'ID: %', retval.id;
-
RETURN retval;
END;
$$ LANGUAGE PLPGSQL;
@@ -191,22 +186,23 @@
$$
BEGIN
IF TG_OP = 'INSERT' THEN
- INSERT INTO business_unit(class_id, description, credit_id)
- VALUES (7 - NEW.entity_class, NEW.meta_number, NEW.id);
+ INSERT INTO business_unit(class_id, control_code, description, credit_id)
+ SELECT 7 - NEW.entity_class, NEW.meta_number, e.name, NEW.id
+ FROM entity e WHERE e.id = NEW.entity_id;
ELSIF TG_OP = 'UPDATE' THEN
IF new.meta_number <> old.meta_number THEN
- UPDATE business_unit SET description = new.meta_number
+ UPDATE business_unit SET control_code = new.meta_number
WHERE class_id = 7 - NEW.entity_class
AND credit_id = new.id;
END IF;
- ELSIF TG_OP = 'DELETE' THEN
+ ELSIF TG_OP = 'DELETE'THEN
DELETE FROM business_unit WHERE class_id = 7 - NEW.entity_class
AND credit_id = old_id;
RETURN OLD;
END IF;
RETURN NEW;
END;
-$$ LANGUAGE PLPGSQL;
+$$ LANGUAGE PLPGSQL SECURITY DEFINER;
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;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits