Browse Source

list ressources

andre 2 years ago
parent
commit
96326e4243
1 changed files with 16 additions and 3 deletions
  1. 16 3
      app/UI/Client/Ressource/Pages/Ressources.php

+ 16 - 3
app/UI/Client/Ressource/Pages/Ressources.php

@@ -187,27 +187,40 @@ class Ressources extends DataTable implements ClientArea
             return ['error' => $error->getMessage()];
             return ['error' => $error->getMessage()];
         }
         }
 
 
-        $api->logout();
         /**
         /**
          * format model to array
          * format model to array
          */
          */
         $data = [];
         $data = [];
         foreach ($ressources as $ressource)
         foreach ($ressources as $ressource)
         {
         {
-            /* @var $account Ressource */
+            try {
+                $manager = $api->getUserById($ressource['manager']['id'], $domainID);
+            } catch (KerioApiException $error) {
+                logModuleCall(
+                    'kerioEmail',
+                    __FUNCTION__,
+                    $error,
+                    'Debug Error',
+                    $error->getMessage()
+                );
+                return ['error' => $error->getMessage()];
+            }
 
 
             $ressourceArray = [
             $ressourceArray = [
                 'id'           => $ressource['id'],
                 'id'           => $ressource['id'],
                 'ressource'    => $ressource['name'],
                 'ressource'    => $ressource['name'],
                 'description'  => $ressource['description'],
                 'description'  => $ressource['description'],
                 'type'         => $ressource['type'],
                 'type'         => $ressource['type'],
-                'manager'      => $ressource['manager']['id'],
+                'manager'      => $manager['name'],
                 'status'       => $ressource['isEnabled'] ? 'active' : 'default'
                 'status'       => $ressource['isEnabled'] ? 'active' : 'default'
             ];
             ];
 
 
             $data[] = $ressourceArray;
             $data[] = $ressourceArray;
         }
         }
 
 
+        $api->logout();
+
+
         logModuleCall(
         logModuleCall(
             'kerioEmail',
             'kerioEmail',
             __FUNCTION__,
             __FUNCTION__,