Example #1
0
    if ($data['period'] == 'A') {
        $data['time_from'] = date("Y-01-1 00:00:00");
        $data['time_to'] = date("Y-m-d 23:59:59", $data['time_to']);
    } else {
        $data['time_from'] = date("Y-m-d 00:00:00", $data['time_from']);
        $data['time_to'] = date("Y-m-d 23:59:59", $data['time_to']);
    }
    foreach ($shipping as $shipping_id => $d_shipping) {
        $service_params = unserialize($d_shipping['service_params']);
        if (!empty($service_params['authlogin']) && !empty($service_params['authpassword'])) {
            $shipping_params['Account'] = $service_params['authlogin'];
            $shipping_params['Secure'] = md5($t_date . '&' . $service_params['authpassword']);
            $shipping_params['Date'] = $t_date;
            $shipping_params['ChangePeriod']['DateFirst'] = $data['time_from'];
            $shipping_params['ChangePeriod']['DateLast'] = $data['time_to'];
            $d_status = RusSdek::orderStatusXml($shipping_params);
            RusSdek::addStatusOrders($d_status);
        } else {
            fn_set_notification('E', __('notice'), __('shippings.sdek.account_password_error'));
        }
    }
    $params['time_from'] = $data['time_from'];
    $params['time_to'] = $data['time_to'];
    $data['time_from'] = strtotime($data['time_from']);
    $data['time_to'] = strtotime($data['time_to']);
    list($data_status, $search) = fn_rus_sdek_get_status($params, Registry::get('settings.Appearance.admin_elements_per_page'));
    Tygh::$app['view']->assign('period', $data);
    Tygh::$app['view']->assign('data_status', $data_status);
    Tygh::$app['view']->assign('search', $search);
}
function fn_rus_sdek_get_status($params = array(), $items_per_page = 0)
Example #2
0
                $sdek_info['CallCourier']['Weight'] = $total_weight * Registry::get('settings.General.weight_symbol_grams');
                $xml .= RusSdek::arraySimpleXml('Call', $sdek_info['CallCourier'], 'open');
                $address_send = array('Street' => Registry::get('runtime.company_data.address'), 'House' => '-', 'Flat' => '-');
                $xml .= RusSdek::arraySimpleXml('Address', $address_send);
                $xml .= '</Call>';
                $xml .= '</CallCourier>';
                $response = RusSdek::xmlRequest('http://gw.edostavka.ru:11443/call_courier.php', $xml, $data_auth);
                $result = RusSdek::resultXml($response);
                if (empty($result['error'])) {
                    $call_courier = array('order_id' => $params['order_id'], 'shipment_id' => $shipment_id, 'timestamp' => TIME, 'call_courier_date' => $sdek_info['CallCourier']['Date'], 'timebag' => $sdek_info['CallCourier']['TimeBeg'], 'timeend' => $sdek_info['CallCourier']['TimeEnd'], 'weight' => $total_weight);
                    $call_courier['lunch_timebag'] = !empty($sdek_info['CallCourier']['LunchBeg']) ? $sdek_info['CallCourier']['LunchBeg'] : '';
                    $call_courier['lunch_timeend'] = !empty($sdek_info['CallCourier']['LunchEnd']) ? $sdek_info['CallCourier']['LunchEnd'] : '';
                    $call_courier['comment_courier'] = !empty($sdek_info['CallCourier']['Comment']) ? $sdek_info['CallCourier']['Comment'] : '';
                    db_query('INSERT INTO ?:rus_sdek_call_courier ?e', $call_courier);
                }
                $date_status = RusSdek::orderStatusXml($data_auth, $params['order_id'], $shipment_id);
                RusSdek::addStatusOrders($date_status);
            }
        }
    }
    $url = fn_url("orders.details&order_id=" . $params['order_id'], 'A', 'current');
    if (defined('AJAX_REQUEST') && !empty($url)) {
        Registry::get('ajax')->assign('force_redirection', $url);
        exit;
    }
    return array(CONTROLLER_STATUS_OK, $url);
}
if ($mode == 'details') {
    $params = $_REQUEST;
    $order_info = Tygh::$app['view']->getTemplateVars('order_info');
    $sdek_info = $sdek_pvz = false;