View Issue Details

IDProjectCategoryView StatusLast Update
0007175OXID eShop (all versions)1.02. Price calculations (discounts, coupons, additional costs etc.)public2020-09-18 11:49
Reportertimwetter 
PrioritynormalSeveritymajorReproducibilityalways
Status acknowledgedResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0007175: wrong VAT calculation with delivery address
Descriptionpossible wrong VAT calculation with delivery address
Steps To Reproducein backend set blShippingCountryVat = 1
in backend set oxvatstatus for country france to 1
in backend set oxvatstatus for country USA to 0

make order in front-end with bill address in USA and shipping address in france

go in backend to the new order
go to tab 'article'
add same/other article to the order

compare the netto prices and the vat percent value

qued
Additional Informationfor solution:

add something to function
getOrderUser
in Order.php

and to function
_getVatCountry
in VatSelector.php

TagsNo tags attached.
ThemeNot defined
BrowserNot defined
PHP VersionNot defined
Database VersionNot defined

Activities

QA

2020-09-17 07:49

administrator   ~0013301

Last edited: 2020-09-17 07:50

View 2 revisions

Dear Tim Wetter,

thank you for the report.

I could reproduce it in 6.2.2. according to your steps.

If you change in backend the order it ignores the delivery-address setting, so it discards the vat.

Best Regards

QA - SG -

timwetter

2020-09-18 11:48

reporter   ~0013304

Last edited: 2020-09-18 11:49

View 2 revisions

my solution


in Order.php
---%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<---
 /**
     * Returns current order user object
     *
     * @return oxuser
     */
    public function getOrderUser()
    {
        if ($this->_oUser === null) {
            $this->_oUser = oxNew("oxuser");
            $this->_oUser->load($this->oxorder__oxuserid->value);

            // if object is loaded then reusing its order info
            if ($this->_isLoaded) {
                // bill address
                $this->_oUser->oxuser__oxcompany = clone $this->oxorder__oxbillcompany;
                $this->_oUser->oxuser__oxusername = clone $this->oxorder__oxbillemail;
                $this->_oUser->oxuser__oxfname = clone $this->oxorder__oxbillfname;
                $this->_oUser->oxuser__oxlname = clone $this->oxorder__oxbilllname;
                $this->_oUser->oxuser__oxstreet = clone $this->oxorder__oxbillstreet;
                $this->_oUser->oxuser__oxstreetnr = clone $this->oxorder__oxbillstreetnr;
                $this->_oUser->oxuser__oxaddinfo = clone $this->oxorder__oxbilladdinfo;
                $this->_oUser->oxuser__oxustid = clone $this->oxorder__oxbillustid;


                $this->_oUser->oxuser__oxcity = clone $this->oxorder__oxbillcity;
                $this->_oUser->oxuser__oxcountryid = clone $this->oxorder__oxbillcountryid;
                $this->_oUser->oxuser__oxstateid = clone $this->oxorder__oxbillstateid;
                $this->_oUser->oxuser__oxzip = clone $this->oxorder__oxbillzip;
                $this->_oUser->oxuser__oxfon = clone $this->oxorder__oxbillfon;
                $this->_oUser->oxuser__oxfax = clone $this->oxorder__oxbillfax;
                $this->_oUser->oxuser__oxsal = clone $this->oxorder__oxbillsal;


                // shipping address
                if (!empty($this->oxorder__oxdelcountryid->value)) {
                    $oAddress = oxNew('oxaddress');
                    $oAddress->setId('fakeIdFromOrder');
                    $oAddress->oxaddress__oxuserid = new oxField($this->_oUser->getId());
                    $oAddress->oxaddress__oxcompany = clone $this->oxorder__oxdelcompany;
                    $oAddress->oxaddress__oxfname = clone $this->oxorder__oxdelfname;
                    $oAddress->oxaddress__oxlname = clone $this->oxorder__oxdellname;
                    $oAddress->oxaddress__oxstreet = clone $this->oxorder__oxdelstreet;
                    $oAddress->oxaddress__oxstreetnr = clone $this->oxorder__oxdelstreetnr;
                    $oAddress->oxaddress__oxcity = clone $this->oxorder__oxdelcity;
                    $oAddress->oxaddress__oxcountryid = clone $this->oxorder__oxdelcountryid;
                    $oAddress->oxaddress__oxstateid = clone $this->oxorder__oxdelstateid;
                    $oAddress->oxaddress__oxzip = clone $this->oxorder__oxdelzip;
                    $oAddress->oxaddress__oxfon = clone $this->oxorder__oxdelfon;
                    $oAddress->oxaddress__oxfax = clone $this->oxorder__oxdelfax;
                    $oAddress->oxaddress__oxsal = clone $this->oxorder__oxdelsal;

                    $this->_oUser->addOrderDeliveryAddress($oAddress);
                }
            }
        }

        return $this->_oUser;
    }

---%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<---


in User.php

---%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<---
    public function addOrderDeliveryAddress($oAddress, $sUserId = null)
    {
        $sUserId = isset( $sUserId ) ? $sUserId : $this->getId();
        $this->getUserAddresses($sUserId);
        $this->_aAddresses[$sUserId][$oAddress->getId()] = $oAddress;
        $this->_sSelAddressId = $oAddress->getId();
    }

---%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<------%<---