Loading code/QueryCompare.php +11 −49 Original line number Diff line number Diff line Loading @@ -5,63 +5,25 @@ * @var $container \Psr\Container\ContainerInterface */ $sql1 = "SELECT * FROM temp_contrat_main"; $sql1 = "SELECT * FROM tbl_piece_jointe"; $sql2 = "SELECT * FROM v_contrat_main"; $sql2 = "SELECT * FROM v_tbl_piece_jointe"; $keyCols = ['CONTRAT_ID']; $keyCols = ['TYPE_PIECE_JOINTE_ID', 'INTERVENANT_ID']; //pays_nationalite => paysNationalite //date_creation => dateCreation //date_contrat_lie => dateContratLie $ignoreCols = [ 'FORMULE_RESULTAT_ID', // colonne supprimée //'totalDiviseParDix', // colonne supprimée 'tauxId', // colonne supprimée 'tauxMajoreId', // colonne supprimée 'heuresPeriodeEssai', // nouvelle colonne 'heuresPrimePrecarite', // nouvelle colonne 'missions', // nouvelle colonne 'typesMission', // nouvelle colonne 'missionsTypesMissions', // nouvelle colonne 'horodatage', // dates générées à partir de NOW => pas de pb 'dateCreation', // formatage pourri ancienne => Ok maintenant 'dateContratLie', // formatage pourri ancienne => Ok maintenant //'tauxHoraireDate', // formatage pourri ancienne => Ok maintenant //'tauxMajoreHoraireDate', // colonne vide avant 'heuresFormation', // toutes vides ancienne vue 'enteteAutresHeures', // problèmes trouvés dans ancienne vue v_contrat_main 'legendeAutresHeures', // problèmes trouvés dans ancienne vue v_contrat_main 'paysNationalite', // colonnes vides dans ancienne, car on ne prenait en compte que les données perso sans tenir compte de la table intervenant 'serviceTotalPaye', // le nouvel calcul met le taux de CP à 0 pour les enseignements, pas l'ancienne vue //'tauxMajoreNom', // bug sur ancien tbl, pas utilisé car recalculé en vue //'tauxNom', // bug sur ancien tbl, pas utilisé car recalculé en vue 'tauxHoraireDate', // les taux sont mieux calculés maintenant 'tauxHoraireValeur', // les taux sont mieux calculés maintenant 'tauxMajoreHoraireDate', // les taux sont mieux calculés maintenant 'tauxMajoreHoraireValeur', // les taux sont mieux calculés maintenant //'numeroAvenant', // pb calcul ancien v23 /* à contrôler + finement */ //'titreCourt', // lié au pb parentalité des avenants ?? 'totalHETD', // OK, la règle n'est plus la même 'hetdContrat', 'avenant1', // contrat1 modifieComplete n titre reste => avenants qui se transforment en contrat et vice versa ?? // contrats concernés : 2479, 40336, 36972, 36028, 19628, 1912, 1854 'DEMANDEE_APRES_RECRUTEMENT', 'DATE_ORIGINE', 'DATE_VALIDITEE', 'SEUIL_HETD', 'HEURES_POUR_SEUIL', 'ID', // colonne supprimée ]; $onlyCols = [ Loading code/test7.php +2 −2 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ $stbl = $container->get(\UnicaenTbl\Service\TableauBordService::class); $data = ['INTERVENANT_ID' => 824751]; $data=[]; $data = ['INTERVENANT_ID' => 1000171]; //$data=[]; $stbl->calculer('piece_jointe', $data); config/autoload/unicaen-tbl.global.php +1 −1 Original line number Diff line number Diff line Loading @@ -332,8 +332,8 @@ return [ ], 'key' => [ 'TYPE_PIECE_JOINTE_ID', 'INTERVENANT_ID', 'TYPE_PIECE_JOINTE_ID', ], ], Loading data/ddl/view/V_TBL_PIECE_JOINTE.sql +4 −4 Original line number Diff line number Diff line Loading @@ -11,8 +11,8 @@ WITH t AS ( COALESCE(pjd.heures_pour_seuil,0) heures_pour_seuil, COALESCE(pjd.obligatoire,1) obligatoire FROM tbl_piece_jointe_demande pjd LEFT JOIN tbl_piece_jointe_fournie pjf ON pjf.code_intervenant = pjd.code_intervenant v_tbl_piece_jointe_demande pjd LEFT JOIN v_tbl_piece_jointe_fournie pjf ON pjf.code_intervenant = pjd.code_intervenant AND pjf.type_piece_jointe_id = pjd.type_piece_jointe_id AND pjd.annee_id BETWEEN pjf.annee_id AND COALESCE(pjf.date_archive - 1,(pjf.annee_id + pjd.duree_vie-1)) WHERE Loading @@ -35,8 +35,8 @@ WITH t AS ( 0 heures_pour_seuil, 0 obligatoire FROM tbl_piece_jointe_fournie pjf LEFT JOIN tbl_piece_jointe_demande pjd ON pjd.intervenant_id = pjf.intervenant_id v_tbl_piece_jointe_fournie pjf LEFT JOIN v_tbl_piece_jointe_demande pjd ON pjd.intervenant_id = pjf.intervenant_id AND pjd.type_piece_jointe_id = pjf.type_piece_jointe_id WHERE pjd.id IS NULL Loading module/PieceJointe/src/Tbl/Process/PieceJointeProcess.php +25 −21 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace PieceJointe\Tbl\Process; use Application\Service\Traits\AnneeServiceAwareTrait; use Intervenant\Service\IntervenantServiceAwareTrait; use Unicaen\BddAdmin\BddAwareTrait; use UnicaenTbl\Event; Loading @@ -19,6 +20,7 @@ class PieceJointeProcess implements ProcessInterface use BddServiceAwareTrait; use BddAwareTrait; use IntervenantServiceAwareTrait; use AnneeServiceAwareTrait; protected array $piecesJointesDemandees = []; Loading @@ -36,25 +38,16 @@ class PieceJointeProcess implements ProcessInterface public function run(TableauBord $tableauBord, array $params = []): void { if (empty($params)) { $annees = $this->getServiceAnnee()->getActives(true); foreach ($annees as $annee) { $this->run($tableauBord, ['ANNEE_ID' => $annee->getId()]); } } else { $this->getPiecesJointesDemandees($params); $this->getPiecesJointesFournies($params); $this->traitementPiecesJointes($params); $this->enregistrement($tableauBord, $params); } } protected function getPiecesJointesDemandees(array $params): array { $params = $this->replaceIntervenantIdbyCodeIntervenantParam($params); $definition = $this->getServiceBdd()->getViewDefinition('V_TBL_PIECE_JOINTE_DEMANDE'); $sqlPiecesJointesDemandees = 'SELECT * FROM (' . $this->getServiceBdd()->injectKey($definition, $params) Loading @@ -70,7 +63,6 @@ class PieceJointeProcess implements ProcessInterface unset($piecesJointesDemandees); //dump($this->piecesJointesDemandees); return $this->piecesJointesDemandees; } Loading @@ -80,6 +72,7 @@ class PieceJointeProcess implements ProcessInterface { $params = $this->replaceIntervenantIdbyCodeIntervenantParam($params); $definition = $this->getServiceBdd()->getViewDefinition('V_TBL_PIECE_JOINTE_FOURNIE'); $sqlPiecesJointesFournies = 'SELECT * FROM (' . $this->getServiceBdd()->injectKey($definition, $params) Loading @@ -98,7 +91,6 @@ class PieceJointeProcess implements ProcessInterface } unset($piecesJointesFournies); //dump($this->piecesJointesFournies); return $this->piecesJointesFournies; Loading @@ -120,13 +112,17 @@ class PieceJointeProcess implements ProcessInterface protected function replaceIntervenantIdbyCodeIntervenantParam(array $params): array { if (isset($params['intervenant_id'])) { $intervenant = $this->getServiceIntervenant()->get($params['intervenant_id']); if (isset($params['INTERVENANT_ID'])) { $intervenant = $this->getServiceIntervenant()->get($params['INTERVENANT_ID']); $codeIntervenant = $intervenant->getCode(); unset($params['intervenant_id']); $params['code_intervenant'] = $codeIntervenant; unset($params['INTERVENANT_ID']); $params['CODE_INTERVENANT'] = $codeIntervenant; } if (isset($params['ANNEE_ID'])) { unset($params['ANNEE_ID']); } return $params; } Loading Loading @@ -156,7 +152,7 @@ class PieceJointeProcess implements ProcessInterface $this->sortDatas($this->tblData[$uuid]); } //On parcourt maintenants les pièces jointes fournies qui sont forcément fournies l'année de leurs dépot //On parcourt maintenant les pièces jointes fournies qui sont forcément fournies l'année de leurs dépot foreach ($this->piecesJointesFournies as $codeIntervenant => $datas) { foreach ($datas as $typePieceJointeId => $piecesJointesFournies) { foreach ($piecesJointesFournies as $pieceJointeFournie) { Loading @@ -181,21 +177,27 @@ class PieceJointeProcess implements ProcessInterface } } } //Ensuite on cherche les pièces jointes fournis sur une potentielle année postérieurs (durée de vie) //Ensuite on cherche les pièces jointes fournies sur une potentielle année postérieure (durée de vie) foreach ($this->piecesJointesDemandees as $pieceJointeDemandee) { $piecesJointesFournies = $this->extractPiecesJointesFournies($pieceJointeDemandee['CODE_INTERVENANT'], $pieceJointeDemandee['TYPE_PIECE_JOINTE_ID']); $uuid = $pieceJointeDemandee['ANNEE_ID'] . '_' . $pieceJointeDemandee['INTERVENANT_ID'] . "_" . $pieceJointeDemandee['TYPE_PIECE_JOINTE_ID']; //Piece jointe demandée déjà fournie donc on passe if ($this->tblData[$uuid]['FOURNIE'] == 1) { continue; } if (!empty($piecesJointesFournies)) { foreach ($piecesJointesFournies as $pieceJointeFournie) { if ((int)$pieceJointeDemandee['ANNEE_ID'] > (int)$pieceJointeFournie['ANNEE_ID']) { if (//1 - Si la pièce jointe est validée if (//0 - c'est le même type de piece jointe $pieceJointeDemandee['TYPE_PIECE_JOINTE_ID'] == $pieceJointeFournie['TYPE_PIECE_JOINTE_ID'] && //1 - Si la pièce jointe est validée !empty($pieceJointeFournie['VALIDATION_ID']) && //2 -Si la date de validité de la pièce jointe est strictement supérieure à l'année où elle est demandée (int)$pieceJointeFournie['DATE_VALIDITEE'] > (int)$pieceJointeDemandee['ANNEE_ID'] && //3 - Si l'année de la pièce fournie est strictement supérieure au maximum de l'ancienneté //de la pièce possible par rapport à la durée de vie paramétrée sur l'année où elle est demandée (int)$pieceJointeFournie['ANNEE_ID'] > ((int)$pieceJointeDemandee['ANNEE_ID']-(int)$pieceJointeDemandee['DUREE_VIE']) && (int)$pieceJointeFournie['ANNEE_ID'] > round((int)$pieceJointeDemandee['ANNEE_ID']-(int)$pieceJointeDemandee['DUREE_VIE']) && //4 - Si la date d'archive de la pièce fournie est strictement supérieure à l'année où elle est demandée ((int)$pieceJointeFournie['DATE_ARCHIVE'] > (int)$pieceJointeDemandee['ANNEE_ID'] || empty($pieceJointeFournie['DATE_ARCHIVE']))) { Loading @@ -207,13 +209,13 @@ class PieceJointeProcess implements ProcessInterface } } } } } $this->sortDatas($this->tblData[$uuid]); } ksort($this->tblData); //dd($this->tblData); } Loading @@ -227,6 +229,8 @@ class PieceJointeProcess implements ProcessInterface $table = $this->getBdd()->getTable('TBL_PIECE_JOINTE'); //dd($this->tblData); $options = [ 'where' => $params, Loading Loading
code/QueryCompare.php +11 −49 Original line number Diff line number Diff line Loading @@ -5,63 +5,25 @@ * @var $container \Psr\Container\ContainerInterface */ $sql1 = "SELECT * FROM temp_contrat_main"; $sql1 = "SELECT * FROM tbl_piece_jointe"; $sql2 = "SELECT * FROM v_contrat_main"; $sql2 = "SELECT * FROM v_tbl_piece_jointe"; $keyCols = ['CONTRAT_ID']; $keyCols = ['TYPE_PIECE_JOINTE_ID', 'INTERVENANT_ID']; //pays_nationalite => paysNationalite //date_creation => dateCreation //date_contrat_lie => dateContratLie $ignoreCols = [ 'FORMULE_RESULTAT_ID', // colonne supprimée //'totalDiviseParDix', // colonne supprimée 'tauxId', // colonne supprimée 'tauxMajoreId', // colonne supprimée 'heuresPeriodeEssai', // nouvelle colonne 'heuresPrimePrecarite', // nouvelle colonne 'missions', // nouvelle colonne 'typesMission', // nouvelle colonne 'missionsTypesMissions', // nouvelle colonne 'horodatage', // dates générées à partir de NOW => pas de pb 'dateCreation', // formatage pourri ancienne => Ok maintenant 'dateContratLie', // formatage pourri ancienne => Ok maintenant //'tauxHoraireDate', // formatage pourri ancienne => Ok maintenant //'tauxMajoreHoraireDate', // colonne vide avant 'heuresFormation', // toutes vides ancienne vue 'enteteAutresHeures', // problèmes trouvés dans ancienne vue v_contrat_main 'legendeAutresHeures', // problèmes trouvés dans ancienne vue v_contrat_main 'paysNationalite', // colonnes vides dans ancienne, car on ne prenait en compte que les données perso sans tenir compte de la table intervenant 'serviceTotalPaye', // le nouvel calcul met le taux de CP à 0 pour les enseignements, pas l'ancienne vue //'tauxMajoreNom', // bug sur ancien tbl, pas utilisé car recalculé en vue //'tauxNom', // bug sur ancien tbl, pas utilisé car recalculé en vue 'tauxHoraireDate', // les taux sont mieux calculés maintenant 'tauxHoraireValeur', // les taux sont mieux calculés maintenant 'tauxMajoreHoraireDate', // les taux sont mieux calculés maintenant 'tauxMajoreHoraireValeur', // les taux sont mieux calculés maintenant //'numeroAvenant', // pb calcul ancien v23 /* à contrôler + finement */ //'titreCourt', // lié au pb parentalité des avenants ?? 'totalHETD', // OK, la règle n'est plus la même 'hetdContrat', 'avenant1', // contrat1 modifieComplete n titre reste => avenants qui se transforment en contrat et vice versa ?? // contrats concernés : 2479, 40336, 36972, 36028, 19628, 1912, 1854 'DEMANDEE_APRES_RECRUTEMENT', 'DATE_ORIGINE', 'DATE_VALIDITEE', 'SEUIL_HETD', 'HEURES_POUR_SEUIL', 'ID', // colonne supprimée ]; $onlyCols = [ Loading
code/test7.php +2 −2 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ $stbl = $container->get(\UnicaenTbl\Service\TableauBordService::class); $data = ['INTERVENANT_ID' => 824751]; $data=[]; $data = ['INTERVENANT_ID' => 1000171]; //$data=[]; $stbl->calculer('piece_jointe', $data);
config/autoload/unicaen-tbl.global.php +1 −1 Original line number Diff line number Diff line Loading @@ -332,8 +332,8 @@ return [ ], 'key' => [ 'TYPE_PIECE_JOINTE_ID', 'INTERVENANT_ID', 'TYPE_PIECE_JOINTE_ID', ], ], Loading
data/ddl/view/V_TBL_PIECE_JOINTE.sql +4 −4 Original line number Diff line number Diff line Loading @@ -11,8 +11,8 @@ WITH t AS ( COALESCE(pjd.heures_pour_seuil,0) heures_pour_seuil, COALESCE(pjd.obligatoire,1) obligatoire FROM tbl_piece_jointe_demande pjd LEFT JOIN tbl_piece_jointe_fournie pjf ON pjf.code_intervenant = pjd.code_intervenant v_tbl_piece_jointe_demande pjd LEFT JOIN v_tbl_piece_jointe_fournie pjf ON pjf.code_intervenant = pjd.code_intervenant AND pjf.type_piece_jointe_id = pjd.type_piece_jointe_id AND pjd.annee_id BETWEEN pjf.annee_id AND COALESCE(pjf.date_archive - 1,(pjf.annee_id + pjd.duree_vie-1)) WHERE Loading @@ -35,8 +35,8 @@ WITH t AS ( 0 heures_pour_seuil, 0 obligatoire FROM tbl_piece_jointe_fournie pjf LEFT JOIN tbl_piece_jointe_demande pjd ON pjd.intervenant_id = pjf.intervenant_id v_tbl_piece_jointe_fournie pjf LEFT JOIN v_tbl_piece_jointe_demande pjd ON pjd.intervenant_id = pjf.intervenant_id AND pjd.type_piece_jointe_id = pjf.type_piece_jointe_id WHERE pjd.id IS NULL Loading
module/PieceJointe/src/Tbl/Process/PieceJointeProcess.php +25 −21 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace PieceJointe\Tbl\Process; use Application\Service\Traits\AnneeServiceAwareTrait; use Intervenant\Service\IntervenantServiceAwareTrait; use Unicaen\BddAdmin\BddAwareTrait; use UnicaenTbl\Event; Loading @@ -19,6 +20,7 @@ class PieceJointeProcess implements ProcessInterface use BddServiceAwareTrait; use BddAwareTrait; use IntervenantServiceAwareTrait; use AnneeServiceAwareTrait; protected array $piecesJointesDemandees = []; Loading @@ -36,25 +38,16 @@ class PieceJointeProcess implements ProcessInterface public function run(TableauBord $tableauBord, array $params = []): void { if (empty($params)) { $annees = $this->getServiceAnnee()->getActives(true); foreach ($annees as $annee) { $this->run($tableauBord, ['ANNEE_ID' => $annee->getId()]); } } else { $this->getPiecesJointesDemandees($params); $this->getPiecesJointesFournies($params); $this->traitementPiecesJointes($params); $this->enregistrement($tableauBord, $params); } } protected function getPiecesJointesDemandees(array $params): array { $params = $this->replaceIntervenantIdbyCodeIntervenantParam($params); $definition = $this->getServiceBdd()->getViewDefinition('V_TBL_PIECE_JOINTE_DEMANDE'); $sqlPiecesJointesDemandees = 'SELECT * FROM (' . $this->getServiceBdd()->injectKey($definition, $params) Loading @@ -70,7 +63,6 @@ class PieceJointeProcess implements ProcessInterface unset($piecesJointesDemandees); //dump($this->piecesJointesDemandees); return $this->piecesJointesDemandees; } Loading @@ -80,6 +72,7 @@ class PieceJointeProcess implements ProcessInterface { $params = $this->replaceIntervenantIdbyCodeIntervenantParam($params); $definition = $this->getServiceBdd()->getViewDefinition('V_TBL_PIECE_JOINTE_FOURNIE'); $sqlPiecesJointesFournies = 'SELECT * FROM (' . $this->getServiceBdd()->injectKey($definition, $params) Loading @@ -98,7 +91,6 @@ class PieceJointeProcess implements ProcessInterface } unset($piecesJointesFournies); //dump($this->piecesJointesFournies); return $this->piecesJointesFournies; Loading @@ -120,13 +112,17 @@ class PieceJointeProcess implements ProcessInterface protected function replaceIntervenantIdbyCodeIntervenantParam(array $params): array { if (isset($params['intervenant_id'])) { $intervenant = $this->getServiceIntervenant()->get($params['intervenant_id']); if (isset($params['INTERVENANT_ID'])) { $intervenant = $this->getServiceIntervenant()->get($params['INTERVENANT_ID']); $codeIntervenant = $intervenant->getCode(); unset($params['intervenant_id']); $params['code_intervenant'] = $codeIntervenant; unset($params['INTERVENANT_ID']); $params['CODE_INTERVENANT'] = $codeIntervenant; } if (isset($params['ANNEE_ID'])) { unset($params['ANNEE_ID']); } return $params; } Loading Loading @@ -156,7 +152,7 @@ class PieceJointeProcess implements ProcessInterface $this->sortDatas($this->tblData[$uuid]); } //On parcourt maintenants les pièces jointes fournies qui sont forcément fournies l'année de leurs dépot //On parcourt maintenant les pièces jointes fournies qui sont forcément fournies l'année de leurs dépot foreach ($this->piecesJointesFournies as $codeIntervenant => $datas) { foreach ($datas as $typePieceJointeId => $piecesJointesFournies) { foreach ($piecesJointesFournies as $pieceJointeFournie) { Loading @@ -181,21 +177,27 @@ class PieceJointeProcess implements ProcessInterface } } } //Ensuite on cherche les pièces jointes fournis sur une potentielle année postérieurs (durée de vie) //Ensuite on cherche les pièces jointes fournies sur une potentielle année postérieure (durée de vie) foreach ($this->piecesJointesDemandees as $pieceJointeDemandee) { $piecesJointesFournies = $this->extractPiecesJointesFournies($pieceJointeDemandee['CODE_INTERVENANT'], $pieceJointeDemandee['TYPE_PIECE_JOINTE_ID']); $uuid = $pieceJointeDemandee['ANNEE_ID'] . '_' . $pieceJointeDemandee['INTERVENANT_ID'] . "_" . $pieceJointeDemandee['TYPE_PIECE_JOINTE_ID']; //Piece jointe demandée déjà fournie donc on passe if ($this->tblData[$uuid]['FOURNIE'] == 1) { continue; } if (!empty($piecesJointesFournies)) { foreach ($piecesJointesFournies as $pieceJointeFournie) { if ((int)$pieceJointeDemandee['ANNEE_ID'] > (int)$pieceJointeFournie['ANNEE_ID']) { if (//1 - Si la pièce jointe est validée if (//0 - c'est le même type de piece jointe $pieceJointeDemandee['TYPE_PIECE_JOINTE_ID'] == $pieceJointeFournie['TYPE_PIECE_JOINTE_ID'] && //1 - Si la pièce jointe est validée !empty($pieceJointeFournie['VALIDATION_ID']) && //2 -Si la date de validité de la pièce jointe est strictement supérieure à l'année où elle est demandée (int)$pieceJointeFournie['DATE_VALIDITEE'] > (int)$pieceJointeDemandee['ANNEE_ID'] && //3 - Si l'année de la pièce fournie est strictement supérieure au maximum de l'ancienneté //de la pièce possible par rapport à la durée de vie paramétrée sur l'année où elle est demandée (int)$pieceJointeFournie['ANNEE_ID'] > ((int)$pieceJointeDemandee['ANNEE_ID']-(int)$pieceJointeDemandee['DUREE_VIE']) && (int)$pieceJointeFournie['ANNEE_ID'] > round((int)$pieceJointeDemandee['ANNEE_ID']-(int)$pieceJointeDemandee['DUREE_VIE']) && //4 - Si la date d'archive de la pièce fournie est strictement supérieure à l'année où elle est demandée ((int)$pieceJointeFournie['DATE_ARCHIVE'] > (int)$pieceJointeDemandee['ANNEE_ID'] || empty($pieceJointeFournie['DATE_ARCHIVE']))) { Loading @@ -207,13 +209,13 @@ class PieceJointeProcess implements ProcessInterface } } } } } $this->sortDatas($this->tblData[$uuid]); } ksort($this->tblData); //dd($this->tblData); } Loading @@ -227,6 +229,8 @@ class PieceJointeProcess implements ProcessInterface $table = $this->getBdd()->getTable('TBL_PIECE_JOINTE'); //dd($this->tblData); $options = [ 'where' => $params, Loading