function sendBookingConfirmation($bookingID, $instanceID, $enrolVar, $ccEmail = false) { $enrolVar['state'] = getStateFromPostcode($enrolVar['postcode']); //$instanceID = "161835"; $courseDetailObj = getEventDetails($instanceID); $courseDetails['name'] = $courseDetailObj['websiteName']; $courseDetails['date'] = date("l", strtotime($courseDetailObj['courseDate'])) . "<br>" . date("j", strtotime($courseDetailObj['courseDate'])) . "<sup>" . date("S", strtotime($courseDetailObj['courseDate'])) . "</sup> " . date("F Y", strtotime($courseDetailObj['courseDate'])); $courseDetails['date_nb'] = date("l", strtotime($courseDetailObj['courseDate'])) . " " . date("j", strtotime($courseDetailObj['courseDate'])) . "<sup>" . date("S", strtotime($courseDetailObj['courseDate'])) . "</sup> " . date("F Y", strtotime($courseDetailObj['courseDate'])); $courseDetails['time'] = date("g:i a", strtotime($courseDetailObj['startDateTime'])) . " to " . date("g:i a", strtotime($courseDetailObj['endDateTime'])); $courseDetails['location'] = str_replace(", ", "<br>", str_replace("\n", "<br>", $courseDetailObj['StreetAddress'])); $courseDetails['maplink'] = "https://www.google.com.au/maps?q=" . str_replace(" ", "+", str_replace("\n", " ", $courseDetailObj['StreetAddress'])); //var_dump($courseDetails); //die(); $emailKey = sha1(date("r", strtotime("now")) . generateRandomString(5) . $bookingID . $instanceID); //$bookingID = "123456789-123456789"; $viewonlinelink = "https://www.australiawidefirstaid.com.au/email/?k=" . $emailKey; $livedata = $enrolVar['fname'] . " " . $enrolVar['lname'] . "|" . $enrolVar['email'] . "|" . $bookingID; $livechatURL = "https://www.australiawidefirstaid.com.au/?livechat=true&data=" . base64_encode($livedata); $html = getEmailTemplate("template_CouponEmailConfirmation_generic.htm"); $html = varReplace("bookingID", $bookingID, $html); $html = varReplace("emailviewlink", $viewonlinelink, $html); $html = varReplace("livechatURL", $livechatURL, $html); $html = varReplace("user.firstname", $enrolVar['fname'], $html); $html = varReplace("user.lastname", $enrolVar['lname'], $html); $html = varReplace("user.address", $enrolVar['address'], $html); $html = varReplace("user.suburb", $enrolVar['suburb'], $html); $html = varReplace("user.state", $enrolVar['state'], $html); $html = varReplace("user.postcode", $enrolVar['postcode'], $html); $html = varReplace("user.phone", $enrolVar['mobile'], $html); $html = varReplace("user.email", $enrolVar['email'], $html); $html = varReplace("user.orginisation", $enrolVar['workplace'], $html); $html = varReplace("course.name", $courseDetails['name'], $html); $html = varReplace("course.date", $courseDetails['date'], $html); $html = varReplace("course.date_nb", $courseDetails['date_nb'], $html); $html = varReplace("course.time", $courseDetails['time'], $html); $html = varReplace("course.location", $courseDetails['location'], $html); $html = varReplace("course.maplink", $courseDetails['maplink'], $html); $message = $html; $semail = "*****@*****.**"; $sname = "Australia Wide First Aid"; $rname = ""; $priority = "high"; $type = "text/html"; $replysemail = $semail; $fullmessage = ""; //$remail = "*****@*****.**"; $remail = $enrolVar['email']; $subject = "First Aid Course Booking Confirmation - " . $enrolVar['fname'] . " " . $enrolVar['lname'] . " - " . $enrolVar['workplace']; email::logEmail($remail, "", $ccEmail, $subjet, $message, $bookingID, $instanceID, $emailKey); esmtp::sendemail_smtp($remail, $subject, $message, $ccEmail); }
//$result = axcelerate_testcontact($userDetails); $userDetails = array('contactID' => '2707364', 'username' => 'andrew.james', 'password' => 'abc123'); //$result = axcelerate_createuser($userDetails); //$result = axcelerate_testcontact($userDetails); //object(stdClass)#1 (3) { ["USERID"]=> int(95545) ["CONTACTID"]=> int(2707364) ["USERNAME"]=> string(17) "*****@*****.**" } /* */ $userDetails = array('contactID' => '2707583', 'instanceID' => '242498', 'type' => 'w'); //$result = axcelerate_testenrolment($userDetails); $userDetails = array('username' => '*****@*****.**', 'oldPassword' => 'abc123', 'newPassword' => '123abc', 'verifyPassword' => '123abc'); //$result = axcelerate_changepassword($userDetails); $userDetails = array('username' => '*****@*****.**', 'password' => '123abc'); //$result = axcelerate_testlogin($userDetails); //var_dump($result); die; $html = getEmailTemplate("template_Invoice_generic.htm"); $iD = axcelerate_getInvoice("158631"); //var_dump($iD); //var_dump(getBookingDetailsFromInvoiceID("158626")); //die(); $courseDetailObj = getBookingDetailsFromInvoiceID("158631"); $courseDetails['name'] = $courseDetailObj['CourseName']; $courseDetails['date'] = date("l", strtotime($courseDetailObj['courseDate'])) . "<br>" . date("j", strtotime($courseDetailObj['courseDate'])) . "<sup>" . date("S", strtotime($courseDetailObj['courseDate'])) . "</sup> " . date("F Y", strtotime($courseDetailObj['courseDate'])); $courseDetails['date_nb'] = date("l", strtotime($courseDetailObj['courseDate'])) . " " . date("j", strtotime($courseDetailObj['courseDate'])) . "<sup>" . date("S", strtotime($courseDetailObj['courseDate'])) . "</sup> " . date("F Y", strtotime($courseDetailObj['courseDate'])); $courseDetails['time'] = date("g:i a", strtotime($courseDetailObj['startDateTime'])) . " to " . date("g:i a", strtotime($courseDetailObj['endDateTime'])); $courseDetails['location'] = str_replace(", ", "<br>", str_replace("\n", "<br>", $courseDetailObj['StreetAddress'])); $courseDetails['maplink'] = "https://www.google.com.au/maps?q=" . str_replace(" ", "+", str_replace("\n", " ", $courseDetailObj['StreetAddress'])); $lookup = ""; $value = ""; $resource = $html; $resource = varReplace("InvoiceID", $iD->INVOICEID, $resource);
<?php /** * Template Name: Pre Approval Application */ get_header(); ?> <?php $response = ''; if (isset($_POST['submitted'])) { $html = getEmailTemplate($_POST); global $response; if (isset($_POST['email_work']) && isset($_POST['email_home'])) { $multiple_recipients = array('*****@*****.**', $_POST['email_home'], $_POST['email_work']); } else { $multiple_recipients = array('*****@*****.**', $_POST['email_home']); } $headers[] = 'From: "MortgageHouse Info" <*****@*****.**>'; $headers[] = 'Content-Type: text/html; charset=UTF-8'; $subject = 'Pre Approve Form: Mortgagehouse Website'; $body = $html; $errors = array(); if (empty($_POST['first_name'])) { $errors[] = "<div class='alert alert-danger'> Please enter your first name!</div>"; } else { $sent = wp_mail($multiple_recipients, $subject, $body, $headers); if ($sent) { $response = "<div class='alert alert-success'> A copy of information is send to your email address, and we'll get in touch with you soon!</div>"; } }
function sendManualInvoice($processgroupID) { $emailKey = $processgroupID; $html = getEmailTemplate("template_invoicenotification.htm"); $processgroupID = db::esc($processgroupID); $mainData = db::runQuery("select * from process_group left join events on events.instanceID = process_group.eventID left join courses on courses.courseID = events.courseID left join locations on locations.ID = events.locationID left join coupons on coupons.couponCode = process_group.campaign_code where processgroupID = '{$processgroupID}'"); if (!$mainData) { return false; } else { $mData = $mainData[0]; $courseName = $mData['CourseName']; $couponName = $mData['campaignName']; $normalCost = $mData['cost']; $totalTrainees = $mData['total_trainee']; $discountcost = $mData['totalcost']; $costNormalTotal = $normalCost * $totalTrainees; $discountcostPerperson = $discountcost / $totalTrainees; $amountDiscountedTot = $costNormalTotal - $discountcost; $invoiceItems = ""; for ($tr = 0; $tr < $totalTrainees; $tr++) { $subHTML = ""; $subHTML = $subHTML . "\t\t<tr style='font-size:13px;'>"; $subHTML = $subHTML . "\t\t\t<td>" . $courseName . " - " . $couponName . "</td>"; $subHTML = $subHTML . "\t\t\t<td>\$" . number_format($normalCost, 2) . "</td>"; $subHTML = $subHTML . "\t\t\t<td>\$" . number_format($discountcostPerperson, 2) . "</td>"; $subHTML = $subHTML . "\t\t</tr>"; $invoiceItems = $invoiceItems . $subHTML; } $html = varReplace("invoiceItemsRow", $invoiceItems, $html); $html = varReplace("order.totalNormal", number_format($costNormalTotal, 2), $html); $html = varReplace("order.Total", number_format($discountcost, 2), $html); $html = varReplace("order.amountDiscounted", number_format($amountDiscountedTot, 2), $html); $html = varReplace("order.subTotal", number_format($discountcost, 2), $html); if ($mData['payment_status'] == "completed") { $html = varReplace("order.amountPaid", number_format($discountcost, 2), $html); $html = varReplace("order.balanceDue", "0.00", $html); } else { $html = varReplace("order.amountPaid", "0.00", $html); $html = varReplace("order.balanceDue", number_format($discountcost, 2), $html); } $html = varReplace("amountToInvoice", number_format($discountcost, 2), $html); $html = varReplace("eventID", $mData['eventID'], $html); $html = varReplace("courseName", $mData['CourseName'], $html); $html = varReplace("courseDateTime", $mData['startDateTime'], $html); $html = varReplace("courseLocation", $mData['LocationState'] . " " . $mData['LocationName'] . " - " . $mData['StreetAddress'], $html); $html = varReplace("totalTrainees", $mData['total_trainee'], $html); $html = varReplace("courseNormalCost", "\$" . number_format($costNormalTotal, 2), $html); $html = varReplace("couponCode", $mData['campaign_code'], $html); $html = varReplace("couponName", $couponName, $html); if ($mData['discountType'] == "0") { $html = varReplace("couponDiscount", "\$" . $mData['discountAmount'] . " off total", $html); } if ($mData['discountType'] == "1") { $html = varReplace("couponDiscount", $mData['discountAmount'] . "% off total", $html); } if ($mData['discountType'] == "2") { $html = varReplace("couponDiscount", "Custom price for Location", $html); } if ($mData['discountType'] == "3") { $html = varReplace("couponDiscount", "Custom price for Course", $html); } $trainees = db::runQuery("select * from process_trainee where processgroupID = '{$processgroupID}'"); if (!$trainees) { return false; } else { $currentTrainee = 1; $traineehtml = ""; foreach ($trainees as $trainee) { $trhtml = ""; $trhtml = $trhtml . '<b>Trainee ' . $currentTrainee . '</b>'; $trhtml = $trhtml . ' <table style="width:100%; margin-left:70px;">'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;">Contact ID</th>'; $trhtml = $trhtml . ' <td style="text-align:left;"><a href="https://admin.axcelerate.com.au/management/management2/Contact_View.cfm?ContactID=' . $trainee['contactID'] . '">' . $trainee['contactID'] . '</a></th>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;">Learner ID</th>'; $trhtml = $trhtml . ' <td style="text-align:left;">' . $trainee['leanerID'] . '</td>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;">Invoice ID</th>'; $trhtml = $trhtml . ' <td style="text-align:left;">' . $trainee['invoiceID'] . '</td>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;">Amount to Invoice</th>'; $trhtml = $trhtml . ' <td style="text-align:left;">$' . number_format($trainee['cost'], 2) . '</td>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;"> </th>'; $trhtml = $trhtml . ' <td style="text-align:left;"></td>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;">Name</th>'; $trhtml = $trhtml . ' <td style="text-align:left;">' . $trainee['firstname'] . ' ' . $trainee['lastname'] . '</td>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;">USI</th>'; $trhtml = $trhtml . ' <td style="text-align:left;">' . $trainee['usi'] . '</td>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;">Email Address</th>'; $trhtml = $trhtml . ' <td style="text-align:left;">' . $trainee['email'] . '</td>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;">Mobile/Phone</th>'; $trhtml = $trhtml . ' <td style="text-align:left;">' . $trainee['mobile'] . '</td>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;">Workplace</th>'; $trhtml = $trhtml . ' <td style="text-align:left;">' . $trainee['workplace'] . '</td>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' <tr style="font-size:13px;">'; $trhtml = $trhtml . ' <th width="30%" style="text-align:left;">Address</th>'; $trhtml = $trhtml . ' <td style="text-align:left;">' . $trainee['address'] . '<br>' . $trainee['suburb'] . ' ' . $trainee['postcode'] . '</td>'; $trhtml = $trhtml . ' </tr>'; $trhtml = $trhtml . ' </table><br><br>'; $traineehtml = $traineehtml . $trhtml; $currentTrainee++; } $html = varReplace("traineeDetails", $traineehtml, $html); $remail = $mData['awfaSendInvoiceNotification']; //$remail = "*****@*****.**"; $subject = "MANUAL INVOICE: Please generate a manual invoice for this Discounted Enrolment"; $message = $html; $bookingID = ""; $instanceID = ""; $ccEmail = ""; //$ccEmail = "*****@*****.**"; email::logEmail($remail, $ccEmail, "", $subject, $message, $bookingID, $instanceID, $emailKey); esmtp::sendemail_smtp($remail, $subject, $message, $ccEmail); echo $html; } } }
function edit_tmplt() { $clang = Yii::app()->lang; if (!Permission::model()->hasGlobalPermission('emailTemp', 'update')) { Yii::app()->setFlashMessage($clang->gT("You do not have sufficient rights to access this page."), 'error'); $this->getController()->redirect(array("admin/index")); } $action = isset($_POST['action']) ? $_POST['action'] : ''; if (isset($_POST['template_emailid'])) { $template_emailid = (int) Yii::app()->request->getPost("template_emailid"); if ($action == 'modemailtemplate') { $current_date = date('y-m-d h:i:s'); $email_title = flattenText($_POST['email_title'], false, true, 'UTF-8', true); $template_usein = (int) Yii::app()->request->getPost("template_usein"); $email_subject = (int) Yii::app()->request->getPost("email_subject"); $body_content = (int) Yii::app()->request->getPost("body_content"); $Isactive = flattenText($_POST['IsActive'], false, true, 'UTF-8', true); $Is_active = 0; if ($Isactive) { $Is_active = 1; } if (empty($email_title)) { $aViewUrls['message'] = array('title' => $clang->gT("Failed to edit Email Template"), 'message' => $clang->gT("A Email Title was not supplied or the Email Title is invalid."), 'class' => 'warningheader'); } elseif ($template_usein <= 0 && $email_subject <= 0 && $body_content <= 0) { $aViewUrls['message'] = array('title' => $clang->gT("Failed to edit Email Template"), 'class' => 'warningheader'); } else { $oRecord = Get_template::model()->findByPk($template_emailid); $oRecord->title_text = $email_title; $oRecord->use_in = $template_usein; $oRecord->email_subjectid = $email_subject; $oRecord->email_bodyid = $body_content; $oRecord->updated_datetime = $current_date; $oRecord->IsActive = $Is_active; $EditEmailSubject = $oRecord->save(); if ($EditEmailSubject) { Yii::app()->setFlashMessage($clang->gT("Email Template updated successfully")); $this->getController()->redirect(array("admin/get/sa/list_tmplt")); } else { $aViewUrls['mboxwithredirect'][] = $this->_messageBoxWithRedirect($clang->gT("Editing Email Template"), $clang->gT("Could not modify Email Template."), 'warningheader'); } } } else { $sresult = getEmailTemplate($template_emailid); $aData['mur'] = $sresult; $this->_renderWrappedTemplate('get', 'view_edittemplate', $aData); return; } } Yii::app()->setFlashMessage(Yii::app()->lang->gT("You do not have sufficient rights to access this page."), 'error'); $this->getController()->redirect(array("admin/get/sa/list_tmplt")); }