Example #1
0
             $sdek_info['CallCourier'] = array_diff($sdek_info['CallCourier'], array('', '0.00'));
             unset($data_auth['Number']);
             $data_auth['CallCount'] = "1";
             $xml = RusSdek::arraySimpleXml('CallCourier', $data_auth, 'open');
             $sdek_info['CallCourier']['Date'] = date("Y-m-d", strtotime($sdek_info['CallCourier']['Date']));
             $sdek_info['CallCourier']['SendCityCode'] = $sdek_info['Order']['SendCityCode'];
             $sdek_info['CallCourier']['SendPhone'] = Registry::get('runtime.company_data.phone');
             $sdek_info['CallCourier']['SenderName'] = Registry::get('runtime.company_data.company');
             $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);