示例#1
0
    if (!empty($_REQUEST['status'])) {
        if (fn_delete_status($_REQUEST['status'], $_REQUEST['type'])) {
            $count = db_get_field("SELECT COUNT(*) FROM ?:statuses");
            if (empty($count)) {
                Registry::get('view')->display('views/statuses/manage.tpl');
            }
        }
    }
    exit;
} elseif ($mode == 'manage') {
    $section_data = array();
    $statuses = fn_get_statuses($_REQUEST['type'], array(), false, false, DESCR_SL);
    Registry::get('view')->assign('statuses', $statuses);
    $type = !empty($_REQUEST['type']) ? $_REQUEST['type'] : STATUSES_ORDER;
    Registry::get('view')->assign('type', $type);
    Registry::get('view')->assign('status_params', fn_get_status_params_definition($type));
    // Orders only
    if ($type == STATUSES_ORDER) {
        Registry::get('view')->assign('title', __('order_statuses'));
    }
}
function fn_get_status_params_definition($type)
{
    $status_params = array();
    if ($type == STATUSES_ORDER) {
        $status_params = array('color' => array('type' => 'color', 'label' => 'color'), 'notify' => array('type' => 'checkbox', 'label' => 'notify_customer', 'default_value' => 'Y'), 'notify_department' => array('type' => 'checkbox', 'label' => 'notify_orders_department'), 'notify_vendor' => array('type' => 'checkbox', 'label' => 'notify_vendor'), 'inventory' => array('type' => 'select', 'label' => 'inventory', 'variants' => array('I' => 'increase', 'D' => 'decrease')), 'remove_cc_info' => array('type' => 'checkbox', 'label' => 'remove_cc_info', 'default_value' => 'Y'), 'repay' => array('type' => 'checkbox', 'label' => 'pay_order_again'), 'appearance_type' => array('type' => 'select', 'label' => 'invoice_credit_memo', 'variants' => array('D' => 'default', 'I' => 'invoice', 'C' => 'credit_memo', 'O' => 'order')));
        if (fn_allowed_for('ULTIMATE:FREE')) {
            unset($status_params['notify_vendor']);
        } elseif (fn_allowed_for('MULTIVENDOR')) {
            $status_params['calculate_for_payouts'] = array('type' => 'checkbox', 'label' => 'charge_to_vendor_account');
        } elseif (fn_allowed_for('ULTIMATE')) {
示例#2
0
        exit;
    }
    return array(CONTROLLER_STATUS_OK, 'statuses.manage?type=' . $_REQUEST['type']);
}
if ($mode == 'update') {
    $status_data = fn_get_status_data($_REQUEST['status'], $_REQUEST['type']);
    Tygh::$app['view']->assign('status_data', $status_data);
    Tygh::$app['view']->assign('type', $_REQUEST['type']);
    Tygh::$app['view']->assign('status_params', fn_get_status_params_definition($_REQUEST['type']));
} elseif ($mode == 'manage') {
    $section_data = array();
    $statuses = fn_get_statuses($_REQUEST['type'], array(), false, false, DESCR_SL);
    Tygh::$app['view']->assign('statuses', $statuses);
    $type = !empty($_REQUEST['type']) ? $_REQUEST['type'] : STATUSES_ORDER;
    Tygh::$app['view']->assign('type', $type);
    Tygh::$app['view']->assign('status_params', fn_get_status_params_definition($type));
    // Orders only
    if ($type == STATUSES_ORDER) {
        Tygh::$app['view']->assign('title', __('order_statuses'));
    }
}
function fn_get_status_params_definition($type)
{
    $status_params = array();
    if ($type == STATUSES_ORDER) {
        $status_params = array('color' => array('type' => 'color', 'label' => 'color'), 'notify' => array('type' => 'checkbox', 'label' => 'notify_customer', 'default_value' => 'Y'), 'notify_department' => array('type' => 'checkbox', 'label' => 'notify_orders_department'), 'notify_vendor' => array('type' => 'checkbox', 'label' => 'notify_vendor'), 'inventory' => array('type' => 'select', 'label' => 'inventory', 'variants' => array('I' => 'increase', 'D' => 'decrease')), 'remove_cc_info' => array('type' => 'checkbox', 'label' => 'remove_cc_info', 'default_value' => 'Y'), 'repay' => array('type' => 'checkbox', 'label' => 'pay_order_again'), 'appearance_type' => array('type' => 'select', 'label' => 'invoice_credit_memo', 'variants' => array('D' => 'default', 'I' => 'invoice', 'C' => 'credit_memo', 'O' => 'order')));
        if (fn_allowed_for('ULTIMATE:FREE')) {
            unset($status_params['notify_vendor']);
        } elseif (fn_allowed_for('MULTIVENDOR')) {
            $status_params['calculate_for_payouts'] = array('type' => 'checkbox', 'label' => 'charge_to_vendor_account');
        } elseif (fn_allowed_for('ULTIMATE')) {
示例#3
0
            db_query("DELETE FROM ?:status_descriptions WHERE status = ?s AND type = ?s", $_REQUEST['status'], $_REQUEST['type']);
            db_query("DELETE FROM ?:status_data WHERE status = ?s AND type = ?s", $_REQUEST['status'], $_REQUEST['type']);
            $count = db_get_field("SELECT COUNT(*) FROM ?:statuses");
            if (empty($count)) {
                $view->display('views/statuses/manage.tpl');
            }
        }
    }
    exit;
} elseif ($mode == 'manage') {
    $section_data = array();
    $statuses = db_get_hash_array("SELECT ?:statuses.*, ?:status_descriptions.* FROM ?:statuses LEFT JOIN ?:status_descriptions ON ?:statuses.status = ?:status_descriptions.status AND ?:statuses.type = ?:status_descriptions.type AND ?:status_descriptions.lang_code = ?s AND ?:statuses.type = ?s ORDER BY ?:status_descriptions.description", 'status', DESCR_SL, $_REQUEST['type']);
    $view->assign('statuses', $statuses);
    $type = !empty($_REQUEST['type']) ? $_REQUEST['type'] : STATUSES_ORDER;
    $view->assign('type', $type);
    $view->assign('status_params', fn_get_status_params_definition($type));
    // Orders only
    if ($type == STATUSES_ORDER) {
        $view->assign('title', fn_get_lang_var('order_statuses'));
    }
}
function fn_update_status($status, $status_data, $type, $lang_code = DESCR_SL)
{
    if (empty($status)) {
        $status_data['type'] = $type;
        db_query("INSERT INTO ?:statuses ?e", $status_data);
        $status = $status_data['status'];
        foreach ((array) Registry::get('languages') as $status_data['lang_code'] => $_v) {
            db_query('REPLACE INTO ?:status_descriptions ?e', $status_data);
        }
    } else {