summaryrefslogtreecommitdiff
path: root/postgresqleu/confreg/invoicehandler.py
diff options
context:
space:
mode:
authorMagnus Hagander2015-09-05 11:17:12 +0000
committerMagnus Hagander2015-09-05 11:17:12 +0000
commita59a07bf63d492ec8722a5ba94972baa15f3b369 (patch)
tree29f67f30f78f5f38fb88d1cefea2b1a11df4a664 /postgresqleu/confreg/invoicehandler.py
parenta996fd2859a4b87c901e491136105243a72bc950 (diff)
Automatically remove additional options from old unconfirmed registrations
Registrations that don't have invoices or bulk paymens still "lock" additional options from others. And some attendees never complete their registrations at all. With this new cronjob enabled, those will also respect the "invoice autocancel hours" parameter from the additional options, and be removed after that time. As there is no actual registration, the only thing that happens is that the current registration is edited and the additional option removed, the rest of it remains. And as long as nobody else manages to register in between, the attendee can go back and re-register for it as long as it's still available. Expiry also happens automatically when an invoice is cancelled, as it makes more sense to do that right away rather than waiting for the next cronjob to run, for consistency. This adds a "lastmodified" field to all conference registrations, which is used to track this and other changes. So we only track the changes on the level of the whole registration, and thus won't catch people who go in and edit their address for example, without modifying the options. But the target with these removals are those that have completely abandoned their registration, which will be properly handled.
Diffstat (limited to 'postgresqleu/confreg/invoicehandler.py')
-rw-r--r--postgresqleu/confreg/invoicehandler.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/postgresqleu/confreg/invoicehandler.py b/postgresqleu/confreg/invoicehandler.py
index deac7a37..b23ffad0 100644
--- a/postgresqleu/confreg/invoicehandler.py
+++ b/postgresqleu/confreg/invoicehandler.py
@@ -2,7 +2,7 @@ from django.conf import settings
from models import ConferenceRegistration, BulkPayment, PendingAdditionalOrder
from models import RegistrationWaitlistHistory
-from util import notify_reg_confirmed
+from util import notify_reg_confirmed, expire_additional_options
from datetime import datetime
@@ -48,6 +48,11 @@ class InvoiceProcessor(object):
reg.invoice = None
reg.save()
+ # If this registration holds any additional options that are about to expire, release
+ # them for others to use at this point. (This will send an additional email to the
+ # attendee automatically)
+ expire_additional_options(reg)
+
# If the registration was on the waitlist, put it back in the
# queue.
if hasattr(reg, 'registrationwaitlistentry'):
@@ -141,6 +146,11 @@ class BulkInvoiceProcessor(object):
r.bulkpayment = None
r.save()
+ # If this registration holds any additional options that are about to expire, release
+ # them for others to use at this point. (This will send an additional email to the
+ # attendee automatically)
+ expire_additional_options(r)
+
# Now actually *remove* the bulk payment record completely,
# since it no longer contains anything interesting.
bp.delete()