Emailed PDF Attachments Are Blank
  • jason331jason331 February 4

    Help!

    I've been trying to customize the names of emailed receipts and I'm not sure if I might have caused this or not but all my emailed PDF receipts and invoices are now 64b blank files. I'm not sure where to start looking to fix this problem. Can anybody please help?

  • mjnshostingmjnshosting February 5

    Where did you make your customizations? Was it done in the database itself or a file?
    What values were changed? Do you have a backup of your DB?

    A+,CCENT,CCNA and business owner tired of exporting XLS to PDF to a SMB share and calling it accounting! :)
    Ubuntu 10.04 LTS in VM on Proxmox (sweet!)
  • jason331jason331 February 5

    Which files are responsible for generating the actual PDF?

    No changes have been made to the database and I do have backups. I changed the following files:

    line 356 in public_html/invoice/include/classcron.php:
    From: $email -> subject = $email->set_subject();
    To: $email -> subject = date('F Y')." Invoice";

    Line 306 in public_html/invoice/include/classcron.php:
    From: $spc2us_pref = str_replace(" ", "_", $invoice['index_name']);
    To: $spc2us_pref = str_replace(" ", "_", date('F Y'));

    Line 213 in public_html/invoice/include/class/export.php:
    From: $spc2us_pref = str_replace(" ", "_", $invoice['index_name']);
    To: $spc2us_pref = str_replace(" ", "_", date('F Y'));

    I also changed public_html/invoice/include/class/email/body.php to the following:

    <?php<br />class email_body {

    public function create()
    {

    switch ($this->email_type)
    {
    case "cron_payment":
    {

    $email_body = <<<EOT<br />Hi $this->customer_name,




    Attached is a PDF copy of this month's invoice.




    Thanks!




    My Name


    $this->biller_name


    XXX-XXX-XXXX (office)


    XXX-XXX-XXXX (cell)
    EOT;
    break;
    }

    case "cron_invoice_reprint":
    {

    $email_body = <<<EOT<br />Hi $this->customer_name,




    Attached is a PDF copy of this month's invoice.




    Thanks!




    My Name


    $this->biller_name


    XXX-XXX-XXXX (office)


    XXX-XXX-XXXX (cell)
    EOT;
    break;
    }
    case "cron_invoice":
    default:
    {

    $email_body = <<<EOT<br />Hi $this->customer_name,




    Attached is a PDF copy of this month's invoice.




    Thanks!




    My Name


    $this->biller_name


    XXX-XXX-XXXX (office)


    XXX-XXX-XXXX (cell)
    EOT;
    }
    }

    return $email_body;
    }

    }

  • jason331jason331 February 6

    OK, I did some more testing after reinstalling from a fresh copy of the source files. It seems that when I change line 306 in public_html/invoice/include/class/cron.php:

    From: $spc2us_pref = str_replace(" ", "_", $invoice['index_name']);
    To: $spc2us_pref = str_replace(" ", "_", date('F Y'));

    and:

    Line 213 in public_html/invoice/include/class/export.php:
    From: $spc2us_pref = str_replace(" ", "_", $invoice['index_name']);
    To: $spc2us_pref = str_replace(" ", "_", date('F Y'));

    ...the problem occurs. How can I change my file names without breaking PDF generation?

  • mjnshostingmjnshosting February 7

    That im unsure of cause of my lack of knowledge with this sort of thing. One thought is where is the index_name defined from and is the substitution you present understood in this case. It looks like the previous entry called a value that may have been addressed earlier or passed with an include. I do like your use for this as invoices with dates generated is kinda the norm and good for tracking purposes.

    A+,CCENT,CCNA and business owner tired of exporting XLS to PDF to a SMB share and calling it accounting! :)
    Ubuntu 10.04 LTS in VM on Proxmox (sweet!)
  • jason331jason331 February 9

    I fixed the problem...

    per http://www.simpleinvoices.org/forum/discussion/comment/7239/#Comment_7239, I had to also modify public_html/modules/invoices/email.php with the exact same changes as made above. Once I did that my attachments started working correctly with the correct naming convention (date.pdf).

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

Categories