diff --git a/CHANGELOG.md b/CHANGELOG.md index b4c28ae1838efac2e01a910218c53d94f2c3873c..5497cf30f8c36e39db81822efa7600e147cd2ba5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ Journal des modifications ========================= +1.4.1 (24/01/2020) +------------------ + +- Les dates d'insertion des données dans les tables `SYGAL_*` de chaque établissement sont désormais retournées + par le web service ; cela permettra côté SyGAL de détecter un problème dans le CRONage du script de remplissage + de ces tables. + + 1.4.0 (23/01/2020) ------------------ diff --git a/config/autoload/version.global.php b/config/autoload/version.global.php index 27f00e5102c3cee599d47900748e15af1f195629..e7ab65ca2e68746ca61c7917944170d42aaeab4e 100644 --- a/config/autoload/version.global.php +++ b/config/autoload/version.global.php @@ -2,9 +2,9 @@ return [ 'unicaen-app' => [ 'app_infos' => [ - 'version' => '1.4.0', - 'date' => '15/01/2020', + 'version' => '1.4.1', + 'date' => '24/01/2020', ], ], - 'comment' => 'Fichier généré le 15/01/2020 à 09:22:35 avec /home/gauthierb/workspace/sygal/bump-version', + 'comment' => 'Fichier généré le 24/01/2020 à 12:14:35 avec /home/gauthierb/workspace/sygal/bump-version', ]; diff --git a/doc/release-notes/v1.4.1.md b/doc/release-notes/v1.4.1.md new file mode 100644 index 0000000000000000000000000000000000000000..1c4f9e312a3e24144d8174aedeae23f3787fc69e --- /dev/null +++ b/doc/release-notes/v1.4.1.md @@ -0,0 +1,52 @@ +# Version 1.4.1 + +## 1. Sur le serveur d'application + +- Placez-vous dans le répertoire de l'application puis lancez la commande suivante +pour installer la nouvelle version : + +```bash +git fetch --tags && git checkout --force 1.4.1 && \ +bash ./install.sh +``` + +- Selon le moteur PHP que vous avez installé, rechargez le service, exemple : + - php7.0-fpm : `service php7.0-fpm reload` + - apache2-mod-php7.0 : `service apache2 reload` + +## 2. Dans la base de données + +Il faut ajouter une colonne `SOURCE_INSERT_DATE` dans chacune des tables `TMP_*` pour importer les dates d'insertion +des données dans les tables `SYGAL_*` des établissements : + +```sql +alter table TMP_ACTEUR add SOURCE_INSERT_DATE DATE default sysdate ; +alter table TMP_DOCTORANT add SOURCE_INSERT_DATE DATE default sysdate ; +alter table TMP_ECOLE_DOCT add SOURCE_INSERT_DATE DATE default sysdate ; +alter table TMP_ETABLISSEMENT add SOURCE_INSERT_DATE DATE default sysdate ; +alter table TMP_FINANCEMENT add SOURCE_INSERT_DATE DATE default sysdate ; +alter table TMP_INDIVIDU add SOURCE_INSERT_DATE DATE default sysdate ; +alter table TMP_ORIGINE_FINANCEMENT add SOURCE_INSERT_DATE DATE default sysdate ; +alter table TMP_ROLE add SOURCE_INSERT_DATE DATE default sysdate ; +alter table TMP_STRUCTURE add SOURCE_INSERT_DATE DATE default sysdate ; +alter table TMP_THESE add SOURCE_INSERT_DATE DATE default sysdate ; +alter table TMP_THESE_ANNEE_UNIV add SOURCE_INSERT_DATE DATE default sysdate ; +alter table TMP_TITRE_ACCES add SOURCE_INSERT_DATE DATE default sysdate ; +alter table TMP_UNITE_RECH add SOURCE_INSERT_DATE DATE default sysdate ; +alter table TMP_VARIABLE add SOURCE_INSERT_DATE DATE default sysdate ; + +alter table TMP_ACTEUR modify SOURCE_INSERT_DATE NOT NULL ; +alter table TMP_DOCTORANT modify SOURCE_INSERT_DATE NOT NULL ; +alter table TMP_ECOLE_DOCT modify SOURCE_INSERT_DATE NOT NULL ; +alter table TMP_ETABLISSEMENT modify SOURCE_INSERT_DATE NOT NULL ; +alter table TMP_FINANCEMENT modify SOURCE_INSERT_DATE NOT NULL ; +alter table TMP_INDIVIDU modify SOURCE_INSERT_DATE NOT NULL ; +alter table TMP_ORIGINE_FINANCEMENT modify SOURCE_INSERT_DATE NOT NULL ; +alter table TMP_ROLE modify SOURCE_INSERT_DATE NOT NULL ; +alter table TMP_STRUCTURE modify SOURCE_INSERT_DATE NOT NULL ; +alter table TMP_THESE modify SOURCE_INSERT_DATE NOT NULL ; +alter table TMP_THESE_ANNEE_UNIV modify SOURCE_INSERT_DATE NOT NULL ; +alter table TMP_TITRE_ACCES modify SOURCE_INSERT_DATE NOT NULL ; +alter table TMP_UNITE_RECH modify SOURCE_INSERT_DATE NOT NULL ; +alter table TMP_VARIABLE modify SOURCE_INSERT_DATE NOT NULL ; +``` diff --git a/module/Application/src/Application/Controller/ExportController.php b/module/Application/src/Application/Controller/ExportController.php index f245687d253db299c3e7225184ecd81c15cb17bd..9b594b56f9c8022c73ba80ec353ec685627c726d 100644 --- a/module/Application/src/Application/Controller/ExportController.php +++ b/module/Application/src/Application/Controller/ExportController.php @@ -87,8 +87,8 @@ class ExportController extends AbstractController 'Date de prévisionnel de soutenance' => function (These $these) { return $these->getDatePrevisionSoutenance(); }, 'Date de soutenance' => function (These $these) { return $these->getDateSoutenance(); }, 'Date de fin de confientialité' => function (These $these) { return $these->getDateFinConfidentialite(); }, - 'Date de dépôt version initiale' => function (These $these) { $file = $these->hasVersionInitiale(); if ($file) return $file->getFichier()->getHistoCreation()->format('d/m/Y'); }, - 'Date de dépôt version corigée' => function (These $these) { $file = $these->hasVersionCorrigee(); if ($file) return $file->getFichier()->getHistoCreation()->format('d/m/Y'); }, + 'Date de dépôt version initiale' => function (These $these) { $file = $these->hasVersionInitiale(); if ($file) return $file->getFichier()->getHistoCreation()->format('d/m/Y'); return "";}, + 'Date de dépôt version corigée' => function (These $these) { $file = $these->hasVersionCorrigee(); if ($file) return $file->getFichier()->getHistoCreation()->format('d/m/Y'); return "";}, 'Durée en mois de la thèse' => function (These $these) { if ($these->getDatePremiereInscription() !== null AND $these->getDateSoutenance() !== null) return number_format(($these->getDateSoutenance())->diff($these->getDatePremiereInscription())->format('%a')/30.5, 2); else return ""; diff --git a/module/Import/src/Import/Model/Mapping/Import.Model.TmpActeur.dcm.xml b/module/Import/src/Import/Model/Mapping/Import.Model.TmpActeur.dcm.xml index d8acd45f056499990317a531da8a97b4951600b9..747b325aa1069d0682565e07201d28f2b1218bf2 100644 --- a/module/Import/src/Import/Model/Mapping/Import.Model.TmpActeur.dcm.xml +++ b/module/Import/src/Import/Model/Mapping/Import.Model.TmpActeur.dcm.xml @@ -18,5 +18,6 @@ <field name="temoinHDR" type="string" column="TEM_HAB_RCH_PER" length="1" nullable="true"/> <field name="temoinRapport" type="string" column="TEM_RAP_RECU" length="1" nullable="true"/> <field name="sourceCode" type="string" column="SOURCE_CODE" length="64" nullable="true"/> + <field name="sourceInsertDate" type="datetime" column="SOURCE_INSERT_DATE"/> </entity> </doctrine-mapping> \ No newline at end of file diff --git a/module/Import/src/Import/Model/Mapping/Import.Model.TmpDoctorant.dcm.xml b/module/Import/src/Import/Model/Mapping/Import.Model.TmpDoctorant.dcm.xml index 037e56739e52b93862beed6e1c4a790a6faf1220..1d5e304da302890195fd35b3a39213742860ade7 100644 --- a/module/Import/src/Import/Model/Mapping/Import.Model.TmpDoctorant.dcm.xml +++ b/module/Import/src/Import/Model/Mapping/Import.Model.TmpDoctorant.dcm.xml @@ -10,5 +10,6 @@ <field name="individuId" type="string" column="INDIVIDU_ID" length="64" nullable="true"/> <field name="ine" type="string" column="INE" length="64" nullable="true"/> <field name="sourceCode" type="string" column="SOURCE_CODE" length="64" nullable="true"/> + <field name="sourceInsertDate" type="datetime" column="SOURCE_INSERT_DATE"/> </entity> </doctrine-mapping> \ No newline at end of file diff --git a/module/Import/src/Import/Model/Mapping/Import.Model.TmpEcoleDoctorale.dcm.xml b/module/Import/src/Import/Model/Mapping/Import.Model.TmpEcoleDoctorale.dcm.xml index e430e5fa4981b586274ae8059955e4b590e79575..cf1e87dcb2f7570d3d6033e2d4e4900b51f794e7 100644 --- a/module/Import/src/Import/Model/Mapping/Import.Model.TmpEcoleDoctorale.dcm.xml +++ b/module/Import/src/Import/Model/Mapping/Import.Model.TmpEcoleDoctorale.dcm.xml @@ -8,5 +8,6 @@ <field name="sourceId" type="string" column="SOURCE_ID" length="64" nullable="true"/> <field name="sourceCode" type="string" column="SOURCE_CODE" length="64" nullable="true"/> <field name="structureId" type="string" column="STRUCTURE_ID" length="64" nullable="true"/> + <field name="sourceInsertDate" type="datetime" column="SOURCE_INSERT_DATE"/> </entity> </doctrine-mapping> diff --git a/module/Import/src/Import/Model/Mapping/Import.Model.TmpEtablissement.dcm.xml b/module/Import/src/Import/Model/Mapping/Import.Model.TmpEtablissement.dcm.xml index 0c2735fc3be978b4550c930f5ab7bc3c028d7854..a080b2211add126567a00c9086cb7396e48f013c 100644 --- a/module/Import/src/Import/Model/Mapping/Import.Model.TmpEtablissement.dcm.xml +++ b/module/Import/src/Import/Model/Mapping/Import.Model.TmpEtablissement.dcm.xml @@ -8,5 +8,6 @@ <field name="sourceId" type="string" column="SOURCE_ID" length="64" nullable="true"/> <field name="sourceCode" type="string" column="SOURCE_CODE" length="64" nullable="true"/> <field name="structureId" type="string" column="STRUCTURE_ID" length="64" nullable="true"/> + <field name="sourceInsertDate" type="datetime" column="SOURCE_INSERT_DATE"/> </entity> </doctrine-mapping> diff --git a/module/Import/src/Import/Model/Mapping/Import.Model.TmpFinancement.dcm.xml b/module/Import/src/Import/Model/Mapping/Import.Model.TmpFinancement.dcm.xml index 1fd05f4b72c083227ab36e6f42757d28aafef4c2..7736e72cc0a24af928b8a402b796ff58e0b20a88 100644 --- a/module/Import/src/Import/Model/Mapping/Import.Model.TmpFinancement.dcm.xml +++ b/module/Import/src/Import/Model/Mapping/Import.Model.TmpFinancement.dcm.xml @@ -14,5 +14,6 @@ <field name="quotiteFinancement" column="QUOTITE_FINANCEMENT" nullable="true"/> <field name="dateDebutFinancement" type="date" column="DATE_DEBUT_FINANCEMENT" nullable="true"/> <field name="dateFinFinancement" type="date" column="DATE_FIN_FINANCEMENT" nullable="true"/> + <field name="sourceInsertDate" type="datetime" column="SOURCE_INSERT_DATE"/> </entity> </doctrine-mapping> diff --git a/module/Import/src/Import/Model/Mapping/Import.Model.TmpIndividu.dcm.xml b/module/Import/src/Import/Model/Mapping/Import.Model.TmpIndividu.dcm.xml index 3104af1e1fb6fb65428cf20b9cfcc148a39388a8..2c362b93765155e416861706a98936418f2f9fc9 100644 --- a/module/Import/src/Import/Model/Mapping/Import.Model.TmpIndividu.dcm.xml +++ b/module/Import/src/Import/Model/Mapping/Import.Model.TmpIndividu.dcm.xml @@ -18,5 +18,6 @@ <field name="dateNaissance" type="date" column="DAT_NAI_PER" nullable="true"/> <field name="nationalite" column="LIB_NAT" nullable="true"/> <field name="sourceCode" column="SOURCE_CODE" nullable="true"/> + <field name="sourceInsertDate" type="datetime" column="SOURCE_INSERT_DATE"/> </entity> </doctrine-mapping> \ No newline at end of file diff --git a/module/Import/src/Import/Model/Mapping/Import.Model.TmpOrigineFinancement.dcm.xml b/module/Import/src/Import/Model/Mapping/Import.Model.TmpOrigineFinancement.dcm.xml index c67661609a9a6324a720fbd2a44a556443f2fa99..0d6f005c042cb57496200c05f118a21372a0f39d 100644 --- a/module/Import/src/Import/Model/Mapping/Import.Model.TmpOrigineFinancement.dcm.xml +++ b/module/Import/src/Import/Model/Mapping/Import.Model.TmpOrigineFinancement.dcm.xml @@ -10,6 +10,6 @@ <field name="codOfi" length="8" column="COD_OFI"/> <field name="licOfi" length="10" column="LIC_OFI"/> <field name="libOfi" length="50" column="LIB_OFI"/> - + <field name="sourceInsertDate" type="datetime" column="SOURCE_INSERT_DATE"/> </entity> </doctrine-mapping> \ No newline at end of file diff --git a/module/Import/src/Import/Model/Mapping/Import.Model.TmpRole.dcm.xml b/module/Import/src/Import/Model/Mapping/Import.Model.TmpRole.dcm.xml index e400a3c85d3f9fee4381029ec42b09750697f988..0e246cd26e3cb9be8040b3364d54e843e3e48cdf 100644 --- a/module/Import/src/Import/Model/Mapping/Import.Model.TmpRole.dcm.xml +++ b/module/Import/src/Import/Model/Mapping/Import.Model.TmpRole.dcm.xml @@ -10,5 +10,6 @@ <field name="libLongRole" type="string" column="LIB_ROJ" length="200" nullable="true"/> <field name="libCourtRole" type="string" column="LIC_ROJ" length="50" nullable="true"/> <field name="sourceCode" type="string" column="SOURCE_CODE" length="64" nullable="true"/> + <field name="sourceInsertDate" type="datetime" column="SOURCE_INSERT_DATE"/> </entity> </doctrine-mapping> \ No newline at end of file diff --git a/module/Import/src/Import/Model/Mapping/Import.Model.TmpSource.dcm.xml b/module/Import/src/Import/Model/Mapping/Import.Model.TmpSource.dcm.xml index 553b491bef4faec25b9f0933585f478eeec4360e..96d1ea01b0865f59234d79f9f82f76359c529bde 100644 --- a/module/Import/src/Import/Model/Mapping/Import.Model.TmpSource.dcm.xml +++ b/module/Import/src/Import/Model/Mapping/Import.Model.TmpSource.dcm.xml @@ -10,5 +10,6 @@ <field name="libelle" type="string" column="LIBELLE" length="128" nullable="true"/> <field name="importable" type="integer" column="IMPORTABLE" nullable="true"/> <field name="sourceCode" type="string" column="SOURCE_CODE" length="64" nullable="true"/> + <field name="sourceInsertDate" type="datetime" column="SOURCE_INSERT_DATE"/> </entity> </doctrine-mapping> \ No newline at end of file diff --git a/module/Import/src/Import/Model/Mapping/Import.Model.TmpStructure.dcm.xml b/module/Import/src/Import/Model/Mapping/Import.Model.TmpStructure.dcm.xml index 021c28f82b8258c859e88e2ec21ecdd561798dee..5d156a2d7ac612ca27da24df4b461fe1849be4ea 100644 --- a/module/Import/src/Import/Model/Mapping/Import.Model.TmpStructure.dcm.xml +++ b/module/Import/src/Import/Model/Mapping/Import.Model.TmpStructure.dcm.xml @@ -12,6 +12,6 @@ <field name="libelle" type="string" column="LIBELLE" length="128" nullable="true"/> <field name="codePays" type="string" column="CODE_PAYS" length="128" nullable="true"/> <field name="libellePays" type="string" column="LIBELLE_PAYS" length="128" nullable="true"/> - + <field name="sourceInsertDate" type="datetime" column="SOURCE_INSERT_DATE"/> </entity> </doctrine-mapping> diff --git a/module/Import/src/Import/Model/Mapping/Import.Model.TmpThese.dcm.xml b/module/Import/src/Import/Model/Mapping/Import.Model.TmpThese.dcm.xml index 7a38f90e4442c1b876c4ae3926a871e55a23eb7d..eb33655ce79e816dbbfd8d4f28373f46879e098e 100644 --- a/module/Import/src/Import/Model/Mapping/Import.Model.TmpThese.dcm.xml +++ b/module/Import/src/Import/Model/Mapping/Import.Model.TmpThese.dcm.xml @@ -30,5 +30,6 @@ <field name="temAvenant" type="string" column="TEM_AVENANT_COTUT" length="1" nullable="true"/> <field name="temSoutenanceAutorisee" type="string" column="TEM_SOU_AUT_THS" length="1" nullable="true"/> <field name="sourceCode" type="string" column="SOURCE_CODE" length="64" nullable="true"/> + <field name="sourceInsertDate" type="datetime" column="SOURCE_INSERT_DATE"/> </entity> </doctrine-mapping> \ No newline at end of file diff --git a/module/Import/src/Import/Model/Mapping/Import.Model.TmpTheseAnneeUniv.dcm.xml b/module/Import/src/Import/Model/Mapping/Import.Model.TmpTheseAnneeUniv.dcm.xml index b2185d6fb8a71eedcccc3b6e7c4b664c89a4be0c..c34d12a9fcfed420ab710723afe121ecaf3ffebe 100644 --- a/module/Import/src/Import/Model/Mapping/Import.Model.TmpTheseAnneeUniv.dcm.xml +++ b/module/Import/src/Import/Model/Mapping/Import.Model.TmpTheseAnneeUniv.dcm.xml @@ -12,5 +12,7 @@ <field name="theseId" column="THESE_ID" nullable="true"/> <field name="anneeUniv" column="ANNEE_UNIV" nullable="true"/> + + <field name="sourceInsertDate" type="datetime" column="SOURCE_INSERT_DATE"/> </entity> </doctrine-mapping> \ No newline at end of file diff --git a/module/Import/src/Import/Model/Mapping/Import.Model.TmpTitreAcces.dcm.xml b/module/Import/src/Import/Model/Mapping/Import.Model.TmpTitreAcces.dcm.xml index e3171438aa1f40a3f09811f90d3c322ff60c15da..ce7d085d8d5d409fa3d64cfb742a9cea73725b96 100644 --- a/module/Import/src/Import/Model/Mapping/Import.Model.TmpTitreAcces.dcm.xml +++ b/module/Import/src/Import/Model/Mapping/Import.Model.TmpTitreAcces.dcm.xml @@ -14,5 +14,6 @@ <field name="libelleEtabTitreAcces" column="LIBELLE_ETB_TITRE_ACCES" nullable="true"/> <field name="codeDeptTitreAcces" column="CODE_DEPT_TITRE_ACCES" nullable="true"/> <field name="codePaysTitreAcces" column="CODE_PAYS_TITRE_ACCES" nullable="true"/> + <field name="sourceInsertDate" type="datetime" column="SOURCE_INSERT_DATE"/> </entity> </doctrine-mapping> \ No newline at end of file diff --git a/module/Import/src/Import/Model/Mapping/Import.Model.TmpUniteRecherche.dcm.xml b/module/Import/src/Import/Model/Mapping/Import.Model.TmpUniteRecherche.dcm.xml index ad595f6ebf9fb1e0f2266efb4d8bef4c483b61ab..288bd98a8afb921adb932555bcc20eaedd7688c3 100644 --- a/module/Import/src/Import/Model/Mapping/Import.Model.TmpUniteRecherche.dcm.xml +++ b/module/Import/src/Import/Model/Mapping/Import.Model.TmpUniteRecherche.dcm.xml @@ -8,5 +8,6 @@ <field name="sourceId" type="string" column="SOURCE_ID" length="64" nullable="true"/> <field name="sourceCode" type="string" column="SOURCE_CODE" length="64" nullable="true"/> <field name="structureId" type="string" column="STRUCTURE_ID" length="64" nullable="true"/> + <field name="sourceInsertDate" type="datetime" column="SOURCE_INSERT_DATE"/> </entity> </doctrine-mapping> diff --git a/module/Import/src/Import/Model/Mapping/Import.Model.TmpVariable.dcm.xml b/module/Import/src/Import/Model/Mapping/Import.Model.TmpVariable.dcm.xml index 4f7379972ac66440fdd4815cc4f1e3cd6add2462..27875b8c76964ae267b3d42e4ce187f67bbdf0a3 100644 --- a/module/Import/src/Import/Model/Mapping/Import.Model.TmpVariable.dcm.xml +++ b/module/Import/src/Import/Model/Mapping/Import.Model.TmpVariable.dcm.xml @@ -12,5 +12,6 @@ <field name="dateDebValidite" type="date" column="DATE_DEB_VALIDITE" nullable="true"/> <field name="dateFinValidite" type="date" column="DATE_FIN_VALIDITE" nullable="true"/> <field name="sourceCode" type="string" column="SOURCE_CODE" length="64" nullable="true"/> + <field name="sourceInsertDate" type="datetime" column="SOURCE_INSERT_DATE"/> </entity> </doctrine-mapping> \ No newline at end of file diff --git a/module/Import/src/Import/Model/TmpActeur.php b/module/Import/src/Import/Model/TmpActeur.php index 30aab0d725de521a6f9580ebb6a25dfee343c6cf..3ad436de3e9c5efb84108e447ea1df07cf297176 100644 --- a/module/Import/src/Import/Model/TmpActeur.php +++ b/module/Import/src/Import/Model/TmpActeur.php @@ -77,6 +77,11 @@ class TmpActeur */ private $id; + /** + * @var \DateTime + */ + private $sourceInsertDate; + /** * @return string */ diff --git a/module/Import/src/Import/Model/TmpDoctorant.php b/module/Import/src/Import/Model/TmpDoctorant.php index d0209298c250a9a0a17a414e2337a08fe23a8129..91fdf0fe0b0a5cf73da94a1f316be14f20a9fed4 100644 --- a/module/Import/src/Import/Model/TmpDoctorant.php +++ b/module/Import/src/Import/Model/TmpDoctorant.php @@ -38,7 +38,12 @@ class TmpDoctorant private $id; /** - * @return string + * @var string + */ + private $sourceInsertDate; + + /** + * @return \DateTime */ public function getIndividuId() { diff --git a/module/Import/src/Import/Model/TmpEcoleDoctorale.php b/module/Import/src/Import/Model/TmpEcoleDoctorale.php index 7c140af3c1e4cf7209c9efe6e77ee41b4ec16777..ca272bf32183bb1c3f74471d2316b7f2b239875f 100644 --- a/module/Import/src/Import/Model/TmpEcoleDoctorale.php +++ b/module/Import/src/Import/Model/TmpEcoleDoctorale.php @@ -32,6 +32,9 @@ class TmpEcoleDoctorale */ private $id; - + /** + * @var \DateTime + */ + private $sourceInsertDate; } diff --git a/module/Import/src/Import/Model/TmpEtablissement.php b/module/Import/src/Import/Model/TmpEtablissement.php index b736539dea688c6f58344f1e7a041fa3808a1369..0fb9a1a73fb3a4d784fb286a2bd70b55c79e2481 100644 --- a/module/Import/src/Import/Model/TmpEtablissement.php +++ b/module/Import/src/Import/Model/TmpEtablissement.php @@ -32,6 +32,9 @@ class TmpEtablissement */ private $id; - + /** + * @var \DateTime + */ + private $sourceInsertDate; } diff --git a/module/Import/src/Import/Model/TmpFinancement.php b/module/Import/src/Import/Model/TmpFinancement.php index efccea37990bc235461fbcf72724c8ff4ae2a3a8..0a42990e1aa05629935ffbc86a89ccb6139afe24 100644 --- a/module/Import/src/Import/Model/TmpFinancement.php +++ b/module/Import/src/Import/Model/TmpFinancement.php @@ -20,90 +20,7 @@ class TmpFinancement protected $dateFinFinancement; /** - * @return mixed + * @var \DateTime */ - public function getId() - { - return $this->id; - } - - /** - * @return mixed - */ - public function getSourceId() - { - return $this->sourceId; - } - - /** - * @return mixed - */ - public function getEtablissementId() - { - return $this->etablissementId; - } - - /** - * @return mixed - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - /** - * @return mixed - */ - public function getTheseId() - { - return $this->theseId; - } - - /** - * @return mixed - */ - public function getAnnee() - { - return $this->annee; - } - - /** - * @return mixed - */ - public function getOrigineFinancementId() - { - return $this->origineFinancementId; - } - - /** - * @return mixed - */ - public function getComplementFinancement() - { - return $this->complementFinancement; - } - - /** - * @return mixed - */ - public function getQuotiteFinancement() - { - return $this->quotiteFinancement; - } - - /** - * @return mixed - */ - public function getDateDebutFinancement() - { - return $this->dateDebutFinancement; - } - - /** - * @return mixed - */ - public function getDateFinFinancement() - { - return $this->dateFinFinancement; - } + private $sourceInsertDate; } \ No newline at end of file diff --git a/module/Import/src/Import/Model/TmpIndividu.php b/module/Import/src/Import/Model/TmpIndividu.php index bd8a9656bf3cc5e7a43c9a4518b696e5cf56c7ce..c8b4cc7c866e1dafc77cd76b1ff176e27f30e498 100644 --- a/module/Import/src/Import/Model/TmpIndividu.php +++ b/module/Import/src/Import/Model/TmpIndividu.php @@ -82,6 +82,9 @@ class TmpIndividu */ private $id; - + /** + * @var \DateTime + */ + private $sourceInsertDate; } diff --git a/module/Import/src/Import/Model/TmpOrigineFinancement.php b/module/Import/src/Import/Model/TmpOrigineFinancement.php index 588e7864e4009e5034456e5e7326530f92a52e80..3e6cef71fe5015b26bfe2eec29d5db1e0f9c9cfb 100644 --- a/module/Import/src/Import/Model/TmpOrigineFinancement.php +++ b/module/Import/src/Import/Model/TmpOrigineFinancement.php @@ -16,58 +16,7 @@ class TmpOrigineFinancement protected $libOfi; /** - * @return mixed + * @var \DateTime */ - public function getId() - { - return $this->id; - } - - /** - * @return mixed - */ - public function getSourceId() - { - return $this->sourceId; - } - - /** - * @return mixed - */ - public function getEtablissementId() - { - return $this->etablissementId; - } - - /** - * @return mixed - */ - public function getSourceCode() - { - return $this->sourceCode; - } - - /** - * @return mixed - */ - public function getCodOfi() - { - return $this->codOfi; - } - - /** - * @return mixed - */ - public function getLicOfi() - { - return $this->licOfi; - } - - /** - * @return mixed - */ - public function getLibOfi() - { - return $this->libOfi; - } + private $sourceInsertDate; } \ No newline at end of file diff --git a/module/Import/src/Import/Model/TmpRole.php b/module/Import/src/Import/Model/TmpRole.php index c27d402dab3bd8dd7d9c8b9ce46c0c8b016892ec..4879444bc920e12e73dda00bdb37d04dec85dfc4 100644 --- a/module/Import/src/Import/Model/TmpRole.php +++ b/module/Import/src/Import/Model/TmpRole.php @@ -37,6 +37,9 @@ class TmpRole */ private $id; - + /** + * @var \DateTime + */ + private $sourceInsertDate; } diff --git a/module/Import/src/Import/Model/TmpSource.php b/module/Import/src/Import/Model/TmpSource.php index 2b2cf7c9edb454cd4d135925324b24e1d142896f..eb3b7f76d04338ab96870ae234bbfe4093eeccb5 100644 --- a/module/Import/src/Import/Model/TmpSource.php +++ b/module/Import/src/Import/Model/TmpSource.php @@ -37,6 +37,9 @@ class TmpSource */ private $id; - + /** + * @var \DateTime + */ + private $sourceInsertDate; } diff --git a/module/Import/src/Import/Model/TmpStructure.php b/module/Import/src/Import/Model/TmpStructure.php index 6adba510ba837c84f24a4a13a9e3764dff57c4aa..07c9c4978efcc6df102f36d3e878392b3a84a1c4 100644 --- a/module/Import/src/Import/Model/TmpStructure.php +++ b/module/Import/src/Import/Model/TmpStructure.php @@ -52,6 +52,9 @@ class TmpStructure */ private $id; - + /** + * @var \DateTime + */ + private $sourceInsertDate; } diff --git a/module/Import/src/Import/Model/TmpThese.php b/module/Import/src/Import/Model/TmpThese.php index 3acc2544a98cd4b1f115cbea00dc74626a2ede87..bae2d829a86e964d22987b1c57c3d42cfd0e29c8 100644 --- a/module/Import/src/Import/Model/TmpThese.php +++ b/module/Import/src/Import/Model/TmpThese.php @@ -123,12 +123,9 @@ class TmpThese private $id; /** - * @return string + * @var \DateTime */ - public function getId() - { - return $this->id; - } + private $sourceInsertDate; /** * @return string diff --git a/module/Import/src/Import/Model/TmpTheseAnneeUniv.php b/module/Import/src/Import/Model/TmpTheseAnneeUniv.php index 205b47ab93ff88383b47d7c64b8d6b3fdc9b359f..8d6cc9f5060cfd8ca8737ed01f8f43f97f2941a1 100644 --- a/module/Import/src/Import/Model/TmpTheseAnneeUniv.php +++ b/module/Import/src/Import/Model/TmpTheseAnneeUniv.php @@ -36,5 +36,10 @@ class TmpTheseAnneeUniv * @var string */ private $anneeUniv; + + /** + * @var \DateTime + */ + private $sourceInsertDate; } diff --git a/module/Import/src/Import/Model/TmpTitreAcces.php b/module/Import/src/Import/Model/TmpTitreAcces.php index e6a0e11670a6b212c36fae355110e6f40956e6c0..bb30248ec180bd2ae65f7164c3782a13818532a1 100644 --- a/module/Import/src/Import/Model/TmpTitreAcces.php +++ b/module/Import/src/Import/Model/TmpTitreAcces.php @@ -61,5 +61,10 @@ class TmpTitreAcces * @var string */ private $id; + + /** + * @var \DateTime + */ + private $sourceInsertDate; } diff --git a/module/Import/src/Import/Model/TmpUniteRecherche.php b/module/Import/src/Import/Model/TmpUniteRecherche.php index 0a722cfeed79d0320c5174d06e65e1f40c0ad518..ddb1c80cf9758246f60ddfc6117f4cc9b238e2b1 100644 --- a/module/Import/src/Import/Model/TmpUniteRecherche.php +++ b/module/Import/src/Import/Model/TmpUniteRecherche.php @@ -32,6 +32,9 @@ class TmpUniteRecherche */ private $id; - + /** + * @var \DateTime + */ + private $sourceInsertDate; } diff --git a/module/Import/src/Import/Model/TmpVariable.php b/module/Import/src/Import/Model/TmpVariable.php index a37edd53ebc0dcd802a324e0f9fee53830043a02..bab73530d5ff3be07d4d6e47d6b1c94546492137 100644 --- a/module/Import/src/Import/Model/TmpVariable.php +++ b/module/Import/src/Import/Model/TmpVariable.php @@ -52,6 +52,9 @@ class TmpVariable */ private $id; - + /** + * @var \DateTime + */ + private $sourceInsertDate; } diff --git a/module/Import/src/Import/Service/DbService.php b/module/Import/src/Import/Service/DbService.php index 075b8b15f6f9649682c7dfe5d67ba9fcdd347a6d..d96bbbccf5e529ce645a6968c53ac471aa258ec9 100644 --- a/module/Import/src/Import/Service/DbService.php +++ b/module/Import/src/Import/Service/DbService.php @@ -44,7 +44,7 @@ class DbService private $tableName; /** - * @var SQLGenerator + * @var DbServiceSQLGenerator */ private $sqlGenerator; diff --git a/module/Import/src/Import/Service/DbServiceSQLGenerator.php b/module/Import/src/Import/Service/DbServiceSQLGenerator.php index 68819dbb5871fc565fdee85d73a616faf954a124..5c195679a1b83d3d96075860896be86bce8f6ffc 100644 --- a/module/Import/src/Import/Service/DbServiceSQLGenerator.php +++ b/module/Import/src/Import/Service/DbServiceSQLGenerator.php @@ -93,6 +93,8 @@ class DbServiceSQLGenerator return $this->prepareString($value); case 'date': return $this->prepareDate($value); + case 'datetime': + return $this->prepareDatetime($value); default: return $value; } @@ -113,4 +115,15 @@ class DbServiceSQLGenerator return "TO_DATE('$yyymmdd', 'YYYY-MM-DD')"; } + + private function prepareDatetime($value) + { + if ($value === null) { + return "NULL"; + } + + $yyymmddhhmiss = explode('.', $value->date)[0]; + + return "TO_DATE('$yyymmddhhmiss', 'YYYY-MM-DD HH24:MI:SS')"; + } } diff --git a/module/Import/src/Import/Service/SQLGenerator.php b/module/Import/src/Import/Service/SQLGenerator.php deleted file mode 100644 index f1d8ca1c1418f630a13d1b8c81654d9332969535..0000000000000000000000000000000000000000 --- a/module/Import/src/Import/Service/SQLGenerator.php +++ /dev/null @@ -1,116 +0,0 @@ -<?php - -namespace Import\Service; - -use Doctrine\DBAL\Platforms\AbstractPlatform; - -class SQLGenerator -{ - /** - * @var AbstractPlatform - */ - private $databasePlatform; - - /** - * @param AbstractPlatform $databasePlatform - * @return self - */ - public function setDatabasePlatform($databasePlatform) - { - $this->databasePlatform = $databasePlatform; - - return $this; - } - - /** - * Génère la requête SQL de suppression de tout ou partie des données déjà importées. - * - * @param string $tableName - * @param array $filters - * @return string - */ - public function generateSQLQueryForClearingExistingData($tableName, array $filters = []) - { - $query = "DELETE FROM " . $tableName; - - if (count($filters) > 0) { - $wheres = $filters; - // NB: préfixage par le code établissement doit être fait en amont - array_walk($wheres, function (&$v, $k) { - $v = strtoupper($k) . " = '$v'"; - }); - $wheres = implode(' AND ', $wheres); - $query .= ' WHERE ' . $wheres; - } - - return $query; - } - - /** - * Génère les requêtes SQL de persistence d'une donnée importée. - * - * @param string $tableName - * @param array $tableColumns - * @param array $columnsValues - * @return string - */ - public function generateSQLQueryForSavingData($tableName, array $tableColumns, array $columnsValues) - { - return sprintf("INSERT INTO %s (%s) VALUES (%s)", - $tableName, - implode(", ", $tableColumns), - implode(", ", $columnsValues) - ); - } - - /** - * @param array $queries - * @return string - */ - public function wrapSQLQueriesInBeginEnd(array $queries) - { - $indent = ' '; - - $sql = $indent . implode(';' . PHP_EOL . $indent, $queries) . ';'; - - return implode(PHP_EOL, ['BEGIN', $sql, 'END;']); - } - - /** - * Fonction de mise en forme d'une valeur selon les metatadata de la propriété spécifiée. - * - * @param mixed $value La valeur à formater - * @param string $type - * @return string La donnée formatée - * - * RMQ si un format n'est pas prévu par le traitement la valeur est retournée sans traitement et un message est - * affiché - */ - public function formatValueForPropertyType($value, $type) - { - switch ($type) { - case 'string': - return $this->prepareString($value); - case 'date': - return $this->prepareDate($value); - default: - return $value; - } - } - - private function prepareString($value) - { - return "'" . $this->databasePlatform->quoteStringLiteral($value) . "'"; - } - - private function prepareDate($value) - { - if ($value === null) { - return "NULL"; - } - - $yyymmdd = explode(' ', $value->date)[0]; - - return "TO_DATE('$yyymmdd', 'YYYY-MM-DD')"; - } -} diff --git a/module/Import/tests/ImportTest/Service/SQLGeneratorTest.php b/module/Import/tests/ImportTest/Service/SQLGeneratorTest.php deleted file mode 100644 index 6dbfa69df69ca32444819689b906dafa112c9650..0000000000000000000000000000000000000000 --- a/module/Import/tests/ImportTest/Service/SQLGeneratorTest.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php - -namespace ImportTest\Service; - -use Doctrine\DBAL\Platforms\AbstractPlatform; -use Import\Service\SQLGenerator; - -class SQLGeneratorTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var SQLGenerator - */ - private $sqlGenerator; - - protected function setUp() - { - $this->sqlGenerator = new SQLGenerator(); - } - - public function test_generateSQLQueryForClearingExistingData() - { - $filters = []; - $sql = $this->sqlGenerator->generateSQLQueryForClearingExistingData('table_basse', $filters); - $this->assertEquals("DELETE FROM table_basse", $sql); - - $filters = ['tiroir_id' => 1234]; - $sql = $this->sqlGenerator->generateSQLQueryForClearingExistingData('table_basse', $filters); - $this->assertEquals("DELETE FROM table_basse WHERE TIROIR_ID = '1234'", $sql); - - $filters = ['tiroir_id' => 1234, 'couleur' => 'bleue']; - $sql = $this->sqlGenerator->generateSQLQueryForClearingExistingData('table_basse', $filters); - $this->assertEquals("DELETE FROM table_basse WHERE TIROIR_ID = '1234' AND COULEUR = 'bleue'", $sql); - } - - public function test_generateSQLQueryForSavingData() - { - $tableColumns = ['largeur', 'hauteur', 'couleur']; - $columnsValues = [12, '30', "'bleue'"]; - $sql = $this->sqlGenerator->generateSQLQueryForSavingData('table_basse', $tableColumns, $columnsValues); - $this->assertEquals("INSERT INTO table_basse (largeur, hauteur, couleur) VALUES (12, 30, 'bleue')", $sql); - } - - public function test_wrapSQLQueriesInBeginEnd() - { - $queries = ['insert ceci', 'insert cela']; - $sql = $this->sqlGenerator->wrapSQLQueriesInBeginEnd($queries); - $expected = <<<EOS -BEGIN - insert ceci; - insert cela; -END; -EOS; - $this->assertEquals($expected, $sql); - } - - public function getDataset() - { - $date = (new \stdClass()); - $date->date = '2018-11-15 08:00:00'; - - return [ - [null, 'string', "'quoted'"], - ['valeur', 'string', "'quoted'"], - [12, 'string', "'quoted'"], - [null, 'date', "NULL"], - [$date, 'date', "TO_DATE('2018-11-15', 'YYYY-MM-DD')"], - ['valeur', '??????', 'valeur'], - [12, '??????', 12], - ]; - } - - /** - * @param $value - * @param $type - * @param $expected - * @dataProvider getDataset - */ - public function test_formatValueForPropertyType($value, $type, $expected) - { - /** @var AbstractPlatform|\PHPUnit_Framework_MockObject_MockObject $platform */ - $platform = $this->createMock(AbstractPlatform::class); - $this->sqlGenerator->setDatabasePlatform($platform); - - $platform->expects($this->any())->method('quoteStringLiteral')->with($value)->willReturn("quoted"); - $res = $this->sqlGenerator->formatValueForPropertyType($value, $type); - $this->assertEquals($expected, $res); - } -}