Plugin Directory

Changeset 3285646


Ignore:
Timestamp:
05/01/2025 01:57:31 PM (11 months ago)
Author:
openstream
Message:

The option has been added to select whether the prices transferred to Run My Accounts include VAT or not.

Location:
run-my-accounts-for-woocommerce
Files:
26 added
4 edited

Legend:

Unmodified
Added
Removed
  • run-my-accounts-for-woocommerce/trunk/classes/class-RMA_WC_API.php

    r3267740 r3285646  
    490490            $order_payment_method = $order->get_payment_method();
    491491
    492             // if order is done without user account
     492            $option_billing       = get_option( 'wc_rma_settings' );
     493
     494            // transfer price net
     495            if( isset( $option_billing[ 'rma-tax-transfer' ] ) && 'net' == $option_billing[ 'rma-tax-transfer' ] ) {
     496                $tax_included = 'false';
     497            }
     498            // transfer price gross
     499            elseif( isset( $option_billing[ 'rma-tax-transfer' ] ) && 'gross' == $option_billing[ 'rma-tax-transfer' ] ) {
     500                $tax_included = 'true';
     501            }
     502            // get the settings from WooCommerce
     503            else {
     504                $tax_included = $order->get_prices_include_tax() ? 'true' : 'false';
     505            }
     506
     507            // if the order is done without a user account
    493508            if ( 0 == $order->get_meta( '_customer_user', true ) ) {
    494509
     
    499514                    $rma_customer_id = (new RMA_WC_API)->create_rma_customer('order', $order_id );
    500515
    501                     if ( false == $rma_customer_id ) {
     516                    if ( ! $rma_customer_id) {
    502517
    503518                        $log_values = array(
     
    517532
    518533                    // customer id is equal to predefined catch all guest account
    519                     $rma_customer_id         = $settings['rma-guest-catch-all'];
    520 
    521                 }
    522 
    523             }
    524             // ...or with user account
     534                    $rma_customer_id = $settings[ 'rma-guest-catch-all' ];
     535
     536                }
     537
     538            }
     539            // ...or with a user account
    525540            else {
    526541
    527                 $rma_customer_id             = get_user_meta( $order->get_customer_id(), 'rma_customer', true );
     542                $rma_customer_id = get_user_meta( $order->get_customer_id(), 'rma_customer', true );
    528543
    529544            }
     
    532547            $order_details[ 'currency' ]       = $order->get_currency();
    533548            $order_details[ 'orderdate' ]      = wc_format_datetime( $order->get_date_created(),'d.m.Y' );
    534             $order_details[ 'taxincluded' ]    = $order->get_prices_include_tax() ? 'true' : 'false';
     549            $order_details[ 'taxincluded' ]    = $tax_included;
    535550            $order_details[ 'customernumber' ] = $rma_customer_id;
    536551            $order_details[ 'ar_accno' ]       = isset( $option_accounting[ $order_payment_method ] ) && !empty( $option_accounting[ $order_payment_method ] ) ? $option_accounting[ $order_payment_method ] : '';
  • run-my-accounts-for-woocommerce/trunk/classes/class-RMA_WC_Settings_Page.php

    r3262812 r3285646  
    4747
    4848            add_action( 'admin_menu', array( $this, 'add_plugin_page' ) );
     49
    4950        }
    5051
     
    374375            );
    375376
     377            $id = 'rma-tax-transfer';
     378            add_settings_field(
     379                $id,
     380                esc_html__( 'Price transfer with tax', 'run-my-accounts-for-woocommerce'),
     381                array( $this, 'option_select_cb'),
     382                $this->option_page_general,
     383                $section,
     384                array(
     385                    'option_group'    => $this->option_group_general,
     386                    'id'              => $id,
     387                    'options'         => $this->options_general,
     388                    'select_options'  => array(
     389                        ''            => esc_html__( 'WooCommerce settings','run-my-accounts-for-woocommerce') ,
     390                        'net'         => esc_html__( 'Item prices net (excl. VAT)','run-my-accounts-for-woocommerce' ),
     391                        'gross'       => esc_html__( 'Item prices gross (incl. VAT)','run-my-accounts-for-woocommerce' ),
     392                    ),
     393                    'description'     => esc_html__( 'How should the item prices be transferred in relation to VAT? The WooCommerce settings are related to WooCommerce > Settings > Tax > Tax options.', 'run-my-accounts-for-woocommerce' )
     394                )
     395            );
     396
    376397        }
    377398
     
    408429                    'class'        => 'payment-trigger',
    409430                    'description'  => esc_html__('When should the payment be booked in Run My Accounts', 'run-my-accounts-for-woocommerce' ),
    410 
    411431                )
    412432            );
     
    11081128         */
    11091129        public function option_select_cb( $args ) {
    1110             $option_group   = (isset($args['option_group'])) ? $args['option_group'] : '';
    1111             $id             = (isset($args['id'])) ? $args['id'] : '';
    1112             $options        = (isset($args['options'])) ? $args['options'] : '';
    1113             $select_options = (isset($args['select_options'])) ? $args['select_options'] : array();
    1114             $description    = (isset($args['description'])) ? $args['description'] : '';
    1115             $class          = (isset($args['class'])) ? $args['class'] : '';
    1116 
    1117             echo '<select name="' . $option_group . '[' . $id . ']"' . ( !empty( $class) ? 'id="'. $id .'" class="' . $class . '"' : '' ) . '>';
     1130            $option_group   = ( isset( $args[ 'option_group'] ) ) ? $args[ 'option_group' ] : '';
     1131            $id             = ( isset( $args[ 'id'] ) ) ? $args[ 'id' ] : '';
     1132            $options        = ( isset( $args[ 'options'] ) ) ? $args[ 'options' ] : '';
     1133            $select_options = ( isset( $args[ 'select_options'] ) ) ? $args[ 'select_options' ] : array();
     1134            $description    = ( isset( $args[ 'description'] ) ) ? $args[ 'description' ] : '';
     1135            $class          = ( isset( $args[ 'class'] ) ) ? $args[ 'class' ] : '';
     1136            $style          = ( isset( $args[ 'style'] ) ) ? $args[ 'style' ] : '';
     1137
     1138            echo '<select name="' . $option_group . '[' . $id . ']"' . ( !empty( $id) ? 'id="'. $id .'"' : '' ) . ( !empty( $class) ? ' class="' . $class . '"' : '' ) . ( !empty( $style) ? ' style="' . $style . '"' : '' ) . '>';
    11181139
    11191140            foreach ( $select_options as $value => $text ) {
  • run-my-accounts-for-woocommerce/trunk/readme.txt

    r3267740 r3285646  
    44* Requires at least: 6.2
    55* Tested up to: 6.8
    6 * Stable tag: 1.8.1
     6* Stable tag: 1.9.0
    77* Requires PHP: 7.2
    88* License: GPLv2
     
    4545== Screenshots ==
    46461. General settings.
    47 2. Settings for dedicated receivable account for each payment gateway.
    48 3. Settings on user page.
     472. Settings for a dedicated receivable account for each payment gateway.
     483. Settings on the user page.
    4949
    5050== Known issues ==
    51 * Discount codes does not be reflected on the invoice.
     51* Discount codes do not be reflected on the invoice.
    5252* Credits are not created in Run My Accounts.
    5353* The collective invoice only works with available products. If a product was deleted between the order and the invoice, the product cannot be included in the invoice anymore.
    5454
    5555== Changelog ==
     56= 1.9.0 =
     57* Added the option to select separately whether the prices transferred to Run My Accounts include VAT or not.
     58
    5659= 1.8.1 =
    5760* Added compatibility with price rules plugins
  • run-my-accounts-for-woocommerce/trunk/rma-wc.php

    r3267740 r3285646  
    1111 *
    1212 * Plugin Name:          Run my Accounts for WooCommerce
    13  * Version:              1.8.1
     13 * Version:              1.9.0
    1414 * Description:          This plug-in connects WooCommerce to <a href="https://www.runmyaccounts.ch/">Run my Accounts</a>. Create customers and invoices as soon as you get an order in your WooCommerce shop.
    1515 * Requires at least:    6.2
Note: See TracChangeset for help on using the changeset viewer.