Exemplo n.º 1
0
    def post(self, request, *args, **kwargs):
        application = get_object_or_404(Application, pk=self.args[0])
        assessment = get_object_or_404(Assessment, pk=self.args[1])

        for order, condition_id in enumerate(request.POST.getlist('conditionID')):
            AssessmentCondition.objects.create(condition=Condition.objects.get(pk=condition_id),
                                               assessment=assessment, order=order)

        # set the assessment request status to be 'assessed'
        assessment.status = 'assessed'
        comment = request.POST.get('comment', '')
        if len(comment.strip()) > 0:
            assessment.comment = comment

        purpose = request.POST.get('purpose', '')
        if len(purpose.strip()) > 0:
            assessment.purpose = purpose

        assessment.save()

        # set application status process
        application.processing_status = determine_processing_status(application)
        application.save()

        send_assessment_done_email(assessment, request)

        return redirect(self.success_url)
Exemplo n.º 2
0
def identification_uploaded_callback(sender, **kwargs):
    if 'user' in kwargs:
        for application in Application.objects.filter(applicant_profile__user=kwargs.get('user')):
            if application.id_check_status == 'awaiting_update':
                application.id_check_status = 'updated'
                application.customer_status = determine_customer_status(application)
                application.processing_status = determine_processing_status(application)
                application.save()
Exemplo n.º 3
0
    def post(self, request, *args, **kwargs):
        application = get_object_or_404(Application, pk=self.args[0])
        assessment = get_object_or_404(Assessment, pk=self.args[1])

        if self._check_read_only(assessment, request):
            return redirect('wl_applications:view_assessment', *args)

        assessment.assessmentcondition_set.all().delete()
        for order, condition_id in enumerate(
                request.POST.getlist('conditionID')):
            AssessmentCondition.objects.create(
                condition=Condition.objects.get(pk=condition_id),
                assessment=assessment,
                order=order)

        # set the assessment request status to be 'assessed' if concluding
        user_action = ApplicationUserAction.ACTION_SAVE_ASSESSMENT_
        if 'conclude' in request.POST:
            assessment.status = 'assessed'
            user_action = ApplicationUserAction.ACTION_CONCLUDE_ASSESSMENT_
        application.log_user_action(
            user_action.format(assessment.assessor_group), request)

        comment = request.POST.get('comment', '')
        if len(comment.strip()) > 0:
            assessment.comment = comment

        purpose = request.POST.get('purpose', '')
        if len(purpose.strip()) > 0:
            assessment.purpose = purpose

        assessment.save()

        # set application status process
        application.processing_status = determine_processing_status(
            application)
        application.save()

        if 'conclude' in request.POST:
            send_assessment_done_email(assessment, request)

            messages.success(
                request,
                'The application assessment has been forwarded back to the Wildlife Licensing '
                'office for review.')

            return redirect(self.success_url)
        else:
            messages.warning(request, 'The application assessment was saved.')

            return render(request, self.template_name, self.get_context_data())
Exemplo n.º 4
0
def return_submitted_callback(sender, **kwargs):
    if 'ret' in kwargs:
        ret = kwargs.get('ret')
        try:
            previous_application = Application.objects.get(licence=ret.licence)
            application = Application.objects.get(previous_application=previous_application)
            if application.returns_check_status == 'awaiting_returns':
                if not Return.objects.filter(licence=ret.licence).exclude(status='submitted').\
                        exclude(status='approved').exists():
                    application.returns_check_status = 'completed'
                    application.customer_status = determine_customer_status(application)
                    application.processing_status = determine_processing_status(application)
                    application.save()
        except Application.DoesNotExist:
            pass
Exemplo n.º 5
0
def identification_uploaded_callback(sender, **kwargs):
    if 'request' in kwargs:
        request = kwargs.get('request')
        is_app_awaiting_id_check = False
        for application in Application.objects.filter(applicant_profile__user=request.user):
            if application.id_check_status == 'awaiting_update':
                application.id_check_status = 'updated'
                application.customer_status = determine_customer_status(application)
                application.processing_status = determine_processing_status(application)
                application.save()

                is_app_awaiting_id_check = True

        if is_app_awaiting_id_check:
            messages.success(request, 'Thank you for providing your photographic identification. Any application(s) '
                             'currently awaiting this identification will now proceed with processing.')
Exemplo n.º 6
0
    def post(self, request, *args, **kwargs):
        application = get_object_or_404(Application, pk=self.args[0])
        assessment = get_object_or_404(Assessment, pk=self.args[1])

        if self._check_read_only(assessment, request):
            return redirect('wl_applications:view_assessment', *args)

        assessment.assessmentcondition_set.all().delete()
        for order, condition_id in enumerate(request.POST.getlist('conditionID')):
            AssessmentCondition.objects.create(condition=Condition.objects.get(pk=condition_id),
                                               assessment=assessment, order=order)

        # set the assessment request status to be 'assessed' if concluding
        user_action = ApplicationUserAction.ACTION_SAVE_ASSESSMENT_
        if 'conclude' in request.POST:
            assessment.status = 'assessed'
            user_action = ApplicationUserAction.ACTION_CONCLUDE_ASSESSMENT_
        application.log_user_action(
            user_action.format(assessment.assessor_group),
            request)

        comment = request.POST.get('comment', '')
        if len(comment.strip()) > 0:
            assessment.comment = comment

        purpose = request.POST.get('purpose', '')
        if len(purpose.strip()) > 0:
            assessment.purpose = purpose

        assessment.save()

        # set application status process
        application.processing_status = determine_processing_status(application)
        application.save()

        if 'conclude' in request.POST:
            send_assessment_done_email(assessment, request)

            messages.success(request, 'The application assessment has been forwarded back to the Wildlife Licensing '
                                      'office for review.')

            return redirect(self.success_url)
        else:
            messages.warning(request, 'The application assessment was saved.')

            return render(request, self.template_name, self.get_context_data())
Exemplo n.º 7
0
def return_submitted_callback(sender, **kwargs):
    if 'ret' in kwargs:
        ret = kwargs.get('ret')
        try:
            previous_application = Application.objects.get(licence=ret.licence)
            application = Application.objects.get(
                previous_application=previous_application)
            if application.returns_check_status == 'awaiting_returns':
                if not Return.objects.filter(licence=ret.licence).exclude(status='submitted').\
                        exclude(status='approved').exists():
                    application.returns_check_status = 'completed'
                    application.customer_status = determine_customer_status(
                        application)
                    application.processing_status = determine_processing_status(
                        application)
                    application.save()
        except Application.DoesNotExist:
            pass
Exemplo n.º 8
0
def identification_uploaded_callback(sender, **kwargs):
    if 'request' in kwargs:
        request = kwargs.get('request')
        is_app_awaiting_id_check = False
        for application in Application.objects.filter(
                applicant_profile__user=request.user):
            if application.id_check_status == 'awaiting_update':
                application.id_check_status = 'updated'
                application.customer_status = determine_customer_status(
                    application)
                application.processing_status = determine_processing_status(
                    application)
                application.save()

                is_app_awaiting_id_check = True

        if is_app_awaiting_id_check:
            messages.success(
                request,
                'Thank you for providing your photographic identification. Any application(s) '
                'currently awaiting this identification will now proceed with processing.'
            )