client notify mails 2

This commit is contained in:
deflax 2017-12-27 03:54:50 +02:00
parent fdb9a8c680
commit a27ed34ff7
2 changed files with 7 additions and 1 deletions

View file

@ -72,6 +72,8 @@ def activate(itemid=0):
owner.wallet = owner.wallet - total owner.wallet = owner.wallet - total
db.session.commit() db.session.commit()
flash('Deployment {} activated for {} month(s)'.format(str(service.description), form.period.data))
if owner.is_administrator: if owner.is_administrator:
return redirect(url_for('admin.list_services')) return redirect(url_for('admin.list_services'))
else: else:

View file

@ -218,7 +218,11 @@ def activate(itemid=0):
deploy.protected = True deploy.protected = True
db.session.commit() db.session.commit()
transaction = Transaction(user_id=int(owner.pid), description='Deployment {} activated for {} month(s)'.format(str(deploy.machine_alias), form.period.data), value=-total) email_content = 'Deployment {} is activated for {} month(s). It will expire at {}'.format(str(deploy.machine_alias), form.period.data, str((expiry + extradays).strftime('%c')))
send_email(current_app.config['MAIL_USERNAME'], str(email_content), 'email/adm_logger', user=owner, content=str(email_content))
send_email(str(owner.email), str(email_content), 'email/client_logger', content=str(email_content))
transaction = Transaction(user_id=int(owner.pid), description=str(email_content), value=-total)
db.session.add(transaction) db.session.add(transaction)
db.session.commit() db.session.commit()
owner.wallet = owner.wallet - total owner.wallet = owner.wallet - total