Loading code/test3.php +12 −3 Changes for code/test3.php: 12 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ * @var $sl \Zend\ServiceManager\ServiceLocatorInterface */ use Application\Service\ModeleContratService; use Unicaen\OpenDocument\Document; Loading @@ -14,6 +15,7 @@ $d = [ [ 'nom' => 'Lécluse', 'prenom' => 'Laurent', 'varFoot' => 'test footer ok!!!', 'sec1' => false, 'dpl_libelle@table:table-row' => [ Loading Loading @@ -51,9 +53,13 @@ $d = [ [ 'nom' => 'Fery', 'prenom' => 'Karin', 'varFoot' => 'test footer 2 bizarre!!!', 'sec1@text:section' => [ ['secvar' => 'Varsec1',], ['secvar' => 'Varsec2',] ['secvar' => 'Varsec2',], ['secvar' => 'Varsec3',], ['secvar' => 'Varsec4',], ['secvar' => 'Varsec5',], ], 'dpl_libelle@table:table-row' => [ [ Loading Loading @@ -91,7 +97,7 @@ poto', ///** @var ModeleContrat $contrat */ //$contrat = $sl->get(ModeleContratService::class)->get(3); $contrat = $sl->get(ModeleContratService::class)->get(13); $document = new Document(); $document->setTmpDir('/home/laurent/UnicaenCode'); Loading @@ -103,7 +109,10 @@ $p = $document->publish($d); $document->setPdfOutput(true); //$document->saveToFile('/home/laurent/UnicaenCode/odtExport.pdf'); xmlDump($document->getPublisher()->getOutContent()); //xmlDump($document->getPublisher()->getOutContent()); //xmlDump($document->getStyles()); //var_dump($document->getStylist()->getVariables()); $document->download('exp.pdf'); Loading data/Mises à jour/07.0.sql +124 Changes for data/Mises à jour/07.0.sql: 124 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -342,3 +342,127 @@ FROM ( UNION ALL SELECT 'contrat' c, 'contrat-generation' p, 'Génération de contrat' l FROM dual ) t1; CREATE OR REPLACE VIEW V_CONTRAT_MAIN AS WITH hs AS ( SELECT contrat_id, sum(heures) "serviceTotal" FROM V_CONTRAT_SERVICES GROUP BY contrat_id ) SELECT ct.id contrat_id, ct."annee", ct."nom", ct."prenom", ct."civilite", ct."e", ct."dateNaissance", ct."adresse", ct."numInsee", ct."statut", ct."totalHETD", ct."tauxHoraireValeur", ct."tauxHoraireDate", ct."dateSignature", CASE WHEN ct.est_contrat=1 THEN 1 ELSE null END "contrat1", CASE WHEN ct.est_contrat=1 THEN null ELSE 1 END "avenant1", CASE WHEN ct.est_contrat=1 THEN '3' ELSE '2' END "n", to_char(SYSDATE, 'dd/mm/YYYY - hh24:mi:ss') "horodatage", 'Exemplaire à conserver' "exemplaire1", 'Exemplaire à retourner' || ct."exemplaire2" "exemplaire2", ct."serviceTotal", CASE ct.est_contrat WHEN 1 THEN -- contrat 'Contrat de travail ' ELSE 'Avenant au contrat de travail initial modifiant le volume horaire initial' || ' de recrutement en qualité ' END "titre", CASE WHEN ct.est_atv = 1 THEN 'd''agent temporaire vacataire' ELSE 'de chargé' || ct."e" || ' d''enseignement vacataire' END "qualite", CASE WHEN ct.est_projet = 1 AND ct.est_contrat = 1 THEN 'Projet de contrat' WHEN ct.est_projet = 0 AND ct.est_contrat = 1 THEN 'Contrat n°' || ct.id WHEN ct.est_projet = 1 AND ct.est_contrat = 0 THEN 'Projet d''avenant' WHEN ct.est_projet = 0 AND ct.est_contrat = 0 THEN 'Avenant n°' || ct.contrat_id || '.' || ct.numero_avenant END "titreCourt" FROM ( SELECT c.*, a.libelle "annee", COALESCE(d.nom_usuel,i.nom_usuel) "nom", COALESCE(d.prenom,i.prenom) "prenom", civ.libelle_court "civilite", CASE WHEN civ.sexe = 'F' THEN 'e' ELSE '' END "e", to_char(COALESCE(d.date_naissance,i.date_naissance), 'dd/mm/YYYY') "dateNaissance", COALESCE(d.adresse,ose_divers.formatted_adresse( ai.NO_VOIE, ai.NOM_VOIE, ai.BATIMENT, ai.MENTION_COMPLEMENTAIRE, ai.LOCALITE, ai.CODE_POSTAL, ai.VILLE, ai.PAYS_LIBELLE)) "adresse", COALESCE(d.numero_insee,i.numero_insee || ' ' || COALESCE(LPAD(i.numero_insee_cle,2,'0'),'')) "numInsee", si.libelle "statut", replace(ltrim(to_char(COALESCE(fr.total,0), '999999.00')),'.',',') "totalHETD", replace(ltrim(to_char(COALESCE(th.valeur,0), '999999.00')),'.',',') "tauxHoraireValeur", COALESCE(to_char(th.histo_creation, 'dd/mm/YYYY'), 'TAUX INTROUVABLE') "tauxHoraireDate", to_char(COALESCE(v.histo_creation, c.histo_creation), 'dd/mm/YYYY') "dateSignature", CASE WHEN s.aff_adresse_contrat = 1 THEN ' signé à l''adresse suivante :' || CHR(13) || CHR(10) || s.libelle_court || ' - ' || REPLACE(ose_divers.formatted_adresse( astr.NO_VOIE, astr.NOM_VOIE, null, null, astr.LOCALITE, astr.CODE_POSTAL, astr.VILLE, null), CHR(13), ' - ') ELSE '' END "exemplaire2", replace(ltrim(to_char(COALESCE(hs."serviceTotal",0), '999999.00')),'.',',') "serviceTotal", CASE WHEN c.contrat_id IS NULL THEN 1 ELSE 0 END est_contrat, CASE WHEN v.id IS NULL THEN 1 ELSE 0 END est_projet, si.tem_atv est_atv FROM contrat c JOIN type_contrat tc ON tc.id = c.type_contrat_id JOIN intervenant i ON i.id = c.intervenant_id JOIN annee a ON a.id = i.annee_id JOIN statut_intervenant si ON si.id = i.statut_id JOIN structure s ON s.id = c.structure_id LEFT JOIN adresse_structure astr ON astr.structure_id = s.id AND astr.principale = 1 AND astr.histo_destruction IS NULL LEFT JOIN dossier d ON d.intervenant_id = i.id AND d.histo_destruction IS NULL JOIN civilite civ ON civ.id = COALESCE(d.civilite_id,i.civilite_id) LEFT JOIN validation v ON v.id = c.validation_id AND v.histo_destruction IS NULL LEFT JOIN adresse_intervenant ai ON ai.intervenant_id = i.id AND ai.histo_destruction IS NULL JOIN type_volume_horaire tvh ON tvh.code = 'PREVU' JOIN etat_volume_horaire evh ON evh.code = 'valide' LEFT JOIN formule_resultat fr ON fr.intervenant_id = i.id AND fr.type_volume_horaire_id = tvh.id AND fr.etat_volume_horaire_id = evh.id LEFT JOIN taux_horaire_hetd th ON c.histo_creation BETWEEN th.histo_creation AND COALESCE(th.histo_destruction,SYSDATE) LEFT JOIN hs ON hs.contrat_id = c.id WHERE c.histo_destruction IS NULL ) ct ; CREATE OR REPLACE VIEW V_CONTRAT_SERVICES AS SELECT c.id contrat_id, str.libelle_court "serviceComposante", ep.code "serviceCode", ep.libelle "serviceLibelle", sum(vh.heures) heures, replace(ltrim(to_char(sum(vh.heures), '999999.00')),'.',',') "serviceHeures" FROM contrat c JOIN intervenant i ON i.id = c.intervenant_id JOIN type_volume_horaire tvh ON tvh.code = 'PREVU' JOIN service s ON s.intervenant_id = i.id AND s.histo_destruction IS NULL JOIN volume_horaire vh ON vh.service_id = s.id AND vh.histo_destruction IS NULL AND vh.type_volume_horaire_id = tvh.id JOIN validation_vol_horaire vvh ON vvh.volume_horaire_id = vh.id JOIN validation v ON v.id = vvh.validation_id AND v.histo_destruction IS NULL LEFT JOIN validation cv ON cv.id = c.validation_id AND cv.histo_destruction IS NULL LEFT JOIN element_pedagogique ep ON ep.id = s.element_pedagogique_id JOIN structure str ON str.id = COALESCE(ep.structure_id,i.structure_id) WHERE c.histo_destruction IS NULL AND (cv.id IS NULL OR vh.contrat_id = c.id) GROUP BY c.id, str.libelle_court, ep.code, ep.libelle ; No newline at end of file data/modele_contrat.odt +45.2 KiB File added.No diff preview for this file type. View file module/Application/src/Application/Controller/ContratController.php +3 −3 Changes for module/Application/src/Application/Controller/ContratController.php: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -331,7 +331,7 @@ class ContratController extends AbstractController * @todo A Supprimer!!! * @deprecated */ public function exporterOLDAction() public function exporterOldAction() { $this->initFilters(); Loading Loading @@ -423,8 +423,8 @@ class ContratController extends AbstractController ); $exp->addBodyScript('application/contrat/contrat-pdf.phtml', true, $variables, 1); // $exp->export($fileName, Pdf::DESTINATION_BROWSER_FORCE_DL); // die(); // pour éviter de générer une erreur par la suite $exp->export($fileName, Pdf::DESTINATION_BROWSER_FORCE_DL); die(); // pour éviter de générer une erreur par la suite } Loading module/Application/src/Application/Service/ModeleContratService.php +28 −6 Changes for module/Application/src/Application/Service/ModeleContratService.php: 28 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -67,7 +67,14 @@ class ModeleContratService extends AbstractEntityService $document = new Document(); $document->setTmpDir(getcwd() . '/data/cache/'); $document->loadFromData($modele->getFichier()); $fichier = $modele->getFichier(); if ($fichier) { $document->loadFromData($fichier); } else { $document->loadFromFile(getcwd() . '/data/modele_contrat.odt'); } if ($contrat->estUnProjet()) { $document->getStylist()->addFiligrane('PROJET'); } Loading @@ -81,14 +88,19 @@ class ModeleContratService extends AbstractEntityService private function generateData(ModeleContrat $modele, Contrat $contrat) { if (!$modele->getRequete()){ throw new \Exception('Impossible de générer le contrat: pas de requête pour le modèle "'.$modele->getLibelle().'"'); } $connection = $this->getEntityManager()->getConnection(); $params = ['contrat' => $contrat->getId()]; $mainData = $connection->fetchAssoc($modele->getRequete(), $params); $mainData = $connection->fetchAssoc('SELECT * FROM V_CONTRAT_MAIN WHERE CONTRAT_ID = :contrat', $params); if ($modele->getRequete()) { $mainDataPerso = $connection->fetchAssoc($modele->getRequete(), $params); foreach ($mainDataPerso as $key => $value) { if ($value) { $mainData[$key] = $value; } } } $data = [0 => $mainData]; Loading @@ -96,9 +108,19 @@ class ModeleContratService extends AbstractEntityService foreach ($blocs as $bname => $bquery) { $bdata = $connection->fetchAll($bquery, $params); $bkey = $bname . '@table:table-row'; $data[0][$bkey] = $bdata; } if (!isset($data[0]['serviceCode@table:table-row']) && !isset($data[0]['serviceComposante@table:table-row']) && !isset($data[0]['serviceLibelle@table:table-row']) && !isset($data[0]['serviceHeures@table:table-row']) ) { $data[0]['serviceCode@table:table-row'] = $connection->fetchAll('SELECT * FROM V_CONTRAT_SERVICES WHERE CONTRAT_ID = :contrat', $params); } $data[1] = $data[0]; if (isset($mainData['exemplaire1'])) { Loading Loading
code/test3.php +12 −3 Changes for code/test3.php: 12 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ * @var $sl \Zend\ServiceManager\ServiceLocatorInterface */ use Application\Service\ModeleContratService; use Unicaen\OpenDocument\Document; Loading @@ -14,6 +15,7 @@ $d = [ [ 'nom' => 'Lécluse', 'prenom' => 'Laurent', 'varFoot' => 'test footer ok!!!', 'sec1' => false, 'dpl_libelle@table:table-row' => [ Loading Loading @@ -51,9 +53,13 @@ $d = [ [ 'nom' => 'Fery', 'prenom' => 'Karin', 'varFoot' => 'test footer 2 bizarre!!!', 'sec1@text:section' => [ ['secvar' => 'Varsec1',], ['secvar' => 'Varsec2',] ['secvar' => 'Varsec2',], ['secvar' => 'Varsec3',], ['secvar' => 'Varsec4',], ['secvar' => 'Varsec5',], ], 'dpl_libelle@table:table-row' => [ [ Loading Loading @@ -91,7 +97,7 @@ poto', ///** @var ModeleContrat $contrat */ //$contrat = $sl->get(ModeleContratService::class)->get(3); $contrat = $sl->get(ModeleContratService::class)->get(13); $document = new Document(); $document->setTmpDir('/home/laurent/UnicaenCode'); Loading @@ -103,7 +109,10 @@ $p = $document->publish($d); $document->setPdfOutput(true); //$document->saveToFile('/home/laurent/UnicaenCode/odtExport.pdf'); xmlDump($document->getPublisher()->getOutContent()); //xmlDump($document->getPublisher()->getOutContent()); //xmlDump($document->getStyles()); //var_dump($document->getStylist()->getVariables()); $document->download('exp.pdf'); Loading
data/Mises à jour/07.0.sql +124 Changes for data/Mises à jour/07.0.sql: 124 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -342,3 +342,127 @@ FROM ( UNION ALL SELECT 'contrat' c, 'contrat-generation' p, 'Génération de contrat' l FROM dual ) t1; CREATE OR REPLACE VIEW V_CONTRAT_MAIN AS WITH hs AS ( SELECT contrat_id, sum(heures) "serviceTotal" FROM V_CONTRAT_SERVICES GROUP BY contrat_id ) SELECT ct.id contrat_id, ct."annee", ct."nom", ct."prenom", ct."civilite", ct."e", ct."dateNaissance", ct."adresse", ct."numInsee", ct."statut", ct."totalHETD", ct."tauxHoraireValeur", ct."tauxHoraireDate", ct."dateSignature", CASE WHEN ct.est_contrat=1 THEN 1 ELSE null END "contrat1", CASE WHEN ct.est_contrat=1 THEN null ELSE 1 END "avenant1", CASE WHEN ct.est_contrat=1 THEN '3' ELSE '2' END "n", to_char(SYSDATE, 'dd/mm/YYYY - hh24:mi:ss') "horodatage", 'Exemplaire à conserver' "exemplaire1", 'Exemplaire à retourner' || ct."exemplaire2" "exemplaire2", ct."serviceTotal", CASE ct.est_contrat WHEN 1 THEN -- contrat 'Contrat de travail ' ELSE 'Avenant au contrat de travail initial modifiant le volume horaire initial' || ' de recrutement en qualité ' END "titre", CASE WHEN ct.est_atv = 1 THEN 'd''agent temporaire vacataire' ELSE 'de chargé' || ct."e" || ' d''enseignement vacataire' END "qualite", CASE WHEN ct.est_projet = 1 AND ct.est_contrat = 1 THEN 'Projet de contrat' WHEN ct.est_projet = 0 AND ct.est_contrat = 1 THEN 'Contrat n°' || ct.id WHEN ct.est_projet = 1 AND ct.est_contrat = 0 THEN 'Projet d''avenant' WHEN ct.est_projet = 0 AND ct.est_contrat = 0 THEN 'Avenant n°' || ct.contrat_id || '.' || ct.numero_avenant END "titreCourt" FROM ( SELECT c.*, a.libelle "annee", COALESCE(d.nom_usuel,i.nom_usuel) "nom", COALESCE(d.prenom,i.prenom) "prenom", civ.libelle_court "civilite", CASE WHEN civ.sexe = 'F' THEN 'e' ELSE '' END "e", to_char(COALESCE(d.date_naissance,i.date_naissance), 'dd/mm/YYYY') "dateNaissance", COALESCE(d.adresse,ose_divers.formatted_adresse( ai.NO_VOIE, ai.NOM_VOIE, ai.BATIMENT, ai.MENTION_COMPLEMENTAIRE, ai.LOCALITE, ai.CODE_POSTAL, ai.VILLE, ai.PAYS_LIBELLE)) "adresse", COALESCE(d.numero_insee,i.numero_insee || ' ' || COALESCE(LPAD(i.numero_insee_cle,2,'0'),'')) "numInsee", si.libelle "statut", replace(ltrim(to_char(COALESCE(fr.total,0), '999999.00')),'.',',') "totalHETD", replace(ltrim(to_char(COALESCE(th.valeur,0), '999999.00')),'.',',') "tauxHoraireValeur", COALESCE(to_char(th.histo_creation, 'dd/mm/YYYY'), 'TAUX INTROUVABLE') "tauxHoraireDate", to_char(COALESCE(v.histo_creation, c.histo_creation), 'dd/mm/YYYY') "dateSignature", CASE WHEN s.aff_adresse_contrat = 1 THEN ' signé à l''adresse suivante :' || CHR(13) || CHR(10) || s.libelle_court || ' - ' || REPLACE(ose_divers.formatted_adresse( astr.NO_VOIE, astr.NOM_VOIE, null, null, astr.LOCALITE, astr.CODE_POSTAL, astr.VILLE, null), CHR(13), ' - ') ELSE '' END "exemplaire2", replace(ltrim(to_char(COALESCE(hs."serviceTotal",0), '999999.00')),'.',',') "serviceTotal", CASE WHEN c.contrat_id IS NULL THEN 1 ELSE 0 END est_contrat, CASE WHEN v.id IS NULL THEN 1 ELSE 0 END est_projet, si.tem_atv est_atv FROM contrat c JOIN type_contrat tc ON tc.id = c.type_contrat_id JOIN intervenant i ON i.id = c.intervenant_id JOIN annee a ON a.id = i.annee_id JOIN statut_intervenant si ON si.id = i.statut_id JOIN structure s ON s.id = c.structure_id LEFT JOIN adresse_structure astr ON astr.structure_id = s.id AND astr.principale = 1 AND astr.histo_destruction IS NULL LEFT JOIN dossier d ON d.intervenant_id = i.id AND d.histo_destruction IS NULL JOIN civilite civ ON civ.id = COALESCE(d.civilite_id,i.civilite_id) LEFT JOIN validation v ON v.id = c.validation_id AND v.histo_destruction IS NULL LEFT JOIN adresse_intervenant ai ON ai.intervenant_id = i.id AND ai.histo_destruction IS NULL JOIN type_volume_horaire tvh ON tvh.code = 'PREVU' JOIN etat_volume_horaire evh ON evh.code = 'valide' LEFT JOIN formule_resultat fr ON fr.intervenant_id = i.id AND fr.type_volume_horaire_id = tvh.id AND fr.etat_volume_horaire_id = evh.id LEFT JOIN taux_horaire_hetd th ON c.histo_creation BETWEEN th.histo_creation AND COALESCE(th.histo_destruction,SYSDATE) LEFT JOIN hs ON hs.contrat_id = c.id WHERE c.histo_destruction IS NULL ) ct ; CREATE OR REPLACE VIEW V_CONTRAT_SERVICES AS SELECT c.id contrat_id, str.libelle_court "serviceComposante", ep.code "serviceCode", ep.libelle "serviceLibelle", sum(vh.heures) heures, replace(ltrim(to_char(sum(vh.heures), '999999.00')),'.',',') "serviceHeures" FROM contrat c JOIN intervenant i ON i.id = c.intervenant_id JOIN type_volume_horaire tvh ON tvh.code = 'PREVU' JOIN service s ON s.intervenant_id = i.id AND s.histo_destruction IS NULL JOIN volume_horaire vh ON vh.service_id = s.id AND vh.histo_destruction IS NULL AND vh.type_volume_horaire_id = tvh.id JOIN validation_vol_horaire vvh ON vvh.volume_horaire_id = vh.id JOIN validation v ON v.id = vvh.validation_id AND v.histo_destruction IS NULL LEFT JOIN validation cv ON cv.id = c.validation_id AND cv.histo_destruction IS NULL LEFT JOIN element_pedagogique ep ON ep.id = s.element_pedagogique_id JOIN structure str ON str.id = COALESCE(ep.structure_id,i.structure_id) WHERE c.histo_destruction IS NULL AND (cv.id IS NULL OR vh.contrat_id = c.id) GROUP BY c.id, str.libelle_court, ep.code, ep.libelle ; No newline at end of file
module/Application/src/Application/Controller/ContratController.php +3 −3 Changes for module/Application/src/Application/Controller/ContratController.php: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -331,7 +331,7 @@ class ContratController extends AbstractController * @todo A Supprimer!!! * @deprecated */ public function exporterOLDAction() public function exporterOldAction() { $this->initFilters(); Loading Loading @@ -423,8 +423,8 @@ class ContratController extends AbstractController ); $exp->addBodyScript('application/contrat/contrat-pdf.phtml', true, $variables, 1); // $exp->export($fileName, Pdf::DESTINATION_BROWSER_FORCE_DL); // die(); // pour éviter de générer une erreur par la suite $exp->export($fileName, Pdf::DESTINATION_BROWSER_FORCE_DL); die(); // pour éviter de générer une erreur par la suite } Loading
module/Application/src/Application/Service/ModeleContratService.php +28 −6 Changes for module/Application/src/Application/Service/ModeleContratService.php: 28 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -67,7 +67,14 @@ class ModeleContratService extends AbstractEntityService $document = new Document(); $document->setTmpDir(getcwd() . '/data/cache/'); $document->loadFromData($modele->getFichier()); $fichier = $modele->getFichier(); if ($fichier) { $document->loadFromData($fichier); } else { $document->loadFromFile(getcwd() . '/data/modele_contrat.odt'); } if ($contrat->estUnProjet()) { $document->getStylist()->addFiligrane('PROJET'); } Loading @@ -81,14 +88,19 @@ class ModeleContratService extends AbstractEntityService private function generateData(ModeleContrat $modele, Contrat $contrat) { if (!$modele->getRequete()){ throw new \Exception('Impossible de générer le contrat: pas de requête pour le modèle "'.$modele->getLibelle().'"'); } $connection = $this->getEntityManager()->getConnection(); $params = ['contrat' => $contrat->getId()]; $mainData = $connection->fetchAssoc($modele->getRequete(), $params); $mainData = $connection->fetchAssoc('SELECT * FROM V_CONTRAT_MAIN WHERE CONTRAT_ID = :contrat', $params); if ($modele->getRequete()) { $mainDataPerso = $connection->fetchAssoc($modele->getRequete(), $params); foreach ($mainDataPerso as $key => $value) { if ($value) { $mainData[$key] = $value; } } } $data = [0 => $mainData]; Loading @@ -96,9 +108,19 @@ class ModeleContratService extends AbstractEntityService foreach ($blocs as $bname => $bquery) { $bdata = $connection->fetchAll($bquery, $params); $bkey = $bname . '@table:table-row'; $data[0][$bkey] = $bdata; } if (!isset($data[0]['serviceCode@table:table-row']) && !isset($data[0]['serviceComposante@table:table-row']) && !isset($data[0]['serviceLibelle@table:table-row']) && !isset($data[0]['serviceHeures@table:table-row']) ) { $data[0]['serviceCode@table:table-row'] = $connection->fetchAll('SELECT * FROM V_CONTRAT_SERVICES WHERE CONTRAT_ID = :contrat', $params); } $data[1] = $data[0]; if (isset($mainData['exemplaire1'])) { Loading