Remove date from filename

Hi,

at this moment my invoices have a filename with the Date like this: 2023-07-05_Rechnung_41_2023

how do i become the filename like this: 41_2023_Name client

Invoicenumber_Client name

at the moment i still use 1.5.11.

I have read Generated Invoice Filename from April 2017 but do not really understand

Any help is appriciated!

Great question!
Open your InvoicePlane files. It’s usually a .zip file you have downloaded
Find this file: application/helpers/pdf_helper.php

Then report back after you have found that file.
If you can’t find the .zip file, check the downloads section of the invoiceplane.com website or check github.com. we have a releases section on github and it also has version 1.5.11

Let us know after you’ve found that file

Yes i found the file… but i do not have a lot of knowledge, if it is row 105…??

how do i change there…

Just copy from 10 rows above row 105 to 10 rows under 105, so from 95 to 115
And paste it here.

Keep in mind that this will be your goal:

return pdf_create($html, trans('invoice') . '_' . str_replace(array('\\', '/'), '_', $invoice->invoice_number)

this is from row 95 until 115:

        'items' => $items,
        'payment_method' => $payment_method,
        'output_type' => 'pdf',
        'show_item_discounts' => $show_item_discounts,
        'custom_fields' => $custom_fields,
    );

    $html = $CI->load->view('invoice_templates/pdf/' . $invoice_template, $data, true);

    $CI->load->helper('mpdf');
    return pdf_create($html, trans('invoice') . '_' . str_replace(array('\\', '/'), '_', $invoice->invoice_number),
        $stream, $invoice->invoice_password, true, $is_guest, $include_zugferd, $associatedFiles);
}

function generate_invoice_sumex($invoice_id, $stream = true, $client = false)
{
    $CI = &get_instance();

    $CI->load->model('invoices/mdl_items');
    $invoice = $CI->mdl_invoices->get_by_id($invoice_id);
    $CI->load->library('Sumex', array(
1 Like

I’m sorry, but your situation is really strange. Do 2 things:

  1. open application/helpers/mpdf_helper.php
    You might need to change something there

  2. can you set your language back to English? Let’s see if your filename changes and in which way

first i want to start to thank you for your help!

the only change is that the filename is changed in invoice…

2023-07-10_invoice_42_2023.pdf, in german it is 2023-07-10_Rechnung_42_2023.

i hope you understand my question (my englisch is not verry good) the only thing i want (hope) to change is that the date at start of the filename is gone… Rechnung_42_2023.pdf

and if it was possible also the name of the customer at the end. ie. Rechnung_42_2023_name customer.pdf

Ok, you can place your own language back.
Now, your next challenge:
Grab those files from the server, not from that .zip file you might have done.

Let’s translate this code for you:
pdf_create($html, trans('invoice') . '_' . str_replace(array('\\', '/'), '_', $invoice->invoice_number)
Let’s say it says:
“create an invoice with the translated word of ‘invoice’ AND after that place the invoice number, nothing more, nothing less”

What you have right now is:
“create an invoice with ADD A DATE FIRST, then the translated word of ‘invoice’ AND after that place the invoice number”

Where that date came from? Really really strange.
Second problem is client name in the filename.
Good idea, but i didn’t see it at the moment.

Would you like to copy/paste those lines, surrounding return pdf_create($html, trans('invoice') . '.
Let’s make it 15 lines above, 15 lines under that line.

hi, i´m a step furter, i try so many things… i just find out that if i send the mail there is the moment there is a date in front of the file… if i working on an invoice and download the pdf there is no Date in Front !!!

just with sending the invoice…

1 Like

Hi,

i´m try to help myself, …

i foundout something, in application/helpers/mpdf_helper row 117

 $archived_file = UPLOADS_ARCHIVE_FOLDER . date('Y-m-d') . '_' . $filename . '.pdf';

i notice that when i change the date format to date('d-m-Y') also my filename takeover this date format when E-Mail is sending…

is this code in this row important for any things in the software or may i changed in:

$archived_file = UPLOADS_ARCHIVE_FOLDER . $filename . '.pdf';

Great, great job!
Go ahead and change that line.

Just keep in mind that every time you updat InvoicePlane, you have to change that line back to your preference (without that date)

So if your server goes to PHP 8.1, just remember your own beautiful solution

Thank you for your patience…!!! and thanks for your Help!!!

1 Like