<?php /*************************************************************************** * * * (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev * * * * This is commercial software, only users who have purchased a valid * * license and accept to the terms of the License Agreement can install * * and use this program. * * * **************************************************************************** * PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE * * "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. * ****************************************************************************/ use Tygh\Registry; if (!defined('BOOTSTRAP')) { die('Access denied'); } if ($_SERVER['REQUEST_METHOD'] == 'POST') { return; } if ($mode == 'manage') { if ($_REQUEST['type'] == STATUSES_RETURN) { Registry::get('view')->assign('title', __('rma_request_statuses')); fn_rma_generate_sections('statuses'); } }
// [Breadcrumbs] if (AREA != 'A') { fn_add_breadcrumb(__('return_requests')); } // [/Breadcrumbs] $params = $_REQUEST; if (AREA == 'C') { $params['user_id'] = $auth['user_id']; if (!empty($auth['order_ids'])) { $params['order_ids'] = $auth['order_ids']; } } list($return_requests, $search) = fn_get_rma_returns($params, Registry::get('settings.Appearance.' . (AREA == 'A' ? 'admin_' : '') . 'elements_per_page')); Tygh::$app['view']->assign('return_requests', $return_requests); Tygh::$app['view']->assign('search', $search); fn_rma_generate_sections('requests'); Tygh::$app['view']->assign('actions', fn_get_rma_properties(RMA_ACTION)); } elseif ($mode == 'create_return' && !empty($_REQUEST['order_id'])) { $order_id = intval($_REQUEST['order_id']); // [Breadcrumbs] if (AREA != 'A') { fn_add_breadcrumb(__('order') . ' #' . $order_id, "orders.details?order_id={$order_id}"); fn_add_breadcrumb(__('return_registration')); } // [/Breadcrumbs] $order_info = fn_get_order_info($order_id); $order_returnable_products = fn_get_order_returnable_products($order_info['products'], $order_info['products_delivery_date']); $order_info['products'] = $order_returnable_products['items']; if (!isset($order_info['allow_return'])) { return array(CONTROLLER_STATUS_DENIED); }
} if ($mode == 'delete' && !empty($_REQUEST['return_id'])) { fn_delete_return($_REQUEST['return_id']); $suffix = '.returns'; } if ($mode == 'delete_property') { if (!empty($_REQUEST['property_id'])) { fn_rma_delete_property($_REQUEST['property_id']); } $suffix = '.properties?property_type=' . $_REQUEST['property_type']; } return array(CONTROLLER_STATUS_OK, 'rma' . $suffix); } if ($mode == 'properties') { $property_type = !empty($_REQUEST['property_type']) ? $_REQUEST['property_type'] : RMA_REASON; fn_rma_generate_sections($property_type == RMA_REASON ? 'reasons' : 'actions'); Tygh::$app['view']->assign('properties', fn_get_rma_properties($property_type, DESCR_SL)); } elseif ($mode == 'confirmation') { $change_return_status = $_SESSION['change_return_status']; unset($_SESSION['change_return_status']); if ($change_return_status['recalculate_order'] == 'R') { $additional_data = db_get_hash_single_array("SELECT type,data FROM ?:order_data WHERE order_id = ?i", array('type', 'data'), $change_return_status['order_id']); $shipping_info = @unserialize($additional_data['L']); Tygh::$app['view']->assign('shipping_info', $shipping_info); } else { $total = db_get_field("SELECT SUM(amount*price) FROM ?:rma_return_products WHERE return_id = ?i AND type = ?s", $change_return_status['return_id'], RETURN_PRODUCT_ACCEPTED); $change_return_status['total'] = $change_return_status['inventory_to'] == 'I' && !($change_return_status['inventory_from'] == 'I' && $change_return_status['status_to'] == RMA_DEFAULT_STATUS) ? -$total : $total; } Tygh::$app['view']->assign('change_return_status', $change_return_status); Tygh::$app['view']->assign('status_descr', fn_get_simple_statuses(STATUSES_RETURN)); }