/** * Handles and fixes database related problems * @return boolean False. Always. */ static function errorHandler() { \Yellowpay::errorHandler(); // Also calls \Cx\Core\Setting\Controller\Setting::errorHandler() foreach (array('postfinance_accepted_payment_methods' => 'yellowpay_accepted_payment_methods', 'postfinance_shop_id' => 'yellowpay_shopid', 'postfinance_hash_signature_in' => 'yellowpay_hashseed', 'postfinance_hash_signature_out' => 'yellowpay_hashseed', 'postfinance_authorization_type' => 'yellowpay_authorization', 'postfinance_use_testserver' => 'yellowpay_use_testserver') as $to => $from) { $value = EgovLibrary::GetSettings($from); //DBG::log("EgovLibrary::errorHandler(): Copying from $from, value $value, to $to<br />"); \Cx\Core\Setting\Controller\Setting::set($to, $value); } \Cx\Core\Setting\Controller\Setting::updateAll(); }
/** * Update the order status and send the confirmation mail * according to the settings * * The resulting javascript code displays a message box or * does some page redirect. * @param integer $order_id The order ID * @return string Javascript code */ function updateOrder($order_id) { global $_ARRAYLANG, $_CONFIG; $product_id = EgovManager::getOrderValue('order_product', $order_id); if (empty($product_id)) { return 'alert("' . $_ARRAYLANG['TXT_EGOV_ERROR_UPDATING_ORDER'] . '");' . "\n"; } // Has this order been updated already? if (EgovManager::GetOrderValue('order_state', $order_id) == 1) { // Do not resend mails! return ''; } $arrFields = EgovLibrary::getOrderValues($order_id); $FormValue4Mail = ''; foreach ($arrFields as $name => $value) { // If the value matches a calendar date, prefix the string with // the day of the week $arrMatch = array(); if (preg_match('/^(\\d\\d?)\\.(\\d\\d?)\\.(\\d\\d\\d\\d)$/', $value, $arrMatch)) { // ISO-8601 numeric representation of the day of the week // 1 (for Monday) through 7 (for Sunday) $dotwNumber = date('N', mktime(1, 1, 1, $arrMatch[2], $arrMatch[1], $arrMatch[3])); $dotwName = $_ARRAYLANG['TXT_EGOV_DAYNAME_' . $dotwNumber]; $value = "{$dotwName}, {$value}"; } $FormValue4Mail .= html_entity_decode($name) . ': ' . html_entity_decode($value) . "\n"; } // Bestelleingang-Benachrichtigung || Mail f�r den Administrator $recipient = EgovLibrary::GetProduktValue('product_target_email', $product_id); if (empty($recipient)) { $recipient = EgovLibrary::GetSettings('set_orderentry_recipient'); } if (!empty($recipient)) { $SubjectText = str_replace('[[PRODUCT_NAME]]', html_entity_decode(EgovLibrary::GetProduktValue('product_name', $product_id)), EgovLibrary::GetSettings('set_orderentry_subject')); $SubjectText = html_entity_decode($SubjectText); $BodyText = str_replace('[[ORDER_VALUE]]', $FormValue4Mail, EgovLibrary::GetSettings('set_orderentry_email')); $BodyText = html_entity_decode($BodyText); $replyAddress = EgovLibrary::GetEmailAdress($order_id); if (empty($replyAddress)) { $replyAddress = EgovLibrary::GetSettings('set_orderentry_sender'); } if (@(include_once ASCMS_LIBRARY_PATH . '/phpmailer/class.phpmailer.php')) { $objMail = new \phpmailer(); if (!empty($_CONFIG['coreSmtpServer'])) { if (($arrSmtp = \SmtpSettings::getSmtpAccount($_CONFIG['coreSmtpServer'])) !== false) { $objMail->IsSMTP(); $objMail->Host = $arrSmtp['hostname']; $objMail->Port = $arrSmtp['port']; $objMail->SMTPAuth = true; $objMail->Username = $arrSmtp['username']; $objMail->Password = $arrSmtp['password']; } } $objMail->CharSet = CONTREXX_CHARSET; $from = EgovLibrary::GetSettings('set_orderentry_sender'); $fromName = EgovLibrary::GetSettings('set_orderentry_name'); $objMail->AddReplyTo($replyAddress); $objMail->SetFrom($from, $fromName); $objMail->Subject = $SubjectText; $objMail->Priority = 3; $objMail->IsHTML(false); $objMail->Body = $BodyText; $objMail->AddAddress($recipient); $objMail->Send(); } } // Update 29.10.2006 Statusmail automatisch abschicken || Produktdatei if (EgovLibrary::GetProduktValue('product_electro', $product_id) == 1 || EgovLibrary::GetProduktValue('product_autostatus', $product_id) == 1) { EgovLibrary::updateOrderStatus($order_id, 1); $TargetMail = EgovLibrary::GetEmailAdress($order_id); if ($TargetMail != '') { $FromEmail = EgovLibrary::GetProduktValue('product_sender_email', $product_id); if ($FromEmail == '') { $FromEmail = EgovLibrary::GetSettings('set_sender_email'); } $FromName = EgovLibrary::GetProduktValue('product_sender_name', $product_id); if ($FromName == '') { $FromName = EgovLibrary::GetSettings('set_sender_name'); } $SubjectDB = EgovLibrary::GetProduktValue('product_target_subject', $product_id); if ($SubjectDB == '') { $SubjectDB = EgovLibrary::GetSettings('set_state_subject'); } $SubjectText = str_replace('[[PRODUCT_NAME]]', html_entity_decode(EgovLibrary::GetProduktValue('product_name', $product_id)), $SubjectDB); $SubjectText = html_entity_decode($SubjectText); $BodyDB = EgovLibrary::GetProduktValue('product_target_body', $product_id); if ($BodyDB == '') { $BodyDB = EgovLibrary::GetSettings('set_state_email'); } $BodyText = str_replace('[[ORDER_VALUE]]', $FormValue4Mail, $BodyDB); $BodyText = str_replace('[[PRODUCT_NAME]]', html_entity_decode(EgovLibrary::GetProduktValue('product_name', $product_id)), $BodyText); $BodyText = html_entity_decode($BodyText); if (@(include_once ASCMS_LIBRARY_PATH . '/phpmailer/class.phpmailer.php')) { $objMail = new \phpmailer(); if ($_CONFIG['coreSmtpServer'] > 0) { if (($arrSmtp = \SmtpSettings::getSmtpAccount($_CONFIG['coreSmtpServer'])) !== false) { $objMail->IsSMTP(); $objMail->Host = $arrSmtp['hostname']; $objMail->Port = $arrSmtp['port']; $objMail->SMTPAuth = true; $objMail->Username = $arrSmtp['username']; $objMail->Password = $arrSmtp['password']; } } $objMail->CharSet = CONTREXX_CHARSET; $objMail->SetFrom($FromEmail, $FromName); $objMail->Subject = $SubjectText; $objMail->Priority = 3; $objMail->IsHTML(false); $objMail->Body = $BodyText; $objMail->AddAddress($TargetMail); if (EgovLibrary::GetProduktValue('product_electro', $product_id) == 1) { $objMail->AddAttachment(ASCMS_PATH . EgovLibrary::GetProduktValue('product_file', $product_id)); } $objMail->Send(); } } } return ''; }