Exemple #1
0
function fn_rma_delete_order(&$order_id)
{
    $return_ids = db_get_fields("SELECT return_id FROM ?:rma_returns WHERE order_id = ?i", $order_id);
    if (!empty($return_ids)) {
        foreach ($return_ids as $return_id) {
            fn_delete_return($return_id);
        }
    }
}
Exemple #2
0
                    if (!isset($extra['returns'])) {
                        $extra['returns'] = array();
                    }
                    $extra['returns'][$change_return_status['return_id']] = array('amount' => (isset($extra['returns'][$change_return_status['return_id']]['amount']) ? $extra['returns'][$change_return_status['return_id']]['amount'] : 0) + $v['amount'], 'status' => $change_return_status['status_from']);
                    // update order detail data
                    $order_details_data = array('extra' => serialize($extra));
                    db_query("UPDATE ?:order_details SET ?u WHERE item_id = ?i AND order_id = ?i", $order_details_data, $item_id, $change_return_status['order_id']);
                    unset($order_details_data);
                }
            }
            db_query('UPDATE ?:rma_returns SET ?u WHERE return_id = ?i', array('total_amount' => $_REQUEST['total_amount'] + $accept_amount), $change_return_status['return_id']);
        }
        $suffix = ".details?return_id={$change_return_status['return_id']}";
    }
    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') {