? uc_vat.location_config.patch
Index: uc_vat.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/uc_vat/uc_vat.module,v
retrieving revision 1.9
diff -u -p -r1.9 uc_vat.module
--- uc_vat.module	16 Jun 2009 08:50:06 -0000	1.9
+++ uc_vat.module	17 Jun 2009 08:16:44 -0000
@@ -36,6 +36,10 @@ function uc_vat_settings_form($form_stat
  */
 function uc_vat_uc_price_handler() {
   return array(
+    'locations' => array(
+      'product-view', 'product-kit-view', 'product-tapir-table', 'catalog-grid-product',
+      'views-price-handler', 'product-upsell', 'cart-item', 'cart-review-item',
+    ),
     'alter' => array(
       'title' => t('VAT price alterer'),
       'description' => t('Modifies prices to include tax before checkout.'),
@@ -107,26 +111,7 @@ function uc_vat_nodeapi(&$node, $op, $a3
  * VAT price alterer callback function.
  */
 function uc_vat_price_handler_alter(&$price, &$context, &$options) {
-  switch ($context['location']) {
-    case 'product-view':            // Standard product node view
-    case 'product-kit-view':        // Product kit node view
-    case 'product-tapir-table':     // Catalog table view
-    case 'catalog-grid-product':    // Catalog grid view
-    case 'views-price-handler':     // Prices displayed by Views module
-    case 'product-upsell':          // Prices displayed by uc_upsell
-      $node = $context['subject']['node'];
-      break;
-
-    case 'cart-item':               // Cart item
-    case 'cart-review-item':        // Cart checkout review page
-    //case 'cart-checkout-item': // Enabling this causes incorrect prices in the cart block!
-      $node = $context['extras']['node'];
-      break;
-      
-    default:
-      // Don't modify prices in other locations.
-      return;
-  }
+  $node = isset($context['subject']['node']) ? $context['subject']['node'] : $context['extras']['node'];
 
   if ($node->type == 'product_kit') {
     // Special case for product kits; calculate VAT per-product including any kit discount.
