/**
  * @Route("/{id}/canceldonttreat", name="askquote_canceldonttreat")
  * @Secure(roles="ROLE_USER")
  */
 public function canceldonttreatAction(AskQuote $entity)
 {
     $entity->setDontTreat();
     $em = $this->getDoctrine()->getManager();
     $em->persist($entity);
     $em->flush();
     return $this->redirect($this->generateUrl('askquote_show', array('id' => $entity->getId())));
 }
Example #2
0
 /**
  * Creation depuis une demande de devis
  * @todo Create a builder
  * @deprecated
  */
 public static function createFromAskQuote(AskQuote $askquote)
 {
     $quote = new self();
     $quote->setCreation(new \DateTime());
     if (($door = $askquote->getDoor()) !== null) {
         $quote->setDoor($door);
         $quote->setDoorCp($door->toString());
         $quote->setVat($door->getSite()->getVat()->getRate());
     } else {
         $site = $askquote->getSite();
         $quote->setDoorCp($site->toString());
         $quote->setVat($site->getVat()->getRate());
     }
     $quote->setTrustee($trustee = $askquote->getTrustee());
     $quote->setTrusteeName($trustee->getName());
     $quote->setTrusteeAddress($trustee->getAddress() . '');
     $quote->setContact($askquote->getPerson());
     $quote->setContactCp($askquote->getPerson() . '');
     $quote->setAsk($askquote);
     return $quote;
 }
 /**
  * Crée une demande de devis
  * @Secure(roles="ROLE_USER")
  */
 public function toquoteAction(Intervention $entity)
 {
     $ask = new AskQuote();
     $ask->populateFromIntervention($entity);
     $em = $this->getDoctrine()->getManager();
     $em->persist($ask);
     $entity->setAskQuote($ask);
     $em->persist($entity);
     $em->flush();
     return $this->redirect($this->generateUrl('intervention_redirect', array('id' => $entity->getId(), 'act' => 'show')));
 }
 private function _line(AskQuote $entity)
 {
     $types = array('fixing' => 'Dépannage', 'maintenance' => 'Entretien', 'work' => 'Travaux');
     $datas[0] = $entity->getCreation()->format('d/m/Y');
     $datas[1] = $entity->getTrustee() . '';
     $datas[2] = '';
     $datas[3] = '';
     if ($entity->getDoor() !== null) {
         $datas[2] .= $entity->getDoor()->getType() . ' - ' . $entity->getDoor()->getLocation() . chr(10);
         $datas[3] .= $entity->getDoor()->getContract() == 'Hors contrat' ? 'HC' : $entity->getDoor()->getActualContract();
     }
     if ($entity->getSite() !== null) {
         $datas[2] .= $entity->getSite()->getAddress()->toString();
     }
     $datas[4] = 'Suite à ';
     $datas[4] .= $entity->getIntervention() !== null ? $types[$entity->getIntervention()->getType()] : 'demande';
     $datas[4] .= chr(10) . $entity->getAsk();
     $datas[5] = '';
     $this->row($datas, 5, 1, false);
 }