Skip to content

Commit

Permalink
fix(Tinebase): fix bugs in vMultiPicker with metadata for
Browse files Browse the repository at this point in the history
  • Loading branch information
sstamer committed Sep 27, 2024
1 parent 3a459ea commit ade71e0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tine20/Calendar/js/EventEditDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Tine.Calendar.EventEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
refIdField: 'record',
searchComboConfig: {useEditPlugin: false},
editDialogConfig: {mode: 'local'},
isMetadataModelFor: 'Calendar.EventType',
isMetadataModelFor: 'event_type',
requiredGrant: 'editGrant',
}]
}, {
Expand Down
2 changes: 1 addition & 1 deletion tine20/Tasks/js/TaskGridPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Tine.Tasks.TaskGridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
refIdField: 'task_id',
searchComboConfig: {useEditPlugin: false},
editDialogConfig: {mode: 'local'},
isMetadataModelFor: 'Tasks.Task'
isMetadataModelFor: 'task_id'
}
}, {
id: 'percent',
Expand Down
7 changes: 4 additions & 3 deletions tine20/Tinebase/js/widgets/form/VMultiPicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Tine.Tinebase.widgets.form.VMultiPicker = Ext.extend(Ext.BoxComponent, {
if (this.refIdField) {
const dataFields = _.difference(this.recordClass.getDataFields(), [this.refIdField]);

this.isMetadataModelFor = this.isMetadataModelFor || dataFields.length === 1 /* precisely this is a cross-record */ ? dataFields[0] : null;
this.isMetadataModelFor = this.isMetadataModelFor || (dataFields.length === 1 /* precisely this is a cross-record */ ? dataFields[0] : null);
this.metaDataFields = _.difference(dataFields, [this.isMetadataModelFor]);
this.mappingRecordClass = this.isMetadataModelFor ? this.recordClass.getField(this.isMetadataModelFor).getRecordClass() : null;
if (! this.recordRenderer) {
Expand Down Expand Up @@ -103,9 +103,10 @@ Tine.Tinebase.widgets.form.VMultiPicker = Ext.extend(Ext.BoxComponent, {
// if the current mode of pickerCombo is same as arg(listMode), there is no need to reinit the combo
// if (this.listMode === listMode ) return
this.pickerCombo?.destroy()
const recordClass = this.mappingRecordClass || this.recordClass;

const {allowMultiple, renderTo, filter, listeners, value, ... searchComboConfig} = this.initialConfig;
let {allowMultiple, renderTo, filter, listeners, value, recordClass, ... searchComboConfig} = this.initialConfig;
recordClass = this.mappingRecordClass || this.recordClass;

if(searchComboConfig.xtype === 'tinerecordspickercombobox'){
// prevent recursive recordsPicker
delete searchComboConfig.xtype;
Expand Down

0 comments on commit ade71e0

Please sign in to comment.