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
Terraform modules
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
Jakob Diel
Stud.IP
Commits
578969b9
Commit
578969b9
authored
2 years ago
by
Jan-Hendrik Willms
Committed by
Jan-Hendrik Willms
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fail safe room request filtering, fixes #1840
Closes #1840 Merge request
studip/studip!1209
parent
fc17e423
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/room_management/overview.php
+6
-6
6 additions, 6 deletions
app/controllers/room_management/overview.php
lib/models/resources/ResourceRequest.class.php
+37
-15
37 additions, 15 deletions
lib/models/resources/ResourceRequest.class.php
with
43 additions
and
21 deletions
app/controllers/room_management/overview.php
+
6
−
6
View file @
578969b9
...
...
@@ -148,10 +148,9 @@ class RoomManagement_OverviewController extends AuthenticatedController
//Global resource admins can see all room requests.
//Get the 10 latest requests:
$room_requests
=
RoomRequest
::
findBySql
(
"resource_requests.closed =
'0'
"resource_requests.closed =
0
ORDER BY chdate DESC
LIMIT 10"
,
[
'room_class_names'
=>
RoomManager
::
getAllRoomClassNames
()]
LIMIT 10"
);
}
else
{
//Users who aren't global resource admins see only the requests
...
...
@@ -175,7 +174,7 @@ class RoomManagement_OverviewController extends AuthenticatedController
AND
resource_categories.class_name IN ( :room_class_names )
AND
resource_requests.closed =
'0'
resource_requests.closed =
0
ORDER BY chdate DESC
LIMIT 10"
,
[
...
...
@@ -185,8 +184,9 @@ class RoomManagement_OverviewController extends AuthenticatedController
);
}
$this
->
room_requests
=
SimpleCollection
::
createFromArray
(
$room_requests
)
->
filter
(
function
(
$room_request
)
{
return
$room_request
->
getEndDate
()
->
getTimestamp
()
>
time
();
->
filter
(
function
(
RoomRequest
$room_request
)
{
return
!
$room_request
->
getEndDate
()
||
$room_request
->
getEndDate
()
->
getTimestamp
()
>
time
();
});
}
}
...
...
This diff is collapsed.
Click to expand it.
lib/models/resources/ResourceRequest.class.php
+
37
−
15
View file @
578969b9
...
...
@@ -50,8 +50,14 @@
* @property string mkdate database column
* @property string chdate database column
* @property Resource resource belongs_to Resource
* @property ResourceCategory $category belongs_to Category
* @property User requester belongs_to User
* @property User last_modifier belongs_to User
* @property Course $course belongs_to Course
* @property SeminarCycleDate $cycle belongs_to SeminarCycleDate
* @property CourseDate $date belongs_to CourseDate
* @property ResourceRequestProperty[]|SimpleORMapCollection $properties has_many ResourceRequestProperty
* @property ResourceRequestAppointment[]|SimpleORMapCollection $appointments has_many ResourceRequestAppointment
*
*
* The attributes begin and end are only used in simple resource requests.
...
...
@@ -801,46 +807,62 @@ class ResourceRequest extends SimpleORMap implements PrivacyObject, Studip\Calen
public
function
getStartDate
()
{
$start_date
=
new
DateTime
();
if
(
count
(
$this
->
appointments
))
{
$start_date
->
setTimestamp
(
$this
->
appointments
[
0
]
->
appointment
->
date
);
if
(
count
(
$this
->
appointments
)
>
0
)
{
$start_date
->
setTimestamp
(
$this
->
appointments
->
first
()
->
appointment
->
date
);
return
$start_date
;
}
elseif
(
$this
->
termin_id
)
{
}
if
(
$this
->
termin_id
)
{
$start_date
->
setTimestamp
(
$this
->
date
->
date
);
return
$start_date
;
}
elseif
(
$this
->
metadate_id
)
{
$start_date
->
setTimestamp
(
$this
->
cycle
->
dates
[
0
]
->
date
);
}
if
(
$this
->
metadate_id
)
{
$start_date
->
setTimestamp
(
$this
->
cycle
->
dates
->
first
()
->
date
);
return
$start_date
;
}
elseif
(
$this
->
course_id
)
{
$start_date
=
new
DateTime
();
$start_date
->
setTimestamp
(
$this
->
course
->
dates
[
0
]
->
date
);
}
if
(
$this
->
course_id
)
{
$start_date
->
setTimestamp
(
$this
->
course
->
dates
->
first
()
->
date
);
return
$start_date
;
}
elseif
(
$this
->
begin
)
{
}
if
(
$this
->
begin
)
{
$start_date
->
setTimestamp
(
$this
->
begin
);
return
$start_date
;
}
return
null
;
}
public
function
getEndDate
()
{
$end_date
=
new
DateTime
();
if
(
count
(
$this
->
appointments
))
{
if
(
count
(
$this
->
appointments
)
>
0
)
{
$end_date
->
setTimestamp
(
$this
->
appointments
->
last
()
->
appointment
->
end_time
);
return
$end_date
;
}
elseif
(
$this
->
termin_id
)
{
}
if
(
$this
->
termin_id
)
{
$end_date
->
setTimestamp
(
$this
->
date
->
end_time
);
return
$end_date
;
}
elseif
(
$this
->
metadate_id
)
{
}
if
(
$this
->
metadate_id
)
{
$end_date
->
setTimestamp
(
$this
->
cycle
->
dates
->
last
()
->
end_time
);
return
$end_date
;
}
elseif
(
$this
->
course_id
)
{
$end_date
=
new
DateTime
();
}
if
(
$this
->
course_id
)
{
$end_date
->
setTimestamp
(
$this
->
course
->
dates
->
last
()
->
end_time
);
return
$end_date
;
}
elseif
(
$this
->
end
)
{
}
if
(
$this
->
end
)
{
$end_date
->
setTimestamp
(
$this
->
end
);
return
$end_date
;
}
return
null
;
}
...
...
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