Example #1
0
 /**
  * Hydrate the update form for this object, before passing it to the update template
  *
  * @param \Thelia\Model\Country $object
  */
 protected function hydrateObjectForm($object)
 {
     $data = array('id' => $object->getId(), 'locale' => $object->getLocale(), 'title' => $object->getTitle(), 'isocode' => $object->getIsocode(), 'isoalpha2' => $object->getIsoalpha2(), 'isoalpha3' => $object->getIsoalpha3());
     return new CountryModificationForm($this->getRequest(), 'form', $data);
 }
Example #2
0
 /**
  * Hydrate the update form for this object, before passing it to the update template
  *
  * @param \Thelia\Model\Country $object
  */
 protected function hydrateObjectForm($object)
 {
     $data = array('id' => $object->getId(), 'locale' => $object->getLocale(), 'visible' => $object->getVisible() ? true : false, 'title' => $object->getTitle(), 'chapo' => $object->getChapo(), 'description' => $object->getDescription(), 'postscriptum' => $object->getPostscriptum(), 'isocode' => $object->getIsocode(), 'isoalpha2' => $object->getIsoalpha2(), 'isoalpha3' => $object->getIsoalpha3(), 'has_states' => $object->getHasStates() ? true : false, 'need_zip_code' => $object->getNeedZipCode() ? true : false, 'zip_code_format' => $object->getZipCodeFormat());
     return $this->createForm(AdminForm::COUNTRY_MODIFICATION, 'form', $data);
 }
Example #3
0
 /**
  * This method is called by the Delivery  loop, to check if the current module has to be displayed to the customer.
  * Override it to implements your delivery rules/
  *
  * If you return true, the delivery method will de displayed to the customer
  * If you return false, the delivery method will not be displayed
  *
  * @param Country $country the country to deliver to.
  *
  * @return boolean
  */
 public function isValidDelivery(Country $country)
 {
     $isValid = true;
     // We just check the country and weight
     // the address could not be a valid address for TNT at this moment cp - city
     if ('FR' !== $country->getIsoalpha2()) {
         $isValid = false;
     }
     /** @var \Thelia\Model\Customer $customer */
     if (null != ($customer = $this->getRequest()->getSession()->getCustomerUser())) {
         //If INDIVIDUAL service exist, be sure that the customer has no company
         if (1 == TNTFrance::getConfigValue(TNTFranceConfigValue::USE_INDIVIDUAL, 0)) {
             if (null != $customer->getDefaultAddress()->getCompany() && $customer->getDefaultAddress()->getCompany() != "") {
                 $isValid = false;
             }
         }
         //If ENTERPRISE service exist, be sure that the customer has a company
         if (1 == TNTFrance::getConfigValue(TNTFranceConfigValue::USE_ENTERPRISE, 0)) {
             if (null == $customer->getDefaultAddress()->getCompany() && $customer->getDefaultAddress()->getCompany() == "") {
                 $isValid = false;
             }
         }
     }
     return $isValid;
 }
 /**
  * Hydrate the update form for this object, before passing it to the update template
  *
  * @param \Thelia\Model\Country $object
  */
 protected function hydrateObjectForm($object)
 {
     $data = array('id' => $object->getId(), 'locale' => $object->getLocale(), 'title' => $object->getTitle(), 'isocode' => $object->getIsocode(), 'isoalpha2' => $object->getIsoalpha2(), 'isoalpha3' => $object->getIsoalpha3());
     return $this->createForm(AdminForm::COUNTRY_MODIFICATION, 'form', $data);
 }