Skip to content
Snippets Groups Projects
Commit 8c5fbb98 authored by Viktoria Wiebe's avatar Viktoria Wiebe Committed by David Siegfried
Browse files

Deletes all resource request appointments #707

Closes #707

Merge request studip/studip!655
parent bd504e86
No related branches found
No related tags found
No related merge requests found
...@@ -1425,6 +1425,7 @@ class Course_TimesroomsController extends AuthenticatedController ...@@ -1425,6 +1425,7 @@ class Course_TimesroomsController extends AuthenticatedController
private function deleteDate($termin, $cancel_comment) private function deleteDate($termin, $cancel_comment)
{ {
$seminar_id = $termin->range_id; $seminar_id = $termin->range_id;
$termin_id = $termin->id;
$termin_room = $termin->getRoomName(); $termin_room = $termin->getRoomName();
$termin_date = $termin->getFullname(); $termin_date = $termin->getFullname();
$has_topics = $termin->topics->count(); $has_topics = $termin->topics->count();
...@@ -1440,6 +1441,12 @@ class Course_TimesroomsController extends AuthenticatedController ...@@ -1440,6 +1441,12 @@ class Course_TimesroomsController extends AuthenticatedController
} else { } else {
if ($termin->delete()) { if ($termin->delete()) {
StudipLog::log("SEM_DELETE_SINGLEDATE", $termin->id, $seminar_id, 'appointment cancelled'); StudipLog::log("SEM_DELETE_SINGLEDATE", $termin->id, $seminar_id, 'appointment cancelled');
// delete attached resource request appointments if they exist
ResourceRequestAppointment::deleteBySQL(
"appointment_id = ?",
[$termin_id]
);
} }
} }
......
<?php
class Biest707 extends Migration
{
public function description()
{
return 'Removes leftover entries of deleted course dates from resource request appointments';
}
public function up()
{
DBManager::get()->exec("DELETE FROM resource_request_appointments WHERE appointment_id NOT IN (SELECT termin_id FROM termine)");
}
}
...@@ -1421,12 +1421,19 @@ class ResourceRequest extends SimpleORMap implements PrivacyObject, Studip\Calen ...@@ -1421,12 +1421,19 @@ class ResourceRequest extends SimpleORMap implements PrivacyObject, Studip\Calen
*/ */
public function getTypeString($short = false) public function getTypeString($short = false)
{ {
if (count($this->appointments)) { if (count($this->appointments) > 1) {
if ($short) { if ($short) {
return _('Einzeltermine'); return _('Einzeltermine');
} else { } else {
return sprintf(_('Einzeltermine (%sx)'), count($this->appointments)); return sprintf(_('Einzeltermine (%sx)'), count($this->appointments));
} }
} elseif (count($this->appointments) == 1) {
if ($short) {
return _('Einzeltermin');
} else {
return sprintf(_('Einzeltermin (%s)'),
$this->appointments[0]->appointment->getFullname());
}
} elseif ($this->date) { } elseif ($this->date) {
if ($short) { if ($short) {
return _('Einzeltermin'); return _('Einzeltermin');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment