aabbb0e5 by Jeff Balicki

invoices

1 parent 8d381d01
...@@ -5,6 +5,8 @@ use Tz\WordPress\CBV; ...@@ -5,6 +5,8 @@ use Tz\WordPress\CBV;
5 use Tz\WordPress\CBV\User; 5 use Tz\WordPress\CBV\User;
6 use Tz\WordPress\Tools; 6 use Tz\WordPress\Tools;
7 use Tz\WordPress\Tools\Sequencer; 7 use Tz\WordPress\Tools\Sequencer;
8 use Tz\WordPress\CBV\Invoice;
9
8 10
9 const OPTION_NAME = 'notif_options'; 11 const OPTION_NAME = 'notif_options';
10 const NOTIFICATION_STATUS_READ = 'read'; 12 const NOTIFICATION_STATUS_READ = 'read';
...@@ -421,6 +423,10 @@ function send_triggered_notification($uid = 0, $trigger = 'NO_TRIGGER', $args = ...@@ -421,6 +423,10 @@ function send_triggered_notification($uid = 0, $trigger = 'NO_TRIGGER', $args =
421 } 423 }
422 424
423 } 425 }
426 if(isset($args['invoice_id'])){
427 $invoiceView = new Invoice\InvoiceView();
428 $pdf = $invoiceView->pdf_create($args['invoice_id']);
429 }
424 430
425 $contents = $email; 431 $contents = $email;
426 432
...@@ -524,7 +530,9 @@ function send_triggered_notification($uid = 0, $trigger = 'NO_TRIGGER', $args = ...@@ -524,7 +530,9 @@ function send_triggered_notification($uid = 0, $trigger = 'NO_TRIGGER', $args =
524 $att1 = isset($attachments[0]) ? $attachments[0] : ''; 530 $att1 = isset($attachments[0]) ? $attachments[0] : '';
525 $att2 = isset($attachments[1]) ? $attachments[1] : ''; 531 $att2 = isset($attachments[1]) ? $attachments[1] : '';
526 $att3 = isset($attachments[2]) ? $attachments[2] : ''; 532 $att3 = isset($attachments[2]) ? $attachments[2] : '';
527 533 if($pdf !=""){
534 $attachments[0] = $pdf;
535 }
528 $attachments = array_map( 536 $attachments = array_map(
529 function ($attachmentPath) { 537 function ($attachmentPath) {
530 return realpath(__DIR__ . '/../../../uploads/notifications/' . $attachmentPath); 538 return realpath(__DIR__ . '/../../../uploads/notifications/' . $attachmentPath);
......