Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
R
red-ci-cd
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
red-group-test
red-ci-cd
Commits
917160f1
Commit
917160f1
authored
Jan 29, 2020
by
Gladys Forte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restrict a requestor to submit a CR without atleast 1 approver v3
parent
337c9802
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletion
+21
-1
app/applicationlayer/cms/form/header/views.py
app/applicationlayer/cms/form/header/views.py
+11
-1
app/businesslayer/changerequest/change_request.py
app/businesslayer/changerequest/change_request.py
+10
-0
No files found.
app/applicationlayer/cms/form/header/views.py
View file @
917160f1
...
...
@@ -1195,6 +1195,17 @@ class ChangeRequestFormPost(APIView):
return
Response
(
message
,
status
=
status
.
HTTP_400_BAD_REQUEST
)
# Restrict a requestor to submit a CR without atleast 1 approver
counter
=
change_request
.
validation_existing_approver
(
frm_approvers
)
if
form_header
[
'status'
]
.
lower
()
==
'pending'
and
counter
==
0
:
message
=
{
'code'
:
400
,
'status'
:
'failed'
,
'message'
:
'Please select at least 1 approver before submitting this request.'
,
}
return
Response
(
message
,
status
=
status
.
HTTP_400_BAD_REQUEST
)
data_list_approver
=
[]
data_list_stake
=
[]
data_list_attach
=
[]
...
...
@@ -1241,7 +1252,6 @@ class ChangeRequestFormPost(APIView):
# create form approvers
frm_approvers
=
form_header
[
'frm_approvers'
]
counter
=
0
for
frm_approver
in
frm_approvers
:
frm_approver
[
'form_code'
]
=
frm_id
data_list_approver
.
append
(
frm_approver
)
...
...
app/businesslayer/changerequest/change_request.py
View file @
917160f1
...
...
@@ -767,6 +767,16 @@ def cr_routing_actions(approver_instance, current_user, move_to_level):
return
True
def
validation_existing_approver
(
approvers
):
counter
=
0
for
approver
in
approvers
:
# count all delegation not equal to Requestor and Vendor
if
approver
[
'delegation'
]
not
in
[
'DELEGATION-20191119-0000002'
,
'DELEGATION-20191119-0000001'
]:
counter
=
counter
+
1
return
counter
return
counter
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment