Advertisement
epheterson

Simple Invoices Records

Mar 22nd, 2013
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.07 KB | None | 0 0
  1. Add to \modules\invoices\save.php
  2. Add to the bottom, just above the smarty stuff.
  3.  
  4. if($saved) {
  5.     // On every invoice update, archive a copy.
  6.     // Added by ELP on 3/22/2013
  7.    
  8.     $invoice = invoice::select($_POST['id']);
  9.    
  10.     //create PDF name
  11.     $spc2us_pref = str_replace(" ", "_", $invoice['index_name']);
  12.     $pdf_file_name = $spc2us_pref  . '.pdf';
  13.    
  14.     //$pdf_file_name = "Invoice_" . $_POST['id'] ;
  15.    
  16.     // Create invoice
  17.     $export = new export();
  18.     $export -> format = "pdf";
  19.     $export -> file_location = 'file';
  20.     $export -> module = 'invoice';
  21.     $export -> id = $_POST['id'];
  22.     $export -> execute();
  23.  
  24.     $email = new email();
  25.     $email -> format = 'invoice';
  26.     //$email -> notes = "Textual message would go here, if necessary.";
  27.     $email -> from = '[email protected]';  <-- PUT YOUR EMAIL HERE!
  28.     $email -> from_friendly = 'Invoice Record';  <-- CHOOSE A FROM NAME HERE!
  29.     $email -> to = '[email protected]';  <-- CHOOSE AN EMAIL TO SEND TO HERE!
  30.     //$email -> bcc = "[email protected]";
  31.     $email -> subject = $pdf_file_name;
  32.     $email -> attachment = $pdf_file_name;
  33.     $message = $email -> send ();
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement