Summary
Reject an explicitly submitted null value for instrument_type in notice updates.
Rationale
The current validation can allow a superadministrator to submit instrument_type: null. NoticeService::update treats that value as an instrument-type change and clears related Formalization.term_number values. This permits an unintended reset of generated term numbers.
Affected areas
app/Http/Requests/Notice/NoticeUpdateRequest.php
app/Services/NoticeService.php
Required changes
Keep the optional behavior when instrument_type is absent. When the request contains instrument_type, require a non-null value and validate it against InstrumentType. Ensure NoticeService::update receives only valid, non-null instrument types when the field is supplied.
Acceptance criteria
- A request without
instrument_type remains valid.
- A request with
instrument_type: null is rejected for every authorized role.
- A request with a valid
InstrumentType value remains valid for authorized users.
- A rejected null value does not clear any related
Formalization.term_number values.
Backlinks
Summary
Reject an explicitly submitted
nullvalue forinstrument_typein notice updates.Rationale
The current validation can allow a superadministrator to submit
instrument_type: null.NoticeService::updatetreats that value as an instrument-type change and clears relatedFormalization.term_numbervalues. This permits an unintended reset of generated term numbers.Affected areas
app/Http/Requests/Notice/NoticeUpdateRequest.phpapp/Services/NoticeService.phpRequired changes
Keep the optional behavior when
instrument_typeis absent. When the request containsinstrument_type, require a non-null value and validate it againstInstrumentType. EnsureNoticeService::updatereceives only valid, non-null instrument types when the field is supplied.Acceptance criteria
instrument_typeremains valid.instrument_type: nullis rejected for every authorized role.InstrumentTypevalue remains valid for authorized users.Formalization.term_numbervalues.Backlinks