mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-20 08:21:34 +02:00
Fixes for QR Ibans with no payment references
This commit is contained in:
parent
2845f2c79e
commit
895bb8deef
@ -26,6 +26,7 @@ class CompanySettings extends BaseSettings
|
||||
public $auto_archive_invoice = false; // @implemented
|
||||
|
||||
public $qr_iban = ''; //@implemented
|
||||
|
||||
public $besr_id = ''; //@implemented
|
||||
|
||||
public $lock_invoices = 'off'; //off,when_sent,when_paid //@implemented
|
||||
|
@ -104,16 +104,32 @@ class SwissQrGenerator
|
||||
|
||||
// Add payment reference
|
||||
// This is what you will need to identify incoming payments.
|
||||
$referenceNumber = QrBill\Reference\QrPaymentReferenceGenerator::generate(
|
||||
$this->company->present()->besr_id() ?: '', // You receive this number from your bank (BESR-ID). Unless your bank is PostFinance, in that case use NULL.
|
||||
$this->invoice->number// A number to match the payment with your internal data, e.g. an invoice number
|
||||
);
|
||||
|
||||
$qrBill->setPaymentReference(
|
||||
QrBill\DataGroup\Element\PaymentReference::create(
|
||||
QrBill\DataGroup\Element\PaymentReference::TYPE_QR,
|
||||
$referenceNumber
|
||||
));
|
||||
if(strlen($this->company->present()->besr_id()) > 1)
|
||||
{
|
||||
nlog("i have a besr");
|
||||
|
||||
$referenceNumber = QrBill\Reference\QrPaymentReferenceGenerator::generate(
|
||||
$this->company->present()->besr_id() ?: '', // You receive this number from your bank (BESR-ID). Unless your bank is PostFinance, in that case use NULL.
|
||||
$this->invoice->number// A number to match the payment with your internal data, e.g. an invoice number
|
||||
);
|
||||
|
||||
$qrBill->setPaymentReference(
|
||||
QrBill\DataGroup\Element\PaymentReference::create(
|
||||
QrBill\DataGroup\Element\PaymentReference::TYPE_QR,
|
||||
$referenceNumber
|
||||
));
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
nlog("i have no besr");
|
||||
$qrBill->setPaymentReference(
|
||||
QrBill\DataGroup\Element\PaymentReference::create(
|
||||
QrBill\DataGroup\Element\PaymentReference::TYPE_NON
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
// Optionally, add some human-readable information about what the bill is for.
|
||||
$qrBill->setAdditionalInformation(
|
||||
@ -141,6 +157,8 @@ class SwissQrGenerator
|
||||
nlog($violation);
|
||||
}
|
||||
|
||||
nlog($e->getMessage());
|
||||
|
||||
return '';
|
||||
// return $e->getMessage();
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ class HtmlEngine
|
||||
$data['$invoice.vendor'] = ['value' => $this->entity->vendor->present()->name(), 'label' => ctrans('texts.vendor_name')];
|
||||
}
|
||||
|
||||
if(strlen($this->company->getSetting('qr_iban')) > 5 && strlen($this->company->getSetting('besr_id')) > 1)
|
||||
if(strlen($this->company->getSetting('qr_iban')) > 5)
|
||||
{
|
||||
try{
|
||||
$data['$swiss_qr'] = ['value' => (new SwissQrGenerator($this->entity, $this->company))->run(), 'label' => ''];
|
||||
|
Loading…
Reference in New Issue
Block a user