Index: openacs-4/contrib/packages/mailing-lists/sql/postgresql/mailing-lists-package-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/mailing-lists/sql/postgresql/mailing-lists-package-create.sql,v
diff -u -r1.2 -r1.2.2.1
--- openacs-4/contrib/packages/mailing-lists/sql/postgresql/mailing-lists-package-create.sql	21 Jan 2004 19:22:14 -0000	1.2
+++ openacs-4/contrib/packages/mailing-lists/sql/postgresql/mailing-lists-package-create.sql	19 Apr 2005 08:43:56 -0000	1.2.2.1
@@ -310,76 +310,79 @@
 
 -- API for Mailing List Jobs
 
-create or replace function ml_mail_job__new (integer,integer,integer,integer,integer,varchar,varchar,boolean,text,text,text,text,text,text,text,boolean,varchar,varchar,timestamptz,text,integer,integer,timestamptz,varchar)
+create or replace function ml_mail_job__new (integer,integer,integer,integer,varchar,varchar,integer,varchar,varchar,boolean,text,text,text,text,text,text,text,boolean,varchar,varchar,timestamptz,text,integer,integer,timestamptz,varchar)
 returns integer as '
 declare
-	 new__mail_job_id	alias for $1; -- default null
-	 new__mail_class_id	alias for $2;
-	 new__list_id		alias for $3; -- default null
-	 new__selection_id	alias for $4; -- default null
-	 new__package_id	alias for $5; -- default null
-	 new__locale		alias for $6;	
-	 new__sender_email	alias for $7; -- default null
-	 new__track_links_p	alias for $8; -- default ''f''
-	 new__subject		alias for $9; -- default null
-	 new__text_header	alias for $10; -- default null
-	 new__text_body		alias for $11; -- default null
-	 new__text_footer	alias for $12; -- default null
-	 new__html_header	alias for $13; -- default null
-	 new__html_body		alias for $14; -- default null
-	 new__html_footer	alias for $15; -- default null
-	 new__template_p	alias for $16; -- default ''f''
-	 new__mime_type		alias for $17; -- default ''text/plain''
-	 new__state		alias for $18; -- default ''active''
-	 new__scheduled_date	alias for $19; -- default sysdate
-	 new__bind_vars		alias for $20; -- default null
-	 new__context_id	alias for $21; -- default null
-	 new__creation_user	alias for $22; -- default null
-	 new__creation_date	alias for $23; -- default sysdate
-	 new__creation_ip	alias for $24; -- default null
+         new__mail_job_id       alias for $1; -- default null
+         new__mail_class_id     alias for $2;
+         new__list_id           alias for $3; -- default null
+         new__selection_id      alias for $4; -- default null
+         new__category_ids      alias for $5; -- default null
+         new__category_join     alias for $6; -- default null
+         new__package_id        alias for $7; -- default null
+         new__locale            alias for $8;	
+         new__sender_email      alias for $9; -- default null
+         new__track_links_p     alias for $10; -- default ''f''
+         new__subject           alias for $11; -- default null
+         new__text_header       alias for $12; -- default null
+         new__text_body         alias for $13; -- default null
+         new__text_footer       alias for $14; -- default null
+         new__html_header       alias for $15; -- default null
+         new__html_body         alias for $16; -- default null
+         new__html_footer       alias for $17; -- default null
+         new__template_p        alias for $18; -- default ''f''
+         new__mime_type         alias for $19; -- default ''text/plain''
+         new__state             alias for $20; -- default ''active''
+         new__scheduled_date    alias for $21; -- default sysdate
+         new__bind_vars         alias for $22; -- default null
+         new__context_id        alias for $23; -- default null
+         new__creation_user     alias for $24; -- default null
+         new__creation_date     alias for $25; -- default sysdate
+         new__creation_ip       alias for $26; -- default null
 
-	 v_mail_job_id	ml_mail_jobs.mail_job_id%TYPE;
-	 v_revision_id	cr_revisions.revision_id%TYPE;
+         v_mail_job_id  ml_mail_jobs.mail_job_id%TYPE;
+         v_revision_id  cr_revisions.revision_id%TYPE;
 begin
-	v_mail_job_id := acs_object__new (
-		      new__mail_job_id,
-		      ''mail_job'',
-		      new__creation_date,
-		      new__creation_user,
-		      new__creation_ip,
-		      new__context_id
-                );
+         v_mail_job_id := acs_object__new (
+              new__mail_job_id,
+              ''mail_job'',
+              new__creation_date,
+              new__creation_user,
+              new__creation_ip,
+              new__context_id
+         );
 
-		  select into v_revision_id live_revision
-		  from cr_items
-		  where parent_id = new__mail_class_id;
-		  	IF NOT FOUND THEN
-			   v_revision_id := null;
-			END IF;
+         select into v_revision_id live_revision
+         from cr_items
+         where parent_id = new__mail_class_id;
 
-		insert into ml_mail_jobs
-		       (mail_job_id, list_id, selection_id, package_id, locale,
-		       sender_email, track_links_p, subject, text_header, text_body,
-		       text_footer, html_header, html_body, html_footer,
-		       template_p, mime_type, state, scheduled_date,
-		       css_revision_id, mail_class_id, bind_vars)
-		values
-		       (v_mail_job_id, new__list_id, new__selection_id, new__package_id, new__locale,
-		       new__sender_email, new__track_links_p, new__subject, new__text_header, new__text_body,
-		       new__text_footer, new__html_header, new__html_body, new__html_footer,
-		       new__template_p, new__mime_type, new__state, new__scheduled_date,
-		       v_revision_id, new__mail_class_id, new__bind_vars);
+         IF NOT FOUND THEN
+              v_revision_id := null;
+         END IF;
 
-		if (new__selection_id is not null) then
-		  insert into ml_mail_job_bind_vars
-		  (select v_mail_job_id as mail_job_id, b.name, b.description,
-		          b.default_value as value
-		   from us_bind_vars b
-		   where b.selection_id = new__selection_id);
-		end if;
+         insert into ml_mail_jobs
+            (mail_job_id, list_id, selection_id, category_ids, category_join, package_id, locale,
+             sender_email, track_links_p, subject, text_header, text_body,
+             text_footer, html_header, html_body, html_footer,
+             template_p, mime_type, state, scheduled_date,
+             css_revision_id, mail_class_id, bind_vars)
+         values
+             (v_mail_job_id, new__list_id, new__selection_id, new__category_ids, new__category_join, new__package_id, new__locale,
+              new__sender_email, new__track_links_p, new__subject, new__text_header, new__text_body,
+              new__text_footer, new__html_header, new__html_body, new__html_footer,
+              new__template_p, new__mime_type, new__state, new__scheduled_date,
+              v_revision_id, new__mail_class_id, new__bind_vars);
 
-		return v_mail_job_id;
+         if (new__selection_id is not null) then
+              insert into ml_mail_job_bind_vars
+                 (select v_mail_job_id as mail_job_id, b.name, b.description,
+                         b.default_value as value
+                  from us_bind_vars b
+                  where b.selection_id = new__selection_id);
+         end if;
 
+         return v_mail_job_id;
+
 end;' language 'plpgsql';
 
 
