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