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
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -1651,6 +1651,11 @@
<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">
<de><![CDATA[Rechnung [invoiceNo]]]></de>
<en><![CDATA[Invoice [invoiceNo]]]></en>
......
......@@ -1291,17 +1291,25 @@ public function post($PermissionUser = null): Invoice
// check if hash already exists
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->setAttribute('hash', QUI\Utils\Uuid::get());
$this->getComments()->addComment(
'A new hash has been created. The hash already existed.'.
'Old Hash: '.$oldHash.
'New Hash: '.$this->getAttribute('hash')
);
$this->getComments()->addComment(
QUI::getLocale()->get(
'quiqqer/invoice',
'history.InvoiceTemporary.new_hash_on_post',
[
'oldHash' => $oldHash,
'newHash' => $this->getAttribute('hash')
]
)
);
}
} catch (QUI\Exception $Exception) {
QUI\System\Log::writeDebugException($Exception);
}
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren