diff --git a/api/js/etemplate/et2_widget_vfs.js b/api/js/etemplate/et2_widget_vfs.js index 8baed18190..a0decf20a1 100644 --- a/api/js/etemplate/et2_widget_vfs.js +++ b/api/js/etemplate/et2_widget_vfs.js @@ -1102,13 +1102,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 diff --git a/api/js/etemplate/et2_widget_vfs.ts b/api/js/etemplate/et2_widget_vfs.ts index cd000c1970..83578bcece 100644 --- a/api/js/etemplate/et2_widget_vfs.ts +++ b/api/js/etemplate/et2_widget_vfs.ts @@ -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;