Commit e6b8094f authored by Mat's avatar Mat

vérifie le statut 'en cours' des offres affichées sur la page today

parent fb07ea87
......@@ -41,7 +41,7 @@ class DefaultController extends MasterController
*/
$lettre = $this->get('doctrine')->getManager()
->getRepository('PotageBundle:Lettre')
->findOneForSend(5);
->findOneForSend(7);
$header = array(
'id' => $lettre->getId(),
......
......@@ -113,6 +113,10 @@ class MembreController extends MasterController
$offre = $this->getDoctrine()->getManager()
->getRepository('PotageBundle:Offre')
->findOneByReference($offre_ref);
if ($offre === null) {
return $this->redirectToRoute('potage_today');
}
return $this->render('@Potage/Membre/today.html.twig', array(
'user' => $user,
......
......@@ -218,9 +218,8 @@ class LettreRepository extends \Doctrine\ORM\EntityRepository
$qb = $this->createQueryBuilder('l')
->select('l.id', 'l.subject', 'l.reference', 'l.startedAt', 'l.endedAt', 'l.status')
->innerJoin('l.groupe', 'g')
->innerJoin('l.offre', 'o')
->addSelect('o.id offre_id', 'o.reference offre_ref')
->addSelect('o.id offre_id', 'o.reference offre_ref', 'o.status offre_status')
->where('g.id = :id')
->andWhere('l.status = :status')
->setParameters(array(
......
......@@ -163,7 +163,11 @@ class OffreRepository extends \Doctrine\ORM\EntityRepository
{
$qb = $this->createQueryBuilder('o')
->where('o.reference = :reference')
->setParameter(':reference', $reference)
->andWhere('o.status = :status')
->setParameters(array(
':reference' => $reference,
':status' => "current"
))
;
return $qb->getQuery()->getOneOrNullResult();
......
......@@ -32,6 +32,7 @@
<ul>
{% if groupe.lettres %}
{% for lettre in groupe.lettres %}
{% if lettre.offre_status == 'current' %}
<li>
<a href="{{ path('potage_today_one', { 'offre_ref': lettre.offre_ref }) }}" >Offre {{ lettre.offre_ref }}</a><br>
Infolettre {{ lettre.reference }} → Période du {{ lettre.startedAt|date('d/m/Y') }} au {{ lettre.endedAt|date('d/m/Y') }}<br>
......@@ -39,6 +40,7 @@
{{ groupe.nom }}: {{ groupe.adresseDepot }}
</li>
{% endif %}
{% endfor %}
{% endif %}
</ul>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment