Jacek Kowalski
2026-03-31 797f70689539add5d9a891f8234a29b29a79cf3d
src/UcrmHelper.php
@@ -2,6 +2,8 @@
namespace SIPL\UCRM\wFirma;
use Ubnt\UcrmPluginSdk\Service\UcrmOptionsManager;
class UcrmHelper {
   protected string $rootDirectory;
   protected ?\Ubnt\UcrmPluginSdk\Service\UcrmApi $api = NULL;
@@ -12,7 +14,7 @@
   function __construct(?string $rootDirectory = NULL) {
      if ($rootDirectory === NULL) {
         $rootDirectory = __DIR__ . '/..';
         $rootDirectory = dirname(__DIR__);
      }
      $this->rootDirectory = $rootDirectory;
   }
@@ -28,6 +30,12 @@
      return $this->api;
   }
   function getSelfUrl(): string {
      $ucrmOptionsManager = new UcrmOptionsManager($this->rootDirectory);
      $options = $ucrmOptionsManager->loadOptions();
      return $options->ucrmLocalUrl ?? $options->ucrmPublicUrl ?? '';
   }
   function getAttributes(): UcrmAttributes {
      if ($this->attributes === NULL) {
         $this->attributes = new UcrmAttributes($this);