diff --git a/src/module_extraction/web_service/ws/ExtractionExtraction.class.sql.inc b/src/module_extraction/web_service/ws/ExtractionExtraction.class.sql.inc index de8f6493a3cadc148c8a131a1f2fc8f75b982163..ae9cf0a2ecdd676b675072868da1260d719486d5 100755 --- a/src/module_extraction/web_service/ws/ExtractionExtraction.class.sql.inc +++ b/src/module_extraction/web_service/ws/ExtractionExtraction.class.sql.inc @@ -18,5 +18,6 @@ $aSql['getRtLayer'] = 'SELECT distinct layer_id, layer, category, mutualized, st $aSql['getUserGroups'] = 'SELECT name FROM [schema_framework]."group",[schema_framework].user_group WHERE "group".group_id = user_group.group_id AND user_group.user_id = [user_id]'; -$aSql['getDepositFile'] = 'SELECT wk_params FROM [schema_gtf]."order" WHERE "order".order_id = [bo_id];' +$aSql['getDepositFile'] = 'SELECT wk_params FROM [schema_gtf]."order" WHERE "order".order_id = [bo_id]'; +$aSql['getFormat'] = 'SELECT format FROM [schema_gtf]."order" WHERE "order".order_id = [bo_id]'; ?> \ No newline at end of file diff --git a/src/module_extraction/web_service/ws/Extraction_depots.class.inc b/src/module_extraction/web_service/ws/Extraction_depots.class.inc index 8d96ea827c316c3266f17fc242e2de5a7f14c838..412f3ddd904395d72d975b8a0220ea1ecc87854a 100755 --- a/src/module_extraction/web_service/ws/Extraction_depots.class.inc +++ b/src/module_extraction/web_service/ws/Extraction_depots.class.inc @@ -394,11 +394,17 @@ class Extraction_depots extends ExtractionExtraction $sExtension = '*.' . end(explode(".", $this->aValues["control_file_name"])); if (in_array($sExtension, explode("|", $this->aProperties['sig'])) or in_array($sExtension, explode("|", $this->aProperties['dao']))) { + $sSchemaContrainte = ""; + if (in_array($sExtension, explode("|", $this->aProperties['sig']))) { + $sSchemaContrainte = $this->aProperties["schema_sig"]; + } elseif (in_array($sExtension, explode("|", $this->aProperties['dao']))) { + $sSchemaContrainte = $this->aProperties["schema_dao"]; + } $this->oBO = new WabBusinessObject($this->oConnection->oBd, array(), $this->aValues, $this->aProperties, 'extraction', $this->aValues['bo_id']); - $this->oBO->insertOrder('EM0160AYYTK48', 'sourceDir=' . end(explode("/", $sDirPath)) . '/' . $this->aValues["input_deposit_name"] . '|sourceMotif=' . $sExtension . '|schema=' . $sSchemaContrainte . '|format=ACAD'); + $this->oBO->insertOrder('EM0160AYYTK48', 'bo_id=' . $this->aValues["bo_id"] . '|sourceDir=' . end(explode("/", $sDirPath)) . '/' . $this->aValues["control_file_name"] . '|sourceMotif=' . $sExtension . '|schema=' . $sSchemaContrainte . '|format=ACAD'); } else { //Si l'extension n'est pas bonne - $error_message .= $this->aValues["control_file_name"] . " format is not authaurized (". $sExtension . ")"; + $error_message .= $this->aValues["control_file_name"] . " format is not authaurized (" . $sExtension . ")"; writeToErrorLog("WARNING: " . $error_message); $aXmlRacineAttribute['status'] = 0; diff --git a/src/module_extraction/web_service/ws/Extractions.class.inc b/src/module_extraction/web_service/ws/Extractions.class.inc index c3cbe333d6d860653c47565e529400cf5cd4a2b0..3b51292aa7cb4144fb40ee59b2de6392df293974 100755 --- a/src/module_extraction/web_service/ws/Extractions.class.inc +++ b/src/module_extraction/web_service/ws/Extractions.class.inc @@ -244,11 +244,11 @@ class Extractions extends ExtractionExtraction //Si l'extension est autorisée if (in_array($sExtension, explode("|", $this->aProperties['sig'])) || in_array($sExtension, explode("|", $this->aProperties['dao']))) { + $sSchemaContrainte = ""; if (in_array($sExtension, explode("|", $this->aProperties['sig']))) { $sSchemaContrainte = $this->aProperties["schema_sig"]; - } elseif (in_array($sExtension, explode("|", $this->aProperties['dao']))) - { + } elseif (in_array($sExtension, explode("|", $this->aProperties['dao']))) { $sSchemaContrainte = $this->aProperties["schema_dao"]; } // Méthode de transition. @@ -266,8 +266,9 @@ class Extractions extends ExtractionExtraction $fp = fopen($sDirPath . '/' . utf8_decode($this->aValues["input_deposit_name"]), "w"); fwrite($fp, $this->aValues["input_deposit_file"]); fclose($fp); + error_log($this->aValues["bo_id"]); //Demande GTF - $this->oBO->insertOrder('EM0160AYYTK48', 'sourceDir=' . end(explode("/", $sDirPath)) . '/' . $this->aValues["input_deposit_name"] . '|sourceMotif=' . $sExtension . '|schema=' . $sSchemaContrainte . '|format=ACAD'); + $this->oBO->insertOrder('EM0160AYYTK48', 'bo_id=' . $this->aValues["bo_id"] . '|sourceDir=' . end(explode("/", $sDirPath)) . '/' . $this->aValues["input_deposit_name"] . '|sourceMotif=' . $sExtension . '|schema=' . $sSchemaContrainte . '|format=ACAD'); } else { //Si l'extension n'est pas bonne $error_message .= $this->aValues["input_deposit_name"] . " format is not authaurized (" . $sExtension . ")"; @@ -548,8 +549,8 @@ class Extractions extends ExtractionExtraction public function trDeposer() { $this->oBO = new WabBusinessObject($this->oConnection->oBd, array(), $this->aValues, $this->aProperties, 'extraction', $this->aValues['bo_id']); - // Check si la table existe si oui change l'état - $this->oBO->wabSetStatus($this->aProperties["schema_extraction"], "extraction", "bo_id", $this->aValues["bo_id"], "Fichier déposé"); + // Check si la table existe si oui change l'état + $this->oBO->wabSetStatus($this->aProperties["schema_extraction"], "extraction", "bo_id", $this->aValues["bo_id"], "Fichier déposé"); } @@ -571,14 +572,15 @@ class Extractions extends ExtractionExtraction public function trAccepter() { $this->oBO = new WabBusinessObject($this->oConnection->oBd, array(), $this->aValues, $this->aProperties, 'extraction', $this->aValues['bo_id']); - // Check si la table existe si oui change l'état $this->oBO->wabSetStatus($this->aProperties["schema_extraction"], "extraction", "bo_id", $this->aValues["bo_id"], "Fichier accepté"); - + + $this->sRessourcesFile = "ExtractionExtraction.class.sql.inc"; + require $this->sRessourcesFile; $sSql = $aSql['getDepositFile']; $aSQLParams = array( 'schema_gtf' => array('value' => $this->aProperties['schema_gtf'], 'type' => 'schema_name'), - 'bo_id' => array('value' => $this->aValues['bo_id'], 'type' => 'integer'), + 'bo_id' => array('value' => $this->aValues['bo_id'], 'type' => 'number'), ); $oPDOresult = $this->oConnection->oBd->executeWithParams($sSql, $aSQLParams); @@ -589,6 +591,8 @@ class Extractions extends ExtractionExtraction } } + $sDirPath = $this->aProperties["upload_dir"] . $sParams[0]; + //$this->oBO->sendmail(id_du_mail_pour_dire_que_le_fichier_est_accepté); $this->trReception(); @@ -599,6 +603,7 @@ class Extractions extends ExtractionExtraction */ public function trInvalider() { + error_log("Invalidé"); $this->oBO = new WabBusinessObject($this->oConnection->oBd, array(), $this->aValues, $this->aProperties, 'extraction', $this->aValues['bo_id']); // Check si la table existe si oui change l'état