Skip to content

Commit 80c2aac

Browse files
committed
Adds reservation cancellation path to resources
1 parent 1aea5c3 commit 80c2aac

27 files changed

Lines changed: 1078 additions & 25 deletions

src/onegov/org/forms/resource.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,12 @@ class ResourceBaseForm(Form):
380380
),
381381
)
382382

383+
allow_cancellation_requests = BooleanField(
384+
label=_('Enable cancel reservation'),
385+
fieldset=_('Cancellation'),
386+
default=False,
387+
)
388+
383389
def on_request(self) -> None:
384390
if hasattr(self.model, 'type'):
385391
if self.model.type != 'room':

src/onegov/org/locale/de_CH/LC_MESSAGES/onegov.org.po

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5644,6 +5644,12 @@ msgstr "1 Reservation hinzugefügt."
56445644
msgid "${count} reservations added."
56455645
msgstr "${count} Reservationen hinzugefügt."
56465646

5647+
msgid "Cancellation requested for 1 reservation."
5648+
msgstr "Stornierung für 1 Reservation beantragt."
5649+
5650+
msgid "Cancellation requested for ${count} reservations."
5651+
msgstr "Stornierung für ${count} Reservationen beantragt."
5652+
56475653
msgid "1 reservation adjusted:"
56485654
msgstr "1 Reservation angepasst:"
56495655

@@ -8064,6 +8070,69 @@ msgstr "Der Benutzer wurde erfolgreich erstellt"
80648070
msgid "Please enter your e-mail address in order to continue"
80658071
msgstr "Bitte geben Sie ihre E-Mail Adresse ein um fortzufahren"
80668072

8073+
msgid "Enable cancel reservation"
8074+
msgstr "Stornierung von Reservationen erlauben"
8075+
8076+
msgid "Cancellation"
8077+
msgstr "Stornierung"
8078+
8079+
msgid "Request cancellation"
8080+
msgstr "Stornierung beantragen"
8081+
8082+
msgid "Request Cancellation"
8083+
msgstr "Stornierung beantragen"
8084+
8085+
msgid "You are about to submit a cancellation request for the following reservations. An administrator will review your request and confirm the cancellation."
8086+
msgstr "Sie sind dabei, eine Stornierungsanfrage für die folgenden Reservationen einzureichen. Ein Administrator wird Ihre Anfrage prüfen und die Stornierung bestätigen."
8087+
8088+
msgid "Would you like to cancel your reservation?"
8089+
msgstr "Möchten Sie Ihre Reservation stornieren?"
8090+
8091+
msgid "Your cancellation request has been submitted. You will be notified once it has been processed."
8092+
msgstr "Ihre Stornierungsanfrage wurde eingereicht. Sie werden benachrichtigt, sobald sie bearbeitet wurde."
8093+
8094+
msgid "A cancellation request can only be submitted for accepted reservations."
8095+
msgstr "Eine Stornierungsanfrage kann nur für angenommene Reservationen eingereicht werden."
8096+
8097+
msgid "A cancellation request has already been submitted."
8098+
msgstr "Eine Stornierungsanfrage wurde bereits eingereicht."
8099+
8100+
msgid "A cancellation request cannot be submitted because the payment has already been invoiced or paid."
8101+
msgstr "Eine Stornierungsanfrage kann nicht eingereicht werden, da die Zahlung bereits in Rechnung gestellt oder bezahlt wurde."
8102+
8103+
msgid "Accept cancellation"
8104+
msgstr "Stornierung akzeptieren"
8105+
8106+
msgid "Do you really want to accept the cancellation?"
8107+
msgstr "Möchten Sie die Stornierung wirklich akzeptieren?"
8108+
8109+
msgid "This will cancel the reservation and cannot be undone."
8110+
msgstr "Damit wird die Reservation storniert und kann nicht rückgängig gemacht werden."
8111+
8112+
msgid "Cancellation accepted."
8113+
msgstr "Stornierung akzeptiert."
8114+
8115+
msgid "The cancellation request was accepted."
8116+
msgstr "Die Stornierungsanfrage wurde akzeptiert."
8117+
8118+
msgid "A cancellation has been requested for this reservation."
8119+
msgstr "Für diese Reservation wurde eine Stornierung beantragt."
8120+
8121+
msgid "Cancellation accepted"
8122+
msgstr "Stornierung akzeptiert"
8123+
8124+
msgid "${org} Accepted Cancellation"
8125+
msgstr "${org} Stornierung akzeptiert"
8126+
8127+
msgid "The following reservations have been cancelled:"
8128+
msgstr "Die folgenden Reservationen wurden storniert:"
8129+
8130+
msgid "This is a notification for accepted cancellation requests for ${organisation}. If you no longer wish to receive these notifications, please contact an administrator so they can remove you from the recipients list."
8131+
msgstr "Dies ist eine Benachrichtigung für akzeptierte Stornierungsanfragen für ${organisation}. Wenn Sie diese Benachrichtigungen nicht mehr erhalten möchten, wenden Sie sich bitte an einen Administrator."
8132+
8133+
msgid "Your cancellation request has been accepted. The following reservations have been cancelled:"
8134+
msgstr "Ihre Stornierungsanfrage wurde akzeptiert. Die folgenden Reservationen wurden storniert:"
8135+
80678136
#~ msgid "e.g. 07:00 or 07:00, 14:30"
80688137
#~ msgstr "z.B. 07:00 oder 07:00, 14:30"
80698138

