|
|
|
@ -40,12 +40,14 @@ def check_one_profile(profile, License, now_, manual=False): |
|
|
|
email = EmailMessage(subject=subject, to=(user_email,), body=email_body) |
|
|
|
email = EmailMessage(subject=subject, to=(user_email,), body=email_body) |
|
|
|
email.send() |
|
|
|
email.send() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# флаг manual=False, если вызов из License.save() |
|
|
|
|
|
|
|
if not manual: |
|
|
|
licenses_remain = License.objects.filter(company=profile, date_from__gt = now_ + timedelta(days=1), |
|
|
|
licenses_remain = License.objects.filter(company=profile, date_from__gt = now_ + timedelta(days=1), |
|
|
|
status=consts.LICENSE_PAID, deleted=False) |
|
|
|
status=consts.LICENSE_PAID, deleted=False) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not licenses_remain: |
|
|
|
licenses_to_pay = License.objects.filter(company=profile, status=consts.LICENSE_UNPAID, deleted=False) |
|
|
|
licenses_to_pay = License.objects.filter(company=profile, status=consts.LICENSE_UNPAID, deleted=False) |
|
|
|
|
|
|
|
|
|
|
|
if not licenses_remain and not manual: |
|
|
|
|
|
|
|
licenses = License.objects.filter(company=profile, date_to__lt=now_, |
|
|
|
licenses = License.objects.filter(company=profile, date_to__lt=now_, |
|
|
|
status__in=[consts.LICENSE_TEST_PERIOD, consts.LICENSE_ACTIVE], deleted=False) |
|
|
|
status__in=[consts.LICENSE_TEST_PERIOD, consts.LICENSE_ACTIVE], deleted=False) |
|
|
|
|
|
|
|
|
|
|
|
@ -80,7 +82,6 @@ def check_one_profile(profile, License, now_, manual=False): |
|
|
|
email = EmailMessage(subject=subject, to=(user_email,), body=email_body) |
|
|
|
email = EmailMessage(subject=subject, to=(user_email,), body=email_body) |
|
|
|
email.send() |
|
|
|
email.send() |
|
|
|
|
|
|
|
|
|
|
|
if not manual: |
|
|
|
|
|
|
|
licenses = License.objects.filter(company=profile, order_date = now_ - timedelta(days = consts.LICENSE_PAY_DAYS - 1), |
|
|
|
licenses = License.objects.filter(company=profile, order_date = now_ - timedelta(days = consts.LICENSE_PAY_DAYS - 1), |
|
|
|
status=consts.LICENSE_UNPAID, deleted=False) |
|
|
|
status=consts.LICENSE_UNPAID, deleted=False) |
|
|
|
|
|
|
|
|
|
|
|
|