Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Maarch
MaarchParapheur
Commits
2bbae900
Verified
Commit
2bbae900
authored
May 26, 2021
by
Damien
Browse files
FEAT #16982 TIME 5:30 Yousign positions
parent
8a2d4822
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/app/document/controllers/DocumentController.php
View file @
2bbae900
...
...
@@ -507,6 +507,11 @@ class DocumentController
]);
$firstWorkflowId
=
null
;
$pdf
=
new
Fpdi
(
'P'
,
'pt'
);
$veryTemporaryPath
=
CoreConfigModel
::
getTmpPath
()
.
"tmp_file_
{
$GLOBALS
[
'id'
]
}
_"
.
rand
()
.
"_coord.pdf"
;
file_put_contents
(
$veryTemporaryPath
,
base64_decode
(
$encodedDocument
[
'encodedDocument'
]));
$pdf
->
setSourceFile
(
$veryTemporaryPath
);
unlink
(
$veryTemporaryPath
);
foreach
(
$body
[
'workflow'
]
as
$key
=>
$workflow
)
{
if
(
!
SignatureController
::
isValidSignatureMode
([
'mode'
=>
$workflow
[
'signatureMode'
]]))
{
$workflow
[
'signatureMode'
]
=
'stamp'
;
...
...
@@ -525,6 +530,22 @@ class DocumentController
$firstWorkflowId
=
$workflowId
;
}
if
(
empty
(
$workflow
[
'userId'
]))
{
if
(
!
empty
(
$workflow
[
'signaturePositions'
]))
{
foreach
(
$workflow
[
'signaturePositions'
]
as
$signaturePosition
)
{
$pageWidth
=
$pdf
->
getPageWidth
(
$signaturePosition
[
'page'
]
-
1
);
$pageHeight
=
$pdf
->
getPageHeight
(
$signaturePosition
[
'page'
]
-
1
);
$llx
=
$pageWidth
*
$signaturePosition
[
'positionX'
]
/
100
;
$llx
=
round
(
$llx
);
$lly
=
$pageHeight
-
(
$pageHeight
*
$signaturePosition
[
'positionY'
]
/
100
)
-
40
;
$lly
=
round
(
$lly
);
$urx
=
$llx
+
100
;
$urx
=
round
(
$urx
);
$ury
=
$lly
+
40
;
$ury
=
round
(
$ury
);
$workflow
[
'externalInformations'
][
'signaturePositions'
][]
=
[
'page'
=>
$signaturePosition
[
'page'
],
'position'
=>
"
{
$llx
}
,
{
$lly
}
,
{
$urx
}
,
{
$ury
}
"
];
}
}
$informations
=
[];
if
(
$workflow
[
'externalInformations'
][
'type'
]
==
'yousign'
)
{
$informations
=
YousignController
::
formatExternalInformations
(
$workflow
[
'externalInformations'
]);
...
...
src/app/history/controllers/HistoryController.php
View file @
2bbae900
...
...
@@ -466,17 +466,19 @@ class HistoryController
$informations
=
json_decode
(
$workflowExternalInformations
[
'informations'
],
true
);
if
(
$informations
[
'type'
]
==
'yousign'
&&
!
empty
(
$informations
[
'yousignProcedureId'
]))
{
$yousignProof
=
YousignController
::
getProofByWorkflowId
([
'workflowId'
=>
$step
[
'id'
]]);
$archivePath
=
$tmpPath
.
'yousignProof'
.
$GLOBALS
[
'id'
]
.
"_"
.
rand
()
.
'.zip'
;
file_put_contents
(
$archivePath
,
base64_decode
(
$yousignProof
));
$zipArchive
=
new
\
ZipArchive
();
$zipArchive
->
open
(
$archivePath
);
$nameInArchive
=
$zipArchive
->
getNameIndex
(
0
);
$yousignPdfProof
=
$zipArchive
->
getFromIndex
(
0
);
$yousignPath
=
$tmpPath
.
'yousignProof'
.
$GLOBALS
[
'id'
]
.
"_"
.
rand
()
.
'.pdf'
;
file_put_contents
(
$yousignPath
,
$yousignPdfProof
);
unlink
(
$archivePath
);
$documentPathToZip
[]
=
[
'path'
=>
$yousignPath
,
'filename'
=>
$nameInArchive
];
if
(
empty
(
$yousignProof
[
'errors'
]))
{
$archivePath
=
$tmpPath
.
'yousignProof'
.
$GLOBALS
[
'id'
]
.
"_"
.
rand
()
.
'.zip'
;
file_put_contents
(
$archivePath
,
base64_decode
(
$yousignProof
));
$zipArchive
=
new
\
ZipArchive
();
$zipArchive
->
open
(
$archivePath
);
$nameInArchive
=
$zipArchive
->
getNameIndex
(
0
);
$yousignPdfProof
=
$zipArchive
->
getFromIndex
(
0
);
$yousignPath
=
$tmpPath
.
'yousignProof'
.
$GLOBALS
[
'id'
]
.
"_"
.
rand
()
.
'.pdf'
;
file_put_contents
(
$yousignPath
,
$yousignPdfProof
);
unlink
(
$archivePath
);
$documentPathToZip
[]
=
[
'path'
=>
$yousignPath
,
'filename'
=>
$nameInArchive
];
}
}
}
}
...
...
src/app/workflow/controllers/YousignController.php
View file @
2bbae900
...
...
@@ -356,7 +356,7 @@ class YousignController
'type'
=>
'yousign'
,
'security'
=>
'sms'
,
'role'
=>
'sign'
,
'signaturePositions'
=>
[
[
'page'
=>
1
,
'position'
=>
'364,105,462,145'
]]
//TODO Remove after front
'signaturePositions'
=>
[
]
];
if
(
!
empty
(
$args
[
'security'
])
&&
$args
[
'security'
]
==
'email'
)
{
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment