public function updateOrderStatus($orders_id, $orders_status, $mail_customer = 0)
 {
     if (!is_numeric($orders_id)) {
         return false;
     }
     $continue = 1;
     //hook to let other plugins further manipulate
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['updateOrderStatusPreProc'])) {
         $params = array('orders_id' => &$orders_id, 'orders_status' => &$orders_status, 'mail_customer' => &$mail_customer, 'continue' => &$continue);
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['updateOrderStatusPreProc'] as $funcRef) {
             \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
         }
     }
     if ($continue) {
         $order = mslib_fe::getOrder($orders_id);
         if ($order['orders_id']) {
             // dynamic variables
             if (isset($order['language_id'])) {
                 // Switch to language that is stored in the order
                 mslib_befe::setSystemLanguage($order['language_id']);
             }
             $billing_address = '';
             $delivery_address = '';
             $full_customer_name = $order['billing_first_name'];
             if ($order['billing_middle_name']) {
                 $full_customer_name .= ' ' . $order['billing_middle_name'];
             }
             if ($order['billing_last_name']) {
                 $full_customer_name .= ' ' . $order['billing_last_name'];
             }
             $delivery_full_customer_name = $order['delivery_first_name'];
             if ($order['delivery_middle_name']) {
                 $delivery_full_customer_name .= ' ' . $order['delivery_middle_name'];
             }
             if ($order['delivery_last_name']) {
                 $delivery_full_customer_name .= ' ' . $order['delivery_last_name'];
             }
             $full_customer_name = preg_replace('/\\s+/', ' ', $full_customer_name);
             $delivery_full_customer_name = preg_replace('/\\s+/', ' ', $delivery_full_customer_name);
             if (!$order['delivery_address'] or !$order['delivery_city']) {
                 $order['delivery_company'] = $order['billing_company'];
                 $order['delivery_address'] = $order['billing_address'];
                 $order['delivery_street_name'] = $order['billing_street_name'];
                 $order['delivery_address_number'] = $order['billing_address_number'];
                 $order['delivery_address_ext'] = $order['billing_address_ext'];
                 $order['delivery_building'] = $order['billing_building'];
                 $order['delivery_zip'] = $order['billing_zip'];
                 $order['delivery_city'] = $order['billing_city'];
                 $order['delivery_telephone'] = $order['billing_telephone'];
                 $order['delivery_mobile'] = $order['billing_mobile'];
             }
             if ($order['delivery_company']) {
                 $delivery_address = $order['delivery_company'] . "<br />";
             }
             if ($delivery_full_customer_name) {
                 $delivery_address .= $delivery_full_customer_name . "<br />";
             }
             if ($order['delivery_building']) {
                 $delivery_address .= $order['delivery_building'] . "<br />";
             }
             if ($order['delivery_address']) {
                 $delivery_address .= $order['delivery_address'] . "<br />";
             }
             if ($order['delivery_zip'] and $order['delivery_city']) {
                 $delivery_address .= $order['delivery_zip'] . " " . $order['delivery_city'];
             }
             //if ($order['delivery_telephone']) 		$delivery_address.=ucfirst($this->pi_getLL('telephone')).': '.$order['delivery_telephone']."<br />";
             //if ($order['delivery_mobile']) 			$delivery_address.=ucfirst($this->pi_getLL('mobile')).': '.$order['delivery_mobile']."<br />";
             if ($order['billing_company']) {
                 $billing_address = $order['billing_company'] . "<br />";
             }
             if ($full_customer_name) {
                 $billing_address .= $full_customer_name . "<br />";
             }
             if ($order['billing_building']) {
                 $billing_address .= $order['billing_building'] . "<br />";
             }
             if ($order['billing_address']) {
                 $billing_address .= $order['billing_address'] . "<br />";
             }
             if ($order['billing_zip'] and $order['billing_city']) {
                 $billing_address .= $order['billing_zip'] . " " . $order['billing_city'];
             }
             //if ($order['billing_telephone']) 		$billing_address.=ucfirst($this->pi_getLL('telephone')).': '.$order['billing_telephone']."<br />";
             //if ($order['billing_mobile']) 			$billing_address.=ucfirst($this->pi_getLL('mobile')).': '.$order['billing_mobile']."<br />";
             $array1 = array();
             $array2 = array();
             $array1[] = '###GENDER_SALUTATION###';
             $array2[] = mslib_fe::genderSalutation($order['billing_gender']);
             $array1[] = '###DELIVERY_FIRST_NAME###';
             $array2[] = $order['delivery_first_name'];
             $array1[] = '###DELIVERY_LAST_NAME###';
             $array2[] = preg_replace('/\\s+/', ' ', $order['delivery_middle_name'] . ' ' . $order['delivery_last_name']);
             $array1[] = '###BILLING_FIRST_NAME###';
             $array2[] = $order['billing_first_name'];
             $array1[] = '###BILLING_LAST_NAME###';
             $array2[] = preg_replace('/\\s+/', ' ', $order['billing_middle_name'] . ' ' . $order['billing_last_name']);
             $array1[] = '###BILLING_TELEPHONE###';
             $array2[] = $order['billing_telephone'];
             $array1[] = '###DELIVERY_TELEPHONE###';
             $array2[] = $order['delivery_telephone'];
             $array1[] = '###BILLING_MOBILE###';
             $array2[] = $order['billing_mobile'];
             $array1[] = '###DELIVERY_MOBILE###';
             $array2[] = $order['delivery_mobile'];
             $array1[] = '###BILLING_FULL_NAME###';
             $array2[] = $full_customer_name;
             $array1[] = '###FULL_NAME###';
             $array2[] = $full_customer_name;
             $array1[] = '###DELIVERY_FULL_NAME###';
             $array2[] = $delivery_full_customer_name;
             $array1[] = '###BILLING_NAME###';
             $array2[] = $order['billing_name'];
             $array1[] = '###BILLING_EMAIL###';
             $array2[] = $order['billing_email'];
             $array1[] = '###DELIVERY_EMAIL###';
             $array2[] = $order['delivery_email'];
             $array1[] = '###DELIVERY_NAME###';
             $array2[] = $order['delivery_name'];
             $array1[] = '###CUSTOMER_EMAIL###';
             $array2[] = $order['billing_email'];
             $array1[] = '###STORE_NAME###';
             $array2[] = $this->ms['MODULES']['STORE_NAME'];
             $array1[] = '###TOTAL_AMOUNT###';
             $array2[] = mslib_fe::amount2Cents($order['total_amount']);
             $ORDER_DETAILS = mslib_fe::printOrderDetailsTable($order, 'email');
             $array1[] = '###ORDER_DETAILS###';
             $array2[] = $ORDER_DETAILS;
             $array1[] = '###BILLING_ADDRESS###';
             $array2[] = $billing_address;
             $array1[] = '###DELIVERY_ADDRESS###';
             $array2[] = $delivery_address;
             $array1[] = '###CUSTOMER_ID###';
             $array2[] = $order['customer_id'];
             $array1[] = '###SHIPPING_METHOD###';
             $array2[] = $order['shipping_method_label'];
             $array1[] = '###PAYMENT_METHOD###';
             $array2[] = $order['payment_method_label'];
             $invoice = mslib_fe::getOrderInvoice($order['orders_id'], 0);
             $invoice_id = '';
             $invoice_link = '';
             if (is_array($invoice)) {
                 $invoice_id = $invoice['invoice_id'];
                 $invoice_link = '<a href="' . $this->FULL_HTTP_URL . mslib_fe::typolink($this->shop_pid . ',2002', 'tx_multishop_pi1[page_section]=download_invoice&tx_multishop_pi1[hash]=' . $invoice['hash']) . '">' . $invoice['invoice_id'] . '</a>';
             }
             $array1[] = '###INVOICE_NUMBER###';
             $array2[] = $invoice_id;
             $array1[] = '###INVOICE_LINK###';
             $array2[] = $invoice_link;
             $time = $order['crdate'];
             $long_date = strftime($this->pi_getLL('full_date_format'), $time);
             $array1[] = '###ORDER_DATE_LONG###';
             // ie woensdag 23 juni, 2010
             $array2[] = $long_date;
             // backwards compatibility
             $array1[] = '###ORDER_DATE###';
             // 21-12-2010 in localized format
             $array2[] = strftime("%x", $time);
             $array1[] = '###LONG_DATE###';
             // ie woensdag 23 juni, 2010
             $array2[] = $long_date;
             $time = time();
             $long_date = strftime($this->pi_getLL('full_date_format'), $time);
             $array1[] = '###CURRENT_DATE_LONG###';
             // ie woensdag 23 juni, 2010
             $array2[] = $long_date;
             $array1[] = '###STORE_NAME###';
             $array2[] = $this->ms['MODULES']['STORE_NAME'];
             $array1[] = '###TOTAL_AMOUNT###';
             $array2[] = mslib_fe::amount2Cents($order['total_amount']);
             $array1[] = '###PROPOSAL_NUMBER###';
             $array2[] = $order['orders_id'];
             $array1[] = '###ORDER_NUMBER###';
             $array2[] = $order['orders_id'];
             $array1[] = '###ORDER_LINK###';
             $array2[] = '';
             $array1[] = '###CUSTOMER_ID###';
             $array2[] = $order['customer_id'];
             $array1[] = '###CUSTOMER_COMMENTS###';
             $array2[] = $order['customer_comments'];
             $array1[] = '###MESSAGE###';
             $array2[] = $this->post['comments'];
             $array1[] = '###OLD_ORDER_STATUS###';
             $array2[] = mslib_fe::getOrderStatusName($order['status'], $order['language_id']);
             $array1[] = '###ORDER_STATUS###';
             $array2[] = mslib_fe::getOrderStatusName($orders_status, $order['language_id']);
             $array1[] = '###EXPECTED_DELIVERY_DATE###';
             if ($order['expected_delivery_date'] > 0) {
                 $array2[] = strftime("%x", $order['expected_delivery_date']);
             } else {
                 $array2[] = '';
             }
             $array1[] = '###EXPECTED_DELIVERY_DATE_LONG###';
             if ($order['expected_delivery_date'] > 0) {
                 $array2[] = strftime($this->pi_getLL('full_date_no_time_format'), $order['expected_delivery_date']);
             } else {
                 $array2[] = '';
             }
             $array1[] = '###TRACK_AND_TRACE_CODE###';
             $array2[] = $order['track_and_trace_code'];
             $array1[] = '###BILLING_STREET_NAME###';
             $array2[] = $order['billing_street_name'];
             $array1[] = '###BILLING_ADDRESS_NUMBER###';
             $array2[] = $order['billing_address_number'];
             $array1[] = '###BILLING_ADDRESS_EXT###';
             $array2[] = $order['billing_address_ext'];
             $array1[] = '###BILLING_ZIP###';
             $array2[] = $order['billing_zip'];
             $array1[] = '###BILLING_CITY###';
             $array2[] = $order['billing_city'];
             $array1[] = '###BILLING_COUNTRY###';
             $array2[] = mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $order['billing_country']);
             $array1[] = '###BILLING_COUNTRY_CODE###';
             $array2[] = mslib_fe::getCountryCnIsoByEnglishName($order['billing_country']);
             $array1[] = '###DELIVERY_STREET_NAME###';
             $array2[] = $order['delivery_street_name'];
             $array1[] = '###DELIVERY_ADDRESS_NUMBER###';
             $array2[] = $order['delivery_address_number'];
             $array1[] = '###DELIVERY_ADDRESS_EXT###';
             $array2[] = $order['delivery_address_ext'];
             $array1[] = '###DELIVERY_ZIP###';
             $array2[] = $order['delivery_zip'];
             $array1[] = '###DELIVERY_CITY###';
             $array2[] = $order['delivery_city'];
             $array1[] = '###DELIVERY_COUNTRY###';
             $array2[] = mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $order['delivery_country']);
             $array1[] = '###DELIVERY_COUNTRY_CODE###';
             $array2[] = mslib_fe::getCountryCnIsoByEnglishName($order['delivery_country']);
             // dynamic variablese eof
             //hook to let other plugins further manipulate
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['updateOrderStatusMarkerReplacerProc'])) {
                 $params = array('array1' => &$array1, 'array2' => &$array2, 'order' => &$order);
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['updateOrderStatusMarkerReplacerProc'] as $funcRef) {
                     \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
                 }
             }
             if ($this->post['comments']) {
                 $this->post['comments'] = str_replace($array1, $array2, $this->post['comments']);
             }
             $status_last_modified = time();
             $updateArray = array();
             $updateArray['orders_id'] = $order['orders_id'];
             $updateArray['old_value'] = $order['status'];
             $updateArray['comments'] = $this->post['comments'];
             $updateArray['customer_notified'] = $mail_customer;
             $updateArray['crdate'] = $status_last_modified;
             $updateArray['new_value'] = $orders_status;
             $updateArray['requester_ip_addr'] = $this->REMOTE_ADDR;
             $query = $GLOBALS['TYPO3_DB']->INSERTquery('tx_multishop_orders_status_history', $updateArray);
             if ($orders_status == $order['status']) {
                 if (!empty($this->post['comments']) && $mail_customer) {
                     // always save the order status history even when order status is the same as the old one when e-mail to client is filled
                     $res = $GLOBALS['TYPO3_DB']->sql_query($query);
                 }
                 $returnTrue = 0;
             } else {
                 // save if new order status history is different than the old status
                 $res = $GLOBALS['TYPO3_DB']->sql_query($query);
                 $returnTrue = 1;
             }
             $updateArray = array();
             $updateArray['status'] = $orders_status;
             $updateArray['status_last_modified'] = $status_last_modified;
             $order['old_status'] = $order['status'];
             $order['status'] = $orders_status;
             $updateArray['orders_last_modified'] = time();
             $query = $GLOBALS['TYPO3_DB']->UPDATEquery('tx_multishop_orders', 'orders_id=\'' . $orders_id . '\'', $updateArray);
             $res = $GLOBALS['TYPO3_DB']->sql_query($query);
             //send e-mail
             if ($mail_customer) {
                 $subject = $this->ms['MODULES']['STORE_NAME'];
                 $message = $this->post['comments'];
                 if ($orders_status) {
                     $orders_status_name = mslib_fe::getOrderStatusName($orders_status, 0);
                     $keys = array();
                     $keys[] = 'email_order_status_changed_' . mslib_befe::strtolower($orders_status_name);
                     $keys[] = 'email_order_status_changed';
                     foreach ($keys as $key) {
                         //$page=mslib_fe::getCMScontent($key,$GLOBALS['TSFE']->sys_language_uid);
                         $page = mslib_fe::getCMScontent($key, $order['language_id']);
                         if ($page[0]) {
                             if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['updateOrderStatusMarkerReplacerPostProc'])) {
                                 $params = array('array1' => &$array1, 'array2' => &$array2, 'page' => &$page);
                                 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['updateOrderStatusMarkerReplacerPostProc'] as $funcRef) {
                                     \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
                                 }
                             }
                             if ($page[0]['content']) {
                                 $page[0]['content'] = str_replace($array1, $array2, $page[0]['content']);
                             }
                             if ($page[0]['name']) {
                                 $page[0]['name'] = str_replace($array1, $array2, $page[0]['name']);
                             }
                             $user = array();
                             $user['email'] = $order['billing_email'];
                             $user['name'] = $order['billing_name'];
                             if ($user['email']) {
                                 mslib_fe::mailUser($user, $page[0]['name'], $page[0]['content'], $this->ms['MODULES']['STORE_EMAIL'], $this->ms['MODULES']['STORE_NAME']);
                             }
                             break;
                         }
                     }
                 }
             }
             if (isset($order['language_id'])) {
                 // Switch back to default language
                 mslib_befe::resetSystemLanguage();
             }
             //hook to let other plugins further manipulate
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['updateOrderStatusPostProc'])) {
                 $params = array('orders_id' => &$orders_id, 'orders_status' => &$orders_status, 'mail_customer' => &$mail_customer, 'order' => &$order, 'array1' => &$array1, 'array2' => &$array2);
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_befe.php']['updateOrderStatusPostProc'] as $funcRef) {
                     \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
                 }
             }
             if ($returnTrue) {
                 return true;
             }
         }
     }
 }
