<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="" />
<meta name="author" content="Jérôme BRACONNIER [EzDATA Solutions]" />
<meta name="generator" content="Hugo 0.98.0" />
<title>{% block title %} EzGED EZDS {% endblock %}</title>
<link rel="icon" type="image/png" href="/ezds/resources/images/logo.png" />
<link
rel="stylesheet"
href="/ezds/font-awesome-4.7.0/css/font-awesome.min.css"
/>
<link href="/ezds/resources/main.css" rel="stylesheet" />
{% block stylesheets %}
{{
encore_entry_link_tags("app")
}}
{% endblock %} {% block javascripts %}
{{
encore_entry_script_tags("app")
}}
{% endblock %}
</head>
<body style="padding: 0.5em; font-size: 13px !important">
{% block body %} {% endblock %}
</body>
{% block ezds_javascripts %} {% endblock %}
</html>
// --- Récupération de la session de EzGED
$ezds_session->initFromEzGED();
dump($ezds_session->getUser()->getFname());
https://www.notion.so/Documentation-Form-Authentification-c1e0743e110a42bf80e38d7f5e61a75c?pvs=4
// --- Redirection sur le formulaire d'authentification si pas connecté
$requestStack->getSession()->set('auth_redirect_to_route', 'app_portail_accueil');
$retour = $ezds_auth->check();
if ( $retour ) {
return $this->redirect($retour);
}
<?php
namespace App\\Controller;
use App\\Entity\\EzContact;
use App\\Service\\EZDS_Authentification;
use App\\Service\\EZDS_Formation;
use App\\Service\\EZDS_Query;
use App\\Service\\EZDS_Session;
use App\\Service\\EZDS_String;
use App\\Service\\EZDS_User;
use Symfony\\Component\\HttpFoundation\\Request;
use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;
use Symfony\\Component\\DependencyInjection\\Container;
use Symfony\\Component\\Filesystem\\Filesystem;
use Symfony\\Component\\HttpClient\\HttpClient;
use Symfony\\Component\\HttpFoundation\\RequestStack;
use Symfony\\Component\\HttpFoundation\\Response;
use Symfony\\Component\\Routing\\Annotation\\Route;
use Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface;
class FormationController extends AbstractController
{
private $ezds_string;
public function __construct(EZDS_String $ezds_string)
{
$this->ezds_string = $ezds_string;
}
/**
* @Route("/formation/viewfilesfromrsid/{qrysyskey}/{rsid}", name="formation_viewfiles",
* methods={"GET", "HEAD"}, requirements={"rsid"=".+"})
*/
public function viewfilesfromrsid(
string $qrysyskey,
string $rsid,
EZDS_Query $ezds_query,
RequestStack $requestStack,
EZDS_Authentification $ezds_auth,
EZDS_Session $ezds_session,
EZDS_String $ezds_string){
// ---------------------------------------------------------- //
// Etape1 : Check authentification //
// ---------------------------------------------------------- //
$requestStack->getSession()->set('auth_redirect_to_route', 'app_formation');
$retour = $ezds_auth->check();
if ( $retour ) {
return $this->redirect($retour);
}
// ---------------------------------------------------------- //
// Etape2 : Init Qry //
// ---------------------------------------------------------- //
$ezds_query->init($qrysyskey);
// ---------------------------------------------------------- //
// Etape3 : Récupération des infos de la fiche sélectionéee //
// ---------------------------------------------------------- //
$ezds_query->initData([
"id" => $rsid,
"ffqn" => $ezds_query->getInfos()["QRY_MAINFFQN"],
"start" => 0,
"number" => 1,
"links" => true,
]);
// ---------------------------------------------------------- //
// Etape4 : Get docs //
// ---------------------------------------------------------- //
$ezds_query->initDocs();
foreach ($ezds_query->getDocs() as $doc) {
//echo $doc->getThumb();
//echo $doc->getLink();
//echo $doc->getLinkWithThumb();
}
// ---------------------------------------------------------- //
// Etape6 : Send to view //
// ---------------------------------------------------------- //
return $this->render('portail/preview.html.twig', [
"docs" => $ezds_query->getDocs(),
]);
}
/**
* @Route("/formation", name="app_formation")
* @Route("/formation/{qrysyskey}", name="app_formation2")
* @Route("/formation/{qrysyskey}/{filter_field}/{filter_op}/{filter_value}", name="app_formation3", requirements={"filter_value"=".+"})
*/
public function index(
Container $container,
EZDS_Query $ezds_query,
RequestStack $requestStack,
EZDS_Authentification $ezds_auth,
EZDS_Session $ezds_session,
EZDS_User $ezds_user,
Filesystem $fs,
Request $request,
$qrysyskey = null,
$filter_field = null,
$filter_value = null,
EZDS_Formation $ezds_formation): Response
{
// ---------------------------------------------------------- //
// Init //
// ---------------------------------------------------------- //
$data = [];
$all_filters = [];
// ---------------------------------------------------------- //
// Check authentification //
// ---------------------------------------------------------- //
$requestStack->getSession()->set('auth_redirect_to_route', 'app_formation');
$retour = $ezds_auth->check();
if ( $retour ) {
return $this->redirect($retour);
}
// ---------------------------------------------------------- //
// Get infos from user //
// ---------------------------------------------------------- //
$ezds_user->init($requestStack->getSession()->get('secusr_id'));
// ---------------------------------------------------------- //
// Get infos from queries for Navigation //
// ---------------------------------------------------------- //
$queries = [];
foreach ( $container->getParameter('custom.formation.queries') as $tmp_qrysyskey ){
$ezds_query->init($tmp_qrysyskey);
$queries[] = [
"id" => $ezds_query->getId(),
"syskey" => $tmp_qrysyskey,
"lib" => $ezds_query->getTitle(),
];
}
// ---------------------------------------------------------- //
// Gestion des filtres et des data //
// ---------------------------------------------------------- //
if ( !empty($qrysyskey)){
switch ($qrysyskey) {
case 'EZDS001_QRY_FACTURES':
// --- Init query selected
$ezds_query->init($qrysyskey);
// --- Gestion des filters
$ezds_query->setFiltre("ez_contact.EZ_CONTACT_LIB");
$all_filters = $ezds_query->getFilters(10); // On recupere uniquement les 10 premiers filtres
// --- Prise en compte du filtre sélectionné
if ( !empty($filter_field) && !empty($filter_value)){
//$ezds_query->addFilterSelected("ez_contact.EZ_CONTACT_LIB", "like", "Fournisseur 499");
$ezds_query->addFilterSelected($filter_field, "like", $filter_value);
}
// --- Get data
$ezds_query->initData([
"start" => 0,
"number" => 10,
"links" => false,
"ffqn" => "EZ_FACTURE_FOURNISSEUR_ID"]);
foreach ( $ezds_query->getData() as $row ){
$data[] = [
"rsid" => $row["EZ_FACTURE_FOURNISSEUR_ID"],
"fournisseur" => $row["EZ_CONTACT_LIB"],
"montantht" => $row["EZ_FACTURE_FOURNISSEUR_MONTANT_HT"],
"date" => $row["EZ_FACTURE_FOURNISSEUR_DATE_PIECE"],
];
}
break;
case 'EZDS002_QRY_BLS':
// --- Init query selected
$ezds_query->init($qrysyskey);
// --- Get data
$ezds_query->initData([
"start" => 0,
"number" => 10,
"links" => false,
"ffqn" => "EZDS002_QRY_BLS"]);
foreach ( $ezds_query->getData() as $row ){
$data[] = [
"rsid" => $row["EZ_BL_FOURNISSEUR_ID"],
"fournisseur" => $row["EZ_CONTACT_LIB"],
];
}
break;
default:
break;
}
}
return $this->render('formation/index.html.twig', [
'controller_name' => 'FormationController',
'ezds_user' => $ezds_user,
'queries' => $queries,
'filters' => $all_filters,
'data' => $data,
'qrysyskey' => $qrysyskey,
]);
}
}
{% extends 'formation/layout.html.twig' %}
{% block title %} Consultation des données {% endblock %}
{% block body %}
<main class="flex justify-center">
<section class="container p-8 bg-gray-300 rounded">
<div class="">
<h1 class="text-3xl font-bold">Consultation des données</h1>
<div class="mt-4">
<h2>Bonjour {{ ezds_user.fname }}</h2>
</div>
<div class="mt-4">
<h3 class="font-bold">Sélectionnez un classeur :</h3>
{% if queries is not empty %}
<ul>
{% for item in queries %}
<li>
<a
href="{{ path('app_formation2', { qrysyskey: item.syskey }) }}"
>{{ item.lib }}</a
>
</li>
{% endfor %}
</ul>
{% endif %}
</div>
</div>
{% if qrysyskey == 'EZDS001_QRY_FACTURES' %}
{% if filters is not empty %}
<div class="mt-4">
<h3 class="font-bold">Sélectionnez un fournisseur :</h3>
<ul>
{% for f in filters %}
<li><a
href="{{ path('app_formation3', { qrysyskey: qrysyskey, filter_field: f.field, filter_op: 'like', filter_value:f.value }) }}"
>{{ f.value }}</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
<div class="mt-4">
<h3 class="font-bold">Liste des factures fournisseur :</h3>
<table class="table">
<thead>
<tr>
<th scope="col">Fournisseur</th>
<th scope="col">Montant HT</th>
<th scope="col">Date</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
{% for e in data %}
<tr>
<td>{{ e.fournisseur }}</td>
<td>{{ e.montantht }}</td>
<td>{{ e.date }}</td>
<td><a href="{{ path('formation_viewfiles', {qrysyskey: qrysyskey, rsid: e.rsid}) }}" target="_blank">Voir le document</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %} {% if qrysyskey == 'EZDS002_QRY_BLS' %}
<div class="mt-4">
<h3 class="font-bold">Liste des bls fournisseur :</h3>
<table class="table">
<thead>
<tr>
<th scope="col">Fournisseur</th>
<th scope="col"></th>
</tr>
</thead>
<tbody></tbody>
{% for e in data %}
<tr>
<td>{{ e.fournisseur }}</td>
<td><a href="{{ path('formation_viewfiles', {qrysyskey: qrysyskey, rsid: e.rsid}) }}" target="_blank">Voir le document</a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</section>
</main>
{% endblock %}