Project

General

Profile

Bug #17569 » 17569.patch

Benni Mack, 2011-05-12 04:34

View differences:

class.tx_version_tcemain.php
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['reviewers']);
break;
case 10:
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers'], TRUE);
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers']);
break;
case -1:
# $emails = $this->getEmailsForStageChangeNotification($workspaceRec['reviewers']);
......
foreach ($rows as $dat) {
$data = unserialize($dat['log_data']);
$emails = t3lib_div::array_merge($emails, $this->getEmailsForStageChangeNotification($dat['userid'], TRUE));
$emails = t3lib_div::array_merge($emails, $this->getEmailsForStageChangeNotification($dat['userid']));
if ($data['stage'] == 1) {
break;
......
break;
default:
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers'], TRUE);
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers']);
break;
}
break;
case 10:
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers'], TRUE);
$emails = $this->getEmailsForStageChangeNotification($workspaceRec['adminusers']);
$emails = t3lib_div::array_merge($emails, $this->getEmailsForStageChangeNotification($workspaceRec['reviewers']));
$emails = t3lib_div::array_merge($emails, $this->getEmailsForStageChangeNotification($workspaceRec['members']));
break;
......
/**
* Return be_users that should be notified on stage change from input list.
* previously called notifyStageChange_getEmails() in tcemain
* previously known as notifyStageChange_getEmails() in tcemain
*
* @param string $listOfUsers List of backend users, on the form "be_users_10,be_users_2" or "10,2" in case noTablePrefix is set.
* @param boolean $noTablePrefix If set, the input list are integers and not strings.
* @param string $listOfUsers List of backend users and groups, in the form "be_users_10,be_users_2"
* @return array Array of emails
*/
protected function getEmailsForStageChangeNotification($listOfUsers, $noTablePrefix = FALSE) {
protected function getEmailsForStageChangeNotification($listOfUsers) {
$users = t3lib_div::trimExplode(',', $listOfUsers, 1);
$emails = array();
foreach ($users as $userIdent) {
if ($noTablePrefix) {
$id = intval($userIdent);
list($table, $uid) = t3lib_div::revExplode('_', $userIdent, 2);
if ($table == 'be_groups') {
// fetch all BE users of the group
$where = ' AND ' . $GLOBALS['TYPO3_DB']->listQuery('usergroup_cached_list', intval($uid), 'be_users') . ' AND email != ""';
$additionalRecords = t3lib_BEfunc::getUserNames('uid,email,lang,realName,usergroup_cached_list', $where);
foreach ($additionalRecords as $userRecord) {
if (t3lib_div::validEmail($userRecord['email'])) {
$emails[$id] = $userRecord;
}
}
} else {
list($table, $id) = t3lib_div::revExplode('_', $userIdent, 2);
}
if ($table === 'be_users' || $noTablePrefix) {
if ($userRecord = t3lib_BEfunc::getRecord('be_users', $id, 'uid,email,lang,realName')) {
if (strlen(trim($userRecord['email']))) {
// fetch a single BE user
if ($userRecord = t3lib_BEfunc::getRecord('be_users', $uid, 'uid,email,lang,realName', ' AND email != ""')) {
if (t3lib_div::validEmail($userRecord['email'])) {
$emails[$id] = $userRecord;
}
}
(3-3/3)