diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 9d318c1714bb7c24547718361fb8b9c23c5a9bdb..8206947c09867b081522831c54f716af964862a4 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -37,18 +37,18 @@ class PageController extends Controller { /** * @var array Payslip PDF search field list */ -// private $_payslipPDFSearchFieldList = array( -// 'siret' => array(3), -// 'matricule' => array(10), -// 'fullname' => array(9), -// 'zip_city' => array(19, 20), -// ); private $_payslipPDFSearchFieldList = array( - 'siret' => array(4, 5), - 'matricule' => array(20, 21), - 'fullname' => array(19, 20), - 'zip_city' => array(34, 35, 36, 37), + 'siret' => array(3), + 'matricule' => array(10), + 'fullname' => array(9), + 'zip_city' => array(19, 20), ); +// private $_payslipPDFSearchFieldList = array( +// 'siret' => array(4, 5), +// 'matricule' => array(20, 21), +// 'fullname' => array(19, 20), +// 'zip_city' => array(34, 35, 36, 37), +// ); /** * @var string CSV delimiter @@ -1102,20 +1102,20 @@ class PageController extends Controller { // pour chaque champ CSV a controler foreach ($checkCurrentValues as $checkField => $checkCurrentValue) { // verifier d'abord aux emplacements previsibles du PDF - //if ($checkField == 'siret') { - // // siret - // if (isset($this->_payslipPDFSearchFieldList[$checkField]) && !empty($this->_payslipPDFSearchFieldList[$checkField])) { - // foreach ($this->_payslipPDFSearchFieldList[$checkField] as $payslipPDFSearchFieldIndex) { - // $matchList = array(); - // if (preg_match('#SIRET:\s(\d+)\s\d+$#', $pdfPageTextList[$payslipPDFSearchFieldIndex], $matchList)) { - // if ($matchList[1] == $checkCurrentValue) { - // $pdfPageValues[$checkField] = $checkCurrentValue; - // continue; - // } - // } - // } - // } - //} else { + if ($checkField == 'siret') { + // siret + if (isset($this->_payslipPDFSearchFieldList[$checkField]) && !empty($this->_payslipPDFSearchFieldList[$checkField])) { + foreach ($this->_payslipPDFSearchFieldList[$checkField] as $payslipPDFSearchFieldIndex) { + $matchList = array(); + if (preg_match('#SIRET:\s(\d+)\s\d+$#', $pdfPageTextList[$payslipPDFSearchFieldIndex], $matchList)) { + if ($matchList[1] == $checkCurrentValue) { + $pdfPageValues[$checkField] = $checkCurrentValue; + continue; + } + } + } + } + } else { // siret, matricule, fullname, zip_city if (isset($this->_payslipPDFSearchFieldList[$checkField]) && !empty($this->_payslipPDFSearchFieldList[$checkField])) { foreach ($this->_payslipPDFSearchFieldList[$checkField] as $payslipPDFSearchFieldIndex) { @@ -1125,7 +1125,7 @@ class PageController extends Controller { } } } - //} + } if (!isset($pdfPageValues[$checkField])) { // si on a pas trouve aux emplacement previsibles du PDF @@ -1134,21 +1134,21 @@ class PageController extends Controller { // formater les champs textes du PDF (enlever les espaces) $pdfPageTextValue = trim($pdfPageText); - //if ($checkField == 'siret') { - // $matchList = array(); - // if (preg_match('#SIRET:\s(\d+)\s\d+$#', $pdfPageTextValue, $matchList)) { - // if ($matchList[1] == $checkCurrentValue) { - // $pdfPageValues[$checkField] = $checkCurrentValue; - // break; - // } - // } - //} else { + if ($checkField == 'siret') { + $matchList = array(); + if (preg_match('#SIRET:\s(\d+)\s\d+$#', $pdfPageTextValue, $matchList)) { + if ($matchList[1] == $checkCurrentValue) { + $pdfPageValues[$checkField] = $checkCurrentValue; + break; + } + } + } else { // siret, matricule, fullname, zip_city if ($pdfPageTextValue == $checkCurrentValue) { $pdfPageValues[$checkField] = $checkCurrentValue; break; } - //} + } } } }