Удаляет тип почтового события
@param $fields , обязательные параметры - id языка, тип события
@return bool
@throws \Sprint\Migration\Exceptions\HelperException
162071
public function deleteEventType($fields) {
        $this->checkRequiredKeys(__METHOD__, $fields, array('LID', 'EVENT_NAME'));

        $exists = $this->getEventType(array(
            'EVENT_NAME' => $fields['EVENT_NAME'],
            'LID' => $fields['LID']
        ));

        if (empty($exists)) {
            return false;
        }

        if (\CEventType::Delete(array("ID" => $exists['ID']))) {
            return true;
        }

        $this->throwException(__METHOD__, 'Could not delete event type %s:%s', $fields['EVENT_NAME'], $fields['LID']);
    }
706855
public function unlock_field($fields = '')
    {
        if ($fields)
        {
            $fdata = $this->_parse_field_names($fields, 'unlock_field');
            foreach ($fdata as $key => $fitem)
            {
                if (!isset($this->fields[$key]))
                {
                    $this->fields[$key] = $fitem;
                }
                if (isset($this->locked_fields[$key]))
                {
                    unset($this->locked_fields[$key]);
                }
            }
        }
    }
484049
public function fields($fields)
    {
        if (is_array($fields) || $fields === null) {
            $this->fields = $fields;
        } else {
            $this->fields = func_get_args();
        }
        return $this;
    }
267880
public function setFields($fields): self
    {
        if (!is_iterable($fields)) {
            throw new Exception(sprintf('%s() expects argument passed to be iterable, %s given', __METHOD__, gettype($fields)));
        }

        $this->fields = [];
        foreach ($fields as $field) {
            $this->addField(...$field);
        }

        return $this;
    }
151048
public function validate($fields = [])
    {
        if (empty($this->rules())) return true;
        foreach ($this->rules() as $rules) {
            if (is_array($rules[0])) {
                foreach ($rules[0] as $v){
                    if(!empty($fields) && !in_array($v,$fields)) continue;
                    $this->_validate($rules,$v);
                }
            } else {
                if(!empty($fields) && !in_array($rules[0],$fields)) continue;
                $this->_validate($rules,$rules[0]);
            }
        }
        $attributes = $this->attributes();
        if(!empty($this->_validateError) && !empty($attributes)){
            foreach ($this->_validateError as $k=> &$v){
                if(strpos($v,':attribute')!==false){
                    $v = isset($attributes[$k])? str_replace(':attribute',$attributes[$k],$v) : $v;
                }
            }
        }
        return empty($this->_validateError);
    }
603683
public function update($fields)
    {
        // Set fields
        $this->fields($fields);

        // Resolve fields
        $fields = $this->getUpdateFieldsString();

        // Define wheres
        $where = $this->getWhereString();

        // Build query
        $this->query = 'UPDATE ' . $this->table . ' SET ' . $fields . ' '. $where;

        // Prepare statement
        $this->statement = $this->pdo->prepare($this->query);

        // Bind fields values
        $this->bindFields();

        // Bind where values
        if (count($this->wheres)) {
            $this->bindWheres();
        }

        // Execute statement
        $result = $this->statement->execute();

        // Reset values
        $this->reset();

        // Return result
        return $result;
    }
659236
public function all($fields = null)
    {
        if (isset($fields)) {
            $this->db->select($fields);
        }

        $result = $this->db->from($this->collection)->get();

        if ($result->count() > 0) {
            $this->result = new DataObjects\Result($result, $this);

            return $this->result;
        }

        return false;
    }
1063743
public function blameable($fields = array('created', 'updated', 'deleted'), $nullable = false)
    {
        if (in_array('created', $fields)) {
            $this->createdBy($nullable);
        }

        if (in_array('updated', $fields)) {
            $this->updatedBy($nullable);
        }

        if (in_array('deleted', $fields)) {
            $this->deletedBy($nullable);
        }
    }
211801
public function removeField($field)
    {
        foreach ($this->fieldsets as $fieldset) {
            if ($fieldset->hasField($field)) {
                unset($fieldset[$field]);
            }
        }
        return $this;
    }
1275615
public function setFields(array $fields)
    {
        foreach ($fields as $key => $field) {
            $this->setField($key, $field);
        }

        return $this;
    }
531733
public function addFields($fields)
    {
        $fieldsArr = $this->parseFields($fields);
        !is_array($this->fields) ? $this->fields = [] : null;
        $this->fields = array_unique(ArrayLib::array_add($this->fields, $fieldsArr));
        return $this;
    }
1002272
public function setFields(array $fields)
    {
        $this->clearFields();

        foreach ($fields as $field) {
            $this->addField($field);
        }

        return $this;
    }
139622
public function delete() : bool {
        global $DB;
        $DB->delete_records('customfield_data', ['fieldid' => $this->get('id')]);
        return $this->field->delete();
    }
1332270
public function update(array $fields = []) {
        $query = new UpdateQuery($this->getTable());
        $query->fields(!empty($fields)? $fields : $this->getFields());
        $query->whereConditionGroup($this->getWhereConditionGroup());
        return $this->connection->exec($query);
    }
425009
public function setFields($fields)
    {
        $data = @unserialize($fields);
        if ($fields === 'b:0;' || $data !== false) {
            $this->fields = $fields;
        } else {
            $this->fields = serialize($fields);
        }

        return $this;
    }
308318
public function removeLockFields($fields)
    {
        $fields = explode(',', str_replace(' ', '', $fields));
        foreach ($fields as $field) {
            if (false !== ($fieldIndex = array_search($field, $this->lockedFields))) {
                unset($this->lockedFields[$fieldIndex]);
            }
        }

        return $this;
    }
866516
protected function fields(array $fields)
    {
        $result = array();
        foreach ($fields as $id => $field) {
            if (!isset($field['id'])) {
                $field['id'] = $id;
            }
            if (!isset($field['name'])) {
                $field['name'] = $id;
            }
            $result[$id] = $this->field($field);
        }
        return $result;
    }