### Eclipse Workspace Patch 1.0 #P lifeline Index: sites/all/modules/uc_vat/uc_vat.admin.inc =================================================================== --- sites/all/modules/uc_vat/uc_vat.admin.inc (revision 4657) +++ sites/all/modules/uc_vat/uc_vat.admin.inc (working copy) @@ -5,6 +5,7 @@ * Module configuration form. */ function uc_vat_settings_form($form_state) { + $tax_name = variable_get('uc_vat_name', 'VAT'); $form['display'] = array( '#type' => 'fieldset', '#title' => t('Price display options'), @@ -19,7 +20,7 @@ ); $form['display']['uc_vat_suffix_tax'] = array( '#type' => 'checkbox', - '#title' => t('Add "including !tax" or "excluding !tax" to product prices.', array('!tax' => variable_get('uc_vat_name', 'VAT'))), + '#title' => t('Add "including !tax" or "excluding !tax" to product prices.', array('!tax' => $tax_name)), '#default_value' => variable_get('uc_vat_suffix_tax', FALSE), ); $form['display']['uc_vat_suffix_shipping'] = array( @@ -29,15 +30,15 @@ ); $form['display']['uc_vat_exclude_superuser'] = array( '#type' => 'checkbox', - '#title' => t('Show prices excluding VAT to the superuser.'), - '#description' => t('By default, uid 1 has all permissions, which would include "show prices excluding VAT". This can be confusing so you can select here whether uid 1 should see prices inclusive or exclusive of VAT.'), + '#title' => t('Show prices excluding !tax to the superuser.', array('!tax' => $tax_name)), + '#description' => t('By default, uid 1 has all permissions, which would include "show prices excluding !tax". This can be confusing so you can select here whether uid 1 should see prices inclusive or exclusive of !tax.', array('!tax' => $tax_name)), '#default_value' => variable_get('uc_vat_exclude_superuser', FALSE), ); $form['edit'] = array( '#type' => 'fieldset', '#title' => t('Price editing options'), - '#description' => t('Select the price fields below that you will enter inclusive of !tax.', array('!tax' => variable_get('uc_vat_name', 'VAT'))), + '#description' => t('Select the price fields below that you will enter inclusive of !tax.', array('!tax' => $tax_name)), '#collapsible' => TRUE, ); $form['edit']['uc_vat_list_price_inclusive'] = array( @@ -69,8 +70,8 @@ ); $form['checkout']['uc_vat_hide_checkout_exclusive'] = array( '#type' => 'checkbox', - '#title' => t('Hide !tax exclusive prices and "Subtotal excluding !tax" line item.', array('!tax' => variable_get('uc_vat_name', 'VAT'))), - '#description' => t('Enabling this will also prefix !tax amounts in the checkout with "incl."', array('!tax' => variable_get('uc_vat_name', 'VAT'))), + '#title' => t('Hide !tax exclusive prices and "Subtotal excluding !tax" line item.', array('!tax' => $tax_name)), + '#description' => t('Enabling this will also prefix !tax amounts in the checkout with "incl."', array('!tax' => $tax_name)), '#default_value' => variable_get('uc_vat_hide_checkout_exclusive', FALSE), ); @@ -81,8 +82,8 @@ ); $form['advanced']['uc_vat_recalculate_prices'] = array( '#type' => 'checkbox', - '#title' => t('Keep !tax inclusive prices the same after a rate change.', array('!tax' => variable_get('uc_vat_name', 'VAT'))), - '#description' => t('By checking this box, any changes to the tax rate(s) will recalculate the base product and attribute prices accordingly, so the !tax inclusive prices will stay the same.', array('!tax' => variable_get('uc_vat_name', 'VAT'))), + '#title' => t('Keep !tax inclusive prices the same after a rate change.', array('!tax' => $tax_name)), + '#description' => t('By checking this box, any changes to the tax rate(s) will recalculate the base product and attribute prices accordingly, so the !tax inclusive prices will stay the same.', array('!tax' => $tax_name)), '#default_value' => variable_get('uc_vat_recalculate_prices', FALSE), ); Index: sites/all/modules/uc_vat/uc_vat.module =================================================================== --- sites/all/modules/uc_vat/uc_vat.module (revision 4657) +++ sites/all/modules/uc_vat/uc_vat.module (working copy) @@ -5,7 +5,7 @@ * Implementation of hook_perm(). */ function uc_vat_perm() { - return array('show prices excluding VAT'); + return array('show prices excluding '. variable_get('uc_vat_name', 'VAT')); } /** @@ -15,7 +15,7 @@ $items = array(); $items['admin/store/settings/taxes/vat'] = array( - 'title' => 'VAT settings', + 'title' => variable_get('uc_vat_name', 'VAT') .' settings', 'page callback' => 'drupal_get_form', 'page arguments' => array('uc_vat_settings_form'), 'access arguments' => array('configure taxes'), @@ -40,7 +40,7 @@ function uc_vat_uc_price_handler() { return array( 'alter' => array( - 'title' => t('VAT price alterer'), + 'title' => t('!tax price alterer', array('!tax' => variable_get('uc_vat_name', 'VAT'))), 'description' => t('Modifies prices to include tax before checkout.'), 'callback' => 'uc_vat_price_handler_alter', ), @@ -176,14 +176,14 @@ if ($form['id']['#value'] && _uc_vat_product_fields()) { if (variable_get('uc_vat_recalculate_prices', FALSE)) { $form['recalculation_note'] = array( - '#value' => '

