function fn_rma_update_details($data) { fn_set_hook('rma_update_details_pre', $data); $change_return_status = $data['change_return_status']; $_data = array(); $show_confirmation_page = false; if (isset($data['comment'])) { $_data['comment'] = $data['comment']; } $is_refund = fn_is_refund_action($change_return_status['action']); $confirmed = isset($data['confirmed']) ? $data['confirmed'] : ''; $st_inv = fn_get_statuses(STATUSES_RETURN); $show_confirmation = false; if (($change_return_status['recalculate_order'] == 'M' && $is_refund == 'Y' || $change_return_status['recalculate_order'] == 'R') && $change_return_status['status_to'] != $change_return_status['status_from'] && !($st_inv[$change_return_status['status_from']]['params']['inventory'] == 'D' && $change_return_status['status_to'] == RMA_DEFAULT_STATUS) && !($st_inv[$change_return_status['status_to']]['params']['inventory'] == 'D' && $change_return_status['status_from'] == RMA_DEFAULT_STATUS)) { $show_confirmation = true; } if ($show_confirmation == true) { if ($confirmed == 'Y') { fn_rma_recalculate_order($change_return_status['order_id'], $change_return_status['recalculate_order'], $change_return_status['return_id'], $is_refund, $change_return_status); $_data['status'] = $change_return_status['status_to']; } else { $change_return_status['inventory_to'] = $st_inv[$change_return_status['status_to']]['params']['inventory']; $change_return_status['inventory_from'] = $st_inv[$change_return_status['status_from']]['params']['inventory']; $_SESSION['change_return_status'] = $change_return_status; $show_confirmation_page = true; } } else { $_data['status'] = $change_return_status['status_to']; } if (!empty($_data)) { db_query("UPDATE ?:rma_returns SET ?u WHERE return_id = ?i", $_data, $change_return_status['return_id']); } if (($show_confirmation == false || $show_confirmation == true && $confirmed == 'Y') && $change_return_status['status_from'] != $change_return_status['status_to']) { $order_items = db_get_hash_single_array("SELECT item_id, extra FROM ?:order_details WHERE ?:order_details.order_id = ?i", array('item_id', 'extra'), $change_return_status['order_id']); foreach ($order_items as $item_id => $extra) { $extra = @unserialize($extra); if (isset($extra['returns'][$change_return_status['return_id']])) { $extra['returns'][$change_return_status['return_id']]['status'] = $change_return_status['status_to']; db_query('UPDATE ?:order_details SET ?u WHERE item_id = ?i AND order_id = ?i', array('extra' => serialize($extra)), $item_id, $change_return_status['order_id']); } } $return_info = fn_get_return_info($change_return_status['return_id']); $order_info = fn_get_order_info($change_return_status['order_id']); fn_send_return_mail($return_info, $order_info, fn_get_notification_rules($change_return_status)); } fn_set_hook('rma_update_details_post', $data, $show_confirmation_page, $show_confirmation, $is_refund, $_data, $confirmed); return $show_confirmation_page; }
$return_id = intval($_REQUEST['return_id']); // [Breadcrumbs] if (AREA != 'A') { fn_add_breadcrumb(__('return_requests'), "rma.returns"); fn_add_breadcrumb(__('return_info')); } // [/Breadcrumbs] Registry::set('navigation.tabs', array('return_products' => array('title' => __('return_products_information'), 'js' => true), 'declined_products' => array('title' => __('declined_products_information'), 'js' => true))); $return_info = fn_get_return_info($return_id); if (AREA == 'C' && (empty($return_info) || $return_info['user_id'] != $auth['user_id'])) { return array(CONTROLLER_STATUS_DENIED); } if (AREA == 'A') { Registry::set('navigation.tabs.comments', array('title' => __('comments'), 'js' => true)); Registry::set('navigation.tabs.actions', array('title' => __('actions'), 'js' => true)); Tygh::$app['view']->assign('is_refund', fn_is_refund_action($return_info['action'])); Tygh::$app['view']->assign('order_info', fn_get_order_info($return_info['order_id'])); } $return_info['extra'] = !empty($return_info['extra']) ? unserialize($return_info['extra']) : array(); if (!is_array($return_info['extra'])) { $return_info['extra'] = array(); } Tygh::$app['view']->assign('reasons', fn_get_rma_properties(RMA_REASON)); Tygh::$app['view']->assign('actions', fn_get_rma_properties(RMA_ACTION)); Tygh::$app['view']->assign('return_info', $return_info); } elseif ($mode == 'print_slip' && !empty($_REQUEST['return_id'])) { if (fn_rma_print_packing_slips($_REQUEST['return_id'], $auth) == false) { return array(CONTROLLER_STATUS_NO_PAGE); } exit; } elseif ($mode == 'returns') {
if ($mode == 'm_delete_properties') { foreach ($_REQUEST['property_ids'] as $property_id) { fn_rma_delete_property($property_id); } $suffix = ".properties?property_type={$_REQUEST['property_type']}"; } // // Updating return details // if ($mode == 'update_details') { $change_return_status = $_REQUEST['change_return_status']; $_data = array(); if (isset($_REQUEST['comment'])) { $_data['comment'] = $_REQUEST['comment']; } $is_refund = fn_is_refund_action($change_return_status['action']); $confirmed = isset($_REQUEST['confirmed']) ? $_REQUEST['confirmed'] : ''; $st_inv = fn_get_statuses(STATUSES_RETURN); $show_confirmation = false; if (($change_return_status['recalculate_order'] == 'M' && $is_refund == 'Y' || $change_return_status['recalculate_order'] == 'R') && $change_return_status['status_to'] != $change_return_status['status_from'] && !($st_inv[$change_return_status['status_from']]['params']['inventory'] == 'D' && $change_return_status['status_to'] == RMA_DEFAULT_STATUS) && !($st_inv[$change_return_status['status_to']]['params']['inventory'] == 'D' && $change_return_status['status_from'] == RMA_DEFAULT_STATUS)) { $show_confirmation = true; } $suffix = ".details?return_id={$change_return_status['return_id']}"; if ($show_confirmation == true) { if ($confirmed == 'Y') { fn_rma_recalculate_order($change_return_status['order_id'], $change_return_status['recalculate_order'], $change_return_status['return_id'], $is_refund, $change_return_status); $_data['status'] = $change_return_status['status_to']; } else { $change_return_status['inventory_to'] = $st_inv[$change_return_status['status_to']]['params']['inventory']; $change_return_status['inventory_from'] = $st_inv[$change_return_status['status_from']]['params']['inventory']; $_SESSION['change_return_status'] = $change_return_status;
$return_id = intval($_REQUEST['return_id']); // [Breadcrumbs] if (AREA != 'A') { fn_add_breadcrumb(fn_get_lang_var('return_requests'), "rma.returns"); fn_add_breadcrumb(fn_get_lang_var('return_info')); } else { fn_add_breadcrumb(fn_get_lang_var('return_requests'), "rma.returns.reset_view"); fn_add_breadcrumb(fn_get_lang_var('search_results'), "rma.returns.last_view"); } // [/Breadcrumbs] Registry::set('navigation.tabs', array('return_products' => array('title' => fn_get_lang_var('return_products_information'), 'js' => true), 'declined_products' => array('title' => fn_get_lang_var('declined_products_information'), 'js' => true))); $return_info = fn_get_return_info($return_id); if (AREA == 'A') { Registry::set('navigation.tabs.comments', array('title' => fn_get_lang_var('comments'), 'js' => true)); Registry::set('navigation.tabs.actions', array('title' => fn_get_lang_var('actions'), 'js' => true)); $view->assign('is_refund', fn_is_refund_action($return_info['action'])); $view->assign('order_info', fn_get_order_info($return_info['order_id'])); } $view->assign('reasons', fn_get_rma_properties(RMA_REASON)); $view->assign('actions', fn_get_rma_properties(RMA_ACTION)); $view->assign('return_info', $return_info); } elseif ($mode == 'print_slip' && !empty($_REQUEST['return_id'])) { $return_id = intval($_REQUEST['return_id']); $return_info = fn_get_return_info($return_id); $order_info = fn_get_order_info($return_info['order_id']); if (empty($return_info) || empty($order_info)) { return array(CONTROLLER_STATUS_NO_PAGE); } $view_mail->assign('reasons', fn_get_rma_properties(RMA_REASON)); $view_mail->assign('actions', fn_get_rma_properties(RMA_ACTION)); $view_mail->assign('return_info', $return_info);
$return_id = intval($_REQUEST['return_id']); // [Breadcrumbs] if (AREA != 'A') { fn_add_breadcrumb(__('return_requests'), "rma.returns"); fn_add_breadcrumb(__('return_info')); } // [/Breadcrumbs] Registry::set('navigation.tabs', array('return_products' => array('title' => __('return_products_information'), 'js' => true), 'declined_products' => array('title' => __('declined_products_information'), 'js' => true))); $return_info = fn_get_return_info($return_id); if (AREA == 'C' && (empty($return_info) || $return_info['user_id'] != $auth['user_id'])) { return array(CONTROLLER_STATUS_DENIED); } if (AREA == 'A') { Registry::set('navigation.tabs.comments', array('title' => __('comments'), 'js' => true)); Registry::set('navigation.tabs.actions', array('title' => __('actions'), 'js' => true)); Registry::get('view')->assign('is_refund', fn_is_refund_action($return_info['action'])); Registry::get('view')->assign('order_info', fn_get_order_info($return_info['order_id'])); } $return_info['extra'] = !empty($return_info['extra']) ? unserialize($return_info['extra']) : array(); if (!is_array($return_info['extra'])) { $return_info['extra'] = array(); } Registry::get('view')->assign('reasons', fn_get_rma_properties(RMA_REASON)); Registry::get('view')->assign('actions', fn_get_rma_properties(RMA_ACTION)); Registry::get('view')->assign('return_info', $return_info); } elseif ($mode == 'print_slip' && !empty($_REQUEST['return_id'])) { if (fn_rma_print_packing_slips($_REQUEST['return_id'], $auth) == false) { return array(CONTROLLER_STATUS_NO_PAGE); } exit; } elseif ($mode == 'returns') {