Commit ee0a6967 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Procédure de rappel en cours

parent a4f442f0
Loading
Loading
Loading
Loading
Loading
+2 −1
Changes for module/Oscar/src/Oscar/Command/OscarTimesheetHighDelayCommand.php: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ class OscarTimesheetHighDelayCommand extends OscarAdvancedCommandAbstract
            $this->getIO()->title("Traitement pour " . $personDt['fullname']);
            if( $personDt['require_alert_declarer'] == true ){
                $this->getIO()->writeln("<green> > Envoi : Déclarant</green>");
                $result = $this->getTimesheetService()->recallHighDelayDeclarer($personDt['person_id']);
            } else {
                $this->getIO()->writeln("<info> - pas d'envoi pour le déclarant</info>");
            }
@@ -101,7 +102,7 @@ class OscarTimesheetHighDelayCommand extends OscarAdvancedCommandAbstract
                    $this->getIO()->error("Pas de validateur pour ce déclarant");
                }
            } else {
                $this->getIO()->writeln("pas d'envoi pour le déclarant");
                $this->getIO()->writeln("<info> - pas d'envoi pour le validateur</info>");
            }
        }

+4 −3
Changes for module/Oscar/src/Oscar/Controller/AdministrationController.php: 4 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -1414,6 +1414,7 @@ class AdministrationController extends AbstractOscarController implements UsePro
            'validatorsRelanceJour1' => $this->getOscarConfigurationService()->getvalidatorsRelanceJour1(),
            'validatorsRelance2' => $this->getOscarConfigurationService()->getValidatorsRelance2(),
            'validatorsRelanceJour2' => $this->getOscarConfigurationService()->getvalidatorsRelanceJour2(),
            'highdelayRelance' => $this->getOscarConfigurationService()->getHighDelayRelance(),
        ];

        switch ($method) {
@@ -1431,6 +1432,7 @@ class AdministrationController extends AbstractOscarController implements UsePro
                $validatorsRelanceJour2 = (int)$this->params()->fromPost('validatorsRelanceJour2');
                $declarersRelanceConflitMessage = $this->params()->fromPost('declarersRelanceConflitMessage');
                $declarersRelanceConflitJour = (int)$this->params()->fromPost('declarersRelanceConflitJour');
                $highdelayRelance = $this->params()->fromPost('highdelayRelance');

                $this->getOscarConfigurationService()->setDeclarersRelance1($declarersRelance1);
                $this->getOscarConfigurationService()->setDeclarersRelanceJour1($declarersRelanceJour1);
@@ -1440,10 +1442,9 @@ class AdministrationController extends AbstractOscarController implements UsePro
                $this->getOscarConfigurationService()->setValidatorsRelanceJour1($validatorsRelanceJour1);
                $this->getOscarConfigurationService()->setValidatorsRelance2($validatorsRelance2);
                $this->getOscarConfigurationService()->setValidatorsRelanceJour2($validatorsRelanceJour2);
                $this->getOscarConfigurationService()->setDeclarersRelanceConflitMessage(
                    $declarersRelanceConflitMessage
                );
                $this->getOscarConfigurationService()->setDeclarersRelanceConflitMessage($declarersRelanceConflitMessage);
                $this->getOscarConfigurationService()->setDeclarersRelanceConflitJour($declarersRelanceConflitJour);
                $this->getOscarConfigurationService()->setHighDelayRelance($highdelayRelance);

                return $this->redirect()->toRoute('administration/messages');
        }
+10 −0
Changes for module/Oscar/src/Oscar/Service/OscarConfigurationService.php: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -403,6 +403,16 @@ class OscarConfigurationService implements ServiceLocatorAwareInterface
        return $this->saveEditableConfKey('validatorsRelanceJour2', $value);
    }

    public function getHighDelayRelance()
    {
        return $this->getEditableConfKey('highdelayRelance', "");
    }

    public function setHighDelayRelance($value)
    {
        return $this->saveEditableConfKey('highdelayRelance', $value);
    }


    public function setTheme($theme)
    {
+28 −0
Changes for module/Oscar/src/Oscar/Service/TimesheetService.php: 28 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -3131,6 +3131,34 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat
        return $this->getEntityManager()->getRepository(RecallDeclaration::class);
    }

    public function recallHighDelayDeclarer( int $declarerId, ?\DateTime $processDate = null ) :void
    {
        if( $processDate == null ){
            $processDate = new \DateTime();
        }
        $declarer = $this->getPersonService()->getPersonById($declarerId, true);

        $messageTemplate = $this->getOscarConfigurationService()->getHighDelayRelance();
        $find = ["{PERSON}", "{PERIOD}"];
        $replace = ["$declarer"];
        $body = str_ireplace($find, $replace, $messageTemplate);

        $message = $this->getPersonService()->getMailingService()->newMessage(
            "Retard de feuille de temps à régulariser"
        );
        $message->setTo($declarer->getEmail());
        $message->setBody($body);

        try {
            $this->getPersonService()->getMailingService()->send($message);
            // Enregistrement du rappel

        } catch (\Exception $e) {
            throw new OscarException($e->getMessage());
        }

    }

    /**
     * Procédure de rappel des validateurs.
     *
+16 −0
Changes for module/Oscar/view/oscar/administration/messages.phtml: 16 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -55,6 +55,22 @@
            </div>
        </div>

        <div class="row">
            <div class="col-md-4">
                <h3><i class="icon-calendar"></i> Retards importants (message général)</h3>
                <p>
                    Jour entre chaque rappel
                    <input type="number" name="highdelayRelance" value="<?= $highdelayRelance ?>"/>
                </p>
                <textarea name="highdelayRelance" id="" cols="30" rows="10"
                          class="form-control"><?= $highdelayRelance ?></textarea>
            </div>

        </div>




        <button type="submit" class="btn btn-primary">
            Enregistrer
        </button>