security update link,module_filters,search_api_solr,ubercart,views
This commit is contained in:
@@ -6,9 +6,8 @@ core = 7.x
|
||||
|
||||
configure = admin/store/settings/quotes/methods
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-07-16
|
||||
version = "7.x-3.10"
|
||||
; Information added by Drupal.org packaging script on 2019-03-06
|
||||
version = "7.x-3.12"
|
||||
core = "7.x"
|
||||
project = "ubercart"
|
||||
datestamp = "1468644909"
|
||||
|
||||
datestamp = "1551862392"
|
||||
|
@@ -5,7 +5,6 @@
|
||||
* Shipping quote module that defines a flat shipping rate for each product.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
|
@@ -22,7 +22,13 @@ class UbercartQuoteTestCase extends UbercartTestHelper {
|
||||
* Overrides DrupalWebTestCase::setUp().
|
||||
*/
|
||||
protected function setUp($modules = array(), $permissions = array()) {
|
||||
$modules = array('rules_admin', 'uc_payment', 'uc_payment_pack', 'uc_quote', 'uc_flatrate');
|
||||
$modules = array(
|
||||
'rules_admin',
|
||||
'uc_payment',
|
||||
'uc_payment_pack',
|
||||
'uc_quote',
|
||||
'uc_flatrate',
|
||||
);
|
||||
$permissions = array('administer rules', 'bypass rules access');
|
||||
parent::setUp($modules, $permissions);
|
||||
module_load_include('inc', 'uc_flatrate', 'uc_flatrate.admin');
|
||||
@@ -32,14 +38,14 @@ class UbercartQuoteTestCase extends UbercartTestHelper {
|
||||
/**
|
||||
* Creates a flat rate shipping quote with optional conditions.
|
||||
*
|
||||
* @param $edit
|
||||
* @param array $edit
|
||||
* Data to use to create shipping quote, same format as the values
|
||||
* submitted from the add flatrate method form.
|
||||
* @param $condition
|
||||
* @param bool $condition
|
||||
* If specified, a RulesAnd component defining the conditions to apply
|
||||
* for this method.
|
||||
*/
|
||||
function createQuote($edit = array(), $condition = FALSE) {
|
||||
protected function createQuote(array $edit = array(), $condition = FALSE) {
|
||||
$edit += array(
|
||||
'title' => $this->randomName(8),
|
||||
'label' => $this->randomName(8),
|
||||
@@ -67,7 +73,7 @@ class UbercartQuoteTestCase extends UbercartTestHelper {
|
||||
/**
|
||||
* Simulates selection of a delivery country on the checkout page.
|
||||
*
|
||||
* @param $country
|
||||
* @param string $country
|
||||
* The text version of the country name to select, e.g. "Canada" or
|
||||
* "United States".
|
||||
*/
|
||||
@@ -91,7 +97,7 @@ class UbercartQuoteTestCase extends UbercartTestHelper {
|
||||
/**
|
||||
* Simulates selection of a quote on the checkout page.
|
||||
*
|
||||
* @param $n
|
||||
* @param int $n
|
||||
* The index of the quote to select.
|
||||
*/
|
||||
protected function selectQuote($n) {
|
||||
@@ -150,10 +156,10 @@ class UbercartQuoteTestCase extends UbercartTestHelper {
|
||||
'USES VARIABLES' => array(
|
||||
'order' => array(
|
||||
'type' => 'uc_order',
|
||||
'label' => 'Order'
|
||||
'label' => 'Order',
|
||||
),
|
||||
),
|
||||
'AND' => array( array(
|
||||
'AND' => array(array(
|
||||
'data_is' => array(
|
||||
'data' => array('order:delivery-address:country'),
|
||||
'value' => '840',
|
||||
@@ -175,9 +181,11 @@ class UbercartQuoteTestCase extends UbercartTestHelper {
|
||||
$this->assertText($quote2->option_text, 'The second quote option is available');
|
||||
$this->assertText($quote1->total, 'Order total includes the default quote.');
|
||||
|
||||
// Select a different quote and ensure the total updates correctly. Currently, we have to do this
|
||||
// by examining the ajax return value directly (rather than the page contents) because drupalPostAjax() can
|
||||
// only handle replacements via the 'wrapper' property, and the ajax callback may use a command with a selector.
|
||||
// Select a different quote and ensure the total updates correctly.
|
||||
// Currently, we have to do this by examining the ajax return value
|
||||
// directly (rather than the page contents) because drupalPostAjax()
|
||||
// can only handle replacements via the 'wrapper' property, and the ajax
|
||||
// callback may use a command with a selector.
|
||||
$edit = array('panes[quotes][quotes][quote_option]' => 'flatrate_2---0');
|
||||
$result = $this->ucPostAjax(NULL, $edit, $edit);
|
||||
$this->assertText($quote2->total, 'The order total includes the selected quote.');
|
||||
@@ -229,4 +237,5 @@ class UbercartQuoteTestCase extends UbercartTestHelper {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -9,9 +9,8 @@ configure = admin/store/settings/quotes
|
||||
; Test cases
|
||||
files[] = tests/uc_quote.test
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-07-16
|
||||
version = "7.x-3.10"
|
||||
; Information added by Drupal.org packaging script on 2019-03-06
|
||||
version = "7.x-3.12"
|
||||
core = "7.x"
|
||||
project = "ubercart"
|
||||
datestamp = "1468644909"
|
||||
|
||||
datestamp = "1551862392"
|
||||
|
@@ -9,7 +9,6 @@
|
||||
* their specific information so that a shipment may be quoted and requested.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_permission().
|
||||
*/
|
||||
@@ -690,7 +689,7 @@ function uc_order_pane_quotes($op, $order, &$form = NULL, &$form_state = NULL) {
|
||||
if (isset($form_state['values']['products']) && is_array($form_state['values']['products'])) {
|
||||
foreach ($form_state['values']['products'] as $product) {
|
||||
$product['data'] = unserialize($product['data']);
|
||||
$product = (object)$product;
|
||||
$product = (object) $product;
|
||||
$order->products[] = $product;
|
||||
}
|
||||
}
|
||||
|
@@ -5,7 +5,6 @@
|
||||
* Variable module hook implementations.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_variable_group_info().
|
||||
*/
|
||||
|
@@ -132,7 +132,7 @@
|
||||
<?php echo t('SKU: ') . $product->model; ?><br />
|
||||
<?php if (isset($product->data['attributes']) && is_array($product->data['attributes']) && count($product->data['attributes']) > 0) {
|
||||
foreach ($product->data['attributes'] as $attribute => $option) {
|
||||
echo '<li>' . t('@attribute: @options', array('@attribute' => $attribute, '@options' => implode(', ', (array)$option))) . '</li>';
|
||||
echo '<li>' . t('@attribute: @options', array('@attribute' => $attribute, '@options' => implode(', ', (array) $option))) . '</li>';
|
||||
}
|
||||
} ?>
|
||||
<br />
|
||||
|
@@ -88,6 +88,7 @@ function uc_shipping_order_packages($order) {
|
||||
* @see uc_shipping_new_package_validate()
|
||||
* @see uc_shipping_new_package_submit()
|
||||
* @see theme_uc_shipping_new_package_fieldset()
|
||||
*
|
||||
* @ingroup forms
|
||||
*/
|
||||
function uc_shipping_new_package($form, &$form_state, $order) {
|
||||
@@ -131,10 +132,10 @@ function uc_shipping_new_package($form, &$form_state, $order) {
|
||||
'#default_value' => 0,
|
||||
);
|
||||
$product_row['model'] = array(
|
||||
'#markup' => check_plain($product->model)
|
||||
'#markup' => check_plain($product->model),
|
||||
);
|
||||
$product_row['name'] = array(
|
||||
'#markup' => filter_xss_admin($product->title)
|
||||
'#markup' => filter_xss_admin($product->title),
|
||||
);
|
||||
$product_row['qty'] = array(
|
||||
'#type' => 'select',
|
||||
@@ -263,14 +264,14 @@ function uc_shipping_new_package_submit($form, &$form_state) {
|
||||
}
|
||||
|
||||
if ($product['package'] != 0) {
|
||||
$packages[$product['package']]['products'][$id] = (object)$product;
|
||||
$packages[$product['package']]['products'][$id] = (object) $product;
|
||||
|
||||
if (!isset($packages[$product['package']]['shipping_type'])) {
|
||||
$packages[$product['package']]['shipping_type'] = $shipping_type;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$packages[0][$shipping_type][$id] = (object)$product;
|
||||
$packages[0][$shipping_type][$id] = (object) $product;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -305,6 +306,7 @@ function uc_shipping_new_package_submit($form, &$form_state) {
|
||||
*
|
||||
* @see uc_shipping_package_edit_submit()
|
||||
* @see theme_uc_shipping_edit_package_fieldset()
|
||||
*
|
||||
* @ingroup forms
|
||||
*/
|
||||
function uc_shipping_package_edit($form, &$form_state, $order, $package) {
|
||||
@@ -401,7 +403,7 @@ function uc_shipping_package_edit_submit($form, &$form_state) {
|
||||
$package = uc_shipping_package_load($form_state['values']['package_id']);
|
||||
foreach ($form_state['values']['products'] as $id => $product) {
|
||||
if ($product['checked']) {
|
||||
$package->products[$id] = (object)$product;
|
||||
$package->products[$id] = (object) $product;
|
||||
}
|
||||
else {
|
||||
unset($package->products[$id]);
|
||||
@@ -417,6 +419,7 @@ function uc_shipping_package_edit_submit($form, &$form_state) {
|
||||
* Confirms cancellation of a package's shipment.
|
||||
*
|
||||
* @see uc_shipping_package_cancel_confirm_submit()
|
||||
*
|
||||
* @ingroup forms
|
||||
*/
|
||||
function uc_shipping_package_cancel_confirm($form, &$form_state, $order, $package) {
|
||||
@@ -468,6 +471,7 @@ function uc_shipping_package_cancel_confirm_submit($form, &$form_state) {
|
||||
* Decides to unpackage products.
|
||||
*
|
||||
* @see uc_shipping_package_delete_confirm_submit()
|
||||
*
|
||||
* @ingroup forms
|
||||
*/
|
||||
function uc_shipping_package_delete_confirm($form, &$form_state, $order, $package) {
|
||||
@@ -541,6 +545,7 @@ function uc_shipping_order_shipments($order) {
|
||||
*
|
||||
* @see uc_shipping_new_shipment_submit()
|
||||
* @see theme_uc_shipping_new_shipment()
|
||||
*
|
||||
* @ingroup forms
|
||||
*/
|
||||
function uc_shipping_new_shipment($form, &$form_state, $order) {
|
||||
@@ -622,6 +627,7 @@ function uc_shipping_new_shipment($form, &$form_state, $order) {
|
||||
* Formats and displays the new shipment form.
|
||||
*
|
||||
* @see uc_shipping_new_shipment()
|
||||
*
|
||||
* @ingroup themeable
|
||||
*/
|
||||
function theme_uc_shipping_new_shipment($variables) {
|
||||
@@ -741,6 +747,7 @@ function uc_shipping_shipment_view($order, $shipment) {
|
||||
*
|
||||
* @see uc_shipping_shipment_edit_validate()
|
||||
* @see uc_shipping_shipment_edit_submit()
|
||||
*
|
||||
* @ingroup forms
|
||||
*/
|
||||
function uc_shipping_shipment_edit($form, &$form_state, $order, $shipment) {
|
||||
@@ -776,7 +783,7 @@ function uc_shipping_shipment_edit($form, &$form_state, $order, $shipment) {
|
||||
}
|
||||
|
||||
// Create list of products and get a representative product (last one in
|
||||
// the loop) to use for some default values
|
||||
// the loop) to use for some default values.
|
||||
$product_list = array();
|
||||
$declared_value = 0;
|
||||
foreach ($package->products as $product) {
|
||||
@@ -968,7 +975,7 @@ function uc_shipping_shipment_edit($form, &$form_state, $order, $shipment) {
|
||||
'#default_value' => array(
|
||||
'year' => $ship_date['year'],
|
||||
'month' => $ship_date['mon'],
|
||||
'day' => $ship_date['mday']
|
||||
'day' => $ship_date['mday'],
|
||||
),
|
||||
);
|
||||
$form['shipment']['expected_delivery'] = array(
|
||||
@@ -977,7 +984,7 @@ function uc_shipping_shipment_edit($form, &$form_state, $order, $shipment) {
|
||||
'#default_value' => array(
|
||||
'year' => $exp_delivery['year'],
|
||||
'month' => $exp_delivery['mon'],
|
||||
'day' => $exp_delivery['mday']
|
||||
'day' => $exp_delivery['mday'],
|
||||
),
|
||||
);
|
||||
$form['shipment']['cost'] = array(
|
||||
@@ -987,12 +994,12 @@ function uc_shipping_shipment_edit($form, &$form_state, $order, $shipment) {
|
||||
);
|
||||
|
||||
$form['actions'] = array(
|
||||
'#type' => 'actions'
|
||||
'#type' => 'actions',
|
||||
);
|
||||
$form['actions']['submit'] = array(
|
||||
'#type' => 'submit',
|
||||
'#value' => t('Save shipment'),
|
||||
'#weight' => 10
|
||||
'#weight' => 10,
|
||||
);
|
||||
|
||||
return $form;
|
||||
@@ -1113,6 +1120,7 @@ function theme_uc_shipping_shipment_print($variables) {
|
||||
* Decides to release packages to be put on another shipment.
|
||||
*
|
||||
* @see uc_shipping_shipment_delete_confirm_submit()
|
||||
*
|
||||
* @ingroup forms
|
||||
*/
|
||||
function uc_shipping_shipment_delete_confirm($form, &$form_state, $order, $shipment) {
|
||||
|
@@ -78,7 +78,8 @@ function hook_uc_shipment($op, $shipment) {
|
||||
$response = uc_google_checkout_send_request('request', $request);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$google_order_number = uc_google_checkout_get_google_number($shipment->order_id);
|
||||
if ($google_order_number) {
|
||||
@@ -100,7 +101,7 @@ function hook_uc_shipment($op, $shipment) {
|
||||
$request .= '</reset-items-shipping-information>';
|
||||
}
|
||||
$response = uc_google_checkout_send_request('request', $request);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -8,9 +8,8 @@ core = 7.x
|
||||
files[] = views/uc_shipping_handler_field_shipment_id.inc
|
||||
files[] = views/uc_shipping_handler_field_package_weight.inc
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-07-16
|
||||
version = "7.x-3.10"
|
||||
; Information added by Drupal.org packaging script on 2019-03-06
|
||||
version = "7.x-3.12"
|
||||
core = "7.x"
|
||||
project = "ubercart"
|
||||
datestamp = "1468644909"
|
||||
|
||||
datestamp = "1551862392"
|
||||
|
@@ -7,7 +7,6 @@
|
||||
* and tracking numbers.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_help().
|
||||
*/
|
||||
@@ -15,7 +14,6 @@ function uc_shipping_help($path, $arg) {
|
||||
switch ($path) {
|
||||
case 'admin/store/orders/%/packages/new':
|
||||
return '<p>' . t('Organize products into packages. Package numbers in multiple shipping types are of the first shipping type they appear in. All packages are given a unique ID when they are saved. Choose the default package "Sep." to automatically create a package for each of the selected quantity of products in that row.') . '</p>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,7 +443,7 @@ function uc_shipping_package_load($package_id) {
|
||||
* Saves a package.
|
||||
*/
|
||||
function uc_shipping_package_save($package) {
|
||||
$package = (object)$package;
|
||||
$package = (object) $package;
|
||||
|
||||
if (!isset($package->package_id)) {
|
||||
$package->package_id = db_insert('uc_packages')
|
||||
@@ -853,9 +851,7 @@ function uc_shipping_uc_order($op, $order, $arg2) {
|
||||
if ($package_count > 0) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
// Find and delete the shipments.
|
||||
|
@@ -55,7 +55,7 @@ function uc_shipping_rules_data_info() {
|
||||
'carrier' => array(
|
||||
'type' => 'text',
|
||||
'label' => t('Carrier'),
|
||||
'description' > t('The company making the delivery.'),
|
||||
'description' => t('The company making the delivery.'),
|
||||
),
|
||||
'transaction_id' => array(
|
||||
'type' => 'text',
|
||||
|
@@ -5,7 +5,6 @@
|
||||
* Token hooks for the uc_shipping module.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_token_info().
|
||||
*/
|
||||
|
@@ -12,6 +12,7 @@
|
||||
* in packages have the same weight unit.
|
||||
*/
|
||||
class uc_shipping_handler_field_package_weight extends uc_product_handler_field_weight {
|
||||
|
||||
/**
|
||||
* Overrides views_handler::use_group_by().
|
||||
*
|
||||
@@ -43,4 +44,5 @@ class uc_shipping_handler_field_package_weight extends uc_product_handler_field_
|
||||
return uc_weight_format($package->weight, $package->weight_units);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -88,7 +88,7 @@ function uc_ups_admin_settings($form, &$form_state) {
|
||||
'#description' => t('Select the UPS services that are available to customers.'),
|
||||
);
|
||||
|
||||
// Container for quote options
|
||||
// Container for quote options.
|
||||
$form['uc_ups_quote_options'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Quote options'),
|
||||
@@ -109,7 +109,7 @@ function uc_ups_admin_settings($form, &$form_state) {
|
||||
'#description' => t('Indicate whether each product is quoted as shipping separately or all in one package. Orders with one kind of product will still use the package quantity to determine the number of packages needed, however.'),
|
||||
);
|
||||
|
||||
// Form to select package types
|
||||
// Form to select package types.
|
||||
$form['uc_ups_quote_options']['uc_ups_pkg_type'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Default Package Type'),
|
||||
@@ -137,7 +137,7 @@ function uc_ups_admin_settings($form, &$form_state) {
|
||||
'#description' => t('Is your UPS account receiving negotiated rates on shipments?'),
|
||||
);
|
||||
|
||||
// Form to select pickup type
|
||||
// Form to select pickup type.
|
||||
$form['uc_ups_quote_options']['uc_ups_pickup_type'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Pickup type'),
|
||||
@@ -181,7 +181,7 @@ function uc_ups_admin_settings($form, &$form_state) {
|
||||
'#description' => t('When enabled, the quotes presented to the customer will include the cost of insurance for the full sales price of all products in the order.'),
|
||||
);
|
||||
|
||||
// Container for markup forms
|
||||
// Container for markup forms.
|
||||
$form['uc_ups_markups'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Markups'),
|
||||
@@ -191,7 +191,7 @@ function uc_ups_admin_settings($form, &$form_state) {
|
||||
'#group' => 'ups-settings',
|
||||
);
|
||||
|
||||
// Form to select type of rate markup
|
||||
// Form to select type of rate markup.
|
||||
$form['uc_ups_markups']['uc_ups_rate_markup_type'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Rate markup type'),
|
||||
@@ -203,7 +203,7 @@ function uc_ups_admin_settings($form, &$form_state) {
|
||||
),
|
||||
);
|
||||
|
||||
// Form to select rate markup amount
|
||||
// Form to select rate markup amount.
|
||||
$form['uc_ups_markups']['uc_ups_rate_markup'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Shipping rate markup'),
|
||||
@@ -211,7 +211,7 @@ function uc_ups_admin_settings($form, &$form_state) {
|
||||
'#description' => t('Markup shipping rate quote by currency amount, percentage, or multiplier.'),
|
||||
);
|
||||
|
||||
// Form to select type of weight markup
|
||||
// Form to select type of weight markup.
|
||||
$form['uc_ups_markups']['uc_ups_weight_markup_type'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Weight markup type'),
|
||||
@@ -224,7 +224,7 @@ function uc_ups_admin_settings($form, &$form_state) {
|
||||
'#disabled' => TRUE,
|
||||
);
|
||||
|
||||
// Form to select weight markup amount
|
||||
// Form to select weight markup amount.
|
||||
$form['uc_ups_markups']['uc_ups_weight_markup'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Shipping weight markup'),
|
||||
@@ -233,7 +233,7 @@ function uc_ups_admin_settings($form, &$form_state) {
|
||||
'#disabled' => TRUE,
|
||||
);
|
||||
|
||||
// Container for label printing
|
||||
// Container for label printing.
|
||||
$form['uc_ups_labels'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Label Printing'),
|
||||
@@ -246,7 +246,7 @@ function uc_ups_admin_settings($form, &$form_state) {
|
||||
$period = drupal_map_assoc(array(86400, 302400, 604800, 1209600, 2419200, 0), 'format_interval');
|
||||
$period[0] = t('Forever');
|
||||
|
||||
// Form to select how long labels stay on server
|
||||
// Form to select how long labels stay on server.
|
||||
$form['uc_ups_labels']['uc_ups_label_lifetime'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Label lifetime'),
|
||||
|
@@ -6,9 +6,8 @@ core = 7.x
|
||||
|
||||
configure = admin/store/settings/quotes/settings/ups
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-07-16
|
||||
version = "7.x-3.10"
|
||||
; Information added by Drupal.org packaging script on 2019-03-06
|
||||
version = "7.x-3.12"
|
||||
core = "7.x"
|
||||
project = "ubercart"
|
||||
datestamp = "1468644909"
|
||||
|
||||
datestamp = "1551862392"
|
||||
|
@@ -387,6 +387,7 @@ function uc_ups_shipping_quote($packages, $origin, $destination, $ups_service) {
|
||||
$units = 'LBS';
|
||||
$unit_name = 'Pounds';
|
||||
break;
|
||||
|
||||
case 'cm':
|
||||
$units = 'KGS';
|
||||
$unit_name = 'Kilograms';
|
||||
@@ -404,6 +405,7 @@ function uc_ups_shipping_quote($packages, $origin, $destination, $ups_service) {
|
||||
case 'in':
|
||||
$weight_factor = uc_weight_conversion($package->weight_units, 'lb');
|
||||
break;
|
||||
|
||||
case 'cm':
|
||||
$weight_factor = uc_weight_conversion($package->weight_units, 'kg');
|
||||
break;
|
||||
@@ -663,7 +665,7 @@ function uc_ups_quote($products, $details, $method) {
|
||||
if (!isset($product->pkg_qty) || !$product->pkg_qty) {
|
||||
$product->pkg_qty = 1;
|
||||
}
|
||||
$num_of_pkgs = (int)($product->qty / $product->pkg_qty);
|
||||
$num_of_pkgs = (int) ($product->qty / $product->pkg_qty);
|
||||
|
||||
// Grab some product properties directly from the (cached) product
|
||||
// data. They are not normally available here because the $product
|
||||
@@ -706,7 +708,7 @@ function uc_ups_quote($products, $details, $method) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$dest = (object)$details;
|
||||
$dest = (object) $details;
|
||||
|
||||
foreach ($packages as $key => $ship_packages) {
|
||||
$orig = $addresses[$key];
|
||||
@@ -727,9 +729,9 @@ function uc_ups_quote($products, $details, $method) {
|
||||
if (isset($response->Response->Error)) {
|
||||
foreach ($response->Response->Error as $error) {
|
||||
if (user_access('configure quotes') && variable_get('uc_quote_display_debug', FALSE)) {
|
||||
$debug_data[$ups_service]['error'][] = (string)$error->ErrorSeverity . ' ' . (string)$error->ErrorCode . ': ' . (string)$error->ErrorDescription;
|
||||
$debug_data[$ups_service]['error'][] = (string) $error->ErrorSeverity . ' ' . (string) $error->ErrorCode . ': ' . (string) $error->ErrorDescription;
|
||||
}
|
||||
if (strpos((string)$error->ErrorSeverity, 'Hard') !== FALSE) {
|
||||
if (strpos((string) $error->ErrorSeverity, 'Hard') !== FALSE) {
|
||||
// All or nothing quote. If some products can't be shipped by
|
||||
// a certain service, no quote is given for that service. If
|
||||
// that means no quotes are given at all, they'd better call in.
|
||||
@@ -744,12 +746,12 @@ function uc_ups_quote($products, $details, $method) {
|
||||
if (isset($response->RatedShipment->NegotiatedRates)) {
|
||||
$charge = $response->RatedShipment->NegotiatedRates->NetSummaryCharges->GrandTotal;
|
||||
}
|
||||
if (!isset($charge->CurrencyCode) || (string)$charge->CurrencyCode == variable_get('uc_currency_code', "USD")) {
|
||||
if (!isset($charge->CurrencyCode) || (string) $charge->CurrencyCode == variable_get('uc_currency_code', "USD")) {
|
||||
// Markup rate before customer sees it.
|
||||
if (!isset($quotes[$ups_service]['rate'])) {
|
||||
$quotes[$ups_service]['rate'] = 0;
|
||||
}
|
||||
$rate = uc_ups_rate_markup((string)$charge->MonetaryValue);
|
||||
$rate = uc_ups_rate_markup((string) $charge->MonetaryValue);
|
||||
$quotes[$ups_service]['rate'] += $rate;
|
||||
}
|
||||
}
|
||||
@@ -847,20 +849,20 @@ function uc_ups_void_shipment($shipment_number, $tracking_numbers = array()) {
|
||||
$response = new SimpleXMLElement($resp->data);
|
||||
if (isset($response->Response)) {
|
||||
if (isset($response->Response->ResponseStatusCode)) {
|
||||
$success = (string)$response->Response->ResponseStatusCode;
|
||||
$success = (string) $response->Response->ResponseStatusCode;
|
||||
}
|
||||
if (isset($response->Response->Error)) {
|
||||
foreach ($response->Response->Error as $error) {
|
||||
drupal_set_message((string)$error->ErrorSeverity . ' ' . (string)$error->ErrorCode . ': ' . (string)$error->ErrorDescription, 'error');
|
||||
drupal_set_message((string) $error->ErrorSeverity . ' ' . (string) $error->ErrorCode . ': ' . (string) $error->ErrorDescription, 'error');
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($response->Status)) {
|
||||
if (isset($response->Status->StatusType)) {
|
||||
$success = (string)$response->Status->StatusType->Code;
|
||||
$success = (string) $response->Status->StatusType->Code;
|
||||
}
|
||||
}
|
||||
return (bool)$success;
|
||||
return (bool) $success;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -880,8 +882,10 @@ function uc_ups_rate_markup($rate) {
|
||||
switch ($type) {
|
||||
case 'percentage':
|
||||
return $rate + $rate * floatval($markup) / 100;
|
||||
|
||||
case 'multiplier':
|
||||
return $rate * floatval($markup);
|
||||
|
||||
case 'currency':
|
||||
return $rate + floatval($markup);
|
||||
}
|
||||
|
@@ -5,7 +5,6 @@
|
||||
* UPS functions for label generation.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Shipment creation callback.
|
||||
*
|
||||
@@ -31,7 +30,7 @@ function uc_ups_fulfill_order($form, &$form_state, $order, $package_ids) {
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Packages'),
|
||||
'#collapsible' => TRUE,
|
||||
'#tree' => TRUE
|
||||
'#tree' => TRUE,
|
||||
);
|
||||
foreach ($package_ids as $id) {
|
||||
$package = uc_shipping_package_load($id);
|
||||
@@ -42,14 +41,14 @@ function uc_ups_fulfill_order($form, &$form_state, $order, $package_ids) {
|
||||
}
|
||||
}
|
||||
// Create list of products and get a representative product (last one in
|
||||
// the loop) to use for some default values
|
||||
// the loop) to use for some default values.
|
||||
$product_list = array();
|
||||
$declared_value = 0;
|
||||
foreach ($package->products as $product) {
|
||||
$product_list[] = $product->qty . ' x ' . $product->model;
|
||||
$declared_value += $product->qty * $product->price;
|
||||
}
|
||||
// Use last product in package to determine package type
|
||||
// Use last product in package to determine package type.
|
||||
$ups_data = db_query("SELECT pkg_type FROM {uc_ups_products} WHERE nid = :nid", array(':nid' => $product->nid))->fetchAssoc();
|
||||
$product->ups = $ups_data;
|
||||
$pkg_form = array(
|
||||
@@ -151,7 +150,7 @@ function uc_ups_fulfill_order($form, &$form_state, $order, $package_ids) {
|
||||
$form['destination'][$field]['#required'] = TRUE;
|
||||
}
|
||||
|
||||
// Determine shipping option chosen by the customer
|
||||
// Determine shipping option chosen by the customer.
|
||||
$method = $order->quote['method'];
|
||||
$methods = module_invoke_all('uc_shipping_method');
|
||||
if (isset($methods[$method])) {
|
||||
@@ -159,14 +158,14 @@ function uc_ups_fulfill_order($form, &$form_state, $order, $package_ids) {
|
||||
$method = $services[$order->quote['accessorials']];
|
||||
}
|
||||
|
||||
// Container for shipment data
|
||||
// Container for shipment data.
|
||||
$form['shipment'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Shipment data'),
|
||||
'#collapsible' => TRUE,
|
||||
);
|
||||
|
||||
// Inform user of customer's shipping choice
|
||||
// Inform user of customer's shipping choice.
|
||||
$form['shipment']['shipping_choice'] = array(
|
||||
'#type' => 'markup',
|
||||
'#prefix' => '<div>',
|
||||
@@ -175,7 +174,7 @@ function uc_ups_fulfill_order($form, &$form_state, $order, $package_ids) {
|
||||
);
|
||||
|
||||
// Pass shipping charge paid information on to validation function so it
|
||||
// can be displayed alongside actual costs
|
||||
// can be displayed alongside actual costs.
|
||||
$form['shipment']['paid'] = array(
|
||||
'#type' => 'value',
|
||||
'#value' => uc_currency_format($order->quote['rate']),
|
||||
@@ -402,6 +401,7 @@ function uc_ups_shipment_request($packages, $origin, $destination, $ups_service)
|
||||
$units = 'LBS';
|
||||
$unit_name = 'Pounds';
|
||||
break;
|
||||
|
||||
case 'cm':
|
||||
$weight_factor = uc_weight_conversion($package->weight_units, 'kg');
|
||||
$units = 'KGS';
|
||||
@@ -709,18 +709,18 @@ function uc_ups_confirm_shipment_submit($form, &$form_state) {
|
||||
/**
|
||||
* Constructs an XML label and pickup request.
|
||||
*
|
||||
* @param $digest
|
||||
* @param string $digest
|
||||
* Base-64 encoded shipment request.
|
||||
* @param $order_id
|
||||
* @param int $order_id
|
||||
* The order id of the shipment.
|
||||
* @param $packages
|
||||
* @param array $packages
|
||||
* An array of package ids to be shipped.
|
||||
*
|
||||
* @return
|
||||
* @return string
|
||||
* ShipmentAcceptRequest XML document to send to UPS.
|
||||
*/
|
||||
function uc_ups_request_pickup($digest, $order_id = 0, $packages = array()) {
|
||||
$packages = (array)$packages;
|
||||
$packages = (array) $packages;
|
||||
|
||||
$schema = uc_ups_access_request();
|
||||
$schema .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
||||
|
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
function uc_usps_admin_settings($form, &$form_state) {
|
||||
|
||||
// Put fieldsets into vertical tabs
|
||||
// Put fieldsets into vertical tabs.
|
||||
$form['usps-settings'] = array(
|
||||
'#type' => 'vertical_tabs',
|
||||
'#attached' => array(
|
||||
@@ -24,7 +24,7 @@ function uc_usps_admin_settings($form, &$form_state) {
|
||||
),
|
||||
);
|
||||
|
||||
// Container for credential forms
|
||||
// Container for credential forms.
|
||||
$form['uc_usps_credentials'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Credentials'),
|
||||
@@ -98,7 +98,7 @@ function uc_usps_admin_settings($form, &$form_state) {
|
||||
'#description' => t('Select the USPS services that are available to customers. Be sure to include the services that the Postal Service agrees are available to you.'),
|
||||
);
|
||||
|
||||
// Container for quote options
|
||||
// Container for quote options.
|
||||
$form['uc_usps_quote_options'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Quote options'),
|
||||
@@ -119,7 +119,7 @@ function uc_usps_admin_settings($form, &$form_state) {
|
||||
'#description' => t('Indicate whether each product is quoted as shipping separately or all in one package. Orders with one kind of product will still use the package quantity to determine the number of packages needed, however.'),
|
||||
);
|
||||
|
||||
// Insurance
|
||||
// Insurance.
|
||||
$form['uc_usps_quote_options']['uc_usps_insurance'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Package insurance'),
|
||||
@@ -128,7 +128,7 @@ function uc_usps_admin_settings($form, &$form_state) {
|
||||
'#disabled' => TRUE,
|
||||
);
|
||||
|
||||
// Delivery Confirmation
|
||||
// Delivery Confirmation.
|
||||
$form['uc_usps_quote_options']['uc_usps_delivery_confirmation'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Delivery confirmation'),
|
||||
@@ -137,7 +137,7 @@ function uc_usps_admin_settings($form, &$form_state) {
|
||||
'#disabled' => TRUE,
|
||||
);
|
||||
|
||||
// Signature Confirmation
|
||||
// Signature Confirmation.
|
||||
$form['uc_usps_quote_options']['uc_usps_signature_confirmation'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Signature confirmation'),
|
||||
@@ -146,7 +146,7 @@ function uc_usps_admin_settings($form, &$form_state) {
|
||||
'#disabled' => TRUE,
|
||||
);
|
||||
|
||||
// Container for markup forms
|
||||
// Container for markup forms.
|
||||
$form['uc_usps_markups'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => t('Markups'),
|
||||
@@ -173,7 +173,7 @@ function uc_usps_admin_settings($form, &$form_state) {
|
||||
'#description' => t('Markup shipping rate quote by dollar amount, percentage, or multiplier.'),
|
||||
);
|
||||
|
||||
// Form to select type of weight markup
|
||||
// Form to select type of weight markup.
|
||||
$form['uc_usps_markups']['uc_usps_weight_markup_type'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Weight markup type'),
|
||||
@@ -186,7 +186,7 @@ function uc_usps_admin_settings($form, &$form_state) {
|
||||
'#disabled' => TRUE,
|
||||
);
|
||||
|
||||
// Form to select weight markup amount
|
||||
// Form to select weight markup amount.
|
||||
$form['uc_usps_markups']['uc_usps_weight_markup'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Shipping weight markup'),
|
||||
|
@@ -6,9 +6,8 @@ core = 7.x
|
||||
|
||||
configure = admin/store/settings/quotes/settings/usps
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-07-16
|
||||
version = "7.x-3.10"
|
||||
; Information added by Drupal.org packaging script on 2019-03-06
|
||||
version = "7.x-3.12"
|
||||
core = "7.x"
|
||||
project = "ubercart"
|
||||
datestamp = "1468644909"
|
||||
|
||||
datestamp = "1551862392"
|
||||
|
@@ -348,32 +348,31 @@ function uc_usps_quote($products, $details, $method) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (isset($response->Package)) {
|
||||
foreach ($response->Package as $package) {
|
||||
if (isset($package->Error)) {
|
||||
$debug_data['error'][] = (string)$package->Error[0]->Description . '<br />';
|
||||
$debug_data['error'][] = (string) $package->Error[0]->Description . '<br />';
|
||||
}
|
||||
else {
|
||||
if (strpos($method['id'], 'intl')) {
|
||||
foreach ($package->Service as $service) {
|
||||
$id = (string)$service['ID'];
|
||||
$services[$id]['label'] = t('U.S.P.S. @service', array('@service' => (string)$service->SvcDescription));
|
||||
$id = (string) $service['ID'];
|
||||
$services[$id]['label'] = t('U.S.P.S. @service', array('@service' => (string) $service->SvcDescription));
|
||||
// Markup rate before customer sees it.
|
||||
if (!isset($services[$id]['rate'])) {
|
||||
$services[$id]['rate'] = 0;
|
||||
}
|
||||
$services[$id]['rate'] += uc_usps_rate_markup((string)$service->Postage);
|
||||
$services[$id]['rate'] += uc_usps_rate_markup((string) $service->Postage);
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach ($package->Postage as $postage) {
|
||||
$classid = (string)$postage['CLASSID'];
|
||||
$classid = (string) $postage['CLASSID'];
|
||||
if ($classid === '0') {
|
||||
if ((string)$postage->MailService == "First-Class Mail® Parcel") {
|
||||
if ((string) $postage->MailService == "First-Class Mail® Parcel") {
|
||||
$classid = 'zeroParcel';
|
||||
}
|
||||
elseif ((string)$postage->MailService == "First-Class Mail® Letter") {
|
||||
elseif ((string) $postage->MailService == "First-Class Mail® Letter") {
|
||||
$classid = 'zeroFlat';
|
||||
}
|
||||
else {
|
||||
@@ -383,16 +382,16 @@ function uc_usps_quote($products, $details, $method) {
|
||||
if (!isset($services[$classid]['rate'])) {
|
||||
$services[$classid]['rate'] = 0;
|
||||
}
|
||||
$services[$classid]['label'] = t('U.S.P.S. @service', array('@service' => (string)$postage->MailService));
|
||||
$services[$classid]['label'] = t('U.S.P.S. @service', array('@service' => (string) $postage->MailService));
|
||||
// Markup rate before customer sees it.
|
||||
// Rates are stored differently if ONLINE $rate_type is requested.
|
||||
// First Class doesn't have online rates, so if CommercialRate
|
||||
// is missing use Rate instead.
|
||||
if ($rate_type && !empty($postage->CommercialRate)) {
|
||||
$services[$classid]['rate'] += uc_usps_rate_markup((string)$postage->CommercialRate);
|
||||
$services[$classid]['rate'] += uc_usps_rate_markup((string) $postage->CommercialRate);
|
||||
}
|
||||
else {
|
||||
$services[$classid]['rate'] += uc_usps_rate_markup((string)$postage->Rate);
|
||||
$services[$classid]['rate'] += uc_usps_rate_markup((string) $postage->Rate);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -573,8 +572,10 @@ function uc_usps_rate_markup($rate) {
|
||||
switch ($type) {
|
||||
case 'percentage':
|
||||
return $rate + $rate * floatval($markup) / 100;
|
||||
|
||||
case 'multiplier':
|
||||
return $rate * floatval($markup);
|
||||
|
||||
case 'currency':
|
||||
return $rate + floatval($markup);
|
||||
}
|
||||
@@ -714,7 +715,7 @@ function _uc_usps_package_products($products, &$addresses) {
|
||||
if (!isset($product->pkg_qty) || !$product->pkg_qty) {
|
||||
$product->pkg_qty = 1;
|
||||
}
|
||||
$num_of_pkgs = (int)($product->qty / $product->pkg_qty);
|
||||
$num_of_pkgs = (int) ($product->qty / $product->pkg_qty);
|
||||
if ($num_of_pkgs) {
|
||||
$package = clone $product;
|
||||
$package->description = $product->model;
|
||||
@@ -730,6 +731,7 @@ function _uc_usps_package_products($products, &$addresses) {
|
||||
$package->pounds = floor($weight);
|
||||
$package->ounces = LB_TO_OZ * ($weight - $package->pounds);
|
||||
break;
|
||||
|
||||
case 'oz':
|
||||
$package->pounds = floor($weight * OZ_TO_LB);
|
||||
$package->ounces = $weight - $package->pounds * LB_TO_OZ;
|
||||
@@ -786,6 +788,7 @@ function _uc_usps_package_products($products, &$addresses) {
|
||||
$package->pounds = floor($weight);
|
||||
$package->ounces = LB_TO_OZ * ($weight - $package->pounds);
|
||||
break;
|
||||
|
||||
case 'oz':
|
||||
$package->pounds = floor($weight * OZ_TO_LB);
|
||||
$package->ounces = $weight - $package->pounds * LB_TO_OZ;
|
||||
|
@@ -13,7 +13,8 @@ function uc_usps_default_rules_configuration_alter(&$configs) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Domestic areas include U.S., American Samoa, Guam, Puerto Rico, and the Virgin Islands
|
||||
// Domestic areas include U.S., American Samoa, Guam, Puerto Rico,
|
||||
// and the US Virgin Islands.
|
||||
$countries = array(
|
||||
16 => t('American Samoa'),
|
||||
316 => t('Guam'),
|
||||
@@ -41,7 +42,6 @@ function uc_usps_default_rules_configuration_alter(&$configs) {
|
||||
$foreign_env->condition($condition);
|
||||
}
|
||||
|
||||
|
||||
$configs['get_quote_from_usps']->condition($domestic);
|
||||
$configs['get_quote_from_usps_env']->condition($domestic_env);
|
||||
$configs['get_quote_from_usps_intl']->condition($foreign);
|
||||
|
@@ -6,9 +6,8 @@ core = 7.x
|
||||
|
||||
configure = admin/store/settings/quotes/methods
|
||||
|
||||
; Information added by Drupal.org packaging script on 2016-07-16
|
||||
version = "7.x-3.10"
|
||||
; Information added by Drupal.org packaging script on 2019-03-06
|
||||
version = "7.x-3.12"
|
||||
core = "7.x"
|
||||
project = "ubercart"
|
||||
datestamp = "1468644909"
|
||||
|
||||
datestamp = "1551862392"
|
||||
|
@@ -6,7 +6,6 @@
|
||||
* product.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
|
Reference in New Issue
Block a user