Skip to content
Snippets Groups Projects
Commit 9740e362 authored by Viktoria Wiebe's avatar Viktoria Wiebe Committed by Elmar Ludwig
Browse files

Deletes all resource request appointments #707

Closes #707

Merge request studip/studip!655
parent 4d6c4826
No related branches found
No related tags found
No related merge requests found
......@@ -1362,6 +1362,7 @@ class Course_TimesroomsController extends AuthenticatedController
private function deleteDate($termin, $cancel_comment)
{
$seminar_id = $termin->range_id;
$termin_id = $termin->id;
$termin_room = $termin->getRoomName();
$termin_date = $termin->getFullname();
$has_topics = $termin->topics->count();
......@@ -1377,6 +1378,12 @@ class Course_TimesroomsController extends AuthenticatedController
} else {
if ($termin->delete()) {
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
*/
public function getTypeString($short = false)
{
if (count($this->appointments)) {
if (count($this->appointments) > 1) {
if ($short) {
return _('Einzeltermine');
} else {
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) {
if ($short) {
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