Skip to content

Commit

Permalink
DIS-48 When updating objects, make sure that read-only checkboxes do …
Browse files Browse the repository at this point in the history
…not change values.
  • Loading branch information
mdnoble73 committed Feb 11, 2025
1 parent ca02690 commit 4fa3967
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions code/web/release_notes/25.02.00.MD
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
- If a field is read-only, do not change the value to blank when updating an object. (*MDN*)
- When editing an object, properly display which fields are required and ensure the required attribute is set for the control. (DIS-293) (*MDN*)
- Add a new property type of dayMonth to allow selecting a date and month for a field. (DIS-291) (*MDN*)
- When updating objects, make sure that read-only checkboxes do not change values. (DIS-48) (*MDN*)

<div markdown="1" class="settings">

Expand Down
20 changes: 11 additions & 9 deletions code/web/sys/DataObjectUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,14 @@ static function processProperty(DataObject $object, $property, $fieldLocks) {
'email2',
'email_prefill',
'multiemail',
'barcode_prefill',
'phone_prefill',
'name_prefill',
'address_prefill',
'address2_prefill',
'city_prefill',
'state_prefill',
'zip_prefill'
'barcode_prefill',
'phone_prefill',
'name_prefill',
'address_prefill',
'address2_prefill',
'city_prefill',
'state_prefill',
'zip_prefill'
])) {
if (isset($_REQUEST[$propertyName])) {
if ($object instanceof UnsavedDataObject && $property['type'] == 'enum') {
Expand Down Expand Up @@ -289,7 +289,9 @@ static function processProperty(DataObject $object, $property, $fieldLocks) {
}

} elseif ($property['type'] == 'checkbox') {
$object->setProperty($propertyName, isset($_REQUEST[$propertyName]) && $_REQUEST[$propertyName] == 'on' ? 1 : 0, $property);
if (empty($property['readOnly'])) {
$object->setProperty($propertyName, isset($_REQUEST[$propertyName]) && $_REQUEST[$propertyName] == 'on' ? 1 : 0, $property);
}
} elseif ($property['type'] == 'webBuilderColor') {
$object->setProperty($propertyName, $_REQUEST[$propertyName], $property);
} elseif ($property['type'] == 'multiSelect') {
Expand Down

0 comments on commit 4fa3967

Please sign in to comment.