diff --git a/parkstay/api.py b/parkstay/api.py index 2a32819b33..b11a154ca2 100644 --- a/parkstay/api.py +++ b/parkstay/api.py @@ -901,8 +901,8 @@ def retrieve(self, request, pk=None, ratis_id=None , format=None): if ground.campground_type != 0: return Response({'error': 'Campground doesn\'t support online bookings'}, status=400) - if not ground._is_open(start_date): - return Response({'closed': 'Campground is closed for your selected dates'}, status=status.HTTP_400_BAD_REQUEST) + #if not ground._is_open(start_date): + # return Response({'closed': 'Campground is closed for your selected dates'}, status=status.HTTP_400_BAD_REQUEST) # get a length of the stay (in days), capped if necessary to the request maximum length = max(0, (end_date-start_date).days) diff --git a/parkstay/emails.py b/parkstay/emails.py index c6dd7d4471..91c14bebe9 100644 --- a/parkstay/emails.py +++ b/parkstay/emails.py @@ -54,6 +54,17 @@ def send_booking_confirmation(booking,request): my_bookings_url = request.build_absolute_uri('/mybookings/') booking_availability = request.build_absolute_uri('/availability/?site_id={}'.format(booking.campground.id)) unpaid_vehicle = False + mobile_number = booking.customer.mobile_number + booking_number = booking.details.get('phone',None) + phone_number = booking.customer.phone_number + tel = None + if booking_number: + tel = booking_number + elif mobile_number: + tel = mobile_number + else: + tel = phone_number + tel = tel if tel else '' for v in booking.vehicle_payment_status: if v.get('Paid') == 'No': @@ -62,6 +73,7 @@ def send_booking_confirmation(booking,request): context = { 'booking': booking, + 'phone_number': tel, 'campground_email': campground_email, 'my_bookings': my_bookings_url, 'availability': booking_availability, diff --git a/parkstay/models.py b/parkstay/models.py index 34fb3d9c2b..f31e4cdeeb 100644 --- a/parkstay/models.py +++ b/parkstay/models.py @@ -1392,9 +1392,15 @@ def _post_delete(sender, instance, **kwargs): if linked_open: linked_open = linked_open[0] linked_open.range_start = instance.range_start + else: + linked_open = None else: - linked_open.range_start = today - if len(linked_open) > 0: + if linked_open: + linked_open = linked_open[0] + linked_open.range_start = today + else: + linked_open = None + if linked_open: linked_open[0].save(skip_validation=True) except CampgroundBookingRange.DoesNotExist: pass @@ -1505,10 +1511,19 @@ def _post_delete(sender, instance, **kwargs): try: linked_open = CampsiteBookingRange.objects.get(range_start=instance.range_end + timedelta(days=1), status=0) if instance.range_start >= today: - linked_open.range_start = instance.range_start + if linked_open: + linked_open = linked_open[0] + linked_open.range_start = instance.range_start + else: + linked_open = None else: - linked_open.range_start = today - linked_open.save(skip_validation=True) + if linked_open: + linked_open = linked_open[0] + linked_open.range_start = today + else: + linked_open = None + if linked_open: + linked_open[0].save(skip_validation=True) except CampsiteBookingRange.DoesNotExist: pass elif instance.status != 0 and not instance.range_end: diff --git a/parkstay/templates/ps/booking/make_booking.html b/parkstay/templates/ps/booking/make_booking.html index f6af64ed8c..623c34f4c2 100644 --- a/parkstay/templates/ps/booking/make_booking.html +++ b/parkstay/templates/ps/booking/make_booking.html @@ -285,6 +285,11 @@

Vehicles

+
+
+

Changes not permitted.Cancel up to 29 days before arrival for 50% refund.

+
+
diff --git a/parkstay/templates/ps/email/confirmation.html b/parkstay/templates/ps/email/confirmation.html index b52d612240..cfd27d49cd 100644 --- a/parkstay/templates/ps/email/confirmation.html +++ b/parkstay/templates/ps/email/confirmation.html @@ -8,14 +8,14 @@

Print or save this confirmation for presentation on arrival and at any time during your stay.

Arrival: {{booking.arrival|date:"d/m/Y"}}

-

Departure: {{booking.departure|date:"d/m/Y"}}


+

Departure: {{booking.departure|date:"d/m/Y"}}

{% if booking.campground.site_type == 2 %}

Campsite: {{booking.first_campsite.type}}

