diff --git a/src/Resources/contao/classes/RealEstateCronImporter.php b/src/Resources/contao/classes/RealEstateCronImporter.php index c360d1b1..a55c8c28 100644 --- a/src/Resources/contao/classes/RealEstateCronImporter.php +++ b/src/Resources/contao/classes/RealEstateCronImporter.php @@ -57,7 +57,7 @@ public function run() if ($minDiff - intval($objInterface->autoSync) >= 0) { - $this->sync(); + $this->sync($objInterface->current()); } } } @@ -65,8 +65,10 @@ public function run() /** * Synchronize an interface + * + * @param InterfaceModel $objInterface */ - protected function sync() + protected function sync($objInterface) { // HOOK: add custom logic if (isset($GLOBALS['TL_HOOKS']['realEstateImportBeforeCronSync']) && \is_array($GLOBALS['TL_HOOKS']['realEstateImportBeforeCronSync'])) @@ -93,7 +95,7 @@ protected function sync() // ToDo: Use array_filter to remove duplicate files (may its possible if file is not completely transferred) - $files = array_slice(array_reverse($files), 0, 10); + $files = array_slice(array_reverse($files), 0, $objInterface->filesPerSync); foreach ($files as $file) { diff --git a/src/Resources/contao/dca/tl_interface.php b/src/Resources/contao/dca/tl_interface.php index bec4f654..22198247 100644 --- a/src/Resources/contao/dca/tl_interface.php +++ b/src/Resources/contao/dca/tl_interface.php @@ -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', + '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', ), // Subpalettes @@ -352,6 +352,14 @@ 'options_callback' => array('tl_interface', 'getDeleteFilesOlderThenOptions'), 'sql' => "int(10) unsigned NOT NULL default '0'" ), + 'filesPerSync' => array + ( + 'label' => &$GLOBALS['TL_LANG']['tl_interface']['filesPerSync'], + 'exclude' => true, + 'inputType' => 'text', + 'eval' => array('maxlength'=>2, 'rgxp'=>'natural', 'tl_class'=>'w50'), + 'sql' => "smallint(2) unsigned NOT NULL default '10'" + ), ) ); diff --git a/src/Resources/contao/languages/en/tl_interface.xlf b/src/Resources/contao/languages/en/tl_interface.xlf index accb6f93..86574885 100644 --- a/src/Resources/contao/languages/en/tl_interface.xlf +++ b/src/Resources/contao/languages/en/tl_interface.xlf @@ -128,6 +128,12 @@ Here you can synchronize real estate + + Max. files per sync + + + Here you can specify the maximum number of files to be synchronized during an automatic import. + OpenImmo