-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/fr/merge' of github.com:armada-ths/ais into fea…
…ture/fr/merge
- Loading branch information
Showing
8 changed files
with
130 additions
and
69 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
accounting/migrations/0034_change_exclusive_for_choices.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 2.2.24 on 2024-08-04 20:10 | ||
|
||
import accounting.models | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('accounting', '0033_add_stock_model'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='product', | ||
name='exclusively_for', | ||
field=accounting.models.ChoiceArrayField(base_field=models.CharField(choices=[('ir-timely', 'Companies who signed IR during the IR period.'), ('ir-late', 'Companies who signed IR after the IR period.')], max_length=31), blank=True, default=list, help_text='Show this product only to the selected company types. An empty selection means showing it to every company.', size=None), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import datetime | ||
|
||
from ais.common import settings | ||
from util.email import send_mail | ||
|
||
|
||
def send_ir_confirmation_email( | ||
request, | ||
fair, | ||
signature, | ||
company, | ||
# How many days the company has to change their initial registration application after signing the contract | ||
ir_application_change_allowed_time=14, | ||
# How many days after the initial registration end date the company will receive a confirmation email | ||
ir_application_review_time=14, | ||
): | ||
# The deadline for the company to change their initial registration application | ||
# either x days after signature, or the registration end date, whichever comes last. | ||
ir_application_change_deadline = max( | ||
[ | ||
signature.timestamp | ||
+ datetime.timedelta(days=ir_application_change_allowed_time), | ||
fair.registration_end_date, | ||
] | ||
) | ||
|
||
# The latest date the company will receive a confirmation email | ||
ir_application_review_date = fair.registration_end_date + datetime.timedelta( | ||
days=ir_application_review_time | ||
) | ||
|
||
send_mail( | ||
request, | ||
template="register/email/ir_complete.html", | ||
context={ | ||
"company": company, | ||
"fair": fair, | ||
"signature": signature, | ||
"ir_application_change_deadline": ir_application_change_deadline, | ||
"ir_application_review_date": ir_application_review_date, | ||
"support_email": "[email protected]", | ||
}, | ||
subject="Initial registration received!", | ||
to=[signature.company_contact.email_address], | ||
file_paths=[settings.MEDIA_ROOT + signature.contract.contract.url[6:]], | ||
) | ||
|
||
|
||
def send_cr_confirmation_email(request, fair, company, exhibitor, signature): | ||
# Untested | ||
# Todo: Add packages to email | ||
send_mail( | ||
request, | ||
template="register/email/cr_complete.html", | ||
context={ | ||
"company": company, | ||
"fair": fair, | ||
"signature": signature, | ||
"deadline": exhibitor.deadline_complete_registration | ||
or fair.complete_registration_close_date, | ||
}, | ||
subject="Final registration received!", | ||
to=[signature.company_contact.email_address], | ||
file_paths=[settings.MEDIA_ROOT + signature.contract.contract.url[6:]], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import datetime | ||
from ais.common import settings | ||
from dashboard.api.registration.email import ( | ||
send_cr_confirmation_email, | ||
send_ir_confirmation_email, | ||
) | ||
from dashboard.api.registration.types.registration import get_registration | ||
from exhibitors.models import Exhibitor | ||
from util import JSONError, get_contract_signature, get_exhibitor, status | ||
|
@@ -12,7 +14,6 @@ | |
from register.models import SignupLog | ||
from accounting.models import Order | ||
|
||
from util.email import send_mail | ||
from util.ip import get_client_ip | ||
|
||
|
||
|
@@ -80,22 +81,7 @@ def submit_cr(request, company, fair, contact, exhibitor): | |
unit_price=0, # A package product is free | ||
) | ||
|
||
# Untested | ||
# Todo: Add packages to email | ||
send_mail( | ||
request, | ||
template="register/email/cr_complete.html", | ||
context={ | ||
"company": company, | ||
"fair": fair, | ||
"signature": signature, | ||
"deadline": exhibitor.deadline_complete_registration | ||
or fair.complete_registration_close_date, | ||
}, | ||
subject="Final registration received!", | ||
to=[signature.company_contact.email_address], | ||
file_paths=[settings.MEDIA_ROOT + signature.contract.contract.url[6:]], | ||
) | ||
send_cr_confirmation_email(request, fair, company, exhibitor, signature) | ||
|
||
try: | ||
registration = get_registration(company, fair, contact, exhibitor) | ||
|
@@ -107,48 +93,6 @@ def submit_cr(request, company, fair, contact, exhibitor): | |
return JsonResponse(serializer.data, safe=False) | ||
|
||
|
||
def send_ir_confirmation_email( | ||
request, | ||
fair, | ||
signature, | ||
company, | ||
# How many days the company has to change their initial registration application after signing the contract | ||
ir_application_change_allowed_time=14, | ||
# How many days after the initial registration end date the company will receive a confirmation email | ||
ir_application_review_time=14, | ||
): | ||
# The deadline for the company to change their initial registration application | ||
# either x days after signature, or the registration end date, whichever comes last. | ||
ir_application_change_deadline = max( | ||
[ | ||
signature.timestamp | ||
+ datetime.timedelta(days=ir_application_change_allowed_time), | ||
fair.registration_end_date, | ||
] | ||
) | ||
|
||
# The latest date the company will receive a confirmation email | ||
ir_application_review_date = fair.registration_end_date + datetime.timedelta( | ||
days=ir_application_review_time | ||
) | ||
|
||
send_mail( | ||
request, | ||
template="register/email/ir_complete.html", | ||
context={ | ||
"company": company, | ||
"fair": fair, | ||
"signature": signature, | ||
"ir_application_change_deadline": ir_application_change_deadline, | ||
"ir_application_review_date": ir_application_review_date, | ||
"support_email": "[email protected]", | ||
}, | ||
subject="Initial registration received!", | ||
to=[signature.company_contact.email_address], | ||
file_paths=[settings.MEDIA_ROOT + signature.contract.contract.url[6:]], | ||
) | ||
|
||
|
||
@require_POST | ||
def submit_ir(request, company, fair, contact): | ||
try: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 2.2.24 on 2024-08-04 20:10 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('register', '0006_add_signup_log_ip'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='signupcontract', | ||
name='is_timely', | ||
field=models.BooleanField(default=True, help_text='(ONLY RELEVANT FOR IR) A contract is timely if it is signed before the IR period ends.'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters