示例#1
0
 public function update($id, $params)
 {
     $data = array();
     $status = Response::STATUS_BAD_REQUEST;
     if ($this->getCallRequest($id)) {
         unset($params['company_id']);
         if (fn_update_call_request($params, $id)) {
             $status = Response::STATUS_OK;
             $data = array('request_id' => $id);
         }
     }
     return array('status' => $status, 'data' => $data);
 }
示例#2
0
function fn_do_call_request($params, $product_data, &$cart, &$auth)
{
    $result = array();
    $params['cart_products'] = fn_call_request_get_cart_products($cart);
    if (!empty($params['product_id']) && !empty($params['email'])) {
        $params['order_id'] = fn_call_requests_placing_order($params, $product_data, $cart, $auth);
    }
    $request_id = fn_update_call_request($params);
    $company_id = Registry::get('runtime.company_id');
    $lang_code = fn_get_company_language($company_id);
    if (empty($lang_code)) {
        $lang_code = CART_LANGUAGE;
    }
    $url = fn_url('call_requests.manage?id=' . $request_id, 'A', 'current', $lang_code, true);
    if (empty($params['product_id'])) {
        // Call request
        Mailer::sendMail(array('to' => 'company_orders_department', 'from' => 'default_company_orders_department', 'data' => array('url' => $url, 'customer' => $params['name'], 'phone_number' => $params['phone'], 'time_from' => $params['time_from'] ?: CALL_REQUESTS_DEFAULT_TIME_FROM, 'time_to' => $params['time_to'] ?: CALL_REQUESTS_DEFAULT_TIME_TO), 'tpl' => 'addons/call_requests/call_request.tpl', 'company_id' => $company_id), 'A', $lang_code);
    } elseif (empty($params['order_id'])) {
        // Buy with one click without order
        Mailer::sendMail(array('to' => 'company_orders_department', 'from' => 'default_company_orders_department', 'data' => array('url' => $url, 'customer' => $params['name'], 'phone_number' => $params['phone'], 'product_url' => fn_url('products.view?product_id=' . $params['product_id'], 'C'), 'product_name' => fn_get_product_name($params['product_id'], $lang_code)), 'tpl' => 'addons/call_requests/buy_with_one_click.tpl', 'company_id' => $company_id), 'A', $lang_code);
    }
    if (!empty($params['order_id'])) {
        $result['notice'] = __('call_requests.order_placed', array('[order_id]' => $params['order_id']));
    } else {
        $result['notice'] = __('call_requests.request_recieved');
    }
    return $result;
}
示例#3
0
* 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') {
    fn_trusted_vars('call_requests');
    if ($mode == 'm_update') {
        if (!empty($_REQUEST['call_requests'])) {
            foreach ($_REQUEST['call_requests'] as $request_id => $request) {
                fn_update_call_request($request, $request_id);
            }
        }
    }
    if ($mode == 'm_delete') {
        if (!empty($_REQUEST['request_ids'])) {
            foreach ($_REQUEST['request_ids'] as $request_id) {
                fn_delete_call_request($request_id);
            }
        }
    }
    if ($mode == 'delete') {
        if ($_REQUEST['request_id']) {
            fn_delete_call_request($_REQUEST['request_id']);
        }
    }