Multiple email accounts on contacts didn't work in sales documents
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 26 Dec 2011 09:16:11 +0000 (10:16 +0100)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Mon, 26 Dec 2011 09:16:11 +0000 (10:16 +0100)
reporting/includes/pdf_report.inc
reporting/rep107.php
reporting/rep109.php
reporting/rep110.php
reporting/rep111.php
reporting/rep113.php

index e4b4c3a66c58d398e630aeec436fb847ff90c37b..ee79d43e2e4173304deb5f008c6e0774dbef46ec 100644 (file)
@@ -980,6 +980,7 @@ class FrontReport extends Cpdf
                                        display_error(_("You have no email contact defined for this type of document"));
                                } else {
                                        $sent = $try = 0;
+                                       $emails = "";
                                        if(!$subject)
                                                $subject = $this->formData['document_name'] . ' '. $this->formData['document_number'];
                                        foreach($this->contactData as $contact) {
@@ -1018,6 +1019,7 @@ class FrontReport extends Cpdf
                                        $mail->subject($subject);
                                        $mail->text($msg . $sender);
                                        $mail->attachment($fname);
+                                       $emails .= " " . $contact['email'];
                                        if ($mail->send()) $sent++;
                                        } // foreach contact
                                        unlink($fname);
@@ -1026,10 +1028,10 @@ class FrontReport extends Cpdf
                                                display_error(_("There is no contact email set for this document type."));
                                        } elseif (!$sent)
                                                display_error($this->title . " " . $this->formData['document_number'] . ". "
-                                                       . _("Sending document by email failed") . ". " . _("Email:") . " " . $contact['email']);
+                                                       . _("Sending document by email failed") . ". " . _("Email:") . $emails);
                                        else
                                                display_notification($this->title . " " . $this->formData['document_number'] . " " 
-                                                       . _("has been sent by email to destination.") . " " . _("Email:") . " " . $contact['email']);
+                                                       . _("has been sent by email to destination.") . " " . _("Email:") . $emails);
                                }
                        }
                        else
index 17fbd69dd3640d7b734c39eae78562786915d9bc..62dc0f2cb202a31c3afe0d53dd01b842f8e53a7e 100644 (file)
@@ -92,7 +92,7 @@ function print_invoices()
                        }
                        else
                                $rep->title = _('INVOICE');
-                       $contacts = get_branch_contacts($branch['branch_code'], 'invoice', $branch['debtor_no']);
+                       $contacts = get_branch_contacts($branch['branch_code'], 'invoice', $branch['debtor_no'], false);
                        $baccount['payment_service'] = $pay_service;
                        $rep->SetCommonData($myrow, $branch, $sales_order, $baccount, ST_SALESINVOICE, $contacts);
                        $rep->NewPage();
index 181a0344ecbf582bb5a55d531e989fe1fa7e74f5..51697c3c6c1ec8bac98ae1c1b3d530d378b90093 100644 (file)
@@ -98,7 +98,7 @@ function print_sales_orders()
                else
                        $rep->title = ($print_as_quote==1 ? _("QUOTE") : _("SALES ORDER"));
 
-               $contacts = get_branch_contacts($branch['branch_code'], 'order', $branch['debtor_no']);
+               $contacts = get_branch_contacts($branch['branch_code'], 'order', $branch['debtor_no'], false);
                $rep->SetCommonData($myrow, $branch, $myrow, $baccount, ST_SALESORDER, $contacts);
                $rep->NewPage();
 
index bcb89665d280686ee01253197e153d27887844ea..4b4fec83e614ede4775a1124481c70d91dbac82d 100644 (file)
@@ -101,7 +101,7 @@ function print_deliveries()
                        }
                        else
                                $rep->title = _('DELIVERY NOTE');
-                       $contacts = get_branch_contacts($branch['branch_code'], 'delivery', $branch['debtor_no']);
+                       $contacts = get_branch_contacts($branch['branch_code'], 'delivery', $branch['debtor_no'], false);
                        $rep->SetCommonData($myrow, $branch, $sales_order, '', ST_CUSTDELIVERY, $contacts);
                        $rep->NewPage();
 
index 80b6b712515792cf04e80283bcbfa6f33bc79553..07fbd41f2b34d62b223e946e4178fabd6e6c5e54 100644 (file)
@@ -84,7 +84,7 @@ function print_sales_quotations()
                        $rep->Info($params, $cols, null, $aligns);
                }
                $rep->title = _("SALES QUOTATION");
-               $contacts = get_branch_contacts($branch['branch_code'], 'order', $branch['debtor_no']);
+               $contacts = get_branch_contacts($branch['branch_code'], 'order', $branch['debtor_no'], false);
                $rep->SetCommonData($myrow, $branch, $myrow, $baccount, ST_SALESQUOTE, $contacts);
                //$rep->headerFunc = 'Header2';
                $rep->NewPage();
index 7a612243ff6a2b313f6b92b17e6b94e4a18e0ad9..aec634e25f3da7d65e1b562d3766d7451011240a 100644 (file)
@@ -94,7 +94,7 @@ function print_credits()
                        }
                        else
                                $rep->title = _('CREDIT NOTE');
-                       $contacts = get_branch_contacts($branch['branch_code'], 'invoice', $branch['debtor_no']);
+                       $contacts = get_branch_contacts($branch['branch_code'], 'invoice', $branch['debtor_no'], false);
                        $rep->SetCommonData($myrow, $branch, $sales_order, $baccount, ST_CUSTCREDIT, $contacts);
                        $rep->NewPage();