Addressbook: Fix creating CSV import definition field mapping step failed

Incorrect select options broke the "target field" column
This commit is contained in:
nathan 2024-12-12 10:56:05 -07:00
parent 4a1455d05e
commit a1b6222c4b
2 changed files with 13 additions and 8 deletions

View File

@ -41,17 +41,21 @@ class addressbook_wizard_import_contacts_csv extends importexport_wizard_basic_i
{
$s .= ' ♦';
}
$cat_list['cat-'.$cat['id']] = empty($cat['description']) ? $s : array(
$cat_list[] = array(
'value' => 'cat-' . $cat['id'],
'label' => $s,
'title' => $cat['description'],
'title' => $cat['description']
);
}
if(count($cat_list) > 0) {
$this->mapping_fields[lang('Categories')] = $cat_list;
$this->mapping_fields[] = array(
'label' => lang('Categories'),
'children' => $cat_list
);
}
foreach($bocontacts->customfields as $name => $data) {
$this->mapping_fields['#'.$name] = $data['label'];
$this->mapping_fields[] = ['value' => '#' . $name, 'label' => $data['label']];
}
unset($this->mapping_fields['jpegphoto']); // can't cvs import that

View File

@ -280,16 +280,17 @@ export const Et2WidgetWithSelectMixin = <T extends Constructor<LitElement>>(supe
<span>Override _optionTemplate(). ${option.value} => ${option.label}</span>`;
}
_groupTemplate(option) : TemplateResult
_groupTemplate(option : SelectOption) : TemplateResult
{
if(!Array.isArray(option.value))
if(!Array.isArray(option.value) && !Array.isArray(option.children) && !option.hasChildren)
{
return this._optionTemplate(option);
}
// option.value is deprecated, option.children is defined in SelectOption
const options = Array.isArray(option.value) ? <SelectOption[]>option.value : <SelectOption[]>option.children;
return html`
<small>${this.noLang ? option.label : this.egw().lang(option.label)}</small>
${option.value.map(this._optionTemplate.bind(this))}
${options.map(this._optionTemplate.bind(this))}
<sl-divider></sl-divider>
`;
}