From 478aa15a9dcf86dff9408694f4450244f217cbe9 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Mon, 16 Feb 2026 21:31:48 +0000
Subject: [PATCH] Release version 4.0

---
 src/UcrmHelper.php |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/UcrmHelper.php b/src/UcrmHelper.php
index 830c923..d5f2eeb 100644
--- a/src/UcrmHelper.php
+++ b/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);

--
Gitblit v1.10.0