# Bug OP-15235 - Adding a new required project attribute blocks other project-level modifications

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-15235

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions | 15.3.0 |
| Observed in versions | 14.1.0 |
| Sprint | 15.3.0 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 14.1.x |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable | Attila Dombi |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### Steps to reproduce

1.  As an administrator, add a new project attribute
    
    1.  Mark it as required

2.  Navigate to a project with an external file storage added and configured

3.  Go to *Project settings* → *Files* and navigate to the *Attachments* tab

4.  Try to disable the *Show attachments in the work packages files tab* option

### What is the buggy behavior?

  - When the new required field is added, the project goes into an "invalid" state and an error message is displayed to the user saying that the change in attachment settings cannot be saved because of this.
    
      - The error message will be implemented in: <mention class="mention" data-id="55789" data-type="work_package" data-text="###55789">###55789</mention>

### What is the expected behavior?

The error message is useful but it doesn't help the user since project admins may not necessary be able to change admin settings.

  - The addition of that new required field should *not* block other actions concerning project settings.

  - A "new" required project attribute should only throw an error when the user tries to edit and save the project attribute section containing this new attribute (left empty) in the *Project overview page.*
    
      - This front-end validation is already implemented.

### Technical details:

Currently custom field validations happen inside the `acts_as_customizable` plugin. This is not ideal, because it does not provide enough flexiblity for each implementing model apart.

A good example is the work package  [<mention class="mention" data-id="55789" data-type="work_package" data-text="#55789">#55789</mention>](https://community.openproject.org/work_packages/55789), where saving Project settings unrelated to custom fields will fail validation if the project has an unset required attribute.

The solution is to move the custom field validations away from the `acts_as_customizable` plugin to the *contract layer* of each implementing model (`Project, Group, User, Version, WorkPackage`).

### Environment information

**OpenProject 14.3.0**  
**Edge**

Core build: [2b354c9d11d94ae1efa3dd75d31de6269ae855a7](https://github.com/opf/openproject/commits/2b354c9d11d94ae1efa3dd75d31de6269ae855a7)  
Product version: [62bf97503d455f6ab4e5c09ee9e1b868ecc8d988](https://github.com/opf/saas-openproject/commits/62bf97503d455f6ab4e5c09ee9e1b868ecc8d988)

**Browser**

- [ ] Chrome
- [x] Firefox
- [ ] Safari
- [ ] Mobile Safari
- [ ] Other (please specify)

**Language**

EN/FR
