Skip to content

Commit

Permalink
Merge pull request #17 from lopes-vincent/master
Browse files Browse the repository at this point in the history
Fix when purchase price is null
  • Loading branch information
lopes-vincent authored Dec 20, 2019
2 parents 69c0718 + e426b87 commit a56d3b5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Config/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<descriptive locale="fr_FR">
<title>Famille de clients et prix d'achat</title>
</descriptive>
<version>1.5.1</version>
<version>1.5.2</version>
<author>
<name>Guillaume Barral / Etienne Perriere</name>
<email>gbarral@openstudio.fr / eperriere@openstudio.fr</email>
Expand Down
4 changes: 4 additions & 0 deletions LoopExtend/BaseCustomerFamilyLoopExtend.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ public function getCustomerFamily()
{
$currentCustomer = $this->securityContext->getCustomerUser();

if (null === $currentCustomer) {
return null;
}

$customerFamily = CustomerFamilyQuery::create()
->useCustomerCustomerFamilyQuery()
->filterByCustomerId($currentCustomer->getId())
Expand Down
6 changes: 3 additions & 3 deletions Service/CustomerFamilyService.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ public function getPseProductPrice($pseId, $currencyId)
public function getPurchasePrice($pseId, $currencyId)
{
$mode = CustomerFamily::getConfigValue('customer_family_price_mode', 0);
if($mode == 1){
if ($mode == 1) {
$pseProductPrice = $this->getPseProductPrice($pseId, $currencyId);
return $pseProductPrice->getPrice();
return $pseProductPrice !== null ? $pseProductPrice->getPrice() : null;
}
$pseProductPurchasePrice = $this->getPseProductPurchasePrice($pseId, $currencyId);
return $pseProductPurchasePrice->getPurchasePrice();
return $pseProductPurchasePrice !== null ? $pseProductPurchasePrice->getPurchasePrice() : null;
}

/**
Expand Down

0 comments on commit a56d3b5

Please sign in to comment.