Commit 15f98407 authored by Johnny Leveneur's avatar Johnny Leveneur
Browse files

scan possible que le pendant la periode de l'évènement

parent 0e904cbe
Loading
Loading
Loading
Loading
+7 −2
Changes for module/Evenementiel/view/evenementiel/evenement/afficher.phtml: 7 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -27,6 +27,11 @@ $canAfficher = $this->isAllowed(EvenementPrivileges::getResourceId(EvenementPriv
$canGererEtat = (!$estAnnulee and $this->isAllowed(EvenementPrivileges::getResourceId(EvenementPrivileges::EVENEMENT_GERER_ETAT)));

$canModifierInscription = $this->isAllowed(EvenementielinscriptionPrivileges::getResourceId(EvenementielinscriptionPrivileges::MODIFIER));
$today = (new \DateTimeImmutable('today'))->format('Y-m-d');
$scanDisponible = $evenement->getJourDebut() !== null
    && $evenement->getJourFin() !== null
    && $today >= $evenement->getJourDebut()->format('Y-m-d')
    && $today <= $evenement->getJourFin()->format('Y-m-d');

?>

@@ -63,7 +68,7 @@ $canModifierInscription = $this->isAllowed(EvenementielinscriptionPrivileges::ge
        Inscription et listes
    </button>

    <?php if ($canModifierInscription): ?>
    <?php if ($canModifierInscription && $scanDisponible): ?>
        <button class="nav-link" id="scan-tab"
                data-bs-toggle="tab" data-bs-target="#scan"
                type="button" role="tab" aria-controls="scan" aria-selected="false">
@@ -102,7 +107,7 @@ $canModifierInscription = $this->isAllowed(EvenementielinscriptionPrivileges::ge
        <?php echo $this->partial('partial/inscription', ['evenement' => $evenement], [], null); ?>
    </div>

    <?php if ($canModifierInscription): ?>
    <?php if ($canModifierInscription && $scanDisponible): ?>
        <div id="scan" class="tab-pane "
             role="tabpanel" aria-labelledby="scan-tab" tabindex="0">
            <?php echo $this->partial('partial/scan', [
+12 −0
Changes for module/Qr/src/Controller/ScanController.php: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -89,6 +89,18 @@ class ScanController extends AbstractActionController
            ]);
        }

        $today = (new \DateTimeImmutable('today'))->format('Y-m-d');
        $jourDebut = $evenement->getJourDebut()?->format('Y-m-d');
        $jourFin = $evenement->getJourFin()?->format('Y-m-d');

        if ($jourDebut === null || $jourFin === null || $today < $jourDebut || $today > $jourFin) {
            return new JsonModel([
                'ok' => false
                , 'status' => 'err'
                , 'error' => "Le scan est uniquement autorisé le jour de l’événement."
            ]);
        }

        if(!$inscription->estNonHistorise())
        {
            // Inscription historisé