Commit e6b8094f authored by Mat's avatar Mat
Browse files

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

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