Index: openacs-4/packages/notifications/sql/postgresql/notifications-package-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/notifications-package-create.sql,v
diff -u -r1.14 -r1.15
--- openacs-4/packages/notifications/sql/postgresql/notifications-package-create.sql	27 Jun 2007 18:54:47 -0000	1.14
+++ openacs-4/packages/notifications/sql/postgresql/notifications-package-create.sql	30 Mar 2013 18:50:28 -0000	1.15
@@ -9,21 +9,26 @@
 
 select define_function_args ('notification_interval__new','interval_id,name,n_seconds,creation_date,creation_user,creation_ip,context_id');
 
-create function notification_interval__new (integer, varchar, integer, timestamptz, integer, varchar, integer)
-returns integer as '
-declare
-    p_interval_id                   alias for $1;
-    p_name                          alias for $2;
-    p_n_seconds                     alias for $3;
-    p_creation_date                 alias for $4;
-    p_creation_user                 alias for $5;
-    p_creation_ip                   alias for $6;
-    p_context_id                    alias for $7;
+
+
+--
+-- procedure notification_interval__new/7
+--
+CREATE OR REPLACE FUNCTION notification_interval__new(
+   p_interval_id integer,
+   p_name varchar,
+   p_n_seconds integer,
+   p_creation_date timestamptz,
+   p_creation_user integer,
+   p_creation_ip varchar,
+   p_context_id integer
+) RETURNS integer AS $$
+DECLARE
     v_interval_id                   integer;
