Jottyfan
2023-01-26 20:39:26 +01:00
parent 0bb92f511c
commit e6e625306d
10 changed files with 47 additions and 16 deletions

View File

@@ -69,4 +69,11 @@ public class RegistrationController extends CommonController {
service.removeBooking(id);
return "redirect:/dashboard";
}
@GetMapping("/registration/toggleconsent/{id}")
public String toggleConsent(@PathVariable Integer id, final Model model) {
super.setupSession(model, request);
service.toggleConsent(id);
return "redirect:/dashboard";
}
}

View File

@@ -177,7 +177,7 @@ public class RegistrationGateway {
// register the person for camp participation
InsertValuesStep13<TPersonRecord, String, String, EnumSex, LocalDate, String, String, String, String, String, EnumCamprole, Integer, String, Integer> sql2 = DSL
.using(t)
// @formatter:off
// @formatter:off
.insertInto(T_PERSON,
T_PERSON.FORENAME,
T_PERSON.SURNAME,
@@ -295,7 +295,8 @@ public class RegistrationGateway {
rssMessage.append(" hat die Buchung von ");
rssMessage.append(forename).append(" ").append(surname);
rssMessage.append(" an ");
rssMessage.append(campname).append(" ").append(arrive == null ? "" : arrive.format(DateTimeFormatter.ofPattern("YYYY")));
rssMessage.append(campname).append(" ")
.append(arrive == null ? "" : arrive.format(DateTimeFormatter.ofPattern("YYYY")));
rssMessage.append(" storniert.");
DeleteConditionStep<TPersondocumentRecord> sql1 = DSL.using(t).deleteFrom(T_PERSONDOCUMENT)
@@ -345,8 +346,7 @@ public class RegistrationGateway {
/**
* remove login
*
* @param bean
* containing username of dataset to be removed
* @param bean containing username of dataset to be removed
* @throws DataAccessExceptionF
*/
public void removeLogin(ProfileBean bean) throws DataAccessException {
@@ -392,4 +392,22 @@ public class RegistrationGateway {
sql3.execute();
});
}
/**
* toggle the consent for photo
*
* @param id the ID of the person
*/
public void toggleConsent(Integer id) {
Boolean consent = jooq.selectFrom(T_PERSON).where(T_PERSON.PK.eq(id)).fetchOne().getConsentCatalogPhoto();
consent = consent == null ? true : !consent;
UpdateConditionStep<TPersonRecord> sql = jooq
// @formatter:off
.update(T_PERSON)
.set(T_PERSON.CONSENT_CATALOG_PHOTO, consent)
.where(T_PERSON.PK.eq(id));
// @formatter:on
LOGGER.debug("{}", sql.toString());
sql.execute();
}
}

View File

@@ -78,4 +78,8 @@ public class RegistrationService {
public Boolean removeBooking(Integer id) {
return gateway.removeBooking(id) > 0;
}
public void toggleConsent(Integer id) {
gateway.toggleConsent(id);
}
}