Loading module/Application/src/Controller/PieceJointeController.php +29 −22 Changes for module/Application/src/Controller/PieceJointeController.php: 29 added lines, 22 removed lines. Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ use Application\Form\PieceJointe\Traits\ModifierTypePieceJointeStatutFormAwareTr use Application\Service\Traits\IntervenantServiceAwareTrait; use Application\Service\Traits\PieceJointeServiceAwareTrait; use Intervenant\Entity\Db\Statut; use Intervenant\Form\MailerIntervenantFormAwareTrait; use Intervenant\Service\StatutServiceAwareTrait; use Application\Service\Traits\TypePieceJointeServiceAwareTrait; use Application\Service\Traits\TypePieceJointeStatutServiceAwareTrait; Loading @@ -23,6 +24,8 @@ use UnicaenApp\View\Model\MessengerViewModel; use Laminas\View\Model\ViewModel; use Laminas\View\Model\JsonModel; use Application\Service\Traits\ContextServiceAwareTrait; use Intervenant\Service\MailServiceAwareTrait; use Intervenant\Service\NoteServiceAwareTrait; /** Loading @@ -40,7 +43,9 @@ class PieceJointeController extends AbstractController use TypePieceJointeServiceAwareTrait; use TypePieceJointeStatutServiceAwareTrait; use WorkflowServiceAwareTrait; use MailServiceAwareTrait; use NoteServiceAwareTrait; use MailerIntervenantFormAwareTrait; /** * Initialisation des filtres Doctrine pour les historique. Loading Loading @@ -520,23 +525,7 @@ class PieceJointeController extends AbstractController public function refuserAction() { // $this->initFilters(); // // /** @var PieceJointe $pj */ // $pj = $this->getEvent()->getParam('pieceJointe'); // $this->getServicePieceJointe()->valider($pj); // $this->updateTableauxBord($pj->getIntervenant(), true); // // $viewModel = new ViewModel(); // $viewModel->setTemplate('application/piece-jointe/validation'); // $viewModel->setVariable('pj', $pj); // // return $viewModel; // // // return $viewModel; /** @var PieceJointe $pj */ $pj = $this->getEvent()->getParam('pieceJointe'); $intervenant = $this->getServiceContext()->getSelectedIdentityRole()->getIntervenant(); if ($intervenant && $pj->getIntervenant() != $intervenant) { Loading @@ -544,17 +533,35 @@ class PieceJointeController extends AbstractController throw new \Exception('Vous ne pouvez pas supprimer la pièce jointe d\'un autre intervenant'); } $pj = $this->getEvent()->getParam('pieceJointe'); $title = 'Rédiger un email à l\'intervenant pour le refus de pièce'; $form = $this->getFormMailerIntervenant()->setIntervenant($pj->getIntervenant())->initForm(); if ($this->getRequest()->isPost() && $this->getRequest()->getPost()->count() > 0) { try { $data = $this->getRequest()->getPost(); $from = $data['from']; $to = $data['to']; $subject = $data['subject']; $content = $data['content']; $this->getServiceMail()->envoyerMail($from, $to, $subject, $content); //Création d'une trace de l'envoi dans les notes de l'intervenant $this->getServiceNote()->createNoteFromEmail($pj->getIntervenant(), $subject, $content); $this->flashMessenger()->addSuccessMessage('Email envoyé à l\'intervenant'); foreach ($pj->getFichier() as $fichier) { $this->getServicePieceJointe()->supprimerFichier($fichier, $pj); } $this->updateTableauxBord($pj->getIntervenant()); } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); } } $viewModel = new ViewModel(); $viewModel->setTemplate('application/piece-jointe/validation'); $viewModel->setVariable('pj', $pj); return $viewModel; return compact('pj', 'title', 'form'); } } module/Application/view/application/piece-jointe/refuser.phtml 0 → 100644 +71 −0 Changes for module/Application/view/application/piece-jointe/refuser.phtml: 71 added lines, 0 removed lines. Original line number Diff line number Diff line <?php echo $this->messenger()->addCurrentMessagesFromFlashMessenger(); /** * @var $form \Intervenant\Form\MailerIntervenantForm */ echo $this->form()->openTag($form); echo $this->formControlGroup($form->get('from')); echo $this->formControlGroup($form->get('to')); echo $this->formControlGroup($form->get('subject')); echo $this->formControlGroup($form->get('content')); echo $this->formRow($form->get('submit')); echo $this->formElement($form->get('security')); echo $this->form()->closeTag(); ?> <script type="text/javascript"> $(function () { var selector = "textarea#<?= $form->get('content')->getAttribute('id') ?>"; var form = $("form#<?= $form->getAttribute('id') ?>"); installEditor(selector, form); // avant de POSTer form.submit(function (e) { if (!confirm(message)) { e.preventDefault(); e.stopPropagation(); } }); }); /** * Installation d'un éditeur WYSIWYG (vers HTML) : http://www.tinymce.com * NB: l'inclusion du script de TinyMCE est faite dans la vue "mère" (application/indicateur/result.phtml). * @param {string} selector * @param {object} form */ function installEditor(selector, form) { WidgetInitializer.includeJs(Url('vendor/tinymce-4.4.1/js/tinymce/tinymce.min.js')); tinymce.editors = []; tinymce.init({ selector: selector, language: 'fr_FR', width: '100%', height: 250, plugins: "link", statusbar: false, menubar: false, toolbar: "bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link | undo redo" }); // Prevent bootstrap dialog from blocking focusin $(document).on('focusin', function (e) { if ($(e.target).closest(".mce-window").length) { e.stopImmediatePropagation(); } }); // Indispensable pour que le contenu du textarea soit mis à jour avant de POSTer form.submit(function () { tinymce.triggerSave(); }); } </script> No newline at end of file module/Application/view/application/piece-jointe/validation.phtml +11 −3 Changes for module/Application/view/application/piece-jointe/validation.phtml: 11 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -22,17 +22,17 @@ $params = [ title="Valider la pièce justificative '<?= $pj->getType() ?>'" data-loading-text="Patientez..." > <?= $pj->getFichier()->count() ?> <i class="fas fa-thumbs-up"></i> Valider </a> <?php endif ?> <?php if (!$pj->getValidation() && $this->isAllowed(Privileges::getResourceId(Privileges::PIECE_JUSTIFICATIVE_REFUS_PIECE))): ?> <?php if ($pj->getFichier()->count() > 0 && !$pj->getValidation() && $this->isAllowed(Privileges::getResourceId(Privileges::PIECE_JUSTIFICATIVE_REFUS_PIECE))): ?> <a class="refuser-pj btn btn-danger" <a class="refuser-pj btn btn-danger ajax-modal" href="<?= $this->url('piece-jointe/intervenant/refuser', $params, [], true) ?>" title="Refuser la pièce justificative '<?= $pj->getType() ?>'" data-loading-text="Patientez..." data-event="pj-refus-event" > <i class="fas fa-trash-can"></i> Refuser </a> Loading @@ -48,3 +48,11 @@ $params = [ <i class="fas fa-thumbs-down"></i> Dévalider </a> <?php endif ?> <script type="text/javascript"> $(function () { $("body").on("pj-refus-event", function (event, data) { window.location.reload(); }); }); </script> No newline at end of file module/Intervenant/config/module.config.php +1 −0 Changes for module/Intervenant/config/module.config.php: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -176,6 +176,7 @@ return [ Service\NoteService::class => Service\NoteServiceFactory::class, Service\TypeNoteService::class => Service\TypeNoteServiceFactory::class, Assertion\NoteAssertion::class => \UnicaenAuth\Assertion\AssertionFactory::class, Service\MailService::class => Service\MailServiceFactory::class, Assertion\StatutAssertion::class => Assertion\StatutAssertionFactory::class, ], Loading module/Intervenant/src/Controller/NoteController.php +10 −26 Changes for module/Intervenant/src/Controller/NoteController.php: 10 added lines, 26 removed lines. Original line number Diff line number Diff line Loading @@ -9,12 +9,10 @@ use Intervenant\Assertion\NoteAssertion; use Intervenant\Entity\Db\Note; use Intervenant\Form\MailerIntervenantFormAwareTrait; use Intervenant\Form\NoteSaisieFormAwareTrait; use Intervenant\Service\MailServiceAwareTrait; use Intervenant\Service\NoteServiceAwareTrait; use Laminas\Mail\Message as MailMessage; use Laminas\Mime\Message; use Laminas\Mime\Mime; use Laminas\Mime\Part; use UnicaenApp\View\Model\MessengerViewModel; class NoteController extends AbstractController Loading @@ -22,6 +20,7 @@ class NoteController extends AbstractController use NoteServiceAwareTrait; use NoteSaisieFormAwareTrait; use MailerIntervenantFormAwareTrait; use MailServiceAwareTrait; public function indexAction() { Loading @@ -46,6 +45,7 @@ class NoteController extends AbstractController } public function saisirAction() { Loading Loading @@ -76,13 +76,14 @@ class NoteController extends AbstractController }); } else { $form->bind($note); } return compact('form', 'intervenant', 'title'); } public function voirAction() { $intervenant = $this->getEvent()->getParam('intervenant'); Loading @@ -91,10 +92,10 @@ class NoteController extends AbstractController return compact('intervenant', 'note', 'title'); } public function supprimerAction() { $intervenant = $this->getEvent()->getParam('intervenant'); Loading @@ -117,6 +118,8 @@ class NoteController extends AbstractController return new MessengerViewModel(compact('note')); } public function envoyerEmailAction() { $intervenant = $this->getEvent()->getParam('intervenant'); Loading @@ -131,33 +134,14 @@ class NoteController extends AbstractController $to = $data['to']; $subject = $data['subject']; $content = $data['content']; $body = new Message(); $text = new Part($content); $text->type = Mime::TYPE_HTML; $text->charset = 'utf-8'; $body->addPart($text); $message = new MailMessage(); $message->setEncoding('UTF-8') ->setFrom($from) ->setSubject($subject) ->addTo($to) ->setBody($body); //Envoi du mail $this->mail()->send($message); $this->getServiceMail()->envoyerMail($from, $to, $subject, $content); //Création d'une trace de l'envoi dans les notes de l'intervenant $this->getServiceNote()->createNoteFromEmail($intervenant, $subject, $content); $this->flashMessenger()->addSuccessMessage('Email envoyé à l\'intervenant'); } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); } } return compact('intervenant', 'form', 'title'); } } Loading Loading
module/Application/src/Controller/PieceJointeController.php +29 −22 Changes for module/Application/src/Controller/PieceJointeController.php: 29 added lines, 22 removed lines. Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ use Application\Form\PieceJointe\Traits\ModifierTypePieceJointeStatutFormAwareTr use Application\Service\Traits\IntervenantServiceAwareTrait; use Application\Service\Traits\PieceJointeServiceAwareTrait; use Intervenant\Entity\Db\Statut; use Intervenant\Form\MailerIntervenantFormAwareTrait; use Intervenant\Service\StatutServiceAwareTrait; use Application\Service\Traits\TypePieceJointeServiceAwareTrait; use Application\Service\Traits\TypePieceJointeStatutServiceAwareTrait; Loading @@ -23,6 +24,8 @@ use UnicaenApp\View\Model\MessengerViewModel; use Laminas\View\Model\ViewModel; use Laminas\View\Model\JsonModel; use Application\Service\Traits\ContextServiceAwareTrait; use Intervenant\Service\MailServiceAwareTrait; use Intervenant\Service\NoteServiceAwareTrait; /** Loading @@ -40,7 +43,9 @@ class PieceJointeController extends AbstractController use TypePieceJointeServiceAwareTrait; use TypePieceJointeStatutServiceAwareTrait; use WorkflowServiceAwareTrait; use MailServiceAwareTrait; use NoteServiceAwareTrait; use MailerIntervenantFormAwareTrait; /** * Initialisation des filtres Doctrine pour les historique. Loading Loading @@ -520,23 +525,7 @@ class PieceJointeController extends AbstractController public function refuserAction() { // $this->initFilters(); // // /** @var PieceJointe $pj */ // $pj = $this->getEvent()->getParam('pieceJointe'); // $this->getServicePieceJointe()->valider($pj); // $this->updateTableauxBord($pj->getIntervenant(), true); // // $viewModel = new ViewModel(); // $viewModel->setTemplate('application/piece-jointe/validation'); // $viewModel->setVariable('pj', $pj); // // return $viewModel; // // // return $viewModel; /** @var PieceJointe $pj */ $pj = $this->getEvent()->getParam('pieceJointe'); $intervenant = $this->getServiceContext()->getSelectedIdentityRole()->getIntervenant(); if ($intervenant && $pj->getIntervenant() != $intervenant) { Loading @@ -544,17 +533,35 @@ class PieceJointeController extends AbstractController throw new \Exception('Vous ne pouvez pas supprimer la pièce jointe d\'un autre intervenant'); } $pj = $this->getEvent()->getParam('pieceJointe'); $title = 'Rédiger un email à l\'intervenant pour le refus de pièce'; $form = $this->getFormMailerIntervenant()->setIntervenant($pj->getIntervenant())->initForm(); if ($this->getRequest()->isPost() && $this->getRequest()->getPost()->count() > 0) { try { $data = $this->getRequest()->getPost(); $from = $data['from']; $to = $data['to']; $subject = $data['subject']; $content = $data['content']; $this->getServiceMail()->envoyerMail($from, $to, $subject, $content); //Création d'une trace de l'envoi dans les notes de l'intervenant $this->getServiceNote()->createNoteFromEmail($pj->getIntervenant(), $subject, $content); $this->flashMessenger()->addSuccessMessage('Email envoyé à l\'intervenant'); foreach ($pj->getFichier() as $fichier) { $this->getServicePieceJointe()->supprimerFichier($fichier, $pj); } $this->updateTableauxBord($pj->getIntervenant()); } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); } } $viewModel = new ViewModel(); $viewModel->setTemplate('application/piece-jointe/validation'); $viewModel->setVariable('pj', $pj); return $viewModel; return compact('pj', 'title', 'form'); } }
module/Application/view/application/piece-jointe/refuser.phtml 0 → 100644 +71 −0 Changes for module/Application/view/application/piece-jointe/refuser.phtml: 71 added lines, 0 removed lines. Original line number Diff line number Diff line <?php echo $this->messenger()->addCurrentMessagesFromFlashMessenger(); /** * @var $form \Intervenant\Form\MailerIntervenantForm */ echo $this->form()->openTag($form); echo $this->formControlGroup($form->get('from')); echo $this->formControlGroup($form->get('to')); echo $this->formControlGroup($form->get('subject')); echo $this->formControlGroup($form->get('content')); echo $this->formRow($form->get('submit')); echo $this->formElement($form->get('security')); echo $this->form()->closeTag(); ?> <script type="text/javascript"> $(function () { var selector = "textarea#<?= $form->get('content')->getAttribute('id') ?>"; var form = $("form#<?= $form->getAttribute('id') ?>"); installEditor(selector, form); // avant de POSTer form.submit(function (e) { if (!confirm(message)) { e.preventDefault(); e.stopPropagation(); } }); }); /** * Installation d'un éditeur WYSIWYG (vers HTML) : http://www.tinymce.com * NB: l'inclusion du script de TinyMCE est faite dans la vue "mère" (application/indicateur/result.phtml). * @param {string} selector * @param {object} form */ function installEditor(selector, form) { WidgetInitializer.includeJs(Url('vendor/tinymce-4.4.1/js/tinymce/tinymce.min.js')); tinymce.editors = []; tinymce.init({ selector: selector, language: 'fr_FR', width: '100%', height: 250, plugins: "link", statusbar: false, menubar: false, toolbar: "bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link | undo redo" }); // Prevent bootstrap dialog from blocking focusin $(document).on('focusin', function (e) { if ($(e.target).closest(".mce-window").length) { e.stopImmediatePropagation(); } }); // Indispensable pour que le contenu du textarea soit mis à jour avant de POSTer form.submit(function () { tinymce.triggerSave(); }); } </script> No newline at end of file
module/Application/view/application/piece-jointe/validation.phtml +11 −3 Changes for module/Application/view/application/piece-jointe/validation.phtml: 11 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -22,17 +22,17 @@ $params = [ title="Valider la pièce justificative '<?= $pj->getType() ?>'" data-loading-text="Patientez..." > <?= $pj->getFichier()->count() ?> <i class="fas fa-thumbs-up"></i> Valider </a> <?php endif ?> <?php if (!$pj->getValidation() && $this->isAllowed(Privileges::getResourceId(Privileges::PIECE_JUSTIFICATIVE_REFUS_PIECE))): ?> <?php if ($pj->getFichier()->count() > 0 && !$pj->getValidation() && $this->isAllowed(Privileges::getResourceId(Privileges::PIECE_JUSTIFICATIVE_REFUS_PIECE))): ?> <a class="refuser-pj btn btn-danger" <a class="refuser-pj btn btn-danger ajax-modal" href="<?= $this->url('piece-jointe/intervenant/refuser', $params, [], true) ?>" title="Refuser la pièce justificative '<?= $pj->getType() ?>'" data-loading-text="Patientez..." data-event="pj-refus-event" > <i class="fas fa-trash-can"></i> Refuser </a> Loading @@ -48,3 +48,11 @@ $params = [ <i class="fas fa-thumbs-down"></i> Dévalider </a> <?php endif ?> <script type="text/javascript"> $(function () { $("body").on("pj-refus-event", function (event, data) { window.location.reload(); }); }); </script> No newline at end of file
module/Intervenant/config/module.config.php +1 −0 Changes for module/Intervenant/config/module.config.php: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -176,6 +176,7 @@ return [ Service\NoteService::class => Service\NoteServiceFactory::class, Service\TypeNoteService::class => Service\TypeNoteServiceFactory::class, Assertion\NoteAssertion::class => \UnicaenAuth\Assertion\AssertionFactory::class, Service\MailService::class => Service\MailServiceFactory::class, Assertion\StatutAssertion::class => Assertion\StatutAssertionFactory::class, ], Loading
module/Intervenant/src/Controller/NoteController.php +10 −26 Changes for module/Intervenant/src/Controller/NoteController.php: 10 added lines, 26 removed lines. Original line number Diff line number Diff line Loading @@ -9,12 +9,10 @@ use Intervenant\Assertion\NoteAssertion; use Intervenant\Entity\Db\Note; use Intervenant\Form\MailerIntervenantFormAwareTrait; use Intervenant\Form\NoteSaisieFormAwareTrait; use Intervenant\Service\MailServiceAwareTrait; use Intervenant\Service\NoteServiceAwareTrait; use Laminas\Mail\Message as MailMessage; use Laminas\Mime\Message; use Laminas\Mime\Mime; use Laminas\Mime\Part; use UnicaenApp\View\Model\MessengerViewModel; class NoteController extends AbstractController Loading @@ -22,6 +20,7 @@ class NoteController extends AbstractController use NoteServiceAwareTrait; use NoteSaisieFormAwareTrait; use MailerIntervenantFormAwareTrait; use MailServiceAwareTrait; public function indexAction() { Loading @@ -46,6 +45,7 @@ class NoteController extends AbstractController } public function saisirAction() { Loading Loading @@ -76,13 +76,14 @@ class NoteController extends AbstractController }); } else { $form->bind($note); } return compact('form', 'intervenant', 'title'); } public function voirAction() { $intervenant = $this->getEvent()->getParam('intervenant'); Loading @@ -91,10 +92,10 @@ class NoteController extends AbstractController return compact('intervenant', 'note', 'title'); } public function supprimerAction() { $intervenant = $this->getEvent()->getParam('intervenant'); Loading @@ -117,6 +118,8 @@ class NoteController extends AbstractController return new MessengerViewModel(compact('note')); } public function envoyerEmailAction() { $intervenant = $this->getEvent()->getParam('intervenant'); Loading @@ -131,33 +134,14 @@ class NoteController extends AbstractController $to = $data['to']; $subject = $data['subject']; $content = $data['content']; $body = new Message(); $text = new Part($content); $text->type = Mime::TYPE_HTML; $text->charset = 'utf-8'; $body->addPart($text); $message = new MailMessage(); $message->setEncoding('UTF-8') ->setFrom($from) ->setSubject($subject) ->addTo($to) ->setBody($body); //Envoi du mail $this->mail()->send($message); $this->getServiceMail()->envoyerMail($from, $to, $subject, $content); //Création d'une trace de l'envoi dans les notes de l'intervenant $this->getServiceNote()->createNoteFromEmail($intervenant, $subject, $content); $this->flashMessenger()->addSuccessMessage('Email envoyé à l\'intervenant'); } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); } } return compact('intervenant', 'form', 'title'); } } Loading