<?php

if (!defined('TYPO3_MODE')) {
    die('Access denied.');
}
if (is_numeric($this->get['orders_id'])) {
    if ($this->ms['MODULES']['ADMIN_INVOICE_MODULE'] && $this->get['print'] != 'packing') {
        $invoice = mslib_fe::getOrderInvoice($this->get['orders_id']);
        $invoice_data = mslib_fe::getInvoice($invoice['hash'], 'hash');
    }
    if ($this->ms['MODULES']['ADMIN_INVOICE_MODULE'] && $this->ms['MODULES']['INVOICE_PDF_DIRECT_LINK_FROM_ORDERS_LISTING'] && $this->get['print'] != 'packing') {
        header('Location: ' . $this->FULL_HTTP_URL . mslib_fe::typolink($this->shop_pid . ',2002', 'tx_multishop_pi1[page_section]=download_invoice&tx_multishop_pi1[hash]=' . $invoice['hash']));
        exit;
    }
    $order = mslib_fe::getOrder($this->get['orders_id']);
    $orders_tax_data = $order['orders_tax_data'];
    if ($order['orders_id']) {
        if ($this->ms['MODULES']['ADMIN_INVOICE_MODULE'] && $this->get['print'] != 'packing') {
            $order['crdate'] = $invoice_data['crdate'];
        }
        // Instantiate admin interface object
        $objRef =& \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj('EXT:multishop/pi1/classes/class.tx_mslib_admin_interface.php:&tx_mslib_admin_interface');
        $objRef->init($this);
        $objRef->setInterfaceKey('admin_order_print');
        // Set header buttons through interface class so other plugins can adjust it
        $objRef->setHeaderButtons($headerButtons);
        if ($this->get['tx_multishop_pi1']['action']) {
            switch ($this->get['tx_multishop_pi1']['action']) {
                case '':
                    break;
                default:
Beispiel #3
0
 $ORDER_DETAILS = $mslib_order->printOrderDetailsTable($tmpArray, 'site');
 $array1[] = '###ORDER_DETAILS###';
 $array2[] = $ORDER_DETAILS;
 $array1[] = '###BILLING_ADDRESS###';
 $array2[] = $billing_address;
 $array1[] = '###DELIVERY_ADDRESS###';
 $array2[] = $delivery_address;
 $array1[] = '###CUSTOMER_ID###';
 $array2[] = $tmpArray['customer_id'];
 $array1[] = '###SHIPPING_METHOD###';
 $array2[] = $tmpArray['shipping_method_label'];
 $array1[] = '###PAYMENT_METHOD###';
 $array2[] = $tmpArray['payment_method_label'];
 $array1[] = '###ORDERS_ID###';
 $array2[] = $tmpArray['orders_id'];
 $invoice = mslib_fe::getOrderInvoice($tmpArray['orders_id'], 0);
 $invoice_id = '';
 $invoice_link = '';
 if (is_array($invoice)) {
     $invoice_id = $invoice['invoice_id'];
     $invoice_link = '<a href="' . $this->FULL_HTTP_URL . mslib_fe::typolink($this->shop_pid . ',2002', 'tx_multishop_pi1[page_section]=download_invoice&tx_multishop_pi1[hash]=' . $invoice['hash']) . '">' . $invoice['invoice_id'] . '</a>';
 }
 $array1[] = '###INVOICE_NUMBER###';
 $array2[] = $invoice_id;
 $array1[] = '###INVOICE_LINK###';
 $array2[] = $invoice_link;
 $time = $tmpArray['crdate'];
 $long_date = strftime($this->pi_getLL('full_date_format'), $time);
 $array1[] = '###ORDER_DATE_LONG###';
 // ie woensdag 23 juni, 2010
 $array2[] = $long_date;
Beispiel #4
0
 public function updateOrderStatusToPaid($orders_id, $timestamp = '')
 {
     if (!is_numeric($orders_id)) {
         return false;
     }
     $order = mslib_fe::getOrder($orders_id);
     if (!$order['paid']) {
         //hook to let other plugins further manipulate the replacers
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['updateOrderStatusToPaidPreProc'])) {
             $params = array('order' => &$order);
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['updateOrderStatusToPaidPreProc'] as $funcRef) {
                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
             }
         }
         $updateArray = array('paid' => 1);
         $updateArray['orders_last_modified'] = time();
         if (!$timestamp) {
             $timestamp = time();
         }
         // set the order status based on payment method settings
         $payment_method = mslib_fe::loadPaymentMethod($order['payment_method']);
         $payment_method_vars = unserialize($payment_method['vars']);
         $payment_method_vars['success_status'] = (int) $payment_method_vars['success_status'];
         if ($payment_method['provider'] == 'generic' && isset($payment_method_vars['success_status']) && is_numeric($payment_method_vars['success_status']) && $payment_method_vars['success_status'] > 0) {
             $updateArray['status'] = $payment_method_vars['success_status'];
         }
         $updateArray['orders_paid_timestamp'] = $timestamp;
         $query = $GLOBALS['TYPO3_DB']->UPDATEquery('tx_multishop_orders', 'orders_id=' . $orders_id, $updateArray);
         $res = $GLOBALS['TYPO3_DB']->sql_query($query);
         if ($this->ms['MODULES']['ADMIN_INVOICE_MODULE'] && $this->ms['MODULES']['GENERATE_INVOICE_ID_AFTER_ORDER_SET_TO_PAID']) {
             // create invoice
             $invoice = mslib_fe::getOrderInvoice($orders_id);
             $updateArray = array('paid' => 1);
             $query = $GLOBALS['TYPO3_DB']->UPDATEquery('tx_multishop_invoices', 'hash=\'' . $invoice['hash'] . '\'', $updateArray);
             $res = $GLOBALS['TYPO3_DB']->sql_query($query);
         }
         $continue = 1;
         foreach ($order['products'] as $product) {
             $module_settings = mslib_fe::loadInherentCustomSettingsByProduct($product['products_id']);
             if ($module_settings['ORDERS_PAID_CUSTOM_SCRIPT']) {
                 if (!strstr($module_settings['ORDERS_PAID_CUSTOM_SCRIPT'], "..")) {
                     if (strstr($module_settings['ORDERS_PAID_CUSTOM_SCRIPT'], "/")) {
                         $continue = 0;
                         require PATH_site . $module_settings['ORDERS_PAID_CUSTOM_SCRIPT'] . '.php';
                     }
                 }
             }
         }
         if ($this->ms['MODULES']['ORDERS_PAID_CUSTOM_SCRIPT'] and $continue) {
             if (!strstr($module_settings['ORDERS_PAID_CUSTOM_SCRIPT'], "..")) {
                 if (strstr($module_settings['ORDERS_PAID_CUSTOM_SCRIPT'], "/")) {
                     require PATH_site . $module_settings['ORDERS_PAID_CUSTOM_SCRIPT'] . '.php';
                 }
             }
         }
         $mailOrder = 1;
         //hook to let other plugins further manipulate the replacers
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['updateOrderStatusToPaidPostProc'])) {
             $params = array('order' => &$order, 'mailOrder' => &$mailOrder);
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['updateOrderStatusToPaidPostProc'] as $funcRef) {
                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
             }
         }
         if ($mailOrder) {
             $tmp = mslib_fe::mailOrder($order['orders_id'], 1, '', 'email_order_paid_letter');
         }
         return true;
     } else {
         return false;
     }
 }
 function mailOrder($orders_id, $copy_to_merchant = 1, $custom_email_address = '', $mail_template = '')
 {
     $order = mslib_fe::getOrder($orders_id);
     if ($order['orders_id']) {
         $order['mail_template'] = $mail_template;
         if (isset($order['language_id'])) {
             // Switch to language that is stored in the order
             mslib_befe::setSystemLanguage($order['language_id']);
         }
         if (!$custom_email_address) {
             $custom_email_address = $order['billing_email'];
         }
         $billing_address = '';
         $delivery_address = '';
         $full_customer_name = $order['billing_first_name'];
         if ($order['billing_middle_name']) {
             $full_customer_name .= ' ' . $order['billing_middle_name'];
         }
         if ($order['billing_last_name']) {
             $full_customer_name .= ' ' . $order['billing_last_name'];
         }
         $delivery_full_customer_name = $order['delivery_first_name'];
         if ($order['delivery_middle_name']) {
             $delivery_full_customer_name .= ' ' . $order['delivery_middle_name'];
         }
         if ($order['delivery_last_name']) {
             $delivery_full_customer_name .= ' ' . $order['delivery_last_name'];
         }
         $full_customer_name = preg_replace('/\\s+/', ' ', $full_customer_name);
         $delivery_full_customer_name = preg_replace('/\\s+/', ' ', $delivery_full_customer_name);
         if (!$order['delivery_address'] or !$order['delivery_city']) {
             $order['delivery_company'] = $order['billing_company'];
             $order['delivery_street_name'] = $order['billing_street_name'];
             $order['delivery_building'] = $order['billing_building'];
             $order['delivery_address'] = $order['billing_address'];
             $order['delivery_address_number'] = $order['billing_address_number'];
             $order['delivery_address_ext'] = $order['billing_address_ext'];
             $order['delivery_zip'] = $order['billing_zip'];
             $order['delivery_city'] = $order['billing_city'];
             $order['delivery_telephone'] = $order['billing_telephone'];
             $order['delivery_mobile'] = $order['billing_mobile'];
         }
         if ($order['delivery_company']) {
             $delivery_address = $order['delivery_company'] . "<br />";
         }
         if ($delivery_full_customer_name) {
             $delivery_address .= $delivery_full_customer_name . "<br />";
         }
         if ($order['delivery_building']) {
             $delivery_address .= $order['delivery_building'] . "<br />";
         }
         if ($order['delivery_address']) {
             $delivery_address .= $order['delivery_address'] . "<br />";
         }
         if ($order['delivery_zip'] and $order['delivery_city']) {
             $delivery_address .= $order['delivery_zip'] . " " . $order['delivery_city'];
         }
         if ($order['delivery_country'] && mslib_befe::strtolower($order['delivery_country']) != mslib_befe::strtolower($this->tta_shop_info['country'])) {
             // ONLY PRINT COUNTRY IF THE COUNTRY OF THE CUSTOMER IS DIFFERENT THAN FROM THE SHOP
             $delivery_address .= '<br />' . mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $order['delivery_country']);
         }
         //		if ($order['delivery_telephone']) 		$delivery_address.=ucfirst($this->pi_getLL('telephone')).': '.$order['delivery_telephone']."<br />";
         //		if ($order['delivery_mobile']) 			$delivery_address.=ucfirst($this->pi_getLL('mobile')).': '.$order['delivery_mobile']."<br />";
         if ($order['billing_company']) {
             $billing_address = $order['billing_company'] . "<br />";
         }
         if ($full_customer_name) {
             $billing_address .= $full_customer_name . "<br />";
         }
         if ($order['billing_building']) {
             $billing_address .= $order['billing_building'] . "<br />";
         }
         if ($order['billing_address']) {
             $billing_address .= $order['billing_address'] . "<br />";
         }
         if ($order['billing_zip'] and $order['billing_city']) {
             $billing_address .= $order['billing_zip'] . " " . $order['billing_city'];
         }
         if ($order['billing_country'] && mslib_befe::strtolower($order['billing_country']) != mslib_befe::strtolower($this->tta_shop_info['country'])) {
             // ONLY PRINT COUNTRY IF THE COUNTRY OF THE CUSTOMER IS DIFFERENT THAN FROM THE SHOP
             $billing_address .= '<br />' . mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $order['billing_country']);
         }
         $loadFromPids = array();
         if ($this->conf['masterShop']) {
             $loadFromPids[] = $order['page_uid'];
             $loadFromPids[] = $this->shop_pid;
             if ($this->showCatalogFromPage and $this->showCatalogFromPage != $this->shop_pid) {
                 $loadFromPids[] = $this->showCatalogFromPage;
             }
         }
         // psp email template
         $psp_mail_template = array();
         if ($order['payment_method']) {
             $psp_data = mslib_fe::loadPaymentMethod($order['payment_method']);
             $psp_vars = unserialize($psp_data['vars']);
             if (isset($psp_vars['order_confirmation'])) {
                 $psp_mail_template['order_confirmation'] = '';
                 if ($psp_vars['order_confirmation'] > 0) {
                     $psp_mail_template['order_confirmation'] = mslib_fe::getCMSType($psp_vars['order_confirmation']);
                 }
             }
             if (isset($psp_vars['order_paid'])) {
                 $psp_mail_template['order_paid'] = '';
                 if ($psp_vars['order_paid'] > 0) {
                     $psp_mail_template['order_paid'] = mslib_fe::getCMSType($psp_vars['order_paid']);
                 }
             }
         }
         // loading the email template
         $page = array();
         //hook to let other plugins further manipulate the replacers
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailOrderPreCMSContent'])) {
             $params = array('page' => &$page, 'order' => &$order, 'mail_template' => $mail_template, 'psp_mail_template' => $psp_mail_template, 'loadFromPids' => $loadFromPids);
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailOrderPreCMSContent'] as $funcRef) {
                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
             }
         }
         if ($mail_template) {
             switch ($mail_template) {
                 case 'email_order_paid_letter':
                     if (isset($psp_mail_template['order_paid'])) {
                         $page = array();
                         if (!empty($psp_mail_template['order_paid'])) {
                             $page = mslib_fe::getCMScontent($psp_mail_template['order_paid'], $GLOBALS['TSFE']->sys_language_uid, $loadFromPids);
                         }
                     } else {
                         if ($order['payment_method']) {
                             $page = mslib_fe::getCMScontent('email_order_paid_letter_' . $order['payment_method'], $GLOBALS['TSFE']->sys_language_uid, $loadFromPids);
                         }
                         if (!count($page[0])) {
                             $page = mslib_fe::getCMScontent('email_order_paid_letter', $GLOBALS['TSFE']->sys_language_uid, $loadFromPids);
                         }
                     }
                     break;
                 default:
                     $page = mslib_fe::getCMScontent($mail_template, $GLOBALS['TSFE']->sys_language_uid, $loadFromPids);
                     break;
             }
         } else {
             if ($order['is_proposal']) {
                 // proposal template
                 $mail_template = 'email_order_proposal';
                 $page = mslib_fe::getCMScontent($mail_template, $GLOBALS['TSFE']->sys_language_uid, $loadFromPids);
             } else {
                 // normal order template
                 if (isset($psp_mail_template['order_confirmation'])) {
                     $page = array();
                     if (!empty($psp_mail_template['order_confirmation'])) {
                         $page = mslib_fe::getCMScontent($psp_mail_template['order_confirmation'], $GLOBALS['TSFE']->sys_language_uid, $loadFromPids);
                     }
                 } else {
                     if ($order['payment_method']) {
                         $page = mslib_fe::getCMScontent('email_order_confirmation_' . $order['payment_method'], $GLOBALS['TSFE']->sys_language_uid, $loadFromPids);
                     }
                     if (!count($page[0])) {
                         $page = mslib_fe::getCMScontent('email_order_confirmation', $GLOBALS['TSFE']->sys_language_uid, $loadFromPids);
                     }
                 }
             }
         }
         //hook to let other plugins further manipulate the replacers
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailOrderPostCMSContent'])) {
             $params = array('page' => &$page, 'order' => &$order, 'mail_template' => $mail_template, 'psp_mail_template' => $psp_mail_template, 'loadFromPids' => $loadFromPids);
             foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailOrderPostCMSContent'] as $funcRef) {
                 \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
             }
         }
         if ($page[0]['content']) {
             // loading the email confirmation letter eof
             // replacing the variables with dynamic values
             $array1 = array();
             $array2 = array();
             $array1[] = '###GENDER_SALUTATION###';
             $array2[] = mslib_fe::genderSalutation($order['billing_gender']);
             // full billing name
             $array1[] = '###BILLING_FULL_NAME###';
             $array2[] = $full_customer_name;
             $array1[] = '###FULL_NAME###';
             $array2[] = $full_customer_name;
             $array1[] = '###BILLING_NAME###';
             $array2[] = $order['billing_name'];
             $array1[] = '###BILLING_COMPANY###';
             $array2[] = $order['billing_company'];
             $array1[] = '###BILLING_FIRST_NAME###';
             $array2[] = $order['billing_first_name'];
             $array1[] = '###BILLING_LAST_NAME###';
             $array2[] = preg_replace('/\\s+/', ' ', $order['billing_middle_name'] . ' ' . $order['billing_last_name']);
             $array1[] = '###BILLING_EMAIL###';
             $array2[] = $order['billing_email'];
             $array1[] = '###BILLING_TELEPHONE###';
             $array2[] = $order['billing_telephone'];
             $array1[] = '###BILLING_MOBILE###';
             $array2[] = $order['billing_mobile'];
             // full delivery name
             $array1[] = '###DELIVERY_NAME###';
             $array2[] = $order['delivery_name'];
             $array1[] = '###DELIVERY_FULL_NAME###';
             $array2[] = $delivery_full_customer_name;
             $array1[] = '###DELIVERY_COMPANY###';
             $array2[] = $order['delivery_company'];
             $array1[] = '###DELIVERY_FIRST_NAME###';
             $array2[] = $order['delivery_first_name'];
             $array1[] = '###DELIVERY_LAST_NAME###';
             $array2[] = preg_replace('/\\s+/', ' ', $order['delivery_middle_name'] . ' ' . $order['delivery_last_name']);
             $array1[] = '###DELIVERY_EMAIL###';
             $array2[] = $order['delivery_email'];
             $array1[] = '###DELIVERY_TELEPHONE###';
             $array2[] = $order['delivery_telephone'];
             $array1[] = '###DELIVERY_MOBILE###';
             $array2[] = $order['delivery_mobile'];
             $array1[] = '###CUSTOMER_EMAIL###';
             $array2[] = $order['billing_email'];
             if ($order['cruser_id'] && is_numeric($order['cruser_id'])) {
                 $crUser = mslib_fe::getUser($order['cruser_id']);
                 $array1[] = '###CREATED_BY_FIRST_NAME###';
                 $array2[] = preg_replace('/\\s+/', ' ', $crUser['first_name']);
                 $array1[] = '###CREATED_BY_LAST_NAME###';
                 $array2[] = preg_replace('/\\s+/', ' ', $crUser['middle_name'] . ' ' . $crUser['last_name']);
                 $array1[] = '###CREATED_BY_FULL_NAME###';
                 $array2[] = preg_replace('/\\s+/', ' ', $crUser['first_name'] . ' ' . $crUser['middle_name'] . ' ' . $crUser['last_name']);
             } else {
                 $array1[] = '###CREATED_BY_FIRST_NAME###';
                 $array2[] = '';
                 $array1[] = '###CREATED_BY_LAST_NAME###';
                 $array2[] = '';
                 $array1[] = '###CREATED_BY_FULL_NAME###';
                 $array2[] = '';
             }
             $time = $order['crdate'];
             $long_date = strftime($this->pi_getLL('full_date_format'), $time);
             $array1[] = '###ORDER_DATE_LONG###';
             // ie woensdag 23 juni, 2010
             $array2[] = $long_date;
             $array1[] = '###ORDER_DATE###';
             // 21-12-2010 in localized format
             $array2[] = strftime("%x", $time);
             // backwards compatibility
             $array1[] = '###LONG_DATE###';
             // ie woensdag 23 juni, 2010
             $array2[] = $long_date;
             $time = time();
             $long_date = strftime($this->pi_getLL('full_date_format'), $time);
             $array1[] = '###CURRENT_DATE_LONG###';
             // ie woensdag 23 juni, 2010
             $array2[] = $long_date;
             $array1[] = '###STORE_NAME###';
             $array2[] = $this->ms['MODULES']['STORE_NAME'];
             $array1[] = '###TOTAL_AMOUNT###';
             $array2[] = mslib_fe::amount2Cents($order['total_amount']);
             $array1[] = '###PROPOSAL_NUMBER###';
             $array2[] = $order['orders_id'];
             $array1[] = '###ORDER_NUMBER###';
             $array2[] = $order['orders_id'];
             $array1[] = '###ORDER_LINK###';
             $array2[] = '';
             $array1[] = '###ORDER_STATUS###';
             $array2[] = $order['orders_status'];
             $array1[] = '###TRACK_AND_TRACE_CODE###';
             $array2[] = $order['track_and_trace_code'];
             $array1[] = '###BILLING_ADDRESS###';
             $array2[] = $billing_address;
             $array1[] = '###DELIVERY_ADDRESS###';
             $array2[] = $delivery_address;
             $array1[] = '###BILLING_STREET_NAME###';
             $array2[] = $order['billing_street_name'];
             $array1[] = '###BILLING_ADDRESS_NUMBER###';
             $array2[] = $order['billing_address_number'];
             $array1[] = '###BILLING_ADDRESS_EXT###';
             $array2[] = $order['billing_address_ext'];
             $array1[] = '###BILLING_ZIP###';
             $array2[] = $order['billing_zip'];
             $array1[] = '###BILLING_CITY###';
             $array2[] = $order['billing_city'];
             $array1[] = '###BILLING_COUNTRY###';
             $array2[] = mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $order['billing_country']);
             $array1[] = '###DELIVERY_STREET_NAME###';
             $array2[] = $order['delivery_street_name'];
             $array1[] = '###DELIVERY_ADDRESS_NUMBER###';
             $array2[] = $order['delivery_address_number'];
             $array1[] = '###DELIVERY_ADDRESS_EXT###';
             $array2[] = $order['delivery_address_ext'];
             $array1[] = '###DELIVERY_ZIP###';
             $array2[] = $order['delivery_zip'];
             $array1[] = '###DELIVERY_CITY###';
             $array2[] = $order['delivery_city'];
             $array1[] = '###DELIVERY_COUNTRY###';
             $array2[] = mslib_fe::getTranslatedCountryNameByEnglishName($this->lang, $order['delivery_country']);
             $array1[] = '###CUSTOMER_ID###';
             $array2[] = $order['customer_id'];
             $ORDER_DETAILS = self::printOrderDetailsTable($order, 'email');
             if ($this->ms['MODULES']['CREATE_INVOICE_DIRECTLY_AFTER_CREATING_ORDER']) {
                 // FORCE CREATE INVOICE IF NOT ALREADY EXISTING
                 $invoice = mslib_fe::getOrderInvoice($order['orders_id'], 1);
             } else {
                 $invoice = mslib_fe::getOrderInvoice($order['orders_id'], 0);
             }
             $invoice_id = '';
             $invoice_link = '';
             if (is_array($invoice)) {
                 $invoice_id = $invoice['invoice_id'];
                 $invoice_link = '<a href="' . $this->FULL_HTTP_URL . mslib_fe::typolink($this->shop_pid . ',2002', '&tx_multishop_pi1[page_section]=download_invoice&tx_multishop_pi1[hash]=' . $invoice['hash']) . '">' . $invoice['invoice_id'] . '</a>';
             }
             $array1[] = '###INVOICE_NUMBER###';
             $array2[] = $invoice_id;
             $array1[] = '###INVOICE_LINK###';
             $array2[] = $invoice_link;
             $array1[] = '###ORDER_DETAILS###';
             $array2[] = $ORDER_DETAILS;
             $array1[] = '###SHIPPING_METHOD###';
             $array2[] = $order['shipping_method_label'];
             $array1[] = '###PAYMENT_METHOD###';
             $array2[] = $order['payment_method_label'];
             $array1[] = '###EXPECTED_DELIVERY_DATE###';
             if ($order['expected_delivery_date'] > 0) {
                 $array2[] = strftime("%x", $order['expected_delivery_date']);
             } else {
                 $array2[] = '';
             }
             $array1[] = '###EXPECTED_DELIVERY_DATE_LONG###';
             if ($order['expected_delivery_date'] > 0) {
                 $array2[] = strftime($this->pi_getLL('full_date_format'), $order['expected_delivery_date']);
             } else {
                 $array2[] = '';
             }
             $array1[] = '###CUSTOMER_COMMENTS###';
             $array2[] = $order['customer_comments'];
             if ($order['customer_id'] > 0) {
                 $user = mslib_fe::getUser($order['customer_id']);
                 $array1[] = '###USERNAME###';
                 $array2[] = $user['username'];
                 if (isset($this->post['password']) && !empty($this->post['password']) && $order['customer_id'] > 0) {
                     $array1[] = '###PASSWORD###';
                     $array2[] = $this->post['password'];
                 }
             }
             //hook to let other plugins further manipulate the replacers
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailOrderReplacersPostProc'])) {
                 $params = array('array1' => &$array1, 'array2' => &$array2, 'order' => &$order, 'mail_template' => $mail_template, 'loadFromPids' => $loadFromPids);
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailOrderReplacersPostProc'] as $funcRef) {
                     \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
                 }
             }
             // Copy
             $pageCopyToMerchant = $page;
             if ($page[0]['content']) {
                 $page[0]['content'] = str_replace($array1, $array2, $page[0]['content']);
             }
             if ($page[0]['name']) {
                 $page[0]['name'] = str_replace($array1, $array2, $page[0]['name']);
             }
             // replacing the variables with dynamic values eof
             $user = array();
             $user['name'] = $full_customer_name;
             $user['email'] = $custom_email_address;
             //hook
             $send_mail = 1;
             $mail_attachment = array();
             $add_invoice_attachment_on_templates = array();
             $add_invoice_attachment_on_templates[] = 'email_order_paid_letter';
             if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailOrder'])) {
                 $params = array('this' => &$this, 'page' => &$page, 'content' => &$content, 'send_mail' => &$send_mail, 'user' => $user, 'order' => $order, 'order_details' => $ORDER_DETAILS, 'copy_to_merchant' => $copy_to_merchant, 'mail_attachment' => &$mail_attachment, 'loadFromPids' => $loadFromPids, 'add_invoice_attachment_on_templates' => &$add_invoice_attachment_on_templates);
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailOrder'] as $funcRef) {
                     \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $params, $this);
                 }
             }
             if ($send_mail) {
                 if ($user['email']) {
                     if (in_array($mail_template, $add_invoice_attachment_on_templates) && $this->ms['MODULES']['ATTACH_INVOICE_PDF_IN_PAID_LETTER_EMAIL'] > 0) {
                         $filterInvoice = array();
                         $filterInvoice[] = 'orders_id=' . $order['orders_id'];
                         $invoices = mslib_befe::getRecords('', 'tx_multishop_invoices', '', $filterInvoice, '', 'id desc');
                         $invoice = $invoices[0];
                         $pdfFileName = $invoice['invoice_id'] . '_' . $invoice['orders_id'] . '.pdf';
                         $pdfFilePath = $this->DOCUMENT_ROOT . 'uploads/tx_multishop/tmp/' . $pdfFileName;
                         // generate the invoice PDF
                         // Get Language code (ie nl, en, de)
                         $language_code = mslib_befe::getLanguageIso2ByLanguageUid($order['language_id']);
                         $language_code = strtolower($language_code);
                         // Download invoice in the language of the order
                         $invoice_data = mslib_fe::file_get_contents($this->FULL_HTTP_URL . mslib_fe::typolink($this->shop_pid . ',2002', 'tx_multishop_pi1[page_section]=download_invoice&tx_multishop_pi1[hash]=' . $invoice['hash'] . '&tx_multishop_pi1[forceRecreate]=1&language=' . $language_code));
                         file_put_contents($pdfFilePath, $invoice_data);
                         $mail_attachment[] = $pdfFilePath;
                     }
                     mslib_fe::mailUser($user, $page[0]['name'], $page[0]['content'], $this->ms['MODULES']['STORE_EMAIL'], $this->ms['MODULES']['STORE_NAME'], $mail_attachment);
                     // moved to cleaning up section
                     //if (strpos($mail_template, 'email_order_paid_letter')!==false && $this->ms['MODULES']['ATTACH_INVOICE_PDF_IN_PAID_LETTER_EMAIL']>0 && file_exists($pdfFilePath)) {
                     //	unlink($pdfFilePath);
                     //}
                 }
                 if ($copy_to_merchant) {
                     $mailSubject = '';
                     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailOrderToMerchant'])) {
                         $conf = array('this' => &$this, 'page' => &$page, 'content' => &$content, 'send_mail' => &$send_mail, 'user' => $user, 'order' => $order, 'order_details' => $ORDER_DETAILS, 'mail_attachment' => &$mail_attachment, 'mail_template' => $mail_template, 'psp_mail_template' => $psp_mail_template, 'loadFromPids' => $loadFromPids, 'mailSubject' => &$mailSubject, 'pageCopyToMerchant' => &$pageCopyToMerchant, 'array1' => &$array1, 'array2' => &$array2);
                         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/multishop/pi1/classes/class.mslib_fe.php']['mailOrderToMerchant'] as $funcRef) {
                             \TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction($funcRef, $conf, $this);
                         }
                     }
                     if ($pageCopyToMerchant[0]['content']) {
                         $pageCopyToMerchant[0]['content'] = str_replace($array1, $array2, $pageCopyToMerchant[0]['content']);
                     }
                     if ($pageCopyToMerchant[0]['name']) {
                         $pageCopyToMerchant[0]['name'] = str_replace($array1, $array2, $pageCopyToMerchant[0]['name']);
                     }
                     if ($mailSubject == '') {
                         $mailSubject = $this->pi_getLL('copy_for_merchant') . ': ' . $pageCopyToMerchant[0]['name'];
                     }
                     // now mail a copy to the merchant
                     $merchant = array();
                     $merchant['name'] = $this->ms['MODULES']['STORE_NAME'];
                     $merchant['email'] = $this->ms['MODULES']['STORE_EMAIL'];
                     mslib_fe::mailUser($merchant, $mailSubject, $pageCopyToMerchant[0]['content'], $this->ms['MODULES']['STORE_EMAIL'], $this->ms['MODULES']['STORE_NAME'], $mail_attachment);
                     if ($this->ms['MODULES']['SEND_ORDER_CONFIRMATION_LETTER_ALSO_TO']) {
                         $email = array();
                         if (!strstr($this->ms['MODULES']['SEND_ORDER_CONFIRMATION_LETTER_ALSO_TO'], ",")) {
                             $email[] = $this->ms['MODULES']['SEND_ORDER_CONFIRMATION_LETTER_ALSO_TO'];
                         } else {
                             $email = explode(',', $this->ms['MODULES']['SEND_ORDER_CONFIRMATION_LETTER_ALSO_TO']);
                         }
                         if (count($email)) {
                             foreach ($email as $item) {
                                 $merchant = array();
                                 $merchant['name'] = $this->ms['MODULES']['STORE_NAME'];
                                 $merchant['email'] = $item;
                                 mslib_fe::mailUser($merchant, $mailSubject, $pageCopyToMerchant[0]['content'], $this->ms['MODULES']['STORE_EMAIL'], $this->ms['MODULES']['STORE_NAME'], $mail_attachment);
                             }
                         }
                     }
                 }
                 // cleaning up the temporary attachment files
                 if (is_array($mail_attachment) && count($mail_attachment)) {
                     foreach ($mail_attachment as $filepath) {
                         if (strpos($filepath, 'tx_multishop/tmp') !== false) {
                             if (file_exists($filepath)) {
                                 @unlink($filepath);
                             }
                         }
                     }
                 }
             }
         }
         if (isset($order['language_id'])) {
             // Switch back to default language
             mslib_befe::resetSystemLanguage();
         }
         return 1;
     }
 }
