-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from contao-estatemanager/develop
Delete existing third party real estate records with 'auftragsart' R,…
- Loading branch information
Showing
1 changed file
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,18 +11,30 @@ | |
namespace ContaoEstateManager\WibImport; | ||
|
||
|
||
use Contao\Database; | ||
use Contao\File; | ||
use Contao\FilesModel; | ||
use Contao\Input; | ||
use Contao\System; | ||
use ContaoEstateManager\FilesHelper; | ||
|
||
/** | ||
* Class WibImport | ||
* @package ContaoEstateManager\Project | ||
* @author Fabian Ekert <[email protected]> | ||
*/ | ||
class WibImport | ||
class WibImport extends System | ||
{ | ||
/** | ||
* Import the Config instance | ||
*/ | ||
protected function __construct() | ||
{ | ||
$this->import(Database::class, 'Database'); | ||
|
||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Download an WIB open immo file manually | ||
* | ||
|
@@ -91,6 +103,11 @@ public function skipPartnerRecord($realEstate, &$re, &$contactPerson, &$skip, $c | |
if (in_array($re['AUFTRAGSART'], array('R', 'V', 'S', 'SB', 'Z', 'G'))) | ||
{ | ||
$skip = true; | ||
|
||
$objektnrExtern = $this->getObjektnrExtern($realEstate, $context); | ||
|
||
$this->Database->prepare("DELETE FROM tl_real_estate WHERE objektnrExtern=?") | ||
->execute($objektnrExtern); | ||
} | ||
} | ||
} | ||
|
@@ -130,6 +147,21 @@ protected function getWibAuftragsart($realEstate, $context): string | |
return ''; | ||
} | ||
|
||
/** | ||
* Return field "objecktr_extern" from real estate xpath object | ||
* | ||
* @param $realEstate | ||
* @param $context | ||
* | ||
* @return string | ||
*/ | ||
protected function getObjektnrExtern($realEstate, $context): string | ||
{ | ||
$groups = $realEstate->xpath('verwaltung_techn'); | ||
|
||
return $context->getFieldData('objektnr_extern', $groups[0]); | ||
} | ||
|
||
public function downloadImage($objFilesFolder, &$value, $tmpGroup, &$values, &$skip, $context): void | ||
{ | ||
if ($context->interface->type === 'wib') | ||
|