diff --git a/composer.json b/composer.json index 033867b..0f1fc59 100644 --- a/composer.json +++ b/composer.json @@ -44,6 +44,9 @@ ] }, "extra":{ + "branch-alias": { + "dev-main": "1.0.x-dev" + }, "contao-manager-plugin": "ContaoEstateManager\\WibImport\\ContaoManager\\Plugin" } } diff --git a/src/Resources/contao/classes/WibImport.php b/src/Resources/contao/classes/WibImport.php index 76404ff..f9c94e4 100644 --- a/src/Resources/contao/classes/WibImport.php +++ b/src/Resources/contao/classes/WibImport.php @@ -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); diff --git a/src/Resources/contao/config/config.php b/src/Resources/contao/config/config.php index c36adfd..9aa8204 100644 --- a/src/Resources/contao/config/config.php +++ b/src/Resources/contao/config/config.php @@ -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'); }