src/onegov/org/locale/fr_CH/LC_MESSAGES/onegov.org.po

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5653,6 +5653,12 @@ msgstr "1 réservation ajoutée."
56535653
msgid "${count} reservations added."
56545654
msgstr "${count} réservations ajoutées."
56555655

5656+
msgid "Cancellation requested for 1 reservation."
5657+
msgstr "Demande d'annulation pour 1 réservation."
5658+
5659+
msgid "Cancellation requested for ${count} reservations."
5660+
msgstr "Demande d'annulation pour ${count} réservations."
5661+
56565662
msgid "1 reservation adjusted:"
56575663
msgstr "1 réservation ajustée:"
56585664

@@ -8066,6 +8072,69 @@ msgstr "L'utilisateur a bien été créé"
80668072
msgid "Please enter your e-mail address in order to continue"
80678073
msgstr "Veuillez saisir votre adresse e-mail pour continuer"
80688074

8075+
msgid "Enable cancel reservation"
8076+
msgstr "Permettre l'annulation de réservations"
8077+
8078+
msgid "Cancellation"
8079+
msgstr "Annulation"
8080+
8081+
msgid "Request cancellation"
8082+
msgstr "Demander l'annulation"
8083+
8084+
msgid "Request Cancellation"
8085+
msgstr "Demander l'annulation"
8086+
8087+
msgid "You are about to submit a cancellation request for the following reservations. An administrator will review your request and confirm the cancellation."
8088+
msgstr "Vous êtes sur le point de soumettre une demande d'annulation pour les réservations suivantes. Un administrateur examinera votre demande et confirmera l'annulation."
8089+
8090+
msgid "Would you like to cancel your reservation?"
8091+
msgstr "Souhaitez-vous annuler votre réservation?"
8092+
8093+
msgid "Your cancellation request has been submitted. You will be notified once it has been processed."
8094+
msgstr "Votre demande d'annulation a été soumise. Vous serez informé(e) une fois qu'elle aura été traitée."
8095+
8096+
msgid "A cancellation request can only be submitted for accepted reservations."
8097+
msgstr "Une demande d'annulation ne peut être soumise que pour des réservations acceptées."
8098+
8099+
msgid "A cancellation request has already been submitted."
8100+
msgstr "Une demande d'annulation a déjà été soumise."
8101+
8102+
msgid "A cancellation request cannot be submitted because the payment has already been invoiced or paid."
8103+
msgstr "Une demande d'annulation ne peut pas être soumise car le paiement a déjà été facturé ou payé."
8104+
8105+
msgid "Accept cancellation"
8106+
msgstr "Accepter l'annulation"
8107+
8108+
msgid "Do you really want to accept the cancellation?"
8109+
msgstr "Voulez-vous vraiment accepter l'annulation?"
8110+
8111+
msgid "This will cancel the reservation and cannot be undone."
8112+
msgstr "Cela annulera la réservation et ne peut pas être annulé."
8113+
8114+
msgid "Cancellation accepted."
8115+
msgstr "Annulation acceptée."
8116+
8117+
msgid "The cancellation request was accepted."
8118+
msgstr "La demande d'annulation a été acceptée."
8119+
8120+
msgid "A cancellation has been requested for this reservation."
8121+
msgstr "Une annulation a été demandée pour cette réservation."
8122+
8123+
msgid "Cancellation accepted"
8124+
msgstr "Annulation acceptée"
8125+
8126+
msgid "${org} Accepted Cancellation"
8127+
msgstr "${org} Annulation acceptée"
8128+
8129+
msgid "The following reservations have been cancelled:"
8130+
msgstr "Les réservations suivantes ont été annulées:"
8131+
8132+
msgid "This is a notification for accepted cancellation requests for ${organisation}. If you no longer wish to receive these notifications, please contact an administrator so they can remove you from the recipients list."
8133+
msgstr "Ceci est une notification pour les demandes d'annulation acceptées pour ${organisation}. Si vous ne souhaitez plus recevoir ces notifications, veuillez contacter un administrateur."
8134+
8135+
msgid "Your cancellation request has been accepted. The following reservations have been cancelled:"
8136+
msgstr "Votre demande d'annulation a été acceptée. Les réservations suivantes ont été annulées:"
8137+
80698138
#~ msgid "e.g. 07:00 or 07:00, 14:30"
80708139
#~ msgstr "p.ex. 07:00 ou 07:00, 14:30"
80718140

src/onegov/org/locale/it_CH/LC_MESSAGES/onegov.org.po

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5627,6 +5627,12 @@ msgstr "1 prenotazione aggiunta."
56275627
msgid "${count} reservations added."
56285628
msgstr "${count} prenotazioni aggiunte."
56295629

5630+
msgid "Cancellation requested for 1 reservation."
5631+
msgstr "Richiesta di cancellazione per 1 prenotazione."
5632+
5633+
msgid "Cancellation requested for ${count} reservations."
5634+
msgstr "Richiesta di cancellazione per ${count} prenotazioni."
5635+
56305636
msgid "1 reservation adjusted:"
56315637
msgstr "1 prenotazione regolata:"
56325638

@@ -8025,6 +8031,69 @@ msgstr "Utente creato correttamente"
80258031
msgid "Please enter your e-mail address in order to continue"
80268032
msgstr "Inserisci il tuo indirizzo e-mail per continuare"
80278033

8034+
msgid "Enable cancel reservation"
8035+
msgstr "Consentire la cancellazione delle prenotazioni"
8036+
8037+
msgid "Cancellation"
8038+
msgstr "Cancellazione"
8039+
8040+
msgid "Request cancellation"
8041+
msgstr "Richiedere la cancellazione"
8042+
8043+
msgid "Request Cancellation"
8044+
msgstr "Richiedere la cancellazione"
8045+
8046+
msgid "You are about to submit a cancellation request for the following reservations. An administrator will review your request and confirm the cancellation."
8047+
msgstr "Stai per inviare una richiesta di cancellazione per le seguenti prenotazioni. Un amministratore esaminerà la tua richiesta e confermerà la cancellazione."
8048+
8049+
msgid "Would you like to cancel your reservation?"
8050+
msgstr "Desideri cancellare la tua prenotazione?"
8051+
8052+
msgid "Your cancellation request has been submitted. You will be notified once it has been processed."
8053+
msgstr "La tua richiesta di cancellazione è stata inviata. Sarai informato/a quando sarà elaborata."
8054+
8055+
msgid "A cancellation request can only be submitted for accepted reservations."
8056+
msgstr "Una richiesta di cancellazione può essere inviata solo per prenotazioni accettate."
8057+
8058+
msgid "A cancellation request has already been submitted."
8059+
msgstr "Una richiesta di cancellazione è già stata inviata."
8060+
8061+
msgid "A cancellation request cannot be submitted because the payment has already been invoiced or paid."
8062+
msgstr "Non è possibile inviare una richiesta di cancellazione perché il pagamento è già stato fatturato o pagato."
8063+
8064+
msgid "Accept cancellation"
8065+
msgstr "Accetta cancellazione"
8066+
8067+
msgid "Do you really want to accept the cancellation?"
8068+
msgstr "Vuoi davvero accettare la cancellazione?"
8069+
8070+
msgid "This will cancel the reservation and cannot be undone."
8071+
msgstr "Questo cancellerà la prenotazione e non può essere annullato."
8072+
8073+
msgid "Cancellation accepted."
8074+
msgstr "Cancellazione accettata."
8075+
8076+
msgid "The cancellation request was accepted."
8077+
msgstr "La richiesta di cancellazione è stata accettata."
8078+
8079+
msgid "A cancellation has been requested for this reservation."
8080+
msgstr "È stata richiesta una cancellazione per questa prenotazione."
8081+
8082+
msgid "Cancellation accepted"
8083+
msgstr "Cancellazione accettata"
8084+
8085+
msgid "${org} Accepted Cancellation"
8086+
msgstr "${org} Cancellazione accettata"
8087+
8088+
msgid "The following reservations have been cancelled:"
8089+
msgstr "Le seguenti prenotazioni sono state cancellate:"
8090+
8091+
msgid "This is a notification for accepted cancellation requests for ${organisation}. If you no longer wish to receive these notifications, please contact an administrator so they can remove you from the recipients list."
8092+
msgstr "Questa è una notifica per le richieste di cancellazione accettate per ${organisation}. Se non si desidera più ricevere queste notifiche, contattare un amministratore."
8093+
8094+
msgid "Your cancellation request has been accepted. The following reservations have been cancelled:"
8095+
msgstr "La tua richiesta di cancellazione è stata accettata. Le seguenti prenotazioni sono state cancellate:"
8096+
80288097
#~ msgid "e.g. 07:00 or 07:00, 14:30"
80298098
#~ msgstr "es. 07:00 o 07:00, 14:30"
80308099

