Пример #1
0
    if (isset($doc_data['info']['applied_taxes'])) {
        $doc_data['info']['taxes'] = $doc_data['info']['applied_taxes'];
    }
    $cart = $doc_data;
    $cart['orders'][] = $doc_data;
    if ($addons['accessories']) {
        cw_include('addons/accessories/add_to_cart.php');
    }
    $cart['info']['quote_doc_id'] = $doc_data['doc_id'];
    cw_header_location("index.php?target=cart");
}
if ($action == 'change_template' && $current_area == 'A') {
    db_query("update {$tables['docs_info']} set layout_id='{$template['layout_id']}' where doc_info_id='{$doc_data['doc_info_id']}'");
    cw_header_location("index.php?target={$target}&mode=layout&doc_id={$doc_id}");
}
$smarty->assign('order_details_fields_labels', cw_doc_details_fields_as_labels());
if ($doc_data) {
    $owner_condition = " and {$tables['docs']}.type = '" . $doc_data['type'] . "'";
    if (AREA_TYPE == 'C') {
        $owner_condition = " AND {$tables['docs_user_info']}.customer_id='{$customer_id}'";
    } elseif (AREA_TYPE == 'P' || AREA_TYPE == 'V') {
        $owner_condition = " AND {$tables['docs_info']}.warehouse_customer_id='{$customer_id}'";
    } elseif (AREA_TYPE == 'B') {
        $owner_condition = " AND {$tables['docs_info']}.salesman_customer_id='{$customer_id}'";
    }
    $tmp = cw_query_first("SELECT {$tables['docs']}.* FROM {$tables['docs']}, {$tables['docs_info']}, {$tables['docs_user_info']} WHERE {$tables['docs_info']}.doc_info_id={$tables['docs']}.doc_info_id and {$tables['docs_user_info']}.doc_info_id={$tables['docs']}.doc_info_id and {$tables['docs']}.doc_id > '{$doc_id}' {$owner_condition} ORDER BY {$tables['docs']}.doc_id ASC LIMIT 1");
    $smarty->assign('doc_id_next', $tmp);
    $tmp = cw_query_first("SELECT {$tables['docs']}.* FROM {$tables['docs']}, {$tables['docs_info']}, {$tables['docs_user_info']} WHERE {$tables['docs_info']}.doc_info_id={$tables['docs']}.doc_info_id and {$tables['docs_user_info']}.doc_info_id={$tables['docs']}.doc_info_id and {$tables['docs']}.doc_id <'{$doc_id}' {$owner_condition} order by {$tables['docs']}.doc_id DESC LIMIT 1");
    $smarty->assign('doc_id_prev', $tmp);
}
$smarty->assign('doc', $doc_data);
function cw_doc_details_translate($order_details, $force = false)
{
    static $labels = array();
    global $current_language;
    if (empty($labels[$current_language])) {
        $labels[$current_language] = cw_doc_details_fields_as_labels($force);
    }
    $order_details = str_replace(array_keys($labels[$current_language]), array_values($labels[$current_language]), $order_details);
    return $order_details;
}