Index: openacs-4/packages/dotlrn/sql/postgresql/upgrade/upgrade-2.9.1d2-2.9.1d3.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/upgrade/upgrade-2.9.1d2-2.9.1d3.sql,v
diff -u -N
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn/sql/postgresql/upgrade/upgrade-2.9.1d2-2.9.1d3.sql	12 Jun 2016 17:34:52 -0000	1.1.2.1
@@ -0,0 +1,83 @@
+drop function if exists dotlrn_community__new(
+   p_community_id integer,
+   p_parent_community_id integer,
+   p_community_type varchar,
+   p_community_key varchar,
+   p_pretty_name varchar,
+   p_description varchar,
+   p_archived_p character varying,
+   p_portal_id integer,
+   p_non_member_portal_id integer,
+   p_package_id integer,
+   p_join_policy varchar,
+   p_creation_date timestamptz,
+   p_creation_user integer,
+   p_creation_ip varchar,
+   p_context_id integer
+   );
+--
+-- procedure dotlrn_community__new/15
+--
+CREATE OR REPLACE FUNCTION dotlrn_community__new(
+   p_community_id integer,
+   p_parent_community_id integer,
+   p_community_type varchar,
+   p_community_key varchar,
+   p_pretty_name varchar,
+   p_description varchar,
+   p_archived_p boolean, -- default 'f'
+   p_portal_id integer,
+   p_non_member_portal_id integer,
+   p_package_id integer,
+   p_join_policy varchar,
+   p_creation_date timestamptz,
+   p_creation_user integer,
+   p_creation_ip varchar,
+   p_context_id integer
+
+) RETURNS integer AS $$
+DECLARE
+        c_id                            integer;
+        v_group_type_exists_p           integer;
+BEGIN
+
+        c_id := application_group__new (
+            p_community_id,
+            p_community_type,
+            p_creation_date,
+            p_creation_user,
+            p_creation_ip,
+            null,
+            null,
+            p_community_key,
+            p_package_id,
+            p_join_policy,
+            p_context_id
+        );
+
+        insert into dotlrn_communities_all
+          (community_id, 
+           parent_community_id,
+           community_type, 
+           community_key, 
+           pretty_name,  
+           description, 
+           package_id, 
+           portal_id,
+           archived_p,
+           non_member_portal_id)
+        values
+          (c_id, 
+           p_parent_community_id, 
+           p_community_type, 
+           p_community_key, 
+           p_pretty_name, 
+           p_description,    
+           p_package_id, 
+           p_portal_id,
+           p_archived_p,
+           p_non_member_portal_id);
+
+        return c_id;        
+END;
+$$ LANGUAGE plpgsql;
