Skip to content
Snippets Groups Projects
Commit a357840f authored by Patrick Barroca's avatar Patrick Barroca
Browse files

rel #37788 : fix file type verification on integration phases

parent 5deff756
Branches
Tags
10 merge requests!1553Master,!1519Master,!1502Master,!1501Stable,!1491Master,!1472Stable,!1461Stable,!1458Stable,!1455Dev#37788 negative fail de stable,!1454Stable
- ticket #37788 : Cosmogramme : correction du lancement de certaines phase pour des types de fichiers ne les concernant pas
\ No newline at end of file
...@@ -28,6 +28,9 @@ class Class_Cosmogramme_Integration_PhasePanier extends Class_Cosmogramme_Integr ...@@ -28,6 +28,9 @@ class Class_Cosmogramme_Integration_PhasePanier extends Class_Cosmogramme_Integr
protected function _init($new_phase) {} protected function _init($new_phase) {}
protected function _validateProfil($profil) { protected function _validateProfil($profil) {
if (!$profil->isBaskets())
return false;
$errors = []; $errors = [];
$fields = $this->getFields($profil); $fields = $this->getFields($profil);
......
...@@ -102,6 +102,9 @@ class Class_Cosmogramme_Integration_PhasePatrons extends Class_Cosmogramme_Integ ...@@ -102,6 +102,9 @@ class Class_Cosmogramme_Integration_PhasePatrons extends Class_Cosmogramme_Integ
/** return true if given profil parameters are correct for this phase */ /** return true if given profil parameters are correct for this phase */
protected function _validateProfil($profil) { protected function _validateProfil($profil) {
if (!$profil->isPatrons())
return false;
$errors = []; $errors = [];
$fields = $this->getFields($profil); $fields = $this->getFields($profil);
......
...@@ -29,15 +29,21 @@ class Class_Cosmogramme_Integration_PhaseReservation extends Class_Cosmogramme_I ...@@ -29,15 +29,21 @@ class Class_Cosmogramme_Integration_PhaseReservation extends Class_Cosmogramme_I
protected function _init($new_phase) {} protected function _init($new_phase) {}
protected function _afterFileProcessed($integration) {} protected function _afterFileProcessed($integration) {}
protected function _validateProfil($profil) { protected function _validateProfil($profil) {
return $profil->isHolds(); return $profil->isHolds();
} }
protected function _processLine($line, $integration) { protected function _processLine($line, $integration) {
$transaction = new Class_Cosmogramme_Integration_Transaction($integration); $transaction = new Class_Cosmogramme_Integration_Transaction($integration);
$line->withDataDo([$transaction, 'importHold']); $line->withDataDo(
function($data) use ($transaction){
return $transaction->importHold($data);
});
} }
...@@ -47,7 +53,7 @@ class Class_Cosmogramme_Integration_PhaseReservation extends Class_Cosmogramme_I ...@@ -47,7 +53,7 @@ class Class_Cosmogramme_Integration_PhaseReservation extends Class_Cosmogramme_I
protected function _shouldIgnoreLine($line, $integration) { protected function _shouldIgnoreLine($line, $integration) {
return $line->withDataDo([$this, 'isPergameHeader']); return $line->withDataDo(function($data) { return $this->isPergameHeader($data); });
} }
......
...@@ -485,7 +485,6 @@ class Class_IntProfilDonnees extends Storm_Model_Abstract { ...@@ -485,7 +485,6 @@ class Class_IntProfilDonnees extends Storm_Model_Abstract {
} }
public function setTypeDocField($value) { public function setTypeDocField($value) {
return $this->setItemField(self::FIELD_ITEM_TYPE_DOC, $value); return $this->setItemField(self::FIELD_ITEM_TYPE_DOC, $value);
} }
...@@ -515,6 +514,17 @@ class Class_IntProfilDonnees extends Storm_Model_Abstract { ...@@ -515,6 +514,17 @@ class Class_IntProfilDonnees extends Storm_Model_Abstract {
return self::FT_RECORDS == $this->getTypeFichier(); return self::FT_RECORDS == $this->getTypeFichier();
} }
public function isBaskets() {
return self::FT_BASKETS == $this->getTypeFichier();
}
public function isPatrons() {
return self::FT_PATRONS == $this->getTypeFichier();
}
public function getSeparator() { public function getSeparator() {
switch ($this->getFormat()) { switch ($this->getFormat()) {
case self::FORMAT_SEMI_COLON_ASCII : return ';';break; case self::FORMAT_SEMI_COLON_ASCII : return ';';break;
......
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