Commit 1c63ccdb authored by Gladys Forte's avatar Gladys Forte

validation form

parent 85672b37
......@@ -1182,21 +1182,20 @@ class ChangeRequestFormPost(APIView):
def post(self, request):
form_header = request.data
try:
frm_approvers = form_header['frm_approvers']
# Routing Validations
result = change_request_template.validation_superuser_department(frm_approvers)
if result is True:
# restrict superuser department
if (form_header['requested_by_department'] == 'DEPARTMENT-20190923-0000001' or
form_header['requested_to_department'] == 'DEPARTMENT-20190923-0000001'):
message = {
'code': 400,
'status': 'failed',
'message': 'Please remove Super User Department into routing table',
'message': 'Superuser department cannot be selected',
}
return Response(message,
status=status.HTTP_400_BAD_REQUEST)
frm_approvers = form_header['frm_approvers']
# Check if Vendor and Requestor are existing on routing table
if len(frm_approvers) < 2:
message = {
......
......@@ -106,16 +106,6 @@ def tmp_add_edit_delete(tmp_request_body,
return True
# Check if superuser department included in routing table
def validation_superuser_department(approvers):
for approver in approvers:
if approver['delegation'] == 'DEPARTMENT-20190923-0000001':
return True
else:
return False
# Check if routing table has Vendor and Requestor
def validation_existing_vendor_requestor(approvers):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment