summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/modules/Company.sql1
-rw-r--r--sql/modules/Employee.sql4
-rw-r--r--sql/modules/Person.sql4
-rw-r--r--sql/modules/admin.sql8
4 files changed, 9 insertions, 8 deletions
diff --git a/sql/modules/Company.sql b/sql/modules/Company.sql
index 7d9dd747..a102fa1c 100644
--- a/sql/modules/Company.sql
+++ b/sql/modules/Company.sql
@@ -463,7 +463,6 @@ $$ LANGUAGE PLPGSQL;
CREATE TYPE contact_list AS (
class text,
class_id int,
- description text,
contact text
);
diff --git a/sql/modules/Employee.sql b/sql/modules/Employee.sql
index 78920ea6..ae2efc86 100644
--- a/sql/modules/Employee.sql
+++ b/sql/modules/Employee.sql
@@ -17,13 +17,13 @@ returns int AS $$
select * into e from entity where id = in_entity and entity_class = 3;
IF NOT FOUND THEN
- RAISE EXCEPTION 'No entity found for ID %', in_id;
+ RAISE EXCEPTION 'No entity found for ID %', in_entity;
END IF;
select * into p from person where id = in_person;
IF NOT FOUND THEN
- RAISE EXCEPTION 'No person found for ID %', in_id;
+ RAISE EXCEPTION 'No person found for ID %', in_person;
END IF;
-- Okay, we're good. Check to see if we update or insert.
diff --git a/sql/modules/Person.sql b/sql/modules/Person.sql
index cd84fefc..9eda8335 100644
--- a/sql/modules/Person.sql
+++ b/sql/modules/Person.sql
@@ -1,6 +1,6 @@
begin;
-CREATE OR REPLACE FUNCTION person_save
+CREATE OR REPLACE FUNCTION person__save
(in_entity_id integer, in_salutation_id int,
in_first_name text, in_middle_name text, in_last_name text
)
@@ -106,7 +106,7 @@ $$
DECLARE out_row RECORD;
BEGIN
FOR out_row IN
- SELECT cc.class, cc.id, c.description, c.contact
+ SELECT cc.class, cc.id, 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)
diff --git a/sql/modules/admin.sql b/sql/modules/admin.sql
index c7dc3d9b..f590aa94 100644
--- a/sql/modules/admin.sql
+++ b/sql/modules/admin.sql
@@ -481,15 +481,17 @@ $$ language plpgsql;
create or replace function admin__user_preferences (in_user int) returns setof user_preference as $$
declare
- v_row user_preferences;
+ v_row user_preference;
BEGIN
- select * into v_row from user_preference where user_id = in_user;
+ select * into v_row from user_preference where id = in_user;
IF NOT FOUND THEN
- RAISE EXCEPTION "Could not find user preferences for id %", in_user;
+ RAISE EXCEPTION 'Could not find user preferences for id %', in_user;
ELSE
return next v_row;
END IF;
+END;
+$$ language plpgsql;
commit; \ No newline at end of file