Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exceptions if optional tt_address extension is not installed #117

Merged
merged 2 commits into from
Jan 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Classes/Controller/PluginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,15 @@ private function extractGroup($record_ids)
$records = [];
foreach ($record_ids as $table => $items) {
$tc = $tables[$table] ?? [];
$connection = $this->connectionPool->getConnectionForTable($table);
$connection = $this->connectionPool
->getConnectionForTable($table)
->getSchemaManager()
->tablesExist([$table]);

// table seems not available --> break to avoid exceptions
if ($connection === false) {
break;
}
foreach ($items as $item) {
$item = intval($item);

Expand Down
14 changes: 1 addition & 13 deletions Classes/Div.php
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ public static function getTableConfig($table = false)
]
];

// load configuration for tt_address only if extension is loaded
// load configuration for calendarize only if extension is loaded
if (ExtensionManagementUtility::isLoaded('calendarize')) {
$tables['tx_calendarize_domain_model_event'] = [
'FORMAT' => '%01.6f',
Expand Down Expand Up @@ -561,16 +561,4 @@ protected static function getLogger()
return $loggerManager->getLogger(static::class);
}



public function isExtensionLoaded($params = [])
{
$isLoaded = false;

if ( ExtensionManagementUtility::isLoaded('tt_address') ) {
$isLoaded = true;
}

return $isLoaded;
}
}
7 changes: 5 additions & 2 deletions Configuration/Flexform/flexform_basic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
<marker>
<TCEforms>
<label>LLL:EXT:ods_osm/Resources/Private/Language/locallang_db.xlf:tt_content.pi_flexform.marker</label>
<description>LLL:EXT:ods_osm/Resources/Private/Language/locallang_db.xlf:tt_content.pi_flexform.marker.description</description>
<config>
<type>group</type>
<internal_type>db</internal_type>
<allowed>fe_groups,fe_users,pages,sys_category,tx_odsosm_track,tx_odsosm_vector,tt_address,tx_calendarize_domain_model_event</allowed>
<allowed>fe_groups,fe_users,pages,sys_category,tx_odsosm_track,tx_odsosm_vector,*</allowed>
<size>5</size>
<minitems>0</minitems>
<maxitems>9999</maxitems>
Expand Down Expand Up @@ -303,11 +304,13 @@
<marker_popup_initial>
<TCEforms>
<label>LLL:EXT:ods_osm/Resources/Private/Language/locallang_db.xlf:tt_content.pi_flexform.marker_popup_intial</label>
<description>LLL:EXT:ods_osm/Resources/Private/Language/locallang_db.xlf:tt_content.pi_flexform.marker_popup_intial.description</description>
<displayCond>FIELD:show_popups:IN:1,3</displayCond>
<config>
<type>group</type>
<internal_type>db</internal_type>
<allowed>fe_users,tt_address</allowed>
<allowed>fe_users,*</allowed>
<prepend_tname>1</prepend_tname>
<size>1</size>
<minitems>0</minitems>
<maxitems>1</maxitems>
Expand Down
18 changes: 0 additions & 18 deletions Configuration/TCA/Overrides/tt_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,3 @@

$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['ods_osm_pi1'] = 'pi_flexform';
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_excludelist']['ods_osm_pi1'] = 'layout,select_key,pages,recursive';

// Avoid PHP 8.1 errors due to not available index if extensions are not installed
if (! ExtensionManagementUtility::isLoaded('tt_address')) {
$GLOBALS['TCA']['tt_address'] = [
'ctrl' => [
'title' => '',
'iconfile' => 'EXT:ods_osm/Resources/Public/Icons/osm.png'
]
];
}
if (! ExtensionManagementUtility::isLoaded('calendarize')) {
$GLOBALS['TCA']['tx_calendarize_domain_model_event'] = [
'ctrl' => [
'title' => '',
'iconfile' => 'EXT:ods_osm/Resources/Public/Icons/osm.png'
]
];
}
8 changes: 6 additions & 2 deletions Resources/Private/Language/de.locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,13 @@
<target><![CDATA[Programm]]></target>
</trans-unit>
<trans-unit id="tt_content.pi_flexform.marker" approved="yes">
<source><![CDATA[Marker to show]]></source>
<source><![CDATA[Records to show]]></source>
<target><![CDATA[Markierungen anzeigen]]></target>
</trans-unit>
<trans-unit id="tt_content.pi_flexform.marker.description" approved="yes">
<source><![CDATA[Select marker, track or vector records to show on the map.]]></source>
<target><![CDATA[Marker, Track oder Vector-Daten für die Anzeige auf der Karte wählen.]]></target>
</trans-unit>
<trans-unit id="tt_content.pi_flexform.marker_popup_intial" approved="yes">
<source><![CDATA[Show this marker's popup initially]]></source>
<target><![CDATA[Markierungspopup anfangs anzeigen]]></target>
Expand Down Expand Up @@ -118,7 +122,7 @@
</trans-unit>
<trans-unit id="tt_content.pi_flexform.show_popups.I.0" approved="yes">
<source><![CDATA[No]]></source>
<target><![CDATA[NNein]]></target>
<target><![CDATA[Nein]]></target>
</trans-unit>
<trans-unit id="tt_content.pi_flexform.show_popups.I.1" approved="yes">
<source><![CDATA[Click]]></source>
Expand Down
5 changes: 4 additions & 1 deletion Resources/Private/Language/locallang_db.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
<source>Cluster markers</source>
</trans-unit>
<trans-unit id="tt_content.pi_flexform.marker" xml:space="preserve">
<source>Marker to show</source>
<source>Records to show</source>
</trans-unit>
<trans-unit id="tt_content.pi_flexform.marker.description" xml:space="preserve">
<source>Select marker, track or vector records to show on the map.</source>
</trans-unit>
<trans-unit id="tt_content.pi_flexform.marker_popup_intial" xml:space="preserve">
<source>Show this marker's popup initially</source>
Expand Down
2 changes: 1 addition & 1 deletion ext_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ CREATE TABLE sys_category (
);

--
-- Table structure for table 'fe_users'
-- Table structure for table 'tx_calendarize_domain_model_event'
--
CREATE TABLE tx_calendarize_domain_model_event (
tx_odsosm_lon decimal(9,6) NOT NULL DEFAULT '0.000000',
Expand Down