Prevent vfs select dialog destroying session becuase of not being able to find the right app name (eg. admin mail account where app is different than current app)

This commit is contained in:
Hadi Nategh 2021-05-05 16:51:09 +02:00
parent be96f11d8b
commit 30fdc92ace
2 changed files with 10 additions and 6 deletions

View File

@ -1101,13 +1101,15 @@ var et2_vfsSelect = /** @class */ (function (_super) {
// Try to fetch et2 from its template name.
var etemplate = jQuery('form').data('etemplate');
var et2;
if (etemplate && etemplate.name && !app[egw(window).app_name()]) {
var currentApp = egw(window).app_name();
if (etemplate && etemplate.name && !app[currentApp]) {
et2 = etemplate2.getByTemplate(etemplate.name)[0];
currentApp = et2.name.split('.')[0];
}
else {
et2 = etemplate2.getByApplication(egw(window).app_name())[0];
et2 = etemplate2.getByApplication(currentApp)[0];
}
var data = jQuery.extend(_data, { 'currentapp': egw(window).app_name(), etemplate_exec_id: et2.etemplate_exec_id });
var data = jQuery.extend(_data, { 'currentapp': currentApp, etemplate_exec_id: et2.etemplate_exec_id });
// define a mini app object for vfs select UI
app.vfsSelectUI = new app.classes.vfsSelectUI;
// callback for dialog

View File

@ -1340,16 +1340,18 @@ export class et2_vfsSelect extends et2_inputWidget
// Try to fetch et2 from its template name.
let etemplate = jQuery('form').data('etemplate');
let et2;
if (etemplate && etemplate.name && !app[egw(window).app_name()])
let currentApp = egw(window).app_name();
if (etemplate && etemplate.name && !app[currentApp])
{
et2 = etemplate2.getByTemplate(etemplate.name)[0];
currentApp = et2.name.split('.')[0];
}
else
{
et2 = etemplate2.getByApplication(egw(window).app_name())[0];
et2 = etemplate2.getByApplication(currentApp)[0];
}
let data = jQuery.extend(_data, {'currentapp': egw(window).app_name(), etemplate_exec_id: et2.etemplate_exec_id});
let data = jQuery.extend(_data, {'currentapp': currentApp, etemplate_exec_id: et2.etemplate_exec_id});
// define a mini app object for vfs select UI
app.vfsSelectUI = new app.classes.vfsSelectUI;