/** * Converts dotted quad to long integer for tb_ip. * * @param unknown $event * @return parent preValidate */ public function preValidate($event) { if (!is_numeric($this->tb_ip)) { $this->tb_ip = ip2long($this->tb_ip); } if (!$this->tb_dtim) { $this->tb_dtim = air2_date(); } return parent::preValidate($event); }
/** * Custom AIR2 validation before update/save * * @param Doctrine_Event $event */ public function preValidate($event) { parent::preValidate($event); // make sure we got a valid ref type if ($this->pa_ref_type && $this->pa_xid) { $rt = $this->pa_ref_type; if (!in_array($rt, array(self::$REF_TYPE_ORG, self::$REF_TYPE_INQ))) { throw new Exception("Invalid pa_ref_type specified!"); } } }
/** * Custom AIR2 validation before update/save * * @param Doctrine_Event $event */ public function preValidate($event) { parent::preValidate($event); }
/** * Custom AIR2 validation before update/save * * @param Doctrine_Event $event */ public function preValidate($event) { parent::preValidate($event); // make sure we got a valid ref type $types = array(self::$REF_TYPE_RESPONSE, self::$REF_TYPE_INQUIRY, self::$REF_TYPE_TANK, self::$REF_TYPE_ORG, self::$REF_TYPE_MAIL, self::$REF_TYPE_EMAIL); if ($this->sact_ref_type && $this->sact_xid) { if (!in_array($this->sact_ref_type, $types)) { throw new Exception("Invalid sact_ref_type specified!"); } } }
/** * Lowercase any email address * * @param Doctrine_Event $event */ public function preValidate($event) { $this->sem_email = strtolower($this->sem_email); parent::preValidate($event); }
/** * Setup new ProjectSavedSearch. * * NOTE: this is temporary, until we can explicitly set Projects in the * SavedSearch UI. * * @param Doctrine_Event $event */ public function preValidate($event) { parent::preValidate($event); // only create if there are no projects if (!$this->exists() && $this->Projects->count() == 0) { $u = Doctrine::getTable('User')->find($this->ssearch_cre_user); $prj_id = $u ? $u->find_default_prj_id() : null; if ($prj_id) { $pss = new ProjectSavedSearch(); $pss->pss_prj_id = $prj_id; $this->Projects[] = $pss; } } }
/** * Only one of certain types (e.g. email) allowed. * * @param Doctrine_Event $event */ public function preValidate($event) { parent::preValidate($event); // check if this type is unique and we already have one if (!$this->osid_id && in_array($this->osid_type, self::$UNIQUE_TYPES)) { $q = AIR2_Query::create()->from('OrgSysId os'); $q->addWhere('osid_type = ?', $this->osid_type); $q->addWhere('osid_org_id = ?', $this->osid_org_id); if ($this->exists()) { $q->addWhere('osid_id != ?', $this->osid_id); } if ($q->count() > 0) { throw new Exception("May only have one OrgSysId of type " . $this->osid_type); } } }
/** * Make sure we have a file * * @param unknown $event */ public function preValidate($event) { parent::preValidate($event); if (!$this->img_file_name) { throw new Exception('Image cannot be null!'); } }
/** * Strip out non-numeric characters * * @param Doctrine_Event $event */ public function preValidate($event) { $this['sph_number'] = preg_replace('/\\D/', '', $this['sph_number']); #Carper::carp($this['sph_number']); parent::preValidate($event); }