Skip to content

Commit

Permalink
Merge pull request #719 from xzzy/master
Browse files Browse the repository at this point in the history
Mooring Hotfixes  & Python3 / Ledger Package Split
  • Loading branch information
xzzy committed Nov 13, 2019
2 parents 555e619 + 7796d94 commit 2a1d716
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 29 deletions.
6 changes: 6 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
include LICENSE
recursive-include ledger/address/fixtures *.json
recursive-include ledger/static/ledger/css *.css *.scss
recursive-include ledger/static/ledger/fonts *.woff2
recursive-include ledger/static/ledger/images *.png
recursive-include ledger/payments/static/payments/js *.js
recursive-include ledger/payments/cash/fixtures *.json
recursive-include ledger/payments/templates/dpaw_payments *.html
recursive-include ledger/payments/templates/dpaw_payments/emails *.html *.txt
recursive-include ledger/payments/templates/dpaw_payments/invoice *.html
recursive-include ledger/payments/templates/dpaw_payments/bpay *.html
recursive-include ledger/payments/templates/dpaw_payments/bpoint *.html
recursive-include ledger/payments/static/payments/img *.jpg
recursive-include ledger/payments/static/payments/img *.png
recursive-include ledger/payments/static/payments/img *.svg
recursive-include ledger/payments/static/payments/js *.js
recursive-include ledger/accounts/templates/customers *.html
recursive-include ledger/accounts/templates/ledger/accounts *.html
recursive-include ledger/accounts/templates/email *.txt
Expand Down
28 changes: 14 additions & 14 deletions mooring/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,21 @@ def sendHtmlEmail(to,subject,context,template,cc,bcc,from_email,template_group,a
bcc = override_email.split(",")

if len(to) > 1:
for to_email in to:
msg = EmailMultiAlternatives(subject, "Please open with a compatible html email client.", from_email=from_email, to=to_email, attachments=_attachments, cc=cc, bcc=bcc, reply_to=reply_to)
msg.attach_alternative(main_template, 'text/html')
msg = EmailMultiAlternatives(subject, "Please open with a compatible html email client.", from_email=from_email, to=to, attachments=_attachments, cc=cc, bcc=bcc, reply_to=reply_to)
msg.attach_alternative(main_template, 'text/html')

#msg = EmailMessage(subject, main_template, to=[to_email],cc=cc, from_email=from_email)
#msg.content_subtype = 'html'
#if attachment1:
# for a in attachment1:
# msg.attach(a)
try:
email_log(str(log_hash)+' '+subject)
msg.send()
email_log(str(log_hash)+' Successfully sent to mail gateway')
except Exception as e:
email_log(str(log_hash)+' Error Sending - '+str(e))

#msg = EmailMessage(subject, main_template, to=[to_email],cc=cc, from_email=from_email)
#msg.content_subtype = 'html'
#if attachment1:
# for a in attachment1:
# msg.attach(a)
try:
email_log(str(log_hash)+' '+subject)
msg.send()
email_log(str(log_hash)+' Successfully sent to mail gateway')
except Exception as e:
email_log(str(log_hash)+' Error Sending - '+str(e))
else:
msg = EmailMultiAlternatives(subject, "Please open with a compatible html email client.", from_email=from_email, to=to, attachments=_attachments, cc=cc, bcc=bcc, reply_to=reply_to)
msg.attach_alternative(main_template, 'text/html')
Expand Down
2 changes: 1 addition & 1 deletion mooring/frontend/exploreparks/src/parkfinder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

<div class="row">
<div class="small-12 columns">
<label>Search <input class="input-group-field" id="searchInput" type="text" placeholder="Search for mooring's..."/></label>
<label>Search <input class="input-group-field" id="searchInput" type="text" placeholder="Search for a mooring..."/></label>
</div>
</div>
<div class="row">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,10 @@ module.exports = {
var id = full.id;
// var addBooking = "<br/><a href='#' class='addBooking' data-campground=\"__ID__\" >Add Booking</a>";
var addBooking = "";
var today = vm.date_today(0);
var today_week_later = vm.date_today(7);
// var availability_admin = "<br/><a target='_blank' href='/availability_admin/?site_id=__ID__' >Availability</a>";
var availability_admin = "<a target='_blank' href='/availability2/?site_id=__ID__&vessel_size=0' >Availability</a>";
var availability_admin = "<a target='_blank' href='/availability2/?site_id=__ID__&arrival="+today+"&departure="+today_week_later+"&gear_type=all&num_adult=2&num_child=0&num_concession=0&num_infant=0&vessel_size=0.1&vessel_draft=0.1&vessel_beam=0.1&vessel_weight=0.1' >Availability</a>";
var column = "";
if(full.noinvent){
column = "<td ><a href='#' class='detailRoute' data-campground=\"__ID__\" >View</a><br/>";
Expand Down Expand Up @@ -265,6 +267,24 @@ module.exports = {
}
});
},
date_today(days) {
var today = new Date();
var res = today.setTime(today.getTime() + (days * 24 * 60 * 60 * 1000));
var today = new Date(res);
var dd = today.getDate();
var mm = today.getMonth() + 1; //January is 0!
var yyyy = today.getFullYear();
if (dd < 10) {
dd = '0' + dd;
}
if (mm < 10) {
mm = '0' + mm;
}
var today = yyyy + '/' + mm + '/'+ dd;
return today
},
updateTable: function() {
var vm = this;
vm.$refs.dtGrounds.vmDataTable.draw();
Expand Down
11 changes: 5 additions & 6 deletions mooring/management/commands/check_oracle_bpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,13 @@ def handle(self, *args, **options):
print (invoice_total)

if bpoint_total != oracle_total:
raise ValidationError("Bpoint and Oracle Totals do not match. Bpoint Total: "+str(oracle_total)+" Oracle Total: "+str(invoice_total))
raise ValidationError("Bpoint and Oracle Totals do not match. Bpoint Total: "+str(bpoint_total)+" Oracle Total: "+str(oracle_total))
except Exception as e:
print ("Error: Sending Email Notification: "+settings.NOTIFICATION_EMAIL)
context = {
'error_report' : str(e)
}

sendHtmlEmail([settings.NOTIFICATION_EMAIL],"[MOORING] oracle and bpoint total mistatch",context,'mooring/email/oracle_bpoint.html',None,None,settings.EMAIL_FROM,'system-oim',attachments=None)



email_list = []
for email_to in settings.NOTIFICATION_EMAIL.split(","):
email_list.append(email_to)
sendHtmlEmail(tuple(email_list),"[MOORING] oracle and bpoint total mistatch",context,'mooring/email/oracle_bpoint.html',None,None,settings.EMAIL_FROM,'system-oim',attachments=None)
2 changes: 1 addition & 1 deletion mooring/static/exploreparks/js/map.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mooring/static/parkstay/js/parkstay.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion mooring/templates/mooring/email/signature-rottnest.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<br>
<p>
If you have any queries please contact us on (08) 9432 9111 or email <a href='mailto:reservations@rottestisland.com'>reservations@rottestisland.com</a>
If you have any queries please contact us on (08) 9432 9111 or email <a href='mailto:reservations@rottnestisland.com'>reservations@rottnestisland.com</a>
</p>
<p>
Kind Regards<BR>
Expand Down
12 changes: 8 additions & 4 deletions mooring/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def post(self, request, *args, **kwargs):
RefundFailed.objects.create(booking=booking, invoice_reference=invoice.reference, refund_amount=b_total,status=0, basket_json=None)

if refund:
bpoint_refund = BpointTransaction.objects.get(txn_number=refund)
bpoint_refund = BpointTransaction.objects.get(txn_number=refund.txn_number)
bpoint_refund.crn1 = new_invoice.reference
bpoint_refund.save()
update_payments(invoice.reference)
Expand Down Expand Up @@ -540,7 +540,7 @@ def post(self, request, *args, **kwargs):
RefundFailed.objects.create(admission_booking=booking, invoice_reference=invoice.reference, refund_amount=b_total,status=0,basket_json=booking_cancellation_fees)

if refund:
bpoint_refund = BpointTransaction.objects.get(txn_number=refund)
bpoint_refund = BpointTransaction.objects.get(txn_number=refund.txn_number)
bpoint_refund.crn1 = new_invoice.reference
bpoint_refund.save()
update_payments(invoice.reference)
Expand Down Expand Up @@ -632,18 +632,22 @@ def post(self, request, *args, **kwargs):
order_response = place_order_submission(request)
new_order = Order.objects.get(basket=basket)
new_invoice = Invoice.objects.get(order_number=new_order.number)
new_invoice.settlement_date = None
new_invoice.save()


# book_inv, created = BookingInvoice.objects.create(booking=booking, invoice_reference=invoice.reference)

BookingInvoice.objects.get_or_create(booking=booking, invoice_reference=new_invoice.reference)
if refund:
invoice.voided = True
invoice.save()

bpoint_refund = BpointTransaction.objects.get(txn_number=refund)
bpoint_refund = BpointTransaction.objects.get(txn_number=refund.txn_number)
bpoint_refund.crn1 = new_invoice.reference
bpoint_refund.save()
update_payments(invoice.reference)
update_payments(new_invoice.reference)
update_payments(new_invoice.reference)


## Send booking confirmation and invoice
Expand Down

0 comments on commit 2a1d716

Please sign in to comment.