protected function validateFieldIdProductClassField()
    {
        $field = 'field_id';

        if ($this->isExcluded($field) || $this->isError('product_class_id')) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('Fields');

        if (empty($value)) {
            $this->setErrorRequired($field, $label);
            return false;
        }

        $updating = $this->getUpdating();
        $product_class_id = $this->getSubmitted('product_class_id');

        if (!isset($product_class_id) && isset($updating['product_class_id'])) {
            $product_class_id = $updating['product_class_id'];
        }

        if (empty($product_class_id)) {
            $this->setErrorUnavailable($field, $this->translation->text('Unknown product class ID'));
        }

        $existing = $this->product_class_field->getList(array(
                'index' => 'field_id',
                'product_class_id' => $product_class_id)
        );

        $processed = array();

        foreach ((array) $value as $field_id) {

            if (empty($field_id) || !is_numeric($field_id)) {
                $this->setErrorInvalid($field, $label);
                return false;
            }

            if (in_array($field_id, $processed)) {
                $this->setErrorExists($field, $label);
                return false;
            }

            if (isset($existing[$field_id])) {
                $this->setErrorExists($field, $label);
                return false;
            }

            $data = $this->field->get($field_id);

            if (empty($data)) {
                $this->setErrorUnavailable($field, $label);
                return false;
            }

            $processed[] = $field_id;
        }

        return true;
    }
protected function validateFieldIdProductClassField()
    {
        $field = 'field_id';

        if ($this->isExcluded($field) || $this->isError('product_class_id')) {
            return null;
        }

        $value = $this->getSubmitted($field);

        if ($this->isUpdating() && !isset($value)) {
            $this->unsetSubmitted($field);
            return null;
        }

        $label = $this->translation->text('Fields');

        if (empty($value)) {
            $this->setErrorRequired($field, $label);
            return false;
        }

        $updating = $this->getUpdating();
        $product_class_id = $this->getSubmitted('product_class_id');

        if (!isset($product_class_id) && isset($updating['product_class_id'])) {
            $product_class_id = $updating['product_class_id'];
        }

        if (empty($product_class_id)) {
            $this->setErrorUnavailable($field, $this->translation->text('Unknown product class ID'));
        }

        $existing = $this->product_class_field->getList(array(
                'index' => 'field_id',
                'product_class_id' => $product_class_id)
        );

        $processed = array();

        foreach ((array) $value as $field_id) {

            if (empty($field_id) || !is_numeric($field_id)) {
                $this->setErrorInvalid($field, $label);
                return false;
            }

            if (in_array($field_id, $processed)) {
                $this->setErrorExists($field, $label);
                return false;
            }

            if (isset($existing[$field_id])) {
                $this->setErrorExists($field, $label);
                return false;
            }

            $data = $this->field->get($field_id);

            if (empty($data)) {
                $this->setErrorUnavailable($field, $label);
                return false;
            }

            $processed[] = $field_id;
        }

        return true;
    }
protected function validateFieldIdProductClassField ( ) { $ field = 'field_id' ; if ( $ this -> isExcluded ( $ field ) || $ this -> isError ( 'product_class_id' ) ) { return null ; } $ value = $ this -> getSubmitted ( $ field ) ; if ( $ this -> isUpdating ( ) && ! isset ( $ value ) ) { $ this -> unsetSubmitted ( $ field ) ; return null ; } $ label = $ this -> translation -> text ( 'Fields' ) ; if ( empty ( $ value ) ) { $ this -> setErrorRequired ( $ field , $ label ) ; return false ; } $ updating = $ this -> getUpdating ( ) ; $ product_class_id = $ this -> getSubmitted ( 'product_class_id' ) ; if ( ! isset ( $ product_class_id ) && isset ( $ updating [ 'product_class_id' ] ) ) { $ product_class_id = $ updating [ 'product_class_id' ] ; } if ( empty ( $ product_class_id ) ) { $ this -> setErrorUnavailable ( $ field , $ this -> translation -> text ( 'Unknown product class ID' ) ) ; } $ existing = $ this -> product_class_field -> getList ( array ( 'index' => 'field_id' , 'product_class_id' => $ product_class_id ) ) ; $ processed = array ( ) ; foreach ( ( array ) $ value as $ field_id ) { if ( empty ( $ field_id ) || ! is_numeric ( $ field_id ) ) { $ this -> setErrorInvalid ( $ field , $ label ) ; return false ; } if ( in_array ( $ field_id , $ processed ) ) { $ this -> setErrorExists ( $ field , $ label ) ; return false ; } if ( isset ( $ existing [ $ field_id ] ) ) { $ this -> setErrorExists ( $ field , $ label ) ; return false ; } $ data = $ this -> field -> get ( $ field_id ) ; if ( empty ( $ data ) ) { $ this -> setErrorUnavailable ( $ field , $ label ) ; return false ; } $ processed [ ] = $ field_id ; } return true ; }
Validates one or several field IDs
@return bool|null
Validates one or several field IDs