Browse Source

edit ressource

andre 2 năm trước cách đây
mục cha
commit
d93994ed75

+ 23 - 1
app/UI/Client/Ressource/Providers/EditRessourceDataProvider.php

@@ -75,8 +75,30 @@ class EditRessourceDataProvider extends BaseDataProvider
             );
             );
             return ['error' => $error->getMessage()];
             return ['error' => $error->getMessage()];
         }
         }
+        $attr = array(
+            "id",
+            "loginName",
+            "isEnabled");
+        try {
+            $users = $api->getUsers($attr,$domainID);
+        } catch (KerioApiException $error) {
+            logModuleCall(
+                'kerioEmail',
+                __FUNCTION__,
+                $error,
+                'Debug Error',
+                $error->getMessage()
+            );
+            return ['error' => $error->getMessage()];
+        }
         $api->logout();
         $api->logout();
 
 
+        foreach($users as $user) {
+            if($user['isEnabled']){
+                $this->availableValues['manager'][ $user['id']] = $user['loginName'] . '@' . $this->getWhmcsParamByKey('domain');
+            }
+        }
+
         $lang = di('lang');
         $lang = di('lang');
         $this->data['id']            = $ressource[0]['id'];
         $this->data['id']            = $ressource[0]['id'];
         $this->data['name']          = $ressource[0]['name'];
         $this->data['name']          = $ressource[0]['name'];
@@ -84,7 +106,7 @@ class EditRessourceDataProvider extends BaseDataProvider
         $this->data['status']        = $ressource[0]['isEnabled'] == true ? Kerio::ACC_STATUS_ACTIVE : Kerio::ACC_STATUS_CLOSED;
         $this->data['status']        = $ressource[0]['isEnabled'] == true ? Kerio::ACC_STATUS_ACTIVE : Kerio::ACC_STATUS_CLOSED;
         $this->data['type']          = $ressource[0]['type'] === 'Room' ? di('lang')->absoluteT('kerio','ressource','type','location') : di('lang')->absoluteT('kerio','ressource','type','equipment');;
         $this->data['type']          = $ressource[0]['type'] === 'Room' ? di('lang')->absoluteT('kerio','ressource','type','location') : di('lang')->absoluteT('kerio','ressource','type','equipment');;
         $this->data['description']   = $ressource[0]['description'];
         $this->data['description']   = $ressource[0]['description'];
-        $this->data['manager']       = [ $ressource[0]['manager']['id'] => $ressource[0]['manager']['name'] . '@' . $ressource[0]['manager']['domainName'] ];
+        $this->data['manager']       = $ressource[0]['manager']['name'] . '@' . $ressource[0]['manager']['domainName'];
 
 
         logModuleCall(
         logModuleCall(
             'kerioEmail',
             'kerioEmail',