[TASK] Remove support for TYPO3 7 LTS 04/58604/3
authorStanislas Rolland <typo3@sjbr.ca>
Tue, 9 Oct 2018 16:24:17 +0000 (12:24 -0400)
committerStanislas Rolland <typo3@sjbr.ca>
Tue, 9 Oct 2018 16:34:12 +0000 (18:34 +0200)
Change-Id: I06027230568739a4679118fce081780eb48645c4
Resolves: #86608
Reviewed-on: https://review.typo3.org/58604
Reviewed-by: Stanislas Rolland <typo3@sjbr.ca>
Tested-by: Stanislas Rolland <typo3@sjbr.ca>
Classes/Hook/Backend/Form/FormDataProvider/TcaSelectItemsProcessor.php
Classes/Hook/Backend/Form/Wizard/SuggestReceiver.php
Classes/Utility/TcaUtility.php [deleted file]
Configuration/TCA/Overrides/static_countries.php [deleted file]
Configuration/TCA/Overrides/sys_language.php
Configuration/TCA/Overrides/tx_rtehtmlarea_acronym.php [deleted file]
composer.json
ext_emconf.php

index 7d33997..d57f80b 100644 (file)
@@ -1,9 +1,10 @@
 <?php
 namespace SJBR\StaticInfoTables\Hook\Backend\Form\FormDataProvider;
+
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 2013-2015 Stanislas Rolland <typo3(arobas)sjbr.ca>
+*  (c) 2013-2018 Stanislas Rolland <typo3(arobas)sjbr.ca>
 *  All rights reserved
 *
 *  This script is part of the Typo3 project. The Typo3 project is
@@ -27,7 +28,6 @@ namespace SJBR\StaticInfoTables\Hook\Backend\Form\FormDataProvider;
  */
 
 use SJBR\StaticInfoTables\Utility\ModelUtility;
-use SJBR\StaticInfoTables\Utility\TcaUtility;
 use SJBR\StaticInfoTables\Utility\LocalizationUtility;
 use TYPO3\CMS\Backend\Form\FormDataProvider\TcaSelectItems;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
index d04c583..6f643cd 100644 (file)
@@ -5,7 +5,7 @@ namespace SJBR\StaticInfoTables\Hook\Backend\Form\Wizard;
  *  Copyright notice
  *
  *  (c) 2007-2011 Andreas Wolf <andreas.wolf@ikt-werk.de>
