function getCalendarSourceBackend($product_id, $flagBackend = false) { global $objDatabase, $_ARRAYLANG; $last_y = date('Y') - 1; $query = "\n SELECT calendar_product, calendar_order, calendar_day,\n calendar_month, calendar_year\n FROM " . DBPREFIX . "module_egov_product_calendar\n WHERE calendar_product={$product_id}\n AND calendar_act=1\n AND calendar_year>{$last_y}\n "; $objResult = $objDatabase->Execute($query); $ArrayRD = array(); if ($objResult) { while (!$objResult->EOF) { if (!isset($ArrayRD[$objResult->fields['calendar_year']][$objResult->fields['calendar_month']][$objResult->fields['calendar_day']])) { $ArrayRD[$objResult->fields['calendar_year']][$objResult->fields['calendar_month']][$objResult->fields['calendar_day']] = 0; } ++$ArrayRD[$objResult->fields['calendar_year']][$objResult->fields['calendar_month']][$objResult->fields['calendar_day']]; $objResult->MoveNext(); } } \Env::get('ClassLoader')->loadFile(ASCMS_MODULE_PATH . '/Egov/Controller/Cal/Calendrier.php'); $AnzahlTxT = $_ARRAYLANG['TXT_EGOV_QUANTITY']; $AnzahlDropdown = $this->_QuantityDropdown(); $Datum4JS = isset($_REQUEST['date']) ? $_REQUEST['date'] : ''; $QuantArray = $this->_GetOrdersQuantityArray($product_id, $Datum4JS); return calendar($QuantArray, $AnzahlDropdown, $AnzahlTxT, EgovLibrary::GetSettings('set_calendar_date_desc'), EgovLibrary::GetSettings('set_calendar_date_label'), $ArrayRD, EgovLibrary::GetProduktValue('product_quantity', $product_id), EgovLibrary::GetProduktValue('product_quantity_limit', $product_id), $Datum4JS, EgovLibrary::GetSettings('set_calendar_background'), EgovLibrary::GetSettings('set_calendar_legende_1'), EgovLibrary::GetSettings('set_calendar_legende_2'), EgovLibrary::GetSettings('set_calendar_legende_3'), EgovLibrary::GetSettings('set_calendar_color_1'), EgovLibrary::GetSettings('set_calendar_color_2'), EgovLibrary::GetSettings('set_calendar_color_3'), EgovLibrary::GetSettings('set_calendar_border'), $flagBackend); }
/** * 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 ''; }