src/onegov/org/models/ticket.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,35 @@ def get_links( # type:ignore[override]
10761076
for r in self.reservations
10771077
)
10781078

1079-
if not all(accepted):
1079+
cancellation_requested = self.data.get('cancellation_requested', False)
1080+
1081+
if cancellation_requested:
1082+
links.append(
1083+
Link(
1084+
text=_('Accept cancellation'),
1085+
url=request.link(self.ticket, 'accept-cancellation'),
1086+
attrs={'class': 'delete-link'},
1087+
traits=(
1088+
Confirm(
1089+
_(
1090+
'Do you really want to accept the '
1091+
'cancellation?'
1092+
),
1093+
_(
1094+
'This will cancel the reservation and cannot '
1095+
'be undone.'
1096+
),
1097+
_('Accept cancellation'),
1098+
_('Cancel'),
1099+
),
1100+
Intercooler(
1101+
request_method='GET', redirect_after=request.url
1102+
),
1103+
),
1104+
)
1105+
)
1106+
1107+
if not all(accepted) and not cancellation_requested:
10801108
links.append(
10811109
Link(
10821110
text=_('Accept all reservations'),
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<div metal:use-macro="layout.base" i18n:domain="onegov.org">
2+
<tal:b metal:fill-slot="title">
3+
${title}
4+
</tal:b>
5+
<tal:b metal:fill-slot="body">
6+
<p i18n:translate>Hello!</p>
7+
<p i18n:translate>Your cancellation request has been accepted. The following reservations have been cancelled:</p>
8+
9+
<table tal:condition="message" class="inline-message current-message" bgcolor="#f5f5f5"><tr><td>
10+
<span class="message-owner" i18n:translate>
11+
<a href="mailto:${message.owner}" i18n:name="author">${message.owner}</a> wrote
12+
</span>
13+
14+
<tal:b content="message.formatted_text(layout)" />
15+
</td></tr></table>
16+
17+
<p><b>${resource.title}</b></p>
18+
<tal:b metal:use-macro="layout.macros['reservations']"></tal:b>
19+
20+
<p>
21+
<a href="${request.link(ticket, 'status')}" i18n:translate>Check request status</a>
22+
</p>
23+
</tal:b>
24+
</div>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<div metal:use-macro="layout.base" i18n:domain="onegov.org">
2+
<tal:b metal:fill-slot="title">
3+
${title}
4+
</tal:b>
5+
<tal:b metal:fill-slot="body">
6+
<p i18n:translate>Hello!</p>
7+
<p i18n:translate>The following reservations have been cancelled:</p>
8+
9+
<table tal:condition="message" class="inline-message current-message" bgcolor="#f5f5f5"><tr><td>
10+
<span class="message-owner" i18n:translate>
11+
<a href="mailto:${message.owner}" i18n:name="author">${message.owner}</a> wrote
12+
</span>
13+
14+
<tal:b content="message.formatted_text(layout)" />
15+
</td></tr></table>
16+
17+
<p><b>${resource.title}</b></p>
18+
<tal:b metal:use-macro="layout.macros['reservations']"></tal:b>
19+
20+
<tal:b condition="show_submission|nothing">
21+
<hr class="large">
22+
<table class="field-display">
23+
<tr><td><b i18n:translate>E-Mail</b></td></tr>
24+
<tr><td>${model.email}</td></tr>
25+
<tr tal:condition="ticket.tag"><td height="5"></td></tr>
26+
<tr tal:condition="ticket.tag"><td><b i18n:translate>Tag</b></td></tr>
27+
<tr tal:condition="ticket.tag"><td>${ticket.tag}</td></tr>
28+
</table>
29+
<metal:b use-macro="layout.macros['display_form']"/>
30+
<hr class="large">
31+
</tal:b>
32+
33+
<p i18n:translate>
34+
See Ticket <a href="${request.link(model)}" i18n:name="link">${ticket_reference}</a> for additional information.
35+
</p>
36+
<p i18n:translate>Have a great day!</p>
37+
</tal:b>
38+
<tal:b metal:fill-slot="above-footer">
39+
<p>
40+
<span i18n:translate>
41+
This is a notification for accepted cancellation requests for <tal:b i18n:name="organisation">${request.app.org.title}</tal:b>. If you no longer wish to receive these notifications, please contact an administrator so they can remove you from the recipients list.
42+
</span>
43+
</tal:b>
44+
45+
</div>

src/onegov/org/templates/mail_reservation_accepted.pt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
<p>
2727
<a href="${request.link(ticket, 'status')}" i18n:translate>Check request status</a>
2828
</p>
29+
<p tal:condition="cancel_url|nothing">
30+
<a href="${cancel_url}" i18n:translate>Request cancellation</a>
31+
</p>
2932
<p tal:condition="my_reservations_url|nothing">
3033
<a href="${my_reservations_url}" i18n:translate>See all your reservations</a>
3134
</p>

src/onegov/org/templates/message_reservation.pt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@
2929
<tal:b i18n:name="count">${count}</tal:b> reservations added.
3030
</tal:b>
3131
</tal:b>
32+
<tal:b tal:case="'cancellation_requested'">
33+
<tal:b tal:condition="count == 1" i18n:translate>
34+
Cancellation requested for 1 reservation.
35+
</tal:b>
36+
<tal:b tal:condition="count > 1" i18n:translate>
37+
Cancellation requested for <tal:b i18n:name="count">${count}</tal:b> reservations.
38+
</tal:b>
39+
</tal:b>
40+
<tal:b tal:case="'cancellation_accepted'">
41+
<tal:b i18n:translate>
42+
Cancellation accepted.
43+
</tal:b>
44+
</tal:b>
3245
</tal:b>
3346
</metal:b>
3447
</metal:b>

0 commit comments

Comments
 (0)