- *  (c) 2013-2015 Stanislas Rolland <typo3(arobas)sjbr.ca>
+ *  (c) 2013-2018 Stanislas Rolland <typo3(arobas)sjbr.ca>
  *  All rights reserved
  *
  *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -50,99 +50,42 @@ class SuggestReceiver extends \TYPO3\CMS\Backend\Form\Wizard\SuggestWizardDefaul
      */
     protected function prepareSelectStatement()
     {
-       if (class_exists('TYPO3\\CMS\\Core\\Database\\ConnectionPool')) {
-               $expressionBuilder = $this->queryBuilder->expr();
-                       $searchWholePhrase = !isset($this->config['searchWholePhrase']) || $this->config['searchWholePhrase'];
-                       $searchString = $this->params['value'];
-                       $searchUid = (int)$searchString;
-                       if ($searchString !== '') {
-                               $likeCondition = ($searchWholePhrase ? '%' : '') . $this->queryBuilder->escapeLikeWildcards($searchString) . '%';
-                               // Get the label field for the current language, if any is available
-                               $lang = LocalizationUtility::getCurrentLanguage();
-                               $lang = LocalizationUtility::getIsoLanguageKey($lang);
-                               $labelFields = LocalizationUtility::getLabelFields($this->table, $lang);
-                               $selectFieldsList = $labelFields[0] . ',' . $this->config['additionalSearchFields'];
-                               $selectFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $selectFieldsList, true);
-                               $selectFields = array_unique($selectFields);
-
-                               $selectParts = $expressionBuilder->orX();
-                               foreach ($selectFields as $field) {
-                                       $selectParts->add($expressionBuilder->like($field, $this->queryBuilder->createPositionalParameter($likeCondition)));
-                               }
-
-                               $searchClause = $expressionBuilder->orX($selectParts);
-                               if ($searchUid > 0 && $searchUid == $searchString) {
-                                       $searchClause->add($expressionBuilder->eq('uid', $searchUid));
-                               }
-
-                               $this->queryBuilder->andWhere($expressionBuilder->orX($searchClause));
-                       }
-                       if (!empty($this->allowedPages)) {
-                               $pidList = array_map('intval', $this->allowedPages);
-                               if (!empty($pidList)) {
-                                       $this->queryBuilder->andWhere(
-                                               $expressionBuilder->in('pid', $pidList)
-                                       );
-                               }
-                       }
-                       // add an additional search condition comment
-                       if (isset($this->config['searchCondition']) && $this->config['searchCondition'] !== '') {
-                               $this->queryBuilder->andWhere(QueryHelper::stripLogicalOperatorPrefix($this->config['searchCondition']));
-                       }
-               } else {
-                       // TYPO3 CMS 7 LTS
-                       $this->prepareCompatibleSelectStatement();
-               }
-    }
-
-       /**
-        * For TYPO3 CMS 7 LTS
-        *
-        * Prepare the statement for selecting the records which will be returned to the selector. May also return some
-        * other records (e.g. from a mm-table) which will be used later on to select the real records
-        *
-        * @return void
-        */
-       protected function prepareCompatibleSelectStatement()
-       {
-               $searchWholePhrase = $this->config['searchWholePhrase'];
+               $expressionBuilder = $this->queryBuilder->expr();
+               $searchWholePhrase = !isset($this->config['searchWholePhrase']) || $this->config['searchWholePhrase'];
                $searchString = $this->params['value'];
-               $searchUid = intval($searchString);
-               if (strlen($searchString)) {
-                       $searchString = $GLOBALS['TYPO3_DB']->quoteStr($searchString, $this->table);
-                       $likeCondition = ' LIKE \'' . ($searchWholePhrase ? '%' : '') . $GLOBALS['TYPO3_DB']->escapeStrForLike($searchString, $this->table) . '%\'';
+               $searchUid = (int)$searchString;
+               if ($searchString !== '') {
+                       $likeCondition = ($searchWholePhrase ? '%' : '') . $this->queryBuilder->escapeLikeWildcards($searchString) . '%';
                        // Get the label field for the current language, if any is available
                        $lang = LocalizationUtility::getCurrentLanguage();
                        $lang = LocalizationUtility::getIsoLanguageKey($lang);
                        $labelFields = LocalizationUtility::getLabelFields($this->table, $lang);
                        $selectFieldsList = $labelFields[0] . ',' . $this->config['additionalSearchFields'];
-                       $selectFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $selectFieldsList, TRUE);
+                       $selectFields = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $selectFieldsList, true);
                        $selectFields = array_unique($selectFields);
-                       $selectParts = array();
+                       $selectParts = $expressionBuilder->orX();
                        foreach ($selectFields as $field) {
-                               $selectParts[] = $field . $likeCondition;
+                               $selectParts->add($expressionBuilder->like($field, $this->queryBuilder->createPositionalParameter($likeCondition)));
                        }
-                       $this->selectClause = '(' . implode(' OR ', $selectParts) . ')';
+                       $searchClause = $expressionBuilder->orX($selectParts);
                        if ($searchUid > 0 && $searchUid == $searchString) {
-                               $this->selectClause = '(' . $this->selectClause . ' OR uid = ' . $searchUid . ')';
+                               $searchClause->add($expressionBuilder->eq('uid', $searchUid));
                        }
+                       $this->queryBuilder->andWhere($expressionBuilder->orX($searchClause));
                }
