aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/resources/booking.php2
-rw-r--r--app/controllers/room_management/planning.php1
-rw-r--r--db/migrations/5.3.5_remove_bookings_repeat_quantity.php21
-rw-r--r--lib/models/resources/Resource.class.php4
-rw-r--r--lib/models/resources/ResourceBooking.class.php11
-rw-r--r--lib/raumzeit/SingleDate.class.php1
-rw-r--r--tests/functional/lib/models/resources/ResourceTest.php5
7 files changed, 28 insertions, 17 deletions
diff --git a/app/controllers/resources/booking.php b/app/controllers/resources/booking.php
index d05862d..63d1261 100644
--- a/app/controllers/resources/booking.php
+++ b/app/controllers/resources/booking.php
@@ -1598,7 +1598,7 @@ class Resources_BookingController extends AuthenticatedController
]
],
$this->booking->getRepetitionInterval(),
- $this->booking->repeat_quantity,
+ 0,
$this->booking->repeat_end,
$this->booking->preparation_time,
$this->booking->description,
diff --git a/app/controllers/room_management/planning.php b/app/controllers/room_management/planning.php
index d30d23c..7f01e86 100644
--- a/app/controllers/room_management/planning.php
+++ b/app/controllers/room_management/planning.php
@@ -934,7 +934,6 @@ class RoomManagement_PlanningController extends AuthenticatedController
$copy->preparation_time = $booking->preparation_time;
$copy->booking_type = $booking->booking_type;
$copy->repeat_end = $target_repeat_end->getTimestamp();
- $copy->repeat_quantity = $booking->repeat_quantity;
$copy->repetition_interval = $booking->repetition_interval;
$copy->internal_comment = $booking->internal_comment;
if ($this->step == 3) {
diff --git a/db/migrations/5.3.5_remove_bookings_repeat_quantity.php b/db/migrations/5.3.5_remove_bookings_repeat_quantity.php
new file mode 100644
index 0000000..d112906
--- /dev/null
+++ b/db/migrations/5.3.5_remove_bookings_repeat_quantity.php
@@ -0,0 +1,21 @@
+<?php
+
+class RemoveBookingsRepeatQuantity extends Migration
+{
+ public function description()
+ {
+ return 'Remove unused column repeat_quantity from table resource_bookings';
+ }
+
+ protected function up()
+ {
+ $query = 'ALTER TABLE resource_bookings DROP COLUMN repeat_quantity';
+ DBManager::get()->exec($query);
+ }
+
+ protected function down()
+ {
+ $query = 'ALTER TABLE resource_bookings ADD COLUMN repeat_quantity int(2) AFTER repeat_end';
+ DBManager::get()->exec($query);
+ }
+}
diff --git a/lib/models/resources/Resource.class.php b/lib/models/resources/Resource.class.php
index 99d335f..0a04dc5 100644
--- a/lib/models/resources/Resource.class.php
+++ b/lib/models/resources/Resource.class.php
@@ -645,7 +645,7 @@ class Resource extends SimpleORMap implements StudipItem
* DateInterval object.
* In case repetitions are specified by their amount set this
* parameter to null.
- * @param int $repetition_amount
+ * @param int $repetition_amount (obsolete, has no effect)
* @param int $preparation_time The preparation time which is needed before
* the real start time. This will be substracted
* from the begin timestamp and stored in an extra column of the
@@ -841,8 +841,6 @@ class Resource extends SimpleORMap implements StudipItem
} else {
$booking->repeat_end = $repetition_end_date;
}
- } elseif ($repetition_amount) {
- $booking->repeat_quantity = $repetition_amount;
}
$booking->repetition_interval = $repetition_interval->format('P%YY%MM%DD');
diff --git a/lib/models/resources/ResourceBooking.class.php b/lib/models/resources/ResourceBooking.class.php
index a8e65dd..3d8ec28 100644
--- a/lib/models/resources/ResourceBooking.class.php
+++ b/lib/models/resources/ResourceBooking.class.php
@@ -41,7 +41,6 @@
* 3 = planned booking (reservation from external tools)
*
* @property int repeat_end database column
- * @property int repeat_quantity database column
* @property string repetition_interval database column
* The repetition_interval column contains a date interval string in a
* format that is accepted by the DateInterval class constructor.
@@ -469,12 +468,12 @@ class ResourceBooking extends SimpleORMap implements PrivacyObject, Studip\Calen
}
if ($this->repetition_interval) {
- if (!($this->repeat_quantity || $this->repeat_end)) {
+ if (!$this->repeat_end) {
throw new InvalidArgumentException(
_('Es wurde ein Wiederholungsintervall ohne Begrenzung angegeben!')
);
}
- if ((!$this->repeat_quantity) && ($this->real_begin > $this->repeat_end)) {
+ if ($this->real_begin > $this->repeat_end) {
throw new InvalidArgumentException(
_('Der Startzeitpunkt darf nicht hinter dem Ende der Wiederholungen liegen!')
);
@@ -717,12 +716,12 @@ class ResourceBooking extends SimpleORMap implements PrivacyObject, Studip\Calen
if ($this->repetition_interval) {
$repetition_interval = $this->getRepetitionInterval();
- if (!($this->repeat_quantity || $this->repeat_end)) {
+ if (!$this->repeat_end) {
throw new InvalidArgumentException(
_('Es wurde ein Wiederholungsintervall ohne Begrenzung angegeben!')
);
}
- if ((!$this->repeat_quantity) && ($this->real_begin > $this->repeat_end)) {
+ if ($this->real_begin > $this->repeat_end) {
throw new InvalidArgumentException(
_('Der Startzeitpunkt darf nicht hinter dem Ende der Wiederholungen liegen!')
);
@@ -1208,7 +1207,7 @@ class ResourceBooking extends SimpleORMap implements PrivacyObject, Studip\Calen
)
];
- if (($this->repeat_quantity > 0) || $this->repeat_end) {
+ if ($this->repeat_end) {
//Repetition: we must check which repetition interval has been
//selected and then create entries for each repetition.
//Repetition starts with the begin date and ends with the
diff --git a/lib/raumzeit/SingleDate.class.php b/lib/raumzeit/SingleDate.class.php
index d5f1d00..289187f 100644
--- a/lib/raumzeit/SingleDate.class.php
+++ b/lib/raumzeit/SingleDate.class.php
@@ -645,7 +645,6 @@ class SingleDate
$changeAssign->begin = $this->date;
$changeAssign->end = $this->end_time;
$changeAssign->repeat_end = $this->end_time;
- $changeAssign->repeat_quantity = 0;
$changeAssign->repetition_interval = '';
if ($preparation_time > 0) {
$changeAssign->preparation_time = $preparation_time * 60;
diff --git a/tests/functional/lib/models/resources/ResourceTest.php b/tests/functional/lib/models/resources/ResourceTest.php
index 66eae55..75a082a 100644
--- a/tests/functional/lib/models/resources/ResourceTest.php
+++ b/tests/functional/lib/models/resources/ResourceTest.php
@@ -254,11 +254,6 @@ class ResourceTest extends \Codeception\Test\Unit
);
$this->assertEquals(
- null,
- $this->booking->repeat_quantity
- );
-
- $this->assertEquals(
'P00Y00M02D',
$this->booking->repetition_interval
);