diff --git a/src/main/java/alfio/controller/ReservationController.java b/src/main/java/alfio/controller/ReservationController.java index f6e46a72e2..9ddd3dc3ca 100644 --- a/src/main/java/alfio/controller/ReservationController.java +++ b/src/main/java/alfio/controller/ReservationController.java @@ -113,6 +113,9 @@ public String showPaymentPage(@PathVariable("eventName") String eventName, return redirectReservation(Optional.of(reservation), eventName, reservationId); } + Configuration.ConfigurationPathKey forceAssignmentKey = Configuration.from(event.getOrganizationId(), event.getId(), ConfigurationKeys.FORCE_TICKET_OWNER_ASSIGNMENT_AT_RESERVATION); + boolean forceAssignment = configurationManager.getBooleanConfigValue(forceAssignmentKey, false); + List ticketsInReservation = ticketReservationManager.findTicketsInReservation(reservationId); if (Boolean.TRUE.equals(isPaypalSuccess) && paypalPayerID != null && paypalPaymentId != null) { model.addAttribute("paypalPaymentId", paypalPaymentId) @@ -126,11 +129,11 @@ public String showPaymentPage(@PathVariable("eventName") String eventName, .addAttribute("hmac", hmac) .addAttribute("postponeAssignment", Boolean.TRUE.equals(postponeAssignment)) .addAttribute("invoiceRequested", Boolean.TRUE.equals(invoiceRequested)) - .addAttribute("showPostpone", Boolean.TRUE.equals(postponeAssignment)); + .addAttribute("showPostpone", !forceAssignment && Boolean.TRUE.equals(postponeAssignment)); } else { model.addAttribute("paypalCheckoutConfirmation", false) .addAttribute("postponeAssignment", false) - .addAttribute("showPostpone", ticketsInReservation.size() > 1); + .addAttribute("showPostpone", !forceAssignment && ticketsInReservation.size() > 1); } try { @@ -421,6 +424,11 @@ public String handleReservation(@PathVariable("eventName") String eventName, bindingResult.reject(ErrorsCode.STEP_2_CAPTCHA_VALIDATION_FAILED); } + Configuration.ConfigurationPathKey forceAssignmentKey = Configuration.from(event.getOrganizationId(), event.getId(), ConfigurationKeys.FORCE_TICKET_OWNER_ASSIGNMENT_AT_RESERVATION); + boolean forceAssignment = configurationManager.getBooleanConfigValue(forceAssignmentKey, false); + if(forceAssignment) { + paymentForm.setPostponeAssignment(false); + } if(paymentForm.getPaymentMethod() != PaymentProxy.PAYPAL || !paymentForm.hasPaypalTokens()) { if(!paymentForm.isPostponeAssignment() && !ticketRepository.checkTicketUUIDs(reservationId, paymentForm.getTickets().keySet())) { bindingResult.reject(ErrorsCode.STEP_2_MISSING_ATTENDEE_DATA); diff --git a/src/main/java/alfio/model/system/ConfigurationKeys.java b/src/main/java/alfio/model/system/ConfigurationKeys.java index e0d92886b8..d2ce68195f 100644 --- a/src/main/java/alfio/model/system/ConfigurationKeys.java +++ b/src/main/java/alfio/model/system/ConfigurationKeys.java @@ -65,6 +65,7 @@ public enum ConfigurationKeys { ASSIGNMENT_REMINDER_INTERVAL("How long should be the 'quiet period' (in days) between the reminders? (default: 3 days)", false, SettingCategory.GENERAL, ComponentType.TEXT, false, EnumSet.of(SYSTEM, ORGANIZATION, EVENT), true), OPTIONAL_DATA_REMINDER_ENABLED("Send a reminder for optional data? (default: true)", false, SettingCategory.GENERAL, ComponentType.BOOLEAN, false, EnumSet.of(SYSTEM, ORGANIZATION, EVENT), true), RESERVATION_TIMEOUT("The amount of time, in MINUTES, that the user have to complete the reservation process (default: 25 min)", false, SettingCategory.GENERAL, ComponentType.TEXT, false, EnumSet.of(SYSTEM, ORGANIZATION, EVENT), true), + FORCE_TICKET_OWNER_ASSIGNMENT_AT_RESERVATION("Force ticket owner assignment at reservation time", false, SettingCategory.GENERAL, ComponentType.BOOLEAN, false, EnumSet.of(SYSTEM, ORGANIZATION, EVENT), true), // MAILER_TYPE("Mailer type (if not set, default will be disabled)", false, SettingCategory.MAIL, ComponentType.TEXT, true, EnumSet.of(SYSTEM), true),//valid values: smtp | mailgun