1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Ensure correct pattern for non-invoice entities

A simple `in_array` check would work here, except there are a lot of
valid keys for the number pattern settings so it's easier this way.
This commit is contained in:
Dave Shoreman 2024-05-29 17:06:44 +01:00
parent e1d08d34bf
commit bd49aa1a15
No known key found for this signature in database
GPG Key ID: C920D1D63709F443

View File

@ -208,13 +208,19 @@ class PdfMock
*/
public function getStubVariables(): array
{
// Although $this->mock is the Invoice/etc entity, we need the invitation to get company details.
$entity_number = $this->getFormattedEntityNumber(
$this->mock->invitation,
29,
$this->settings->counter_padding,
$this->settings->invoice_number_pattern
);
$entity_pattern = $this->entity_string.'_number_pattern';
$entity_number = '0029';
if (!empty($this->settings->{$entity_pattern})) {
// Although $this->mock is the Invoice/etc entity,
// we need the invitation to get company details.
$entity_number = $this->getFormattedEntityNumber(
$this->mock->invitation,
(int) $entity_number,
$this->settings->counter_padding,
$this->settings->{$entity_pattern},
);
}
return ['values' =>
[