setPrimaryKey('virtuemart_userfield_id'); $this->setLoggable(); } /** * Validates the userfields record fields, and checks if the given value already exists. * If so, the primary key is set. * * @return boolean True if the table buffer is contains valid data, false otherwise. */ function check() { if (preg_match('/[^a-z0-9\._\-]/i', $this->fieldvalue) > 0) { vmError(vmText::_('COM_VIRTUEMART_TITLE_IN_FIELDVALUES_CONTAINS_INVALID_CHARACTERS')); return false; } if(empty($this->virtuemart_userfield_value_id)){ $this->loadTblKeyByPrimaryAnd('fieldvalue'); } return parent::check(); } /** * Reimplement delete() to get a list if value IDs based on the field id * @var Field id * @return boolean True on success */ function delete( $virtuemart_userfield_id=null , $where = 0 ){ $db = JFactory::getDBO(); $db->setQuery('DELETE from `#__virtuemart_userfield_values` WHERE `virtuemart_userfield_id` = ' . $virtuemart_userfield_id); if ($db->execute() === false) { vmError($db->getError()); return false; } return true; } } //No CLosing Tag