/** * Notify admin by email of a failed subscription * * @param Interspire_EmailIntegration_Subscription $subscription Failed subscription * @param array $merge Failed merge data * @param string $errorMessage */ public function notifyAdmin(Interspire_EmailIntegration_Subscription $subscription, $merge, $errorMessage) { // can't rely on ISC_ADMIN_ENGINE or admin lang stuff from here because this code may be run by the task manager $languagePath = ISC_BASE_PATH . '/language/' . GetConfig('Language') . '/admin'; ParseLangFile($languagePath . '/common.ini'); ParseLangFile($languagePath . '/settings.emailintegration.ini'); $replacements = array( 'provider' => $this->GetName(), 'time' => isc_date(GetConfig('ExtendedDisplayDateFormat'), time()), ); $GLOBALS['EmailHeader'] = GetLang("NoCheckoutProvidersSubject"); $GLOBALS['EmailMessage'] = sprintf(GetLang("NoCheckoutProvidersErrorLong"), $GLOBALS['ShopPath']); $GLOBALS['SubscriptionDetails'] = ''; $GLOBALS['EmailIntegrationNotice_Header'] = GetLang('EmailIntegrationNotice_Header', $replacements); $GLOBALS['EmailIntegrationNotice_Intro'] = GetLang('EmailIntegrationNotice_Intro', $replacements); $GLOBALS['EmailIntegrationNotice_Error'] = GetLang('EmailIntegrationNotice_Error', $replacements); $GLOBALS['EmailIntegrationNotice_Message'] = $errorMessage; $GLOBALS['EmailIntegrationNotice_Time'] = GetLang('EmailIntegrationNotice_Time', $replacements); $GLOBALS['EmailIntegrationNotice_Details'] = GetLang('EmailIntegrationNotice_Details', $replacements); $GLOBALS['EmailIntegrationNotice_Type'] = $subscription->getSubscriptionTypeLang(); $details = new Xhtml_Table(); $row = new Xhtml_Tr(); $row->appendChild(new Xhtml_Th(GetLang('EmailIntegrationNotice_Columns_Provider', $replacements))); $row->appendChild(new Xhtml_Th(GetLang('EmailIntegrationNotice_Columns_Subscription', $replacements))); $details->appendChild($row); $row = new Xhtml_Tr(); $row->appendChild(new Xhtml_Td($this->getEmailProviderFieldId())); $row->appendChild(new Xhtml_Td($subscription->getSubscriptionEmail())); $details->appendChild($row); foreach ($merge as $field => $value) { $row = new Xhtml_Tr(); $row->appendChild(new Xhtml_Td($field)); $row->appendChild(new Xhtml_Td($value)); $details->appendChild($row); } $GLOBALS['EmailIntegrationNotice_Subscription'] = $details->render(); $GLOBALS['EmailIntegrationNotice_CommonCauses'] = GetLang('EmailIntegrationNotice_CommonCauses', $replacements); $GLOBALS['EmailIntegrationNotice_Cause1_Intro'] = GetLang('EmailIntegrationNotice_Cause1_Intro', $replacements); $GLOBALS['EmailIntegrationNotice_Cause1_Detail'] = GetLang('EmailIntegrationNotice_Cause1_Detail', $replacements); $GLOBALS['EmailIntegrationNotice_Cause2_Intro'] = GetLang('EmailIntegrationNotice_Cause2_Intro', $replacements); $GLOBALS['EmailIntegrationNotice_Cause2_Detail'] = GetLang('EmailIntegrationNotice_Cause2_Detail', $replacements); $GLOBALS['EmailIntegrationNotice_Cause3_Intro'] = GetLang('EmailIntegrationNotice_Cause3_Intro', $replacements); $GLOBALS['EmailIntegrationNotice_Cause3_Detail'] = GetLang('EmailIntegrationNotice_Cause3_Detail', $replacements); $GLOBALS['EmailIntegrationNotice_Cause4_Intro'] = GetLang('EmailIntegrationNotice_Cause4_Intro', $replacements); $GLOBALS['EmailIntegrationNotice_Cause4_Detail'] = GetLang('EmailIntegrationNotice_Cause4_Detail', $replacements); $GLOBALS['EmailIntegrationNotice_Cause5_Intro'] = GetLang('EmailIntegrationNotice_Cause5_Intro', $replacements); $GLOBALS['EmailIntegrationNotice_Cause5_Detail'] = GetLang('EmailIntegrationNotice_Cause5_Detail', $replacements); $GLOBALS['EmailIntegrationNotice_Closing'] = GetLang('EmailIntegrationNotice_Closing', $replacements); $emailTemplate = FetchEmailTemplateParser(); $emailTemplate->SetTemplate("email_integration_notice_email"); $message = $emailTemplate->ParseTemplate(true); $obj_email = GetEmailClass(); $obj_email->Set('CharSet', GetConfig('CharacterSet')); $obj_email->From(GetConfig('OrderEmail'), GetConfig('StoreName')); $obj_email->Set("Subject", GetLang("EmailIntegrationEmailSubject")); $obj_email->AddBody("html", $message); $obj_email->AddRecipient(GetConfig('AdminEmail'), "", "h"); $email_result = $obj_email->Send(); }