Changeset 1954775
- Timestamp:
- 10/10/2018 09:20:28 PM (7 years ago)
- Location:
- event-organiser-vat/trunk
- Files:
-
- 1 deleted
- 7 edited
-
assets/images (deleted)
-
assets/js/vat.js (modified) (3 diffs)
-
assets/js/vat.min.js (modified) (1 diff)
-
event-organiser-vat.php (modified) (3 diffs)
-
includes/vat.php (modified) (1 diff)
-
languages/event-organiser-vat.pot (modified) (2 diffs)
-
readme.md (modified) (3 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
event-organiser-vat/trunk/assets/js/vat.js
r1219529 r1954775 5 5 */ 6 6 var eoVatToFixed = function( number, precision ) { 7 7 8 8 precision = ( typeof precision == 'undefined' ? 0 : precision ); 9 9 10 10 //Lets ensure the part we want to keep is the (rounded) integer 11 11 var roundedInt = Math.round( number * Math.pow( 10, precision ) ); 12 12 var roundedFloat = roundedInt / Math.pow( 10, precision ); 13 13 14 14 //Ensure the appropriate number of decimal points are returned 15 15 return roundedFloat.toPrecision( roundedInt.toString().length ); 16 17 16 }; 18 17 19 18 /** 20 19 * Listens for a change in the checkout total and 21 20 * adds the appropriate about of VAT. If VAT amount 22 * is above 0, show VAT row, otherwise hide it. 21 * is above 0, show VAT row, otherwise hide it. 23 22 */ 24 23 wp.hooks.addFilter( 'eventorganiser.checkout_cart', function( cart ){ … … 26 25 var vat = eo_pro_vat.vat_percent; 27 26 var vat_amount = cart.total*(vat/100); 27 28 28 cart.total = cart.total + vat_amount; 29 29 … … 33 33 $('#eo-booking-vat').parents('tr').show(); 34 34 } 35 35 36 36 $('#eo-booking-vat').text( eoVatToFixed( parseFloat( vat_amount, 2 ), 2 ) ); 37 37 38 38 return cart; 39 39 40 40 }, 100 ); 41 41 -
event-organiser-vat/trunk/assets/js/vat.min.js
r1219529 r1954775 1 /*! Event Organiser VAT - v1.0. 51 /*! Event Organiser VAT - v1.0.6 2 2 * http://wp-event-organiser.com 3 3 */ 4 jQuery(document).ready(function( t){var o=function(t,o){o=o===void 0?0:o;var e=Math.round(t*Math.pow(10,o)),a=e/Math.pow(10,o);return a.toPrecision((""+e).length)};wp.hooks.addFilter("eventorganiser.checkout_cart",function(e){var a=eo_pro_vat.vat_percent,r=e.total*(a/100);return e.total=e.total+r,0===r?t("#eo-booking-vat").parents("tr").hide():t("#eo-booking-vat").parents("tr").show(),t("#eo-booking-vat").text(o(parseFloat(r,2),2)),e},100)});4 jQuery(document).ready(function(a){var b=function(a,b){b="undefined"==typeof b?0:b;var c=Math.round(a*Math.pow(10,b)),d=c/Math.pow(10,b);return d.toPrecision(c.toString().length)};wp.hooks.addFilter("eventorganiser.checkout_cart",function(c){var d=eo_pro_vat.vat_percent,e=c.total*(d/100);return c.total=c.total+e,0===e?a("#eo-booking-vat").parents("tr").hide():a("#eo-booking-vat").parents("tr").show(),a("#eo-booking-vat").text(b(parseFloat(e,2),2)),c},100)}); -
event-organiser-vat/trunk/event-organiser-vat.php
r1219529 r1954775 4 4 * Plugin URI: http://wp-event-organiser.com 5 5 * Description: Adds VAT to Event Organiser Pro 6 * Version: 1.0. 56 * Version: 1.0.6 7 7 * Author: Stephen Harris 8 8 * Author URI: http://wp-event-organiser.com … … 31 31 32 32 // Useful global constants 33 define( 'EVENTORGANISERVAT_VERSION', '1.0. 5' );33 define( 'EVENTORGANISERVAT_VERSION', '1.0.6' ); 34 34 define( 'EVENTORGANISERVAT_URL', plugin_dir_url( __FILE__ ) ); 35 35 define( 'EVENTORGANISERVAT_DIR', plugin_dir_path( __FILE__ ) ); … … 43 43 */ 44 44 function eventorganiservat_init() { 45 45 46 46 load_plugin_textdomain( 'event-organiser-vat', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); 47 47 48 48 $version = defined( 'EVENTORGANISERVAT_VERSION' ) ? EVENTORGANISERVAT_VERSION : false; 49 49 $ext = (defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG) ? '' : '.min'; 50 50 51 51 //Register scripts 52 52 wp_register_script( 'eo_pro_vat', EVENTORGANISERVAT_URL . "assets/js/vat{$ext}.js", array( 'eo-wp-js-hooks' ), $version ); 53 53 54 54 wp_localize_script( 'eo_pro_vat', 'eo_pro_vat', array( 55 55 'vat_percent' => eventorganiservat_get_vat_percent(), -
event-organiser-vat/trunk/includes/vat.php
r1212022 r1954775 90 90 $amount = floatval( eo_get_booking_meta( $booking_id, 'booking_amount', true ) ); 91 91 $vat = eventorganiservat_get_vat_percent(); 92 $vat_amount = number_format( ($vat * $amount )/100, 2 );92 $vat_amount = round( ($vat * $amount )/100, 2 ); 93 93 94 94 update_post_meta( $booking_id, '_eo_booking_vat_percent', $vat ); -
event-organiser-vat/trunk/languages/event-organiser-vat.pot
r1219529 r1954775 1 1 # SOME DESCRIPTIVE TITLE. 2 2 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 # This file is distributed under the same license as the PACKAGEpackage.3 # This file is distributed under the same license as the event-organiser-vat package. 4 4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. 5 5 # … … 7 7 msgid "" 8 8 msgstr "" 9 "Project-Id-Version: event-organiser-vat 1.0. 5\n"9 "Project-Id-Version: event-organiser-vat 1.0.6\n" 10 10 "Report-Msgid-Bugs-To: \n" 11 "POT-Creation-Date: 201 5-08-12 21:46+0100\n"11 "POT-Creation-Date: 2018-10-10 22:17+0100\n" 12 12 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 13 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -
event-organiser-vat/trunk/readme.md
r1219529 r1954775 3 3 **Donate link:** http://wp-event-organiser.com 4 4 **Requires at least:** 3.3 5 **Tested up to:** 4. 3.06 **Stable tag:** 1.0. 55 **Tested up to:** 4.9.8 6 **Stable tag:** 1.0.6 7 7 **License:** GPLv2 or later 8 8 … … 36 36 ## Changelog ## 37 37 38 ### 1.0.6 ### 39 * Fixes bug with total calcation when VAT amount exceeds 1,000 40 38 41 ### 1.0.5 ### 39 42 * Fixes rounding errors … … 43 46 44 47 ### 1.0.3 ### 45 * Added option for "VAT" label 48 * Added option for "VAT" label 46 49 47 50 ### 1.0.2 ### -
event-organiser-vat/trunk/readme.txt
r1219529 r1954775 3 3 Donate link: http://wp-event-organiser.com 4 4 Requires at least: 3.3 5 Tested up to: 4. 3.06 Stable tag: 1.0. 55 Tested up to: 4.9.8 6 Stable tag: 1.0.6 7 7 License: GPLv2 or later 8 8 … … 34 34 == Changelog == 35 35 36 = 1.0.6 = 37 * Fixes bug with total calcation when VAT amount exceeds 1,000 38 36 39 = 1.0.5 = 37 40 * Fixes rounding errors … … 41 44 42 45 = 1.0.3 = 43 * Added option for "VAT" label 46 * Added option for "VAT" label 44 47 45 48 = 1.0.2 =
Note: See TracChangeset
for help on using the changeset viewer.