Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stud.IP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marcus Eibrink-Lunzenauer
Stud.IP
Commits
391df9bc
Commit
391df9bc
authored
2 years ago
by
Moritz Strohm
Browse files
Options
Downloads
Patches
Plain Diff
fix for BIESt #908
parent
af6c8a43
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/controllers/messages.php
+36
-43
36 additions, 43 deletions
app/controllers/messages.php
with
36 additions
and
43 deletions
app/controllers/messages.php
+
36
−
43
View file @
391df9bc
...
...
@@ -275,81 +275,74 @@ class MessagesController extends AuthenticatedController {
}
//check if the message shall be sent to all (or some) members of a course:
if
(
Request
::
get
(
'filter'
)
&&
Request
::
option
(
"course_id"
))
{
$filter
=
Request
::
get
(
'filter'
);
if
(
$filter
&&
Request
::
option
(
"course_id"
))
{
$additional
=
''
;
$course
=
new
Course
(
Request
::
option
(
'course_id'
));
$allow_tutor_filters
=
false
;
if
(
$GLOBALS
[
'perm'
]
->
have_studip_perm
(
'tutor'
,
$course
->
id
)
||
$course
->
getSemClass
()[
'studygroup_mode'
]
||
CourseConfig
::
get
(
$course
->
id
)
->
COURSE_STUDENT_MAILING
)
{
$this
->
default_message
->
receivers
=
[];
if
(
Request
::
get
(
'filter'
)
===
'claiming'
)
{
$cs
=
CourseSet
::
getSetForCourse
(
$course
->
id
);
if
(
is_object
(
$cs
)
&&
!
$cs
->
hasAlgorithmRun
())
{
foreach
(
AdmissionPriority
::
getPrioritiesByCourse
(
$cs
->
getId
(),
$course
->
id
)
as
$user_id
=>
$p
)
{
$this
->
default_message
->
receivers
[]
=
MessageUser
::
build
([
'user_id'
=>
$user_id
,
'snd_rec'
=>
'rec'
]);
}
}
}
else
{
// Exclude hidden course members from mail if not at least tutor
$additional
=
''
;
if
(
!
$GLOBALS
[
'perm'
]
->
have_studip_perm
(
'tutor'
,
$course
->
id
))
{
$additonal
=
" AND seminar_user.visible != 'no'"
;
}
$allow_tutor_filters
=
true
;
$additonal
=
" AND seminar_user.visible != 'no'"
;
}
$this
->
default_message
->
receivers
=
[];
$query
=
''
;
$params
=
[
$course
->
id
,
Request
::
option
(
'who'
)];
$params
=
[
$course
->
id
,
Request
::
option
(
'who'
)];
switch
(
Request
::
get
(
'filter'
))
{
case
'send_sms_to_all'
:
$query
=
"SELECT user_id, 'rec' AS snd_rec
if
(
$filter
===
'send_sms_to_all'
&&
$allow_tutor_filters
)
{
$query
=
"SELECT user_id, 'rec' AS snd_rec
FROM seminar_user
JOIN auth_user_md5 USING (user_id)
WHERE Seminar_id = ? AND status = ?
{
$additonal
}
WHERE Seminar_id = ? AND status = ?
{
$addit
i
onal
}
ORDER BY Nachname, Vorname"
;
break
;
case
'all'
:
$query
=
"SELECT user_id, 'rec' AS snd_rec
}
elseif
(
$filter
===
'all'
)
{
$query
=
"SELECT user_id, 'rec' AS snd_rec
FROM seminar_user
JOIN auth_user_md5 USING (user_id)
WHERE Seminar_id = ?
{
$additonal
}
WHERE Seminar_id = ?
{
$addit
i
onal
}
ORDER BY Nachname, Vorname"
;
break
;
case
'prelim'
:
$query
=
"SELECT user_id, 'rec' AS snd_rec
}
elseif
(
$filter
===
'prelim'
&&
$allow_tutor_filters
)
{
$query
=
"SELECT user_id, 'rec' AS snd_rec
FROM admission_seminar_user
JOIN auth_user_md5 USING (user_id)
WHERE seminar_id = ? AND status = 'accepted'
{
$additonal
}
{
$addit
i
onal
}
ORDER BY Nachname, Vorname"
;
break
;
case
'awaiting'
:
$query
=
"SELECT user_id, 'rec' AS snd_rec
}
elseif
(
$filter
===
'awaiting'
&&
$allow_tutor_filters
)
{
$query
=
"SELECT user_id, 'rec' AS snd_rec
FROM admission_seminar_user
JOIN auth_user_md5 USING (user_id)
WHERE seminar_id = ? AND status = 'awaiting'
{
$additonal
}
{
$addit
i
onal
}
ORDER BY Nachname, Vorname"
;
break
;
case
'inst_status'
:
$query
=
"SELECT user_id, 'rec' AS snd_rec
}
elseif
(
$filter
===
'inst_status'
)
{
$query
=
"SELECT user_id, 'rec' AS snd_rec
FROM user_inst
JOIN auth_user_md5 USING (user_id)
WHERE Institut_id = ? AND inst_perms = ?
{
$additonal
}
{
$addit
i
onal
}
ORDER BY Nachname, Vorname"
;
break
;
case
'not_grouped'
:
$query
=
"SELECT seminar_user.user_id, 'rec' as snd_rec
}
elseif
(
$filter
===
'not_grouped'
&&
$allow_tutor_filters
)
{
$query
=
"SELECT seminar_user.user_id, 'rec' as snd_rec
FROM seminar_user
JOIN auth_user_md5 USING (user_id)
LEFT JOIN statusgruppen ON range_id = seminar_id
LEFT JOIN statusgruppe_user ON statusgruppen.statusgruppe_id = statusgruppe_user.statusgruppe_id
AND seminar_user.user_id = statusgruppe_user.user_id
AND seminar_user.user_id = statusgruppe_user.user_id
WHERE seminar_id = ?
GROUP BY seminar_user.user_id
HAVING COUNT(statusgruppe_user.statusgruppe_id) = 0
ORDER BY Nachname, Vorname"
;
break
;
}
elseif
(
$filter
===
'claiming'
&&
$allow_tutor_filters
)
{
$cs
=
CourseSet
::
getSetForCourse
(
$course
->
id
);
if
(
is_object
(
$cs
)
&&
!
$cs
->
hasAlgorithmRun
())
{
foreach
(
AdmissionPriority
::
getPrioritiesByCourse
(
$cs
->
getId
(),
$course
->
id
)
as
$user_id
=>
$p
)
{
$this
->
default_message
->
receivers
=
MessageUser
::
build
([
'user_id'
=>
$user_id
,
'snd_rec'
=>
'rec'
]);
}
$this
->
default_message
->
receivers
=
DBManager
::
get
()
->
fetchAll
(
$query
,
$params
,
'MessageUser::build'
);
}
}
if
(
$query
)
{
$this
->
default_message
->
receivers
=
DBManager
::
get
()
->
fetchAll
(
$query
,
$params
,
'MessageUser::build'
);
}
}
if
(
Request
::
option
(
'prof_id'
)
&&
Request
::
option
(
'deg_id'
)
&&
$GLOBALS
[
'perm'
]
->
have_perm
(
'root'
))
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment