Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andyg5000/cb12d7695c7323ad318e to your computer and use it in GitHub Desktop.
Save andyg5000/cb12d7695c7323ad318e to your computer and use it in GitHub Desktop.
https://www.drupal.org/node/2026321 Patch to remove "You are not authorized to access this command."
diff --git a/includes/commerce_shipping.checkout_pane.inc b/includes/commerce_shipping.checkout_pane.inc
index fed4752..8c61552 100644
--- a/includes/commerce_shipping.checkout_pane.inc
+++ b/includes/commerce_shipping.checkout_pane.inc
@@ -178,17 +178,12 @@ function commerce_shipping_recalculate_services_refresh($form, $form_state) {
* Validate callback for recalculating shipping services.
*/
function commerce_shipping_recalculate_services_validate($form, &$form_state) {
-
- // Load latest version of the order.
- $order = commerce_order_load($form_state['order']->order_id);
// Check if the order is still on the same checkout step.
$checkout_page = $form_state['checkout_page'];
- if ($form_state['order']->changed < $order->changed || !commerce_checkout_page_access($checkout_page, $order)) {
- // Clear all errors.
- form_clear_error();
- watchdog('access denied', check_plain($_GET['q']), NULL, WATCHDOG_WARNING);
- drupal_set_message(t('You are not authorized to access this command.'), 'error');
- $form_state['rebuild'] = TRUE;
+
+ // Don't attempt to recalculate shipping if the order object has changed
+ // or access to the current checkout page is prohibited.
+ if (commerce_order_has_changed($form_state['order']) || !commerce_checkout_page_access($checkout_page, $form_state['order'])) {
return FALSE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment