Fix #5642 - Report designer - hebe
authorEdward <edward@roojs.com>
Mon, 7 Jan 2019 07:22:15 +0000 (15:22 +0800)
committerEdward <edward@roojs.com>
Mon, 7 Jan 2019 07:22:15 +0000 (15:22 +0800)
Pman/Roo.php

index e116afa..78c897f 100644 (file)
@@ -454,11 +454,18 @@ class Pman_Roo extends Pman
                 if ($cols == '*') {  /// did we get cols sent to us?
                     $cols = array_keys($x);
                 }
+                
+                if(!is_array($cols)) {
+                    $cols = explode(',', $cols);
+                }
                
                 if ($titles !== false) {
                     if ($titles== '*') {
                         $titles= array_keys($x);
                     }
+                    if(!is_array($titles)) {
+                        $titles = explode(',', $titles);
+                    }
                     foreach($cols as $i=>$col) {
                         $se_config['cols'][] = array(
                             'header'=> isset($titles[$i]) ? $titles[$i] : $col,
@@ -494,13 +501,24 @@ class Pman_Roo extends Pman
         foreach($data as $x) {
             //echo "<PRE>"; print_r(array($_REQUEST['csvCols'], $x->toArray())); exit;
             $line = array();
-            if ($titles== '*') {
-                $titles= array_keys($x);
-            }
+            
             if ($cols== '*') {
                 $cols= array_keys($x);
             }
+            
+            if(!is_array($cols)) {
+                $cols = explode(',', $cols);
+            }
+
             if ($titles !== false) {
+                if ($titles== '*') {
+                    $titles= array_keys($x);
+                }
+
+                if(!is_array($titles)) {
+                    $titles = explode(',', $titles);
+                }
+
                 foreach($cols as $i=>$col) {
                     $se_config['cols'][] = array(
                         'header'=> isset($titles[$i]) ? $titles[$i] : $col,
@@ -520,17 +538,15 @@ class Pman_Roo extends Pman
                 $titles = false;
             }
             
-            
-            
             $se->addLine($se_config['workbook'], $x);
         }
+        
         if(!$se){
             $this->jerr('no data found');
         }
+        
         $se->send($fn .'.xls');
         exit;
-    
-        
         
     }