Skip to content

Commit

Permalink
fix: Job execution by user doesn't work #168
Browse files Browse the repository at this point in the history
  • Loading branch information
ctippler committed Feb 23, 2023
1 parent ac27572 commit 2fa894b
Showing 1 changed file with 47 additions and 23 deletions.
70 changes: 47 additions & 23 deletions src/Resources/public/js/executor/callback/abstractCallback.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,31 +324,55 @@ pimcore.plugin.processmanager.executor.callback.abstractCallback = Class.create(
csrfToken: pimcore.settings['csrfToken']
};

this.formPanel.getForm().submit({
url: this.executionUrl,
method: 'post',
params: params,
failure: function (response) {
alert('Error at execution');
}.bind(this),
success: function (re,result) {
var data = Ext.decode(result.response.responseText);
if (data.success) {
processmanagerPlugin.activeProcesses.refreshTask.start();
} else {
pimcore.helpers.showNotification(t("error"), t("plugin_pm_start_error"), "error", data.message);
}
if (typeof this.grid != "undefined") {
this.grid.store.reload();
}
// we have a callback form -> so we use form submit for file uploads
if (typeof this.formPanel == "object") {
this.formPanel.getForm().submit({
url: this.executionUrl,
method: 'post',
params: params,
failure: function (response) {
alert('Error at execution');
}.bind(this),
success: function (re, result) {
var data = Ext.decode(result.response.responseText);
if (data.success) {
processmanagerPlugin.activeProcesses.refreshTask.start();
} else {
pimcore.helpers.showNotification(t("error"), t("plugin_pm_start_error"), "error", data.message);
}
if (typeof this.grid != "undefined") {
this.grid.store.reload();
}

if(this.window){
if(!this.callbackWindowKeepOpen){
this.closeWindow();
if (this.window) {
if (!this.callbackWindowKeepOpen) {
this.closeWindow();
}
}
}
}.bind(this)
});
}.bind(this)
});
} else {
//direct execution without a callback window
Ext.Ajax.request({
url: this.executionUrl,
method: 'post',
params: params,
failure: function (response) {
alert('Error at execution');
}.bind(this),
success: function (response) {
var data = Ext.decode(response.responseText);
if (data.success) {
processmanagerPlugin.activeProcesses.refreshTask.start();
} else {
pimcore.helpers.showNotification(t("error"), t("plugin_pm_start_error"), "error", data.message);
}
if (this.store) {
this.store.reload();
}
}.bind(this.grid)
});
}
},

getFormPanel: function () {
Expand Down

0 comments on commit 2fa894b

Please sign in to comment.