-               if (isset($GLOBALS['TCA'][$this->table]['ctrl']['delete'])) {
-                       $this->selectClause .= ' AND ' . $GLOBALS['TCA'][$this->table]['ctrl']['delete'] . ' = 0';
-               }
-               if (count($this->allowedPages)) {
-                       $pidList = $GLOBALS['TYPO3_DB']->cleanIntArray($this->allowedPages);
-                       if (count($pidList)) {
-                               $this->selectClause .= ' AND pid IN (' . implode(', ', $pidList) . ') ';
+               if (!empty($this->allowedPages)) {
+                       $pidList = array_map('intval', $this->allowedPages);
+                       if (!empty($pidList)) {
+                               $this->queryBuilder->andWhere(
+                                       $expressionBuilder->in('pid', $pidList)
+                               );
                        }
                }
                // add an additional search condition comment
-               if (isset($this->config['searchCondition']) && strlen($this->config['searchCondition']) > 0) {
-                       $this->selectClause .= ' AND ' . $this->config['searchCondition'];
+               if (isset($this->config['searchCondition']) && $this->config['searchCondition'] !== '') {
+                       $this->queryBuilder->andWhere(QueryHelper::stripLogicalOperatorPrefix($this->config['searchCondition']));
                }
-               // add the global clauses to the where-statement
-               $this->selectClause .= $this->addWhere;
-       }
+    }
 
        /**
         * Prepares the clause by which the result elements are sorted. See description of ORDER BY in
@@ -152,42 +95,17 @@ class SuggestReceiver extends \TYPO3\CMS\Backend\Form\Wizard\SuggestWizardDefaul
         */
        protected function prepareOrderByStatement()
        {
-               if (class_exists('TYPO3\\CMS\\Core\\Database\\ConnectionPool')) {
-                       // Get the label field for the current language, if any is available
-                       $lang = LocalizationUtility::getCurrentLanguage();
-                       $lang = LocalizationUtility::getIsoLanguageKey($lang);
-                       $labelFields = LocalizationUtility::getLabelFields($this->table, $lang);
-                       if (!empty($labelFields)) {
-                               foreach ($labelFields as $labelField) {
-                                       $this->queryBuilder->addOrderBy($labelField);
-                               }
-                       } else  if ($GLOBALS['TCA'][$this->table]['ctrl']['label']) {
-                               $this->queryBuilder->addOrderBy($GLOBALS['TCA'][$this->table]['ctrl']['label']);
-                       }
-               } else {
-                       // TYPO3 CMS 7 LTS
-                       $this->prepareCompatibleOrderByStatement();
-               }
-       }
-
-       /**
-        * For TYPO3 CMS 7 LTS
-        *
-        * Prepares the clause by which the result elements are sorted. See description of ORDER BY in
-        * SQL standard for reference.
-        *
-        * @return void
-        */
-       protected function prepareCompatibleOrderByStatement()
-       {
-               if ($GLOBALS['TCA'][$this->table]['ctrl']['label']) {
-                       $this->orderByStatement = $GLOBALS['TCA'][$this->table]['ctrl']['label'];
-               }
                // Get the label field for the current language, if any is available
                $lang = LocalizationUtility::getCurrentLanguage();
                $lang = LocalizationUtility::getIsoLanguageKey($lang);
                $labelFields = LocalizationUtility::getLabelFields($this->table, $lang);
-               $this->orderByStatement = implode(',' , $labelFields);
+               if (!empty($labelFields)) {
+                       foreach ($labelFields as $labelField) {
+                               $this->queryBuilder->addOrderBy($labelField);
+                       }
+               } else  if ($GLOBALS['TCA'][$this->table]['ctrl']['label']) {
+                       $this->queryBuilder->addOrderBy($GLOBALS['TCA'][$this->table]['ctrl']['label']);
+               }
        }
 
        /**
diff --git a/Classes/Utility/TcaUtility.php b/Classes/Utility/TcaUtility.php
deleted file mode 100644 (file)
index cab962a..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-namespace SJBR\StaticInfoTables\Utility;
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2013-2014 StanislasRolland <typo3@sjbr.ca>
-*  All rights reserved
-*
-*  This script is part of the Typo3 project. The Typo3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-/**
- * TCA-related functions
- */
-class TcaUtility {
-
-       /**
-        * Get the enable fields clause based on the table configuration
-        *
-        * @param string $tableName: the name of the table
-        * @return string enable fileds clause
-        */
-       static public function getEnableFields ($tableName) {
-               if (TYPO3_MODE === 'FE') {
-                       $enableFields = $GLOBALS['TSFE']->sys_page->enableFields($tableName);
-               } else {
-                       $enableFields = \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($tableName);
-               }
-       }
-}
\ No newline at end of file
diff --git a/Configuration/TCA/Overrides/static_countries.php b/Configuration/TCA/Overrides/static_countries.php
deleted file mode 100644 (file)
index 3421090..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-// Use pre-8 LTS suggest options
-if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version()) < 8000000) {
-       $GLOBALS['TCA']['static_countries']['columns']['cn_currency_uid']['config'] = [
-               'type' => 'select',
-               'renderType' => 'selectSingle',
-               'items' => array(
-                       array('', 0),
-               ),
-               'foreign_table' => 'static_currencies',
-               'foreign_table_where' => 'ORDER BY static_currencies.cu_name_en',
-               'itemsProcFunc' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\FormDataProvider\\TcaSelectItemsProcessor->translateCurrenciesSelector',
-               'size' => 1,
-               'minitems' => 0,
-               'maxitems' => 1,
-               'wizards' => array(
-                       'suggest' => array(
-                               'type' => 'suggest',
-                               'default' => array(
-                                       'receiverClass' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\Wizard\\SuggestReceiver'
-                               )
-                       )
-               )
-       ];
-}
index 804b4e7..242f91b 100644 (file)
@@ -2,60 +2,31 @@
 defined('TYPO3_MODE') or die();
 
 // Configure static_lang_isocode field in TCA
-if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(\TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version()) < 8000000) {
 $GLOBALS['TCA']['sys_language']['columns']['static_lang_isocode'] = array(
        'exclude' => 1,
        'label' => 'LLL:EXT:lang/locallang_tca.xlf:sys_language.isocode',
-       'config' => array(
-               'type' => 'select',
-               'renderType' => 'selectSingle',
-               'items' => array(
-                       array('', 0)
-               ),
+       'config' => [
+               'type' => 'group',
+               'internal_type' => 'db',
+               'allowed' => 'static_languages',
                'foreign_table' => 'static_languages',
-               'foreign_table_where' => 'AND static_languages.pid=0 ORDER BY static_languages.lg_name_en',
-               'itemsProcFunc' => \SJBR\StaticInfoTables\Hook\Backend\Form\FormDataProvider\TcaSelectItemsProcessor::class . '->translateLanguagesSelector',
+               'suggestOptions' => [
+                       'default' => [
+                               'pidList' => '0',
+                               'additionalSearchFields' => 'lg_name_local'
+                       ]
+               ],
+               'fieldWizard' => [
+                       'recordsOverview' => [
+                               'disabled' => true
+                       ],
+                       'tableList' => [
+                               'disabled' => true
+                       ]
+               ],
                'size' => 1,
                'minitems' => 0,
-               'maxitems' => 1,
-               'wizards' => array(
-                       'suggest' => array(
-                               'type' => 'suggest',
-                               'default' => array(
-                                       'receiverClass' => \SJBR\StaticInfoTables\Hook\Backend\Form\Wizard\SuggestReceiver::class
-                               )
-                       )
-               )
-       )
+               'maxitems' => 1
+       ]
 );
-} else {
-       $GLOBALS['TCA']['sys_language']['columns']['static_lang_isocode'] = array(
-               'exclude' => 1,
-               'label' => 'LLL:EXT:lang/locallang_tca.xlf:sys_language.isocode',
-               'config' => [
-                       'type' => 'group',
-                       'internal_type' => 'db',
-                       'allowed' => 'static_languages',
-                       'foreign_table' => 'static_languages',
-                       'suggestOptions' => [
-                               'default' => [
-                                       'pidList' => '0',
-                                       'additionalSearchFields' => 'lg_name_local'
-                               ]
-                       ],
-                       'fieldWizard' => [
-                               'recordsOverview' => [
-                                       'disabled' => true
-                               ],
-                               'tableList' => [
-                                       'disabled' => true
-                               ]
-                       ],
-                       'size' => 1,
-                       'minitems' => 0,
-                       'maxitems' => 1
-               ]
-       );
-}
-
 \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('sys_language', 'static_lang_isocode', '', 'after:language_isocode');
\ No newline at end of file
diff --git a/Configuration/TCA/Overrides/tx_rtehtmlarea_acronym.php b/Configuration/TCA/Overrides/tx_rtehtmlarea_acronym.php
deleted file mode 100644 (file)
index a6a2e13..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-defined('TYPO3_MODE') or die();
-
-if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('rtehtmlarea')) {
-       $additionalColumns = array(
-               'static_lang_isocode' => array(
-                       'exclude' => 0,
-                       'label' => 'LLL:EXT:rtehtmlarea/Resources/Private/Language/locallang_db.xlf:tx_rtehtmlarea_acronym.static_lang_isocode',
-                       'config' => array(
-                               'type' => 'select',
-                               'renderType' => 'selectSingle',
-                               'items' => array(
-                                       array('', 0)
-                               ),
-                               'foreign_table' => 'static_languages',
-                               'foreign_table_where' => 'ORDER BY static_languages.lg_name_en',
-                               'itemsProcFunc' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\FormDataProvider\\TcaSelectItemsProcessor->translateLanguagesSelector',
-                               'size' => 1,
-                               'minitems' => 0,
-                               'maxitems' => 1,
-                               'wizards' => array(
-                                       'suggest' => array(
-                                               'type' => 'suggest',
-                                               'default' => array(
-                                                       'receiverClass' => 'SJBR\\StaticInfoTables\\Hook\\Backend\\Form\\Wizard\\SuggestReceiver'
-                                               )
-                                       )
-                               )
-                       )
-               )
-       );
-
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns('tx_rtehtmlarea_acronym', $additionalColumns);
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tx_rtehtmlarea_acronym', 'static_lang_isocode');
-}
\ No newline at end of file
index a6af160..76535ac 100644 (file)
@@ -7,6 +7,7 @@
   "authors": [
     {
       "name": "Stanislas Rolland",
+      "homepage": "http://www.sjbr.ca",
       "role": "Developer"
     }
   ],
@@ -19,7 +20,7 @@
     "typo3-ter/static-info-tables": "self.version"
   },
   "require": {
-         "typo3/cms-core": ">=7.6,<9.0"
+         "typo3/cms-core": ">=8.7,<9.0"
   },
   "autoload": {
     "psr-4": {
index d183595..876cc6a 100644 (file)
@@ -17,7 +17,7 @@ $EM_CONF[$_EXTKEY] = array(
        'author_company' => 'SJBR',
        'constraints' => array(
                'depends' => array(
-                       'typo3' => '7.6.0-8.7.99'
+                       'typo3' => '8.7.0-8.7.99'
                ),
                'conflicts' => array(
                        'sr_static_info' => '0.0.0-99.99.99',