JAL : Amélioration SQL pour la liste des JALs

This commit is contained in:
Michael RICOIS 2015-12-15 10:26:49 +00:00
parent 1712967604
commit 907bbe5528

View File

@ -46,12 +46,13 @@ $requests = array(
'header' => array('id', 'nomJALedition', 'parution', 'parutionJours', 'aboDateDeb', 'aboDateFin', 'priorite'),
'columns' => array('id', 'nomJALedition', 'parution', 'parutionJours', 'aboDateDeb', 'aboDateFin', 'priorite'),
'sql' => "SELECT jal.id, jal.nomJALedition, jal.parution, jal.parutionJours, jalabo.aboDateDeb, jalabo.aboDateFin,
IF(jal.jalPrioritaire=1,'A',IF(jal.parution='Q','C','B')) AS priorite
FROM jo.tabJALed AS jal
JOIN ( SELECT abo.jalId, abo.aboDateDeb, abo.aboDateFin FROM jo.tabJALabo AS abo
GROUP BY abo.jalId ORDER BY abo.aboDateFin DESC
) AS jalabo ON jalabo.jalId = jal.id
WHERE jal.dateSuppr=0 ORDER BY jal.id",
IF(jal.jalPrioritaire=1,'A',IF(jal.parution='Q','C','B')) AS priorite
FROM jo.tabJALed AS jal
LEFT JOIN ( SELECT abo.jalId, abo.aboDateDeb, abo.aboDateFin FROM jo.tabJALabo AS abo
WHERE abo.aboDateDeb < NOW() AND abo.aboDateFin > NOW()
GROUP BY abo.jalId ORDER BY abo.aboDateFin DESC
) AS jalabo ON jalabo.jalId = jal.id
WHERE jal.dateSuppr=0 ORDER BY jal.id",
),
'REF_CodeFormeJuridique_' => array(
'header' => array('code', 'libelle', 'libelleCourt'),
@ -68,8 +69,8 @@ $requests = array(
'header' => array('triId', 'triCode', 'triType', 'triNom', 'triVille'),
'columns' => array('triId', 'triCode', 'triType', 'triNom', 'triVille'),
'sql' => "SELECT triId, triCode, triType, triNom, triVille
FROM jo.tribunaux
WHERE triType IN ('L', 'C', 'I', 'G', 'M');",
FROM jo.tribunaux
WHERE triType IN ('L', 'C', 'I', 'G', 'M');",
),
/*'REF_Evenements' => array(
'header' => array('triId', 'triCode', 'triType', 'triNom', 'triVille'),