Skip to content

Commit

Permalink
Bugfix: Possibility added to remove XML namespaces from openimmo XML.
Browse files Browse the repository at this point in the history
  • Loading branch information
zoglo authored and eki89 committed Nov 30, 2022
1 parent efe29cb commit 7c4590e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 9 deletions.
18 changes: 10 additions & 8 deletions src/Resources/contao/classes/RealEstateImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -872,14 +872,16 @@ protected function loadData()
{
$data = file_get_contents($this->strRootDir . '/' . $this->syncFile);

/* FlowFact
$data = str_replace('<imo:', '<', $data);
$data = str_replace('</imo:', '</', $data);
$oi_open_pos = strpos($data, '<openimmo');
$oi_close_pos = strpos(substr($data, $oi_open_pos), '>');
$data = substr($data, 0, $oi_open_pos) . '<openimmo>' . substr($data, $oi_close_pos + $oi_open_pos + 1);
*/
// Remove XML namespaces
if ($this->objInterface->removeXmlNamespaces)
{
$data = str_replace('<imo:', '<', $data);
$data = str_replace('</imo:', '</', $data);

$oi_open_pos = strpos($data, '<openimmo');
$oi_close_pos = strpos(substr($data, $oi_open_pos), '>');
$data = substr($data, 0, $oi_open_pos) . '<openimmo>' . substr($data, $oi_close_pos + $oi_open_pos + 1);
}

try {
$this->data = simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NOCDATA);
Expand Down
10 changes: 9 additions & 1 deletion src/Resources/contao/dca/tl_interface.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
(
'__selector__' => array('type', 'importThirdPartyRecords'),
'default' => '{title_legend},title,type',
'openimmo' => '{title_legend},title,type;{oi_field_legend},provider,anbieternr,uniqueProviderField,uniqueField,importPath,filesPath,filesPathContactPerson;{related_records_legend},contactPersonActions,contactPersonUniqueField,importThirdPartyRecords;{expert_legend},skipRecords,dontPublishRecords;{sync_legend},autoSync,deleteFilesOlderThen,filesPerSync',
'openimmo' => '{title_legend},title,type;{oi_field_legend},provider,anbieternr,uniqueProviderField,uniqueField,importPath,filesPath,filesPathContactPerson;{related_records_legend},contactPersonActions,contactPersonUniqueField,importThirdPartyRecords;{expert_legend},skipRecords,dontPublishRecords,removeXmlNamespaces;{sync_legend},autoSync,deleteFilesOlderThen,filesPerSync',
),

// Subpalettes
Expand Down Expand Up @@ -333,6 +333,14 @@
'eval' => array('tl_class'=>'w50'),
'sql' => "char(1) NOT NULL default ''"
),
'removeXmlNamespaces' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_interface']['removeXmlNamespaces'],
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array('tl_class'=>'w50'),
'sql' => "char(1) NOT NULL default ''"
),
'autoSync' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_interface']['autoSync'],
Expand Down
8 changes: 8 additions & 0 deletions src/Resources/contao/languages/de/tl_interface.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@
<source>Here you can specify whether real estate records should be initially published on create.</source>
<target>Hier können Sie angeben, ob Immobiliendatensätze beim Anlegen initial veröffentlicht werden sollen.</target>
</trans-unit>
<trans-unit id="tl_interface.removeXmlNamespaces.0">
<source>Remove XML namespaces</source>
<target>XML-Namespaces entfernen</target>
</trans-unit>
<trans-unit id="tl_interface.removeXmlNamespaces.1">
<source>Here you can specify whether XML namespaces should be removed from the OpenImmo-XML.</source>
<target>Hier kannst du angeben, ob XML-Namespaces aus der OpenImmo-XML entfernt werden sollen.</target>
</trans-unit>
<trans-unit id="tl_interface.autoSync.0">
<source>Automatic synchronization</source>
<target>Automatische Synchronisierung</target>
Expand Down
6 changes: 6 additions & 0 deletions src/Resources/contao/languages/en/tl_interface.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@
<trans-unit id="tl_interface.dontPublishRecords.1">
<source>Here you can specify whether real estate records should be initially published on create.</source>
</trans-unit>
<trans-unit id="tl_interface.removeXmlNamespaces.0">
<source>Remove XML namespaces</source>
</trans-unit>
<trans-unit id="tl_interface.removeXmlNamespaces.1">
<source>Here you can specify whether XML namespaces should be removed from the OpenImmo-XML.</source>
</trans-unit>
<trans-unit id="tl_interface.autoSync.0">
<source>Automatic synchronization</source>
</trans-unit>
Expand Down

0 comments on commit 7c4590e

Please sign in to comment.