[FEATURE] Let workspace users decide whom to send notifications 47/22447/2
authorOliver Hader <oliver@typo3.org>
Wed, 19 Jun 2013 13:05:34 +0000 (15:05 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 12 Oct 2013 15:37:19 +0000 (17:37 +0200)
Workspaces are defined by having owners, members and default
notification recipients. These recipients, of course, need to be
a sub-set out of the owners/members crowd. Besides that, changing
the stage to "ready to publish execute" only considers owners and
falling back to "editing" stage only considers editors.

This feature request aims to allow editors/users to define whom
to notify, out of the owners/members crowd without limiting
these possibilities on the system level.

Resolves: #50224
Releases: 6.2
Change-Id: I39ded2ed02772040d498d5293d24c8bd6fb9ef46
Reviewed-on: https://review.typo3.org/22447
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
typo3/sysext/workspaces/Classes/Service/StagesService.php

index 11278c2..620453f 100644 (file)
@@ -463,23 +463,23 @@ class StagesService {
                        case self::STAGE_PUBLISH_EXECUTE_ID:
 
                        case self::STAGE_PUBLISH_ID:
-                               if ($selectDefaultUserField == FALSE) {
-                                       $userList = $this->getResponsibleUser($workspaceRec['adminusers']);
+                               if (!$selectDefaultUserField) {
+                                       $userList = $this->getResponsibleUser($workspaceRec['adminusers'] . ',' . $workspaceRec['members']);
                                } else {
                                        $notification_default_user = $workspaceRec['publish_notification_defaults'];
                                        $userList = $this->getResponsibleUser($notification_default_user);
                                }
                                break;
                        case self::STAGE_EDIT_ID:
-                               if ($selectDefaultUserField == FALSE) {
-                                       $userList = $this->getResponsibleUser($workspaceRec['members']);
+                               if (!$selectDefaultUserField) {
+                                       $userList = $this->getResponsibleUser($workspaceRec['adminusers'] . ',' . $workspaceRec['members']);
                                } else {
                                        $notification_default_user = $workspaceRec['edit_notification_defaults'];
                                        $userList = $this->getResponsibleUser($notification_default_user);
                                }
                                break;
                        default:
-                               if ($selectDefaultUserField == FALSE) {
+                               if (!$selectDefaultUserField) {
                                        $responsible_persons = $this->getPropertyOfCurrentWorkspaceStage($stageId, 'responsible_persons');
                                        $userList = $this->getResponsibleUser($responsible_persons);
                                } else {
@@ -505,22 +505,21 @@ class StagesService {
         * @return      string  uid list of responsible be_users
         */
        public function getResponsibleUser($stageRespValue) {
-               $stageValuesArray = array();
-               $stageValuesArray = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $stageRespValue);
+               $stageValuesArray = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $stageRespValue, TRUE);
                $beuserUidArray = array();
                $begroupUidArray = array();
-               $allBeUserArray = array();
-               $begroupUidList = array();
-               foreach ($stageValuesArray as $key => $uidvalue) {
+
+               foreach ($stageValuesArray as $uidvalue) {
                        if (strstr($uidvalue, 'be_users') !== FALSE) {
                                // Current value is a uid of a be_user record
                                $beuserUidArray[] = str_replace('be_users_', '', $uidvalue);
                        } elseif (strstr($uidvalue, 'be_groups') !== FALSE) {
                                $begroupUidArray[] = str_replace('be_groups_', '', $uidvalue);
-                       } else {
-                               $beuserUidArray[] = $uidvalue;
+                       } elseif ((int) $uidvalue) {
+                               $beuserUidArray[] = (int) $uidvalue;
                        }
                }
+
                if (!empty($begroupUidArray)) {
                        $allBeUserArray = BackendUtility::getUserNames();
                        $begroupUidList = implode(',', $begroupUidArray);
@@ -534,6 +533,7 @@ class StagesService {
                                }
                        }
                }
+
                array_unique($beuserUidArray);
                return implode(',', $beuserUidArray);
        }