Skip to content

Commit

Permalink
Merge pull request #10 from contao-estatemanager/bugfix/emptyPrice
Browse files Browse the repository at this point in the history
Format empty price (false) on import
  • Loading branch information
zoglo authored Feb 22, 2023
2 parents ea261e1 + 0dc0755 commit 4533c0a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
]
},
"extra":{
"branch-alias": {
"dev-main": "1.0.x-dev"
},
"contao-manager-plugin": "ContaoEstateManager\\WibImport\\ContaoManager\\Plugin"
}
}
12 changes: 12 additions & 0 deletions src/Resources/contao/classes/WibImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,18 @@ public function downloadImage($objFilesFolder, &$value, $tmpGroup, &$values, &$s
}
}

/**
* Formats a non-given main price to the correct value as
* WIB does not comply with OpenImmo standard
*/
public function formatEmptyMainPrice(&$objRealEstate, $context): void
{
if (false === $objRealEstate->kaufpreis)
{
$objRealEstate->kaufpreis = null;
}
}

protected function getValueFromStringUrl($url, $parameter)
{
$parts = parse_url($url);
Expand Down
1 change: 1 addition & 0 deletions src/Resources/contao/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
$GLOBALS['TL_HOOKS']['realEstateImportBeforeCronSync'][] = array(WibImport::class, 'downloadOpenImmoFile');
$GLOBALS['TL_HOOKS']['realEstateImportPrePrepareRecord'][] = array(WibImport::class, 'skipPartnerRecord');
$GLOBALS['TL_HOOKS']['realEstateImportSaveImage'][] = array(WibImport::class, 'downloadImage');
$GLOBALS['TL_HOOKS']['beforeRealEstateImport'][] = array(WibImport::class, 'formatEmptyMainPrice');
}

0 comments on commit 4533c0a

Please sign in to comment.