Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Maarch
MaarchCapture
Commits
599af507
Commit
599af507
authored
Jul 11, 2019
by
Florian Azizian
Browse files
FIX #10971 move file in folder when pb with qrSeparator module
parent
95276d47
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/QRSeparator/MaarchQRSeparator.php
View file @
599af507
...
...
@@ -10,7 +10,7 @@ class QRSeparator
require
__DIR__
.
"/../../vendor/autoload.php"
;
}
public
function
separatePDF
(
$ScanSource
,
$qrcodePrefix
,
$ResultDirectory
=
false
)
public
function
separatePDF
(
$ScanSource
,
$qrcodePrefix
=
"false"
,
$ResultDirectory
=
false
)
{
echo
"Init process ...
\n
"
;
...
...
@@ -40,8 +40,7 @@ class QRSeparator
exit
();
}
$files
=
array_diff
(
scandir
(
$ScanSource
),
array
(
'..'
,
'.'
,
'FAILED'
));
//print_r($files);
$files
=
array_diff
(
scandir
(
$ScanSource
),
array
(
'..'
,
'.'
,
'FAILED'
,
'files_errors'
,
'files_noseparator'
));
if
(
empty
(
$files
))
{
echo
"No files to process ! End of process ...
\n
"
;
...
...
@@ -80,7 +79,28 @@ class QRSeparator
copy
(
$ScanSource
.
$files
[
$key
],
$ScanSource
.
'FAILED/'
.
$files
[
$key
]);
}
//merge pages previously splited
$this
->
construct_pdf
(
sys_get_temp_dir
()
.
'/'
.
$key
,
$ResultDirectory
);
try
{
$result
=
$this
->
construct_pdf
(
sys_get_temp_dir
()
.
'/'
.
$key
,
$ResultDirectory
);
}
catch
(
Exception
$e
)
{
if
(
!
is_dir
(
$ScanSource
.
'files_errors/'
))
{
mkdir
(
$ScanSource
.
'files_errors/'
,
0755
,
true
);
}
shell_exec
(
'rm -Rf '
.
sys_get_temp_dir
()
.
'/'
.
$key
);
copy
(
$ScanSource
.
$files
[
$key
],
$ScanSource
.
'files_errors/'
.
$files
[
$key
]);
unlink
(
$ScanSource
.
$files
[
$key
]);
$num_file
++
;
continue
;
}
if
(
$result
==
'NOSEPARATOR'
)
{
shell_exec
(
'rm -Rf '
.
sys_get_temp_dir
()
.
'/'
.
$key
);
if
(
!
is_dir
(
$ScanSource
.
'files_noseparator/'
))
{
mkdir
(
$ScanSource
.
'files_noseparator/'
,
0755
,
true
);
}
copy
(
$ScanSource
.
$files
[
$key
],
$ScanSource
.
'files_noseparator/'
.
$files
[
$key
]);
unlink
(
$ScanSource
.
$files
[
$key
]);
$num_file
++
;
continue
;
}
unlink
(
$ScanSource
.
$files
[
$key
]);
rmdir
(
realpath
(
sys_get_temp_dir
()
.
'/'
.
$key
));
}
else
{
...
...
@@ -165,7 +185,6 @@ class QRSeparator
//Attempt to extract QRCODE
$qrcode
=
new
\
Zxing\QrReader
(
$split_directory
.
$file
);
$pdfdata
=
file_get_contents
(
$split_directory
.
$file
);
$text
=
$qrcode
->
text
();
...
...
@@ -217,6 +236,7 @@ class QRSeparator
$tplidx
=
$new_pdf
->
importPage
(
1
);
$new_pdf
->
useTemplate
(
$tplidx
);
return
'NOSEPARATOR'
;
}
/*
...
...
Write
Preview
Supports
Markdown
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