Fix grouped custom fields not saving deselected values #333
This commit is contained in:
parent
6e3b9d209c
commit
0a369e2475
3 changed files with 13 additions and 3 deletions
|
@ -469,6 +469,7 @@ module.exports.getRow = (fieldList, values, useDate, showAll, onlyExisting) => {
|
|||
case 'radio':
|
||||
case 'checkbox':
|
||||
{
|
||||
let hasSelectedOption = (field.options || []).some(subField => subField.column && valueList[subField.column]);
|
||||
let item = {
|
||||
id: field.id,
|
||||
type: field.type,
|
||||
|
@ -481,8 +482,15 @@ module.exports.getRow = (fieldList, values, useDate, showAll, onlyExisting) => {
|
|||
groupTemplate: field.groupTemplate,
|
||||
options: (field.options || []).map(subField => {
|
||||
if (onlyExisting && subField.column && !valueList.hasOwnProperty(subField.column)) {
|
||||
// ignore missing values
|
||||
return false;
|
||||
if (hasSelectedOption && field.type !== 'checkbox') {
|
||||
// Set all radio or dropdown options if a selection for the group is present
|
||||
} else if (field.type === 'checkbox' && values['originGroupG' + field.id] === 'webform') {
|
||||
// Set all checkbox options if origin is webform (subscribe, manage, or admin edit) #333
|
||||
// Atomic updates via API call or CSV import still possible
|
||||
} else {
|
||||
// ignore missing values
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return {
|
||||
type: subField.type,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue