src/Controller/PieceController.php line 33

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Affectation;
  4. use App\Entity\Payment;
  5. use App\Entity\Piece;
  6. use App\Entity\PieceLine;
  7. use App\Form\PieceLineSearchType;
  8. use App\Form\PieceSearchType;
  9. use App\Form\PieceType;
  10. use App\Repository\ConfigurationRepository;
  11. use App\Repository\PieceLineRepository;
  12. use App\Repository\PieceRepository;
  13. use App\Repository\ProductRepository;
  14. use Doctrine\Common\Collections\ArrayCollection;
  15. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  16. use Symfony\Component\HttpFoundation\Request;
  17. use Symfony\Component\HttpFoundation\Response;
  18. use Symfony\Component\Routing\Annotation\Route;
  19. use Knp\Component\Pager\PaginatorInterface;
  20. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
  21. use Spipu\Html2Pdf\Html2Pdf;
  22. /**
  23.  * @Route("/piece")
  24.  */
  25. class PieceController extends AbstractController
  26. {
  27.     /**
  28.      * @Route("/", name="piece_index", methods={"GET|POST"})
  29.      * @Security("is_granted('ROLE_USER')")
  30.      */
  31.     public function index(PieceRepository $pieceRepositoryProductRepository $productRepositoryRequest $requestPaginatorInterface $paginator): Response
  32.     {
  33.         $form $this->createForm(PieceSearchType::class,null,['responsable'=>$this->getUser()]);
  34.         $form->handleRequest($request);
  35.         if ($form->isSubmitted()) {
  36.             $url $this->buildSearchUrl($request->request->all());
  37.             if (!empty($url)) {
  38.                 return $this->redirectToRoute('piece_index'$url);
  39.             }
  40.         }
  41.         if($request->query->get('payment') == 'create'){
  42.             $pieces $pieceRepository->findAll();
  43.             $type Payment::TYPE_OLD;
  44.             $date = new \DateTime('now');
  45.             $em $this->getDoctrine()->getManager();
  46.             foreach ($pieces as $piece){
  47.                 if($piece->getPayer() and $piece->getAmountTTC() > 0){
  48.                     if(!is_null($piece->getModePaiement())){
  49.                         $type $piece->getModePaiement();
  50.                     }
  51.                     $payment = New Payment();
  52.                     $payment->setUser($piece->getUser());
  53.                     $payment->setDate($piece->getDate());
  54.                     $payment->setClient($piece->getClient());
  55.                     $payment->setAmount($piece->getAmountTTC());
  56.                     $payment->setType($type);
  57.                     $affectation = new Affectation();
  58.                     $affectation->setPayment($payment);
  59.                     $affectation->setAmount($piece->getAmountTTC());
  60.                     $affectation->setPiece($piece);
  61.                     $payment->addAffectation($affectation);
  62.                     $em->persist($payment);
  63.                     $em->flush();
  64.                 }
  65.                 $piece->setUpdatedAt($date);
  66.                 $em->flush();
  67.             }
  68.         }
  69.         $pieces $paginator->paginate(
  70.             $pieceRepository->MyFindAll($request->query->all(),$this->getUser()), /* query NOT result */
  71.             $request->query->getInt('page'1)/* page number */20/* limit per page */
  72.         );
  73.         $totaux $pieceRepository->getSumOperations($request->query->all(),$this->getUser());
  74.         return $this->render('piece/index.html.twig', [
  75.             'pieces' => $pieces,
  76.             'totaux' => $totaux,
  77.             'form' => $form->createView(),
  78.         ]);
  79.     }
  80.     /**
  81.      * @Route("/ligne-vente", name="ligne_vente_index", methods={"GET|POST"})
  82.      * @Security("is_granted('ROLE_SUPER_ADMIN')")
  83.      */
  84.     public function ligneVenteIndex(PieceLineRepository $pieceLineRepositoryRequest $requestPaginatorInterface $paginator): Response
  85.     {
  86.         $form $this->createForm(PieceLineSearchType::class,null,['responsable'=>$this->getUser()]);
  87.         $form->handleRequest($request);
  88.         if ($form->isSubmitted()) {
  89.             $url $this->buildSearchUrlPieceLine($request->request->all());
  90.             if (!empty($url)) {
  91.                 return $this->redirectToRoute('ligne_vente_index'$url);
  92.             }
  93.         }
  94.         $pieceLines $paginator->paginate(
  95.             $pieceLineRepository->MyFindAll($request->query->all()), /* query NOT result */
  96.             $request->query->getInt('page'1)/* page number */20/* limit per page */
  97.         );
  98.         $totaux $pieceLineRepository->getSumOperations($request->query->all());
  99.         return $this->render('piece/ligne_vente_index.html.twig', [
  100.             'pieceLines' => $pieceLines,
  101.             'totaux' => $totaux,
  102.             'form' => $form->createView(),
  103.         ]);
  104.     }
  105.     /**
  106.      * @Route("/new", name="piece_new", methods={"GET","POST"})
  107.      * @Security("is_granted('ROLE_USER')")
  108.      */
  109.     public function new(Request $requestConfigurationRepository $configurationRepositoryPieceRepository $pieceRepository): Response
  110.     {
  111.         $piece = new Piece();
  112.         $pieceLine = new PieceLine();
  113.         if (count($piece->getPieceLines()) === 0) {
  114.             $piece->addPieceLine($pieceLine);
  115.         }
  116.         $config $configurationRepository->find(1);
  117.         $array_tva $config->getTvaValues();
  118.         $products = new ArrayCollection();
  119.         $form $this->createForm(PieceType::class, $piece, ['config' => $array_tva,'responsable'=>$this->getUser(),'type'=>'add','products'=>$products]);
  120.         $form->handleRequest($request);
  121.         if ($form->isSubmitted() && $form->isValid()) {
  122.             $piece->setUser($this->getUser());
  123.             $entityManager $this->getDoctrine()->getManager();
  124.             $entityManager->persist($piece);
  125.             $entityManager->flush();
  126.             foreach ($piece->getPieceLines() as $piece_line) {
  127.                 $lot $piece_line->getLot();
  128.                 $lot->setStock($lot->getStock() - $piece_line->getQty());
  129.                 $entityManager->flush();
  130.             }
  131.             $data $request->request->all();
  132.             if($data['piece']['modePaiement'] != ''){
  133.                 $payment = new Payment();
  134.                 $payment->setClient($piece->getClient());
  135.                 $payment->setDate($piece->getDate());
  136.                 $payment->setAmount($piece->getAmountTTC());
  137.                 $payment->setType($data['piece']['modePaiement']);
  138.                 $affectation = new Affectation();
  139.                 $affectation->setPiece($piece);
  140.                 $affectation->setAmount($piece->getAmountTTC());
  141.                 $affectation->setPayment($payment);
  142.                 $payment->addAffectation($affectation);
  143.                 $entityManager->persist($payment);
  144.                 $entityManager->flush();
  145.             }
  146.             return $this->redirectToRoute('piece_show',['id'=>$piece->getId()]);
  147.         }
  148.         return $this->render('piece/new.html.twig', [
  149.             'piece' => $piece,
  150.             'numero' => $pieceRepository->getMaxNumeroPiece()['last_numero'] + 1,
  151.             'form' => $form->createView(),
  152.         ]);
  153.     }
  154.     /**
  155.      * @Route("/{id}/delete-confirmation", name="piece_delete_confirmation", methods={"GET"})
  156.      * @Security("is_granted('ROLE_SUPER_ADMIN')")
  157.      */
  158.     public function deleteConfirmation(Piece $piece): Response
  159.     {
  160.         return $this->render('piece/_delete_confirmation.html.twig', [
  161.             'piece' => $piece,
  162.         ]);
  163.     }
  164.     /**
  165.      * @Route("/delete-validation", name="piece_delete_validation", methods={"GET"})
  166.      * @Security("is_granted('ROLE_SUPER_ADMIN')")
  167.      */
  168.     public function deleteValidation(): Response
  169.     {
  170.         return $this->render('piece/_delete_validation.html.twig', [
  171.         ]);
  172.     }
  173.     /**
  174.      * @Route("/{id}/impression", name="piece_print", methods={"GET"})
  175.      * @Security("is_granted('ROLE_USER')")
  176.      */
  177.     public function imprimerPieceAction(Piece $pieceConfigurationRepository $configurationRepository)
  178.     {
  179.         if (
  180.             ($this->getUser()->isResponsable() && $piece->getClient()->getUser() != $this->getUser()) or
  181.             ($this->getUser()->isResponsable() && !$this->getUser()->canViewInvoice($piece))
  182.         ) {
  183.             $this->addFlash("danger""Accès interdit");
  184.             return $this->redirectToRoute('accueil_back');
  185.         }
  186.         $configuration $configurationRepository->find(1);
  187.         if ($configuration->getTvaActive()) {
  188.             $nb_article_page 15;
  189.         } else {
  190.             $nb_article_page 16;
  191.         }
  192.         $nb_ligne_piece count($piece->getPieceLines());
  193.         $nb_total_page ceil($nb_ligne_piece $nb_article_page);
  194.         $array_ligne_piece = [];
  195.         $compt 1;
  196.         $nb_page 1;
  197.         foreach ($piece->getPieceLines() as $ligne):
  198.             $array_ligne_piece[$nb_page][] = $ligne;
  199.             if ($compt $nb_article_page == 0) {
  200.                 $nb_page++;
  201.             }
  202.             $compt++;
  203.         endforeach;
  204.         if ($configuration->getTvaActive()) {
  205.             $html $this->renderView('piece/imprimer_piece_tva.html.twig', [
  206.                 'piece' => $piece,
  207.                 'array_ligne_piece' => $array_ligne_piece,
  208.                 'nb_total_page' => $nb_total_page,
  209.                 'num' => $piece->getNumero(),
  210.                 'config' => $configuration,
  211.                 'server' => 'https://' $_SERVER['HTTP_HOST'],
  212.             ]);
  213.         } else {
  214.             $html $this->renderView('piece/imprimer_piece.html.twig', [
  215.                 'piece' => $piece,
  216.                 'array_ligne_piece' => $array_ligne_piece,
  217.                 'nb_total_page' => $nb_total_page,
  218.                 'num' => $piece->getNumero(),
  219.                 'config' => $configuration,
  220.                 'server' => 'https://' $_SERVER['HTTP_HOST'],
  221.             ]);
  222.         }
  223.         $html2pdf = new Html2Pdf('P''A4''fr');
  224.         $html2pdf->writeHTML($html);
  225.         $html2pdf->Output();
  226.     }
  227.     /**
  228.      * @Route("/{id}", name="piece_show", methods={"GET"})
  229.      * @Security("is_granted('ROLE_USER')")
  230.      */
  231.     public function show(Piece $pieceConfigurationRepository $configurationRepository): Response
  232.     {
  233.         if (
  234.             ($this->getUser()->isResponsable() && $piece->getClient()->getUser() != $this->getUser()) or
  235.             ($this->getUser()->isResponsable() && !$this->getUser()->canViewInvoice($piece))
  236.         ) {
  237.             $this->addFlash("danger""Accès interdit");
  238.             return $this->redirectToRoute('accueil_back');
  239.         }
  240.         return $this->render('piece/show.html.twig', [
  241.             'piece' => $piece,
  242.             'config' => $configurationRepository->find(1),
  243.             'server' => 'https://' $_SERVER['HTTP_HOST'],
  244.             'modes' => array_flip(Payment::paymentTypeListWithoutGift())
  245.         ]);
  246.     }
  247.     /**
  248.      * @Route("/{id}/edit", name="piece_edit", methods={"GET","POST"})
  249.      * @Security("is_granted('ROLE_USER')")
  250.      */
  251.     public function edit(Request $requestPiece $piecePieceRepository $pieceRepositoryConfigurationRepository $configurationRepository): Response
  252.     {
  253.         if (
  254.             ($this->getUser()->isResponsable() && $this->getParameter('param_title') == 'IRON-APP') or
  255.             ($this->getUser()->isResponsable() && $piece->getClient()->getUser() != $this->getUser()) or
  256.             ($this->getUser()->isResponsable() && !$this->getUser()->canViewInvoice($piece))
  257.         ) {
  258.             $this->addFlash("danger""Accès interdit");
  259.             return $this->redirectToRoute('accueil_back');
  260.         }
  261.         $actuel_piece $pieceRepository->find($request->attributes->get('id'));
  262.         $array_actuel_ligne_piece = [];
  263.         foreach ($actuel_piece->getPieceLines() as $piece_line) {
  264.             $array_actuel_ligne_piece[$piece_line->getId()]['product'] = $piece_line->getProduct();
  265.             $array_actuel_ligne_piece[$piece_line->getId()]['lot'] = $piece_line->getLot();
  266.             $array_actuel_ligne_piece[$piece_line->getId()]['qte'] = $piece_line->getQty();
  267.         }
  268.         $config $configurationRepository->find(1);
  269.         $array_tva $config->getTvaValues();
  270.         $products = new ArrayCollection();
  271.         foreach($piece->getPieceLines() as $line){
  272.             if($products->contains($line->getProduct()) === false){
  273.                 $products->add($line->getProduct());
  274.             }
  275.         }
  276.         $form $this->createForm(PieceType::class, $piece, ['config' => $array_tva,'responsable'=>$this->getUser(),'type'=>'edit','products'=>$products]);
  277.         $form->handleRequest($request);
  278.         $array_edit_ligne_piece = [];
  279.         $array_new_ligne_piece = [];
  280.         if ($form->isSubmitted() && $form->isValid()) {
  281.             $piece->setUser($this->getUser());
  282.             $entityManager $this->getDoctrine()->getManager();
  283.             $comp 0;
  284.             foreach ($piece->getPieceLines() as $piece_line) {
  285.                 if ($piece_line->getId()) {
  286.                     $array_edit_ligne_piece[$piece_line->getId()]['product'] = $piece_line->getProduct();
  287.                     $array_edit_ligne_piece[$piece_line->getId()]['lot'] = $piece_line->getLot();
  288.                     $array_edit_ligne_piece[$piece_line->getId()]['qte'] = $piece_line->getQty();
  289.                 } else {
  290.                     $array_new_ligne_piece[$comp]['product'] = $piece_line->getProduct();
  291.                     $array_new_ligne_piece[$comp]['lot'] = $piece_line->getLot();
  292.                     $array_new_ligne_piece[$comp]['qte'] = $piece_line->getQty();
  293.                     $comp++;
  294.                 }
  295.             }
  296.             $entityManager->flush();
  297.             $array_delete_ligne_piece=[];
  298.             foreach ($array_actuel_ligne_piece as $id_ligne=>$piece_line) {
  299.                 if(!isset($array_edit_ligne_piece[$id_ligne])){
  300.                     $array_delete_ligne_piece[$id_ligne]=$array_actuel_ligne_piece[$id_ligne];
  301.                 }
  302.             }
  303.             //stock new article
  304.             foreach ($array_new_ligne_piece as $piece_line) {
  305.                 $product $piece_line['product'];
  306.                 $lot $piece_line['lot'];
  307.                 $lot->setStock($lot->getStock() - $piece_line['qte']);
  308.                 $entityManager->flush();
  309.             }
  310.             //stock edit article
  311.             foreach ($array_edit_ligne_piece as $id_ligne=>$piece_line) {
  312.                 $product_act $array_actuel_ligne_piece[$id_ligne]['product'];
  313.                 $lot_act $array_actuel_ligne_piece[$id_ligne]['lot'];
  314.                 $lot_act->setStock($lot_act->getStock() +  $array_actuel_ligne_piece[$id_ligne]['qte']);
  315.                 $entityManager->flush();
  316.                 $product_edit $piece_line['product'];
  317.                 $lot_edit $piece_line['lot'];
  318.                 $lot_edit->setStock($lot_edit->getStock() -  $piece_line['qte']);
  319.                 $entityManager->flush();
  320.             }
  321.             //stock delete article
  322.             foreach ($array_delete_ligne_piece as $piece_line) {
  323.                 $product $piece_line['product'];
  324.                 $lot $piece_line['lot'];
  325.                 $lot->setStock($lot->getStock() +  $piece_line['qte']);
  326.                 $entityManager->flush();
  327.             }
  328.             return $this->redirectToRoute('piece_show', ['id' => $piece->getId()]);
  329.         }
  330.         return $this->render('piece/edit.html.twig', [
  331.             'piece' => $piece,
  332.             'form' => $form->createView(),
  333.         ]);
  334.     }
  335.     /**
  336.      * @Route("/{id}/delete", name="piece_delete", methods={"DELETE"})
  337.      * @Security("is_granted('ROLE_SUPER_ADMIN')")
  338.      */
  339.     public function delete(Request $requestPiece $piece): Response
  340.     {
  341.         if ($this->isCsrfTokenValid('delete' $piece->getId(), $request->request->get('_token'))) {
  342.             $entityManager $this->getDoctrine()->getManager();
  343.             foreach ($piece->getPieceLines() as $piece_line) {
  344.                 $product $piece_line->getProduct();
  345.                 $product->setStock($product->getStock() + $piece_line->getQty());
  346.                 $entityManager->flush();
  347.             }
  348.             $entityManager->remove($piece);
  349.             $entityManager->flush();
  350.         }
  351.         return $this->redirectToRoute('piece_index');
  352.     }
  353.     private function buildSearchUrlPieceLine($data)
  354.     {$url = [];
  355.         foreach ($data as $k => $v) {
  356.             if (isset($data['piece_line_search']['code']) && !empty($data['piece_line_search']['code'])) {
  357.                 $url['code'] = $data['piece_line_search']['code'];
  358.             }
  359.             if (isset($data['piece_line_search']['product']) && !empty($data['piece_line_search']['product'])) {
  360.                 $url['product'] = $data['piece_line_search']['product'];
  361.             }
  362.             if (isset($data['piece_line_search']['dateDu']) && !empty($data['piece_line_search']['dateDu'])) {
  363.                 $url['dateDu'] = $data['piece_line_search']['dateDu'];
  364.             }
  365.             if (isset($data['piece_line_search']['dateAu']) && !empty($data['piece_line_search']['dateAu'])) {
  366.                 $url['dateAu'] = $data['piece_line_search']['dateAu'];
  367.             }
  368.             if (isset($data['piece_line_search']['priceHTMin']) && !empty($data['piece_line_search']['priceHTMin'])) {
  369.                 $url['priceHTMin'] = $data['piece_line_search']['priceHTMin'];
  370.             }
  371.             if (isset($data['piece_line_search']['priceHTMax']) && !empty($data['piece_line_search']['priceHTMax'])) {
  372.                 $url['priceHTMax'] = $data['piece_line_search']['priceHTMax'];
  373.             }
  374.             if (isset($data['piece_line_search']['totalHTMin']) && !empty($data['piece_line_search']['totalHTMin'])) {
  375.                 $url['totalHTMin'] = $data['piece_line_search']['totalHTMin'];
  376.             }
  377.             if (isset($data['piece_line_search']['totalHTMax']) && !empty($data['piece_line_search']['totalHTMax'])) {
  378.                 $url['totalHTMax'] = $data['piece_line_search']['totalHTMax'];
  379.             }
  380.             if (isset($data['piece_line_search']['rabaisMin']) && !empty($data['piece_line_search']['rabaisMin'])) {
  381.                 $url['rabaisMin'] = $data['piece_line_search']['rabaisMin'];
  382.             }
  383.             if (isset($data['piece_line_search']['rabaisMax']) && !empty($data['piece_line_search']['rabaisMax'])) {
  384.                 $url['rabaisMax'] = $data['piece_line_search']['rabaisMax'];
  385.             }
  386.             if (isset($data['piece_line_search']['amountRabaisMin']) && !empty($data['piece_line_search']['amountRabaisMin'])) {
  387.                 $url['amountRabaisMin'] = $data['piece_line_search']['amountRabaisMin'];
  388.             }
  389.             if (isset($data['piece_line_search']['amountRabaisMax']) && !empty($data['piece_line_search']['amountRabaisMax'])) {
  390.                 $url['amountRabaisMax'] = $data['piece_line_search']['amountRabaisMax'];
  391.             }
  392.             if (isset($data['piece_line_search']['priceBuyHTMin']) && !empty($data['piece_line_search']['priceBuyHTMin'])) {
  393.                 $url['priceBuyHTMin'] = $data['piece_line_search']['priceBuyHTMin'];
  394.             }
  395.             if (isset($data['piece_line_search']['priceBuyHTMax']) && !empty($data['piece_line_search']['priceBuyHTMax'])) {
  396.                 $url['priceBuyHTMax'] = $data['piece_line_search']['priceBuyHTMax'];
  397.             }
  398.             if (isset($data['piece_line_search']['margeMin']) && !empty($data['piece_line_search']['margeMin'])) {
  399.                 $url['margeMin'] = $data['piece_line_search']['margeMin'];
  400.             }
  401.             if (isset($data['piece_line_search']['margeMax']) && !empty($data['piece_line_search']['margeMax'])) {
  402.                 $url['margeMax'] = $data['piece_line_search']['margeMax'];
  403.             }
  404.             if (isset($data['piece_line_search']['modePaiement']) && $data['piece_line_search']['modePaiement'] != '') {
  405.                 $url['modePaiement'] = $data['piece_line_search']['modePaiement'];
  406.             }
  407.             if (isset($data['piece_line_search']['marque']) && $data['piece_line_search']['marque'] != '') {
  408.                 $url['marque'] = $data['piece_line_search']['marque'];
  409.             }
  410.             if (isset($data['piece_line_search']['client']) && !empty($data['piece_line_search']['client'])) {
  411.                 $url['client'] = $data['piece_line_search']['client'];
  412.             }
  413.         }
  414.         return $url;
  415.     }
  416.     private function buildSearchUrl($data)
  417.     {
  418.         $url = [];
  419.         foreach ($data as $k => $v) {
  420.             if (isset($data['piece_search']['user']) && !empty($data['piece_search']['user'])) {
  421.                 $url['user'] = $data['piece_search']['user'];
  422.             }
  423.             if (isset($data['piece_search']['client']) && !empty($data['piece_search']['client'])) {
  424.                 $url['client'] = $data['piece_search']['client'];
  425.             }
  426.             if (isset($data['piece_search']['code']) && !empty($data['piece_search']['code'])) {
  427.                 $url['code'] = $data['piece_search']['code'];
  428.             }
  429.             if (isset($data['piece_search']['amountHTMin']) && !empty($data['piece_search']['amountHTMin'])) {
  430.                 $url['amountHTMin'] = $data['piece_search']['amountHTMin'];
  431.             }
  432.             if (isset($data['piece_search']['amountHTMax']) && !empty($data['piece_search']['amountHTMax'])) {
  433.                 $url['amountHTMax'] = $data['piece_search']['amountHTMax'];
  434.             }
  435.             if (isset($data['piece_search']['amountTVAMin']) && !empty($data['piece_search']['amountTVAMin'])) {
  436.                 $url['amountTVAMin'] = $data['piece_search']['amountTVAMin'];
  437.             }
  438.             if (isset($data['piece_search']['amountTVAMax']) && !empty($data['piece_search']['amountTVAMax'])) {
  439.                 $url['amountTVAMax'] = $data['piece_search']['amountTVAMax'];
  440.             }
  441.             if (isset($data['piece_search']['amountDiscountMin']) && !empty($data['piece_search']['amountDiscountMin'])) {
  442.                 $url['amountDiscountMin'] = $data['piece_search']['amountDiscountMin'];
  443.             }
  444.             if (isset($data['piece_search']['amountDiscountMax']) && !empty($data['piece_search']['amountDiscountMax'])) {
  445.                 $url['amountDiscountMax'] = $data['piece_search']['amountDiscountMax'];
  446.             }
  447.             if (isset($data['piece_search']['discountMin']) && !empty($data['piece_search']['discountMin'])) {
  448.                 $url['discountMin'] = $data['piece_search']['discountMin'];
  449.             }
  450.             if (isset($data['piece_search']['discountMax']) && !empty($data['piece_search']['discountMax'])) {
  451.                 $url['discountMax'] = $data['piece_search']['discountMax'];
  452.             }
  453.             if (isset($data['piece_search']['amountTTCMin']) && !empty($data['piece_search']['amountTTCMin'])) {
  454.                 $url['amountTTCMin'] = $data['piece_search']['amountTTCMin'];
  455.             }
  456.             if (isset($data['piece_search']['amountTTCMax']) && !empty($data['piece_search']['amountTTCMax'])) {
  457.                 $url['amountTTCMax'] = $data['piece_search']['amountTTCMax'];
  458.             }
  459.             if (isset($data['piece_search']['dateDu']) && !empty($data['piece_search']['dateDu'])) {
  460.                 $url['dateDu'] = $data['piece_search']['dateDu'];
  461.             }
  462.             if (isset($data['piece_search']['dateAu']) && !empty($data['piece_search']['dateAu'])) {
  463.                 $url['dateAu'] = $data['piece_search']['dateAu'];
  464.             }
  465.             if (isset($data['piece_search']['soldeMin']) && $data['piece_search']['soldeMin'] != '') {
  466.                 $url['soldeMin'] = $data['piece_search']['soldeMin'];
  467.             }
  468.             if (isset($data['piece_search']['soldeMax']) && $data['piece_search']['soldeMax'] != '') {
  469.                 $url['soldeMax'] = $data['piece_search']['soldeMax'];
  470.             }
  471.             if (isset($data['piece_search']['modePaiement']) && $data['piece_search']['modePaiement'] != '') {
  472.                 $url['modePaiement'] = $data['piece_search']['modePaiement'];
  473.             }
  474.             if (isset($data['piece_search']['marque']) && $data['piece_search']['marque'] != '') {
  475.                 $url['marque'] = $data['piece_search']['marque'];
  476.             }
  477.             /*if (isset($data['piece_search']['payer']) && !empty($data['piece_search']['payer'])) {
  478.                 $url['payer'] = $data['piece_search']['payer'];
  479.             }
  480.             if (isset($data['piece_search']['modePaiement']) && !empty($data['piece_search']['modePaiement'])) {
  481.                 $url['modePaiement'] = $data['piece_search']['modePaiement'];
  482.             }*/
  483.         }
  484.         return $url;
  485.     }
  486. }