Commit 83dfefb2 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Liste des synchros : affichage de l'erreur de génération de la vue diff le cas échéant.

parent 69e3fef0
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ class SynchroController extends AbstractActionController
            $synchros = $this->synchroService->getSynchros();
        }

        $importLogs = $diffFounds = [];
        $importLogs = $diffFounds = $diffFoundsErrors = [];
        foreach ($synchros as $synchro) {
            $importLog = $this->importLogService->findLastLogForSynchro($synchro);
            $importLogs[$synchro->getName()] = $importLog;
@@ -49,11 +49,12 @@ class SynchroController extends AbstractActionController
                $diffFounds[$synchro->getName()] = $this->synchroService->fetchSynchroDiffFound($synchro);
            }
            catch (Exception $e) {
                $this->flashMessenger()->addErrorMessage(sprintf(
                    "Erreur rencontrée lors du calcul des différences pour la syncho %s : %s",
                    $synchro,
                    $e->getMessage()
                ));
                $error = "Erreur rencontrée lors du calcul des différences pour la syncho $synchro :";
                do {
                    $error .= ' ' . $e->getMessage();
                    $e = $e->getPrevious();
                } while ($e);
                $diffFoundsErrors[$synchro->getName()] = $error;
            }
        }

@@ -61,6 +62,7 @@ class SynchroController extends AbstractActionController
            'synchros' => $synchros,
            'importLogs' => $importLogs,
            'diffFounds' => $diffFounds,
            'diffFoundsErrors' => $diffFoundsErrors,
            'text' => $text,
        ];
    }
+19 −6
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
 * @var \UnicaenDbImport\Domain\Synchro[] $synchros
 * @var \UnicaenDbImport\Entity\Db\ImportLog[] $importLogs
 * @var int[] $diffFounds
 * @var string[] $diffFoundsErrors
 * @var string $text
 * @var \Application\View\Renderer\PhpRenderer $this
 *
@@ -65,6 +66,9 @@ $lancable = $this->isAllowed(SynchroPrivilege::getResourceId(SynchroPrivilege::L
            <th rowspan="2">
                <?php echo $this->translate("Diff"); ?> ?
            </th>
            <th rowspan="2">
                <?php echo $this->translate("Actions"); ?>
            </th>
        </tr>
        <tr>
            <th>
@@ -92,6 +96,7 @@ $lancable = $this->isAllowed(SynchroPrivilege::getResourceId(SynchroPrivilege::L
            $destination = $synchro->getDestination();
            $importLog = $importLogs[$synchro->getName()] ?? null;
            $diffFound = $diffFounds[$synchro->getName()] ?? 0;
            $diffFoundError = $diffFoundsErrors[$synchro->getName()] ?? null;
            ?>
            <tr class="synchro">
                <td>
@@ -134,6 +139,20 @@ $lancable = $this->isAllowed(SynchroPrivilege::getResourceId(SynchroPrivilege::L
                    <?php endif ?>
                </td>
                <td class="diff">
                    <?php if ($diffFoundError): ?>
                        <span class="icon icon-warning text-danger" title="<?php echo $diffFoundError ?>"></span>
                    <?php else: ?>
                        <?php if ($diffFound): ?>
                            <a href="<?php echo $this->url('unicaen-db-import/synchro/diff', ['name' => $synchro->getName()]) ?>"
                               title="Voir le différentiel">
                                Oui
                            </a>
                        <?php else: ?>
                            Non
                        <?php endif ?>
                    <?php endif ?>
                </td>
                <td class="action">
                    <?php if ($diffFound): ?>
                        <?php if ($lancable): ?>
                            <a class="btn btn-warning btn-sm"
@@ -144,12 +163,6 @@ $lancable = $this->isAllowed(SynchroPrivilege::getResourceId(SynchroPrivilege::L
                                   ['query' => ['redirect' => $this->url('unicaen-db-import/synchro/voir', ['name' => $synchro->getName()])]],
                               ) ?>"><span class="fas fa-play"></span></a>
                        <?php endif ?>
                        <a href="<?php echo $this->url('unicaen-db-import/synchro/diff', ['name' => $synchro->getName()]) ?>"
                           title="Voir le différentiel">
                            Oui
                        </a>
                    <?php else: ?>
                        Non
                    <?php endif ?>
                </td>
            </tr>