Skip to content

Commit

Permalink
#3487 - Order Summary to Have Last Updated & Log OID
Browse files Browse the repository at this point in the history
  • Loading branch information
abrookbanks committed Mar 13, 2024
1 parent 9478341 commit 66a346b
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 3 deletions.
2 changes: 2 additions & 0 deletions admin/skins/default/templates/orders.index.php
Expand Up @@ -35,6 +35,7 @@
<td>{$THEAD.customer}</td>
<td nowrap="nowrap">{$THEAD.status}</td>
<td>{$THEAD.date}</td>
<td>{$THEAD.updated}</td>
<td>{$THEAD.total}</td>
<td>&nbsp;</td>
</tr>
Expand All @@ -58,6 +59,7 @@
</td>
<td class="{$order.status_class}">{$order.status}</td>
<td>{$order.date}</td>
<td>{$order.updated}</td>
<td style="text-align:right">{$order.prod_total}</td>
<td style="text-align:center">
<a href="{$order.link_print}" class="print" target="_blank" title="{$LANG.common.print}"><i class="fa fa-print" title="{$LANG.common.print}"></i></a>
Expand Down
4 changes: 3 additions & 1 deletion admin/sources/orders.index.inc.php
Expand Up @@ -469,7 +469,7 @@
$GLOBALS['main']->addTabControl($lang['orders']['title_card_details'], 'credit_card');
$decrypt = Encryption::getInstance();
$decrypt->setup(false, $summary[0]['cart_order_id']);
$card = unserialize($decrypt->decrypt(stripslashes($summary[0]['offline_capture'])));
$card = unserialize((string)$decrypt->decrypt(stripslashes($summary[0]['offline_capture'])));

$card = (!empty($card)) ? $card : array('card_type' => '', 'card_number' => '', 'card_expire' => '', 'card_valid' => '', 'card_issue' => '', 'card_cvv' => '');
foreach ($card as $key => $value) {
Expand Down Expand Up @@ -831,6 +831,7 @@
'customer' => $GLOBALS['db']->column_sort('customer', $lang['orders']['title_customer'], 'sort', $current_page, $_GET['sort']),
'status' => $GLOBALS['db']->column_sort('status', $lang['common']['status'], 'sort', $current_page, $_GET['sort']),
'date' => $GLOBALS['db']->column_sort('order_date', $lang['common']['date'], 'sort', $current_page, $_GET['sort']),
'updated' => $GLOBALS['db']->column_sort('updated', $lang['common']['updated'], 'sort', $current_page, $_GET['sort']),
'total' => $GLOBALS['db']->column_sort('total', $lang['basket']['total'], 'sort', $current_page, $_GET['sort'])
);

Expand Down Expand Up @@ -885,6 +886,7 @@
$order['status_class'] = 'order_status_'.$order['status'];
$order['status'] = $lang['order_state']['name_'.$order['status']];
$order['date'] = formatTime($order['order_date']);
$order['updated'] = formatTime(strtotime($order['updated']));
$order['prod_total'] = Tax::getInstance()->priceFormat($order['total']);

$smarty_data['list_orders'][] = $order;
Expand Down
7 changes: 7 additions & 0 deletions admin/sources/settings.logs.inc.php
Expand Up @@ -82,6 +82,13 @@
$log['item_link'] = '';
if(!empty($log['item_id']) && !empty($log['item_type'])) {
switch($log['item_type']) {
case 'oid':
$item = $GLOBALS['db']->select('CubeCart_order_summary', array('cart_order_id'), array('cart_order_id' => $log['item_id']));
if($item && !empty($item[0]['cart_order_id'])) {
$log['item_name'] = $item[0]['cart_order_id'];
$log['item_link'] = '?_g=orders&action=edit&order_id='.$log['item_id'];
}
break;
case 'prod':
$item = $GLOBALS['db']->select('CubeCart_inventory', array('name'), array('product_id' => $log['item_id']));
if($item && !empty($item[0]['name'])) {
Expand Down
4 changes: 4 additions & 0 deletions classes/acp.class.php
Expand Up @@ -162,6 +162,10 @@ public function adminLog($message)
{
$item_id = null;
$item_type = null;
if(isset($_REQUEST['order_id'])) {
$item_id = $_REQUEST['order_id'];
$item_type = 'oid';
}
if(isset($_REQUEST['product_id'])) {
$item_id = $_REQUEST['product_id'];
$item_type = 'prod';
Expand Down
3 changes: 2 additions & 1 deletion setup/db/install/structure.sql
Expand Up @@ -60,7 +60,7 @@ CREATE TABLE IF NOT EXISTS `CubeCart_admin_log` (
`time` INT UNSIGNED NOT NULL,
`ip_address` VARCHAR(45) NOT NULL,
`description` TEXT NOT NULL,
`item_id` INT UNSIGNED NULL,
`item_id` VARCHAR(255) UNSIGNED NULL,
`item_type` VARCHAR(4) NULL,
PRIMARY KEY (`log_id`),
KEY `admin_id` (`admin_id`),
Expand Down Expand Up @@ -794,6 +794,7 @@ CREATE TABLE IF NOT EXISTS `CubeCart_order_summary` (
`note_to_customer` TEXT,
`custom_oid` varchar(50) DEFAULT NULL,
`currency` varchar(3) DEFAULT '',
`updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `cart_order_id` (`cart_order_id`),
UNIQUE KEY `custom_oid` (`custom_oid`),
Expand Down
4 changes: 3 additions & 1 deletion setup/db/upgrade/6.5.4.sql
Expand Up @@ -18,4 +18,6 @@ ALTER TABLE `CubeCart_reviews` CHANGE `email` `email` VARCHAR(96); #EOQ
ALTER TABLE `CubeCart_customer_coupon` CHANGE `email` `email` VARCHAR(96); #EOQ
ALTER TABLE `CubeCart_admin_users` CHANGE `email` `email` VARCHAR(96); #EOQ
ALTER TABLE `CubeCart_category_language` CHANGE `cat_desc` `cat_desc` TEXT NULL DEFAULT NULL; #EOQ
ALTER TABLE `CubeCart_inventory` CHANGE `maximum_quantity` `maximum_quantity` INT NULL DEFAULT '0'; #EOQ
ALTER TABLE `CubeCart_inventory` CHANGE `maximum_quantity` `maximum_quantity` INT NULL DEFAULT '0'; #EOQ
ALTER TABLE `CubeCart_order_summary` ADD `updated` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP; #EOQ
ALTER TABLE `CubeCart_admin_log` CHANGE `item_id` `item_id` VARCHAR(255) NULL DEFAULT NULL; #EOQ

0 comments on commit 66a346b

Please sign in to comment.