Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchParapheur
Manage
Activity
Members
Plan
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchParapheur
Commits
0823c304
Verified
Commit
0823c304
authored
4 years ago
by
Damien
Browse files
Options
Downloads
Patches
Plain Diff
FEAT #14568 TIME 1:00 Fix higher signature mode
parent
4d7fbb22
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/user/controllers/UserController.php
+15
-7
15 additions, 7 deletions
src/app/user/controllers/UserController.php
src/app/workflow/controllers/WorkflowTemplateController.php
+11
-2
11 additions, 2 deletions
src/app/workflow/controllers/WorkflowTemplateController.php
with
26 additions
and
9 deletions
src/app/user/controllers/UserController.php
+
15
−
7
View file @
0823c304
...
...
@@ -183,7 +183,7 @@ class UserController
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'Body email is empty or not a valid email'
]);
}
$user
=
UserModel
::
getById
([
'id'
=>
$args
[
'id'
],
'select'
=>
[
1
]]);
$user
=
UserModel
::
getById
([
'id'
=>
$args
[
'id'
],
'select'
=>
[
'signature_modes'
]]);
if
(
empty
(
$user
))
{
return
$response
->
withStatus
(
400
)
->
withJson
([
'errors'
=>
'User does not exist'
]);
}
...
...
@@ -205,19 +205,27 @@ class UserController
$modes
[]
=
$signatureMode
;
}
}
$set
[
'signature_modes'
]
=
$modes
;
$validModes
=
CoreConfigModel
::
getSignatureModes
();
$higherMode
=
'stamp'
;
foreach
(
$validModes
as
$validMode
)
{
if
(
in_array
(
$validMode
[
'id'
],
$modes
))
{
$higherMode
=
$validMode
[
'id'
];
break
;
}
}
WorkflowModel
::
update
([
'set'
=>
[
'signature_mode'
=>
'stamp'
],
'set'
=>
[
'signature_mode'
=>
$higherMode
],
'where'
=>
[
'user_id = ?'
,
'signature_mode not in (?)'
,
'process_date is null'
,
'signature_mode != ?'
],
'data'
=>
[
$args
[
'id'
],
$
b
od
y
[
'signatureModes'
],
'stamp'
]
'data'
=>
[
$args
[
'id'
],
$
m
od
es
,
$higherMode
]
]);
WorkflowTemplateItemModel
::
update
([
'set'
=>
[
'signature_mode'
=>
'stamp'
],
'set'
=>
[
'signature_mode'
=>
$higherMode
],
'where'
=>
[
'user_id = ?'
,
'signature_mode not in (?)'
,
'signature_mode != ?'
],
'data'
=>
[
$args
[
'id'
],
$
b
od
y
[
'signatureModes'
],
'stamp'
]
'data'
=>
[
$args
[
'id'
],
$
m
od
es
,
$higherMode
]
]);
$set
[
'signature_modes'
]
=
$
body
[
'signatureM
odes
'
]
;
$set
[
'signature_modes'
]
=
$
m
odes
;
}
$set
[
'signature_modes'
]
=
json_encode
(
$set
[
'signature_modes'
]);
...
...
This diff is collapsed.
Click to expand it.
src/app/workflow/controllers/WorkflowTemplateController.php
+
11
−
2
View file @
0823c304
...
...
@@ -57,14 +57,23 @@ class WorkflowTemplateController
$workflowTemplatesUsers
=
[];
foreach
(
$rawWorkflowTemplatesUsers
as
$value
)
{
$user
=
UserModel
::
getById
([
'id'
=>
$value
[
'user_id'
],
'select'
=>
[
'signature_modes'
]]);
$user
[
'signature_modes'
]
=
json_decode
(
$user
[
'signature_modes'
],
true
);
$higherMode
=
'stamp'
;
foreach
(
$validSignatureModes
as
$validMode
)
{
if
(
in_array
(
$validMode
,
$user
[
'signature_modes'
]))
{
$higherMode
=
$validMode
[
'id'
];
break
;
}
}
$workflowTemplatesUsers
[]
=
[
'userId'
=>
$value
[
'user_id'
],
'userLabel'
=>
UserModel
::
getLabelledUserById
([
'id'
=>
$value
[
'user_id'
]]),
'mode'
=>
$value
[
'mode'
],
'signatureMode'
=>
in_array
(
$value
[
'signature_mode'
],
$validSignatureModes
)
?
$value
[
'signature_mode'
]
:
'stamp'
,
'signatureMode'
=>
in_array
(
$value
[
'signature_mode'
],
$validSignatureModes
)
?
$value
[
'signature_mode'
]
:
$higherMode
,
'order'
=>
$value
[
'order'
],
'userSignatureModes'
=>
array_intersect
(
json_decode
(
$user
[
'signature_modes'
],
true
),
$validSignatureModes
)
'userSignatureModes'
=>
array_intersect
(
$user
[
'signature_modes'
],
$validSignatureModes
)
];
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment