|
1 | 1 | <?php |
2 | | - |
3 | | -if (!defined ('TYPO3_MODE')) { |
4 | | - die ('Access denied.'); |
5 | | -} |
| 2 | +defined('TYPO3_MODE') || die('Access denied.'); |
6 | 3 |
|
7 | 4 | $table = 'tt_products'; |
8 | | -$bSelectTaxMode = FALSE; |
| 5 | +$bSelectTaxMode = false; |
9 | 6 |
|
10 | 7 | if ( |
11 | 8 | version_compare(TYPO3_version, '8.7.0', '<') |
|
20 | 17 |
|
21 | 18 | if ( |
22 | 19 | defined('STATIC_INFO_TABLES_TAXES_EXT') && |
23 | | - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded(STATIC_INFO_TABLES_TAXES_EXT) |
| 20 | + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded(STATIC_INFO_TABLES_TAXES_EXT) |
24 | 21 | ) { |
25 | | - $eInfo = tx_div2007_alpha5::getExtensionInfo_fh003(STATIC_INFO_TABLES_TAXES_EXT); |
26 | | - |
27 | | - if (is_array($eInfo)) { |
28 | | - $sittVersion = $eInfo['version']; |
29 | | - if (version_compare($sittVersion, '0.3.0', '>=')) { |
30 | | - $bSelectTaxMode = TRUE; |
31 | | - } |
32 | | - } |
| 22 | + $eInfo = tx_div2007_alpha5::getExtensionInfo_fh003(STATIC_INFO_TABLES_TAXES_EXT); |
| 23 | + |
| 24 | + if (is_array($eInfo)) { |
| 25 | + $sittVersion = $eInfo['version']; |
| 26 | + if (version_compare($sittVersion, '0.3.0', '>=')) { |
| 27 | + $bSelectTaxMode = true; |
| 28 | + } |
| 29 | + } |
33 | 30 | } |
34 | 31 |
|
35 | 32 |
|
36 | 33 | if ($bSelectTaxMode) { |
37 | | - $whereTaxCategory = \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('static_tax_categories'); |
38 | | - |
39 | | - $temporaryColumns = array ( |
40 | | - 'tax_id' => array ( |
41 | | - 'exclude' => 0, |
42 | | - 'label' => 'LLL:EXT:' . STATIC_INFO_TABLES_TAXES_EXT . '/locallang_db.xml:static_taxes.tx_rate_id', |
43 | | - 'config' => array ( |
44 | | - 'type' => 'select', |
45 | | - 'renderType' => 'selectSingle', |
46 | | - 'items' => array ( |
47 | | - array('LLL:EXT:' . STATIC_INFO_TABLES_TAXES_EXT . '/locallang_db.xml:static_taxes.tx_rate_id.I.0', '0'), |
48 | | - array('LLL:EXT:' . STATIC_INFO_TABLES_TAXES_EXT . '/locallang_db.xml:static_taxes.tx_rate_id.I.1', '1'), |
49 | | - array('LLL:EXT:' . STATIC_INFO_TABLES_TAXES_EXT . '/locallang_db.xml:static_taxes.tx_rate_id.I.2', '2'), |
50 | | - array('LLL:EXT:' . STATIC_INFO_TABLES_TAXES_EXT . '/locallang_db.xml:static_taxes.tx_rate_id.I.3', '3'), |
51 | | - array('LLL:EXT:' . STATIC_INFO_TABLES_TAXES_EXT . '/locallang_db.xml:static_taxes.tx_rate_id.I.4', '4'), |
52 | | - array('LLL:EXT:' . STATIC_INFO_TABLES_TAXES_EXT . '/locallang_db.xml:static_taxes.tx_rate_id.I.5', '5'), |
53 | | - ), |
54 | | - ) |
55 | | - ), |
56 | | - ); |
57 | | - |
58 | | - |
59 | | - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns( |
60 | | - $table, |
61 | | - $temporaryColumns |
62 | | - ); |
63 | | - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( |
64 | | - $table, |
65 | | - 'tax_id', |
66 | | - '', |
67 | | - 'replace:tax_dummy' |
68 | | - ); |
69 | | - |
70 | | - $GLOBALS['TCA'][$table]['interface']['showRecordFieldList'] = str_replace(',tax,', ',tax,tax_id,', $GLOBALS['TCA'][$table]['interface']['showRecordFieldList']); |
| 34 | + $whereTaxCategory = \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('static_tax_categories'); |
| 35 | + |
| 36 | + $temporaryColumns = array ( |
| 37 | + 'tax_id' => array ( |
| 38 | + 'exclude' => 0, |
| 39 | + 'label' => 'LLL:EXT:' . STATIC_INFO_TABLES_TAXES_EXT . '/locallang_db.xml:static_taxes.tx_rate_id', |
| 40 | + 'config' => array ( |
| 41 | + 'type' => 'select', |
| 42 | + 'renderType' => 'selectSingle', |
| 43 | + 'items' => array ( |
| 44 | + array('LLL:EXT:' . STATIC_INFO_TABLES_TAXES_EXT . '/locallang_db.xml:static_taxes.tx_rate_id.I.0', '0'), |
| 45 | + array('LLL:EXT:' . STATIC_INFO_TABLES_TAXES_EXT . '/locallang_db.xml:static_taxes.tx_rate_id.I.1', '1'), |
| 46 | + array('LLL:EXT:' . STATIC_INFO_TABLES_TAXES_EXT . '/locallang_db.xml:static_taxes.tx_rate_id.I.2', '2'), |
| 47 | + array('LLL:EXT:' . STATIC_INFO_TABLES_TAXES_EXT . '/locallang_db.xml:static_taxes.tx_rate_id.I.3', '3'), |
| 48 | + array('LLL:EXT:' . STATIC_INFO_TABLES_TAXES_EXT . '/locallang_db.xml:static_taxes.tx_rate_id.I.4', '4'), |
| 49 | + array('LLL:EXT:' . STATIC_INFO_TABLES_TAXES_EXT . '/locallang_db.xml:static_taxes.tx_rate_id.I.5', '5'), |
| 50 | + ), |
| 51 | + 'default' => 0 |
| 52 | + ) |
| 53 | + ), |
| 54 | + ); |
| 55 | + |
| 56 | + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns( |
| 57 | + $table, |
| 58 | + $temporaryColumns |
| 59 | + ); |
| 60 | + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes( |
| 61 | + $table, |
| 62 | + 'tax_id', |
| 63 | + '', |
| 64 | + 'replace:tax_dummy' |
| 65 | + ); |
71 | 66 |
|
| 67 | + $GLOBALS['TCA'][$table]['interface']['showRecordFieldList'] = str_replace(',tax,', ',tax,tax_id,', $GLOBALS['TCA'][$table]['interface']['showRecordFieldList']); |
72 | 68 | } |
73 | 69 |
|
74 | 70 |
|
75 | 71 |
|
76 | 72 | switch ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][TT_PRODUCTS_EXT]['articleMode']) { |
77 | | - case '1': |
78 | | - $GLOBALS['TCA'][$table]['columns']['article_uid'] = array ( |
79 | | - 'exclude' => 1, |
80 | | - 'label' => 'LLL:EXT:' . TT_PRODUCTS_EXT . '/locallang_db.xml:tt_products.article_uid', |
81 | | - 'config' => array ( |
82 | | - 'type' => 'group', |
83 | | - 'internal_type' => 'db', |
84 | | - 'allowed' => 'tt_products_articles', |
85 | | - 'MM' => 'tt_products_products_mm_articles', |
86 | | - 'foreign_table' => 'tt_products_articles', |
87 | | - 'foreign_table_where' => ' ORDER BY tt_products_articles.title', |
88 | | - 'size' => 10, |
89 | | - 'selectedListStyle' => 'width:450px', |
90 | | - 'minitems' => 0, |
91 | | - 'maxitems' => 1000, |
92 | | - ) |
93 | | - ); |
94 | | - break; |
95 | | - case '2': |
96 | | - // leave the settings of article_uid |
97 | | - break; |
| 73 | + case '1': |
| 74 | + $GLOBALS['TCA'][$table]['columns']['article_uid'] = array ( |
| 75 | + 'exclude' => 1, |
| 76 | + 'label' => 'LLL:EXT:' . TT_PRODUCTS_EXT . '/locallang_db.xml:tt_products.article_uid', |
| 77 | + 'config' => array ( |
| 78 | + 'type' => 'group', |
| 79 | + 'internal_type' => 'db', |
| 80 | + 'allowed' => 'tt_products_articles', |
| 81 | + 'MM' => 'tt_products_products_mm_articles', |
| 82 | + 'foreign_table' => 'tt_products_articles', |
| 83 | + 'foreign_table_where' => ' ORDER BY tt_products_articles.title', |
| 84 | + 'size' => 10, |
| 85 | + 'selectedListStyle' => 'width:450px', |
| 86 | + 'minitems' => 0, |
| 87 | + 'maxitems' => 1000, |
| 88 | + 'default' => 0 |
| 89 | + ) |
| 90 | + ); |
| 91 | + break; |
| 92 | + case '2': |
| 93 | + // leave the settings of article_uid |
| 94 | + break; |
98 | 95 | case '0': |
99 | 96 | default: |
100 | 97 | unset($GLOBALS['TCA'][$table]['columns']['article_uid']); |
|
104 | 101 | break; |
105 | 102 | } |
106 | 103 |
|
107 | | - |
108 | | - |
109 | 104 | $addressTable = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][TT_PRODUCTS_EXT]['addressTable']; |
110 | 105 |
|
111 | 106 | if (!$addressTable) { |
|
122 | 117 | 'size' => 1, |
123 | 118 | 'minitems' => 0, |
124 | 119 | 'maxitems' => 1, |
| 120 | + 'default' => 0 |
125 | 121 | ) |
126 | 122 | ); |
127 | 123 |
|
|
134 | 130 | 'before:price' |
135 | 131 | ); |
136 | 132 |
|
137 | | - |
138 | | - |
139 | 133 | $orderBySortingTablesArray = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][TT_PRODUCTS_EXT]['orderBySortingTables']); |
140 | 134 | if ( |
141 | 135 | !empty($orderBySortingTablesArray) && |
|
0 commit comments