echo "\t\t\t<input type='hidden' id='item_count' value='" . $itemsCnt . "'/>"; echo "\t\t</form>\n"; echo "\t\t</div>\n"; echo "\t</div>\n"; echo "\t<br clear='all'/><br/><br/>\n"; echo "\t<table class='sofort_table'>\n"; echo "\t\t<tr class='sofort_htr'>\n"; echo "\t\t\t<td class='sofort_htd' align='center' width='16%'>" . TABLE_HEADING_DATE_ADDED . "</td>\n"; echo "\t\t\t<td class='sofort_htd' align='center' width='16%'>" . TABLE_HEADING_CUSTOMER_NOTIFIED . "</td>\n"; echo "\t\t\t<td class='sofort_htd' align='center' width='16%'>" . TABLE_HEADING_STATUS . "</td>\n"; echo "\t\t\t<td class='sofort_htd' align='center' width='52%'>" . TABLE_HEADING_COMMENTS . "</td>\n"; echo "\t\t</tr>\n"; $ordersHistoryQuery = shopDbQuery('SELECT orders_status_id, date_added, customer_notified, comments FROM ' . TABLE_ORDERS_STATUS_HISTORY . ' WHERE orders_id = \'' . $oID . '\' ORDER BY date_added'); if (shopDbNumRows($ordersHistoryQuery)) { $i = 0; while ($ordersHistory = shopDbFetchArray($ordersHistoryQuery)) { $bgColor = $i % 2 ? '#E0E0E0' : '#FAFAFA'; $i++; echo "\t\t<tr class='sofort_tr' style='background-color:" . $bgColor . "'>\n"; echo "\t\t\t<td class='sofort_td' align='center'>" . shopDatetimeShort($ordersHistory['date_added']) . "</td>\n"; echo "\t\t\t<td class='sofort_td' align='center'>"; if ($ordersHistory['customer_notified'] == '1') { echo "<img src='" . shopGetIconPath() . "ok.gif' />"; } elseif ($ordersHistory['customer_notified'] == '-1') { echo "<img src='" . shopGetIconPath() . "lock.gif' />"; } else { echo "<img src='" . shopGetIconPath() . "error.gif' />"; } echo "</td>\n"; echo "\t\t\t<td class='sofort_td' align='left'>" . $ordersStatusArray[$ordersHistory['orders_status_id']] . "</td>\n"; echo "\t\t\t<td class='sofort_td' align='left'>" . nl2br(shopDbOutput($ordersHistory['comments'])) . "</td>\n";
/** * handle and submit status / comment change via orderdetailpage * @param int $oID * @param object $order * @param string $status * @param string $comments * @param string $notifyCustomer * @param string $notifyWithComments */ function shopSofortComment($oID, $order, $status, $comments, $notifyCustomer, $notifyWithComments) { global $messageStack; $order_updated = false; $check_status_query = shopDbQuery("SELECT customers_name, customers_email_address, orders_status, date_purchased FROM " . TABLE_ORDERS . " WHERE orders_id = '" . shopDbInput($oID) . "'"); $check_status = shopDbFetchArray($check_status_query); if ($check_status['orders_status'] != $status || $comments != '') { shopDbQuery("UPDATE " . TABLE_ORDERS . " SET orders_status = '" . shopDbInput($status) . "', last_modified = now() WHERE orders_id = '" . shopDbInput($oID) . "'"); $customer_notified = '0'; if ($notifyCustomer == 'on') { $notify_comments = ''; if ($notifyWithComments == 'on') { $notify_comments = $comments; } else { $notify_comments = ''; } $smarty = new Smarty(); $smarty->assign('language', $_SESSION['language']); $smarty->caching = false; $smarty->template_dir = DIR_FS_CATALOG . 'templates'; $smarty->compile_dir = DIR_FS_CATALOG . 'templates_c'; $smarty->config_dir = DIR_FS_CATALOG . 'lang'; $smarty->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/'); $smarty->assign('logo_path', HTTP_SERVER . DIR_WS_CATALOG . 'templates/' . CURRENT_TEMPLATE . '/img/'); $smarty->assign('NAME', $check_status['customers_name']); $smarty->assign('ORDER_NR', $oID); $smarty->assign('ORDER_LINK', shopCatalogHrefLink(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL')); $smarty->assign('ORDER_DATE', shopDateLong($check_status['date_purchased'])); $smarty->assign('NOTIFY_COMMENTS', $notify_comments); $smarty->assign('ORDER_STATUS', $orders_status_array[$status]); $html_mail = $smarty->fetch('db:change_order_mail.html'); $txt_mail = $smarty->fetch('db:change_order_mail.txt'); shopDbMail(EMAIL_BILLING_ADDRESS, EMAIL_BILLING_NAME, $check_status['customers_email_address'], $check_status['customers_name'], '', EMAIL_BILLING_REPLY_ADDRESS, EMAIL_BILLING_REPLY_ADDRESS_NAME, '', '', EMAIL_BILLING_SUBJECT, $html_mail, $txt_mail); $customer_notified = '1'; } shopDbQuery("INSERT INTO " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) VALUES ('" . shopDbInput($oID) . "', '" . shopDbInput($status) . "', now(), '" . $customer_notified . "', '" . shopDbInput($comments) . "')"); $order_updated = true; } if ($order_updated) { $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success'); } else { $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning'); } return; }
/** * inserts a "new total" comment into shop order status history * @param int $orderId * @param string $status * @param date $time * @param PnagInvoice $PnagInvoice * @param float $lastShopTotal */ protected function _insertNewTotalCommentToHistory($orderId, $status, $time, PnagInvoice $PnagInvoice, $lastShopTotal) { $newTotal = $PnagInvoice->getAmount(); if ($newTotal > $lastShopTotal) { $comment = MODULE_PAYMENT_SOFORT_SR_TRANSLATE_CART_RESET . ' ' . MODULE_PAYMENT_SOFORT_SR_TRANSLATE_CURRENT_TOTAL . ' ' . $newTotal . ' Euro ' . MODULE_PAYMENT_SOFORT_SR_TRANSLATE_TIME . ': ' . $time; } else { $comment = MODULE_PAYMENT_SOFORT_SR_TRANSLATE_CART_EDITED . ' ' . MODULE_PAYMENT_SOFORT_SR_TRANSLATE_CURRENT_TOTAL . ' ' . $newTotal . ' Euro ' . MODULE_PAYMENT_SOFORT_SR_TRANSLATE_TIME . ': ' . $time; } $sqlDataArray = array('orders_id' => (int) $orderId, 'orders_status_id' => $status, 'date_added' => 'now()', 'customer_notified' => 0, 'comments' => $comment); shopDbPerform(TABLE_ORDERS_STATUS_HISTORY, $sqlDataArray); $sofortOrdersId = shopDbFetchArray(shopDbQuery('SELECT id FROM sofort_orders WHERE orders_id = "' . $orderId . '"')); HelperFunctions::insertSofortOrdersNotification($sofortOrdersId['id'], $PnagInvoice, $comment, $comment); }