diff --git a/app/controllers/resources/booking.php b/app/controllers/resources/booking.php index d05862d78777c1d6dde74a72c9c1072d1e211117..63d126168d62d0a46e0eb99a4607c188ac0a0873 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 d30d23c90ca6cf63b1721f13d7acfa5f6b09bcea..7f01e8647926cff37ba005c829b385bcee681d06 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 0000000000000000000000000000000000000000..d112906af81b9baf8018338be89b4f63632af755 --- /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 99d335f3357efd8675e3630536e9337b912a3271..0a04dc51a69dc4f0baf0198f0e7d6c03f8ddc323 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 a8e65dd07e46e742d25a0b9fac3b579f8f79644e..3d8ec28991643a9804513fd451d8ea1ca0c2059b 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 d5f1d00423e76eef45886a5cc51c6193d18f918a..289187fd58d8a4eda6d8ff448532718eb4e5f5a1 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 66eae5583bb7a50be28ed54ef80c8c91294ff391..75a082a0fb6bc0fbd5dac23b9067e1dd637df5d7 100644 --- a/tests/functional/lib/models/resources/ResourceTest.php +++ b/tests/functional/lib/models/resources/ResourceTest.php @@ -253,11 +253,6 @@ class ResourceTest extends \Codeception\Test\Unit $this->booking->repeat_end ); - $this->assertEquals( - null, - $this->booking->repeat_quantity - ); - $this->assertEquals( 'P00Y00M02D', $this->booking->repetition_interval