From 67e4ab9dfca8a5cf647b4204c6534546d029706a Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Tue, 17 Mar 2026 09:29:49 +0000
Subject: [PATCH] Rename attribute "KSeF QR Code" to "QR Code Generator URL"
---
src/InvoiceQrCodeSynchronizer.php | 29 +++++++++++++----------------
src/UcrmAttributes.php | 4 ++--
2 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/src/InvoiceQrCodeSynchronizer.php b/src/InvoiceQrCodeSynchronizer.php
index a782c2c..4d6ec9d 100644
--- a/src/InvoiceQrCodeSynchronizer.php
+++ b/src/InvoiceQrCodeSynchronizer.php
@@ -11,35 +11,32 @@
public function synchronize(string $ucrmInvoiceId, array $previousEntity = []): void {
$ksefUrlAttribute = $this->helper->getAttributes()->getIdForCode('ksef-url');
- $ksefQrCodeAttribute = $this->helper->getAttributes()->getIdForCode('ksef-qr-code');
+ $qrCodeGenUrlAttribute = $this->helper->getAttributes()->getIdForCode('qr-code-gen-url');
$invoice = $this->helper->getApi()->get('/invoices/' . $ucrmInvoiceId);
- $currentUrl = '';
- $currentQrCode = '';
+ $currentKsefUrl = '';
+ $currentQrCodeGenUrl = '';
foreach ($invoice['attributes'] ?? [] as $attribute) {
if ($attribute['customAttributeId'] == $ksefUrlAttribute) {
- $currentUrl = $attribute['value'];
+ $currentKsefUrl = $attribute['value'];
}
- if ($attribute['customAttributeId'] == $ksefQrCodeAttribute) {
- $currentQrCode = $attribute['value'];
+ if ($attribute['customAttributeId'] == $qrCodeGenUrlAttribute) {
+ $currentQrCodeGenUrl = $attribute['value'];
}
}
- $newQrCode = null;
- $expectedQrCodeUrl = $this->helper->getSelfUrl() . '_plugins/wfirma/public.php?barcode=';
- if ($currentUrl == '' && $currentQrCode != '') {
- $newQrCode = '';
- }
- if ($currentUrl != '' && $currentQrCode != $expectedQrCodeUrl) {
- $newQrCode = $expectedQrCodeUrl;
+ $newQrCodeGenUrl = null;
+ $expectedQrCodeGenUrl = $this->helper->getSelfUrl() . '_plugins/wfirma/public.php?barcode=';
+ if ($currentQrCodeGenUrl != $expectedQrCodeGenUrl) {
+ $newQrCodeGenUrl = $expectedQrCodeGenUrl;
}
- if ($newQrCode != null) {
+ if ($newQrCodeGenUrl != null) {
$this->helper->getApi()->patch('/invoices/' . $ucrmInvoiceId, [
'attributes' => [
[
- 'customAttributeId' => $ksefQrCodeAttribute,
- 'value' => $newQrCode,
+ 'customAttributeId' => $qrCodeGenUrlAttribute,
+ 'value' => $newQrCodeGenUrl,
],
],
]);
diff --git a/src/UcrmAttributes.php b/src/UcrmAttributes.php
index a2f1c4e..f8f9c67 100644
--- a/src/UcrmAttributes.php
+++ b/src/UcrmAttributes.php
@@ -23,8 +23,8 @@
'code' => 'ksef-url',
'type' => 'invoice',
],
- 'KSeF QR Code' => [
- 'code' => 'ksef-qr-code',
+ 'QR Code Generator URL' => [
+ 'code' => 'qr-code-gen-url',
'type' => 'invoice',
],
'wFirma Payment ID' => [
--
Gitblit v1.10.0