sync
authorAlan Knowles <alan@akbkhome.com>
Wed, 6 Apr 2011 04:56:52 +0000 (12:56 +0800)
committerAlan Knowles <alan@akbkhome.com>
Wed, 6 Apr 2011 04:56:52 +0000 (12:56 +0800)
DataObjects/Core_watch.php

index b0e77c4..5b9615e 100644 (file)
@@ -30,7 +30,27 @@ class Pman_Core_DataObjects_Core_watch extends DB_DataObject
     
     /* the code above is auto generated do not remove the tag below */
     ###END_AUTOCODE
+    /** make sure there is a watch for this user.. */
     
+    function ensureNotify(  $ontable, $onid, $person_id, $whereAdd)
+    {
+        $w = DB_DataObject::factory('core_watch');
+        $w->ontable = $ontable;
+        $w->onid = $onid;
+        $w->person_id = $personid;
+        $nw = clone($w);
+        $w->whereAdd($whereAdd);
+        
+        
+        if ($w->count()) {
+            return;
+        }
+        $nw->medium = 'email';
+        $nw->active = 1;
+        $nw->insert();
+        
+        
+    }
     
     function notify($ontable , $onid, $whereAdd)
     {