Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8043 Posts in 1856 Topics- by 2099 Members - Latest Member: roi
Calendar Script CommunityCustomizationPlugins (Moderators: scott, DanO, Marty)Split Recurring and EmailNotify 2 Plugins
Pages: [1]   Go Down
Print
Author Topic: Split Recurring and EmailNotify 2 Plugins  (Read 541 times)
0 Members and 1 Guest are viewing this topic.
k9barry
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« on: February 11, 2004, 10:37:00 AM »

Trying to get the Split Recurring and EmailNotify 2 Plugins to work together.  The install instructions say to post to the forum for further help.  Searched the forums for the two keywords but nothing specific returned.

Looks like the only two common pl files are the after_schedule_event and the before_delete_event

I get working on it at my end if anyone has done this already I would hate to re-invent the wheel.

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #1 on: February 11, 2004, 07:53:00 PM »

** The install instructions say to post to the forum for further help **

That is because no one AFAIK (including myself) has looked into allowing them to work together.

** only two common pl files are the after_schedule_event and the before_delete_event **

Have you tried combining the code of each pair into a single routines?

BTW. How did you make out an any of your other adventures? I never did see a posting back about your progress (if any).

Dan O.

------------------

Logged
k9barry
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #2 on: February 12, 2004, 05:44:00 AM »

I got the Split recurring plugin to work with the Emailnotify2 plugin but it is not perfect.  I moved the Split Recurring above the EmailNotify in the plug-ins list then modified the two file like below.

To the after_schedule_event.pl in the Split Recurring directory I added this to the very end a line above the 1;
------------------------------------------
unshift @INC, $BASE_DIR."plugins/EmailNotify2/";
   require "EmailUtil.inc";
   
   my $db = new DBFile($events_db);
   my $event = $db->getRecord( {'id' => $in{EVENT_id} } );
   &AddEventToDB($event, ($email_was_edit ? "edit" : "add"), $calendar);
--------------------------------------------

This modification works fine.  

The second file to modify is the command_delete_all_events.pl in the Split recurring directory.  Again add the following lines before the 1;

--------------------------------------------
unshift @INC, $BASE_DIR."plugins/EmailNotify2/";
   require "EmailUtil.inc";
   
   my $edb = new DBFile($events_db);
   my $sdb = new DBFile($schedule_db);
   my $event = $edb->getRecord( {'id' => $in{EVENT_id} } );
   my $scheds = $sdb->getRecords( {'event_id' => $in{EVENT_id} } );
   
   my $save_db_dir = $BASE_DIR."plugins/EmailNotify2/db/";
   $edb = new DBFile($save_db_dir."deleted_events");
   $sdb = new DBFile($save_db_dir."deleted_schedule");
   
   if (!$edb->getRecord( {'id' => $in{EVENT_id}, 'calendar' => $calendar } ) )
   {
      $event->{calendar} = $calendar;
      $event->{event_id} = $event->{id};
      $edb->addRecord($event);         #addRecord gets it's own id, so we have to save the event_id in another variable.
      $event->{id} = $event->{event_id};   #we store it back in the id field for AddEventToDB's benefit (so it will match adding any other type of event)
      foreach $sched (@$scheds)
      {
         $sched->{calendar} = $calendar;
         $sdb->addRecord($sched);
      }
   }

   &AddEventToDB($event, "delete", $calendar);
---------------------------------------------

This works but when you delete "related events" only one of the events gets sent as an administrative email "not all the related events".  So if you are deleting 5 events and you check the box to "delete related events" they will all delete OK but youe administrative email you receive will only show the one event.  Like I said this works but is not perfect.

------------------

Logged
k9barry
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #3 on: February 12, 2004, 05:49:00 AM »

DanO, still working on the others........    

------------------

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #4 on: February 12, 2004, 03:29:00 PM »

** administrative email you receive will only show the one event. **

You will likely need to put the EmailNotify2 code inside the loop which does the actual deleting rather than after it where the event ID variable only contains the ID of the most recent (ie. last) event acted upon. Actually the proper route would probably be to put the EmailNotify2 code in a subroutine and call that subroutine from inside the loop which does the deleting.

Some of the code (like unshift @INC, $BASE_DIR."plugins/EmailNotify2/";
require "EmailUtil.inc"; ) may only be needed once in the file somewhere towards the top rather than executing those sames lines each time the subroutie is called.

Dan O.

------------------

[This message has been edited by DanO (edited February 12, 2004).]

Logged
k9barry
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #5 on: February 13, 2004, 12:54:00 PM »

I understand what you recommend, however, at this time with my limited knowledge I do not know how to implement the changes.  I am still learning the basics and will work on this more as my knowledge base improves.


Still a learner......

------------------

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #6 on: February 13, 2004, 05:24:00 PM »

** I do not know how to implement the changes.  **

Than I would suggest you just leave the before_delete_event.pl from the EmailNotify2 plug-in intacted.

Then in the Split Recurring Events plug-in's command_delete_all_events.pl add something like the following line inside the loop which deletes the events' schedules:

$in{EVENT_id} = $event->{'id'};
&handleCustomFunction("before_delete_event");

In the other places (2?) in the command_delete_all_events.pl file where just a single event is deleted, just add this line:

&handleCustomFunction("before_delete_event");

 This code is untested so use at your own risk!


Dan O.

------------------

Logged
Pages: [1]   Go Up
Print
Jump to: