From 1cda865a38122f7bd63ad89bb8cbc1b54f46bffb Mon Sep 17 00:00:00 2001 From: Alex Hotsaliyk Date: Fri, 25 Sep 2020 21:40:58 +0300 Subject: [PATCH] PriceListTreeHandler TypeErrors fix --- .../Model/PriceListTreeHandler.php | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/Oro/Bundle/PricingBundle/Model/PriceListTreeHandler.php b/src/Oro/Bundle/PricingBundle/Model/PriceListTreeHandler.php index dd4684318d4..988e5984f0f 100644 --- a/src/Oro/Bundle/PricingBundle/Model/PriceListTreeHandler.php +++ b/src/Oro/Bundle/PricingBundle/Model/PriceListTreeHandler.php @@ -88,15 +88,18 @@ public function getPriceList(Customer $customer = null, Website $website = null) } $priceList = null; - if ($customer) { - $priceList = $this->getPriceListByCustomer($customer, $website); - } - if (!$priceList) { - $priceList = $this->getPriceListByAnonymousCustomerGroup($website); - } - if (!$priceList) { - $priceList = $this->getPriceListRepository()->getPriceListByWebsite($website); + if ($website) { + if ($customer) { + $priceList = $this->getPriceListByCustomer($customer, $website); + } + if (!$priceList) { + $priceList = $this->getPriceListByAnonymousCustomerGroup($website); + } + if (!$priceList) { + $priceList = $this->getPriceListRepository()->getPriceListByWebsite($website); + } } + if (!$priceList) { $priceList = $this->getPriceListFromConfig(); } @@ -123,8 +126,8 @@ protected function getPriceListByCustomer(Customer $customer, Website $website) } /** - * @param Customer|null $customer - * @param Website|null $website + * @param Customer $customer + * @param Website $website * @return null|CombinedPriceList */ protected function getPriceListByCustomerGroup(Customer $customer, Website $website) @@ -139,7 +142,7 @@ protected function getPriceListByCustomerGroup(Customer $customer, Website $webs } /** - * @param Website|null $website + * @param Website $website * @return null|CombinedPriceList */ protected function getPriceListByAnonymousCustomerGroup(Website $website)