} } } if (!empty($invoices)) { $general_for_xml = array('ContractNumber' => RusSpsr::$icn, 'TotalShipments' => count($invoices), 'TotalInsurance' => $total_invoices_cost_ins, 'TotalDeclared' => $total_invoices_cost_val, 'TotalPieces' => $total_pieces_count, 'TotalWeight' => $total_weight); if ($settings_shipping_spsr['cod'] == 1) { $general_for_xml['TotalCOD'] = $total_invoices_cost_cod; } $save_data['order_info'] = array('total' => $order_info['total'], 'subtotal' => $order_info['subtotal'], 'discount' => $order_info['discount'], 'subtotal_discount' => $order_info['subtotal_discount'], 'shipping_ids' => $order_info['shipping_ids'], 'shipping_cost' => $order_info['shipping_cost'], 'timestamp' => $order_info['timestamp']); $save_data['general'] = $general_for_xml; $save_data['service_params'] = $service_params; $save_data['params'] = $spsr_invoice; $general_xml = RusSpsr::generalXml($general_for_xml, $invoices_xml); list($session_info, $g_xml) = RusSpsr::WANewInvoicesByFile($general_xml); if (!empty($session_info)) { $register_id = RusSpsr::saveSesInvoices($params['order_id'], $session_info, $save_data, $g_xml); } else { fn_set_notification('E', __('error'), RusSpsr::$last_error); } if (!empty($register_id)) { fn_set_notification('N', __('notice'), __('shippings.spsr.register_save')); } else { fn_set_notification('E', __('notice'), __('shippings.spsr.not_register_save')); } } $error_logout = RusSpsr::WALogout(); if (!$error_logout) { fn_set_notification('E', __('notice'), RusSpsr::$last_error); } } }