/**
  * Exclude object from result
  *
  * @param   ChildAddressSocolissimo $addressSocolissimo Object to remove from the list of results
  *
  * @return ChildAddressSocolissimoQuery The current query, for fluid interface
  */
 public function prune($addressSocolissimo = null)
 {
     if ($addressSocolissimo) {
         $this->addUsingAlias(AddressSocolissimoTableMap::ID, $addressSocolissimo->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
 public function isModuleSoColissimo(OrderEvent $event)
 {
     if ($this->check_module($event->getDeliveryModule())) {
         $request = $this->getRequest();
         $dom = $request->get('socolissimo-home');
         $rdv = $request->get('socolissimo-appointment');
         $pr_code = $request->get('socolissimo_code');
         $request->getSession()->set('SoColissimoDeliveryId', 0);
         $request->getSession()->set('SoColissimoDomicile', 0);
         $request->getSession()->set('SoColissimoRdv', 0);
         if ($dom) {
             $request->getSession()->set('SoColissimoDomicile', 1);
             $customer_name = AddressQuery::create()->findPk($event->getDeliveryAddress());
             $address = AddressSocolissimoQuery::create()->findPk($event->getDeliveryAddress());
             $request->getSession()->set('SoColissimoDeliveryId', $event->getDeliveryAddress());
             if ($address === null) {
                 $address = new AddressSocolissimo();
                 $address->setId($event->getDeliveryAddress());
             }
             // France Métropolitaine
             $address->setCode($pr_code)->setType("DOM")->setCompany($customer_name->getCompany())->setAddress1($customer_name->getAddress1())->setAddress2($customer_name->getAddress2())->setAddress3($customer_name->getAddress3())->setZipcode($customer_name->getZipcode())->setCity($customer_name->getCity())->setFirstname($customer_name->getFirstname())->setLastname($customer_name->getLastname())->setTitleId($customer_name->getTitleId())->setCountryId($customer_name->getCountryId())->setCellphone(null)->save();
         } elseif ($rdv) {
             $request->getSession()->set('SoColissimoRdv', 1);
             $customer_name = AddressQuery::create()->findPk($event->getDeliveryAddress());
             $address = AddressSocolissimoQuery::create()->findPk($event->getDeliveryAddress());
             $request->getSession()->set('SoColissimoDeliveryId', $event->getDeliveryAddress());
             if ($address === null) {
                 $address = new AddressSocolissimo();
                 $address->setId($event->getDeliveryAddress());
             }
             // France Métropolitaine
             $address->setCode($pr_code)->setType("RDV")->setCompany($customer_name->getCompany())->setAddress1($customer_name->getAddress1())->setAddress2($customer_name->getAddress2())->setAddress3($customer_name->getAddress3())->setZipcode($customer_name->getZipcode())->setCity($customer_name->getCity())->setFirstname($customer_name->getFirstname())->setLastname($customer_name->getLastname())->setTitleId($customer_name->getTitleId())->setCountryId($customer_name->getCountryId())->setCellphone($request->get('socolissimo-cellphone'))->save();
         } elseif (!empty($pr_code)) {
             $req = new FindById();
             $req->setId($pr_code)->setLangue("FR")->setDate(date("d/m/Y"))->setAccountNumber(ConfigQuery::read('socolissimo_login'))->setPassword(ConfigQuery::read('socolissimo_pwd'));
             $response = $req->exec();
             $customer_name = AddressQuery::create()->findPk($event->getDeliveryAddress());
             $address = AddressSocolissimoQuery::create()->findPk($event->getDeliveryAddress());
             $request->getSession()->set('SoColissimoDeliveryId', $event->getDeliveryAddress());
             if ($address === null) {
                 $address = new AddressSocolissimo();
                 $address->setId($event->getDeliveryAddress());
             }
             // France Métropolitaine
             $address->setCode($pr_code)->setType($response->typeDePoint)->setCompany($response->nom)->setAddress1($response->adresse1)->setAddress2($response->adresse2)->setAddress3($response->adresse3)->setZipcode($response->codePostal)->setCity($response->localite)->setFirstname($customer_name->getFirstname())->setLastname($customer_name->getLastname())->setTitleId($customer_name->getTitleId())->setCountryId($customer_name->getCountryId())->save();
         }
     }
 }