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

Fix : Erreur lors du rappel des déclarants lié à l'entityManager (patch temporaire)

parent 26eb063f
Loading
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -87,7 +87,13 @@ class OscarTimesheetRecallsCommand extends OscarAdvancedCommandAbstract

        foreach ($declarers as $declarer) {

            $result = $this->getTimesheetService()->recallProcess($declarer->getId(), $period->getPeriodCode(), $processDate, $force, $preview);
            try {
                $result = $this->getTimesheetService()->recallProcess(
                    $declarer->getId(), $period->getPeriodCode(), $processDate, $force, $preview);
            } catch (\Exception $e) {
                $this->getIO()->error($e->getMessage());
                continue;
            }
            if( $result['mailSend'] ){
                $snd = "<green>Mail envoyé</green>";
            } else {
+11 −1
Original line number Diff line number Diff line
@@ -3505,10 +3505,11 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat
            } else {
                if ($recallSend == null) {
                    $recallSend = new RecallDeclaration();
                    $this->getEntityManager()->persist($recallSend);
                    $recallSend->setStartProcess($processDate);
                    $this->getEntityManager()->persist($recallSend);
                }

                try {
                    $repport = $this->sendMailRecallDeclarer(
                        $declarer,
                        $periodInfos->getPeriodCode(),
@@ -3517,8 +3518,14 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat
                        $processDate,
                        $force
                    );

                    $result['mailSend'] = true;
                    $result = array_merge($result, $repport);
                } catch (\Exception $e) {
                    $this->getEntityManager()->detach($recallSend);
                    $result['recall_info'] = "Erreur d'envoi de mail : " . $e->getMessage();
                }

            }
        }

@@ -3578,6 +3585,9 @@ class TimesheetService implements UseOscarUserContextService, UseOscarConfigurat

            return $recallDeclaration->getRepport();
        } catch (\Exception $e) {
            var_dump($period);
            var_dump($periodInfos->getMonth());
            var_dump($periodInfos->getYear());
            throw new OscarException(
                "Un problème est survenu lors de la procédure de rappel pour $declarer pour la période $period : " . $e->getMessage(
                )