Beispiel #6
0
 $ORDER_DETAILS = $mslib_order->printOrderDetailsTable($order, 'site');
 $array1[] = '###ORDER_DETAILS###';
 $array2[] = $ORDER_DETAILS;
 $array1[] = '###BILLING_ADDRESS###';
 $array2[] = $billing_address;
 $array1[] = '###DELIVERY_ADDRESS###';
 $array2[] = $delivery_address;
 $array1[] = '###CUSTOMER_ID###';
 $array2[] = $order['customer_id'];
 $array1[] = '###SHIPPING_METHOD###';
 $array2[] = $order['shipping_method_label'];
 $array1[] = '###PAYMENT_METHOD###';
 $array2[] = $order['payment_method_label'];
 $array1[] = '###ORDERS_ID###';
 $array2[] = $order['orders_id'];
 $invoice = mslib_fe::getOrderInvoice($order['orders_id'], 0);
 $invoice_id = '';
 $invoice_link = '';
 if (is_array($invoice)) {
     $invoice_id = $invoice['invoice_id'];
     $invoice_link = '<a href="' . $this->FULL_HTTP_URL . mslib_fe::typolink($this->shop_pid . ',2002', 'tx_multishop_pi1[page_section]=download_invoice&tx_multishop_pi1[hash]=' . $invoice['hash']) . '">' . $invoice['invoice_id'] . '</a>';
 }
 $array1[] = '###INVOICE_NUMBER###';
 $array2[] = $invoice_id;
 $array1[] = '###INVOICE_LINK###';
 $array2[] = $invoice_link;
 $time = $order['crdate'];
 $long_date = strftime($this->pi_getLL('full_date_format'), $time);
 $array1[] = '###ORDER_DATE_LONG###';
 // ie woensdag 23 juni, 2010
 $array2[] = $long_date;