[dev] [PATCH] Kronolith: Send Reminders at Correct Time (Bug 1356)

Derek Battams derek at battams.ca
Thu Feb 24 17:56:22 PST 2005


This message is in MIME format.

--=_2f54egb5atog
Content-Type: text/plain;
	charset=ISO-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

I've attached my patch for kronoloth 2.0.2.  This patch addresses bug 1356 by
modifying the SQL driver such that alarms are sent at the right time.  It also
modifies the text of the reminder email such that the entire date and time of
the event being reminded about is printed instead of just the start time.

  - Derek
--=_2f54egb5atog
Content-Type: text/plain;
	charset=ISO-8859-1;
	name="sql_alarm.patch.txt"
Content-Disposition: attachment;
	filename="sql_alarm.patch.txt"
Content-Transfer-Encoding: 7bit

diff -uNr kronolith-h3-2.0.2/lib/Driver/sql.php kronolith/lib/Driver/sql.php
--- kronolith-h3-2.0.2/lib/Driver/sql.php	2005-01-16 22:26:29.000000000 -0500
+++ kronolith/lib/Driver/sql.php	2005-02-24 09:04:18.000000000 -0500
@@ -43,7 +43,7 @@
 
     function listAlarms($date)
     {
-        $allevents = $this->listEvents($date, $date, true);
+        $allevents = $this->listEvents($date, NULL, true);
         $events = array();
 
         foreach ($allevents as $eventId) {
diff -uNr kronolith-h3-2.0.2/lib/Scheduler/kronolith.php kronolith/lib/Scheduler/kronolith.php
--- kronolith-h3-2.0.2/lib/Scheduler/kronolith.php	2004-11-23 19:36:00.000000000 -0500
+++ kronolith/lib/Scheduler/kronolith.php	2005-02-24 09:55:28.000000000 -0500
@@ -75,14 +75,13 @@
         }
 
         // Check for alarms and act on them.
-        $today = date('Ymd');
         $kronolith = &Kronolith_Driver::factory();
         $alarms = Kronolith::listAlarms(new Horde_Date($this->_runtime), array_keys($this->_calendars));
         foreach ($alarms as $calId => $calarms) {
             $kronolith->open($calId);
             foreach ($calarms as $eventId) {
                 $event = &$kronolith->getEvent($eventId);
-                $seenid = $today . $eventId . $event->start->timestamp() . $event->getAlarm();
+                $seenid = $eventId . $event->start->timestamp() . $event->getAlarm();
                 if (!isset($this->_seen[$seenid])) {
                     $this->_seen[$seenid] = true;
                     $result = $this->remind($calId, $eventId);
@@ -165,7 +164,7 @@
         $msg_headers->addHeader('From', $conf['reminder']['from_addr']);
         $msg_headers->addHeader('Subject', sprintf(_("Reminder: %s"), $event->title));
 
-        $message = "\n" . sprintf(_("You requested to be reminded about %s, which is at %s."), $event->title, date('H:i', $event->start->timestamp())) . "\n\n" . $event->getDescription();
+        $message = "\n" . sprintf(_("You requested to be reminded about %s, which starts on %s."), $event->title, date('D, d M Y H:i', $event->start->timestamp())) . "\n\n" . $event->getDescription();
 
         $mime = &new MIME_Message();
         $body = &new MIME_Part('text/plain', String::wrap($message, 76, "\n"), NLS::getCharset());
--=_2f54egb5atog--


More information about the dev mailing list