public function isValid($data, $context = null) { if (empty($data)) { return true; } if ($data == -1) { return true; } if (!isset($context)) { $this->_error(self::INVALID_SIM); return false; } $sim = new SimModel($context); if (!$sim->getCustomer()) { $this->_error(self::INVALID_CUSTOMER); return false; } $simApns = $sim->getApns(); $custApns = $sim->getCustomer()->getApnList(); $apn = $simApns[$data - 1]; if (!$apn) { $this->_error(self::INVALID_APN_INDEX, $data); return false; } if (!$custApns[$apn]) { $this->_error(self::APN_IS_NOT_STATIC, $data); return false; } return true; }
public function isValid($data, $context = null, $removeNotPresentFields = false) { $sim = new SimModel($context); $org = $sim->getCustomer(); if (empty($org)) { $this->_messages = array(self::CUSTOMER_MISSING => $this->_messageTemplatesBilling[self::CUSTOMER_MISSING]); return false; } if (!$org->hasBillingAccountId($data)) { $this->_messages = array(self::BILLING_ACCOUNT_NOT_FOUND => $this->_messageTemplatesBilling[self::BILLING_ACCOUNT_NOT_FOUND]); return false; } return true; }
public function isValid($data, $context = null, $removeNotPresentFields = false) { if (!$context) { return true; } $sim = new SimModel($context); $apn = $sim->getStaticApn(); if (!$apn) { return true; } $vpn = $sim->getCustomer()->getVpnFromApn($apn); if (!$vpn || !$vpn->staticAddressing) { return true; } try { $this->setNetwork($vpn->network, $vpn->mask); } catch (\Exception $e) { $this->_error(self::INVALID_VALUE); return false; } return parent::isValid($data, $context, $removeNotPresentFields); }