'. t('If the rate is changed, product and attribute prices will be recalculated, so !tax exclusive prices will change but !tax inclusive prices will stay the same. Visit the VAT settings page to change this behaviour.', array('!tax' => variable_get('uc_vat_name', 'VAT'), '!url' => url('admin/store/settings/taxes/vat'))) .'

', + '#value' => '

'. t('If the rate is changed, product and attribute prices will be recalculated, so !tax exclusive prices will change but !tax inclusive prices will stay the same. Visit the !tax settings page to change this behaviour.', array('!tax' => variable_get('uc_vat_name', 'VAT'), '!url' => url('admin/store/settings/taxes/vat'))) .'

', '#weight' => -10, ); $form['#submit'][] = 'uc_vat_recalculate_prices'; } else { $form['recalculation_note'] = array( - '#value' => '

'. t('If the rate is changed, product and attribute prices will not be recalculated, so !tax inclusive prices will change. Visit the VAT settings page to change this behaviour.', array('!tax' => variable_get('uc_vat_name', 'VAT'), '!url' => url('admin/store/settings/taxes/vat'))) .'

', + '#value' => '

'. t('If the rate is changed, product and attribute prices will not be recalculated, so !tax inclusive prices will change. Visit the !tax settings page to change this behaviour.', array('!tax' => variable_get('uc_vat_name', 'VAT'), '!url' => url('admin/store/settings/taxes/vat'))) .'

', '#weight' => -10, ); } @@ -196,6 +196,7 @@ function uc_vat_recalculate_prices($form, &$form_state) { $old_rate = $form['rate']['#default_value']; $new_rate = $form_state['values']['rate']; + $tax_name = variable_get('uc_vat_name', 'VAT'); if ($old_rate == $new_rate) { // Don't do anything if the rate didn't change. @@ -240,7 +241,7 @@ } if ($count > 0) { - drupal_set_message(format_plural($count, 'Recalculated the VAT exclusive price of 1 product.', 'Recalculated the VAT exclusive price of @count products.')); + drupal_set_message(format_plural($count, t('Recalculated the !tax exclusive price of 1 product.', array('!tax' => $tax_name)), t('Recalculated the !tax exclusive price of @count products.', array('!tax' => $tax_name)))); } // Find product class attribute options to be recalculated. @@ -265,7 +266,7 @@ } if ($count > 0) { - drupal_set_message(format_plural($count, 'Recalculated the VAT exclusive price of 1 product class attribute option.', 'Recalculated the VAT exclusive price of @count product class attribute options.')); + drupal_set_message(format_plural($count, t('Recalculated the !tax exclusive price of 1 product class attribute option.', array('!tax' => $tax_name)), t('Recalculated the VAT exclusive price of @count product class attribute options.', array('!tax' => $tax_name)))); } // Find product attribute options to be recalculated. @@ -290,7 +291,7 @@ } if ($count > 0) { - drupal_set_message(format_plural($count, 'Recalculated the VAT exclusive price of 1 attribute option.', 'Recalculated the VAT exclusive price of @count attribute options.')); + drupal_set_message(format_plural($count, t('Recalculated the !tax exclusive price of 1 attribute option.', array('!tax' => $tax_name)), t('Recalculated the !tax exclusive price of @count attribute options.', array('!tax' => $tax_name)))); } } @@ -417,7 +418,7 @@ } } } - + if ($node->type == 'product_kit') { // Special case for product kits; calculate VAT per-product including any kit discount. foreach ($node->products as $product) { @@ -447,7 +448,7 @@ $options['suffixes'][] = ' '. t('including !taxes', array('!taxes' => implode(', ', $suffixes))) .''; } else { - $options['suffixes'][] = ' '. t('excluding !tax', array('!tax' => variable_get('uc_vat_name', 'VAT'))) .''; + $options['suffixes'][] = ' '. t('excluding !tax', array('!tax' => $tax_name)) .''; } } if (variable_get('uc_vat_suffix_shipping', FALSE) && $node->shippable) { @@ -455,7 +456,7 @@ } } } - + /** * Handle VAT on line items. */ @@ -626,7 +627,7 @@ $tax = reset($taxes); $tax_name = $tax->name; } - + // Set up table header. $header = array( array('data' => t('Qty'), 'class' => 'qty'), @@ -711,7 +712,7 @@ */ function uc_vat_exclude_vat() { global $user; - return $user->uid == 1 ? variable_get('uc_vat_exclude_superuser', FALSE) : user_access('show prices excluding VAT'); + return $user->uid == 1 ? variable_get('uc_vat_exclude_superuser', FALSE) : user_access('show prices excluding '. variable_get('uc_vat_name', 'VAT')); } /**