Ejemplo n.º 1
0
                    }
                    print "<h2>";
                    print _("Invoice");
                    print "</h2>";
                    $invoiceContents = invoiceContents($guid, $connection2, $gibbonFinanceInvoiceID, $gibbonSchoolYearID, $_SESSION[$guid]["currency"]);
                    if ($invoiceContents == FALSE) {
                        print "<div class='error'>";
                        print _("An error occurred.");
                        print "</div>";
                    } else {
                        print $invoiceContents;
                    }
                } else {
                    if ($type = "Receipt") {
                        print "<h2>";
                        print _("Receipt");
                        print "</h2>";
                        $receiptContents = receiptContents($guid, $connection2, $gibbonFinanceInvoiceID, $gibbonSchoolYearID, $_SESSION[$guid]["currency"], FALSE, $receiptNumber);
                        if ($receiptContents == FALSE) {
                            print "<div class='error'>";
                            print _("An error occurred.");
                            print "</div>";
                        } else {
                            print $receiptContents;
                        }
                    }
                }
            }
        }
    }
}
 }
 $emailFail = FALSE;
 //Email Receipt
 if (isset($_POST["emailReceipt"])) {
     if ($_POST["emailReceipt"] == "Y") {
         $from = $_POST["email"];
         if ($partialFail == FALSE and $from != "") {
             //Send emails
             $emails = NULL;
             if (isset($_POST["emails"])) {
                 $emails = $_POST["emails"];
             }
             if (count($emails) > 0) {
                 require $_SESSION[$guid]["absolutePath"] . '/lib/PHPMailer/class.phpmailer.php';
                 //Prep message
                 $body = receiptContents($guid, $connection2, $gibbonFinanceInvoiceID, $gibbonSchoolYearID, $_SESSION[$guid]["currency"], TRUE) . "<p style='font-style: italic;'>Email sent via " . $_SESSION[$guid]["systemName"] . " at " . $_SESSION[$guid]["organisationName"] . ".</p>";
                 $bodyPlain = "This email is not viewable in plain text: enable rich text/HTML in your email client to view the receipt. Please reply to this email if you have any questions.";
                 $mail = new PHPMailer();
                 $mail->SetFrom($from, $_SESSION[$guid]["preferredName"] . " " . $_SESSION[$guid]["surname"]);
                 foreach ($emails as $address) {
                     $mail->AddBCC($address);
                 }
                 $mail->CharSet = "UTF-8";
                 $mail->Encoding = "base64";
                 $mail->IsHTML(true);
                 $mail->Subject = "Receipt From " . $_SESSION[$guid]["organisationNameShort"] . " via " . $_SESSION[$guid]["systemName"];
                 $mail->Body = $body;
                 $mail->AltBody = $bodyPlain;
                 if (!$mail->Send()) {
                     $emailFail = TRUE;
                 }