Example #1
0
        $supplier_data = db_get_row("SELECT * FROM ?:suppliers WHERE supplier_id = ?i {$condition}", $_REQUEST['id']);
        if (!empty($supplier_data)) {
            $result = fn_update_status_supplier($supplier_data['supplier_id'], $_REQUEST['status']);
            if ($result) {
                fn_set_notification('N', __('notice'), __('status_changed'));
            } else {
                fn_set_notification('E', __('error'), __('error_status_not_changed'));
                Tygh::$app['ajax']->assign('return_status', $supplier_data['status']);
            }
        }
        exit;
    }
    return array(CONTROLLER_STATUS_OK, 'suppliers' . $suffix);
}
if ($mode == 'manage') {
    list($suppliers, $search) = fn_get_suppliers($_REQUEST, Registry::get('settings.Appearance.admin_elements_per_page'));
    $view = Tygh::$app['view'];
    $view->assign('search', $search);
    $view->assign('suppliers', $suppliers);
    $view->assign('countries', fn_get_simple_countries(true, CART_LANGUAGE));
    $view->assign('states', fn_get_all_states());
} elseif ($mode == 'update' || $mode == 'add') {
    Registry::set('navigation.tabs', array('general' => array('title' => __('general'), 'js' => true), 'products' => array('title' => __('products'), 'js' => true), 'shippings' => array('title' => __('shippings'), 'js' => true)));
    $supplier = !empty($_REQUEST['supplier_id']) ? fn_get_supplier_data($_REQUEST['supplier_id']) : array();
    $condition = " AND ?:shippings.status = 'A'";
    if (Registry::get('runtime.company_id') && !fn_allowed_for('ULTIMATE')) {
        $condition = fn_get_company_condition('?:shippings.company_id');
        $company_data = Registry::get('runtime.company_data');
        if (!empty($company_data['shippings'])) {
            $condition .= db_quote(" OR ?:shippings.shipping_id IN (?n)", explode(',', $company_data['shippings']));
        }
Example #2
0
<?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 ($mode == 'update') {
    Registry::set('navigation.tabs.suppliers', array('title' => __('suppliers'), 'js' => true));
    $shipping_data = Tygh::$app['view']->getTemplateVars('shipping');
    list($suppliers) = fn_get_suppliers();
    $linked_suppliers = fn_get_shippings_suppliers($shipping_data['shipping_id']);
    Tygh::$app['view']->assign('suppliers', $suppliers);
    Tygh::$app['view']->assign('linked_suppliers', $linked_suppliers);
}