1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-20 14:54:15 +01:00

(bug) admin cannot book an event for himself

This commit is contained in:
Sylvain 2023-01-25 12:37:06 +01:00
parent c1159b2aed
commit 0ac3caf96a
2 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,7 @@
# Changelog Fab-manager
- Fix a bug: updating plan prices
- Fix a bug: admin cannot book an event for himself
## v5.6.6 2023 January 23

View File

@ -329,16 +329,15 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
return Wallet.getWalletByUser({ user_id: $scope.ctrl.member.id }, function (wallet) {
const amountToPay = helpers.getAmountToPay($scope.reserve.amountTotal, wallet.amount);
if ((AuthService.isAuthorized(['member']) && amountToPay > 0)
|| (AuthService.isAuthorized('manager') && $scope.ctrl.member.id === $rootScope.currentUser.id && amountToPay > 0)) {
if ((AuthService.isAuthorized('member') && amountToPay > 0)
|| (AuthService.isAuthorized(['manager', 'admin']) && $scope.ctrl.member.id === $rootScope.currentUser.id && amountToPay > 0)) {
if (settingsPromise.online_payment_module !== 'true') {
growl.error(_t('app.public.events_show.online_payment_disabled'));
} else {
return payOnline(reservation);
}
} else {
if (AuthService.isAuthorized('admin')
|| (AuthService.isAuthorized('manager') && $scope.ctrl.member.id !== $rootScope.currentUser.id)
if (AuthService.isAuthorized(['manager', 'admin']) && $scope.ctrl.member.id !== $rootScope.currentUser.id
|| amountToPay === 0) {
return payOnSite(reservation);
}