Plugin Directory

Changeset 2444165


Ignore:
Timestamp:
12/22/2020 07:53:04 AM (5 years ago)
Author:
starkinfo
Message:

Updated 1.2 to 1.3
Verified the compatibility with WordPress 5.6 and WooCommerce 4.8.0

Location:
woo-gst
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • woo-gst/trunk/class-gst-woocommerce-addon.php

    r1962125 r2444165  
    1414    public function init() {
    1515
    16         add_filter( 'woocommerce_settings_tabs_array', array( $this ,'fn_add_settings_tab' ), 50 );
    17         add_action( 'woocommerce_settings_tabs_settings_gst_tab', array( $this , 'fn_settings_tab') );
    18         add_action( 'woocommerce_update_options_settings_gst_tab', array( $this , 'fn_update_settings') );
    19         add_action( 'woocommerce_update_options_tax', array( $this , 'fn_update_tax_settings') );
    20         add_action( 'init', array( $this , 'fn_gst_callback') );
    21         add_action('woocommerce_product_options_general_product_data', array( $this , 'fn_add_product_custom_meta_box') );
    22         add_action( 'woocommerce_process_product_meta', array( $this , 'fn_save_license_field') );
     16        add_filter( 'woocommerce_settings_tabs_array', array( $this ,'fn_add_settings_tab' ), 50 );
     17        add_action( 'woocommerce_settings_tabs_settings_gst_tab', array( $this , 'fn_settings_tab') );
     18        add_action( 'woocommerce_update_options_settings_gst_tab', array( $this , 'fn_update_settings') );
     19        add_action( 'woocommerce_update_options_tax', array( $this , 'fn_update_tax_settings') );
     20        // add_action( 'init', array( $this , 'fn_gst_callback') );
     21        add_action( 'woocommerce_update_options_settings_gst_tab', array( $this , 'fn_update_tax_settings') );
     22        add_action('woocommerce_product_options_general_product_data', array( $this , 'fn_add_product_custom_meta_box') );
     23        add_action( 'woocommerce_process_product_meta', array( $this , 'fn_save_license_field') );
    2324        add_action( 'admin_print_scripts',  array( $this , 'fn_load_custom_wp_admin_script'), 999 );
    24         add_action( 'woocommerce_email_after_order_table', array( $this , 'fn_woocommerce_gstin_invoice_fields') );
     25        add_action( 'woocommerce_email_after_order_table', array( $this , 'fn_woocommerce_gstin_invoice_fields') );
    2526        add_action( 'admin_notices', array( $this , 'print_pro_notice') );
    2627        add_filter( 'plugin_row_meta', array( $this, 'fn_add_extra_links' ), 10, 2 );
     
    3839    }
    3940    function fn_woocommerce_gstin_invoice_fields( $order ) {
    40         ?>
    41         <p><strong><?php _e('GSTIN Number:', 'woocommerce'); ?></strong> <?php echo get_option('woocommerce_gstin_number'); ?></p>
    42         <?php
     41        ?>
     42        <p><strong><?php _e('GSTIN Number:', 'woocommerce'); ?></strong> <?php echo get_option('woocommerce_gstin_number'); ?></p>
     43        <?php
    4344    }
    4445
     
    4748       ?>
    4849       <script>
    49         jQuery(document).ready(function($) {
    50             
    51             if($('#woocommerce_product_types').val() == 'multiple'){
    52                 hide_singe();
    53             } else {
    54                 hide_mutiple();
    55             }
    56             $('#woocommerce_product_types').change(function(){
    57                 if($(this).val() == 'single'){
    58                     hide_mutiple();
    59                 } else {
    60                     hide_singe();
    61                 }
    62             });
    63 
    64             function hide_singe(){
    65                 $('select[name="woocommerce_gst_single_select_slab"]').parents('tr:first').hide();
    66                 $('select[name="woocommerce_gst_multi_select_slab[]"]').parents('tr:first').show();
    67             }
    68 
    69             function hide_mutiple(){
    70                 $('select[name="woocommerce_gst_multi_select_slab[]"]').parents('tr:first').hide();
    71                 $('select[name="woocommerce_gst_single_select_slab"]').parents('tr:first').show();
    72             }
    73         });
     50        jQuery(document).ready(function($) {
     51            
     52            if($('#woocommerce_product_types').val() == 'multiple'){
     53                hide_singe();
     54            } else {
     55                hide_mutiple();
     56            }
     57            $('#woocommerce_product_types').change(function(){
     58                if($(this).val() == 'single'){
     59                    hide_mutiple();
     60                } else {
     61                    hide_singe();
     62                }
     63            });
     64
     65            function hide_singe(){
     66                $('select[name="woocommerce_gst_single_select_slab"]').parents('tr:first').hide();
     67                $('select[name="woocommerce_gst_multi_select_slab[]"]').parents('tr:first').show();
     68            }
     69
     70            function hide_mutiple(){
     71                $('select[name="woocommerce_gst_multi_select_slab[]"]').parents('tr:first').hide();
     72                $('select[name="woocommerce_gst_single_select_slab"]').parents('tr:first').show();
     73            }
     74        });
    7475       </script>
    7576       <?php
    76     }
    77 
    78     public function fn_add_product_custom_meta_box() {
    79         woocommerce_wp_text_input(
    80             array(
    81                 'id'            => 'hsn_prod_id',
    82                 'label'         => __('HSN Code', 'woocommerce' ),
    83                 'description'   => __( 'HSN Code is mandatory for GST.', 'woocommerce' ),
    84                 'custom_attributes' => array( 'required' => 'required' ),
    85                 'value'         => get_post_meta( get_the_ID(), 'hsn_prod_id', true )
    86                 )
    87             );
    88     }
    89 
    90     public function fn_save_license_field( $post_id ) {
    91         $value = ( $_POST['hsn_prod_id'] )? sanitize_text_field( $_POST['hsn_prod_id'] ) : '' ;
    92         update_post_meta( $post_id, 'hsn_prod_id', $value );
    93     }
     77    }
     78
     79    public function fn_add_product_custom_meta_box() {
     80        woocommerce_wp_text_input(
     81            array(
     82                'id'            => 'hsn_prod_id',
     83                'label'         => __('HSN Code', 'woocommerce' ),
     84                'description'   => __( 'HSN Code is mandatory for GST.', 'woocommerce' ),
     85                'custom_attributes' => array( 'required' => 'required' ),
     86                'value'         => get_post_meta( get_the_ID(), 'hsn_prod_id', true )
     87                )
     88            );
     89    }
     90
     91    public function fn_save_license_field( $post_id ) {
     92        $value = ( $_POST['hsn_prod_id'] )? sanitize_text_field( $_POST['hsn_prod_id'] ) : '' ;
     93        update_post_meta( $post_id, 'hsn_prod_id', $value );
     94    }
    9495   
    9596    /**
     
    100101     */
    101102    public static function fn_add_settings_tab( $settings_tabs ) {
    102         $settings_tabs['settings_gst_tab'] = __( 'GST Settings', 'woocommerce' );
    103         return $settings_tabs;
     103        $settings_tabs['settings_gst_tab'] = __( 'GST Settings', 'woocommerce' );
     104        return $settings_tabs;
    104105    }
    105106    /**
     
    119120     */
    120121    public static function fn_update_settings() {
    121         self::gst_insrt_tax_slab_rows();
    122         woocommerce_update_options( self::fn_get_settings() );
     122        self::gst_insrt_tax_slab_rows();
     123        woocommerce_update_options( self::fn_get_settings() );
    123124    }
    124125
     
    128129     */
    129130    public static function fn_update_tax_settings() {
    130         self::fn_gst_callback();
     131        if ( isset( $_POST['custom_gst_nonce'] ) && wp_verify_nonce( $_POST['custom_gst_nonce'], 'wc_gst_nonce' )){
     132            self::fn_gst_callback();
     133        }
     134
    131135    }
    132136
     
    138142     */
    139143    public static function fn_gst_callback() {
    140         $a_currunt_tax_slabs = array();
    141         $a_gst_tax_slabs = array();
    142         $s_woocommerce_product_types = get_option( 'woocommerce_product_types' );
    143 
    144         if( isset( $s_woocommerce_product_types ) && $s_woocommerce_product_types == 'multiple' ){
    145             $s_product_types = get_option( 'woocommerce_gst_multi_select_slab' );
    146             $a_gst_tax_slabs = array_merge( $a_gst_tax_slabs, $s_product_types );
    147         } elseif( isset( $s_woocommerce_product_types ) && $s_woocommerce_product_types == 'single' ) {
    148             $s_product_types = get_option( 'woocommerce_gst_single_select_slab' );
    149             array_push( $a_gst_tax_slabs, $s_product_types );
    150         }
    151 
    152         $s_woocommerce_tax_classes = get_option('woocommerce_tax_classes');
    153         if( isset( $s_woocommerce_tax_classes ) ){
    154             $a_currunt_tax_slabs = explode( PHP_EOL, $s_woocommerce_tax_classes );
    155             $i_old_count = count( $a_currunt_tax_slabs );
    156             foreach ( $a_gst_tax_slabs as $gst_tax_value ) {
    157                 if ( !in_array( $gst_tax_value, $a_currunt_tax_slabs ) )
    158                     array_push( $a_currunt_tax_slabs, $gst_tax_value );
    159             }
    160             $i_new_count = count( $a_currunt_tax_slabs );
    161             if( $i_new_count == $i_old_count ){
    162                 return;
    163             }
    164         }
    165         $a_currunt_tax_slabs = ( !$a_currunt_tax_slabs ) ? $a_gst_tax_slabs : $a_currunt_tax_slabs ;
    166         $a_currunt_tax_slabs = implode( PHP_EOL, $a_currunt_tax_slabs );
    167         update_option( 'woocommerce_tax_classes', $a_currunt_tax_slabs );
     144        global $wpdb;
     145        $table_prefix = $wpdb->prefix . "wc_tax_rate_classes";
     146        $a_currunt_tax_slabs = array();
     147        $a_gst_tax_slabs = array();
     148        $s_woocommerce_product_types = get_option( 'woocommerce_product_types' );
     149
     150        if( isset( $s_woocommerce_product_types ) && $s_woocommerce_product_types == 'multiple' ){
     151            $s_product_types = get_option( 'woocommerce_gst_multi_select_slab' );
     152            $a_gst_tax_slabs = array_merge( $a_gst_tax_slabs, $s_product_types );
     153
     154        } elseif( isset( $s_woocommerce_product_types ) && $s_woocommerce_product_types == 'single' ) {
     155            $s_product_types = get_option( 'woocommerce_gst_single_select_slab' );
     156            array_push( $a_gst_tax_slabs, $s_product_types );
     157        }
     158
     159        $s_woocommerce_tax_classes = get_option('woocommerce_tax_classes');
     160
     161        if( isset( $s_woocommerce_tax_classes ) ){
     162            // $a_currunt_tax_slabs = explode( PHP_EOL, $s_woocommerce_tax_classes );
     163            $a_currunt_tax_slabs = array();
     164
     165            $i_old_count = count( $a_currunt_tax_slabs );
     166            $old_tax_slabs = $a_currunt_tax_slabs;
     167            foreach ( $a_gst_tax_slabs as $gst_tax_value ) {
     168                if ( !in_array( $gst_tax_value, $a_currunt_tax_slabs ) )
     169                    array_push( $a_currunt_tax_slabs, $gst_tax_value );
     170            }
     171
     172            $i_new_count = count( $a_currunt_tax_slabs );
     173             if( $i_new_count == $i_old_count ){
     174                return;
     175            }
     176            $diff1 = array_diff($old_tax_slabs,$a_currunt_tax_slabs);
     177            $diff2 = array_diff($a_currunt_tax_slabs,$old_tax_slabs);
     178           
     179            if(!empty($diff1) || !empty($diff2)) {
     180                $tax_slab_array = $a_currunt_tax_slabs;
     181                if(woogst_get_woo_version_number() >= '3.7.0') {
     182                    foreach ($tax_slab_array as $tax_value) {
     183                        $slug = str_replace('%', '', $tax_value);
     184                        $tax_rate_class_id = $wpdb->get_var("SELECT tax_rate_class_id FROM $table_prefix WHERE name='$tax_value'");
     185                        if(($tax_rate_class_id == NULL || empty($tax_rate_class_id)) && !empty($tax_value)) {
     186                            $wpdb->insert($table_prefix,array( 'name' => $tax_value, 'slug' => $slug),array( '%s','%s' ));
     187                        }
     188                    }
     189
     190                }
     191            } else {
     192                return;
     193            }
     194        }
     195        $a_currunt_tax_slabs = ( !$a_currunt_tax_slabs ) ? $a_gst_tax_slabs : $a_currunt_tax_slabs ;
     196        $a_currunt_tax_slabs = implode( PHP_EOL, $a_currunt_tax_slabs );
     197        update_option( 'woocommerce_tax_classes', $a_currunt_tax_slabs );
    168198    }
    169199
     
    173203     */
    174204    public static function gst_insrt_tax_slab_rows() {
    175         global $wpdb;
    176 
    177 
    178         $a_multiple_slabs = array();
    179         if( isset( $_POST['woocommerce_product_types'] ) && $_POST['woocommerce_product_types'] == 'multiple' ){
     205
     206        global $wpdb;
     207
     208        $a_multiple_slabs = array();
     209        if( isset( $_POST['woocommerce_product_types'] ) && $_POST['woocommerce_product_types'] == 'multiple' ){
    180210            $multi_select_slab = $_POST['woocommerce_gst_multi_select_slab'];
    181211            if( ! empty( $multi_select_slab ) )
    182212                $a_multiple_slabs = array_merge( $a_multiple_slabs, $multi_select_slab );
    183         } elseif ( isset( $_POST['woocommerce_product_types'] ) ){
     213        } elseif ( isset( $_POST['woocommerce_product_types'] ) ){
    184214            $single_select_slab = $_POST['woocommerce_gst_single_select_slab'];
    185             array_push( $a_multiple_slabs, $single_select_slab );       
    186         }
    187 
    188         $table_prefix = $wpdb->prefix . "woocommerce_tax_rates";
     215            array_push( $a_multiple_slabs, $single_select_slab );       
     216        }
     217
     218        $table_prefix = $wpdb->prefix . "woocommerce_tax_rates";
    189219
    190220        $s_woocommerce_tax_classes = get_option('woocommerce_tax_classes');
     
    194224        if( !empty( $s_woocommerce_tax_classes ) )
    195225            $a_currunt_tax_slabs = explode( PHP_EOL, $s_woocommerce_tax_classes );
    196 
    197 
    198        
    199         foreach ( $a_multiple_slabs as $a_multiple_slab ) {
    200             if( $a_multiple_slab != '0%' && ! in_array( $a_multiple_slab, $a_currunt_tax_slabs ) ){
    201                 $slab_name = preg_replace('/%/', '', $a_multiple_slab);
    202                 $state_tax ='';
    203                 switch ($slab_name) {
    204                     case '5':
    205                         $state_tax = '2.5';
    206                         break;
    207                     case '12':
    208                         $state_tax = '6';
    209                         break;
    210                     case '18':
    211                         $state_tax = '9';
    212                         break;
    213                     case '28':
    214                         $state_tax = '14';
    215                         break;
    216 
    217                     default:
    218                         $state_tax ='';
    219                         break;
    220                 }
     226            // $a_currunt_tax_slabs = array();
     227
     228
     229       
     230        foreach ( $a_multiple_slabs as $a_multiple_slab ) {
     231
     232            // if( $a_multiple_slab != '0%' && ! in_array( $a_multiple_slab, $a_currunt_tax_slabs ) ){
     233                $slab_name = preg_replace('/%/', '', $a_multiple_slab);
     234                $state_tax ='';
     235               
     236                $state_tax = $slab_name / 2;
    221237
    222238                $state = get_option( 'woocommerce_store_state' );
     239                $ut_state = array('CH','AN','DN','DD', 'LD');
    223240                if( isset( $state ) ) :
    224                     $wpdb->insert($table_prefix,array( 'tax_rate_country' => 'IN', 'tax_rate_state' => $state,'tax_rate' => $state_tax,'tax_rate_name' => $state_tax."% CGST",'tax_rate_priority' => 1,'tax_rate_compound' => 0,'tax_rate_shipping' => 0,'tax_rate_order' => 0,'tax_rate_class' =>$slab_name),array( '%s','%s','%s','%s','%d','%d','%d','%d','%s'));
    225 
    226                     $wpdb->insert($table_prefix,array( 'tax_rate_country' => 'IN', 'tax_rate_state' => $state,'tax_rate' => $state_tax,'tax_rate_name' => $state_tax."% SGST",'tax_rate_priority' => 2,'tax_rate_compound' => 0,'tax_rate_shipping' => 0,'tax_rate_order' => 0,'tax_rate_class' =>$slab_name),array( '%s','%s','%s','%s','%d','%d','%d','%d','%s'));
    227 
    228                     $wpdb->insert($table_prefix,array( 'tax_rate_country' => 'IN', 'tax_rate_state' => '','tax_rate' => $slab_name,'tax_rate_name' => $slab_name."% IGST",'tax_rate_priority' => 1,'tax_rate_compound' => 0,'tax_rate_shipping' => 0,'tax_rate_order' => 0,'tax_rate_class' =>$slab_name),array( '%s','%s','%s','%s','%d','%d','%d','%d','%s'));
     241
     242                    $tax_slab_row_cgst = $state_tax."% CGST";
     243                    $tax_slab_row_utgst = $state_tax."% UTGST";
     244                    $tax_slab_row_sgst = $state_tax."% SGST";
     245                    $tax_slab_row_igst = $slab_name."% IGST";
     246
     247                    $table_tax_prefix = $wpdb->prefix . "woocommerce_tax_rates";
     248
     249                    $select_table_tax_cgst = $wpdb->get_var("SELECT tax_rate_id FROM $table_tax_prefix WHERE tax_rate_name='$tax_slab_row_cgst'");
     250
     251                    $select_table_tax_utgst = $wpdb->get_var("SELECT tax_rate_id FROM $table_tax_prefix WHERE tax_rate_name='$tax_slab_row_utgst'");
     252
     253                    $select_table_tax_sgst = $wpdb->get_var("SELECT tax_rate_id FROM $table_tax_prefix WHERE tax_rate_name='$tax_slab_row_sgst'");
     254
     255                    $select_table_tax_igst = $wpdb->get_var("SELECT tax_rate_id FROM $table_tax_prefix WHERE tax_rate_name='$tax_slab_row_igst'");
     256
     257                   
     258
     259                    if( ($select_table_tax_cgst == NULL || empty($select_table_tax_cgst)) ){
     260                        $wpdb->insert($table_prefix,array( 'tax_rate_country' => 'IN', 'tax_rate_state' => $state,'tax_rate' => $state_tax,'tax_rate_name' => $state_tax."% CGST",'tax_rate_priority' => 1,'tax_rate_compound' => 0,'tax_rate_shipping' => 0,'tax_rate_order' => 0,'tax_rate_class' =>$slab_name),array( '%s','%s','%s','%s','%d','%d','%d','%d','%s'));
     261                    }
     262
     263                    if(in_array($state, $ut_state)){
     264
     265                        if( ($select_table_tax_utgst == NULL || empty($select_table_tax_utgst)) ){
     266                            $wpdb->insert($table_prefix,array( 'tax_rate_country' => 'IN', 'tax_rate_state' => $state,'tax_rate' => $state_tax,'tax_rate_name' => $state_tax."% UTGST",'tax_rate_priority' => 2,'tax_rate_compound' => 0,'tax_rate_shipping' => 0,'tax_rate_order' => 0,'tax_rate_class' =>$slab_name),array( '%s','%s','%s','%s','%d','%d','%d','%d','%s'));
     267                        }   
     268                    } else {
     269                        if( ($select_table_tax_sgst == NULL || empty($select_table_tax_sgst)) ){
     270                            $wpdb->insert($table_prefix,array( 'tax_rate_country' => 'IN', 'tax_rate_state' => $state,'tax_rate' => $state_tax,'tax_rate_name' => $state_tax."% SGST",'tax_rate_priority' => 2,'tax_rate_compound' => 0,'tax_rate_shipping' => 0,'tax_rate_order' => 0,'tax_rate_class' =>$slab_name),array( '%s','%s','%s','%s','%d','%d','%d','%d','%s'));
     271                        }   
     272
     273                    }
     274                   
     275                    if( ($select_table_tax_igst == NULL || empty($select_table_tax_igst)) ){
     276                        $wpdb->insert($table_prefix,array( 'tax_rate_country' => 'IN', 'tax_rate_state' => '','tax_rate' => $slab_name,'tax_rate_name' => $slab_name."% IGST",'tax_rate_priority' => 1,'tax_rate_compound' => 0,'tax_rate_shipping' => 0,'tax_rate_order' => 0,'tax_rate_class' =>$slab_name),array( '%s','%s','%s','%s','%d','%d','%d','%d','%s'));
     277                    }   
    229278                endif;
    230             }
    231         }
     279            // }
     280        }
    232281       
    233282    }
     
    240289    public static function fn_get_settings() {
    241290
    242         $location = wc_get_base_location();
    243         $state = esc_attr( $location['state'] );
    244 
    245         $settings = array(
    246             'section_title' => array(
    247                 'name'     => __( 'Select Product Type', 'woocommerce' ),
    248                 'type'     => 'title',
    249                 'desc'     => '',
    250                 'id'       => 'wc_settings_gst_tab_section_title'
    251             ),
    252             'GSTIN_number' => array(
    253 
    254                 'name'    => __( 'GSTIN Number', 'woocommerce' ),
    255 
    256                 'desc'    => __( 'This GSTIN number display on your invoice.', 'woocommerce' ),
    257 
    258                 'id'      => 'woocommerce_gstin_number',
    259 
    260                 'css'     => 'min-width:150px;',
    261 
    262                 'std'     => 'left', // WooCommerce < 2.0
    263 
    264                 'default' => '', // WooCommerce >= 2.0
     291        $state = get_option( 'woocommerce_store_state' );
     292        $settings = array(
     293            'section_title' => array(
     294                'name'     => __( 'Select Product Type', 'woocommerce' ),
     295                'type'     => 'title',
     296                'desc'     => '',
     297                'id'       => 'wc_settings_gst_tab_section_title'
     298            ),
     299            'GSTIN_number' => array(
     300
     301                'name'    => __( 'GSTIN Number', 'woocommerce' ),
     302
     303                'desc'    => __( 'This GSTIN number display on your invoice.', 'woocommerce' ),
     304
     305                'id'      => 'woocommerce_gstin_number',
     306
     307                'css'     => 'min-width:150px;',
     308
     309                'std'     => 'left', // WooCommerce < 2.0
     310
     311                'default' => '', // WooCommerce >= 2.0
    265312
    266313                'custom_attributes' => array( 'required' => 'required' ),
    267314
    268                 'type'    => 'text',
    269 
    270             ),
     315                'type'    => 'text',
     316
     317            ),
    271318            'store_state' => array(
    272319
     
    284331
    285332                'custom_attributes' => array( 'required' => 'required' ),
     333
     334                'custom_attributes' => array('readonly' => 'readonly'),
    286335               
    287336                'type'    => 'text',
     
    290339            'prod_types' => array(
    291340
    292                 'name'    => __( 'Select Product Types', 'woocommerce' ),
    293 
    294                 'desc'    => __( 'Select single or multiple tax slab.', 'woocommerce' ),
    295 
    296                 'id'      => 'woocommerce_product_types',
    297 
    298                 'css'     => 'min-width:150px;height:auto;',
    299 
    300                     'std'     => 'left', // WooCommerce < 2.0
    301 
    302                     'default' => 'left', // WooCommerce >= 2.0
    303 
    304                     'type'    => 'select',
    305 
    306                     'options' => array(
    307 
    308                         'single'        => __( 'Single', 'woocommerce' ),
    309 
    310                         'multiple'       => __( 'Multiple', 'woocommerce' ),
    311 
    312                     ),
    313 
    314                     'desc_tip' =>  true,
    315 
    316                 ),
     341                'name'    => __( 'Select Product Types', 'woocommerce' ),
     342
     343                'desc'    => __( 'Select single or multiple tax slab.', 'woocommerce' ),
     344
     345                'id'      => 'woocommerce_product_types',
     346
     347                'css'     => 'min-width:150px;height:auto;',
     348
     349                    'std'     => 'left', // WooCommerce < 2.0
     350
     351                    'default' => 'left', // WooCommerce >= 2.0
     352
     353                    'type'    => 'select',
     354
     355                    'options' => array(
     356
     357                        'single'        => __( 'Single', 'woocommerce' ),
     358
     359                        'multiple'       => __( 'Multiple', 'woocommerce' ),
     360
     361                    ),
     362
     363                    'desc_tip' =>  true,
     364
     365                ),
    317366            'woocommerce_gst_multi_select_slab' => array(
    318367
    319                 'name'    => __( 'Select Multiple Tax Slabs ', 'woocommerce' ),
    320 
    321                 'desc'    => __( 'Multiple tax slabs.', 'woocommerce' ),
    322 
    323                 'id'      => 'woocommerce_gst_multi_select_slab',
    324 
    325                 'css'     => 'min-width:150px;',
    326 
    327                 'std'     => 'left', // WooCommerce < 2.0
    328 
    329                 'default' => 'left', // WooCommerce >= 2.0
    330 
    331                 'type'    => 'multi_select_countries',
    332 
    333                 'options' => array(
    334 
    335                     '0%'  => __( '0%', 'woocommerce' ),
    336 
    337                     '5%'  => __( '5%', 'woocommerce' ),
    338 
    339                     '12%' => __( '12%', 'woocommerce' ),
    340 
    341                     '18%' => __( '18%', 'woocommerce' ),
    342 
    343                     '28%' => __( '28%', 'woocommerce' ),
    344 
    345                 ),
    346 
    347                 'desc_tip' =>  true,
    348 
    349             ),
     368                'name'    => __( 'Select Multiple Tax Slabs ', 'woocommerce' ),
     369
     370                'desc'    => __( 'Multiple tax slabs.', 'woocommerce' ),
     371
     372                'id'      => 'woocommerce_gst_multi_select_slab',
     373
     374                'css'     => 'min-width:150px;',
     375
     376                'std'     => 'left', // WooCommerce < 2.0
     377
     378                'default' => 'left', // WooCommerce >= 2.0
     379
     380                'type'    => 'multi_select_countries',
     381
     382                'options' => array(
     383
     384                    '0%'  => __( '0%', 'woocommerce' ),
     385
     386                    '5%'  => __( '5%', 'woocommerce' ),
     387
     388                    '12%' => __( '12%', 'woocommerce' ),
     389
     390                    '18%' => __( '18%', 'woocommerce' ),
     391
     392                    '28%' => __( '28%', 'woocommerce' ),
     393
     394                ),
     395
     396                'desc_tip' =>  true,
     397
     398            ),
    350399
    351400            'woocommerce_gst_single_select_slab' => array(
    352401
    353                 'name'    => __( 'Select Tax Slab', 'woocommerce' ),
    354 
    355                 'desc'    => __( 'Tax slab.', 'woocommerce' ),
    356 
    357                 'id'      => 'woocommerce_gst_single_select_slab',
    358 
    359                 'css'     => 'min-width:150px;height:auto;',
    360 
    361                 'std'     => 'left', // WooCommerce < 2.0
    362 
    363                 'default' => 'left', // WooCommerce >= 2.0
    364 
    365                 'type'    => 'select',
    366 
    367                 'options' => array(
    368 
    369                     '0%'  => __( '0%', 'woocommerce' ),
    370 
    371                     '5%'  => __( '5%', 'woocommerce' ),
    372 
    373                     '12%' => __( '12%', 'woocommerce' ),
    374 
    375                     '18%' => __( '18%', 'woocommerce' ),
    376 
    377                     '28%' => __( '28%', 'woocommerce' ),
    378 
    379                 ),
    380 
    381                 'desc_tip' =>  true,
    382 
    383             ),
     402                'name'    => __( 'Select Tax Slab', 'woocommerce' ),
     403
     404                'desc'    => __( 'Tax slab.', 'woocommerce' ),
     405
     406                'id'      => 'woocommerce_gst_single_select_slab',
     407
     408                'css'     => 'min-width:150px;height:auto;',
     409
     410                'std'     => 'left', // WooCommerce < 2.0
     411
     412                'default' => 'left', // WooCommerce >= 2.0
     413
     414                'type'    => 'select',
     415
     416                'options' => array(
     417
     418                    '0%'  => __( '0%', 'woocommerce' ),
     419
     420                    '5%'  => __( '5%', 'woocommerce' ),
     421
     422                    '12%' => __( '12%', 'woocommerce' ),
     423
     424                    '18%' => __( '18%', 'woocommerce' ),
     425
     426                    '28%' => __( '28%', 'woocommerce' ),
     427
     428                ),
     429
     430                'desc_tip' =>  true,
     431
     432            ),
     433
     434            'gst_nonce' => array(
     435
     436                'name'    => __( 'GST nonce', 'woocommerce' ),
     437
     438                'desc'    => __( 'GST nonce.', 'woocommerce' ),
     439
     440                'id'      => 'woocommerce_gst_nonce',
     441
     442                'css'     => 'min-width:150px;',
     443
     444                'std'     => 'left', // WooCommerce < 2.0
     445
     446                'default' => wp_nonce_field( 'wc_gst_nonce', 'custom_gst_nonce' ), // WooCommerce >= 2.0
     447               
     448                'type'    => 'hidden',
     449
     450            ),
    384451
    385452
    386453
    387454            'section_end' => array(
    388                 'type' => 'sectionend',
    389                 'id' => 'wc_settings_gst_tab_section_end'
     455                'type' => 'sectionend',
     456                'id' => 'wc_settings_gst_tab_section_end'
    390457            )
    391458        );
    392         return apply_filters( 'wc_settings_gst_tab_settings', $settings );
     459        return apply_filters( 'wc_settings_gst_tab_settings', $settings );
    393460    }
    394461
  • woo-gst/trunk/inc/functions.php

    r1786309 r2444165  
    2626    }
    2727}
     28
     29if ( ! function_exists( 'woogst_get_woo_version_number' ) ) {
     30    function woogst_get_woo_version_number() {
     31            // If get_plugins() isn't available, require it
     32        if ( ! function_exists( 'get_plugins' ) )
     33            require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
     34       
     35            // Create the plugins folder and file variables
     36        $plugin_folder = get_plugins( '/' . 'woocommerce' );
     37        $plugin_file = 'woocommerce.php';
     38       
     39        // If the plugin version number is set, return it
     40        if ( isset( $plugin_folder[$plugin_file]['Version'] ) ) {
     41            return $plugin_folder[$plugin_file]['Version'];
     42
     43        } else {
     44        // Otherwise return null
     45            return NULL;
     46        }
     47    }
     48}
     49
    2850?>
  • woo-gst/trunk/readme.txt

    r2091510 r2444165  
    33Tags: gst, woocommerce, addon, woocommerce addon, gst tax, woocommerce tax, indian gst tax,hsn, hsn code, hsn code woocommerce, pdf, invoice, pdf invoice, gst invoice, gst pdf invoice 
    44Requires at least: 4.0
    5 Requires PHP : 5.5
    6 Tested up to: 5.2
    7 Stable tag: 1.2
     5Requires PHP : 5.6
     6Tested up to: 5.6
     7Stable tag: 1.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2222* Admin can choose required tax slabs.
    2323* Generates tax slabs with CGST, SGST and IGST automatically.
     24* Added UTGST(Union Territory Goods and Service Tax.) support.
    2425* Dynamic tax slabs (**PRO**).
    2526* PDF invoice with GSTIN and HSN Number (**PRO**).
     
    5051
    5152== Changelog ==
     53= 1.3 =
     54* Fixed Auto create Tax Slabs issue.
     55* Added UTGST support for five Union Territories of India.
     56
    5257= 1.2 =
    5358* Fixed minor bugs.
     
    5964
    6065== Upgrade Notice ==
     66= 1.3 =
     67* Fixed Auto create Tax Slabs issue.
     68* Added UTGST support for five Union Territories of India.
    6169
    6270= 1.2 =
  • woo-gst/trunk/woocommerce-gst-addon.php

    r2091510 r2444165  
    55 * Author: Stark Digital
    66 * Author URI: https://www.starkdigital.net
    7  * Version: 1.2
     7 * Version: 1.3
    88 * Plugin URI: https://www.woocommercegst.co.in
    99 * WC requires at least: 3.0.0
    10  * WC tested up to: 3.6.3
     10 * WC tested up to: 4.8.0
    1111 */
    1212
Note: See TracChangeset for help on using the changeset viewer.