Cleanup #13869: Scheduler: editTasks() calls all registered tasks to edit just one
authorFrancois Suter <francois.suter@typo3.org>
Sat, 3 Apr 2010 13:22:51 +0000 (13:22 +0000)
committerFrancois Suter <francois.suter@typo3.org>
Sat, 3 Apr 2010 13:22:51 +0000 (13:22 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@7236 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/scheduler/mod1/index.php

index 9a57516..b1ce2b2 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-04-03  Francois Suter  <francois@typo3.org>
+
+       * Cleanup #13869: Scheduler: editTasks() calls all registered tasks to edit just one
+
 2010-04-01  Tobias Liebig  <mail_typo3@etobi.de>
 
        * Fixed bug #13557: t3editor/codecompletion: add new typoscript properties and update tsref descriptions
index 596f75f..861c71a 100755 (executable)
@@ -594,6 +594,7 @@ class tx_scheduler_Module extends t3lib_SCbase {
                $content = '';
                $taskInfo = array();
                $task = NULL;
+               $process = 'edit';
 
                if ($this->submittedData['uid'] > 0) {
                                // If editing, retrieve data for existing task
@@ -663,6 +664,7 @@ class tx_scheduler_Module extends t3lib_SCbase {
                        $taskInfo['end'] = '';
                        $taskInfo['frequency'] = '';
                        $taskInfo['multiple'] = 0;
+                       $process = 'add';
                }
 
                if (count($this->submittedData) > 0) {
@@ -673,12 +675,23 @@ class tx_scheduler_Module extends t3lib_SCbase {
 
                        // Get the extra fields to display for each task that needs some
                $allAdditionalFields = array();
-               foreach ($registeredClasses as $class => $registrationInfo) {
-                       if (!empty($registrationInfo['provider'])) {
-                               $providerObject = t3lib_div::getUserObj($registrationInfo['provider']);
+               if ($process == 'add') {
+                       foreach ($registeredClasses as $class => $registrationInfo) {
+                               if (!empty($registrationInfo['provider'])) {
+                                       $providerObject = t3lib_div::getUserObj($registrationInfo['provider']);
+                                       if ($providerObject instanceof tx_scheduler_AdditionalFieldProvider) {
+                                               $additionalFields = $providerObject->getAdditionalFields($taskInfo, NULL, $this);
+                                               $allAdditionalFields = array_merge($allAdditionalFields, array($class => $additionalFields));
+                                       }
+                               }
+                       }
+
+                       // In case of edit, get only the extra fields for the current task class
+               } else {
+                       if (!empty($registeredClasses[$taskInfo['class']]['provider'])) {
+                               $providerObject = t3lib_div::getUserObj($registeredClasses[$taskInfo['class']]['provider']);
                                if ($providerObject instanceof tx_scheduler_AdditionalFieldProvider) {
-                                       $additionalFields = $providerObject->getAdditionalFields($taskInfo, isset($task) ? $task : null, $this);
-                                       $allAdditionalFields = array_merge($allAdditionalFields, array($class => $additionalFields));
+                                       $allAdditionalFields[$taskInfo['class']] = $providerObject->getAdditionalFields($taskInfo, $task, $this);
                                }
                        }
                }