From 668f856b0767febe489518380d3f4efd6236d164 Mon Sep 17 00:00:00 2001
From: Moritz Strohm <strohm@data-quest.de>
Date: Thu, 28 Apr 2022 18:34:53 +0200
Subject: [PATCH] CourseDateAndRoomBookingExporter: fixed an error with dates
 and course_name

---
 .../exporters/CourseDateAndRoomBookingExporter.class.php  | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/classes/exporters/CourseDateAndRoomBookingExporter.class.php b/classes/exporters/CourseDateAndRoomBookingExporter.class.php
index ae51bd0..3c3a3b2 100644
--- a/classes/exporters/CourseDateAndRoomBookingExporter.class.php
+++ b/classes/exporters/CourseDateAndRoomBookingExporter.class.php
@@ -522,10 +522,10 @@ class CourseDateAndRoomBookingExporter extends Exporter
                 $course_dates_stmt_sql .= "INNER JOIN `resource_bookings` rb
                     ON `termine`.`termin_id` = rb.`range_id` ";
             }
-            if ($with_course_name) {
-                $course_dates_stmt_sql .= "LEFT JOIN `seminare`
-                    ON `termine`.`range_id` = `seminare`.`seminar_id` ";
-            }
+        }
+        if (!$institute_ids && $with_course_name) {
+            $course_dates_stmt_sql .= "LEFT JOIN `seminare`
+                ON `termine`.`range_id` = `seminare`.`seminar_id` ";
         }
         $course_dates_stmt_sql .= "WHERE ";
         $course_dates_stmt_sql .= "(
-- 
GitLab