Skip to content
Code-Schnipsel Gruppen Projekte
Bestätigt Commit fb1dc5ce erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

feat: invoice#147

Übergeordneter 8686a8de
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
2 Merge Requests!63Next,!62Dev
Pipeline-Nr. 6096 bestanden
......@@ -139,6 +139,14 @@
Please install quiqqer/invoice to create invoices.
]]></en>
</locale>
<locale name="exception.to.invoice.missing.payment">
<de><![CDATA[
Bitte fügen Sie eine Zahlungsmethode zur Bestellung hinzu, um die Rechnungserstellung abzuschließen.
]]></de>
<en><![CDATA[
Please add a payment method to the order to complete the billing process.
]]></en>
</locale>
<locale name="exception.missing.address.for.invoice">
<de><![CDATA[
Leider konnte die Rechnung nicht erstellt werden. Bitte gebe alle erforderlichen Adressdaten an.
......
......@@ -108,27 +108,35 @@ public function createInvoice($PermissionUser = null)
}
if (!Settings::getInstance()->isInvoiceInstalled()) {
throw new QUI\Exception([
'quiqqer/order',
'exception.invoice.is.not.installed'
]);
throw new QUI\Exception(['quiqqer/order', 'exception.invoice.is.not.installed']);
}
// check if order has an invoice address
// invoice creation is only possible with an address
$InvoiceAddress = $this->getInvoiceAddress();
if (
$addressRequired = QUI\ERP\Accounting\Invoice\Utils\Invoice::addressRequirement();
$addressThreshold = QUI\ERP\Accounting\Invoice\Utils\Invoice::addressRequirementThreshold();
$Calculation = $this->getPriceCalculation();
if ($addressRequired === false && $Calculation->getSum()->value() > $addressThreshold) {
$addressRequired = true;
}
$missingAddress = (
$InvoiceAddress->getName() === ''
|| $InvoiceAddress->getAttribute('street_no') === ''
|| $InvoiceAddress->getAttribute('zip') === ''
|| $InvoiceAddress->getAttribute('city') === ''
|| $InvoiceAddress->getAttribute('country') === ''
) {
throw new QUI\Exception([
'quiqqer/order',
'exception.missing.address.for.invoice'
]);
);
if ($addressRequired && $missingAddress) {
throw new QUI\Exception(['quiqqer/order', 'exception.missing.address.for.invoice']);
}
if (!$this->getPayment()) {
throw new QUI\Exception(['quiqqer/order', 'exception.to.invoice.missing.payment']);
}
if ($PermissionUser === null) {
......
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