andre 1 год назад
Родитель
Сommit
735df5e0fd

+ 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
          */
-        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;
     }
 

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

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