forked from extern/egroupware
Fix adding calendar participants did not give correct values due to missing type indicator
This commit is contained in:
parent
ac0867ab77
commit
4880a5ae74
@ -77,8 +77,7 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist
|
||||
// Add in group memberships as strings
|
||||
$info['resources'] = array_map(function($a) { return ''.$a;},$GLOBALS['egw']->accounts->members($owner, true));
|
||||
}
|
||||
|
||||
$option = array('value' => $owner, 'label' => $label, 'app' => lang($resource['app'])) + $info;
|
||||
$option = static::format_owner($owner, $label, $info);
|
||||
$sel_option_index = $this->get_index($sel_options, 'value', $owner);
|
||||
if($sel_option_index === false)
|
||||
{
|
||||
@ -283,7 +282,7 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist
|
||||
$type = $data['type'];
|
||||
|
||||
$value = array(
|
||||
'value' => $id,
|
||||
'value' => substr($id, 0, -1) == $type ? $id : $type . $id,
|
||||
'label' => $title,
|
||||
'app' => lang($data['app'])
|
||||
);
|
||||
|
@ -54,39 +54,42 @@ export class CalendarOwner extends Et2Select
|
||||
// If parent didn't find a label, label will be the same as ID so we
|
||||
// can find them that way
|
||||
let missing_labels = [];
|
||||
for(var i = 0; i < this.value.length; i++)
|
||||
this.updateComplete.then(() =>
|
||||
{
|
||||
if(!this.menuItems.find(o => o.value == this.value[i]))
|
||||
for(var i = 0; i < this.value.length; i++)
|
||||
{
|
||||
missing_labels.push(this.value[i]);
|
||||
}
|
||||
}
|
||||
if(Object.keys(missing_labels).length > 0)
|
||||
{
|
||||
// Proper label was not found by parent - ask directly
|
||||
this.egw().json('calendar_owner_etemplate_widget::ajax_owner', [missing_labels], function(data)
|
||||
{
|
||||
for(let owner in data)
|
||||
if(!this.menuItems.find(o => o.value == this.value[i]))
|
||||
{
|
||||
if(!owner || typeof owner == "undefined")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// Put it in the list of options
|
||||
let index = this.select_options.findIndex(o => o.value == owner);
|
||||
if(index !== -1)
|
||||
{
|
||||
this.select_options[index] = data[owner];
|
||||
}
|
||||
else
|
||||
{
|
||||
this.select_options.push(data[owner]);
|
||||
}
|
||||
missing_labels.push(this.value[i]);
|
||||
}
|
||||
this.requestUpdate("select_options");
|
||||
this.updateComplete.then(() => {this.syncItemsFromValue();});
|
||||
}, this, true, this).sendRequest();
|
||||
}
|
||||
}
|
||||
if(Object.keys(missing_labels).length > 0)
|
||||
{
|
||||
// Proper label was not found by parent - ask directly
|
||||
this.egw().json('calendar_owner_etemplate_widget::ajax_owner', [missing_labels], function(data)
|
||||
{
|
||||
for(let owner in data)
|
||||
{
|
||||
if(!owner || typeof owner == "undefined")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
// Put it in the list of options
|
||||
let index = this.select_options.findIndex(o => o.value == owner);
|
||||
if(index !== -1)
|
||||
{
|
||||
this.select_options[index] = data[owner];
|
||||
}
|
||||
else
|
||||
{
|
||||
this.select_options.push(data[owner]);
|
||||
}
|
||||
}
|
||||
this.requestUpdate("select_options");
|
||||
this.updateComplete.then(() => {this.syncItemsFromValue();});
|
||||
}, this, true, this).sendRequest();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2788,17 +2788,17 @@ export class CalendarApp extends EgwApp
|
||||
state.state.owner = jQuery.map(state.state.owner, function(owner) {return owner;});
|
||||
}
|
||||
}
|
||||
// Remove duplicates
|
||||
state.state.owner = state.state.owner.filter(function(value, index, self) {
|
||||
return self.indexOf(value) === index;
|
||||
});
|
||||
// Make sure they're all strings
|
||||
state.state.owner = state.state.owner.map(function(owner) { return ''+owner;});
|
||||
|
||||
if (state.state.owner.indexOf('0') >= 0)
|
||||
if(state.state.owner.indexOf('0') >= 0)
|
||||
{
|
||||
state.state.owner[state.state.owner.indexOf('0')] = this.egw.user('account_id');
|
||||
}
|
||||
// Remove duplicates
|
||||
state.state.owner = state.state.owner.filter(function(value, index, self)
|
||||
{
|
||||
return self.indexOf(value) === index;
|
||||
});
|
||||
// Make sure they're all strings
|
||||
state.state.owner = state.state.owner.map(function(owner) { return '' + owner;});
|
||||
|
||||
// Show the correct number of grids
|
||||
var grid_count = 0;
|
||||
|
@ -412,7 +412,8 @@ export class et2_calendar_planner extends et2_calendar_view implements et2_IDeta
|
||||
var resource = null;
|
||||
if(app.calendar && app.calendar.sidebox_et2 && app.calendar.sidebox_et2.getWidgetById('owner'))
|
||||
{
|
||||
options = app.calendar.sidebox_et2.getWidgetById('owner').select_options;
|
||||
const owner = app.calendar.sidebox_et2.getWidgetById('owner')
|
||||
options = [...owner.select_options, ...owner._selected_remote];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user