From 68733e1d15a3b3cca8f1dc4e7c78dba1cd756e81 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Mon, 16 Feb 2026 21:31:48 +0000
Subject: [PATCH] Add KSeF invoice attributes
---
src/UcrmAttributes.php | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/UcrmAttributes.php b/src/UcrmAttributes.php
index 5782706..a2f1c4e 100644
--- a/src/UcrmAttributes.php
+++ b/src/UcrmAttributes.php
@@ -3,10 +3,10 @@
namespace SIPL\UCRM\wFirma;
class UcrmAttributes {
- protected $attributesFile;
- protected $api;
+ protected string $attributesFile;
+ protected \Ubnt\UcrmPluginSdk\Service\UcrmApi $api;
- protected static $definition = [
+ protected static array $definition = [
'wFirma Customer ID' => [
'code' => 'client',
'type' => 'client',
@@ -15,12 +15,24 @@
'code' => 'invoice',
'type' => 'invoice',
],
+ 'KSeF Number' => [
+ 'code' => 'ksef-number',
+ 'type' => 'invoice',
+ ],
+ 'KSeF URL' => [
+ 'code' => 'ksef-url',
+ 'type' => 'invoice',
+ ],
+ 'KSeF QR Code' => [
+ 'code' => 'ksef-qr-code',
+ 'type' => 'invoice',
+ ],
'wFirma Payment ID' => [
'code' => 'payment',
'type' => 'payment',
],
];
- protected $ids = [];
+ protected array $ids = [];
function __construct(UcrmHelper $ucrmHelper) {
$this->attributesFile = $ucrmHelper->getRootDirectory() . '/data/attributes.json';
@@ -41,7 +53,7 @@
return $this->ids[$attributeCode];
}
- function updateMapping() {
+ function updateMapping(): bool {
$attributes = $this->api->get('/custom-attributes');
foreach ($attributes as $attribute) {
$data = self::$definition[$attribute['name']] ?? NULL;
@@ -71,7 +83,7 @@
return $changed;
}
- function saveMapping() {
+ function saveMapping(): void {
if (!is_dir(dirname($this->attributesFile))) {
mkdir(dirname($this->attributesFile));
}
--
Gitblit v1.10.0