Merge pull request #9675 from thirstyice/v5-develop

Make $project.name defined as empty for invoices with no project
This commit is contained in:
David Bomba 2024-06-25 08:54:52 +10:00 committed by GitHub
commit 498a627988
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -169,6 +169,9 @@ class HtmlEngine
$data['$invoice.po_number'] = ['value' => $this->entity->po_number ?: ' ', 'label' => ctrans('texts.po_number')]; $data['$invoice.po_number'] = ['value' => $this->entity->po_number ?: ' ', 'label' => ctrans('texts.po_number')];
$data['$poNumber'] = &$data['$invoice.po_number']; $data['$poNumber'] = &$data['$invoice.po_number'];
$data['$po_number'] = &$data['$invoice.po_number']; $data['$po_number'] = &$data['$invoice.po_number'];
$data['$project.name'] = ['value' => $this->entity->project?->name ?: '', 'label' => ctrans('texts.project')];
$data['$entity.datetime'] = ['value' => $this->formatDatetime($this->entity->created_at, $this->client->date_format()), 'label' => ctrans('texts.date')]; $data['$entity.datetime'] = ['value' => $this->formatDatetime($this->entity->created_at, $this->client->date_format()), 'label' => ctrans('texts.date')];
$data['$invoice.datetime'] = &$data['$entity.datetime']; $data['$invoice.datetime'] = &$data['$entity.datetime'];
$data['$quote.datetime'] = &$data['$entity.datetime']; $data['$quote.datetime'] = &$data['$entity.datetime'];
@ -219,19 +222,14 @@ class HtmlEngine
$data['$credit.custom3'] = &$data['$invoice.custom3']; $data['$credit.custom3'] = &$data['$invoice.custom3'];
$data['$credit.custom4'] = &$data['$invoice.custom4']; $data['$credit.custom4'] = &$data['$invoice.custom4'];
if ($this->entity->project) { $data['$invoice.project'] = &$data['$project.name'];
$data['$project.name'] = ['value' => $this->entity->project->name, 'label' => ctrans('texts.project')]; $data['$quote.project'] = &$data['$project.name'];
$data['$invoice.project'] = &$data['$project.name'];
$data['$quote.project'] = &$data['$project.name'];
}
$data['$status_logo'] = ['value' => '<div class="stamp is-paid"> ' . ctrans('texts.paid') .'</div>', 'label' => '']; $data['$status_logo'] = ['value' => '<div class="stamp is-paid"> ' . ctrans('texts.paid') .'</div>', 'label' => ''];
$data['$show_paid_stamp'] = ['value' => $this->entity->status_id == 4 && $this->settings->show_paid_stamp ? 'flex' : 'none', 'label' => '']; $data['$show_paid_stamp'] = ['value' => $this->entity->status_id == 4 && $this->settings->show_paid_stamp ? 'flex' : 'none', 'label' => ''];
if ($this->entity->vendor) { $data['$invoice.vendor'] = ['value' => $this->entity->vendor?->present()->name() ?: '', 'label' => ctrans('texts.vendor_name')];
$data['$invoice.vendor'] = ['value' => $this->entity->vendor->present()->name(), 'label' => ctrans('texts.vendor_name')];
}
if (strlen($this->company->getSetting('qr_iban')) > 5) { if (strlen($this->company->getSetting('qr_iban')) > 5) {
try { try {
@ -276,16 +274,10 @@ class HtmlEngine
$data['$credit.custom3'] = &$data['$quote.custom3']; $data['$credit.custom3'] = &$data['$quote.custom3'];
$data['$credit.custom4'] = &$data['$quote.custom4']; $data['$credit.custom4'] = &$data['$quote.custom4'];
if ($this->entity->project) { $data['$invoice.project'] = &$data['$project.name'];
$data['$project.name'] = ['value' => $this->entity->project->name, 'label' => ctrans('texts.project')]; $data['$quote.project'] = &$data['$project.name'];
$data['$invoice.project'] = &$data['$project.name'];
$data['$quote.project'] = &$data['$project.name'];
} $data['$invoice.vendor'] = ['value' => $this->entity->vendor?->present()->name() ?: '', 'label' => ctrans('texts.vendor_name')];
if ($this->entity->vendor) {
$data['$invoice.vendor'] = ['value' => $this->entity->vendor->present()->name(), 'label' => ctrans('texts.vendor_name')];
}
} }
if ($this->entity_string == 'credit') { if ($this->entity_string == 'credit') {