Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] PDF file name modification
07-30-2015, 12:58 AM, (This post was last modified: 08-06-2015, 07:23 AM by bytebitter.)
#1
[Solved] PDF file name modification
Hello All,

First post as a new webERP user so may I first say thanks for this lovely open source accounting software Smile

So far I think I have managed to set up most things correctly (time will tell...) & am now using 'live' data. I would like to iron out a couple of things one of which is the PDF file name given to attachments. Can anyone please advise which files I need to edit to put, say, My_Company_Name_Ltd_Invoice_3.pdf instead of the current naming scheme?

Thank you,
Rgds,
Mark.
Reply
07-30-2015, 06:46 AM,
#2
RE: PDF file name modification
For outgoing invoices: PrintCustTransPortrait.php or PrintCustTrans.php depending on your paper orientation.
Reply
08-05-2015, 07:33 AM,
#3
RE: PDF file name modification
(07-30-2015, 06:46 AM)agaluski Wrote: For outgoing invoices: PrintCustTransPortrait.php or PrintCustTrans.php depending on your paper orientation.

Thanks for file names above, however, what I was really after was code assistance manipulating the above to remove 'hostname'_'dbname'_Invoice_X.pdf to simply CompanyName_Invoice_X.pdf
Am I correct in thinking that the first part of the file name is pulled from $session.inc?

Thanks.
Reply
08-05-2015, 08:07 AM, (This post was last modified: 08-05-2015, 08:16 AM by phil.)
#4
RE: PDF file name modification
Well currently the code uses (PrintCustTrans.php)

Code:
$pdf->OutputD($_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $FromTransNo . '.pdf');

So if the name of the company database is say YourCompanyName
and the transaction being printed is an "Invoice" not a "Credit Note"
and the invoice is number 1000

Then the pdf would be named

Code:
YourCompanyName_Invoice_1000.pdf

It sounds as though this is what you want?

perhaps your host is making you use a crazy database name for the company.... in which case you might elect to change $_SESSION['DatabaseName'] to hard code it or use $CompanyRecord['coyname'] which might have spaces or other characters that could cause trouble ...

so you could refine a bit to lose the spaces and replace with underscores...

str_replace(" ","_",$CompanyRecord['coyname'])
Phil Daintree
webERP Admin
Logic Works Ltd
http://www.logicworks.co.nz
Reply
08-05-2015, 08:43 AM,
#5
RE: PDF file name modification
(08-05-2015, 08:07 AM)phil Wrote: Then the pdf would be named

Code:
YourCompanyName_Invoice_1000.pdf

It sounds as though this is what you want?

perhaps your host is making you use a crazy database name for the company

Hello Phil,
Many thanks for the reply. Yes, this cPanel host appears to be combining the account name with the db name. I'd thought of renaming the db to 'fix' part of the problem but it would only solve half of it.
I shall try your suggestion tomorrow & post the result.
Cheers,
Mark.
Reply
08-06-2015, 07:20 AM,
#6
[Solved] RE: PDF file name modification
OK, I've obtained the result I was looking for by hardcoding as suggested:
$pdf->OutputD('MyCompanyName_Ltd_' . $InvOrCredit . '_' . $FromTransNo . '.pdf');

Thank you for your assistance.
Kind Regards,
Mark.
Reply
08-06-2015, 08:08 PM,
#7
RE: [Solved] PDF file name modification
There is a quicker solution

in PrintCustTransPortrait.php replace this line (approx #471)

$pdf->OutputD($_SESSION['DatabaseName'] . '_' . $InvOrCredit . '_' . $FromTransNo . '.pdf');

with this one

$pdf->OutputD($_SESSION['CompanyRecord']['coyname'] . '_-_' . $InvOrCredit . '_' . $FromTransNo . '.pdf');
Reply
08-07-2015, 10:23 PM,
#8
RE: [Solved] PDF file name modification
Noted.
Thank you @Kosta Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)