소스 검색

bugfix array object mixup..

andre 1 년 전
부모
커밋
735df5e0fd
2개의 변경된 파일15개의 추가작업 그리고 12개의 파일을 삭제
  1. 6 5
      app/Libs/Kerio/Components/Api/Soap/Services/Create/CreateAccountCosQuota.php
  2. 9 7
      core/UI/Widget/DataTable/DataTable.php

+ 6 - 5
app/Libs/Kerio/Components/Api/Soap/Services/Create/CreateAccountCosQuota.php

@@ -92,12 +92,13 @@ class CreateAccountCosQuota extends CreateAccount
         /**
         /**
          * check if limit has been reached
          * check if limit has been reached
          */
          */
-        if ($cosLimits[$this->formData['cosId']] !== Size::UNLIMITED && count($groupedByCos[$this->formData['cosId']]) >= $cosLimits[$this->formData['cosId']] && $this->formData['cosId'] !== $this->formData['currentCosId'])
-        {
-            $this->setError('There are too many mailboxes with selected quota limit');
-            return false;
+        if(is_countable($groupedByCos[$this->formData['cosId']])) {
+            if ($cosLimits[$this->formData['cosId']] !== Size::UNLIMITED && count($groupedByCos[$this->formData['cosId']]) >= $cosLimits[$this->formData['cosId']] && $this->formData['cosId'] !== $this->formData['currentCosId'])
+            {
+                $this->setError('There are too many mailboxes with selected quota limit');
+                return false;
+            }
         }
         }
-
         return true;
         return true;
     }
     }
 
 

+ 9 - 7
core/UI/Widget/DataTable/DataTable.php

@@ -126,7 +126,7 @@ class DataTable extends BaseContainer implements \ThurData\Servers\KerioEmail\Co
         return $this;
         return $this;
     }
     }
 
 
-    public function setData($data = [])
+    public function setData(array $data = [])
     {
     {
         $this->recordsSet = $data;
         $this->recordsSet = $data;
         
         
@@ -135,7 +135,7 @@ class DataTable extends BaseContainer implements \ThurData\Servers\KerioEmail\Co
 
 
     protected function getCount()
     protected function getCount()
     {
     {
-        return count($this->recordsSet->records);
+        return count($this->recordsSet['records']);
     }
     }
 
 
     protected function getRecords()
     protected function getRecords()
@@ -158,7 +158,7 @@ class DataTable extends BaseContainer implements \ThurData\Servers\KerioEmail\Co
             $this->loadHtml();
             $this->loadHtml();
         }
         }
 
 
-        $this->setData($this->dataProvider->getData($this->columns));
+        $this->setData((array)$this->dataProvider->getData($this->columns));
     }
     }
     
     
     protected function parseDataRecords()
     protected function parseDataRecords()
@@ -169,9 +169,9 @@ class DataTable extends BaseContainer implements \ThurData\Servers\KerioEmail\Co
             return false;
             return false;
         }
         }
 
 
-        foreach ($this->recordsSet->records as $key => $row)
+        foreach ($this->recordsSet['records'] as $key => $row)
         {
         {
-            $this->recordsSet->records[$key] = $this->replaceRowData($row, $replacementFunctions);
+            $this->recordsSet['records'][$key] = $this->replaceRowData($row, $replacementFunctions);
         }
         }
     }
     }
 
 
@@ -210,9 +210,11 @@ class DataTable extends BaseContainer implements \ThurData\Servers\KerioEmail\Co
             
             
             return $this;
             return $this;
         }
         }
+        if (is_object($row))
+        {
+            $row->$colName = $value;
+        }
         
         
-        $row->$colName = $value;
-
         return $this;        
         return $this;        
     }    
     }