def send_tilbake_til_saksbehandling_strategy(soknad, action, data): errors = soknad.validate_soknad_for_innsending() if errors: abort(400, __error__=errors) soknad.status = action.get_end_state().id SoknadRepo.save(soknad, autocommit=False) # Arkivering ############ organisation = get_organisation(soknad.organisation_id, request.cookies) person = get_person(soknad.person_id, request.cookies) csv_file_content = ExportSoknaderResource().get(soknad_id=soknad.id).data save_journalpost_for_soknad(soknad, organisation, person, csv_file_content, u"soknad-%s-%s.pdf" % (soknad.id, datetime.now().isoformat())) current_app.db_session.commit() # Sending mail after save to avoid that mail integration errors make it impossible to perform action. # It also makes sense to send mail only when we know that the action is successful send_email_to_soker_on_action_send_inn(soknad) if not soknad.tilskuddsordning.soknadsfrist: send_email_to_saksbehandlere_on_action_send_inn(soknad)
def sende_inn_action_strategy(soknad, action, data): soknad.levert_dato = date.today() errors = soknad.validate_soknad_for_innsending() if errors: abort(400, __error__=errors) soknad.status = action.get_end_state().id SoknadRepo.save(soknad) # Sending mail after save to avoid that mail integration errors make it impossible to perform action. # It also makes sense to send mail only when we know that the action is successful send_email_to_soker_on_action_send_inn(soknad) send_email_to_organisasjon_on_action_send_inn(soknad) if not soknad.tilskuddsordning.soknadsfrist: send_email_to_saksbehandlere_on_action_send_inn(soknad)