sync
[Pman.Admin] / Report / SendEventErrors.php
index 8988084..d2aa0f8 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-
 require_once 'Pman/Roo.php';
 
 class Pman_Admin_Report_SendEventErrors extends Pman_Roo
@@ -84,7 +84,7 @@ class Pman_Admin_Report_SendEventErrors extends Pman_Roo
         return true;
     }
     
-    function get($args, $opts)
+    function get($args,   $opts = Array())
     {
         $this->opts = $opts;
         
@@ -100,15 +100,6 @@ class Pman_Admin_Report_SendEventErrors extends Pman_Roo
             $this->jerr('Missing group - try add [-t {group name}]');
         }
         
-        $rcpts = DB_DataObject::factory('groups')->lookupMembers("{$this->opts['group']}",'email');
-        
-        
-        if(empty($rcpts)){
-            $this->jerr("{$this->opts['group']} does not has any memeber");
-        }
-        // see the last date of notification to these users...
-        $rcpt_ids = DB_DataObject::factory('groups')->lookupMembers("{$this->opts['group']}",'id');
-        
         $min = 0;
          
         if ($this->opts['uid'] != 'STD') {
@@ -128,8 +119,8 @@ class Pman_Admin_Report_SendEventErrors extends Pman_Roo
             DISTINCT(Events.action) AS action,
             COUNT(Events.id) AS total
         ");
-        $events->whereAdd('id > '. $min);
-        
+        $events->whereAdd('Events.id > '. $min);
+        $events->whereAdd("Events.action NOT LIKE 'ERROR-REPORT-%'");
         $events->whereAdd("Events.event_when > NOW() - INTERVAL 1 DAY");
         
         if(!empty($this->opts['exclude'])){
@@ -182,6 +173,7 @@ class Pman_Admin_Report_SendEventErrors extends Pman_Roo
             
         ");
         $events->selectAddPersonEmail();
+        $events->whereAdd("Events.action NOT LIKE 'ERROR-REPORT-%'");
         $events->whereAdd('Events.id > '. $min);
         $events->whereAdd("Events.event_when > NOW() - INTERVAL 1 DAY");
         
@@ -218,8 +210,8 @@ class Pman_Admin_Report_SendEventErrors extends Pman_Roo
         
         
         $content = array(
-            'template'      => 'EVENT_ERRORS_REPORT',
-            'rcpts'         => $rcpts,
+            'template'      => 'FILE_REPORTING_EMAIL',
+            'rcpts_group'   => $this->opts['group'],
             'errors'        => $errors,
             'subject'       => $subject
         );
@@ -236,7 +228,7 @@ class Pman_Admin_Report_SendEventErrors extends Pman_Roo
     
     function listTypes()
     {
-         $events = DB_DataObject::factory('Events');
+        $events = DB_DataObject::factory('Events');
         $events->selectAdd();
         $events->selectAdd("
             DISTINCT(Events.action) AS action
@@ -249,5 +241,10 @@ class Pman_Admin_Report_SendEventErrors extends Pman_Roo
         
     }
     
+    static function test_EVENT_ERRORS_REPORT($pg, $to)
+    {
+        $this->jerr("Not implemented");
+    }
+    
     
 }
\ No newline at end of file