00001 <?php 00002 00003 00007 class oxCompanyVatInCountryChecker extends oxCompanyVatInChecker implements oxICountryAware 00008 { 00009 00013 const ERROR_ID_NOT_VALID = 'ID_NOT_VALID'; 00014 00020 private $_oCountry = null; 00021 00027 public function setCountry(oxCountry $oCountry) 00028 { 00029 $this->_oCountry = $oCountry; 00030 } 00031 00037 public function getCountry() 00038 { 00039 return $this->_oCountry; 00040 } 00041 00049 public function validate(oxCompanyVatIn $oVatIn) 00050 { 00051 $blResult = false; 00052 $oCountry = $this->getCountry(); 00053 if (!is_null($oCountry)) { 00054 $blResult = ($oCountry->getVATIdentificationNumberPrefix() === $oVatIn->getCountryCode()); 00055 if (!$blResult) { 00056 $this->setError(self::ERROR_ID_NOT_VALID); 00057 } 00058 } 00059 00060 return $blResult; 00061 } 00062 }