Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Maarch
Pastell Connecteur SAE Maarch RM
Commits
07012218
Commit
07012218
authored
Feb 17, 2021
by
Arnaud Pauget
Browse files
fix() : amélioration analyse datas reçu lors de l'export d'un bordereau + error debug
parent
7435fbc6
Changes
1
Hide whitespace changes
Inline
Side-by-side
MaarchREST.class.php
View file @
07012218
...
...
@@ -161,22 +161,35 @@ class MaarchREST extends SAEConnecteur {
public
function
getXmlFromZipMessage
(
$zipMessage
,
$messageId
)
{
$tmpFile
=
new
TmpFile
();
$zipTempFile
=
$tmpFile
->
create
();
file_put_contents
(
$zipTempFile
,
$zipMessage
);
$writer
=
file_put_contents
(
$zipTempFile
,
$zipMessage
);
if
(
$writer
==
0
)
{
throw
new
UnrecoverableException
(
"ERREUR : L'application n'a pas pu écrire le contenu du bordereau ou son contenu est vide."
);
}
// get the absolute path to $file
$path
=
pathinfo
(
realpath
(
$zipTempFile
),
PATHINFO_DIRNAME
);
if
(
is_null
(
$zipMessage
)
||
empty
(
$zipMessage
))
{
throw
new
UnrecoverableException
(
"Le paquet a correctement été récupéré mais semble vide. Vérifiez l'identifiant
$messageId
dans maarch RM."
);
}
try
{
shell_exec
(
"7z x
$zipTempFile
-o
$path
*.xml"
);
}
catch
(
Exception
$e
)
{
error_log
(
"ERREUR LECTURE ZIP"
,
0
);
error_log
(
"Chemin ZIP : "
.
$zipTempFile
,
0
);
error_log
(
"Extraction vers : "
.
$path
,
0
);
throw
new
UnrecoverableException
(
$e
);
}
$fullFilePath
=
$path
.
"/"
.
$messageId
.
".xml"
;
if
(
!
file_exists
(
$fullFilePath
))
{
error_log
(
"ERREUR LECTURE FICHIER : "
.
$fullFilePath
,
0
);
throw
new
UnrecoverableException
(
"Problème lors de la lecture du fichier
$fullFilePath
."
);
}
$xmlContent
=
file_get_contents
(
$fullFilePath
);
unlink
(
$zipTempFile
);
...
...
@@ -200,10 +213,10 @@ class MaarchREST extends SAEConnecteur {
"application/zip"
);
if
(
$zipMessage
)
{
if
(
$zipMessage
&&
$zipMessage
!=
"false"
)
{
return
$zipMessage
;
}
else
{
throw
new
UnrecoverableException
(
"Le paquet du bordereau identifié par "
.
$messageId
.
" n'a pas pu être récup
e
ré."
);
throw
new
UnrecoverableException
(
"Le paquet du bordereau identifié par "
.
$messageId
.
" n'a pas pu être récup
é
ré
dans Maarch RM
."
);
}
}
...
...
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