Skip to content

Commit 533885a

Browse files
committed
Show IBAN formatted with spaces in between
1 parent 93742c3 commit 533885a

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

src/Entity/BankAccount.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ public function getIban(): ?string
9898
return $this->iban;
9999
}
100100

101+
/**
102+
* @return string|null The IBAN formatted with spaces between every 4 characters.
103+
*/
104+
public function getIbanFormatted(): string
105+
{
106+
return chunk_split($this->iban ?? '', 4, ' ');
107+
}
108+
101109
/**
102110
* Returns the IBAN of the bank account without spaces.
103111
* This is useful for SEPA exporter and other places where a IBAN in a machine-readable form is needed.

src/Entity/Embeddable/PayeeInfo.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,14 @@ public function getIban(): ?string
160160
return $this->iban;
161161
}
162162

163+
/**
164+
* @return string|null The IBAN formatted with spaces between every 4 characters.
165+
*/
166+
public function getIbanFormatted(): string
167+
{
168+
return chunk_split($this->iban ?? '', 4, ' ');
169+
}
170+
163171
/**
164172
* Returns the IBAN of the receivers bank account without spaces.
165173
* This is useful for SEPA exporter and other places where a IBAN in a machine-readable form is needed.

templates/pdf/payment_order/payment_order.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282

8383
<tr>
8484
<td>IBAN:</td>
85-
<td>{{ paymentOrder.bankInfo.iban }}</td>
85+
<td>{{ paymentOrder.bankInfo.ibanFormatted }}</td>
8686
</tr>
8787
<tr>
8888
<td>Verwendungszweck:</td>

0 commit comments

Comments
 (0)