{% else %} -

Campsite: {{booking.first_campsite.name}} ({{booking.first_campsite.type}})


+

Campsite: {{booking.first_campsite.name}} ({{booking.first_campsite.type}})

{% endif %} -

Campers: {{booking.stay_guests}}


+

Campers: {{booking.stay_guests}}

{% for v in booking.vehicle_payment_status %} {% if not v.Paid %} @@ -24,17 +24,23 @@

Vehicle: {{v.Rego}}, {{v.Type}}, {% if v.Paid == 'Yes' %} Entry fee paid {% elif v.Paid == 'No' %} Unpaid {% elif v.Paid == 'pass_required' %} Park Pass Required {% endif %}

{% endif %} {% endfor %} + +

Phone Number: {{phone_number}}


{% if unpaid_vehicle %}

Purchase a park entry pass at our online store or pay on arrival

{% endif %} -

About {{booking.campground.name}} and booking conditions {{availability}}


+About {{booking.campground.name}} and booking conditions -

Before you go, check

+

Before you go, check:

-

Your contact details and vehicle registration are correct [link to on screen details] The Bureau of Meteorology for weather forecasts and warnings Emergency WA for warnings and incidents The ABC radio frequency for the area you are visiting (ABC local radio broadcasts emergency information)


+

Contact us about your booking

{{campground_email}}

@@ -43,5 +49,5 @@ {% endif %}
-

View my Park Stay WA bookings {{my_bookings}}

+View my Park Stay WA bookings {% endblock %} diff --git a/parkstay/utils.py b/parkstay/utils.py index 445a30e82a..7dd424b119 100644 --- a/parkstay/utils.py +++ b/parkstay/utils.py @@ -218,10 +218,14 @@ def get_campsite_availability(campsites_qs, start_date, end_date): for closure in cgbr_qs: start = max(start_date, closure.range_start) end = min(end_date, closure.range_end) if closure.range_end else end_date + today = date.today() for i in range((end-start).days): for cs in campground_map[closure.campground.pk]: #results[cs][start+timedelta(days=i)][0] = 'closed' - if not closure.campground._is_open(start+timedelta(days=i)): + if start+timedelta(days=i) == today: + if not closure.campground._is_open(start+timedelta(days=i)): + results[cs][start+timedelta(days=i)][0] = 'closed' + else: results[cs][start+timedelta(days=i)][0] = 'closed' # strike out campsite closures diff --git a/wildlifelicensing/apps/applications/utils.py b/wildlifelicensing/apps/applications/utils.py index abe1832105..d2ec2ac683 100755 --- a/wildlifelicensing/apps/applications/utils.py +++ b/wildlifelicensing/apps/applications/utils.py @@ -367,6 +367,8 @@ def format_application(instance, attrs): attrs['licence_type']['default_conditions'] = serialize([ap.condition for ap in instance.licence_type.defaultcondition_set.order_by('order')]) attrs['conditions'] = serialize([ap.condition for ap in instance.applicationcondition_set.order_by('order')]) + attrs['applicant_profile']['user'] = serialize(instance.applicant_profile.user,exclude=['postal_address','residential_address','billing_address']) + attrs['applicant_profile']['postal_address'] = serialize(instance.applicant_profile.postal_address,exclude=['user','oscar_address']) if instance.applicant.identification is not None and instance.applicant.identification.file is not None: attrs['applicant']['identification']['url'] = instance.applicant.identification.file.url if instance.applicant.senior_card is not None and instance.applicant.senior_card.file is not None: diff --git a/wildlifelicensing/apps/applications/views/conditions.py b/wildlifelicensing/apps/applications/views/conditions.py index 3570400aca..75d733ec53 100755 --- a/wildlifelicensing/apps/applications/views/conditions.py +++ b/wildlifelicensing/apps/applications/views/conditions.py @@ -37,7 +37,8 @@ def get_context_data(self, **kwargs): convert_documents_to_url(application.data, application.documents.all(), '') - kwargs['application'] = serialize(application, posthook=format_application) + #kwargs['application'] = serialize(application, posthook=format_application) + kwargs['application'] = serialize(application,posthook=format_application,related={'applicant': {'exclude': ['residential_address','postal_address','billing_address']},'applicant_profile':{'fields':['email','id','institution','name']}}) kwargs['form_structure'] = application.licence_type.application_schema kwargs['assessments'] = serialize(Assessment.objects.filter(application=application), posthook=format_assessment) @@ -92,7 +93,8 @@ def get_context_data(self, **kwargs): convert_documents_to_url(application.data, application.documents.all(), '') - kwargs['application'] = serialize(application, posthook=format_application) + #kwargs['application'] = serialize(application, posthook=format_application) + kwargs['application'] = serialize(application,posthook=format_application,related={'applicant': {'exclude': ['residential_address','postal_address','billing_address']},'applicant_profile':{'fields':['email','id','institution','name']}}) kwargs['form_structure'] = application.licence_type.application_schema kwargs['assessment'] = serialize(assessment, post_hook=format_assessment) diff --git a/wildlifelicensing/apps/applications/views/issue.py b/wildlifelicensing/apps/applications/views/issue.py index bdcb569e3b..67807c0738 100755 --- a/wildlifelicensing/apps/applications/views/issue.py +++ b/wildlifelicensing/apps/applications/views/issue.py @@ -173,7 +173,8 @@ def _issue_licence(self, request, application, issue_licence_form): def get_context_data(self, **kwargs): application = get_object_or_404(Application, pk=self.args[0]) - kwargs['application'] = serialize(application, posthook=format_application) + #kwargs['application'] = serialize(application, posthook=format_application) + kwargs['application'] = serialize(application,posthook=format_application,related={'applicant': {'exclude': ['residential_address','postal_address','billing_address']},'applicant_profile':{'fields':['email','id','institution','name']}}) if application.licence: kwargs['issue_licence_form'] = IssueLicenceForm(instance=application.licence) @@ -273,7 +274,8 @@ def post(self, request, *args, **kwargs): messages.warning(request, 'Licence saved but not yet issued.') return render(request, self.template_name, { - 'application': serialize(application, posthook=format_application), + #'application': serialize(application, posthook=format_application), + 'application': serialize(application,posthook=format_application,related={'applicant': {'exclude': ['residential_address','postal_address','billing_address']},'applicant_profile':{'fields':['email','id','institution','name']}}), 'issue_licence_form': issue_licence_form, 'extracted_fields': extracted_fields, 'payment_status': payment_status_verbose, @@ -291,7 +293,8 @@ def post(self, request, *args, **kwargs): messages.error(request, 'Please fix the errors below before saving / issuing the licence.') return render(request, self.template_name, { - 'application': serialize(application, posthook=format_application), + #'application': serialize(application, posthook=format_application), + 'application': serialize(application,posthook=format_application,related={'applicant': {'exclude': ['residential_address','postal_address','billing_address']},'applicant_profile':{'fields':['email','id','institution','name']}}), 'issue_licence_form': issue_licence_form, 'extracted_fields': extracted_fields, 'payment_status': payment_status_verbose, diff --git a/wildlifelicensing/apps/applications/views/process.py b/wildlifelicensing/apps/applications/views/process.py index 4e71cc1a82..ab33a1a04b 100755 --- a/wildlifelicensing/apps/applications/views/process.py +++ b/wildlifelicensing/apps/applications/views/process.py @@ -81,7 +81,8 @@ def _build_data(self, request, application): data = { 'user': serialize(request.user), - 'application': serialize(application, posthook=format_application), + #'application': serialize(application, posthook=format_application), + 'application': serialize(application,posthook=format_application,related={'applicant': {'exclude': ['residential_address','postal_address','billing_address']},'applicant_profile':{'fields':['email','id','institution','name']}}), 'form_structure': application.licence_type.application_schema, 'officers': officers, 'amendment_requests': serialize(AmendmentRequest.objects.filter(application=application), diff --git a/wildlifelicensing/settings.py b/wildlifelicensing/settings.py index e4eecf4b92..6ae1fa6fad 100755 --- a/wildlifelicensing/settings.py +++ b/wildlifelicensing/settings.py @@ -34,7 +34,7 @@ STATICFILES_DIRS.append(os.path.join(os.path.join(BASE_DIR, 'wildlifelicensing', 'static'))) CRON_CLASSES = [ - 'wildlifelicensing.apps.applications.cron.AssessmentRemindersCronJob', + #'wildlifelicensing.apps.applications.cron.AssessmentRemindersCronJob', 'wildlifelicensing.apps.main.cron.CheckLicenceRenewalsCronJob', 'wildlifelicensing.apps.returns.cron.CheckOverdueReturnsCronJob', ]