From be3dd4f08072caf20879f98044e3a34e48d394ea Mon Sep 17 00:00:00 2001 From: Jordan Fei Date: Wed, 6 Feb 2013 13:38:14 +0800 Subject: [PATCH] Issue #1899458: Added taxed product type updated when content type change --- uc_taxes/uc_taxes.module | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/uc_taxes/uc_taxes.module b/uc_taxes/uc_taxes.module index 5cdaed9..79dcf2b 100644 --- a/uc_taxes/uc_taxes.module +++ b/uc_taxes/uc_taxes.module @@ -235,6 +235,26 @@ function uc_taxes_uc_order($op, $order, $arg2) { } /** + * Implements hook_node_type_update(). + * + * Ensure taxed product type are synchronised if the + * content type is updated. + */ +function uc_taxes_node_type_update($info) { + $existing_type = !empty($info->old_type) ? $info->old_type : $info->type; + + if($existing_type != $info->type) + { + db_update('uc_taxed_product_types') + ->fields(array( + 'type' => $info->type, + )) + ->condition('type', $existing_type) + ->execute(); + } +} + +/** * Tax line item callback. */ function uc_line_item_tax_display($op, $order) { -- 1.8.0.msysgit.0