-begin
+BEGIN
     v_interval_id := acs_object__new(
         p_interval_id,
-        ''notification_interval'',
+        'notification_interval',
         p_creation_date,
         p_creation_user,
         p_creation_ip,
@@ -37,39 +42,51 @@
     (v_interval_id, p_name, p_n_seconds);
 
     return v_interval_id;
-end;
-' language 'plpgsql';
+END;
 
+$$ LANGUAGE plpgsql;
+
 select define_function_args ('notification_interval__delete','interval_id');
 
-create function notification_interval__delete(integer)
-returns integer as '
-declare
-    p_interval_id                   alias for $1;
-begin
+
+
+--
+-- procedure notification_interval__delete/1
+--
+CREATE OR REPLACE FUNCTION notification_interval__delete(
+   p_interval_id integer
+) RETURNS integer AS $$
+DECLARE
+BEGIN
     perform acs_object__delete(p_interval_id);
     return 0;
-end;
-' language 'plpgsql';
+END;
 
+$$ LANGUAGE plpgsql;
+
 select define_function_args ('notification_delivery_method__new','delivery_method_id,sc_impl_id,short_name,pretty_name,creation_date,creation_user,creation_ip,context_id');
 
-create function notification_delivery_method__new (integer, integer, varchar, varchar, timestamptz, integer, varchar, integer)
-returns integer as '
-declare
-    p_delivery_method_id            alias for $1;
-    p_sc_impl_id                    alias for $2;
-    p_short_name                    alias for $3;
-    p_pretty_name                   alias for $4;
-    p_creation_date                 alias for $5;
-    p_creation_user                 alias for $6;
-    p_creation_ip                   alias for $7;
-    p_context_id                    alias for $8;
+
+
+--
+-- procedure notification_delivery_method__new/8
+--
+CREATE OR REPLACE FUNCTION notification_delivery_method__new(
+   p_delivery_method_id integer,
+   p_sc_impl_id integer,
+   p_short_name varchar,
+   p_pretty_name varchar,
+   p_creation_date timestamptz,
+   p_creation_user integer,
+   p_creation_ip varchar,
+   p_context_id integer
+) RETURNS integer AS $$
+DECLARE
     v_delivery_method_id            integer;
-begin
+BEGIN
     v_delivery_method_id := acs_object__new(
         p_delivery_method_id,
-        ''notification_delivery_method'',
+        'notification_delivery_method',
         p_creation_date,
         p_creation_user,
         p_creation_ip,
@@ -83,10 +100,11 @@
     (v_delivery_method_id, p_sc_impl_id, p_short_name, p_pretty_name);
 
     return v_delivery_method_id;
-end;
-' language 'plpgsql';
+END;
 
+$$ LANGUAGE plpgsql;
 
+
 create function notification_delivery_method__delete(integer)
 returns integer as '
 DECLARE
@@ -95,9 +113,10 @@
         perform acs_object__delete(p_delivery_method_id);
         return 0;
 END;
-' language 'plpgsql';
 
+$$ LANGUAGE plpgsql;
 
+
 -- Notification Types Package
 select define_function_args ('notification_type__new','type_id,sc_impl_id,short_name,pretty_name,description,creation_date,creation_user,creation_ip,context_id');
 
@@ -119,7 +138,7 @@
 BEGIN
         v_type_id:= acs_object__new (
                                     p_type_id,
-                                    ''notification_type'',
+                                    'notification_type',
                                     p_creation_date,
                                     p_creation_user,
                                     p_creation_ip,
@@ -131,20 +150,27 @@
       
       return v_type_id;
 END;
-' language 'plpgsql';
 
+$$ LANGUAGE plpgsql;
+
 select define_function_args ('notification_type__delete','type_id');
 
-create function notification_type__delete(integer)
-returns integer as '
-declare
-    p_type_id                       alias for $1;
-begin
+
+
+--
+-- procedure notification_type__delete/1
+--
+CREATE OR REPLACE FUNCTION notification_type__delete(
+   p_type_id integer
+) RETURNS integer AS $$
+DECLARE
+BEGIN
     perform acs_object__delete(p_type_id);
     return 0;
-end;
-' language 'plpgsql';
+END;
 
+$$ LANGUAGE plpgsql;
+
 select define_function_args ('notification_request__new','request_id,object_type;notification_request,type_id,user_id,object_id,interval_id,delivery_method_id,format,dynamic_p;f,creation_date,creation_user,creation_ip,context_id');
 
 create function notification_request__new (
@@ -194,16 +220,22 @@
       return v_request_id;                          
 
 END;
-' language 'plpgsql';
 
+$$ LANGUAGE plpgsql;
+
 select define_function_args ('notification_request__delete','request_id');
 
-create or replace function notification_request__delete(integer)
-returns integer as '
-declare
-    p_request_id                    alias for $1;
+
+
+--
+-- procedure notification_request__delete/1
+--
+CREATE OR REPLACE FUNCTION notification_request__delete(
+   p_request_id integer
+) RETURNS integer AS $$
+DECLARE
     v_notifications record;
-begin
+BEGIN
     for v_notifications in select notification_id
                            from notifications n, notification_requests nr
                            where n.response_id = nr.object_id
@@ -214,17 +246,23 @@
 
     perform acs_object__delete(p_request_id);
     return 0;
-end;
-' language 'plpgsql';
+END;
 
+$$ LANGUAGE plpgsql;
+
 select define_function_args ('notification_request__delete_all', 'object_id');
 
-create function notification_request__delete_all(integer)
-returns integer as '
-declare
-    p_object_id                     alias for $1;
+
+
+--
+-- procedure notification_request__delete_all/1
+--
+CREATE OR REPLACE FUNCTION notification_request__delete_all(
+   p_object_id integer
+) RETURNS integer AS $$
+DECLARE
     v_request                       RECORD;
-begin
+BEGIN
     for v_request in select request_id
                      from notification_requests
                      where object_id= p_object_id
@@ -233,17 +271,23 @@
     end loop;
 
     return 0;
-end;
-' language 'plpgsql';
+END;
 
+$$ LANGUAGE plpgsql;
+
 select define_function_args ('notification_request__delete_all_for_user', 'user_id');
 
-create function notification_request__delete_all_for_user(integer)
-returns integer as '
-declare
-    p_user_id                       alias for $1;
+
+
+--
+-- procedure notification_request__delete_all_for_user/1
+--
+CREATE OR REPLACE FUNCTION notification_request__delete_all_for_user(
+   p_user_id integer
+) RETURNS integer AS $$
+DECLARE
     v_request                       RECORD;
-begin
+BEGIN
     for v_request in select request_id
                      from notification_requests
                      where user_id= p_user_id
@@ -252,35 +296,41 @@
     end loop;
 
     return 0;
-end;
-' language 'plpgsql';
+END;
 
+$$ LANGUAGE plpgsql;
 
+
 select define_function_args ('notification__new','notification_id,type_id,object_id,notif_date,response_id,notif_user,notif_subject,notif_text,notif_html,file_ids,creation_date,creation_user,creation_ip,context_id');
 
-create or replace function notification__new(integer,integer,integer,timestamptz,integer,integer,varchar,text,text,text,timestamptz,integer,varchar,integer)
-returns integer as '
-declare
-    p_notification_id               alias for $1;
-    p_type_id                       alias for $2;
-    p_object_id                     alias for $3;
-    p_notif_date                    alias for $4;
-    p_response_id                   alias for $5;
-    p_notif_user                    alias for $6;
-    p_notif_subject                 alias for $7;
-    p_notif_text                    alias for $8;
-    p_notif_html                    alias for $9;
-    p_file_ids                      alias for $10;
-    p_creation_date                 alias for $11;
-    p_creation_user                 alias for $12;
-    p_creation_ip                   alias for $13;
-    p_context_id                    alias for $14;
+
+
+--
+-- procedure notification__new/14
+--
+CREATE OR REPLACE FUNCTION notification__new(
+   p_notification_id integer,
+   p_type_id integer,
+   p_object_id integer,
+   p_notif_date timestamptz,
+   p_response_id integer,
+   p_notif_user integer,
+   p_notif_subject varchar,
+   p_notif_text text,
+   p_notif_html text,
+   p_file_ids text,
+   p_creation_date timestamptz,
+   p_creation_user integer,
+   p_creation_ip varchar,
+   p_context_id integer
+) RETURNS integer AS $$
+DECLARE
     v_notification_id               integer;
     v_notif_date                    notifications.notif_date%TYPE;
-begin
+BEGIN
     v_notification_id := acs_object__new(
         p_notification_id,
-        ''notification'',
+        'notification',
         p_creation_date,
         p_creation_user,
         p_creation_ip,
@@ -300,18 +350,25 @@
     (v_notification_id, p_type_id, p_object_id, v_notif_date, p_response_id, p_notif_user, p_notif_subject, p_notif_text, p_notif_html, p_file_ids);
 
     return v_notification_id;
-end;
-' language 'plpgsql';
+END;
 
+$$ LANGUAGE plpgsql;
+
 select define_function_args ('notification__delete','notification_id');
 
-create function notification__delete(integer)
-returns integer as '
-declare
-    p_notification_id               alias for $1;
-begin
+
+
+--
+-- procedure notification__delete/1
+--
+CREATE OR REPLACE FUNCTION notification__delete(
+   p_notification_id integer
+) RETURNS integer AS $$
+DECLARE
+BEGIN
     delete from notifications where notification_id = p_notification_id;
     perform acs_object__delete(p_notification_id);
     return 0;
-end;
-' language 'plpgsql';
+END;
+
+$$ LANGUAGE plpgsql;
