From 25b0a7329494aebe8d420f3d63f4fdec88c29e0c Mon Sep 17 00:00:00 2001 From: einhverfr Date: Sat, 16 Aug 2008 22:42:34 +0000 Subject: Committing patch 1928336, to transactions_foreign_key_fix.sql git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@2272 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/PriceMatrix.pm | 3 +- sql/fixes/transactions_foreign_key_fix.sql | 118 ++++++++++++++--------------- 2 files changed, 60 insertions(+), 61 deletions(-) diff --git a/LedgerSMB/PriceMatrix.pm b/LedgerSMB/PriceMatrix.pm index f4482164..2af812bd 100644 --- a/LedgerSMB/PriceMatrix.pm +++ b/LedgerSMB/PriceMatrix.pm @@ -122,8 +122,7 @@ sub price_matrix { } elsif ( $form->{vendor_id} ) { $pmh->execute( $ref->{id} ); } else { - $form->debug(); - $form->error(); + $form->error('Access Denied'); return; } diff --git a/sql/fixes/transactions_foreign_key_fix.sql b/sql/fixes/transactions_foreign_key_fix.sql index 5b0ed2dd..58dae8e2 100644 --- a/sql/fixes/transactions_foreign_key_fix.sql +++ b/sql/fixes/transactions_foreign_key_fix.sql @@ -19,160 +19,160 @@ BEGIN END; $$ LANGUAGE PLPGSQL; -insert into transactions (id, table_name) SELECT id, 'ap' FROM ap; +INSERT INTO transactions (id, table_name) SELECT id, 'ap' FROM ap; DROP RULE ap_id_track_i ON ap; -DROP RULE ap_id_track_u ON update TO ap; +DROP RULE ap_id_track_u ON ap; -CREATE TRIGGER track_global_inserts BEFORE INSERT OR UPDATE ON ap +CREATE TRIGGER track_global_inserts_iu BEFORE INSERT OR UPDATE ON ap FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); -CREATE TRIGGER track_global_inserts AFTER DELETE ON ap +CREATE TRIGGER track_global_inserts_d AFTER DELETE ON ap FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); -insert into transactions (id, table_name) SELECT id, 'ar' FROM ar; +INSERT INTO transactions (id, table_name) SELECT id, 'ar' FROM ar; -DROP RULE ar_id_track_i ON insert TO ar; -DROP RULE ar_id_track_u ON update TO ar; +DROP RULE ar_id_track_i ON ar; +DROP RULE ar_id_track_u ON ar; -CREATE TRIGGER track_global_inserts BEFORE INSERT OR UPDATE ON ar +CREATE TRIGGER track_global_inserts_iu BEFORE INSERT OR UPDATE ON ar FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); -CREATE TRIGGER track_global_inserts AFTER DELETE ON ar +CREATE TRIGGER track_global_inserts_d AFTER DELETE ON ar FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); INSERT INTO transactions (id, table_name) SELECT id, 'business' FROM business; -DROP RULE business_id_track_i ON insert TO business; -DROP RULE business_id_track_u ON update TO business +DROP RULE business_id_track_i ON business; +DROP RULE business_id_track_u ON business; -CREATE TRIGGER track_global_inserts BEFORE INSERT OR UPDATE ON business +CREATE TRIGGER track_global_inserts_iu BEFORE INSERT OR UPDATE ON business FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); -CREATE TRIGGER track_global_inserts AFTER DELETE ON business +CREATE TRIGGER track_global_inserts_d AFTER DELETE ON business FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); INSERT INTO transactions (id, table_name) SELECT id, 'chart' FROM chart; -DROP RULE chart_id_track_i ON insert TO chart; -DROP RULE chart_id_track_u ON update TO chart; +DROP RULE chart_id_track_i ON chart; +DROP RULE chart_id_track_u ON chart; -CREATE TRIGGER track_global_inserts BEFORE INSERT OR UPDATE ON chart +CREATE TRIGGER track_global_inserts_iu BEFORE INSERT OR UPDATE ON chart FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); -CREATE TRIGGER track_global_inserts AFTER DELETE ON chart +CREATE TRIGGER track_global_inserts_d AFTER DELETE ON chart FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); INSERT INTO transactions (id, table_name) SELECT id, 'customer' FROM customer; -DROP RULE customer_id_track_i ON insert TO customer; -DROP RULE customer_id_track_u ON update TO customer; +DROP RULE customer_id_track_i ON customer; +DROP RULE customer_id_track_u ON customer; -CREATE TRIGGER track_global_inserts BEFORE INSERT OR UPDATE ON customer +CREATE TRIGGER track_global_inserts_iu BEFORE INSERT OR UPDATE ON customer FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); -CREATE TRIGGER track_global_inserts AFTER DELETE ON customer +CREATE TRIGGER track_global_inserts_d AFTER DELETE ON customer FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); INSERT INTO transactions (id, table_name) SELECT id, 'department' FROM department; -DROP RULE department_id_track_i ON insert TO department; -DROP RULE department_id_track_u ON update TO department; +DROP RULE department_id_track_i ON department; +DROP RULE department_id_track_u ON department; INSERT INTO transactions (id, table_name) SELECT id, 'employee' FROM employee; -DROP RULE employee_id_track_i ON insert TO employee; -DROP RULE employee_id_track_u ON update TO employee; +DROP RULE employee_id_track_i ON employee; +DROP RULE employee_id_track_u ON employee; -CREATE TRIGGER track_global_inserts BEFORE INSERT OR UPDATE ON employee +CREATE TRIGGER track_global_inserts_iu BEFORE INSERT OR UPDATE ON employee FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); -CREATE TRIGGER track_global_inserts AFTER DELETE ON employee +CREATE TRIGGER track_global_inserts_d AFTER DELETE ON employee FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); INSERT INTO transactions (id, table_name) SELECT id, 'gl' FROM gl; -DROP RULE gl_id_track_i ON insert TO gl; -DROP RULE gl_id_track_u ON update TO gl; +DROP RULE gl_id_track_i ON gl; +DROP RULE gl_id_track_u ON gl; -CREATE TRIGGER track_global_inserts BEFORE INSERT OR UPDATE ON gl +CREATE TRIGGER track_global_inserts_iu BEFORE INSERT OR UPDATE ON gl FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); -CREATE TRIGGER track_global_inserts AFTER DELETE ON gl +CREATE TRIGGER track_global_inserts_d AFTER DELETE ON gl FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); INSERT INTO transactions (id, table_name) SELECT id, 'oe' FROM oe; -DROP RULE oe_id_track_i ON insert TO oe; -DROP RULE oe_id_track_u ON update TO oe; +DROP RULE oe_id_track_i ON oe; +DROP RULE oe_id_track_u ON oe; -CREATE TRIGGER track_global_inserts BEFORE INSERT OR UPDATE ON oe +CREATE TRIGGER track_global_inserts_iu BEFORE INSERT OR UPDATE ON oe FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); -CREATE TRIGGER track_global_inserts AFTER DELETE ON oe +CREATE TRIGGER track_global_inserts_d AFTER DELETE ON oe FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); INSERT INTO transactions (id, table_name) SELECT id, 'parts' FROM parts; -DROP RULE parts_id_track_i ON insert TO parts; -DROP RULE parts_id_track_u ON update TO parts; +DROP RULE parts_id_track_i ON parts; +DROP RULE parts_id_track_u ON parts; -CREATE TRIGGER track_global_inserts BEFORE INSERT OR UPDATE ON parts +CREATE TRIGGER track_global_inserts_iu BEFORE INSERT OR UPDATE ON parts FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); -CREATE TRIGGER track_global_inserts AFTER DELETE ON parts +CREATE TRIGGER track_global_inserts_d AFTER DELETE ON parts FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); INSERT INTO transactions (id, table_name) SELECT id, 'partsgroup' FROM partsgroup; -DROP RULE partsgroup_id_track_i ON insert TO partsgroup; -DROP RULE partsgroup_id_track_u ON update TO partsgroup; +DROP RULE partsgroup_id_track_i ON partsgroup; +DROP RULE partsgroup_id_track_u ON partsgroup; -CREATE TRIGGER track_global_inserts BEFORE INSERT OR UPDATE ON partsgroup +CREATE TRIGGER track_global_inserts_iu BEFORE INSERT OR UPDATE ON partsgroup FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); -CREATE TRIGGER track_global_inserts AFTER DELETE ON partsgroup +CREATE TRIGGER track_global_inserts_d AFTER DELETE ON partsgroup FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); INSERT INTO transactions (id, table_name) SELECT id, 'pricegroup' FROM pricegroup; -DROP RULE pricegroup_id_track_i ON insert TO pricegroup; -DROP RULE pricegroup_id_track_u ON update TO pricegroup; +DROP RULE pricegroup_id_track_i ON pricegroup; +DROP RULE pricegroup_id_track_u ON pricegroup; -CREATE TRIGGER track_global_inserts BEFORE INSERT OR UPDATE ON pricegroup +CREATE TRIGGER track_global_inserts_iu BEFORE INSERT OR UPDATE ON pricegroup FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); -CREATE TRIGGER track_global_inserts AFTER DELETE ON pricegroup +CREATE TRIGGER track_global_inserts_d AFTER DELETE ON pricegroup FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); INSERT INTO transactions (id, table_name) SELECT id, 'project' FROM project; -DROP RULE project_id_track_i ON insert TO project; -DROP RULE project_id_track_u ON update TO project; +DROP RULE project_id_track_i ON project; +DROP RULE project_id_track_u ON project; -CREATE TRIGGER track_global_inserts BEFORE INSERT OR UPDATE ON project +CREATE TRIGGER track_global_inserts_iu BEFORE INSERT OR UPDATE ON project FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); -CREATE TRIGGER track_global_inserts AFTER DELETE ON project +CREATE TRIGGER track_global_inserts_d AFTER DELETE ON project FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); INSERT INTO transactions (id, table_name) SELECT id, 'vendor' FROM vendor; -DROP RULE vendor_id_track_i ON insert TO vendor; -DROP RULE employee_id_track_u ON update TO vendor; +DROP RULE vendor_id_track_i ON vendor; +DROP RULE employee_id_track_u ON vendor; -CREATE TRIGGER track_global_inserts BEFORE INSERT OR UPDATE ON vendor +CREATE TRIGGER track_global_inserts_iu BEFORE INSERT OR UPDATE ON vendor FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); -CREATE TRIGGER track_global_inserts AFTER DELETE ON vendor +CREATE TRIGGER track_global_inserts_d AFTER DELETE ON vendor FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); INSERT INTO transactions (id, table_name) SELECT id, 'warehouse' FROM warehouse; -DROP RULE warehouse_id_track_i ON insert TO warehouse; -DROP RULE warehouse_id_track_u ON update TO warehouse; +DROP RULE warehouse_id_track_i ON warehouse; +DROP RULE warehouse_id_track_u ON warehouse; -CREATE TRIGGER track_global_inserts BEFORE INSERT OR UPDATE ON warehouse +CREATE TRIGGER track_global_inserts_iu BEFORE INSERT OR UPDATE ON warehouse FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); -CREATE TRIGGER track_global_inserts AFTER DELETE ON warehouse +CREATE TRIGGER track_global_inserts_d AFTER DELETE ON warehouse FOR EACH ROW EXECUTE PROCEDURE track_global_sequence(); -- cgit v1.2.3