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 @@ ...@@ -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"> <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"> <step function="separatePDF" module="QRSeparator" name="separatePDF">
<input name="ScanSource">/opt/maarch/MaarchCapture/files/TEST_IMPORT/</input> <input name="ScanSource">/opt/maarch/MaarchCapture/files/TEST_IMPORT/</input>
<input name="qrcodePrefix">false</input>
</step> </step>
<step function="processBatch" module="MaarchWSClient" name="SendToMaarch"> <step function="processBatch" module="MaarchWSClient" name="SendToMaarch">
<input name="WSDL">MaarchRestWS</input> <input name="WSDL">MaarchRestWS</input>
......
...@@ -2,19 +2,28 @@ ...@@ -2,19 +2,28 @@
class QRSeparator class QRSeparator
{ {
public $qrcodePrefix = "false";
public function __construct() public function __construct()
{ {
$this->Batch = $_SESSION['capture']->Batch; $this->Batch = $_SESSION['capture']->Batch;
require __DIR__ . "/../../vendor/autoload.php"; require __DIR__ . "/../../vendor/autoload.php";
} }
public function separatePDF($ScanSource, $ResultDirectory = false) public function separatePDF($ScanSource, $qrcodePrefix, $ResultDirectory = false)
{ {
echo "Init process ...\n"; echo "Init process ...\n";
$_SESSION['capture']->logEvent( $_SESSION['capture']->logEvent(
"Init process ... " "Init process ... "
); );
$this->qrcodePrefix = $qrcodePrefix;
if ($qrcodePrefix == "true") {
echo "Prefix MAARCH_ is enabled !\n";
}
if (!is_readable($ScanSource)) { if (!is_readable($ScanSource)) {
echo "Source directory is not valid !\n"; echo "Source directory is not valid !\n";
$_SESSION['capture']->logEvent( $_SESSION['capture']->logEvent(
...@@ -56,7 +65,6 @@ class QRSeparator ...@@ -56,7 +65,6 @@ class QRSeparator
//Ignore all files except pdf //Ignore all files except pdf
if (strtolower($array_files[1]) == 'pdf') { if (strtolower($array_files[1]) == 'pdf') {
//call split function to sepearate pages //call split function to sepearate pages
try { try {
$this->split_pdf($ScanSource.$files[$key], sys_get_temp_dir().'/'.$key); $this->split_pdf($ScanSource.$files[$key], sys_get_temp_dir().'/'.$key);
...@@ -138,6 +146,7 @@ class QRSeparator ...@@ -138,6 +146,7 @@ class QRSeparator
public function construct_pdf($split_directory, $end_directory = false) public function construct_pdf($split_directory, $end_directory = false)
{ {
print_r($this->qrcodePrefix);
$end_directory = $end_directory ? $end_directory : sys_get_temp_dir().'/'; $end_directory = $end_directory ? $end_directory : sys_get_temp_dir().'/';
//$new_pdf = new FPDI(); //$new_pdf = new FPDI();
...@@ -160,6 +169,18 @@ class QRSeparator ...@@ -160,6 +169,18 @@ class QRSeparator
$text = $qrcode->text(); $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)) { if (!empty($text)) {
$isCourrier = false; $isCourrier = false;
echo "This is a separator ! Extract name ..."; 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