Changing PDF Title

Hi there,

I have created a field ‘ClientID’ with an auto-increment on the relations (new field in studio and a trigger in the DB). That works perfectly. I now create invoices with a combination of the invoice title and the auto-increment value by using


This works perfectly. However, the PDF that’s being created only shows the aos_invoices_name. That’s because of this in generatePdf.php

$file_name = $mod_strings['LBL_PDF_NAME'] . "_" . str_replace(" ", "_", $bean->name) . ".pdf";

I would love to add the $billing_account_klantnummer in the .pdf creation as well. Anyone has any idea? Thanks in advance!

Well, you just need a way to reference it. That depends on what module it exists (is billing_account a custom module you created?), and what is the relationship between the invoice module and that one.

But it should be simple Bean stuff.

Another approach would be if you could get that full name into one of the invoice fields (like description, for example) and then get it directly from the invoice Bean.

Sorry for my late reply! As far as I know billing_account is not a custom module. It’s the relation module. So there is already a relation. The klantnummer is a custom field, so that’s in accounts_cstm.

In my invoice I have in one column “Invoicename” and in the other column $billing_account_klantnummer_c-$aos_invoices_name (I wanted to attach it but neither on Chrome nor on Safari does the Add File button work, so please see

I have no clue whatsoever how to get that name in the .pdf generator.

From a quick look at the file, I think it will work if you simply reference


so that line setting the file_name could be something like

$file_name = $mod_strings['LBL_PDF_NAME'] . "_" . $bean->$billing_account_klantnummer_c . "_" . str_replace(" ", "_", $bean->name) . ".pdf";

Sadly, that doesn’t work. With adding that it simply doesn’t generate any PDF files.

What is the error in php_errors.log (the Apache log)?

None. I’m using nginx btw, but php5-fpm.log doesn’t give any errors

Maybe you need to get some help from a PHP developer. If you could use a debugger and check all the fields available in that bean, you would get it quickly.

If you want to explore anyway, try this from your SuiteCRM root directory:

grep -irn 'billing_account_klantnummer_c'

… and try to figure out how that field is called in the Bean, and in which module it exists.

Sorry, before anything, try fixing my code:

$file_name = $mod_strings['LBL_PDF_NAME'] . "_" . $bean->billing_account_klantnummer_c . "_" . str_replace(" ", "_", $bean->name) . ".pdf";

I removed a dollar sign before “billing”, I hope it works now.

Yes and no - it’s generating a file now, however, the title is empty (so instead of giving Invoice_8303_201801.pdf its giving Invoice__201801.pdf