diff --git a/CHANGELOG.md b/CHANGELOG.md index 81396d814..34d4e7092 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog Fab Manager -- Ability to configure allowing or preventing member book a machine/formation/event slot if he already have a reservation the same day at the same time +- Ability to configure the policy (allow or prevent) for members booking a machine/formation/event slot, if they already have a reservation the same day at the same time - Ability to create and delete periodic calendar availabilities (recurrence) - Ability to fully customize the home page - Automated setup assistant @@ -142,7 +142,7 @@ ## v4.0.4 2019 August 14 - Fix a bug: #140 VAT rate is erroneous in invoices. - Note: this bug was introduced in v4.0.3 and requires (if you are on v4.0.3) to regenerate the invoices since August 1st (if + Note: this bug was introduced in v4.0.3 and requires (if you are on v4.0.3) to regenerate the invoices since August 1st - [TODO DEPLOY] `rake fablab:maintenance:regenerate_invoices[2019,8]` ## v4.0.3 2019 August 01 diff --git a/app/assets/javascripts/controllers/events.js.erb b/app/assets/javascripts/controllers/events.js.erb index 4e1717060..d81811991 100644 --- a/app/assets/javascripts/controllers/events.js.erb +++ b/app/assets/javascripts/controllers/events.js.erb @@ -820,8 +820,7 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', ' }; /** - * find user reservations the same date at the same time with event - * + * Find user's reservations, the same date at the same time, with event */ var findReservationsAtSameTime = function () { let sameTimeReservations = [ @@ -829,18 +828,18 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', ' 'machine_reservations', 'space_reservations', 'events_reservations' - ].map(k => { - return _.filter($scope.ctrl.member[k], r => { + ].map(function(k) { + return _.filter($scope.ctrl.member[k], function(r) { if (r.reservable_type === 'Event' && r.reservable.id === $scope.event.id) { return false; - }; + } return moment($scope.event.start_time).isSame(r.start_at) || (moment($scope.event.end_time).isAfter(r.start_at) && moment($scope.event.end_time).isBefore(r.end_at)) || (moment($scope.event.start_time).isAfter(r.start_at) && moment($scope.event.start_time).isBefore(r.end_at)) || (moment($scope.event.start_time).isBefore(r.start_at) && moment($scope.event.end_time).isAfter(r.end_at)); }); }); - return _.union(...sameTimeReservations); + return _.union.apply(null, sameTimeReservations); }; /** diff --git a/app/assets/javascripts/directives/cart.js.erb b/app/assets/javascripts/directives/cart.js.erb index 816253088..efafc2763 100644 --- a/app/assets/javascripts/directives/cart.js.erb +++ b/app/assets/javascripts/directives/cart.js.erb @@ -77,15 +77,15 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs', 'machine_reservations', 'space_reservations', 'events_reservations' - ].map(k => { - return _.filter($scope.user[k], r => { + ].map(function (k) { + return _.filter($scope.user[k], function(r) { return slot.start.isSame(r.start_at) || (slot.end.isAfter(r.start_at) && slot.end.isBefore(r.end_at)) || (slot.start.isAfter(r.start_at) && slot.start.isBefore(r.end_at)) || (slot.start.isBefore(r.start_at) && slot.end.isAfter(r.end_at)); - }); + }) }); - sameTimeReservations = _.union(...sameTimeReservations); + sameTimeReservations = _.union.apply(null, sameTimeReservations); if (sameTimeReservations.length > 0) { const modalInstance = $uibModal.open({ animation: true, @@ -93,7 +93,7 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs', size: 'md', controller: 'ReserveSlotSameTimeController', resolve: { - sameTimeReservations: function() { return sameTimeReservations; }, + sameTimeReservations: function() { return sameTimeReservations; } } }); modalInstance.result.then(function(res) { diff --git a/doc/environment.md b/doc/environment.md index 7cef275b4..8e43aadb8 100644 --- a/doc/environment.md +++ b/doc/environment.md @@ -111,7 +111,7 @@ If set to 'false' the phone number won't be required to register a new user on t BOOK_SLOT_AT_SAME_TIME -If set to 'false' user won't book a machine/formation/event slot if he already have a reservation the same day at the same time. +If set to 'false', users won't be able to book a machine/formation/event slot if they already have a reservation the same day at the same time. USER_CONFIRMATION_NEEDED_TO_SIGN_IN