function fn_spsr_delete_addr($addr_id, $addr_owner_id) { RusSpsr::WALogin(); $result = RusSpsr::WADelAddress($addr_id, $addr_owner_id, 8); if ($result) { fn_set_notification('N', __('notice'), __('shippings.spsr.address_delete')); } else { fn_set_notification('E', __('notice'), __('shippings.spsr.not_address_delete') . ' : ' . RusSpsr::$last_error); } RusSpsr::WALogout(); return $result; }
Tygh::$app['view']->assign('registers', $registers); $f_spsr = 1; } Tygh::$app['view']->assign('addr_list', $addr_list); $url_invoice = RusSpsr::urlInvoice(); Tygh::$app['view']->assign('url_invoice', $url_invoice); $info_barcode = array('width' => $spsr_settings['width'], 'height' => $spsr_settings['height'], 'type' => 'C128B'); Tygh::$app['view']->assign('info_barcode', $info_barcode); if ($f_spsr) { Registry::set('navigation.tabs.rus_spsr_invoice', array('title' => __('shippings.spsr.tab_invoice'), 'js' => true)); } } if (!$login) { fn_set_notification('E', __('notice'), __('shippings.spsr.login_error') . ' : ' . RusSpsr::$last_error); } $error_logout = RusSpsr::WALogout(); if (!$error_logout) { fn_set_notification('E', __('notice'), __('shippings.spsr.logout_error') . ' : ' . RusSpsr::$last_error); } } } if ($mode == 'spsr_barcode') { require Registry::get('config.dir.addons') . 'barcode/lib/barcodegenerator/barcode.php'; $style = BCS_ALIGN_CENTER; if (Registry::get('addons.barcode.text') == 'Y') { $style = $style + BCS_DRAW_TEXT; } if (Registry::get('addons.barcode.output') == 'png') { $style = $style + BCS_IMAGE_PNG; } if (Registry::get('addons.barcode.output') == 'jpeg') {
/** * Gets shipping cost and information about possible errors * * @param string $resonse Reponse from Shipping service server * @return array Shipping cost and errors */ public function processResponse($response) { $return = array('cost' => false, 'error' => false); $xml = simplexml_load_string($response); if (isset($xml->Error)) { $this->_internalError((string) $xml->Error); } elseif (isset($xml->Tariff)) { $_result = array(); foreach ($xml->Tariff as $shipment) { $_result[] = array('TariffType' => (string) $shipment->TariffType, 'Total_Dost' => (string) $shipment->Total_Dost, 'Total_DopUsl' => (string) $shipment->Total_DopUsl, 'Insurance' => (string) $shipment->id, 'worth' => (string) $shipment->Insurance, 'DP' => (string) $shipment->DP); } } if (!empty($_result)) { foreach ($_result as $ship) { if ($ship['TariffType'] == 'Услуги по доставке "Пеликан-стандарт"') { $return['cost'] = $ship['Total_Dost']; self::_fillSessionData($this->_shipping_info, $ship['DP']); } } } if (empty($return['cost'])) { $return['error'] = __('shippings.spsr.error_get_cost'); } if (!empty($this->_error_stack)) { foreach ($this->_error_stack as $error) { $return['error'] .= '; ' . $error; } } RusSpsr::WALogout(); return $return; }
} elseif ($mode == 'm_update') { $selected_fields = $_SESSION['selected_fields']; $field_groups = Tygh::$app['view']->getTemplateVars('field_groups'); $filled_groups = Tygh::$app['view']->getTemplateVars('filled_groups'); $field_names = Tygh::$app['view']->getTemplateVars('field_names'); if (!empty($selected_fields['data']['spsr_product_type'])) { $type_products = array(); $login = RusSpsr::WALogin(); if ($login) { $type_products = RusSpsr::WAGetEncloseType(); } RusSpsr::WALogout(); $field_groups['S']['spsr_product_type']['name'] = 'products_data'; foreach ($type_products as $type) { $field_groups['S']['spsr_product_type']['variants'][$type['Value']] = 'shippings.spsr.type' . $type['Value']; } $filled_groups['S']['spsr_product_type'] = __('shippings.spsr.product_type'); unset($field_names['spsr_product_type']); } Tygh::$app['view']->assign('field_groups', $field_groups); Tygh::$app['view']->assign('filled_groups', $filled_groups); Tygh::$app['view']->assign('field_names', $field_names); } elseif ($mode == 'update') { $type_products = array(); $login = RusSpsr::WALogin(); if ($login) { $type_products = RusSpsr::WAGetEncloseType(); } RusSpsr::WALogout(); Tygh::$app['view']->assign('type_products', $type_products); }
function fn_spsr_delete_courier($id, $owner_id) { RusSpsr::WALogin(); $result = RusSpsr::WACancelOrder($id, $owner_id); $save = array('courier_key' => '', 'courier_id' => '', 'courier_owner_id' => ''); db_query('UPDATE ?:rus_spsr_invoices SET ?u WHERE courier_id = ?i AND courier_owner_id = ?i', $save, $id, $owner_id); if ($result) { fn_set_notification('N', __('notice'), __('shippings.spsr.order_delete') . ' : ' . $result['order'] . ' ' . $result['order_state']); } else { fn_set_notification('E', __('notice'), __('shippings.spsr.not_order_delete') . ' : ' . RusSpsr::$last_error); } RusSpsr::WALogout(); }