Verified Commit 81de276a authored by Alex ORLUC's avatar Alex ORLUC

FEAT #10160 TIME 2:30 add prefix param for qrseparator

parent b83f2705
Pipeline #3778 failed with stage
in 3 minutes and 57 seconds
......@@ -12,6 +12,7 @@
<workflow name="SCAN_MASS" debug="false" logMode="Maarch" maarchLogParam="/var/www/html/MaarchCourrier/apps/maarch_entreprise/xml/log4php.xml" maarchLoggerName="loggerTechnique">
<step function="separatePDF" module="QRSeparator" name="separatePDF">
<input name="ScanSource">/opt/maarch/MaarchCapture/files/TEST_IMPORT/</input>
<input name="qrcodePrefix">false</input>
</step>
<step function="processBatch" module="MaarchWSClient" name="SendToMaarch">
<input name="WSDL">MaarchRestWS</input>
......
......@@ -2,19 +2,28 @@
class QRSeparator
{
public $qrcodePrefix = "false";
public function __construct()
{
$this->Batch = $_SESSION['capture']->Batch;
require __DIR__ . "/../../vendor/autoload.php";
}
public function separatePDF($ScanSource, $ResultDirectory = false)
public function separatePDF($ScanSource, $qrcodePrefix, $ResultDirectory = false)
{
echo "Init process ...\n";
$_SESSION['capture']->logEvent(
"Init process ... "
);
$this->qrcodePrefix = $qrcodePrefix;
if ($qrcodePrefix == "true") {
echo "Prefix MAARCH_ is enabled !\n";
}
if (!is_readable($ScanSource)) {
echo "Source directory is not valid !\n";
$_SESSION['capture']->logEvent(
......@@ -56,7 +65,6 @@ class QRSeparator
//Ignore all files except pdf
if (strtolower($array_files[1]) == 'pdf') {
//call split function to sepearate pages
try {
$this->split_pdf($ScanSource.$files[$key], sys_get_temp_dir().'/'.$key);
......@@ -138,6 +146,7 @@ class QRSeparator
public function construct_pdf($split_directory, $end_directory = false)
{
print_r($this->qrcodePrefix);
$end_directory = $end_directory ? $end_directory : sys_get_temp_dir().'/';
//$new_pdf = new FPDI();
......@@ -160,6 +169,18 @@ class QRSeparator
$text = $qrcode->text();
var_dump($text);
if ($this->qrcodePrefix == "true" && !empty($text)) {
if (preg_match("/^MAARCH_/i", $text)) {
$text = preg_replace("/^MAARCH_/i", '', $text);
echo "Un résultat a été trouvé.";
} else {
$text = '';
echo "Aucun résultat n'a été trouvé.";
}
}
if (!empty($text)) {
$isCourrier = false;
echo "This is a separator ! Extract name ...";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment