Merge branch 'master' of http://git.roojs.com/Pman.Core
authorEdward <edward@roojs.com>
Fri, 18 Jan 2019 07:12:32 +0000 (15:12 +0800)
committerEdward <edward@roojs.com>
Fri, 18 Jan 2019 07:12:32 +0000 (15:12 +0800)
Bjs.php [new file with mode: 0644]
DataObjects/Core_watch.php
UpdateDatabase.php

diff --git a/Bjs.php b/Bjs.php
new file mode 100644 (file)
index 0000000..1950d84
--- /dev/null
+++ b/Bjs.php
@@ -0,0 +1,71 @@
+<?php
+
+/**
+ * parse BJS files .... 
+ *
+ * currenly only extracts $this->fields from the list..
+ */
+
+class Pman_Core_Bjs {
+    
+    var $json;
+    var $fields = array();
+    
+    function __construct($file)
+    {
+        
+        $this->json = json_decode(file_get_contents($file));
+        $this->iterateFields($this->json->items);
+    }
+    
+    function iterateFields($ar)
+    {
+        foreach($ar as $o) {
+            
+            switch ($o->xtype) {
+                case "ComboBox":                
+                    $this->fields[] = $o->{'String hiddenName'};
+                    // fall throught..
+                    $k = isset($o->{'String name'}) ? 'String name' : 'string name';
+                    
+                    if (!isset($o->{$k})) {
+                        break; // allowed to not exit.
+                    }
+                    $this->fields[] = $o->{$k};
+                    
+                case "Input":
+                case "TextArea":
+                case "CheckBox":
+                case "DateField":
+                case "Radio":
+                case "RadioSet":                    
+                case "PhoneInput":
+                case "NumberField":
+                    $k = isset($o->{'String name'}) ? 'String name' : 'string name';
+                    
+                    if (!isset($o->{$k})) {
+                        echo "missing string name";
+                        print_r($o);exit;
+                    }
+                    $this->fields[] = $o->{$k};
+                    break;
+                
+                case "MoneyField":
+                    $k = isset($o->{'String currencyName'}) ? 'String currencyName' : 'string currencyName';
+                    
+                    $this->fields[] = $o->{$k};
+                    $k = isset($o->{'String name'}) ? 'String name' : 'string name';
+                    $this->fields[] = $o->{$k};
+                    break;
+                default:
+                    if (isset($o->items)) {
+                        $this->iterateFields($o->items);
+                    }
+            }
+             
+        }
+        
+    }
+    
+    
+}
index 4a30b81..e41d10d 100644 (file)
@@ -157,9 +157,12 @@ class Pman_Core_DataObjects_Core_watch extends DB_DataObject
      *  @param int    $onid    - the id of the row changed
      *  @param string  $whereAdd (optiona) - a DB whereAdd() condition to filter the search for watches
      *  @param datetime    $when   (default now)  - date/time to create the notification for (Eg. end of day..)
+     *  @param string $to_ontable  - notify event create on this table, rather than watch table.
+     *  @param string $to_id  - notify event create on this id, rather than watch id.
+     *  
      * 
      */
-    function notify($ontable , $onid, $whereAdd = false, $when=false)
+    function notify($ontable , $onid, $whereAdd = false, $when=false, $to_ontable=false, $to_onid=false)
     {
         $w = DB_DataObject::factory('core_watch');   
         if ($whereAdd !== false) { 
@@ -179,11 +182,9 @@ class Pman_Core_DataObjects_Core_watch extends DB_DataObject
                 continue;
             }
          
-         
-         
             $nn = DB_DataObject::Factory('core_notify');
-            $nn->ontable = $ontable;
-            $nn->onid = $onid;
+            $nn->ontable = $to_ontable === false ? $ontable : $to_ontable;
+            $nn->onid = $to_onid === false ?  $onid : $to_onid;
             $nn->evtype = $w->medium;
             $nn->person_id = $w->person_id;
             
index 2b2a03f..19c0dd9 100644 (file)
@@ -1277,10 +1277,13 @@ class Pman_Core_UpdateDatabase extends Pman
     
     function clearApacheDataobjectsCache()
     {
-        echo "Clearing Database Cache\n";
+        
         // this needs to clear it's own cache along with remote one..
   
         $url = "http://localhost{$this->local_base_url}/Core/RefreshDatabaseCache";
+        
+        echo "Clearing Database Cache : http://localhost{$this->local_base_url}/Core/RefreshDatabaseCache\n";
+        
         $response = $this->curl($url);
         
         $json = json_decode($response, true);
@@ -1297,7 +1300,7 @@ class Pman_Core_UpdateDatabase extends Pman
     
     function clearApacheAssetCache()
     {
-        echo "Clearing Asset Cache\n";
+        echo "Clearing Asset Cache : http://localhost{$this->local_base_url}/Core/Asset\n";
         $response = $this->curl(
             "http://localhost{$this->local_base_url}/Core/Asset",
             array( '_clear_cache' => 1 ,'returnHTML' => 'NO' ),