summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2017-09-20 01:24:56 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2017-09-20 01:24:56 +0200
commit5b12eecdd63dd6fc64e988cd2ff6b5fb89d10429 (patch)
tree4504f04219572069f401d2cf14a85fced8485b87
parent3141c3f8b5fd1a45d337c1f5540cb715a5a7dbbf (diff)
parente1d44e60e35d126dbd05aefa5f897fad16fbfceb (diff)
Merge remote-tracking branch 'engelsystem/feature-igel-rewrite'
-rw-r--r--includes/controller/shift_entries_controller.php11
-rw-r--r--includes/view/ShiftCalendarShiftRenderer.php14
-rw-r--r--public/.htaccess1
3 files changed, 14 insertions, 12 deletions
diff --git a/includes/controller/shift_entries_controller.php b/includes/controller/shift_entries_controller.php
index 150db2e9..15aeaab1 100644
--- a/includes/controller/shift_entries_controller.php
+++ b/includes/controller/shift_entries_controller.php
@@ -32,14 +32,19 @@ function shift_entry_add_controller()
}
$shift['Name'] = $room_array[$shift['RID']];
- $type_id = 0;
+ $type_id = null;
if ($request->has('type_id') && preg_match('/^\d+$/', $request->input('type_id'))) {
$type_id = $request->input('type_id');
- } else {
- redirect(page_link_to('user_shifts'));
}
if (in_array('user_shifts_admin', $privileges) || in_array('shiftentry_edit_angeltype_supporter', $privileges)) {
+ if($type_id == null) {
+ // If no angeltype id is given, then select first existing angeltype.
+ $needed_angeltypes = NeededAngelTypes_by_shift($shift_id);
+ if(count($needed_angeltypes) > 0) {
+ $type_id = $needed_angeltypes[0]['id'];
+ }
+ }
$type = AngelType($type_id);
} else {
// TODO: Move queries to model
diff --git a/includes/view/ShiftCalendarShiftRenderer.php b/includes/view/ShiftCalendarShiftRenderer.php
index 0e5fc8c3..3e59d61a 100644
--- a/includes/view/ShiftCalendarShiftRenderer.php
+++ b/includes/view/ShiftCalendarShiftRenderer.php
@@ -124,14 +124,12 @@ class ShiftCalendarShiftRenderer
}
if (in_array('user_shifts_admin', $privileges)) {
- $html .= '<li class="list-group-item">' . _('Add more angels') . ':';
- foreach ($needed_angeltypes as $angeltype) {
- $html .= ' ' . button(
- page_link_to('user_shifts', ['shift_id' => $shift['SID'], 'type_id' => $angeltype['id']]),
- $angeltype['name'],
- 'btn-xs'
- );
- }
+ $html .= '<li class="list-group-item">';
+ $html .= button(
+ page_link_to('user_shifts', ['shift_id' => $shift['SID']]),
+ glyph('plus') . _('Add more angels'),
+ 'btn-xs'
+ );
$html .= '</li>';
}
if ($html != '') {
diff --git a/public/.htaccess b/public/.htaccess
index 60c6685d..c9d40187 100644
--- a/public/.htaccess
+++ b/public/.htaccess
@@ -1,6 +1,5 @@
<IfModule mod_rewrite.c>
RewriteEngine on
- RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f