Fix adding calendar participants did not give correct values due to missing type indicator

This commit is contained in:
nathan 2022-07-22 13:24:38 -06:00
parent ac0867ab77
commit 4880a5ae74
4 changed files with 44 additions and 41 deletions

View File

@ -77,8 +77,7 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist
// Add in group memberships as strings // Add in group memberships as strings
$info['resources'] = array_map(function($a) { return ''.$a;},$GLOBALS['egw']->accounts->members($owner, true)); $info['resources'] = array_map(function($a) { return ''.$a;},$GLOBALS['egw']->accounts->members($owner, true));
} }
$option = static::format_owner($owner, $label, $info);
$option = array('value' => $owner, 'label' => $label, 'app' => lang($resource['app'])) + $info;
$sel_option_index = $this->get_index($sel_options, 'value', $owner); $sel_option_index = $this->get_index($sel_options, 'value', $owner);
if($sel_option_index === false) if($sel_option_index === false)
{ {
@ -283,7 +282,7 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist
$type = $data['type']; $type = $data['type'];
$value = array( $value = array(
'value' => $id, 'value' => substr($id, 0, -1) == $type ? $id : $type . $id,
'label' => $title, 'label' => $title,
'app' => lang($data['app']) 'app' => lang($data['app'])
); );

View File

@ -54,6 +54,8 @@ export class CalendarOwner extends Et2Select
// If parent didn't find a label, label will be the same as ID so we // If parent didn't find a label, label will be the same as ID so we
// can find them that way // can find them that way
let missing_labels = []; let missing_labels = [];
this.updateComplete.then(() =>
{
for(var i = 0; i < this.value.length; i++) for(var i = 0; i < this.value.length; i++)
{ {
if(!this.menuItems.find(o => o.value == this.value[i])) if(!this.menuItems.find(o => o.value == this.value[i]))
@ -87,6 +89,7 @@ export class CalendarOwner extends Et2Select
this.updateComplete.then(() => {this.syncItemsFromValue();}); this.updateComplete.then(() => {this.syncItemsFromValue();});
}, this, true, this).sendRequest(); }, this, true, this).sendRequest();
} }
});
} }
/** /**

View File

@ -2788,17 +2788,17 @@ export class CalendarApp extends EgwApp
state.state.owner = jQuery.map(state.state.owner, function(owner) {return owner;}); 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'); 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 // Show the correct number of grids
var grid_count = 0; var grid_count = 0;

View File

@ -412,7 +412,8 @@ export class et2_calendar_planner extends et2_calendar_view implements et2_IDeta
var resource = null; var resource = null;
if(app.calendar && app.calendar.sidebox_et2 && app.calendar.sidebox_et2.getWidgetById('owner')) 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 else
{ {