Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MaarchCourrier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Redmine
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maarch
MaarchCourrier
Commits
fd6c3b21
Commit
fd6c3b21
authored
4 years ago
by
Alex ORLUC
Browse files
Options
Downloads
Plain Diff
Merge branch 'develop' of labs.maarch.org:maarch/MaarchCourrier into develop
parents
573f5fff
f76dacbd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/external/exportSeda/controllers/ExportSEDATrait.php
+1
-1
1 addition, 1 deletion
src/app/external/exportSeda/controllers/ExportSEDATrait.php
src/app/external/exportSeda/controllers/SendMessageController.php
+31
-19
31 additions, 19 deletions
...external/exportSeda/controllers/SendMessageController.php
with
32 additions
and
20 deletions
src/app/external/exportSeda/controllers/ExportSEDATrait.php
+
1
−
1
View file @
fd6c3b21
...
...
@@ -497,7 +497,7 @@ trait ExportSEDATrait
$data
[
'messageObject'
]
=
self
::
array2object
(
$args
[
"data"
][
"messageObject"
]);
$data
[
'type'
]
=
$args
[
"data"
][
"type"
];
$informationsToSend
=
SendMessageController
::
generate
Message
File
(
$data
);
$informationsToSend
=
SendMessageController
::
generate
Seda
File
(
$data
);
return
$informationsToSend
;
}
...
...
This diff is collapsed.
Click to expand it.
src/app/external/exportSeda/controllers/SendMessageController.php
+
31
−
19
View file @
fd6c3b21
...
...
@@ -36,7 +36,36 @@ class SendMessageController
return
$res
;
}
public
static
function
generateMessageFile
(
$aArgs
=
[])
public
static
function
generateMessageFile
(
$aArgs
=
[],
$isForSeda
=
false
)
{
$messageObject
=
$aArgs
[
'messageObject'
];
$type
=
$aArgs
[
'type'
];
$DOMTemplate
=
new
\DOMDocument
();
$DOMTemplate
->
load
(
'modules/export_seda/resources/'
.
$type
.
'.xml'
);
$DOMTemplateProcessor
=
new
DOMTemplateProcessorController
(
$DOMTemplate
);
$DOMTemplateProcessor
->
setSource
(
$type
,
$messageObject
);
$DOMTemplateProcessor
->
merge
();
$DOMTemplateProcessor
->
removeEmptyNodes
();
$tmpPath
=
CoreConfigModel
::
getTmpPath
();
file_put_contents
(
$tmpPath
.
$messageObject
->
MessageIdentifier
->
value
.
".xml"
,
$DOMTemplate
->
saveXML
());
if
(
$messageObject
->
DataObjectPackage
&&
!
$isForSeda
)
{
foreach
(
$messageObject
->
DataObjectPackage
->
BinaryDataObject
as
$binaryDataObject
)
{
$base64_decoded
=
base64_decode
(
$binaryDataObject
->
Attachment
->
value
);
$file
=
fopen
(
$tmpPath
.
$binaryDataObject
->
Attachment
->
filename
,
'w'
);
fwrite
(
$file
,
$base64_decoded
);
fclose
(
$file
);
}
}
$filename
=
self
::
generateZip
(
$messageObject
,
$tmpPath
);
return
$filename
;
}
public
static
function
generateSedaFile
(
$aArgs
=
[])
{
$tmpPath
=
CoreConfigModel
::
getTmpPath
();
...
...
@@ -99,9 +128,7 @@ class SendMessageController
}
}
$xmlFile
=
self
::
generateXML
(
$seda2Message
,
$type
,
$tmpPath
);
$filename
=
self
::
generateZip
(
$seda2Message
,
$tmpPath
);
$filename
=
self
::
generateMessageFile
([
"messageObject"
=>
$seda2Message
,
"type"
=>
$type
],
$isForSeda
=
true
);
$arrayReturn
=
[
"messageObject"
=>
$seda2Message
,
...
...
@@ -112,20 +139,6 @@ class SendMessageController
return
$arrayReturn
;
}
private
static
function
generateXML
(
$seda2Message
,
$type
,
$tmpPath
)
{
$DOMTemplate
=
new
\DOMDocument
();
$DOMTemplate
->
load
(
'src/app/external/exportSeda/resources/'
.
$type
.
'.xml'
);
$DOMTemplateProcessor
=
new
DOMTemplateProcessorController
(
$DOMTemplate
);
$DOMTemplateProcessor
->
setSource
(
$type
,
$seda2Message
);
$DOMTemplateProcessor
->
merge
();
$DOMTemplateProcessor
->
removeEmptyNodes
();
file_put_contents
(
$tmpPath
.
$seda2Message
->
MessageIdentifier
->
value
.
".xml"
,
$DOMTemplate
->
saveXML
());
return
$tmpPath
.
$seda2Message
->
MessageIdentifier
->
value
.
".xml"
;
}
private
static
function
generateZip
(
$seda2Message
,
$tmpPath
)
{
$zip
=
new
\ZipArchive
();
...
...
@@ -182,7 +195,6 @@ class SendMessageController
$binaryDataObject
->
MessageDigest
->
algorithm
=
"sha256"
;
$binaryDataObject
->
Size
=
filesize
(
$filePath
);
$binaryDataObject
->
Attachment
=
new
\stdClass
();
$binaryDataObject
->
Attachment
->
filename
=
$filename
;
...
...
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