Skip to content
Code-Schnipsel Gruppen Projekte
Commit 8552a2dc erstellt von Patrick Müller's avatar Patrick Müller
Dateien durchsuchen

fix: hash re-generation on invoice post in case of duplicate hashes

Übergeordneter 88976e3d
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
Keine zugehörigen Merge Requests gefunden
...@@ -1651,6 +1651,11 @@ ...@@ -1651,6 +1651,11 @@
<groups name="quiqqer/invoice" datatype="php"> <groups name="quiqqer/invoice" datatype="php">
<locale name="history.InvoiceTemporary.new_hash_on_post">
<de><![CDATA[Bei Buchung der Rechnung musste eine neue Vorgangsnummer ("Hash") generiert werden, da bereits ein anderer Rechnungs-Entwurf mit identischer Vorgangsnummer vorlag. Vorherige Vorgangsnummer: [oldHash] | Neue Vorgangsnummer: [newHash]]]></de>
<en><![CDATA[When posting the invoice, a new procedure number ("hash") had to be generated because another invoice draft with an identical procedure number already existed. Previous procedure number: [oldHash] | New procedure number: [newHash]]]></en>
</locale>
<locale name="OutputProvider.epc_qr_code_purpose"> <locale name="OutputProvider.epc_qr_code_purpose">
<de><![CDATA[Rechnung [invoiceNo]]]></de> <de><![CDATA[Rechnung [invoiceNo]]]></de>
<en><![CDATA[Invoice [invoiceNo]]]></en> <en><![CDATA[Invoice [invoiceNo]]]></en>
......
...@@ -1291,17 +1291,25 @@ public function post($PermissionUser = null): Invoice ...@@ -1291,17 +1291,25 @@ public function post($PermissionUser = null): Invoice
// check if hash already exists // check if hash already exists
try { try {
$oldHash = $this->getAttribute('hash'); $oldHash = $this->getAttribute('hash');
$HashCheckInvoice = Handler::getInstance()->getInvoiceByHash($oldHash);
Handler::getInstance()->getInvoiceByHash($oldHash); if ($HashCheckInvoice instanceof InvoiceTemporary &&
$HashCheckInvoice->getCleanId() !== $this->getCleanId()) {
// if invoice hash exist, we need a new hash
$this->setAttribute('hash', QUI\Utils\Uuid::get());
// if invoice hash exist, we need a new hash $this->getComments()->addComment(
$this->setAttribute('hash', QUI\Utils\Uuid::get()); QUI::getLocale()->get(
$this->getComments()->addComment( 'quiqqer/invoice',
'A new hash has been created. The hash already existed.'. 'history.InvoiceTemporary.new_hash_on_post',
'Old Hash: '.$oldHash. [
'New Hash: '.$this->getAttribute('hash') 'oldHash' => $oldHash,
); 'newHash' => $this->getAttribute('hash')
]
)
);
}
} catch (QUI\Exception $Exception) { } catch (QUI\Exception $Exception) {
QUI\System\Log::writeDebugException($Exception); QUI\System\Log::writeDebugException($Exception);
} }
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren