- $notifytimes = $w->notifyTimes(2);
- $newSearch = DB_DataObject::factory('core_notify');
- $newSearch->whereAdd( 'act_start > NOW() and act_start < NOW() + INTERVAL 2 DAY');
- $newSearch->recur_id = $w->id;
- $old = $newSearch->fetchAll('act_start', 'id');
- // returns array('2012-12-xx'=>12, 'date' => id....)
-
-
- foreach($notifytimes as $time){
- if (strtotime($time) < time()) {
- continue;
- }
- if (isset($old[$time])) {
- // we already have it...
- unset($old[$time]);
- continue;
- }
-
- // do not have a notify event... creat it..
- $add = DB_DataObject::factory('core_notify');
- $add->setFrom(array(
- "recur_id" => $w->id,
- "act_start" => $time,
- "act_when" => $time,
- "person_id" => $w->person_id,
- "onid" => $w->onid,
- "ontable" => $w->ontable
- ));
- $add->insert();
+ $w->generateNotificationsSingle();
+
+ }
+ }
+
+
+ function generateNotificationsSingle()
+ {
+
+
+ $notifytimes = $this->notifyTimes(2);
+ $newSearch = DB_DataObject::factory('core_notify');
+ $newSearch->whereAdd( 'act_start > NOW()');
+ $newSearch->recur_id = $this->id;
+ $old = $newSearch->fetchAll('act_start', 'id');
+ // returns array('2012-12-xx'=>12, 'date' => id....)
+
+
+ foreach($notifytimes as $time){
+ if (strtotime($time) < time()) {
+ continue;