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
Jan-Hendrik Willms
Stud.IP
Commits
b4f60d28
Commit
b4f60d28
authored
6 months ago
by
Moritz Strohm
Browse files
Options
Downloads
Patches
Plain Diff
TIC 4387, closes #4387
Closes #4387 Merge request
studip/studip!3350
parent
35304570
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/controllers/course/timesrooms.php
+68
-5
68 additions, 5 deletions
app/controllers/course/timesrooms.php
lib/models/resources/Resource.php
+2
-2
2 additions, 2 deletions
lib/models/resources/Resource.php
with
70 additions
and
7 deletions
app/controllers/course/timesrooms.php
+
68
−
5
View file @
b4f60d28
<?php
use
Studip\ResourceBookingException
;
use
Studip\ResourceBookingOverlapException
;
/**
* @author David Siegfried <david.siegfried@uni-vechta.de>
* @license GPL2 or any later version
...
...
@@ -528,11 +531,71 @@ class Course_TimesroomsController extends AuthenticatedController
try
{
$failure
=
!
$termin
->
bookRoom
(
$room
,
$preparation_time
?:
0
);
}
catch
(
ResourceBookingException
|
ResourceBookingOverlapException
$e
)
{
PageLayout
::
postError
(
sprintf
(
_
(
'Der angegebene Raum konnte für den Termin %1$s nicht gebucht werden: %2$s'
),
'<strong>'
.
htmlReady
(
$termin
->
getFullName
())
.
'</strong>'
,
$e
->
getMessage
()
));
$course
=
$e
->
getRange
();
$message_links
=
[];
if
(
$course
instanceof
Course
)
{
if
(
$course
->
isEditableByUser
())
{
//Link to the times/rooms page:
$link
=
new
LinkElement
(
_
(
'Direkt zur Veranstaltung'
),
URLHelper
::
getURL
(
'dispatch.php/course/timesrooms/index'
,
[
'cid'
=>
$course
->
id
]),
Icon
::
create
(
'link-intern'
)
);
$message_links
[]
=
$link
->
render
();
}
elseif
(
$course
->
isAccessibleToUser
())
{
//Link to the details page:
$link
=
new
LinkElement
(
_
(
'Direkt zur Veranstaltung'
),
URLHelper
::
getURL
(
'course/details/index'
,
[
'cid'
=>
$course
->
id
]),
Icon
::
create
(
'link-intern'
)
);
$message_links
[]
=
$link
->
render
();
}
}
if
(
$room
->
userHasBookingRights
(
User
::
findCurrent
()))
{
$room_link
=
new
LinkElement
(
_
(
'Zum Belegungsplan'
),
$room
->
getActionURL
(
'booking_plan'
)
);
$message_links
[]
=
$room_link
->
render
();
}
if
(
$e
instanceof
ResourceBookingException
)
{
PageLayout
::
postError
(
sprintf
(
_
(
'Der angegebene Raum konnte für den Termin %1$s nicht gebucht werden: %2$s'
),
'<strong>'
.
htmlReady
(
$termin
->
getFullName
())
.
'</strong>'
,
$e
->
getMessage
()
),
$message_links
);
}
else
{
//$e is a ResourceBookingOverlapException
if
(
$course
instanceof
Course
)
{
PageLayout
::
postError
(
studip_interpolate
(
_
(
'Der Raum %{room_name} wird an dem Termin %{date} bereits durch die Veranstaltung %{course_name} belegt.'
),
[
'room_name'
=>
$room
->
name
,
'date'
=>
$termin
->
getFullName
(),
'course_name'
=>
$course
->
name
]
),
$message_links
);
}
else
{
PageLayout
::
postError
(
studip_interpolate
(
_
(
'Der Raum %{room_name} wird an dem Termin %{date} bereits durch eine andere Veranstaltung belegt.'
),
[
'room_name'
=>
$room
->
name
,
'date'
=>
$termin
->
getFullName
()
]
),
$message_links
);
}
}
}
}
if
(
$failure
)
{
...
...
This diff is collapsed.
Click to expand it.
lib/models/resources/Resource.php
+
2
−
2
View file @
b4f60d28
...
...
@@ -859,7 +859,7 @@ class Resource extends SimpleORMap implements StudipItem
$booking
->
store
(
$force_booking
);
}
catch
(
ResourceBookingOverlapException
$e
)
{
if
(
$begin
->
format
(
'Ymd'
)
==
$end
->
format
(
'Ymd'
))
{
throw
new
ResourceBookingException
(
throw
new
ResourceBooking
Overlap
Exception
(
sprintf
(
_
(
'%1$s: Die Buchung vom %2$s bis %3$s konnte wegen Überlappungen nicht gespeichert werden: %4$s'
),
$this
->
getFullName
(),
...
...
@@ -869,7 +869,7 @@ class Resource extends SimpleORMap implements StudipItem
)
);
}
else
{
throw
new
ResourceBookingException
(
throw
new
ResourceBooking
Overlap
Exception
(
sprintf
(
_
(
'%1$s: Die Buchung vom %2$s bis %3$s konnte wegen Überlappungen nicht gespeichert werden: %4$s'
),
$this
->
getFullName
(),
...
...
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