Forum OpenACS Q&A: Re: Request notification problem

Collapse
Posted by Brad Duell on
I would first try to run forums-notifications-init.sql, and then restart your instance to see if the type_id for forums_forum_notif exists in the notification_types table.

If that doesn't work, I've had this problem before, and had to do the following (this is the type creation minus the service contract creation from forums-notifications-init.sql):

I first dropped everything w/ regards to the forums type with:

--
-- Drop the type
--

declare
  v_foo integer;
begin
  select type_id into v_foo from notification_types where short_name='forums_forum_notif';

  delete from notification_types_del_methods where type_id=v_foo;

  delete from notification_types_intervals where type_id=v_foo;

  notification_type.delete(v_foo);

end;
/
show errors

I then created the type:

--
-- Create the type
--

declare
  impl_id      integer;
  foo          integer;
begin

  select impl_id into impl_id from acs_sc_impls where impl_name='forums_forum_notif_type';

  foo:= notification_type.new (
              short_name => 'forums_forum_notif',
              sc_impl_id => impl_id,
              pretty_name => 'Forum Notification',
              description => 'Notifications for Entire Forums',
              creation_user => null,
              creation_ip => null
          );

  -- enable the various intervals and delivery methods
  insert into notification_types_intervals
  (type_id, interval_id)
  select foo, interval_id
  from notification_intervals where name in ('instant','hourly','daily');

  insert into notification_types_del_methods
  (type_id, delivery_method_id)
  select foo, delivery_method_id
  from notification_delivery_methods where short_name in ('email');

end;
/
show errors

declare
  impl_id      integer;
  foo          integer;
begin

  select impl_id into impl_id from acs_sc_impls where impl_name='forums_message_notif_type';

  foo:= notification_type.new (
              short_name => 'forums_message_notif',
              sc_impl_id => impl_id,
              pretty_name => 'Forum Message Notification',
              description => 'Notifications for Forum Messages',
              creation_user => null,
              creation_ip => null
          );

  -- enable the various intervals and delivery methods
  insert into notification_types_intervals
  (type_id, interval_id)
  select foo, interval_id
  from notification_intervals where name in ('instant','hourly','daily');

  insert into notification_types_del_methods
  (type_id, delivery_method_id)
  select foo, delivery_method_id
  from notification_delivery_methods where short_name in ('email');

end;
/
show errors

Basically, your type creation was interrupted, and now you might have some (or none) of it in your database.  The type_id cannot be pulled since forums_forum_notif doesn't exist.