Skip to content
Snippets Groups Projects
Commit 972e8b89 authored by David Siegfried's avatar David Siegfried Committed by Elmar Ludwig
Browse files

use sorm-relations, refs #707

Merge request studip/studip!662
parent e552f45f
No related branches found
No related tags found
No related merge requests found
...@@ -1417,7 +1417,7 @@ class Course_TimesroomsController extends AuthenticatedController ...@@ -1417,7 +1417,7 @@ class Course_TimesroomsController extends AuthenticatedController
/** /**
* Deletes a date. * Deletes a date.
* *
* @param String $termin CourseDate of the date * @param CourseDate $termin CourseDate of the date
* @param String $cancel_comment cancel mesessage (if non empty) * @param String $cancel_comment cancel mesessage (if non empty)
* *
* @return CourseDate|CourseExDate deleted date * @return CourseDate|CourseExDate deleted date
...@@ -1425,7 +1425,6 @@ class Course_TimesroomsController extends AuthenticatedController ...@@ -1425,7 +1425,6 @@ 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();
...@@ -1441,12 +1440,6 @@ class Course_TimesroomsController extends AuthenticatedController ...@@ -1441,12 +1440,6 @@ 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]
);
} }
} }
......
...@@ -100,6 +100,11 @@ class CourseDate extends SimpleORMap implements PrivacyObject ...@@ -100,6 +100,11 @@ class CourseDate extends SimpleORMap implements PrivacyObject
'assoc_foreign_key' => 'termin_id', 'assoc_foreign_key' => 'termin_id',
'on_delete' => 'delete', 'on_delete' => 'delete',
]; ];
$config['has_many']['resource_request_appointments'] = [
'class_name' => ResourceRequestAppointment::class,
'assoc_foreign_key' => 'appointment_id',
'on_delete' => 'delete',
];
$config['default_values']['date_typ'] = 1; $config['default_values']['date_typ'] = 1;
parent::configure($config); parent::configure($config);
} }
......
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