1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Fixes for naming PDFs

This commit is contained in:
David Bomba 2021-03-24 09:28:42 +11:00
parent 63655f7076
commit 89598d44ef
2 changed files with 5 additions and 1 deletions

View File

@ -795,6 +795,8 @@ class InvoiceController extends BaseController
$file_path = $invoice->service()->getInvoicePdf($contact);
nlog($file_path);
return response()->download($file_path, basename($file_path));
}

View File

@ -191,7 +191,9 @@ class BaseModel extends Model
public function numberFormatter()
{
$formatted_number = mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $this->number);
$number = strlen($this->number) > 1 ? $this->number : class_basename($this);
$formatted_number = mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $number);
// Remove any runs of periods (thanks falstro!)
$formatted_number = mb_ereg_replace("([\.]{2,})", '', $formatted_number);