[BUGFIX] AdminPanel: Change fields for simulate time 30/53230/3
authorThorben Nissen <thorben.nissen@kapp-hamburg.de>
Fri, 16 Jun 2017 06:32:19 +0000 (08:32 +0200)
committerBenni Mack <benni@typo3.org>
Fri, 16 Jun 2017 11:36:11 +0000 (13:36 +0200)
When entering a date string in the admin panel to simulate a certain
date/time and clicking the "update" button an exception it thrown. Due to
the names and ordering of the fields, the timestamp from the hidden field
gets overridden by the date string.

Move the hidden timestamp field after the human readable date string field
to avoid the timestamp being overridden by the date string. Add a comment
to explain the ordering and avoid future changes.

Resolves: #81174
Releases: master, 8.7
Change-Id: I87236c9b8ef84dabb3ec63e0530f14582ecbe6fe
Reviewed-on: https://review.typo3.org/53230
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/frontend/Classes/View/AdminPanelView.php

index eddbc01..3565bbd 100644 (file)
@@ -462,11 +462,12 @@ class AdminPanelView
 
             // Simulate date
             $output[] = '<div class="typo3-adminPanel-form-group">';
-            $output[] = '  <input type="hidden" name="TSFE_ADMIN_PANEL[preview_simulateDate]" value="' . $this->getBackendUser()->uc['TSFE_adminConfig']['preview_simulateDate'] . '" />';
             $output[] = '  <label for="' . htmlspecialchars('preview_simulateDate') . '">';
             $output[] = '    ' . $this->extGetLL('preview_simulateDate');
             $output[] = '  </label>';
             $output[] = '  <input type="text" id="preview_simulateDate" name="TSFE_ADMIN_PANEL[preview_simulateDate]_hr" onchange="TSFEtypo3FormFieldGet(\'TSFE_ADMIN_PANEL[preview_simulateDate]\', \'datetime\', \'\', 1,0);" />';
+            // the hidden field must be placed after the _hr field to avoid the timestamp being overridden by the date string
+            $output[] = '  <input type="hidden" name="TSFE_ADMIN_PANEL[preview_simulateDate]" value="' . $this->getBackendUser()->uc['TSFE_adminConfig']['preview_simulateDate'] . '" />';
             $output[] = '</div>';
             $this->extJSCODE .= 'TSFEtypo3FormFieldSet("TSFE_ADMIN_PANEL[preview_simulateDate]", "datetime", "", 0, 0);';