diff --git a/src/module_anc/web_service/conf/properties.inc b/src/module_anc/web_service/conf/properties.inc index 49ff6cc5d92f56cd3041f402deee449567e41717..8ac9596648d42b3d4bbf8f11d1902d18a386d30b 100755 --- a/src/module_anc/web_service/conf/properties.inc +++ b/src/module_anc/web_service/conf/properties.inc @@ -1,5 +1,6 @@ <?php $properties["schema_anc"] = 's_anc'; + $properties["anc"]["files_container"] = 'anc'; $properties["anc"]["cont_zone_urba"]["intersect"]["schema"] = ''; $properties["anc"]["cont_zone_urba"]["intersect"]["table"] = ''; $properties["anc"]["cont_zone_urba"]["intersect"]["column"] = ''; diff --git a/src/module_anc/web_service/ws/Anc.class.inc b/src/module_anc/web_service/ws/Anc.class.inc index 02e930b9b1167af55d50459475a0d9fd1e4e18c0..b101f7e20a08b8d068f7871356deb92fec1779c8 100755 --- a/src/module_anc/web_service/ws/Anc.class.inc +++ b/src/module_anc/web_service/ws/Anc.class.inc @@ -8,8 +8,9 @@ class Anc extends Vitis { //Chemin du fichier de ressources contenant les requêtes SQL var $sRessourcesFile = 'ws/anc/Anc.class.sql.inc'; - + /** + * DEPRECATED * Upload un document dans le ws_data du module Anc. * @param type $sIndex * @param type $sFolder @@ -38,4 +39,4 @@ class Anc extends Vitis { } } } -?> \ No newline at end of file +?> diff --git a/src/module_anc/web_service/ws/Controle.class.inc b/src/module_anc/web_service/ws/Controle.class.inc index 0aafbd8a8ccf6947a7c23f653647f727a2b8da3a..aa8ebe27980eca688b4b391d235a545eba457101 100755 --- a/src/module_anc/web_service/ws/Controle.class.inc +++ b/src/module_anc/web_service/ws/Controle.class.inc @@ -14,7 +14,7 @@ require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection * \brief This file contains the Controle php class * * This class defines operation for one Controle - * + * */ class Controle extends Anc { @@ -32,10 +32,11 @@ class Controle extends Anc { $this->aPath = $aPath; $this->aProperties = $properties; $this->oConnection = new Connection($this->aValues, $this->aProperties); + $this->oFilesManager = new Files_manager($this->aProperties); } /** - * @SWG\Get(path="/controles/{id_controle}", + * @SWG\Get(path="/controles/{id_controle}", * tags={"Controles"}, * summary="Get Controle", * description="Request to get Controle by id", @@ -75,22 +76,7 @@ class Controle extends Anc { * get informations about mode */ function GET() { - $this->aFields = $this->getFields($this->aProperties['schema_anc'], "v_controle", "id_controle"); - // Url des fichiers. - $sWsDataUrl = $this->aProperties['web_server_name'] . '/' . $this->aProperties['ws_data_alias'] . '/anc/anc_saisie_anc_controle/documents/' . $this->aValues["my_vitis_id"]; - if (!empty($this->aFields['photos_f'])) - $this->aFields['photos_f'] = $sWsDataUrl . '/photos_f/' . $this->aFields['photos_f']; - if (!empty($this->aFields['fiche_f'])) - $this->aFields['fiche_f'] = $sWsDataUrl . '/fiche_f/' . $this->aFields['fiche_f']; - if (!empty($this->aFields['rapport_f'])) - $this->aFields['rapport_f'] = $sWsDataUrl . '/rapport_f/' . $this->aFields['rapport_f']; - if (!empty($this->aFields['schema_f'])) - $this->aFields['schema_f'] = $sWsDataUrl . '/schema_f/' . $this->aFields['schema_f']; - if (!empty($this->aFields['documents_f'])) - $this->aFields['documents_f'] = $sWsDataUrl . '/documents_f/' . $this->aFields['documents_f']; - if (!empty($this->aFields['plan_f'])) - $this->aFields['plan_f'] = $sWsDataUrl . '/plan_f/' . $this->aFields['plan_f']; - + $this->aFields = $this->getFields($this->aProperties['schema_anc'], 'v_controle', 'id_controle', 'anc_saisie_anc_controle', $this->aProperties['anc']['files_container']); // Champ sur lequel sera fait le typage pour changer les styles etc.. $this->sTyleField = 'composant_type'; // custom_form du controle pour map_workbench @@ -208,7 +194,7 @@ class Controle extends Anc { if (!empty($aStyle['image'])) { $aGeoJSONStyle['draw']['image'] = $aStyle['image']; } - // Text + // Text if (!empty($aStyle['text_font'])) { $aGeoJSONStyle['text']['font'] = $aStyle['text_font']; } @@ -260,4 +246,4 @@ class Controle extends Anc { } -?> \ No newline at end of file +?> diff --git a/src/module_anc/web_service/ws/Controles.class.inc b/src/module_anc/web_service/ws/Controles.class.inc index 51f0e88c7d2abcd385131fe9cdd8219279b9d7b8..74b669c39827087d60d115f2f656d895b168f86d 100755 --- a/src/module_anc/web_service/ws/Controles.class.inc +++ b/src/module_anc/web_service/ws/Controles.class.inc @@ -9,7 +9,7 @@ * \brief This file contains the Controles php class * * This class defines Rest Api to Vitis Controles - * + * */ require_once __DIR__ . '/Anc.class.inc'; require_once 'Controle.class.inc'; @@ -44,6 +44,7 @@ class Controles extends Anc { $this->aPath = $aPath; $this->aProperties = $properties; $this->oConnection = new Connection($this->aValues, $this->aProperties); + $this->oFilesManager = new Files_manager($this->aProperties); } /** @@ -162,19 +163,7 @@ class Controles extends Anc { //$this->aValues['des_date_control'] = date('Y-m-d'); if (empty($this->aValues['des_interval_control'])) $this->aValues['des_interval_control'] = 0; - // Sauve le nom des fichiers. - if (!empty($_FILES['photos_f'])) - $this->aValues['photos_f'] = $_FILES['photos_f']["name"]; - if (!empty($_FILES['fiche_f'])) - $this->aValues['fiche_f'] = $_FILES['fiche_f']["name"]; - if (!empty($_FILES['rapport_f'])) - $this->aValues['rapport_f'] = $_FILES['rapport_f']["name"]; - if (!empty($_FILES['schema_f'])) - $this->aValues['schema_f'] = $_FILES['schema_f']["name"]; - if (!empty($_FILES['documents_f'])) - $this->aValues['documents_f'] = $_FILES['documents_f']["name"]; - if (!empty($_FILES['plan_f'])) - $this->aValues['plan_f'] = $_FILES['plan_f']["name"]; + // Conversion des dates $aDates = array('cl_date_avis', 'cl_facture_le', 'des_date_installation', 'des_date_recommande', 'dep_date_depot', 'dep_date_envoi_incomplet', 'des_date_control'); foreach ($aDates as $sDate) { @@ -185,16 +174,20 @@ class Controles extends Anc { $this->aValues[$sDate] = date_format(date_create_from_format('d/m/Y', $this->aValues[$sDate]), 'Y-m-d'); } } - // - $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'v_controle', $this->aProperties['schema_anc'] . '.controle_id_controle_seq', 'id_controle'); - // Upload les fichiers. - $this->uploadDocument('photos_f', 'anc_saisie_anc_controle'); - $this->uploadDocument('fiche_f', 'anc_saisie_anc_controle'); - $this->uploadDocument('rapport_f', 'anc_saisie_anc_controle'); - $this->uploadDocument('schema_f', 'anc_saisie_anc_controle'); - $this->uploadDocument('documents_f', 'anc_saisie_anc_controle'); - $this->uploadDocument('plan_f', 'anc_saisie_anc_controle'); - // + + // Fichiers à uploader + $aUploadFiles = array( + 'photos_f' => [], + 'fiche_f' => [], + 'rapport_f' => [], + 'schema_f' => [], + 'documents_f' => [], + 'plan_f' => [] + ); + + // Envoi Post + $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'v_controle', $this->aProperties['schema_anc'] . '.controle_id_controle_seq', 'id_controle', $aUploadFiles, 'anc_saisie_anc_controle', $this->aProperties['anc']['files_container']); + return $aReturn['sMessage']; } @@ -237,13 +230,6 @@ class Controles extends Anc { $this->aValues['maj'] = $_SESSION["ses_Login"]; if (empty($this->aValues['maj_date'])) $this->aValues['maj_date'] = date('Y-m-d'); - // Upload les fichiers. - $this->uploadDocument('photos_f', 'anc_saisie_anc_controle'); - $this->uploadDocument('fiche_f', 'anc_saisie_anc_controle'); - $this->uploadDocument('rapport_f', 'anc_saisie_anc_controle'); - $this->uploadDocument('schema_f', 'anc_saisie_anc_controle'); - $this->uploadDocument('documents_f', 'anc_saisie_anc_controle'); - $this->uploadDocument('plan_f', 'anc_saisie_anc_controle'); // Si il y a des composants à ajouter/supprimer/mettre à jour if (!empty($this->aValues['composants'])) { @@ -267,8 +253,19 @@ class Controles extends Anc { $this->aValues[$sDate] = date_format(date_create_from_format('d/m/Y', $this->aValues[$sDate]), 'Y-m-d'); } } - // - $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'v_controle', 'id_controle'); + + // Fichiers à uploader + $aUploadFiles = array( + 'photos_f' => [], + 'fiche_f' => [], + 'rapport_f' => [], + 'schema_f' => [], + 'documents_f' => [], + 'plan_f' => [] + ); + + // Mise à jour + $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'v_controle', 'id_controle', $aUploadFiles, 'anc_saisie_anc_controle', $this->aProperties['anc']['files_container']); return $aReturn['sMessage']; } @@ -411,14 +408,6 @@ class Controles extends Anc { // Supprime les objets dépendants $this->deleteControleDependencies($this->aValues['idList']); - -// $aParams['idControle'] = array('value' => $this->aValues['id_controle'], 'type' => 'integer'); -// $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getInstallationControls'], $aParams); -// if ($this->oConnection->oBd->enErreur()) { -// $aReturn = array('status' => 0, 'message' => $this->oConnection->oBd->getBDMessage(), 'error_code' => 1); -// return json_encode($aReturn); -// } - $aReturn = $this->genericDelete($this->aProperties['schema_anc'], 'v_controle', 'id_controle'); return $aReturn['sMessage']; } @@ -440,7 +429,7 @@ class Controles extends Anc { // Suppression dpépendance s_anc.traitement $this->deleteControleTraitements($sIdControles); - + // Suppression dpépendance s_anc.composant $this->deleteControleComposants($sIdControles); } @@ -716,4 +705,4 @@ class Controles extends Anc { } -?> \ No newline at end of file +?> diff --git a/src/module_anc/web_service/ws/Evacuation_eaux.class.inc b/src/module_anc/web_service/ws/Evacuation_eaux.class.inc index 6021f86278c6e9665e92487dc22ea65966720923..47191074c3aaf4e75282a36dc643bfec8b897e80 100755 --- a/src/module_anc/web_service/ws/Evacuation_eaux.class.inc +++ b/src/module_anc/web_service/ws/Evacuation_eaux.class.inc @@ -12,7 +12,7 @@ require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection * \brief This file contains the Evacuation_eaux php class * * This class defines operation for one Evacuation_eaux - * + * */ class Evacuation_eaux extends Anc { @@ -30,10 +30,11 @@ class Evacuation_eaux extends Anc { $this->aPath = $aPath; $this->aProperties = $properties; $this->oConnection = new Connection($this->aValues, $this->aProperties); + $this->oFilesManager = new Files_manager($this->aProperties); } /** - * @SWG\Get(path="/evacuation_eauxs/{id_evacuation_eaux}", + * @SWG\Get(path="/evacuation_eauxs/{id_evacuation_eaux}", * tags={"Evacuation_eauxs"}, * summary="Get Evacuation_eaux", * description="Request to get Evacuation_eaux by id", @@ -73,19 +74,7 @@ class Evacuation_eaux extends Anc { * get informations about mode */ function GET() { - $this->aFields = $this->getFields($this->aProperties['schema_anc'], "v_evacuation_eaux", "id_eva"); - // Url des fichiers. - $sWsDataUrl = $this->aProperties['web_server_name'] . '/' . $this->aProperties['ws_data_alias'] . '/anc/anc_saisie_anc_evacuation_eaux/documents/' . $this->aValues["my_vitis_id"]; - if (!empty($this->aFields['photos_f'])) - $this->aFields['photos_f'] = $sWsDataUrl . '/photos_f/' . $this->aFields['photos_f']; - if (!empty($this->aFields['fiche_f'])) - $this->aFields['fiche_f'] = $sWsDataUrl . '/fiche_f/' . $this->aFields['fiche_f']; - if (!empty($this->aFields['schema_f'])) - $this->aFields['schema_f'] = $sWsDataUrl . '/schema_f/' . $this->aFields['schema_f']; - if (!empty($this->aFields['documents_f'])) - $this->aFields['documents_f'] = $sWsDataUrl . '/documents_f/' . $this->aFields['documents_f']; - if (!empty($this->aFields['plan_f'])) - $this->aFields['plan_f'] = $sWsDataUrl . '/plan_f/' . $this->aFields['plan_f']; + $this->aFields = $this->getFields($this->aProperties['schema_anc'], 'v_evacuation_eaux', 'id_eva', 'anc_saisie_anc_evacuation_eaux', $this->aProperties['anc']['files_container']); } /** @@ -102,4 +91,4 @@ class Evacuation_eaux extends Anc { } -?> \ No newline at end of file +?> diff --git a/src/module_anc/web_service/ws/Evacuation_eauxs.class.inc b/src/module_anc/web_service/ws/Evacuation_eauxs.class.inc index e7bafb94f732b5ad60aaae77a4412bb8e8b3acc2..de866e5aa38af63cffe8eb050ba495993aa8b41f 100755 --- a/src/module_anc/web_service/ws/Evacuation_eauxs.class.inc +++ b/src/module_anc/web_service/ws/Evacuation_eauxs.class.inc @@ -9,7 +9,7 @@ * \brief This file contains the Evacuation_eauxs php class * * This class defines Rest Api to Vitis Evacuation_eauxs - * + * */ require_once __DIR__ . '/Anc.class.inc'; require_once 'Evacuation_eaux.class.inc'; @@ -40,6 +40,7 @@ class Evacuation_eauxs extends Anc { $this->aPath = $aPath; $this->aProperties = $properties; $this->oConnection = new Connection($this->aValues, $this->aProperties); + $this->oFilesManager = new Files_manager($this->aProperties); } /** @@ -154,26 +155,18 @@ class Evacuation_eauxs extends Anc { function POST() { $this->aValues['create'] = $_SESSION["ses_Login"]; $this->aValues['create_date'] = date('Y-m-d'); - // Sauve le nom des fichiers. - if (!empty($_FILES['photos_f'])) - $this->aValues['photos_f'] = $_FILES['photos_f']["name"]; - if (!empty($_FILES['fiche_f'])) - $this->aValues['fiche_f'] = $_FILES['fiche_f']["name"]; - if (!empty($_FILES['schema_f'])) - $this->aValues['schema_f'] = $_FILES['schema_f']["name"]; - if (!empty($_FILES['documents_f'])) - $this->aValues['documents_f'] = $_FILES['documents_f']["name"]; - if (!empty($_FILES['plan_f'])) - $this->aValues['plan_f'] = $_FILES['plan_f']["name"]; - // - $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'v_evacuation_eaux', $this->aProperties['schema_anc'].'.evacuation_eaux_id_eva_seq', 'id_eva'); - // Upload les fichiers. - $this->uploadDocument('photos_f', 'anc_saisie_anc_evacuation_eaux'); - $this->uploadDocument('fiche_f', 'anc_saisie_anc_evacuation_eaux'); - $this->uploadDocument('schema_f', 'anc_saisie_anc_evacuation_eaux'); - $this->uploadDocument('documents_f', 'anc_saisie_anc_evacuation_eaux'); - $this->uploadDocument('plan_f', 'anc_saisie_anc_evacuation_eaux'); - // + + // Fichiers à uploader + $aUploadFiles = array( + 'photos_f' => [], + 'fiche_f' => [], + 'schema_f' => [], + 'documents_f' => [], + 'plan_f' => [] + ); + + // Envoi Post + $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'v_evacuation_eaux', $this->aProperties['schema_anc'].'.evacuation_eaux_id_eva_seq', 'id_eva', $aUploadFiles, 'anc_saisie_anc_evacuation_eaux', $this->aProperties['anc']['files_container']); return $aReturn['sMessage']; } @@ -216,14 +209,18 @@ class Evacuation_eauxs extends Anc { $this->aValues['maj'] = $_SESSION["ses_Login"]; if (empty($this->aValues['maj_date'])) $this->aValues['maj_date'] = date('Y-m-d'); - // Upload les fichiers. - $this->uploadDocument('photos_f', 'anc_saisie_anc_evacuation_eaux'); - $this->uploadDocument('fiche_f', 'anc_saisie_anc_evacuation_eaux'); - $this->uploadDocument('schema_f', 'anc_saisie_anc_evacuation_eaux'); - $this->uploadDocument('documents_f', 'anc_saisie_anc_evacuation_eaux'); - $this->uploadDocument('plan_f', 'anc_saisie_anc_evacuation_eaux'); - // - $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'v_evacuation_eaux', 'id_eva'); + + // Fichiers à uploader + $aUploadFiles = array( + 'photos_f' => [], + 'fiche_f' => [], + 'schema_f' => [], + 'documents_f' => [], + 'plan_f' => [] + ); + + // Envoi Put + $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'v_evacuation_eaux', 'id_eva', $aUploadFiles, 'anc_saisie_anc_evacuation_eaux', $this->aProperties['anc']['files_container']); return $aReturn['sMessage']; } @@ -294,4 +291,4 @@ class Evacuation_eauxs extends Anc { return $aReturn['sMessage']; } } -?> \ No newline at end of file +?> diff --git a/src/module_anc/web_service/ws/Filieres_agree.class.inc b/src/module_anc/web_service/ws/Filieres_agree.class.inc index 4630c33c038ea1a837f1dfc929a1cf947df132c8..a8af8ab19140cd31178184373302ed8b7152b0c7 100755 --- a/src/module_anc/web_service/ws/Filieres_agree.class.inc +++ b/src/module_anc/web_service/ws/Filieres_agree.class.inc @@ -12,7 +12,7 @@ require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection * \brief This file contains the Filieres_agree php class * * This class defines operation for one Filieres_agree - * + * */ class Filieres_agree extends Anc { @@ -30,10 +30,11 @@ class Filieres_agree extends Anc { $this->aPath = $aPath; $this->aProperties = $properties; $this->oConnection = new Connection($this->aValues, $this->aProperties); + $this->oFilesManager = new Files_manager($this->aProperties); } /** - * @SWG\Get(path="/filieres_agrees/{id_filieres_agree}", + * @SWG\Get(path="/filieres_agrees/{id_filieres_agree}", * tags={"Filieres_agrees"}, * summary="Get Filieres_agree", * description="Request to get Filieres_agree by id", @@ -73,19 +74,7 @@ class Filieres_agree extends Anc { * get informations about mode */ function GET() { - $this->aFields = $this->getFields($this->aProperties['schema_anc'], "v_filieres_agrees", "id_fag"); - // Url des fichiers. - $sWsDataUrl = $this->aProperties['web_server_name'] . '/' . $this->aProperties['ws_data_alias'] . '/anc/anc_saisie_anc_filieres_agree/documents/' . $this->aValues["my_vitis_id"]; - if (!empty($this->aFields['photos_f'])) - $this->aFields['photos_f'] = $sWsDataUrl . '/photos_f/' . $this->aFields['photos_f']; - if (!empty($this->aFields['fiche_f'])) - $this->aFields['fiche_f'] = $sWsDataUrl . '/fiche_f/' . $this->aFields['fiche_f']; - if (!empty($this->aFields['schema_f'])) - $this->aFields['schema_f'] = $sWsDataUrl . '/schema_f/' . $this->aFields['schema_f']; - if (!empty($this->aFields['documents_f'])) - $this->aFields['documents_f'] = $sWsDataUrl . '/documents_f/' . $this->aFields['documents_f']; - if (!empty($this->aFields['plan_f'])) - $this->aFields['plan_f'] = $sWsDataUrl . '/plan_f/' . $this->aFields['plan_f']; + $this->aFields = $this->getFields($this->aProperties['schema_anc'], 'v_filieres_agrees', 'id_fag', 'anc_saisie_anc_filieres_agree', $this->aProperties['anc']['files_container']); } /** @@ -102,4 +91,4 @@ class Filieres_agree extends Anc { } -?> \ No newline at end of file +?> diff --git a/src/module_anc/web_service/ws/Filieres_agrees.class.inc b/src/module_anc/web_service/ws/Filieres_agrees.class.inc index f8480883e30010efa04cb9c20ad1db8747f33179..92aff066305f0f00934d7c52bea235d0cf5c2a55 100755 --- a/src/module_anc/web_service/ws/Filieres_agrees.class.inc +++ b/src/module_anc/web_service/ws/Filieres_agrees.class.inc @@ -9,7 +9,7 @@ * \brief This file contains the Filieres_agrees php class * * This class defines Rest Api to Vitis Filieres_agrees - * + * */ require_once __DIR__ . '/Anc.class.inc'; require_once 'Filieres_agree.class.inc'; @@ -40,6 +40,7 @@ class Filieres_agrees extends Anc { $this->aPath = $aPath; $this->aProperties = $properties; $this->oConnection = new Connection($this->aValues, $this->aProperties); + $this->oFilesManager = new Files_manager($this->aProperties); } /** @@ -154,17 +155,7 @@ class Filieres_agrees extends Anc { function POST() { $this->aValues['create'] = $_SESSION["ses_Login"]; $this->aValues['create_date'] = date('Y-m-d'); - // Sauve le nom des fichiers. - if (!empty($_FILES['photos_f'])) - $this->aValues['photos_f'] = $_FILES['photos_f']["name"]; - if (!empty($_FILES['fiche_f'])) - $this->aValues['fiche_f'] = $_FILES['fiche_f']["name"]; - if (!empty($_FILES['schema_f'])) - $this->aValues['schema_f'] = $_FILES['schema_f']["name"]; - if (!empty($_FILES['documents_f'])) - $this->aValues['documents_f'] = $_FILES['documents_f']["name"]; - if (!empty($_FILES['plan_f'])) - $this->aValues['plan_f'] = $_FILES['plan_f']["name"]; + // Conversion des dates if (isset($this->aValues['fag_en_date'])) { if ($this->aValues['fag_en_date'] == '') @@ -172,15 +163,18 @@ class Filieres_agrees extends Anc { else $this->aValues['fag_en_date'] = date_format(date_create_from_format('d/m/Y', $this->aValues['fag_en_date']), 'Y-m-d'); } - // - $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'v_filieres_agrees', $this->aProperties['schema_anc'].'.filieres_agrees_id_fag_seq', 'id_fag'); - // Upload les fichiers. - $this->uploadDocument('photos_f', 'anc_saisie_anc_filieres_agree'); - $this->uploadDocument('fiche_f', 'anc_saisie_anc_filieres_agree'); - $this->uploadDocument('schema_f', 'anc_saisie_anc_filieres_agree'); - $this->uploadDocument('documents_f', 'anc_saisie_anc_filieres_agree'); - $this->uploadDocument('plan_f', 'anc_saisie_anc_filieres_agree'); - // + + // Fichiers à uploader + $aUploadFiles = array( + 'photos_f' => [], + 'fiche_f' => [], + 'schema_f' => [], + 'documents_f' => [], + 'plan_f' => [] + ); + + // Envoi Post + $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'v_filieres_agrees', $this->aProperties['schema_anc'].'.filieres_agrees_id_fag_seq', 'id_fag', $aUploadFiles, 'anc_saisie_anc_filieres_agree', $this->aProperties['anc']['files_container']); return $aReturn['sMessage']; } @@ -223,12 +217,7 @@ class Filieres_agrees extends Anc { $this->aValues['maj'] = $_SESSION["ses_Login"]; if (empty($this->aValues['maj_date'])) $this->aValues['maj_date'] = date('Y-m-d'); - // Upload les fichiers. - $this->uploadDocument('photos_f', 'anc_saisie_anc_filieres_agree'); - $this->uploadDocument('fiche_f', 'anc_saisie_anc_filieres_agree'); - $this->uploadDocument('schema_f', 'anc_saisie_anc_filieres_agree'); - $this->uploadDocument('documents_f', 'anc_saisie_anc_filieres_agree'); - $this->uploadDocument('plan_f', 'anc_saisie_anc_filieres_agree'); + // Conversion des dates if (isset($this->aValues['fag_en_date'])) { if ($this->aValues['fag_en_date'] == '') @@ -236,8 +225,18 @@ class Filieres_agrees extends Anc { else $this->aValues['fag_en_date'] = date_format(date_create_from_format('d/m/Y', $this->aValues['fag_en_date']), 'Y-m-d'); } - // - $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'v_filieres_agrees', 'id_fag'); + + // Fichiers à uploader + $aUploadFiles = array( + 'photos_f' => [], + 'fiche_f' => [], + 'schema_f' => [], + 'documents_f' => [], + 'plan_f' => [] + ); + + // Envoi Put + $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'v_filieres_agrees', 'id_fag', $aUploadFiles, 'anc_saisie_anc_filieres_agree', $this->aProperties['anc']['files_container']); return $aReturn['sMessage']; } @@ -308,4 +307,4 @@ class Filieres_agrees extends Anc { return $aReturn['sMessage']; } } -?> \ No newline at end of file +?> diff --git a/src/module_anc/web_service/ws/Installation.class.inc b/src/module_anc/web_service/ws/Installation.class.inc index cf00fc2d545cbfddc31961af275da2596c3c0d16..8608257f91bd6ec7a04f9e2b34ce0f5432933bd6 100755 --- a/src/module_anc/web_service/ws/Installation.class.inc +++ b/src/module_anc/web_service/ws/Installation.class.inc @@ -12,7 +12,7 @@ require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection * \brief This file contains the Installation php class * * This class defines operation for one Installation - * + * */ class Installation extends Anc { @@ -31,10 +31,11 @@ class Installation extends Anc { $this->aProperties = $properties; $this->oConnection = new Connection($this->aValues, $this->aProperties); $this->aSelectedFields = Array("id_installation", "id_com", "id_parc", "parc_sup", "parc_parcelle_associees", "parc_adresse", "code_postal", "parc_commune", "prop_titre", "prop_nom_prenom", "prop_adresse", "prop_code_postal", "prop_commune", "prop_tel", "prop_mail", "bati_type", "bati_ca_nb_pp", "bati_ca_nb_eh", "bati_ca_nb_chambres", "bati_ca_nb_autres_pieces", "bati_ca_nb_occupant", "bati_nb_a_control", "bati_date_achat", "bati_date_mutation", "cont_zone_enjeu", "cont_zone_sage", "cont_zone_autre", "cont_zone_urba", "cont_zone_anc", "cont_alim_eau_potable", "cont_puits_usage", "cont_puits_declaration", "cont_puits_situation", "cont_puits_terrain_mitoyen", "observations", "maj", "maj_date", "create", "create_date", "archivage", "geom", "photo_f", "document_f", "num_dossier", "commune", "section", "parcelle", "nb_controle", "last_date_control", "cl_avis", "next_control", "classement_installation"); + $this->oFilesManager = new Files_manager($this->aProperties); } /** - * @SWG\Get(path="/installations/{id_installation}", + * @SWG\Get(path="/installations/{id_installation}", * tags={"Installations"}, * summary="Get Installation", * description="Request to get Installation by id", @@ -74,12 +75,7 @@ class Installation extends Anc { * get informations about mode */ function GET() { - $this->aFields = $this->getFields($this->aProperties['schema_anc'], "v_installation", "id_installation"); - // Url des fichiers. - if (!empty($this->aFields['photo_f'])) - $this->aFields['photo_f'] = $this->aProperties['web_server_name'] . '/' . $this->aProperties['ws_data_alias'] . '/anc/anc_saisie_anc_installation/documents/' . $this->aValues["my_vitis_id"] . '/photo_f/' . $this->aFields['photo_f']; - if (!empty($this->aFields['document_f'])) - $this->aFields['document_f'] = $this->aProperties['web_server_name'] . '/' . $this->aProperties['ws_data_alias'] . '/anc/anc_saisie_anc_installation/documents/' . $this->aValues["my_vitis_id"] . '/document_f/' . $this->aFields['document_f']; + $this->aFields = $this->getFields($this->aProperties['schema_anc'], 'v_installation', 'id_installation', 'anc_saisie_anc_installation', $this->aProperties['anc']['files_container']); } /** @@ -96,4 +92,4 @@ class Installation extends Anc { } -?> \ No newline at end of file +?> diff --git a/src/module_anc/web_service/ws/Installations.class.inc b/src/module_anc/web_service/ws/Installations.class.inc index 2993a37050e8bbad65512b1b436cfcd9a4d20279..c334b99d471a1811bb49cf6c5270fadf4ed31ee0 100755 --- a/src/module_anc/web_service/ws/Installations.class.inc +++ b/src/module_anc/web_service/ws/Installations.class.inc @@ -9,7 +9,7 @@ * \brief This file contains the Installations php class * * This class defines Rest Api to Vitis Installations - * + * */ require_once __DIR__ . '/Anc.class.inc'; require_once 'Installation.class.inc'; @@ -41,6 +41,7 @@ class Installations extends Anc { $this->aProperties = $properties; $this->oConnection = new Connection($this->aValues, $this->aProperties); $this->aSelectedFields = Array("id_installation", "id_com", "id_parc", "parc_sup", "parc_parcelle_associees", "parc_adresse", "code_postal", "parc_commune", "prop_titre", "prop_nom_prenom", "prop_adresse", "prop_code_postal", "prop_commune", "prop_tel", "prop_mail", "bati_type", "bati_ca_nb_pp", "bati_ca_nb_eh", "bati_ca_nb_chambres", "bati_ca_nb_autres_pieces", "bati_ca_nb_occupant", "bati_nb_a_control", "bati_date_achat", "bati_date_mutation", "cont_zone_enjeu", "cont_zone_sage", "cont_zone_autre", "cont_zone_urba", "cont_zone_anc", "cont_alim_eau_potable", "cont_puits_usage", "cont_puits_declaration", "cont_puits_situation", "cont_puits_terrain_mitoyen", "observations", "maj", "maj_date", "create", "create_date", "archivage", "geom", "photo_f", "document_f", "num_dossier", "commune", "section", "parcelle", "nb_controle", "last_date_control", "cl_avis", "next_control", "classement_installation"); + $this->oFilesManager = new Files_manager($this->aProperties); } /** @@ -155,7 +156,15 @@ class Installations extends Anc { function POST() { $this->aValues['create'] = $_SESSION["ses_Login"]; $this->aValues['create_date'] = date('Y-m-d'); - $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'v_installation', $this->aProperties['schema_anc'].'.installation_id_installation_seq', 'id_installation'); + + // Fichiers à uploader + $aUploadFiles = array( + 'photo_f' => [], + 'document_f' => [] + ); + + // Envoi Post + $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'v_installation', $this->aProperties['schema_anc'].'.installation_id_installation_seq', 'id_installation', $aUploadFiles, 'anc_saisie_anc_installation', $this->aProperties['anc']['files_container']); return $aReturn['sMessage']; } @@ -198,9 +207,7 @@ class Installations extends Anc { $this->aValues['maj'] = $_SESSION["ses_Login"]; if (empty($this->aValues['maj_date'])) $this->aValues['maj_date'] = date('Y-m-d'); - // Upload les fichiers. - $this->uploadDocument('photo_f', 'anc_saisie_anc_installation'); - $this->uploadDocument('document_f', 'anc_saisie_anc_installation'); + // Zone PLU. if (!empty($this->aValues['geom'])) { $sSchema = $this->aProperties["anc"]["cont_zone_urba"]["intersect"]["schema"]; @@ -221,7 +228,15 @@ class Installations extends Anc { } } } - $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'v_installation', 'id_installation'); + + // Fichiers à uploader + $aUploadFiles = array( + 'photo_f' => [], + 'document_f' => [] + ); + + // Envoi Put + $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'v_installation', 'id_installation', $aUploadFiles, 'anc_saisie_anc_installation', $this->aProperties['anc']['files_container']); return $aReturn['sMessage']; } @@ -309,4 +324,4 @@ class Installations extends Anc { } } } -?> \ No newline at end of file +?> diff --git a/src/module_anc/web_service/ws/Pretraitement.class.inc b/src/module_anc/web_service/ws/Pretraitement.class.inc index 372fc829f7b0c57fe0cd99a5e61d063beea7a79a..f72fe963c9e4fb3c9e3bc2fda20b3a8983063b49 100755 --- a/src/module_anc/web_service/ws/Pretraitement.class.inc +++ b/src/module_anc/web_service/ws/Pretraitement.class.inc @@ -12,7 +12,7 @@ require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection * \brief This file contains the Pretraitement php class * * This class defines operation for one Pretraitement - * + * */ class Pretraitement extends Anc { @@ -30,10 +30,11 @@ class Pretraitement extends Anc { $this->aPath = $aPath; $this->aProperties = $properties; $this->oConnection = new Connection($this->aValues, $this->aProperties); + $this->oFilesManager = new Files_manager($this->aProperties); } /** - * @SWG\Get(path="/pretraitements/{id_pretraitement}", + * @SWG\Get(path="/pretraitements/{id_pretraitement}", * tags={"Pretraitements"}, * summary="Get Pretraitement", * description="Request to get Pretraitement by id", @@ -73,19 +74,7 @@ class Pretraitement extends Anc { * get informations about mode */ function GET() { - $this->aFields = $this->getFields($this->aProperties['schema_anc'], "v_pretraitement", "id_pretraitement"); - // Url des fichiers. - $sWsDataUrl = $this->aProperties['web_server_name'] . '/' . $this->aProperties['ws_data_alias'] . '/anc/anc_saisie_anc_pretraitement/documents/' . $this->aValues["my_vitis_id"]; - if (!empty($this->aFields['photos_f'])) - $this->aFields['photos_f'] = $sWsDataUrl . '/photos_f/' . $this->aFields['photos_f']; - if (!empty($this->aFields['fiche_f'])) - $this->aFields['fiche_f'] = $sWsDataUrl . '/fiche_f/' . $this->aFields['fiche_f']; - if (!empty($this->aFields['schema_f'])) - $this->aFields['schema_f'] = $sWsDataUrl . '/schema_f/' . $this->aFields['schema_f']; - if (!empty($this->aFields['documents_f'])) - $this->aFields['documents_f'] = $sWsDataUrl . '/documents_f/' . $this->aFields['documents_f']; - if (!empty($this->aFields['plan_f'])) - $this->aFields['plan_f'] = $sWsDataUrl . '/plan_f/' . $this->aFields['plan_f']; + $this->aFields = $this->getFields($this->aProperties['schema_anc'], 'v_pretraitement', 'id_pretraitement', 'anc_saisie_anc_pretraitement', 'anc'); } /** @@ -102,4 +91,4 @@ class Pretraitement extends Anc { } -?> \ No newline at end of file +?> diff --git a/src/module_anc/web_service/ws/Pretraitements.class.inc b/src/module_anc/web_service/ws/Pretraitements.class.inc index 49be91d57e8f6266528f64cb5de79bf641317e0e..06cdea6a2494dc36cd386a5931b4823048f9e9b7 100755 --- a/src/module_anc/web_service/ws/Pretraitements.class.inc +++ b/src/module_anc/web_service/ws/Pretraitements.class.inc @@ -9,7 +9,7 @@ * \brief This file contains the Pretraitements php class * * This class defines Rest Api to Vitis Pretraitements - * + * */ require_once __DIR__ . '/Anc.class.inc'; require_once 'Pretraitement.class.inc'; @@ -40,6 +40,7 @@ class Pretraitements extends Anc { $this->aPath = $aPath; $this->aProperties = $properties; $this->oConnection = new Connection($this->aValues, $this->aProperties); + $this->oFilesManager = new Files_manager($this->aProperties); } /** @@ -154,18 +155,7 @@ class Pretraitements extends Anc { function POST() { $this->aValues['create'] = $_SESSION["ses_Login"]; $this->aValues['create_date'] = date('Y-m-d'); - // Sauve le nom des fichiers. - if (!empty($_FILES['photos_f'])) - $this->aValues['photos_f'] = $_FILES['photos_f']["name"]; - if (!empty($_FILES['fiche_f'])) - $this->aValues['fiche_f'] = $_FILES['fiche_f']["name"]; - if (!empty($_FILES['schema_f'])) - $this->aValues['schema_f'] = $_FILES['schema_f']["name"]; - if (!empty($_FILES['documents_f'])) - $this->aValues['documents_f'] = $_FILES['documents_f']["name"]; - if (!empty($_FILES['plan_f'])) - $this->aValues['plan_f'] = $_FILES['plan_f']["name"]; - // + $aDates = array('ptr_vi_date'); foreach ($aDates as $sDate) { if (isset($this->aValues[$sDate])) { @@ -174,16 +164,19 @@ class Pretraitements extends Anc { else $this->aValues[$sDate] = date_format(date_create_from_format('d/m/Y', $this->aValues[$sDate]), 'Y-m-d'); } - } - // - $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'v_pretraitement', $this->aProperties['schema_anc'].'.pretraitement_id_pretraitement_seq', 'id_pretraitement'); - // Upload les fichiers. - $this->uploadDocument('photos_f', 'anc_saisie_anc_pretraitement'); - $this->uploadDocument('fiche_f', 'anc_saisie_anc_pretraitement'); - $this->uploadDocument('schema_f', 'anc_saisie_anc_pretraitement'); - $this->uploadDocument('documents_f', 'anc_saisie_anc_pretraitement'); - $this->uploadDocument('plan_f', 'anc_saisie_anc_pretraitement'); - // + } + + // Fichiers à uploader + $aUploadFiles = array( + 'photos_f' => [], + 'fiche_f' => [], + 'schema_f' => [], + 'documents_f' => [], + 'plan_f' => [] + ); + + // Envoi Post + $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'v_pretraitement', $this->aProperties['schema_anc'].'.pretraitement_id_pretraitement_seq', 'id_pretraitement', $aUploadFiles, 'anc_saisie_anc_pretraitement', 'anc'); return $aReturn['sMessage']; } @@ -226,13 +219,7 @@ class Pretraitements extends Anc { $this->aValues['maj'] = $_SESSION["ses_Login"]; if (empty($this->aValues['maj_date'])) $this->aValues['maj_date'] = date('Y-m-d'); - // Upload les fichiers. - $this->uploadDocument('photos_f', 'anc_saisie_anc_pretraitement'); - $this->uploadDocument('fiche_f', 'anc_saisie_anc_pretraitement'); - $this->uploadDocument('schema_f', 'anc_saisie_anc_pretraitement'); - $this->uploadDocument('documents_f', 'anc_saisie_anc_pretraitement'); - $this->uploadDocument('plan_f', 'anc_saisie_anc_pretraitement'); - // + $aDates = array('ptr_vi_date'); foreach ($aDates as $sDate) { if (isset($this->aValues[$sDate])) { @@ -241,9 +228,19 @@ class Pretraitements extends Anc { else $this->aValues[$sDate] = date_format(date_create_from_format('d/m/Y', $this->aValues[$sDate]), 'Y-m-d'); } - } - // - $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'v_pretraitement', 'id_pretraitement'); + } + + // Fichiers à uploader + $aUploadFiles = array( + 'photos_f' => [], + 'fiche_f' => [], + 'schema_f' => [], + 'documents_f' => [], + 'plan_f' => [] + ); + + // Envoi Put + $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'v_pretraitement', 'id_pretraitement', $aUploadFiles, 'anc_saisie_anc_evacuation_eaux', 'anc'); return $aReturn['sMessage']; } @@ -314,7 +311,7 @@ class Pretraitements extends Anc { return $aReturn['sMessage']; } - + } -?> \ No newline at end of file +?> diff --git a/src/module_anc/web_service/ws/Traitement.class.inc b/src/module_anc/web_service/ws/Traitement.class.inc index b297bff3becff86d2b0a720f35baee8f88222c01..08c8b0a3f2a55b3850cc4d72334134f22de9b1c9 100755 --- a/src/module_anc/web_service/ws/Traitement.class.inc +++ b/src/module_anc/web_service/ws/Traitement.class.inc @@ -12,7 +12,7 @@ require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection * \brief This file contains the Traitement php class * * This class defines operation for one Traitement - * + * */ class Traitement extends Anc { @@ -30,10 +30,11 @@ class Traitement extends Anc { $this->aPath = $aPath; $this->aProperties = $properties; $this->oConnection = new Connection($this->aValues, $this->aProperties); + $this->oFilesManager = new Files_manager($this->aProperties); } /** - * @SWG\Get(path="/traitements/{id_traitement}", + * @SWG\Get(path="/traitements/{id_traitement}", * tags={"Traitements"}, * summary="Get Traitement", * description="Request to get Traitement by id", @@ -73,19 +74,7 @@ class Traitement extends Anc { * get informations about mode */ function GET() { - $this->aFields = $this->getFields($this->aProperties['schema_anc'], "v_traitement", "id_traitement"); - // Url des fichiers. - $sWsDataUrl = $this->aProperties['web_server_name'] . '/' . $this->aProperties['ws_data_alias'] . '/anc/anc_saisie_anc_traitement/documents/' . $this->aValues["my_vitis_id"]; - if (!empty($this->aFields['photos_f'])) - $this->aFields['photos_f'] = $sWsDataUrl . '/photos_f/' . $this->aFields['photos_f']; - if (!empty($this->aFields['fiche_f'])) - $this->aFields['fiche_f'] = $sWsDataUrl . '/fiche_f/' . $this->aFields['fiche_f']; - if (!empty($this->aFields['schema_f'])) - $this->aFields['schema_f'] = $sWsDataUrl . '/schema_f/' . $this->aFields['schema_f']; - if (!empty($this->aFields['documents_f'])) - $this->aFields['documents_f'] = $sWsDataUrl . '/documents_f/' . $this->aFields['documents_f']; - if (!empty($this->aFields['plan_f'])) - $this->aFields['plan_f'] = $sWsDataUrl . '/plan_f/' . $this->aFields['plan_f']; + $this->aFields = $this->getFields($this->aProperties['schema_anc'], 'v_traitement', 'id_traitement', 'anc_saisie_anc_traitement', 'anc'); } /** @@ -102,4 +91,4 @@ class Traitement extends Anc { } -?> \ No newline at end of file +?> diff --git a/src/module_anc/web_service/ws/Traitements.class.inc b/src/module_anc/web_service/ws/Traitements.class.inc index b4ce521c4d338e104365315babd03e478234e2b0..3598ba52ceb6227c909e6abb34e9f70cd121525e 100755 --- a/src/module_anc/web_service/ws/Traitements.class.inc +++ b/src/module_anc/web_service/ws/Traitements.class.inc @@ -9,7 +9,7 @@ * \brief This file contains the Traitements php class * * This class defines Rest Api to Vitis Traitements - * + * */ require_once __DIR__ . '/Anc.class.inc'; require_once 'Traitement.class.inc'; @@ -40,6 +40,7 @@ class Traitements extends Anc { $this->aPath = $aPath; $this->aProperties = $properties; $this->oConnection = new Connection($this->aValues, $this->aProperties); + $this->oFilesManager = new Files_manager($this->aProperties); } /** @@ -154,26 +155,18 @@ class Traitements extends Anc { function POST() { $this->aValues['create'] = $_SESSION["ses_Login"]; $this->aValues['create_date'] = date('Y-m-d'); - // Sauve le nom des fichiers. - if (!empty($_FILES['photos_f'])) - $this->aValues['photos_f'] = $_FILES['photos_f']["name"]; - if (!empty($_FILES['fiche_f'])) - $this->aValues['fiche_f'] = $_FILES['fiche_f']["name"]; - if (!empty($_FILES['schema_f'])) - $this->aValues['schema_f'] = $_FILES['schema_f']["name"]; - if (!empty($_FILES['documents_f'])) - $this->aValues['documents_f'] = $_FILES['documents_f']["name"]; - if (!empty($_FILES['plan_f'])) - $this->aValues['plan_f'] = $_FILES['plan_f']["name"]; - // - $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'v_traitement', $this->aProperties['schema_anc'].'.traitement_id_traitement_seq', 'id_traitement'); - // Upload les fichiers. - $this->uploadDocument('photos_f', 'anc_saisie_anc_traitement'); - $this->uploadDocument('fiche_f', 'anc_saisie_anc_traitement'); - $this->uploadDocument('schema_f', 'anc_saisie_anc_traitement'); - $this->uploadDocument('documents_f', 'anc_saisie_anc_traitement'); - $this->uploadDocument('plan_f', 'anc_saisie_anc_traitement'); - // + + // Fichiers à uploader + $aUploadFiles = array( + 'photos_f' => [], + 'fiche_f' => [], + 'schema_f' => [], + 'documents_f' => [], + 'plan_f' => [] + ); + + // Envoi Post + $aReturn = $this->genericPost($this->aProperties['schema_anc'], 'v_traitement', $this->aProperties['schema_anc'].'.anc_saisie_anc_traitement', 'id_traitement', $aUploadFiles, 'anc_saisie_anc_evacuation_eaux', 'anc'); return $aReturn['sMessage']; } @@ -216,14 +209,18 @@ class Traitements extends Anc { $this->aValues['maj'] = $_SESSION["ses_Login"]; if (empty($this->aValues['maj_date'])) $this->aValues['maj_date'] = date('Y-m-d'); - // Upload les fichiers. - $this->uploadDocument('photos_f', 'anc_saisie_anc_traitement'); - $this->uploadDocument('fiche_f', 'anc_saisie_anc_traitement'); - $this->uploadDocument('schema_f', 'anc_saisie_anc_traitement'); - $this->uploadDocument('documents_f', 'anc_saisie_anc_traitement'); - $this->uploadDocument('plan_f', 'anc_saisie_anc_traitement'); - // - $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'v_traitement', 'id_traitement'); + + // Fichiers à uploader + $aUploadFiles = array( + 'photos_f' => [], + 'fiche_f' => [], + 'schema_f' => [], + 'documents_f' => [], + 'plan_f' => [] + ); + + // Envoi Put + $aReturn = $this->genericPut($this->aProperties['schema_anc'], 'v_traitement', 'id_traitement', $aUploadFiles, 'anc_saisie_anc_traitement', 'anc'); return $aReturn['sMessage']; } @@ -294,7 +291,7 @@ class Traitements extends Anc { return $aReturn['sMessage']; } - + } -?> \ No newline at end of file +?>