
Génération du controleur
use App\\Service\\EZDS_Query;
use App\\Service\\EZDS_Session;
use App\\Service\\EZDS_String;
use Doctrine\\ORM\\EntityManagerInterface;
use Symfony\\Bundle\\FrameworkBundle\\Controller\\AbstractController;
use Symfony\\Component\\HttpFoundation\\Request;
use Symfony\\Component\\HttpFoundation\\Response;
use Symfony\\Component\\Routing\\Annotation\\Route;
use Symfony\\Component\\DependencyInjection\\Container;
/**
* @Route("/button/template", name="button_template")
*/
public function button_template(
Request $request,
Container $container,
EntityManagerInterface $em,
EZDS_Session $ezds_session,
EZDS_Query $ezds_query
) {
// --- Get session from EzGED
$ezds_session->initFromEzGED();
// --- Est-ce que la personne connectée appartient au groupe demandé
/*if (!in_array("ez_groupe", $ezds_session->getUser()->getGroupsLib())) {
dd("Vous n'êtes pas autorisé à consulter ces données");
}*/
$parameters = json_decode(base64_decode($request->query->get('base64content')), true);
if (!isset($parameters["qryid"])) {
dd("Parameter qryid not set !");
}
// --- Init query Factures Fournisseur
$ezds_query->init($parameters["qryid"], true); // true = initialisation rapide
// --- Est-ce que le user a le droit de consulter la qry
if (!$ezds_session->getUser()->can_view_qry($ezds_query->getId())) {
dd("Vous n'êtes pas autorisé à consulter ces données");
}
if (isset($parameters["qryid"]) && isset($parameters["rsids"])) {
foreach ($parameters["rsids"] as $rsid) {
$data_with_docs = $ezds_query->findOneById($rsid, false); // false = with links
$data_with_docs = $ezds_query->getDataWithDocs([
"id" => $rsid,
"start" => 0,
"number" => 1,
"links" => false,
"ffqn" => $ezds_query->getInfos()["QRY_MAINFFQN_FIELD"],
]);
dd($data_with_docs);
//dump($data_from_bdd);
}
}
}