DataObjects/core.sql
[Pman.Core] / Notify.php
index e7ec4b3..a462098 100644 (file)
@@ -50,6 +50,13 @@ class Pman_Core_Notify extends Pman
             'min' => 0,
             'max' => 0,
         ),
+        'generate' => array(
+            'desc' => 'Generate notifications for a table, eg. cash_invoice',
+            'default' => '',
+            'short' => 'g',
+            'min' => 0,
+            'max' => 1,
+        ),
     );
     
     
@@ -58,7 +65,7 @@ class Pman_Core_Notify extends Pman
     var $target = 'Core/NotifySend';
     var $evtype = ''; // any notification...
                     // this script should only handle EMAIL notifications..
-    
+    var $force = false;
     function getAuth()
     {
         $ff = HTML_FlexyFramework::get();
@@ -96,7 +103,15 @@ class Pman_Core_Notify extends Pman
         if (is_a($w, 'DB_DataObject')) {
             $w->generateNotifications();
         }
-     
+        if (!empty($opts['generate'])) {
+            $w = DB_DataObject::factory($opts['generate']);
+            if (is_a($w, 'DB_DataObject')) {
+                $w->generateNotifications();
+            }
+            exit;
+            
+            
+        }
      
         //DB_DataObject::debugLevel(1);
         $w = DB_DataObject::factory($this->table);
@@ -203,7 +218,7 @@ class Pman_Core_Notify extends Pman
         if (!empty($this->send_to)) {
             $app .= ' --sent-to='.escapeshellarg($this->send_to);
         }
-        $cmd = $php . ' ' . $app . ' ' . $cmdOpts; //. ' &';
+        $cmd = 'exec ' . $php . ' ' . $app . ' ' . $cmdOpts; //. ' &';
         
        
         $pipe = array();
@@ -306,9 +321,9 @@ class Pman_Core_Notify extends Pman
         return false;
         
     }
+
     function output()
     {
-        die("done\n");
+        die("Done\n");
     }
-
 }
\ No newline at end of file