diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/modules/Company.sql | 12 | ||||
-rw-r--r-- | sql/modules/Location.sql | 1 | ||||
-rw-r--r-- | sql/modules/Payment.sql | 3 | ||||
-rw-r--r-- | sql/modules/Person.sql | 4 |
4 files changed, 12 insertions, 8 deletions
diff --git a/sql/modules/Company.sql b/sql/modules/Company.sql index d935317d..df6967a4 100644 --- a/sql/modules/Company.sql +++ b/sql/modules/Company.sql @@ -291,7 +291,7 @@ DECLARE out_row RECORD; BEGIN FOR out_row IN SELECT l.id, l.line_one, l.line_two, l.line_three, l.city, - l.state, c.name, lc.class + l.state, l.mail_code, c.name, lc.class FROM location l JOIN company_to_location ctl ON (ctl.location_id = l.id) JOIN company cp ON (ctl.company_id = cp.id) @@ -307,6 +307,7 @@ $$ LANGUAGE PLPGSQL; CREATE TYPE contact_list AS ( class text, + description text, contact text ); @@ -315,7 +316,7 @@ RETURNS SETOF contact_list AS $$ DECLARE out_row contact_list; BEGIN FOR out_row IN - SELECT cl.class, c.contact + SELECT cl.class, c.description, c.contact FROM company_to_contact c JOIN contact_class cl ON (c.contact_class_id = cl.id) WHERE company_id = @@ -357,13 +358,14 @@ END; $$ LANGUAGE PLPGSQL; CREATE OR REPLACE FUNCTION company__save_contact -(in_entity_id int, in_contact_class int, in_contact text) +(in_entity_id int, in_contact_class int, in_description text, in_contact text) RETURNS INT AS $$ DECLARE out_id int; BEGIN - INSERT INTO company_to_contact(company_id, contact_class_id, contact) - SELECT id, in_contact_class, in_contact FROM company + INSERT INTO company_to_contact(company_id, contact_class_id, + description, contact) + SELECT id, in_contact_class, in_description, in_contact FROM company WHERE entity_id = in_entity_id; RETURN 1; diff --git a/sql/modules/Location.sql b/sql/modules/Location.sql index c91a93a8..b90e11c7 100644 --- a/sql/modules/Location.sql +++ b/sql/modules/Location.sql @@ -131,6 +131,7 @@ CREATE TYPE location_result AS ( line_three text, city text, state text, + mail_code text, country text, class text ); diff --git a/sql/modules/Payment.sql b/sql/modules/Payment.sql index 7f82a88e..b3b9d1c2 100644 --- a/sql/modules/Payment.sql +++ b/sql/modules/Payment.sql @@ -606,6 +606,7 @@ CREATE TYPE payment_location_result AS ( line_three text, city text, state text, + mail_code text country text, class text ); @@ -622,7 +623,7 @@ DECLARE out_row RECORD; BEGIN FOR out_row IN SELECT l.id, l.line_one, l.line_two, l.line_three, l.city, - l.state, c.name, lc.class + l.state, l.mail_code, c.name, lc.class FROM location l JOIN company_to_location ctl ON (ctl.location_id = l.id) JOIN company cp ON (ctl.company_id = cp.id) diff --git a/sql/modules/Person.sql b/sql/modules/Person.sql index 160eeb2e..98b4dcb1 100644 --- a/sql/modules/Person.sql +++ b/sql/modules/Person.sql @@ -86,7 +86,7 @@ DECLARE out_row RECORD; BEGIN FOR out_row IN SELECT l.id, l.line_one, l.line_two, l.line_three, l.city, - l.state, c.name, lc.class + l.state, l.mail_code, c.name, lc.class FROM location l JOIN person_to_location ctl ON (ctl.location_id = l.id) JOIN person p ON (ctl.person_id = p.id) @@ -106,7 +106,7 @@ $$ DECLARE out_row RECORD; BEGIN FOR out_row IN - SELECT cc.class, c.contact + SELECT cc.class, c.description, c.contact FROM person_to_contact c JOIN contact_class cc ON (c.contact_class_id = cc.id) JOIN person p ON (c.person_id = p.id) |