Commit 97fbc34c authored by Johnny Leveneur's avatar Johnny Leveneur
Browse files

gestion envoi qrcode par mail

parent 81826a02
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -192,6 +192,7 @@ CREATE TABLE evenementiel_inscription
    participant_id          INTEGER REFERENCES evenementiel_participant (id) ON DELETE CASCADE,
    statut                  VARCHAR(50) DEFAULT 'inscrit', -- inscrit, annulé, en attente
    nombre_places_demandees integer,
    nombre_places_pointees integer,
    histo_createur_id       integer     default 0     not null
        constraint evenementiel_inscription_createur_fk
            references unicaen_utilisateur_user,
@@ -207,6 +208,10 @@ CREATE TABLE evenementiel_inscription
    UNIQUE (evenement_id, participant_id)
);

-- ajout du champ nombre_places_pointees
alter table evenementiel_inscription
    add column nombre_places_pointees integer default 0;

update evenementiel_inscription
set nombre_places_demandees = 1
where nombre_places_demandees is null;
+2 −1
Original line number Diff line number Diff line
@@ -32,7 +32,8 @@
        "unicaen/synchro": "^6",
        "unicaen/enquete": "^0",
        "unicaen/bddadmin": "^0",
        "laminas/laminas-crypt": "^4.0"
        "laminas/laminas-crypt": "^4.0",
        "endroid/qr-code": "^6.0"
    },
    "require-dev": {
        "laminas/laminas-developer-tools": ">=1.0"
+3 −1
Original line number Diff line number Diff line
@@ -11,6 +11,8 @@ use Application\Form\Auth\RegisterFormFactory;
use Application\Form\Auth\RegisterHydrator;
use Application\Form\Auth\RegisterHydratorFactory;
use Application\Service\Bdd\BddFactory;
use Application\Service\Qrcode\QrcodeService;
use Application\Service\Qrcode\QrcodeServiceFactory;
use Atelier\Provider\Privilege\InscriptionPrivileges;
use Doctrine\ORM\Mapping\Driver\XmlDriver;
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
@@ -208,6 +210,7 @@ return [
            Bdd::class => BddFactory::class,
            RegisterForm::class => RegisterFormFactory::class,
//            RegisterController::class => RegisterControllerFactory::class,
            QrcodeService::class => QrcodeServiceFactory::class,
        ],
    ],
    'form_elements' => [
@@ -226,7 +229,6 @@ return [
    ],
    'hydrators' => [
        'factories' => [
                RegisterHydrator::class => RegisterHydratorFactory::class,
              ],
    ],

+42 −0
Original line number Diff line number Diff line
<?php

namespace Application\Service\Qrcode;

use Endroid\QrCode\Builder\Builder;
use Endroid\QrCode\Encoding\Encoding;
use Endroid\QrCode\ErrorCorrectionLevel;
use Endroid\QrCode\Label\LabelAlignment;
use Endroid\QrCode\Label\Font\OpenSans;
use Endroid\QrCode\RoundBlockSizeMode;
use Endroid\QrCode\Writer\PngWriter;

class QrcodeService
{

    public function generateQrcodePng(string $data, int $size = 300): string
    {

        $builder = new Builder(
            writer: new PngWriter(),
            writerOptions: [],
            validateResult: false,
            // QrCode options
            data: $data,
            encoding: new Encoding('UTF-8'),
            errorCorrectionLevel: ErrorCorrectionLevel::High,
            size: $size,
            margin: 10,
            roundBlockSizeMode: RoundBlockSizeMode::Margin,
            // Label options
            labelText: 'Votre billet',
            labelFont: new OpenSans(20),
            labelAlignment: LabelAlignment::Center
        );

        $result = $builder->build();

        // creation de la balise image avec le data uri:
        return '<img src="' . $result->getDataUri() . '" alt="QR">';;
    }

}
 No newline at end of file
+20 −0
Original line number Diff line number Diff line
<?php

namespace Application\Service\Qrcode;

trait QrcodeServiceAwareTrait
{
    private QrcodeService $qrcodeService;

    public function getQrcodeService(): QrcodeService
    {
        return $this->qrcodeService;
    }

    public function setQrcodeService(QrcodeService $qrcodeService): void
    {
        $this->qrcodeService = $qrcodeService;
    }


}
 No newline at end of file
Loading