--
-- acs_event__new/13
--
create or replace function acs_event__new(
  integer,
  character varying,
  text,
  boolean,
  text,
  integer,
  integer,
  integer,
  character varying,
  timestamp with time zone,
  integer,
  character varying,
  integer
) returns int4 as $$

begin
       return acs_event__new($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,null);
end;$$ language plpgsql;


--
-- acs_event__new/18
--
create or replace function acs_event__new(
  new__event_id integer,
  new__name character varying,
  new__description text,
  new__html_p boolean,
  new__status_summary text,
  new__timespan_id integer,
  new__activity_id integer,
  new__recurrence_id integer,
  new__object_type character varying,
  new__creation_date timestamp with time zone,
  new__creation_user integer,
  new__creation_ip character varying,
  new__context_id integer,
  new__package_id integer,
  new__location character varying DEFAULT NULL::character varying,
  new__related_link_url character varying DEFAULT NULL::character varying,
  new__related_link_text character varying DEFAULT NULL::character varying,
  new__redirect_to_rel_link_p boolean DEFAULT NULL::boolean
) returns int4 as $$

	-- acs_events.event_id%TYPE
DECLARE
       v_event_id	    acs_events.event_id%TYPE;
BEGIN
       v_event_id := acs_object__new(
            new__event_id,	-- object_id
            new__object_type,	-- object_type
            new__creation_date, -- creation_date
            new__creation_user,	-- creation_user
            new__creation_ip,	-- creation_ip
            new__context_id,	-- context_id
            't',		-- security_inherit_p
            new__name,		-- title
            new__package_id	-- package_id
	    );

       insert into acs_events
            (event_id, name, description, html_p, status_summary,
	    activity_id, timespan_id, recurrence_id, location,
	    related_link_url, related_link_text, redirect_to_rel_link_p)
       values
            (v_event_id, new__name, new__description, new__html_p, new__status_summary,
	    new__activity_id, new__timespan_id, new__recurrence_id, new__location,
	    new__related_link_url, new__related_link_text, new__redirect_to_rel_link_p);

       return v_event_id;

END;
$$ language plpgsql;