From b3763cd82250328986b7bb199ccfbce96ffca99f Mon Sep 17 00:00:00 2001 From: doishub Date: Tue, 5 May 2020 15:20:55 +0200 Subject: [PATCH 1/4] Clean up files --- src/Resources/contao/classes/AddonManager.php | 6 ++++-- src/Resources/contao/classes/WibImport.php | 11 +++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Resources/contao/classes/AddonManager.php b/src/Resources/contao/classes/AddonManager.php index 8173438..5dbaa61 100644 --- a/src/Resources/contao/classes/AddonManager.php +++ b/src/Resources/contao/classes/AddonManager.php @@ -10,6 +10,8 @@ namespace ContaoEstateManager\WibImport; +use Contao\Config; +use Contao\Environment; use ContaoEstateManager\EstateManager; class AddonManager @@ -101,14 +103,14 @@ public static function getLicenses() public static function valid() { - if(strpos(\Environment::get('requestUri'), '/contao/install') !== false) + if(strpos(Environment::get('requestUri'), '/contao/install') !== false) { return true; } if (static::$initialized === false) { - static::$valid = EstateManager::checkLicenses(\Config::get(static::$key), static::$licenses, static::$key); + static::$valid = EstateManager::checkLicenses(Config::get(static::$key), static::$licenses, static::$key); static::$initialized = true; } diff --git a/src/Resources/contao/classes/WibImport.php b/src/Resources/contao/classes/WibImport.php index 68babce..e0450bb 100644 --- a/src/Resources/contao/classes/WibImport.php +++ b/src/Resources/contao/classes/WibImport.php @@ -11,6 +11,9 @@ namespace ContaoEstateManager\WibImport; +use Contao\File; +use Contao\FilesModel; +use Contao\Input; use ContaoEstateManager\FilesHelper; /** @@ -29,7 +32,7 @@ public function manuallyDownloadOpenImmoFile($context) { if ($context->interface->type === 'wib') { - if (\Input::get('downloadWibXml')) + if (Input::get('downloadWibXml')) { $this->downloadOpenImmoFile($context); } @@ -55,7 +58,7 @@ public function downloadOpenImmoFile($context) if (strpos($content, 'uebertragung') !== false) { - \File::putContent($context->importFolder->path . '/' . $fileName, $content); + File::putContent($context->importFolder->path . '/' . $fileName, $content); $objInterface->lastSync = $syncTime; $objInterface->save(); @@ -147,7 +150,7 @@ public function downloadImage($objFilesFolder, &$value, $tmpGroup, &$values, &$s $completeFileName = $fileName . $extension; - $existingFile = \FilesModel::findByPath($objFilesFolder->path . '/' . $context->uniqueProviderValue . '/' . $context->uniqueValue . '/' . $completeFileName); + $existingFile = FilesModel::findByPath($objFilesFolder->path . '/' . $context->uniqueProviderValue . '/' . $context->uniqueValue . '/' . $completeFileName); if ($existingFile !== null && $existingFile->hash === $check) { @@ -222,7 +225,7 @@ protected function downloadFile($path, $targetDirectory, $fileName, $tmpFolder=t { $content = $this->getFileContent($path); - \File::putContent($targetDirectory->path . '/' . ($tmpFolder ? 'tmp/' : '') . $fileName, $content); + File::putContent($targetDirectory->path . '/' . ($tmpFolder ? 'tmp/' : '') . $fileName, $content); } protected function getFileContent($path) From ce76a10fe9abfbd970aa0289cd2140ca050c2951 Mon Sep 17 00:00:00 2001 From: doishub Date: Tue, 5 May 2020 15:32:11 +0200 Subject: [PATCH 2/4] Update composer --- composer.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index d75b8b1..944aff6 100644 --- a/composer.json +++ b/composer.json @@ -7,8 +7,13 @@ "license":"proprietary", "authors":[ { - "name":"Oveleon", - "homepage":"https://www.oveleon.de/", + "name":"Daniele Sciannimanica", + "homepage":"https://github.com/doishub", + "role":"Developer" + }, + { + "name":"Fabian Ekert", + "homepage":"https://github.com/eki89", "role":"Developer" } ], From 2f874da69e2375bcc552e5e00057e525ef9dcf57 Mon Sep 17 00:00:00 2001 From: eki89 Date: Tue, 19 May 2020 12:56:01 +0200 Subject: [PATCH 3/4] Code cleanup --- src/Resources/contao/classes/WibImport.php | 12 ++++++------ src/Resources/contao/config/config.php | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Resources/contao/classes/WibImport.php b/src/Resources/contao/classes/WibImport.php index e0450bb..c241f1b 100644 --- a/src/Resources/contao/classes/WibImport.php +++ b/src/Resources/contao/classes/WibImport.php @@ -28,7 +28,7 @@ class WibImport * * @param $context */ - public function manuallyDownloadOpenImmoFile($context) + public function manuallyDownloadOpenImmoFile($context): void { if ($context->interface->type === 'wib') { @@ -46,7 +46,7 @@ public function manuallyDownloadOpenImmoFile($context) * * @param $context */ - public function downloadOpenImmoFile($context) + public function downloadOpenImmoFile($context): void { $objInterface = $context->interface; @@ -80,7 +80,7 @@ public function downloadOpenImmoFile($context) * @param $skip * @param $context */ - public function skipPartnerRecord($realEstate, &$re, &$contactPerson, &$skip, $context) + public function skipPartnerRecord($realEstate, &$re, &$contactPerson, &$skip, $context): void { if ($context->interface->type === 'wib') { @@ -104,7 +104,7 @@ public function skipPartnerRecord($realEstate, &$re, &$contactPerson, &$skip, $c * * @return string */ - protected function getWibAuftragsart($realEstate, $context) + protected function getWibAuftragsart($realEstate, $context): string { $groups = $realEstate->xpath('verwaltung_objekt'); @@ -130,7 +130,7 @@ protected function getWibAuftragsart($realEstate, $context) return ''; } - public function downloadImage($objFilesFolder, &$value, $tmpGroup, &$values, &$skip, $context) + public function downloadImage($objFilesFolder, &$value, $tmpGroup, &$values, &$skip, $context): void { if ($context->interface->type === 'wib') { @@ -221,7 +221,7 @@ protected function getExtension($format) return $extension; } - protected function downloadFile($path, $targetDirectory, $fileName, $tmpFolder=true) + protected function downloadFile($path, $targetDirectory, $fileName, $tmpFolder=true): void { $content = $this->getFileContent($path); diff --git a/src/Resources/contao/config/config.php b/src/Resources/contao/config/config.php index 12d110d..1083400 100644 --- a/src/Resources/contao/config/config.php +++ b/src/Resources/contao/config/config.php @@ -9,12 +9,12 @@ */ // ESTATEMANAGER -$GLOBALS['TL_ESTATEMANAGER_ADDONS'][] = array('ContaoEstateManager\\WibImport', 'AddonManager'); +$GLOBALS['TL_ESTATEMANAGER_ADDONS'][] = array('ContaoEstateManager\WibImport', 'AddonManager'); if(ContaoEstateManager\WibImport\AddonManager::valid()) { // HOOKS - $GLOBALS['TL_HOOKS']['realEstateImportBeforeSync'][] = array('ContaoEstateManager\\WibImport\\WibImport', 'manuallyDownloadOpenImmoFile'); - $GLOBALS['TL_HOOKS']['realEstateImportBeforeCronSync'][] = array('ContaoEstateManager\\WibImport\\WibImport', 'downloadOpenImmoFile'); - $GLOBALS['TL_HOOKS']['realEstateImportPrePrepareRecord'][] = array('ContaoEstateManager\\WibImport\\WibImport', 'skipPartnerRecord'); - $GLOBALS['TL_HOOKS']['realEstateImportSaveImage'][] = array('ContaoEstateManager\\WibImport\\WibImport', 'downloadImage'); + $GLOBALS['TL_HOOKS']['realEstateImportBeforeSync'][] = array('ContaoEstateManager\WibImport\WibImport', 'manuallyDownloadOpenImmoFile'); + $GLOBALS['TL_HOOKS']['realEstateImportBeforeCronSync'][] = array('ContaoEstateManager\WibImport\WibImport', 'downloadOpenImmoFile'); + $GLOBALS['TL_HOOKS']['realEstateImportPrePrepareRecord'][] = array('ContaoEstateManager\WibImport\WibImport', 'skipPartnerRecord'); + $GLOBALS['TL_HOOKS']['realEstateImportSaveImage'][] = array('ContaoEstateManager\WibImport\WibImport', 'downloadImage'); } From 1f73ca8e76c80b2a75bfae453cf3710665d8884b Mon Sep 17 00:00:00 2001 From: doishub Date: Mon, 8 Jun 2020 11:36:08 +0200 Subject: [PATCH 4/4] Update composer Update readme --- README.md | 3 ++- composer.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5b0f876..f5c28d3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # WIB-Import Extension for Contao EstateManager - +The WIB import extension provides a new interface for importing real estate of the "Westdeutsche Immobilienbörse" for the Contao EstateManager. + # License Copyright (c) 2019 Contao EstateManager diff --git a/composer.json b/composer.json index 944aff6..9ed88b2 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "require":{ "php":">=7.1", "contao/core-bundle":"^4.4", - "contao-estatemanager/core": "*" + "contao-estatemanager/core": "^1.0" }, "require-dev": { "contao/manager-plugin": "^2.0"