importPackage(Packages.de.elo.ix.client); importPackage(Packages.de.elo.ix.jscript); //@include lib_Class.js //@include lib_sol.common.Config.js //@include lib_sol.common.JsonUtils.js //@include lib_sol.common.SordUtils.js //@include lib_sol.common.IxUtils.js //@include lib_sol.common.WfUtils.js //@include lib_sol.common.RepoUtils.js //@include lib_sol.common.SordTypeUtils.js //@include lib_sol.common.Template.js //@include lib_sol.common.TranslateTerms.js //@include lib_sol.common.ix.RfUtils.js //@include lib_sol.common.ix.ActionBase.js //@include lib_sol.common.ix.FunctionBase.js //@include lib_sol.contract.ix.ContractUtils.js var logger = sol.create("sol.Logger", { scope: "sol.contract.ix.actions.TerminateContract" }); /** * Termination of a contract * * @eloix * @requires sol.common.Config * @requires sol.common.JsonUtils * @requires sol.common.SordUtils * @requires sol.common.IxUtils * @requires sol.common.CounterUtils * @requires sol.common.AclUtils * @requires sol.common.RepoUtils * @requires sol.common.Template * @requires sol.common.TranslateTerms * @requires sol.common.WfUtils * @requires sol.common.ix.RfUtils * @requires sol.common.ix.ActionBase * @requires sol.common.ix.FunctionBase * @requires sol.contract.ix.ContractUtils */ sol.define("sol.contract.ix.actions.TerminateContract", { extend: "sol.common.ix.ActionBase", requiredConfig: ["ci", "user", "objId"], /** * @cfg {de.elo.ix.client.ClientInfo} ci (required) */ /** * @cfg {de.elo.ix.client.UserInfo} user (required) */ /** * @cfg {String} templateId (required) * Object ID of the template */ initialize: function (config) { var me = this; me.$super("sol.common.ix.ActionBase", "initialize", [config]); }, getName: function () { return "TerminateContract"; }, process: function () { var me = this, contractSord, contractConfig, contractObjId, wfNumber, wfName, flowId, dialogTitle; contractConfig = sol.contract.ix.ContractUtils.loadConfig(); contractSord = sol.common.RepoUtils.findObjectTypeInHierarchy(me.objId, contractConfig.objectTypes); if (!contractSord) { me.addErrorEvent("sol.contract.client.contract.msg.noContractFoundInHierarchy", "", "", me.ci.language); return; } contractObjId = contractSord.id; wfNumber = me.actionId; wfName = sol.create("sol.common.Template", { source: contractConfig.workflows.terminateContract.workflowNameTemplate }).apply({ wfDate: new Date(), wfNumber: wfNumber }); flowId = me.startWorkflow(contractObjId, contractConfig.workflows.terminateContract.workflowTemplateName, wfName); dialogTitle = sol.common.TranslateTerms.translate("sol.contract.client.ribbon.btnInitiateTermination"); me.addWfDialogEvent(flowId, { objId: contractObjId, dialogId: me.getName(), title: dialogTitle }); me.addRefreshEvent(contractObjId, { type: "WF_STATUS", value: "REFRESH", flowId: flowId }); } }); /** * @member sol.contract.ix.actions.TerminateContract * @method RF_sol_contract_action_TerminateContract * @static * @inheritdoc sol.common.ix.FunctionBase#RF_FunctionName */ function RF_sol_contract_action_TerminateContract(ec, configAny) { logger.enter("RF_sol_contract_action_TerminateContract", configAny); var rfUtils = sol.common.ix.RfUtils, config = rfUtils.parseAndCheckParams(ec, arguments.callee.name, configAny, "objId"), terminateContract, result; config.ci = ec.ci; config.user = ec.user; terminateContract = sol.create("sol.contract.ix.actions.TerminateContract", config); result = terminateContract.execute(); logger.exit("RF_sol_contract_action_TerminateContract", result); return result; }