mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-24 23:58:54 +01:00
If timesheet list has a project filter selected and user adds a new timesheet, pre-set the project to the one selected in the list
This commit is contained in:
parent
6b3e9c38bb
commit
2032be4a63
@ -85,6 +85,8 @@ class timesheet_ui extends timesheet_bo
|
||||
'ts_owner' => $GLOBALS['egw_info']['user']['account_id'],
|
||||
'cat_id' => (int) $_REQUEST['cat_id'],
|
||||
'ts_status'=> $GLOBALS['egw_info']['user']['preferences']['timesheet']['predefined_status'],
|
||||
'ts_project' => $_REQUEST['ts_project'],
|
||||
'ts_title_blur' => $_REQUEST['ts_project'],
|
||||
);
|
||||
}
|
||||
$matches = null;
|
||||
@ -97,8 +99,11 @@ class timesheet_ui extends timesheet_bo
|
||||
$only_admin_edit = true;
|
||||
$msg = lang('only Admin can edit this status');
|
||||
}
|
||||
if(!$this->data['ts_project_blur'])
|
||||
{
|
||||
$this->data['ts_project_blur'] = $this->data['pm_id'] ? Link::title('projectmanager', $this->data['pm_id']) : '';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//echo "<p>ts_start=$content[ts_start], start_time=$content[start_time], end_time=$content[end_time], ts_duration=$content[ts_duration], ts_quantity=$content[ts_quantity]</p>\n";
|
||||
@ -976,8 +981,7 @@ class timesheet_ui extends timesheet_bo
|
||||
*/
|
||||
'add' => array(
|
||||
'caption' => 'Add',
|
||||
'url' => 'menuaction=timesheet.timesheet_ui.edit',
|
||||
'popup' => Link::get_registry('timesheet', 'add_popup'),
|
||||
'onExecute' => 'javaScript:app.timesheet.add_action_handler',
|
||||
'group' => $group,
|
||||
),
|
||||
'cat' => Etemplate\Widget\Nextmatch::category_action(
|
||||
|
@ -102,6 +102,60 @@ app.classes.timesheet = AppJS.extend(
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper so add action in the context menu can pass current
|
||||
* filter values into new edit dialog
|
||||
*
|
||||
* @see add_with_extras
|
||||
*
|
||||
* @param {egwAction} action
|
||||
* @param {egwActionObject[]} selected
|
||||
*/
|
||||
add_action_handler: function(action, selected)
|
||||
{
|
||||
var nm = action.getManager().data.nextmatch || false;
|
||||
if(nm)
|
||||
{
|
||||
this.add_with_extras(nm);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Opens a new edit dialog with some extra url parameters pulled from
|
||||
* nextmatch filters.
|
||||
*
|
||||
* @param {et2_widget} widget Originating/calling widget
|
||||
*/
|
||||
add_with_extras: function(widget)
|
||||
{
|
||||
var nm = widget.getRoot().getWidgetById('nm');
|
||||
var nm_value = nm.getValue() || {};
|
||||
|
||||
var extras = {};
|
||||
if(nm_value.cat_id)
|
||||
{
|
||||
extras.cat_id = nm_value.cat_id;
|
||||
}
|
||||
|
||||
if(nm_value.col_filter && nm_value.col_filter.linked)
|
||||
{
|
||||
var split = nm_value.col_filter.linked.split(':') || '';
|
||||
extras.link_app = split[0] || '';
|
||||
extras.link_id = split[1] || '';
|
||||
}
|
||||
if(nm_value.col_filter && nm_value.col_filter.pm_id)
|
||||
{
|
||||
extras.link_app = 'projectmanager';
|
||||
extras.link_id = nm_value.col_filter.pm_id;
|
||||
}
|
||||
else if (nm_value.col_filter && nm_value.col_filter.ts_project)
|
||||
{
|
||||
extras.ts_project = nm_value.col_filter.ts_project;
|
||||
}
|
||||
|
||||
egw.open('','timesheet','add',extras);
|
||||
},
|
||||
|
||||
/**
|
||||
* Change handler for project selection to set empty ts_project string, if project get deleted
|
||||
*
|
||||
|
@ -11,7 +11,7 @@
|
||||
</hbox>
|
||||
</template>
|
||||
<template id="timesheet.index.add" template="" lang="" group="0" version="1.7.001">
|
||||
<buttononly statustext="Add" id="add" onclick="egw.open('timesheet');"/>
|
||||
<buttononly statustext="Add" id="add" onclick="app.timesheet.add_with_extras(widget,'','$cont[action]','$cont[action_id]');"/>
|
||||
</template>
|
||||
<template id="timesheet.index.rows" template="" lang="" group="0" version="1.9.001">
|
||||
<grid width="100%">
|
||||
|
Loading…
Reference in New Issue
Block a user