You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`sap.ui.define(["vistex/ui/core/BaseController",
"vistex/ui/core/global",
"vistex/ui/core/commonUtils",
"sap/ui/comp/variants/VariantItem"],
function (Controller,global,commonUtils,VariantItem) {
"use strict";
return Controller.extend(vui5.app +".bdoutilities.Controllers.BaseController", {
getRouter : function(){
return sap.ui.core.UIComponent.getRouterFor(this);
},
onNavBack : function() {
// var history;//previousHash;
// history = History.getInstance();
//previousHash = history.getPreviousHash();
window.history.go(-1);
//parent.window.frameElement.contentWindow.history.back();
},
getModel : function(sName){
return this.getView().getModel(sName);
},
showAllButtons: function(show){
var mainModel = this.getModel(vui5.modelName);
var changeMode = mainModel.getProperty("/CHANGE_MODE");
mainModel.setProperty("/DELETEMODE",!show);
mainModel.setProperty("/SHOWBUTTONS",changeMode && show);
},
onValueHelpRequest: function (oEvent) {
// jQuery.sap.require("globalUtilsPath/Fragments/InputHelp");
var oController = this;
var mainModel = oController.getModel(vui5.modelName);
var src = oEvent.getSource();
var _inputHelpID = src.getId();
var modelName = src.data("model");
var path = src.data("path");
var supportRangesOnly = false;
// Support F4 with filtered Values when User Pressing Show All Items
var fromSuggestions = oEvent.getParameters("fromSuggestions").fromSuggestions;
if(src.data("SUPPORTRANGESONLY"))
supportRangesOnly = true;
if(modelName && path) {
var model = src.getModel(modelName);
var fieldInfo = model.getProperty(path);
var dataArea = src.data("dataArea");
mainModel.setProperty("/INPUTHELP/FLDNAME",fieldInfo['FLDNAME']);
mainModel.setProperty("/INPUTHELP/MULTISELECT",fieldInfo['MULTISELECT']);
mainModel.setProperty("/INPUTHELP/FIELDID",_inputHelpID);
mainModel.setProperty("/INPUTHELP/TABNAME",fieldInfo['TABNAME']);
mainModel.setProperty("/INPUTHELP/LABEL",fieldInfo['LABEL']);
mainModel.setProperty("/INPUTHELP/SHLPNAME",fieldInfo['SHLPNAME']);
mainModel.setProperty("/INPUTHELP/TXTFL", fieldInfo['TXTFL']);
mainModel.setProperty("/INPUTHELP/DEPFL", fieldInfo['DEPFL']);
mainModel.setProperty("/INPUTHELP/DATAR",dataArea);
mainModel.setProperty("/INPUTHELP/SUPPORTRANGESONLY", supportRangesOnly);
mainModel.setProperty("/INPUTHELP/DATATYPE", fieldInfo['DATATYPE']);
mainModel.setProperty("/INPUTHELP/INTTYPE", fieldInfo['INTTYPE']);
mainModel.setProperty("/INPUTHELP/OUTPUTLEN", fieldInfo['OUTPUTLEN']);
/ESP4 QA issue #6352 Passing Rollname for Inputhelp/
mainModel.setProperty("/INPUTHELP/ROLLNAME", fieldInfo['ROLLNAME']);
/******/
// Support F4 with filtered Values when User Pressing Show All Items
mainModel.setProperty("/INPUTHELP/TYPEAHEAD_ACTIVE",fromSuggestions);
var _oInputHelpDialog = sap.ui.jsfragment(global.vui5.ui.fragments.InputHelp,oController);
_oInputHelpDialog.setModel(oController.getModel(vui5.modelName),vui5.modelName);
oController.getView().addDependent(_oInputHelpDialog);
jQuery.sap.syncStyleClass(oController.getOwnerComponent().getContentDensityClass(),
oController.getView(), _oInputHelpDialog);
}
},
onRangeHelpRequest: function (oEvent) {
jQuery.sap.require("bdoUtilsPath/Fragments/RangeHelp");
var oController = this;
var mainModel = oController.getModel(vui5.modelName);
var src = oEvent.getSource();
var _inputHelpID = src.getId();
var modelName = src.data("model");
var path = src.data("path");
if(modelName && path) {
var model = src.getModel(modelName);
var fieldInfo = model.getProperty(path);
var dataArea = src.data("dataArea");
mainModel.setProperty("/INPUTHELP/FLDNAME",fieldInfo['FLDNAME']);
// var oController = this;
// var mainModel = oController.getModel(vui5.modelName);
// var modelName = mainModel.getProperty("/MODELNAME");
var type = oEvent.getParameter("type");
if(type != undefined && type == "tokensChanged"){
var oSource = oEvent.getSource();
var fieldPath = oSource.data('path');
var model = oSource.getModel(oSource.data('model'));
var fieldInfo = model.getProperty(fieldPath);
var token = oSource.getBinding("tokens");
var object = model.getProperty(token.getPath());
var tokens = oEvent.getSource().getTokens();
var newTokens = [];
var newTexts = [];
/*Define-Condition Issue Changes - START*/
underscoreJS.each(tokens,function(obj){
var range = obj.data("range");
if(range){
var sign = vui5.cons.seloptSign.include;
if(range.exclude)
sign = vui5.cons.seloptSign.exclude;
newTokens.push({
"SHLPNAME": fieldInfo['SHLPNAME'],
"FIELDNAME": fieldInfo['FLDNAME'],
"SHLPFIELD": fieldInfo['FLDNAME'],
"SELNAME" : fieldInfo['FLDNAME'],
/*Rel 60E_SP5*/
"TABNAME": fieldInfo['TABNAME'],
/*Rel 60E_SP5*/
"OPTION": range.operation,
"LOW": range.value1,
"HIGH": range.value2,
"SIGN": sign,
"TEXT" : obj.getText()
});
}else{
newTokens.push({
"SHLPNAME": fieldInfo['SHLPNAME'],
"FIELDNAME": fieldInfo['FLDNAME'],
"SHLPFIELD": fieldInfo['FLDNAME'],
"SELNAME" : fieldInfo['FLDNAME'],
/*Rel 60E_SP5*/
"TABNAME": fieldInfo['TABNAME'],
/*Rel 60E_SP5*/
"OPTION": '',
"LOW": obj.getText(),
"HIGH": '',
"SIGN": "",
"TEXT" : obj.getText()
});
}
newTexts.push(obj.getText());
});
var oldTexts = [];
for(var i=0; i<object.length ; i++){
oldTexts.push(object[i]['TEXT']);
}
/*Define-Condition Issue Changes - START*/
var diff = underscoreJS.difference(oldTexts,newTexts);
if(diff.length == 0 )
diff = underscoreJS.difference(newTexts,oldTexts);
if(diff.length != 0){
object = newTokens;
model.setProperty(token.getPath(),object);
oSource.fireChange();//fireChange();
}
}
},
attachmentDataPrepare : function(attachments){
var docs = [];
var mainModel = this.getModel(vui5.modelName);
var modelName = mainModel.getProperty("/MODELNAME");
var deletedDocs = this.getModel(modelName).getProperty("/ATTACHMENTS/DELETED");
underscoreJS.each(attachments,function(obj){
var doc = underscoreJS.findWhere(deletedDocs,{
BITM_TYPE : obj['BITM_TYPE']
});
if(doc == undefined){
obj['BITM_ICON'] = obj['BITM_ICON'].toLowerCase();
docs.push(obj);
}
});
return docs;
},
/* For fetching Description*/
getDescription : function(oEvent) {
var source = oEvent.getSource();
var valueMoved = source.data("VALUE_MOVED");
source.data("VALUE_MOVED",false);
var promise;
if(!valueMoved){
promise = this.descriptionGet(source,source.getValue(),'X','');//oEvent.getParameter("newValue"));
}
return promise;
},
_sessionEnd: function () {
var oUrl;
if (vui5.server.url.full.indexOf("?") == -1) {
oUrl = vui5.server.url.full + '?sap-sessioncmd=close';
}
else {
oUrl = vui5.server.url.full + '&sap-sessioncmd=close';
}
$.ajax({
dataType: 'json',
data: [],
xhrFields: {
withCredentials: true
},
crossDomain: true,
type: 'POST',
url: oUrl,
async: false,
error: function (jqXHR, textStatus, errorThrown) { }
}).done(function (data, status, xhr) {
});
},
_registerUnloadEvent: function () {
var oController = this;
function onWindowUnload()
{
if (!vui5.fromOtherApp) {
oController._sessionEnd();
}
else {
var data = [];
data.push({
"DATA": [],
"PARAMS": [],
"DTAREA": "APPLICATION",
"EVENT": "UNLOAD"
});
data.push({
"DATA": [],
"PARAMS": [],
"DTAREA": "APCTX",
"EVENT": "UNLOAD"
});
if (_.isArray(data)) {
_.each(data, function (obj) {
if (_.has(obj, 'DATA')) {
obj['DATA'] = JSON.stringify(obj['DATA']).replace(/\"/g, "@!@");
obj['DATA'] = obj['DATA'].replace(/\\r/g, "");
}
});
}
postData = JSON.stringify(data).replace(/@!@/g, '\\\"');
$.ajax({
data: postData,
xhrFields: {
withCredentials: true
},
crossDomain: true,
method: "POST",
url: vui5.server.url.full,
async: false,
}).done(function (result) {
});
}
};
function onWindowBeforeUnload()
{
if (!vui5.session.sessionend_skip) {
if(vui5.fromOtherApp == false)
{
oController._sessionEnd();
window.removeEventListener("unload", onWindowUnload);
}
}
else {
vui5.session.sessionend_skip = false;
}
}
window.addEventListener("unload", onWindowUnload);
window.addEventListener("beforeunload", onWindowBeforeUnload);
},
descriptionGet : function(source,newValue,getDescription,checkValue){
var oController = this;
var model = source.getModel(source.data("model"));
if(model) {
/* Multiple Change Event Issue Changes */
var deffered = $.Deferred();
var fieldInfo = model.getProperty(source.data("path"));
if(parseInt(fieldInfo['OUTPUTLEN']) != 0 && parseInt(fieldInfo['OUTPUTLEN']) < newValue.length){
source.setValueState(sap.ui.core.ValueState.Error);
var text;
if(source.getParent().getAggregation("label")){
// in case of form
text = source.getParent().getAggregation("label").getText();
}else{
if(source.data("sap-ui-colid")){
// non responsive table
text = sap.ui.getCore().byId(source.data("sap-ui-colid")).getAggregation("label").getText();
}else{
// m.Table
/*QA Issue 7022 Changes - START*/
var ariaLabelledBy = source.getAriaLabelledBy();
for(var i=0; i < ariaLabelledBy.length ; i++){
var textElement = sap.ui.getCore().byId(ariaLabelledBy[i]);
if(textElement){
text = textElement.getText();
break;
}
}
// text = sap.ui.getCore().byId(source.getAriaLabelledBy()[0]).getText();
/QA Issue 7022 Changes - END/
}
}
var bundle = source.getModel("i18n").getResourceBundle();
var errorText = bundle.getText("EnterValid",[text]);
source.setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
source.getId() + "/value" );
deffered.resolve(false);
}else{
source.setValueState(sap.ui.core.ValueState.None);
source.setValueStateText('');
oController.handleCheckFieldsMessages(
"",
"",
source.getId() + "/value" );
var dataArea = source.data("dataArea");
/Fill Description from Buffer/
var mainModel = this.getModel(vui5.modelName);
var descriptionBuffer = mainModel.getProperty("/DESCRIPTION_BUFFER");
var bufferEntry = underscoreJS.find(descriptionBuffer,{
'FLDNAME' : fieldInfo['FLDNAME'],
'TABNAME' : fieldInfo['TABNAME'],
'FLDVAL' : newValue
});
var oBinding = source.getBinding("value");
var path;
if(oBinding.getContext()) {
path = oBinding.getContext().getPath() + "/" + oBinding.getPath();
}else{
path = oBinding.getPath();
}
if(bufferEntry){
this.fillDescription(model,path,fieldInfo,bufferEntry['DESCRIPTION'],newValue);
/* Multiple Change Event Issue Changes /
deffered.resolve(true);
}else{
var arr = path.split("/");
var fieldname = arr[arr.length-1];
var rsparams = [];
if( underscoreJS.isArray(fieldInfo['DEPFL']) && fieldInfo['DEPFL'].length > 0 ){
for(var i=0;i < fieldInfo['DEPFL'].length ; i++) {
var depflPath = path.replace(fieldname,fieldInfo['DEPFL'][i]);
var depflData = model.getProperty(depflPath);
rsparams.push({
"SHLPNAME" : "",
"SHLPFIELD" : fieldInfo['DEPFL'][i],
"SIGN" : vui5.cons.seloptSign.include,
"OPTION" : "EQ",
"LOW" : depflData,
"HIGH" : ""
});
}
}
var data = [];
var params = [];
params.push({ NAME : "FIELDVALUE" , VALUE : newValue });
params.push({ NAME : "FIELDNAME" , VALUE : fieldInfo['FLDNAME'] });
params.push({ NAME : "TABLENAME" , VALUE : fieldInfo['TABNAME'] });
params.push({ NAME : "CONVEXIT" , VALUE : fieldInfo['CONVEXIT'] });
params.push({ NAME : "NRART" , VALUE : fieldInfo['NRART'] });
params.push({ NAME : "DATAAREA" , VALUE : dataArea });
params.push({ NAME : "CHECK_VALUE" , VALUE : checkValue });
params.push({ NAME : "GET_DESCR" , VALUE : getDescription });
data.push({
"DATA": rsparams,
"PARAMS": params,
"DTAREA": "FIELD_CHECK",
"EVENT": "READ"
});
$.when(this.callServer({ // callDescriptionServer
data: data,
reqType: vui5.cons.reqType.post,
NoLoader : true
})).then(function(result) {
if(result){
var path;
var response = underscoreJS.find(result,{DTAREA: "FIELD_CHECK", EVENT: "READ"});
if(response) {
if(checkValue == 'X'){
if(response['RESULT']['VALUE_NOT_FOUND'] == 'X'){
source.setValueState(sap.ui.core.ValueState.Error);
var text;
if(source.getParent().getAggregation("label")){
// in case of form
text = source.getParent().getAggregation("label").getText();
}else{
if(source.data("sap-ui-colid")){
// non responsive table
text = sap.ui.getCore().byId(source.data("sap-ui-colid")).getAggregation("label").getText();
}else{
// m.Table
/QA Issue 7022 Changes - START/
var ariaLabelledBy = source.getAriaLabelledBy();
for(var i=0; i < ariaLabelledBy.length ; i++){
var textElement = sap.ui.getCore().byId(ariaLabelledBy[i]);
if(textElement){
text = textElement.getText();
break;
}
}
// text = sap.ui.getCore().byId(source.getAriaLabelledBy()[0]).getText();
/QA Issue 7022 Changes - END/
}
}
var bundle = source.getModel("i18n").getResourceBundle();
var errorText = bundle.getText("EnterValid",[text]);
source.setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
source.getId() + "/value" );
deffered.resolve(false);
}else{
source.setValueState(sap.ui.core.ValueState.None);
source.setValueStateText('');
oController.handleCheckFieldsMessages(
"",
"",
source.getId() + "/value" );
if(getDescription == 'X'){
if(oBinding.getContext()) {
path = oBinding.getContext().getPath() + "/" + oBinding.getPath();
}else{
path = oBinding.getPath();
}
oController.fillDescription(model,path,fieldInfo,response['RESULT']['DESCR'],newValue);
/ Multiple Change Event Issue Changes */
}
deffered.resolve(true);
}
}else if(getDescription == 'X'){
if(oBinding.getContext()) {
path = oBinding.getContext().getPath() + "/" + oBinding.getPath();
}else{
path = oBinding.getPath();
}
oController.fillDescription(model,path,fieldInfo,response['RESULT']['DESCR'],newValue);
/* Multiple Change Event Issue Changes */
deffered.resolve(true);
}else{
deffered.resolve(true);
}
}
}
});
}
}
/* Multiple Change Event Issue Changes */
return deffered.promise();
}
},
fillDescription : function(model,path,fieldInfo,descr,newValue){
if(fieldInfo['SDSCR'] == vui5.cons.fieldValue.value_cont_descr){
var description = descr;
if(newValue && newValue != ''){
description = description + " (" + newValue + ")";
}
model.setProperty(path,description);
path = path.replace(fieldInfo['TXTFL'],fieldInfo['FLDNAME']);
model.setProperty(path,newValue);
}else if(fieldInfo['SDSCR'] == vui5.cons.fieldValue.description){
model.setProperty(path,descr);
path = path.replace(fieldInfo['TXTFL'],fieldInfo['FLDNAME']);
model.setProperty(path,newValue);
}else if(fieldInfo['SDSCR'] == vui5.cons.fieldValue.value_descr) {
path = path.replace(fieldInfo['FLDNAME'], fieldInfo['TXTFL']);
model.setProperty(path,descr);
}
},
handleTypeAhead : function(oEvent) {
var source = oEvent.getSource();
var model = source.getModel(source.data("model"));
var fieldInfo = model.getProperty(source.data("path"));
var dataArea = source.data("dataArea");
var oBinding = source.getBinding("value");
var path;
if(oBinding.getContext()) {
path = oBinding.getContext().getPath() + "/" + oBinding.getPath();
}else{
path = oBinding.getPath();
}
var arr = path.split("/");
var fieldname = arr[arr.length-1];
var rsparams = [];
if( underscoreJS.isArray(fieldInfo['DEPFL']) && fieldInfo['DEPFL'].length > 0 ){
for(var i=0;i < fieldInfo['DEPFL'].length ; i++) {
var depflPath = path.replace(fieldname,fieldInfo['DEPFL'][i]);
var depflData = model.getProperty(depflPath);
rsparams.push({
"SHLPNAME" : "",
"SHLPFIELD" : fieldInfo['DEPFL'][i],
"SIGN" : vui5.cons.seloptSign.include,
"OPTION" : "EQ",
"LOW" : depflData,
"HIGH" : ""
});
}
}
var mainModel = this.getModel(vui5.modelName);
mainModel.setProperty("/TYPEAHEAD",{});
var data = [];
var params = [];
params.push({ NAME : "FIELDVALUE" , VALUE : oEvent.getParameter("suggestValue") });
params.push({ NAME : "FIELDNAME" , VALUE : fieldInfo['FLDNAME'] });
params.push({ NAME : "TABLENAME" , VALUE : fieldInfo['TABNAME'] });
params.push({ NAME : "SHLPNAME" , VALUE : fieldInfo['SHLPNAME'] });
/*ESP4 QA issue #6352 Passing Rollname for Inputhelp*/
params.push({ NAME : "ROLLNAME" , VALUE: fieldInfo['ROLLNAME']});
/******/
params.push({ NAME : "DATAAREA" , VALUE : dataArea });
if(fieldInfo['SDSCR'] == vui5.cons.fieldValue.description || fieldInfo['SDSCR'] == vui5.cons.fieldValue.value_cont_descr )
params.push({ NAME : "SEARCHTYPE" , VALUE : "DSC" });
else if(fieldInfo['SDSCR'] == vui5.cons.fieldValue.value || fieldInfo['SDSCR'] == vui5.cons.fieldValue.value_descr)
params.push({ NAME : "SEARCHTYPE" , VALUE : "VAL" });
data.push({
"DATA": rsparams,
"PARAMS": params,
"DTAREA": "TYPEAHEAD",
"EVENT": "READ"
});
$.when(this.callServer({
data: data,
reqType: vui5.cons.reqType.post,
NoLoader : true
})).then(function(result) {
if(result){
var typeAhead = {};
typeAhead[fieldInfo['FLDNAME']] = {};
var response = underscoreJS.find(result,{DTAREA: "TYPEAHEAD", EVENT: "READ"});
if(response && response['RESULT']){
typeAhead[fieldInfo['FLDNAME']]['FIELDS'] = response['RESULT']['RESULT_FCAT'];
if (oController.checkAmountValue(newValue)){
// set state
source.setValueState(sap.ui.core.ValueState.None);
source.setValueStateText("");
oController.handleCheckFieldsMessages(
"",
"",
source.getId() + "/value" );
var oBinding = source.getBinding("value");
var model = oBinding.getModel();
var currencyPath = source.data("currencyPath");
var currency = model.getProperty(currencyPath);
if(!currency)
currency = '';
//check currency
}else{
if(errorExist)
deffered.resolve(false);
else
deffered.resolve(true);
}
return deffered.promise();
},
handleQuantityConversion : function(oEvent) {
var oController = this;
var source = oEvent.getSource();
oController.performQuantityConversion(source);
},
performQuantityConversion : function(source) {
var oController = this;
var newValue = source.getValue();
// check value
var deffered = $.Deferred();
if (oController.checkQuantityValue(newValue)){
// set state
source.setValueState(sap.ui.core.ValueState.None);
source.setValueStateText("");
oController.handleCheckFieldsMessages(
"",
"",
source.getId() + "/value" );
var oBinding = source.getBinding("value");
var model = oBinding.getModel();
var unitPath = source.data("unitPath");
var unit = model.getProperty(unitPath);
if(unit)
unit = '';
//check unit
}else{
if(errorExist)
deffered.resolve(false);
else
deffered.resolve(true);
}
return deffered.promise();
},
showPanelContent: function (key) {
var oController = this;
var panelObj;
var mainModel = oController.getModel(global.vui5.modelName);
var section = oController.getSectionBy('SECTN', key);
var model = oController.getModel(oController.modelName);
var path = oController._getPath(true);
var sections = model.getProperty(path);
var sectionID = section['SECTN'];
var index = underscoreJS.indexOf(sections, section);
if (oController.getPanel) {
panelObj = oController.getPanel();
}
oController.sectionData = section;
/* Prepare section config */
if (oController.sectionConfig[sectionID] === undefined) {
oController.sectionConfig[sectionID] = {
keyField: section['KEYS'] || global.vui5.rowID,
fields: {},
metaDataLoaded: false
};
}
oController.sectionConfig[sectionID]['attributes'] = oController._flattenAttributes(section['ATTRB']);
underscoreJS.each(section['FIELDS'], function (fld) {
oController.sectionConfig[sectionID]['fields'][fld['FLDNAME']] = {
attributes: oController._flattenAttributes(fld['ATTRB'])
}
});
oController._processCommonSections({
section: section
});
model.setProperty("/SECCFG", oController.sectionConfig);
switch (section['DAPPT']) {
case vui5.cons.propertyType.snappingHeader:
oController._processSnappingHeader({
section: section,
index: index
});
break;
case vui5.cons.propertyType.treeTable:
oController._processTreeTable({
section: section,
index: index
});
break;
case global.vui5.cons.propertyType.form:
oController._processForm({
section: section,
index: index
});
break;
case global.vui5.cons.propertyType.table:
oController._processTable({
section: section,
index: index
});
break;
case global.vui5.cons.propertyType.selections:
oController._processSelections({
section: section,
index: index
});
break;
case global.vui5.cons.propertyType.variant:
oController.sectionRef[sectionID] = new sap.m.Button({
visible: false
});
break;
case global.vui5.cons.propertyType.postings:
oController._processPostings({
section: section,
index: index
})
break;
case global.vui5.cons.propertyType.tradecalendar:
oController._processCalendar({
section: section,
index: index
})
break;
case global.vui5.cons.propertyType.processFlow:
oController._processProcessFlow({
section: section,
index: index
})
break;
case global.vui5.cons.propertyType.status:
oController._processStatus({
section: section,
index: index
})
break;
case global.vui5.cons.propertyType.partners:
oController._processPartners({
section: section,
index: index
})
break;
case global.vui5.cons.propertyType.texts:
oController._processTexts({
section: section,
index: index
})
break;
case global.vui5.cons.propertyType.reportingView:
case global.vui5.cons.propertyType.summary:
oController._processSummary({
section: section,
index: index
})
break;
case global.vui5.cons.propertyType.evaluationForm:
oController._processEvaluationForm({
section: section,
index: index
})
break;
case global.vui5.cons.propertyType.notes:
oController._processNotes({
section: section,
index: index
});
break;
case global.vui5.cons.propertyType.attachments:
oController._processAttachments({
section: section,
index: index
});
break;
case global.vui5.cons.propertyType.objectheader:
oController._processObjectHeader({
section: section,
index: index
})
break;
case global.vui5.cons.propertyType.tilesGroup:
oController._processTilesGroup({
section: section,
index: index
});
break;
case global.vui5.cons.propertyType.attributes:
oController._processAttributes({
section: section,
index: index
})
break;
case global.vui5.cons.propertyType.sets:
oController._processSets({
section: section,
index: index
});
break;
case global.vui5.cons.propertyType.tree:
oController._processTree({
section: section,
index: index
});
break;
case global.vui5.cons.propertyType.address:
oController._processAddress({
section: section,
index: index
})
break;
case global.vui5.cons.propertyType.treeTable:
oController._processTreeTable({
section: section,
index: index
})
break;
case global.vui5.cons.propertyType.list:
oController._processList({
section: section,
index: index
})
break;
case global.vui5.cons.propertyType.HTML:
oController._processHtml({
section: section,
index: index
})
break;
case global.vui5.cons.propertyType.planningGrid:
oController._processPlanningGrid({
section: section,
index: index
});
break;
case global.vui5.cons.propertyType.pricingGrid:
oController._processPricingGrid({
section: section,
index: index
});
break;
case global.vui5.cons.propertyType.statementEditor:
oController._processStatementEditor({
section: section,
index: index
});
break;
case "MF":
oController._processMatchForm({
section: section,
index: index
})
break;
}
if (section['DAPPT'] === global.vui5.cons.propertyType.table || section['DAPPT'] === global.vui5.cons.propertyType.partners ||
section['DAPPT'] === global.vui5.cons.propertyType.treeTable) {
oController.getControlTitleVisibility(oController.sectionRef[section['SECTN']], section);
}
else if (section['DAPPT'] === global.vui5.cons.propertyType.list) {
oController.sectionRef[section['SECTN']].getAggregation("_getListControl").setHeaderText("");
}
else if (section['DAPPT'] === global.vui5.cons.propertyType.attachments) {
//oController.sectionRef[section['SECTN']].getAggregation("_uploadCollection").setNumberOfAttachmentsText(null);
}
},
_processSelections: function (cfg) {
var oController = this, section, index, sectionID, dataArea, sectionPath, dataPath, sectionModelPath,
sectionConfig, variantSectionConfig, variantSection, callback;
var model = oController.getModel(oController.modelName);
section = cfg.section;
index = cfg.index;
sectionID = section['SECTN'];
dataArea = section['DATAR'];
sectionPath = oController._getPath(true);
dataPath = oController._getPath();
sectionModelPath = sectionPath + index;
sectionConfig = oController.sectionConfig[sectionID];
variantSection = oController.getSectionBy("DAPPT", global.vui5.cons.propertyType.variant) || {
};
variantSectionConfig = oController.sectionConfig[variantSection['SECTN']] || {
};
/* Process Attributes */
if (sectionConfig.attributes[global.vui5.cons.attributes.onSearch]) {
sectionConfig.onSearchAction = underscoreJS.findWhere(cfg.section['FUNC'], {
FNCNM: sectionConfig.attributes[global.vui5.cons.attributes.onSearch]
});
}
if (!underscoreJS.isEmpty(variantSectionConfig)) {
if (variantSectionConfig.attributes[global.vui5.cons.attributes.onVariantMaintain]) {
variantSectionConfig.onVariantMaintain = underscoreJS.findWhere(variantSection['FUNC'], {
FNCNM: variantSectionConfig.attributes[global.vui5.cons.attributes.onVariantMaintain]
});
}
if (variantSectionConfig && variantSectionConfig.attributes[global.vui5.cons.attributes.onVariantSelect]) {
variantSectionConfig.onVariantSelect = underscoreJS.findWhere(variantSection['FUNC'], {
FNCNM: variantSectionConfig.attributes[global.vui5.cons.attributes.onVariantSelect]
});
}
}
/* Prepare Element */
jQuery.sap.require("bdoUtilsPath/Controls/BdoSelections");
var selRef = oController.sectionRef[sectionID] = new bdo.utility.selections({
controller: oController,
dataAreaID: section['DATAR'],
sectionPath: sectionModelPath,
dataPath: "/SRCH_DATA/",
fieldsPath: sectionModelPath + "/FIELDS/",
modelName: oController.modelName,
dropdownModel: global.vui5.modelName,
variantDataPath: dataPath + variantSection['DATAR'] + "/",
showVariants: variantSectionConfig.onVariantMaintain !== undefined,
goVisibleProperty: sectionConfig.onSearchAction !== undefined,
showFilterConfiguration: oController.getBindingExpression("showFilterConfiguration", section, index),
selectedVariant: "/SECCFG/" + variantSection['SECTN'] + "/attributes/" + global.vui5.cons.attributes.selectedVariant,
visible: oController.getBindingExpression('visible', section, index),
search: [oController.onSearchAction,oController],
variantSave: function (oEvent) {
callback = oEvent.getParameter("callback");
oController.processVariantAction(sectionID, variantSectionConfig.onVariantMaintain).then(function () {
if (callback && callback instanceof Function) {
callback();
}
});
},
fieldEvent: oController.preProcessFieldEvent.bind(oController, sectionID),
onValueHelpRequest: oController.onValueHelpRequest.bind(oController, sectionID),
variantSelect: function (evt) {
callback = evt.getParameter("callback");
oController.processVariantAction(sectionID, variantSectionConfig.onVariantSelect, evt.getParameter('record')).then(function () {
if (callback && callback instanceof Function) {
callback();
}
});
}
});
oController.sectionRef[sectionID].setModel(model, oController.modelName);
oController.sectionRef[sectionID].selectionInfocusSet(global.vui5.cons.applnObject, global.vui5.cons.application);
selRef.processOnInputChange = function (oEvent) {
return oController.processOnInputChange(sectionID, oEvent);
};
},
processVariantAction: function(sectionID, actionObject, rowData, urlParams){
// var filterBarModel = this.getModel("VUI_FILTERBAR");
var oController = this,promise, objDefer = $.Deferred();;
var oFilter = oController.sectionRef[sectionID].oFilter;
var model = oController.getModel(oController.modelName);
var variantDataPath = oFilter.getVariantDataPath();
var variantData = model.getProperty(variantDataPath);
switch(actionObject['FNCNM']){
case "VARMNT":
var lt_rsparams = oController.prepareVariantsData(oFilter);
var inserted = underscoreJS.find(variantData,{'UPDKZ': 'I'});
var data = [];
var params = [];
if(inserted){
var insertingData = true;
var headerData = JSON.parse(JSON.stringify(inserted));
if(headerData){
delete headerData.FLDPPTY;
headerData['SRCHP'] = vui5.uiProfile;
headerData['UPDKZ'] = '';
}
var data = [];
data.push({
"DATA": notesData,
"PARAMS": params,
"DTAREA": "NOTE",
"EVENT": actionObject
});
data.push({
"DATA": [],
"PARAMS": [],
"DTAREA": "MESSAGES",
"EVENT": "READ"
});
$.when(this.callServer({
data: data,
reqType: 'POST'
})).then(function(result) {
oController.notesInfocusSet(dmode,
vui5.cons.applnObject,
oController.selectedDocument,
subobj,
infocusModel.getProperty("/UIPRF"),
sectionID,
section['DARID']);
objDefer.resolve();
});
break;
case vui5.cons.propertyType.status:
}
return objDefer.promise();
},
handleRequiredFieldCheck : function(oEvent){
var oController = this;
var newValue = oEvent.getParameter("newValue");
var oSource = oEvent.getSource();
var error;
if (newValue === "") {
oSource.setValueState(sap.ui.core.ValueState.Error); // if the field is empty after change, it will go red
var text;
if(oSource.getParent().getAggregation("label")){
text = oSource.getParent().getAggregation("label").getText();
}else{
text = oSource.getParent().getTitle();
text = text.substr(5,text.length);
}
var bundle = oSource.getModel("i18n").getResourceBundle();
var errorText = bundle.getText("Enter",[text]);
oSource.setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
oSource.getId() + "/value" );
error = true;
}else {
oSource.setValueState(sap.ui.core.ValueState.None); // if the field is not empty after change, the value state (if any) is removed
oSource.setValueStateText("");
oController.handleCheckFieldsMessages(
"",
"",
oSource.getId() + "/value" );
error = false;
}
return error;
},
checkRequiredFields : function() {
var error = false;
var oController = this;
var mainModel = this.getModel(vui5.modelName);
var docMode = mainModel.getProperty("/DOCUMENT_MODE");
var index = 0;
jQuery('input[aria-invalid=true]').each(function(){
var oInput = sap.ui.getCore().byId(this.parentNode.id);
if(oInput){
error = true;
if(index == 0){
oInput.focus();
}
index++;
}
});
if(docMode != vui5.cons.mode.display) {
jQuery('input[aria-required=true]').each(function(){
var oInput = sap.ui.getCore().byId(this.parentNode.id);
// if(oInput.$().is(":visible") && oInput.getValue && oInput.getValue() == ''){
// oInput.setValueState(sap.ui.core.ValueState.Error); // if the field is empty after change, it will go red
// var text = oInput.getParent().getAggregation("label").getText();
// var bundle = oInput.getModel("i18n").getResourceBundle();
// var errorText = bundle.getText("Enter",[text]);
// oInput.setValueStateText(errorText);
// oController.handleCheckFieldsMessages(
// errorText,
// sap.ui.core.MessageType.Error,
// oInput.getId() + "/value" );
// error = true;
// if(index == 0){
// oInput.focus();
// }
// index++;
// }
var errorflag = false;
if(oInput.$().is(":visible") ) {
if( oInput.getSelectedKey && oInput.getSelectedItem ){
var item = oInput.getSelectedItem();
if(!item)
errorflag = true;
}else if(oInput.getValue && oInput.getValue() == ''){
errorflag = true;
}
if(errorflag) {
oInput.setValueState(sap.ui.core.ValueState.Error); // if the field is empty after change, it will go red
var text = oInput.getParent().getAggregation("label").getText();
var bundle = oInput.getModel("i18n").getResourceBundle();
var errorText = bundle.getText("Enter",[text]);
oInput.setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
oInput.getId() + "/value" );
error = true;
if(index == 0){
oInput.focus();
}
index++;
}
}
/Not Required, as it will clear error flag marked by other checks/
// else {
// oInput.setValueState(sap.ui.core.ValueState.None); // if the field is not empty after change, the value state (if any) is removed
// oInput.setValueStateText("");
// oController.handleCheckFieldsMessages(
// "",
// "",
// oInput.getId() + "/value" );
// }
});
}
return error;
},
messageDataPrepare : function(messages) {
var oController = this;
if(!this.oMessageProcessor){
this.oMessageProcessor = new sap.ui.core.message.ControlMessageProcessor();
}
var oMessageManager = sap.ui.getCore().getMessageManager();
oMessageManager.registerMessageProcessor(this.oMessageProcessor);
var messageModel = oMessageManager.getMessageModel();
messageModel.setSizeLimit(vui5.cons.maxDataLimit);
oMessageManager.removeAllMessages();
underscoreJS.each(messages,function(obj) {
var type;
switch(obj['MSGTY']){
case 'S' :
type = sap.ui.core.MessageType.Success;
break;
case 'I' :
type = sap.ui.core.MessageType.Information;
break;
case 'E' :
type = sap.ui.core.MessageType.Error;
break;
case 'W' :
type = sap.ui.core.MessageType.Warning;
break;
}
oMessageManager.addMessages(
new sap.ui.core.message.Message({
message: obj['MSGLI'],
type: type,
processor: oController.oMessageProcessor
})
);
});
},
handleMessageButtonPress: function (oEvent) {
var oController = this;
var oSource = oEvent.getSource();
if(!oController._messagePopover){
oController._messagePopover = sap.ui.jsfragment(global.vui5.ui.fragments.Messages,oController);
oSource.addDependent(oController._messagePopover);
jQuery.sap.syncStyleClass(oController.getOwnerComponent().getContentDensityClass(),
oController.getView(), oController.messagePopover);
}
oController.messagePopover.toggle(oSource);
},
loginDataSet : function(mainModel,response) {
if(response && response['RESULT']){
mainModel.setProperty("/LOGIN",response['RESULT']['DATA']);
/var dateFormat = mainModel.getProperty("/LOGIN/DATEFORMAT");
dateFormat = dateFormat.toLowerCase().replace('mm', 'MM');
mainModel.setProperty('/LOGIN/DATEFORMAT', dateFormat);/
vui5.session.extensionPath = mainModel.getProperty('/LOGIN/EXTENSIONPATH');
global.vui5.session.ccounter = global.vui5.session.maxTime = parseInt(mainModel.getProperty('/LOGIN/TIMEOUT'));
vui5.themeRoot = mainModel.getProperty('/LOGIN/THEME_ROOT');
commonUtils.applyTheme(response['RESULT']['DATA'].THEME);
}
},
checkFloatField : function(oEvent){
var oController = this;
var oSource = oEvent.getSource();
var value = oSource.getValue();
var regx;
var mainModel = oController.getModel(vui5.modelName);
var decimalNotation = mainModel.getProperty("/LOGIN/DECIMALNOTATION");
switch(decimalNotation){
case 'X':
regx = /^[-+]?[0-9](,\d{0,})?.?[0-9]+([eE][-+]?[0-9]+)?$/;
break;
case 'Y':
regx = /^[-+]?[0-9](\s\d{0,})?,?[0-9]+([eE][-+]?[0-9]+)?$/;
break;
default:
regx = /^[-+]?[0-9](.\d{0,})?,?[0-9]+([eE][-+]?[0-9]+)?$/;
break;
}
value = value.trim();
if(value && !regx.test(value)){
oSource.setValueState(sap.ui.core.ValueState.Error);
var text;
if(oSource.getParent().getAggregation("label")){
text = oSource.getParent().getAggregation("label").getText();
}else if(oSource.getParent().getTitle()){
text = oSource.getParent().getTitle();
text = text.substr(5,text.length);
}else{
if(oSource.data("sap-ui-colid")){
// non responsive table
text = sap.ui.getCore().byId(oSource.data("sap-ui-colid")).getAggregation("label").getText();
}else{
// m.Table
/QA Issue 7022 Changes - START/
var ariaLabelledBy = oSource.getAriaLabelledBy();
for(var i=0; i < ariaLabelledBy.length ; i++){
var textElement = sap.ui.getCore().byId(ariaLabelledBy[i]);
if(textElement){
text = textElement.getText();
break;
}
}
// text = sap.ui.getCore().byId(oSource.getAriaLabelledBy()[0]).getText();
/QA Issue 7022 Changes - END/
}
}
// var text = source.getParent().getAggregation("label").getText();
var bundle = oSource.getModel("i18n").getResourceBundle();
var errorText = bundle.getText("EnterValid",[text]);
oSource.setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
oSource.getId() + "/value" );
}else{
oSource.setValueState(sap.ui.core.ValueState.None);
oSource.setValueStateText('');
oController.handleCheckFieldsMessages(
"",
"",
oSource.getId() + "/value" );
}
},
checkNumericField : function(oEvent){
var oController = this;
var source = oEvent.getSource();
var value;
if(oEvent.oSource.$input[0]['attributes']['role'] && oEvent.oSource.$input[0]['attributes']['role']['nodeValue'] === 'combobox'){
value = source.getSelectedKey();
}else{
value = source.getValue();
}
var regex;
regex = /^[0-9]*$/;
var error;
value = value.trim();
if(value && !regex.test(value)){
source.setValueState(sap.ui.core.ValueState.Error);
var text;
if(source.getParent().getAggregation("label")){
text = source.getParent().getAggregation("label").getText();
}else if(source.getParent().getTitle()){
text = source.getParent().getTitle();
text = text.substr(5,text.length);
}else{
if(source.data("sap-ui-colid")){
// non responsive table
text = sap.ui.getCore().byId(source.data("sap-ui-colid")).getAggregation("label").getText();
}else{
// m.Table
/*QA Issue 7022 Changes - START*/
var ariaLabelledBy = source.getAriaLabelledBy();
for(var i=0; i < ariaLabelledBy.length ; i++){
var textElement = sap.ui.getCore().byId(ariaLabelledBy[i]);
if(textElement){
text = textElement.getText();
break;
}
}
// text = sap.ui.getCore().byId(source.getAriaLabelledBy()[0]).getText();
/QA Issue 7022 Changes - END/
}
}
// var text = source.getParent().getAggregation("label").getText();
var bundle = source.getModel("i18n").getResourceBundle();
var errorText = bundle.getText("EnterValid",[text]);
source.setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
source.getId() + "/value" );
error = true;
}else{
source.setValueState(sap.ui.core.ValueState.None);
source.setValueStateText('');
oController.handleCheckFieldsMessages(
"",
"",
source.getId() + "/value" );
error = false;
}
return error;
},
checkPackedField : function(oEvent) {
var oController = this;
var source = oEvent.getSource();
var value = source.getValue();
var regex;
var mainModel = oController.getModel(vui5.modelName);
var decimalNotation = mainModel.getProperty("/LOGIN/DECIMALNOTATION");
/QA Issue 7022 Changes/
regex = oController.getDecimalNotationRegex(decimalNotation);
/*QA Issue 7022 Changes*/
var error;
value = value.trim();
if(value && !regex.test(value)){
source.setValueState(sap.ui.core.ValueState.Error);
// var text = source.getParent().getAggregation("label").getText();
var text;
if(source.getParent().getAggregation("label")){
text = source.getParent().getAggregation("label").getText();
}else if(source.getParent().getTitle()){
text = source.getParent().getTitle();
text = text.substr(5,text.length);
}else{
if(source.data("sap-ui-colid")){
// non responsive table
text = sap.ui.getCore().byId(source.data("sap-ui-colid")).getAggregation("label").getText();
}else{
// m.Table
/QA Issue 7022 Changes - START/
var ariaLabelledBy = source.getAriaLabelledBy();
for(var i=0; i < ariaLabelledBy.length ; i++){
var textElement = sap.ui.getCore().byId(ariaLabelledBy[i]);
if(textElement){
text = textElement.getText();
break;
}
}
// text = sap.ui.getCore().byId(source.getAriaLabelledBy()[0]).getText();
/QA Issue 7022 Changes - END/
}
}
var bundle = source.getModel("i18n").getResourceBundle();
var errorText = bundle.getText("EnterValid",[text]);
source.setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
source.getId() + "/value" );
error = true;
}else{
source.setValueState(sap.ui.core.ValueState.None);
source.setValueStateText('');
oController.handleCheckFieldsMessages(
"",
"",
source.getId() + "/value" );
error = false;
}
return error;
},
checkIntegerField : function(oEvent) {
var oController = this;
var source = oEvent.getSource();
var value = source.getValue();
var regex;
regex = /^[0-9-]\d*(((,\d{1,}){0,})?)(([0-9-])?)$/ ;
var error;
value = value.trim();
if(value && !regex.test(value)){
source.setValueState(sap.ui.core.ValueState.Error);
var text;
if(source.getParent().getAggregation("label")){
text = source.getParent().getAggregation("label").getText();
}else if(source.getParent().getTitle()){
text = source.getParent().getTitle();
text = text.substr(5,text.length);
}else{
if(source.data("sap-ui-colid")){
// non responsive table
text = sap.ui.getCore().byId(source.data("sap-ui-colid")).getAggregation("label").getText();
}else{
// m.Table
/QA Issue 7022 Changes - START/
var ariaLabelledBy = source.getAriaLabelledBy();
for(var i=0; i < ariaLabelledBy.length ; i++){
var textElement = sap.ui.getCore().byId(ariaLabelledBy[i]);
if(textElement){
text = textElement.getText();
break;
}
}
// text = sap.ui.getCore().byId(source.getAriaLabelledBy()[0]).getText();
/QA Issue 7022 Changes - END/
}
}
// var text = source.getParent().getAggregation("label").getText();
var bundle = source.getModel("i18n").getResourceBundle();
var errorText = bundle.getText("EnterValid",[text]);
source.setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
source.getId() + "/value" );
error = true;
}else{
source.setValueState(sap.ui.core.ValueState.None);
source.setValueStateText('');
oController.handleCheckFieldsMessages(
"",
"",
source.getId() + "/value" );
error = false;
}
return error;
},
dateFieldCheck : function(oEvent) {
var oController = this;
var oSource = oEvent.getSource();
if(oEvent.getParameter("valid")){
oSource.setValueState(sap.ui.core.ValueState.None);
oSource.setValueStateText("");
oController.handleCheckFieldsMessages(
"",
"",
oSource.getId() + "/value" );
}else if(oEvent.getParameter("valid") == false){
oSource.setValueState(sap.ui.core.ValueState.Error);
var text;
if(oSource.getParent().getAggregation("label")){
text = oSource.getParent().getAggregation("label").getText();
}else if(oSource.getParent().getTitle()){
text = oSource.getParent().getTitle();
text = text.substr(5,text.length);
}else{
if(oSource.data("sap-ui-colid")){
// non responsive table
text = sap.ui.getCore().byId(oSource.data("sap-ui-colid")).getAggregation("label").getText();
}else{
// m.Table
/QA Issue 7022 Changes - START/
var ariaLabelledBy = oSource.getAriaLabelledBy();
for(var i=0; i < ariaLabelledBy.length ; i++){
var textElement = sap.ui.getCore().byId(ariaLabelledBy[i]);
if(textElement){
text = textElement.getText();
break;
}
}
// text = sap.ui.getCore().byId(oSource.getAriaLabelledBy()[0]).getText();
/QA Issue 7022 Changes - END/
}
}
// var text = source.getParent().getAggregation("label").getText();
var bundle = oSource.getModel("i18n").getResourceBundle();
var errorText = bundle.getText("EnterValid",[text]);
oSource.setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
oSource.getId() + "/value" );
}else{
var valid = oSource._bValid;
if(valid){
oSource.setValueState(sap.ui.core.ValueState.None);
oSource.setValueStateText("");
oController.handleCheckFieldsMessages(
"",
"",
oSource.getId() + "/value" );
}else{
oSource.setValueState(sap.ui.core.ValueState.Error);
var text;
if(oSource.getParent().getAggregation("label")){
// in case of form
text = oSource.getParent().getAggregation("label").getText();
}else{
if(oSource.data("sap-ui-colid")){
// non responsive table
text = sap.ui.getCore().byId(oSource.data("sap-ui-colid")).getAggregation("label").getText();
}else{
// m.Table
/QA Issue 7022 Changes - START/
var ariaLabelledBy = oSource.getAriaLabelledBy();
for(var i=0; i < ariaLabelledBy.length ; i++){
var textElement = sap.ui.getCore().byId(ariaLabelledBy[i]);
if(textElement){
text = textElement.getText();
break;
}
}
// text = sap.ui.getCore().byId(oSource.getAriaLabelledBy()[0]).getText();
/QA Issue 7022 Changes - END/
}
}
var bundle = oSource.getModel("i18n").getResourceBundle();
var errorText = bundle.getText("EnterValid",[text]);
oSource.setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
oSource.getId() + "/value" );
}
}
var cellID = oController.changedDateTimeID;
$("#"+cellID).parents("td").removeClass (function (index, className) {
return (className.match (/\bvui_tblrowcolor_\S+/g) || []).join(' ');
});
$("#"+cellID).parents("td").addClass("vui_tblrowcolor_CHANGED");
},
getDecimalNotationRegex:function(decimalNotation)
{
var regex;
switch(decimalNotation) {
case 'X' :
regex = /^[0-9\-.]\d*(((,\d{1,}){0,})?(\.\d{0,})?)([0-9\-]{0,1})$/;
break;
case 'Y' :
regex = /^[0-9\-,]\d*(((\s\d{1,}){0,})?(,\d{0,})?)([0-9\-]{0,1})$/;
break;
default :
regex = /^[0-9\-,]\d*(((\.\d{1,}){0,})?(,\d{0,})?)([0-9\-]{0,1})$/;
break;
}
return regex;
},
/**********************************Generic App Methods************************************************/
setProfileInfo: function (data) {
// TODO - check if this storage at
// main model is required.
var modelPath;
var mainModel = this.getMainModel();
if (!data) return false;
modelPath = global.vui5.cons.modelPath.infocusUIPrf;
mainModel.setProperty(modelPath, data);
},
getProfileInfo: function() {
var modelPath;
var mainModel = this.getOwnerComponent().getModel(vui5.modelName);
return mainModel.getProperty(vui5.cons.modelPath.infocusUIPrf);
},
getSections: function() {
var oController = this;
var model = oController.getModel(oController.modelName);
var path = oController._getPath(true); // copy popup
return model.getProperty(path);
},
_showMessages: function(oEvent) {
var oController = this;
var oSource = oEvent.getSource();
/*
* if(oController._messagePopover) {
* oController._messagePopover.destroy(); }
*/
oController._messagePopover = sap.ui.jsfragment(global.vui5.ui.fragments.Messages, oController);
oSource.addDependent(oController._messagePopover);
jQuery.sap.syncStyleClass(oController.getOwnerComponent().getContentDensityClass(),
oController.getView(), oController._messagePopover);
oController._messagePopover.toggle(oSource);
},
getQueryParams: function() {
var oController = this, params;
params = oController.getRouteParam('all*') || '';
return commonUtils.paramsUnserialize(params);
},
getQueryParam: function(key) {
var oController = this, params;
params = oController.getQueryParams('') || {};
return params[key];
},
getRouteParams: function() {
var oController = this;
var routerRef = oController.getRouter();
var routerPvtObj = routerRef._oRouter;
var hashManager = routerRef.oHashChanger;
var currentHash, matchedRoutes, routeParams = {};
if (hashManager) {
currentHash = hashManager.getHash();
matchedRoutes = routerPvtObj._getMatchedRoutes(currentHash);
underscoreJS.each(matchedRoutes, function(matchedRoute) {
underscoreJS.each(matchedRoute.params, function(g, h) {
routeParams[matchedRoute.route._paramsIds[h]] = g;
});
});
}
return routeParams;
},
getRouteParam: function(key) {
var oController = this;
return oController.getRouteParams()[key];
},
_flattenAttributes: function(attributes) {
return underscoreJS.object(underscoreJS.pluck(attributes, "NAME"), underscoreJS.pluck(attributes, "VALUE"));
},
onMenuItemSelected: function (sectionID, actionObject, rowData, urlParams) {
var oController = this;
if(actionObject['FNCNM'] == "NAVG"){
var infocusModel = oController.getModel(oController.modelName);
var uiprofile = urlParams['$SELMNITM'];
var org = window.location.origin;
var pName = window.location.pathname;
var regEx = new RegExp("bdom", "ig");
if(pName.search(regEx)){
pName = pName.replace(regEx,"bdosnp");
}else{
pName = "/sap/bc/ui5_ui5/vui/bdosnp/index.html"
}
var search = '?uiprofile=' + uiprofile + '&donum=' + oController.selectedDocument + '&action=search#?mode=CHANGE';
var lct = org + pName + search;
window.open(lct);
}
},
_prepareButtonControl: function(object, sectionID, fromToolBar) {
var oController = this,
oButtonControl,
prepareInvisibleControl,
visible,
oType,
priority,
buttonType,
buttonConfig,
showIcon,
dmode,
index,
funcIndex;
var mainModel = oController.getModel(vui5.modelName);
var model = oController.getModel(oController.modelName);
var path = oController._getPath(true);
dmode = mainModel.getProperty("/DOCUMENT_MODE") || vui5.cons.mode.display;
oType = sap.m.ButtonType.Transparent;
if (object['BTNTP'] == vui5.cons.buttonType.menuButton) {
if (!underscoreJS.isEmpty(object['MNITM'])) {
var sMenu = [];
priority = object['FNDTP'] === global.vui5.cons.func.showInList ? sap.m.OverflowToolbarPriority.AlwaysOverflow : sap.m.OverflowToolbarPriority.High;
`sap.ui.define(["vistex/ui/core/BaseController",
"vistex/ui/core/global",
"vistex/ui/core/commonUtils",
"sap/ui/comp/variants/VariantItem"],
function (Controller,global,commonUtils,VariantItem) {
"use strict";
return Controller.extend(vui5.app +".bdoutilities.Controllers.BaseController", {
getRouter : function(){
return sap.ui.core.UIComponent.getRouterFor(this);
},
onNavBack : function() {
// var history;//previousHash;
// history = History.getInstance();
//previousHash = history.getPreviousHash();
window.history.go(-1);
//parent.window.frameElement.contentWindow.history.back();
},
getModel : function(sName){
return this.getView().getModel(sName);
},
showAllButtons: function(show){
var mainModel = this.getModel(vui5.modelName);
var changeMode = mainModel.getProperty("/CHANGE_MODE");
mainModel.setProperty("/DELETEMODE",!show);
mainModel.setProperty("/SHOWBUTTONS",changeMode && show);
},
onValueHelpRequest: function (oEvent) {
// jQuery.sap.require("globalUtilsPath/Fragments/InputHelp");
var oController = this;
var mainModel = oController.getModel(vui5.modelName);
var src = oEvent.getSource();
var _inputHelpID = src.getId();
var modelName = src.data("model");
var path = src.data("path");
var supportRangesOnly = false;
// Support F4 with filtered Values when User Pressing Show All Items
var fromSuggestions = oEvent.getParameters("fromSuggestions").fromSuggestions;
if(src.data("SUPPORTRANGESONLY"))
supportRangesOnly = true;
if(modelName && path) {
var model = src.getModel(modelName);
var fieldInfo = model.getProperty(path);
var dataArea = src.data("dataArea");
mainModel.setProperty("/INPUTHELP/FLDNAME",fieldInfo['FLDNAME']);
mainModel.setProperty("/INPUTHELP/MULTISELECT",fieldInfo['MULTISELECT']);
mainModel.setProperty("/INPUTHELP/FIELDID",_inputHelpID);
mainModel.setProperty("/INPUTHELP/TABNAME",fieldInfo['TABNAME']);
mainModel.setProperty("/INPUTHELP/LABEL",fieldInfo['LABEL']);
mainModel.setProperty("/INPUTHELP/SHLPNAME",fieldInfo['SHLPNAME']);
mainModel.setProperty("/INPUTHELP/TXTFL", fieldInfo['TXTFL']);
mainModel.setProperty("/INPUTHELP/DEPFL", fieldInfo['DEPFL']);
mainModel.setProperty("/INPUTHELP/DATAR",dataArea);
mainModel.setProperty("/INPUTHELP/SUPPORTRANGESONLY", supportRangesOnly);
mainModel.setProperty("/INPUTHELP/DATATYPE", fieldInfo['DATATYPE']);
mainModel.setProperty("/INPUTHELP/INTTYPE", fieldInfo['INTTYPE']);
mainModel.setProperty("/INPUTHELP/OUTPUTLEN", fieldInfo['OUTPUTLEN']);
/ESP4 QA issue #6352 Passing Rollname for Inputhelp/
mainModel.setProperty("/INPUTHELP/ROLLNAME", fieldInfo['ROLLNAME']);
/******/
// Support F4 with filtered Values when User Pressing Show All Items
mainModel.setProperty("/INPUTHELP/TYPEAHEAD_ACTIVE",fromSuggestions);
// mainModel.setProperty("/INPUTHELP/MULTISELECT",fieldInfo['MULTISELECT']);
mainModel.setProperty("/INPUTHELP/FIELDID",_inputHelpID);
// mainModel.setProperty("/INPUTHELP/TABNAME",fieldInfo['TABNAME']);
mainModel.setProperty("/INPUTHELP/LABEL",fieldInfo['LABEL']);
// mainModel.setProperty("/INPUTHELP/SHLPNAME",fieldInfo['SHLPNAME']);
mainModel.setProperty("/INPUTHELP/TXTFL", fieldInfo['TXTFL']);
// mainModel.setProperty("/INPUTHELP/DEPFL", fieldInfo['DEPFL']);
// mainModel.setProperty("/INPUTHELP/DATAR",dataArea);
// mainModel.setProperty("/INPUTHELP/SUPPORTRANGESONLY", supportRangesOnly);
mainModel.setProperty("/INPUTHELP/DATATYPE", fieldInfo['DATATYPE']);
mainModel.setProperty("/INPUTHELP/INTTYPE", fieldInfo['INTTYPE']);
mainModel.setProperty("/INPUTHELP/OUTPUTLEN", fieldInfo['OUTPUTLEN']);
/ESP4 QA issue #6352 Passing Rollname for Inputhelp/
var _oRangeHelpDialog = sap.ui.jsfragment("bdoUtilsPath" + ".fragments.RangeHelp",oController);
_oRangeHelpDialog.setModel(oController.getModel(vui5.modelName),vui5.modelName);
}else{
mainModel.setProperty("/INPUTHELP","");
}
// var oController = this;
// var mainModel = oController.getModel(vui5.modelName);
// var modelName = mainModel.getProperty("/MODELNAME");
var type = oEvent.getParameter("type");
if(type != undefined && type == "tokensChanged"){
var oSource = oEvent.getSource();
var fieldPath = oSource.data('path');
var model = oSource.getModel(oSource.data('model'));
var fieldInfo = model.getProperty(fieldPath);
// text = sap.ui.getCore().byId(source.getAriaLabelledBy()[0]).getText();
/QA Issue 7022 Changes - END/
}
}
var bundle = source.getModel("i18n").getResourceBundle();
var errorText = bundle.getText("EnterValid",[text]);
source.setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
source.getId() + "/value" );
deffered.resolve(false);
}else{
source.setValueState(sap.ui.core.ValueState.None);
source.setValueStateText('');
oController.handleCheckFieldsMessages(
"",
"",
source.getId() + "/value" );
var dataArea = source.data("dataArea");
/Fill Description from Buffer/
var mainModel = this.getModel(vui5.modelName);
var descriptionBuffer = mainModel.getProperty("/DESCRIPTION_BUFFER");
var bufferEntry = underscoreJS.find(descriptionBuffer,{
'FLDNAME' : fieldInfo['FLDNAME'],
'TABNAME' : fieldInfo['TABNAME'],
'FLDVAL' : newValue
});
var oBinding = source.getBinding("value");
var path;
if(oBinding.getContext()) {
path = oBinding.getContext().getPath() + "/" + oBinding.getPath();
}else{
path = oBinding.getPath();
}
if(bufferEntry){
this.fillDescription(model,path,fieldInfo,bufferEntry['DESCRIPTION'],newValue);
/* Multiple Change Event Issue Changes /
deffered.resolve(true);
}else{
var arr = path.split("/");
var fieldname = arr[arr.length-1];
var rsparams = [];
if( underscoreJS.isArray(fieldInfo['DEPFL']) && fieldInfo['DEPFL'].length > 0 ){
for(var i=0;i < fieldInfo['DEPFL'].length ; i++) {
var depflPath = path.replace(fieldname,fieldInfo['DEPFL'][i]);
var depflData = model.getProperty(depflPath);
rsparams.push({
"SHLPNAME" : "",
"SHLPFIELD" : fieldInfo['DEPFL'][i],
"SIGN" : vui5.cons.seloptSign.include,
"OPTION" : "EQ",
"LOW" : depflData,
"HIGH" : ""
});
}
}
var data = [];
var params = [];
params.push({ NAME : "FIELDVALUE" , VALUE : newValue });
params.push({ NAME : "FIELDNAME" , VALUE : fieldInfo['FLDNAME'] });
params.push({ NAME : "TABLENAME" , VALUE : fieldInfo['TABNAME'] });
params.push({ NAME : "CONVEXIT" , VALUE : fieldInfo['CONVEXIT'] });
params.push({ NAME : "NRART" , VALUE : fieldInfo['NRART'] });
params.push({ NAME : "DATAAREA" , VALUE : dataArea });
params.push({ NAME : "CHECK_VALUE" , VALUE : checkValue });
params.push({ NAME : "GET_DESCR" , VALUE : getDescription });
data.push({
"DATA": rsparams,
"PARAMS": params,
"DTAREA": "FIELD_CHECK",
"EVENT": "READ"
});
$.when(this.callServer({ // callDescriptionServer
data: data,
reqType: vui5.cons.reqType.post,
NoLoader : true
})).then(function(result) {
if(result){
var path;
var response = underscoreJS.find(result,{DTAREA: "FIELD_CHECK", EVENT: "READ"});
if(response) {
if(checkValue == 'X'){
if(response['RESULT']['VALUE_NOT_FOUND'] == 'X'){
source.setValueState(sap.ui.core.ValueState.Error);
var text;
if(source.getParent().getAggregation("label")){
// in case of form
text = source.getParent().getAggregation("label").getText();
}else{
if(source.data("sap-ui-colid")){
// non responsive table
text = sap.ui.getCore().byId(source.data("sap-ui-colid")).getAggregation("label").getText();
}else{
// m.Table
/QA Issue 7022 Changes - START/
var ariaLabelledBy = source.getAriaLabelledBy();
for(var i=0; i < ariaLabelledBy.length ; i++){
var textElement = sap.ui.getCore().byId(ariaLabelledBy[i]);
if(textElement){
text = textElement.getText();
break;
}
}
// text = sap.ui.getCore().byId(source.getAriaLabelledBy()[0]).getText();
/QA Issue 7022 Changes - END/
}
}
var bundle = source.getModel("i18n").getResourceBundle();
var errorText = bundle.getText("EnterValid",[text]);
source.setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
source.getId() + "/value" );
deffered.resolve(false);
}else{
source.setValueState(sap.ui.core.ValueState.None);
source.setValueStateText('');
oController.handleCheckFieldsMessages(
"",
"",
source.getId() + "/value" );
if(getDescription == 'X'){
if(oBinding.getContext()) {
path = oBinding.getContext().getPath() + "/" + oBinding.getPath();
}else{
path = oBinding.getPath();
}
oController.fillDescription(model,path,fieldInfo,response['RESULT']['DESCR'],newValue);
/ Multiple Change Event Issue Changes */
}
deffered.resolve(true);
}
}else if(getDescription == 'X'){
// mainModel.setProperty("/TYPEAHEAD/FIELDS",response['RESULT']['RESULT_FCAT']);
if(response['RESULT']['RESULT_FCAT']) {
var length = response['RESULT']['RESULT_FCAT'].length;
var width = (length + 1) * 10 ;
if(width > 90)
width = 90;
width = width + "%";
source.setMaxSuggestionWidth(width);
}
typeAhead[fieldInfo['FLDNAME']]['DATA'] = response['RESULT']['RESULT_DATA'];
typeAhead[fieldInfo['FLDNAME']]['RETURNFIELD'] = response['RESULT']['RETFIELD'];
typeAhead[fieldInfo['FLDNAME']]['DESCRFIELD'] = response['RESULT']['DESCRFIELD'];
mainModel.setProperty("/TYPEAHEAD",typeAhead);
}
}
});
},
handleSuggestionItemSelected : function(oEvent) {
var source = oEvent.getSource();
var model = source.getModel(source.data("model"));
var fieldInfo = model.getProperty(source.data("path"));
var item = oEvent.getParameter("selectedRow");
var rowData = item.getBindingContext(vui5.modelName).getObject();
var mainModel = this.getModel(vui5.modelName);
var returnField = mainModel.getProperty("/TYPEAHEAD/"+ fieldInfo['FLDNAME'] + "/RETURNFIELD");
var descrField = mainModel.getProperty("/TYPEAHEAD/"+ fieldInfo['FLDNAME'] + "/DESCRFIELD");
source.setValue(rowData[returnField]);
/Description Buffer Changes/
if(descrField && descrField != '') {
var descriptionBuffer = mainModel.getProperty("/DESCRIPTION_BUFFER");
var bufferEntry = underscoreJS.find(descriptionBuffer,{'FLDNAME' : fieldInfo['FLDNAME'],
'TABNAME' : fieldInfo['TABNAME'],
'FLDVAL' : rowData[returnField] });
if(bufferEntry){
bufferEntry['DESCRIPTION'] = rowData[descrField];
}else{
descriptionBuffer.push({
'FLDNAME' : fieldInfo['FLDNAME'],
'TABNAME' : fieldInfo['TABNAME'],
'FLDVAL' : rowData[returnField] ,
'DESCRIPTION' : rowData[descrField]});
}
}
source.fireChange();
},
onCheckBoxSelect : function(oEvent) {
var source = oEvent.getSource();
var path;
if(source.getBindingContext(source.data("model"))) {
path = source.getBindingContext(source.data("model")).getPath();
path = path + "/" + source.getBinding("selected").getBindings()[0].getPath();
}else{
path = source.getBinding("selected").getBindings()[0].getPath();
}
var model = source.getModel(source.data("model"));
if(oEvent.getParameter("selected"))
model.setProperty(path,'X');
else
model.setProperty(path,'');
},
handleAmountConversion : function(oEvent) {
var oController = this;
var source = oEvent.getSource();
oController.performAmountConversion(source);
},
performDecimalConversion : function(source){
var oController = this;
var newValue = source.getValue();
var oBinding = source.getBinding("value");
var model = oBinding.getModel();
/* Multiple Change Event Issue Changes /
/QA Issue 7022 Changes - START/
var deffered = $.Deferred();
var path;
if(oBinding.getContext()) {
path = oBinding.getContext().getPath() + "/" + oBinding.getPath();
}else{
path = oBinding.getPath();
}
var fieldname = source.data("FLDNAME");
var tablename = source.data("TABNAME");
var decimalField = [{ 'FLDNAME' : fieldname, 'TABNAME' : tablename , 'VALUE' : newValue }];
var data = [];
// var params = [];
data.push({
"DATA": decimalField,
"PARAMS": [],
"DTAREA": "CONVERSION",
"EVENT": ""
});
$.when(this.callServer({
data: data,
reqType: vui5.cons.reqType.post,
NoLoader : true
})).then(function(result) {
var error = false;
if(result){
var response = underscoreJS.find(result,{DTAREA: "CONVERSION"});
if(response && response['RESULT']['DATA']) {
underscoreJS.each(response['RESULT']['DATA'] , function(obj) {
model.setProperty(path,obj['VALUE']);
if(obj['ERROR'] != '') {
source.setValueState(sap.ui.core.ValueState.Error);
source.setValueStateText(obj['MESSAGE']);
oController.handleCheckFieldsMessages(
obj['MESSAGE'],
sap.ui.core.MessageType.Error,
source.getId() + "/value" );
error = true;
}else{
source.setValueState(sap.ui.core.ValueState.None);
source.setValueStateText("");
oController.handleCheckFieldsMessages(
"",
"",
source.getId() + "/value" );
}
});
}
}
/ Multiple Change Event Issue Changes /
if(error)
deffered.resolve(false);
else
deffered.resolve(true);
});
/ Multiple Change Event Issue Changes */
return deffered.promise();
/QA Issue 7022 Changes - END/
},
performAmountConversion : function(source){
var oController = this;
var newValue = source.getValue();
// check value
/QA Issue 7022 Changes - START/
var deffered = $.Deferred();
// if(currency) {
/* Multiple Change Event Issue Changes */
// var deffered = $.Deferred();
// }
}else{
source.setValueState(sap.ui.core.ValueState.Error);
var text;
if(source.getParent().getAggregation("label")){
text = source.getParent().getAggregation("label").getText();
}else if(source.getParent().getTitle()){
text = source.getParent().getTitle();
text = text.substr(5,text.length);
}else{
if(source.data("sap-ui-colid")){
// non responsive table
text = sap.ui.getCore().byId(source.data("sap-ui-colid")).getAggregation("label").getText();
}else{
// m.Table
/QA Issue 7022 Changes - START/
var ariaLabelledBy = source.getAriaLabelledBy();
for(var i=0; i < ariaLabelledBy.length ; i++){
var textElement = sap.ui.getCore().byId(ariaLabelledBy[i]);
if(textElement){
text = textElement.getText();
break;
}
}
// text = sap.ui.getCore().byId(source.getAriaLabelledBy()[0]).getText();
/QA Issue 7022 Changes - END/
}
}
var bundle = source.getModel("i18n").getResourceBundle();
var errorText = bundle.getText("EnterValid",[text]);
source.setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
source.getId() + "/value" );
// text = sap.ui.getCore().byId(obj['CONTROL'].getAriaLabelledBy()[0]).getText();
/QA Issue 7022 Changes - END/
}
}
// var text = obj['CONTROL'].getParent().getAggregation("label").getText();
var bundle = obj['CONTROL'].getModel("i18n").getResourceBundle();
var errorText = bundle.getText("EnterValid",[text]);
obj['CONTROL'].setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
obj['CONTROL'].getId() + "/value" );
}
});
if(currency && amount.length > 0) {
/* Multiple Change Event Issue Changes /
// var deffered = $.Deferred();
var data = [];
var params = [];
params.push({ NAME : "CURRENCY" , VALUE : currency });
data.push({
"DATA": amount,
"PARAMS": params,
"DTAREA": "CONVERSION",
"EVENT": ""
});
$.when(this.callServer({
data: data,
reqType: vui5.cons.reqType.post,
NoLoader : true
})).then(function(result) {
var error = false;
if(result){
var response = underscoreJS.find(result,{DTAREA: "CONVERSION"});
if(response && response['RESULT']['DATA']) {
underscoreJS.each(response['RESULT']['DATA'] , function(obj) {
model.setProperty(path + obj['TXTFL'],obj['VALUE']);
var oControl ;
if(obj['ERROR'] != '') {
oControl = underscoreJS.find(fields,{
'FLDNAME' : obj['FLDNAME'],
'TABNAME' : obj['TABNAME']});
if(oControl){
oControl['CONTROL'].setValueState(sap.ui.core.ValueState.Error);
oControl['CONTROL'].setValueStateText(obj['MESSAGE']);
oController.handleCheckFieldsMessages(
obj['MESSAGE'],
sap.ui.core.MessageType.Error,
oControl['CONTROL'].getId() + "/value" );
}
error = true;
}else{
oControl = underscoreJS.find(fields,{
'FLDNAME' : obj['FLDNAME'],
'TABNAME' : obj['TABNAME']});
if(oControl){
oControl['CONTROL'].setValueState(sap.ui.core.ValueState.None);
oControl['CONTROL'].setValueStateText("");
oController.handleCheckFieldsMessages(
"",
"",
oControl['CONTROL'].getId() + "/value" );
}
}
});
}
}
/ Multiple Change Event Issue Changes /
if(error || errorExist)
deffered.resolve(false);
else
deffered.resolve(true);
});
/ Multiple Change Event Issue Changes */
// if(unit) {
/* Multiple Change Event Issue Changes /
// var deffered = $.Deferred();
var path;
if(oBinding.getContext()) {
path = oBinding.getContext().getPath() + "/" + oBinding.getPath();
}else{
path = oBinding.getPath();
}
var fieldname = source.data("FLDNAME");
var tablename = source.data("TABNAME");
var quantity = [{ 'FLDNAME' : fieldname, 'TABNAME' : tablename , 'VALUE' : newValue }];
var data = [];
var params = [];
params.push({ NAME : "UNIT" , VALUE : unit });
data.push({
"DATA": quantity,
"PARAMS": params,
"DTAREA": "CONVERSION",
"EVENT": ""
});
$.when(this.callServer({
data: data,
reqType: vui5.cons.reqType.post,
NoLoader : true
})).then(function(result) {
var error = false;
if(result){
var response = underscoreJS.find(result,{DTAREA: "CONVERSION"});
if(response && response['RESULT']['DATA']) {
underscoreJS.each(response['RESULT']['DATA'] , function(obj) {
model.setProperty(path,obj['VALUE']);
if(obj['ERROR'] != '') {
source.setValueState(sap.ui.core.ValueState.Error);
source.setValueStateText(obj['MESSAGE']);
oController.handleCheckFieldsMessages(
obj['MESSAGE'],
sap.ui.core.MessageType.Error,
source.getId() + "/value" );
error = true;
}else{
source.setValueState(sap.ui.core.ValueState.None);
source.setValueStateText("");
oController.handleCheckFieldsMessages(
"",
"",
source.getId() + "/value" );
}
});
}
}
/ Multiple Change Event Issue Changes /
if(error)
deffered.resolve(false);
else
deffered.resolve(true);
});
/ Multiple Change Event Issue Changes */
// }
}else{
source.setValueState(sap.ui.core.ValueState.Error);
var text;
if(source.getParent().getAggregation("label")){
text = source.getParent().getAggregation("label").getText();
}else if(source.getParent().getTitle()){
text = source.getParent().getTitle();
text = text.substr(5,text.length);
}else{
if(source.data("sap-ui-colid")){
// non responsive table
text = sap.ui.getCore().byId(source.data("sap-ui-colid")).getAggregation("label").getText();
}else{
// m.Table
/QA Issue 7022 Changes - START/
var ariaLabelledBy = source.getAriaLabelledBy();
for(var i=0; i < ariaLabelledBy.length ; i++){
var textElement = sap.ui.getCore().byId(ariaLabelledBy[i]);
if(textElement){
text = textElement.getText();
break;
}
}
// text = sap.ui.getCore().byId(source.getAriaLabelledBy()[0]).getText();
/QA Issue 7022 Changes - END/
}
}
// var text = source.getParent().getAggregation("label").getText();
var bundle = source.getModel("i18n").getResourceBundle();
var errorText = bundle.getText("EnterValid",[text]);
source.setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
source.getId() + "/value" );
deffered.resolve(false);
}
return deffered.promise();
},
checkQuantityValue : function(value) {
var regex;
var oController = this;
var mainModel = this.getModel(vui5.modelName);
var decimalNotation = mainModel.getProperty("/LOGIN/DECIMALNOTATION");
// text = sap.ui.getCore().byId(obj['CONTROL'].getAriaLabelledBy()[0]).getText();
/QA Issue 7022 Changes - END/
}
}
// var text = obj['CONTROL'].getParent().getAggregation("label").getText();
var bundle = obj['CONTROL'].getModel("i18n").getResourceBundle();
var errorText = bundle.getText("EnterValid",[text]);
obj['CONTROL'].setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
obj['CONTROL'].getId() + "/value" );
}
});
if(unit && quantity.length > 0) {
/* Multiple Change Event Issue Changes /
// var deffered = $.Deferred();
var data = [];
var params = [];
params.push({ NAME : "UNIT" , VALUE : unit });
data.push({
"DATA": quantity,
"PARAMS": params,
"DTAREA": "CONVERSION",
"EVENT": ""
});
$.when(this.callServer({
data: data,
reqType: vui5.cons.reqType.post,
NoLoader : true
})).then(function(result) {
var error = false;
if(result){
var response = underscoreJS.find(result,{DTAREA: "CONVERSION"});
if(response && response['RESULT']['DATA']) {
underscoreJS.each(response['RESULT']['DATA'] , function(obj) {
model.setProperty(path + obj['TXTFL'],obj['VALUE']);
var oControl ;
if(obj['ERROR'] != '') {
oControl = underscoreJS.find(fields,{
'FLDNAME' : obj['FLDNAME'],
'TABNAME' : obj['TABNAME']});
if(oControl){
oControl['CONTROL'].setValueState(sap.ui.core.ValueState.Error);
oControl['CONTROL'].setValueStateText(obj['MESSAGE']);
oController.handleCheckFieldsMessages(
obj['MESSAGE'],
sap.ui.core.MessageType.Error,
oControl['CONTROL'].getId() + "/value" );
}
error = true;
}else{
oControl = underscoreJS.find(fields,{
'FLDNAME' : obj['FLDNAME'],
'TABNAME' : obj['TABNAME']});
if(oControl){
oControl['CONTROL'].setValueState(sap.ui.core.ValueState.None);
oControl['CONTROL'].setValueStateText("");
oController.handleCheckFieldsMessages(
"",
"",
oControl['CONTROL'].getId() + "/value" );
}
}
});
}
}
/ Multiple Change Event Issue Changes /
if(error || errorExist)
deffered.resolve(false);
else
deffered.resolve(true);
});
/ Multiple Change Event Issue Changes */
// var filterBarModel = this.getModel("VUI_FILTERBAR");
var oController = this,promise, objDefer = $.Deferred();;
var oFilter = oController.sectionRef[sectionID].oFilter;
var model = oController.getModel(oController.modelName);
var variantDataPath = oFilter.getVariantDataPath();
var variantData = model.getProperty(variantDataPath);
switch(actionObject['FNCNM']){
case "VARMNT":
var lt_rsparams = oController.prepareVariantsData(oFilter);
var inserted = underscoreJS.find(variantData,{'UPDKZ': 'I'});
var data = [];
var params = [];
if(inserted){
var insertingData = true;
var headerData = JSON.parse(JSON.stringify(inserted));
if(headerData){
delete headerData.FLDPPTY;
headerData['SRCHP'] = vui5.uiProfile;
headerData['UPDKZ'] = '';
}
tableSection['DAPPT']);
// if(!oController.sectionRef[section['SECTN']]){
if (section['TBTYP'] == global.vui5.cons.tableType.responsive) {
jQuery.sap.require("bdoUtilsPath/Controls/BdoResponsiveTable");
oController.sectionRef[section['SECTN']] = new bdo.utility.BdoResponsiveTable({
sectionID: section['SECTN'],
controller: oController,
modelName: oController.modelName,
fieldPath: sectionModelPath + "/FIELDS/",
dataPath: dataPath + section['DATAR'] + "/",
dataAreaPath: sectionModelPath + "/DATAR/",
// layoutDataPath: dataPath + section['DATAR'] + global.vui5.cons.nodeName.layout + "/",
layoutDataPath: dataPath + section['DATAR'] + "/",
variantDataPath: dataPath + section['DATAR'] + global.vui5.cons.nodeName.variant + "/",
selectedVariant: "/SECCFG/" + section['SECTN'] + "/attributes/" + global.vui5.cons.attributes.selectedVariant,
totalNumberOfRows: "/SECCFG/" + section['SECTN'] + "/attributes/" + global.vui5.cons.attributes.maxItems,
showTitle: true,
growingScrollToLoad: true,
rememberSelections: false,
listItemType: oListItemType,
enableSearchAndReplace: enableSearchAndReplace,
enableSetValues: enableSetValues,
uiProfile: oController.getProfileInfo()['UIPRF'],
fullScreen: oController.getBindingExpression("fullScreen", section, index),
backendSortFilter: oController.getBindingExpression("backendSortFilter", section, index),
handle: oController.getBindingExpression("handle", section, index),
visible: oController.getBindingExpression('visible', section, index),
title: oController.getBindingExpression("title",section, index),
editable: oController.getBindingExpression("editable", section, index),
enableLocalSearch: oController.getBindingExpression("enableLocalSearch", section, index),
enablePersonalization: oController.getBindingExpression("enablePersonalization", section, index),
enablePersonalization: true,
pagingType: oController.getBindingExpression("pageType", section, index),
pagingThreshold: oController.getBindingExpression("pageSize", section, index),
onValueHelpRequest: oController.onValueHelpRequest.bind(oController, sectionID),
onItemSelect : [oController.onItemNavigation, oController],
onRowButtonPressed : [oController.onRowButtonPressed, oController],
onFullScreen: function (oEvent) {
oController.processFullScreen(sectionID, oEvent.getParameter("fullScreen"));
},
variantSelect: function (oEvent) {
callBack = oEvent.getParameter("callBack");
oController.processAction.call(oController, sectionID, sectionConfig.onVariantSelect, oEvent.getParameter("record")).then(function () {
if (callBack && callBack instanceof Function) {
callBack();
}
});
},
variantSave: function (oEvent) {
callBack = oEvent.getParameter("callBack");
oController.processAction.call(oController, sectionID, sectionConfig.onVariantMaintain, null, oEvent.getParameter("urlParams")).then(function () {
if (callBack && callBack instanceof Function) {
callBack();
}
});
},
layoutManage: function (oEvent) {
callBack = oEvent.getParameter("callBack");
oController.tableLayoutManage.call(oController, sectionID, sectionConfig.onLayoutManage).then(function () {
if (callBack && callBack instanceof Function) {
callBack();
}
});
},
pageChange: function (oEvent) {
oController.processAction.call(oController, sectionID, sectionConfig.onPageChange, null, oEvent.getParameter("urlParams"));
},
onExport: function (oEvent) {
var object = oEvent.getParameter('object');
object['DARID'] = section['DARID'];
callBack = oEvent.getParameter("callBack");
oController.exportAllData.call(oController, sectionID, object).then(function () {
if (callBack && callBack instanceof Function) {
callBack();
}
});
},
onSetValues: function (oEvent) {
callBack = oEvent.getParameter("callBack");
oController.processAction.call(oController, sectionID, sectionConfig.onSetValues).then(function () {
if (callBack && callBack instanceof Function) {
callBack();
}
});
},
onSetValuesApply: function () {
oController.processAction.call(oController, sectionID, sectionConfig.onSetValuesApply).then(function () {
oController._setValuesAction = undefined;
});
// layoutDataPath: dataPath + section['DATAR'] + global.vui5.cons.nodeName.layout + "/",
layoutDataPath: sectionModelPath,
variantDataPath: dataPath + section['DATAR'] + global.vui5.cons.nodeName.variant + "/",
selectedVariant: "/SECCFG/" + section['SECTN'] + "/attributes/" + global.vui5.cons.attributes.selectedVariant,
enableSearchAndReplace: enableSearchAndReplace,
enableSetValues: enableSetValues,
showTitle: true,
enableColumnFreeze: true,
enableCustomFilter: true,
fullScreen: oController.getBindingExpression("fullScreen", section, index),
backendSortFilter: oController.getBindingExpression("backendSortFilter", section, index),
// pagingType should be set first
pagingType: oController.getBindingExpression("pageType", section, index),
numberOfPages: oController.getBindingExpression("totalNumberOfPages", section, index),
// title: oController.getBindingExpression("title",
// section, index),
pageSize: oController.getBindingExpression("pageSize", section, index),
enablePersonalization: oController.getBindingExpression("enablePersonalization", section, index),
handle: oController.getBindingExpression('handle', section, index),
visible: oController.getBindingExpression('visible', section, index),
// editable: oController.getBindingExpression("editable", section, index),
editable:"{= ${" + vui5.modelName + ">/DOCUMENT_MODE} === 'V' }",
enableLocalSearch: oController.getBindingExpression("enableLocalSearch", section, index),
// BDOAPP changes
hideDetailButton: false,
onDetailButton : [oController.onNRItemNavigation,oController],
hideBulkEditButton : false,
onBulkEditButton : [oController.onBulkEdit,oController],
cellClick : [oController.onPopover,oController],
onFieldClick : [oController.onPopover,oController],
onFullScreen: function (oEvent) {
oController.processFullScreen(sectionID, oEvent.getParameter("fullScreen"));
},
onValueHelpRequest: oController.onValueHelpRequest.bind(oController, sectionID), variantSelect: function (oEvent) {
callBack = oEvent.getParameter("callBack");
oController.processAction.call(oController, sectionID, sectionConfig.onVariantSelect, oEvent.getParameter("record")).then(function () {
if (callBack && callBack instanceof Function) {
callBack();
}
});
},
variantSave: function (oEvent) {
callBack = oEvent.getParameter("callBack");
oController.processAction.call(oController, sectionID, sectionConfig.onVariantMaintain, null, oEvent.getParameter("urlParams")).then(function () {
if (callBack && callBack instanceof Function) {
callBack();
}
});
},
layoutManage: function (oEvent) {
callBack = oEvent.getParameter("callBack");
oController.processAction.call(oController, sectionID, sectionConfig.onLayoutManage).then(function () {
if (callBack && callBack instanceof Function) {
callBack();
}
});
},
onExport: function (oEvent) {
var object = oEvent.getParameter('object');
object['DARID'] = section['DARID'];
callBack = oEvent.getParameter("callBack");
oController.exportAllData.call(oController, sectionID, object).then(function () {
if (callBack && callBack instanceof Function) {
callBack();
}
});
},
/pageChange: function (oEvent) {
oController.processAction.call(oController, sectionID, sectionConfig.onPageChange, null, oEvent.getParameter("urlParams"));
},/
pageChange:[oController.onNRServerSidePaging,oController],
onSetValues: function (oEvent) {
callBack = oEvent.getParameter("callBack");
oController.processAction.call(oController, sectionID, sectionConfig.onSetValues).then(function () {
if (callBack && callBack instanceof Function) {
callBack();
}
});
},
onSetValuesApply: function () {
oController.processAction.call(oController, sectionID, sectionConfig.onSetValuesApply).then(function () {
oController._setValuesAction = undefined;
});
// oController.sectionRef[section['SECTN']].attachRowSelectionChange(function (evt) {
// var record = evt.getSource().getBindingContext(oController.modelName).getObject();
// oController.processAction.call(oController, sectionID, sectionConfig.onRowSelect, record)
// });
}
oController.setSectionTitle(sectionModelFullPath + "/DESCR", oController.modelName + ">/SECCFG/" + section['SECTN'] + "/attributes/" + global.vui5.cons.attributes.maxItems, oController.sectionRef[section['SECTN']], section['DAPPT']);
// window.open(oUrl, "_self");
}
oController.attachmentInfocusSet(
global.vui5.cons.applnObject,
oController.selectedDocument,
infocusModel.getProperty("/UIPRF"),
sectionID,
section['DARID']);
objDefer.resolve();
});
break;
case vui5.cons.propertyType.notes:
var notesData = {};
notesData[section['DARID']] = _.reject(infocusModel.getProperty('/DATA/'+ section['DARID']), function(obj){
return (obj['UPDKZ_UI'] == undefined || obj['UPDKZ_UI'] == "");
});
if(infocusModel.getProperty("/TECHNICAL_DATA")){
var subobj = infocusModel.getProperty("/TECHNICAL_DATA/VERSN");
}
var params = [{
"NAME": "OBJTYP",
"VALUE": vui5.cons.applnObject
}, {
"NAME": "OBJKEY",
"VALUE": oController.selectedDocument
}, {
"NAME": "UIPRF",
"VALUE": infocusModel.getProperty("/UIPRF")
}, {
"NAME": "SUBOBJ",
"VALUE": subobj
}, {
"NAME": "SECTN",
"VALUE": oController.clickedTab
}, {
"NAME": "DMODE",
"VALUE": dmode
}];
// if(oInput.$().is(":visible") && oInput.getValue && oInput.getValue() == ''){
// oInput.setValueState(sap.ui.core.ValueState.Error); // if the field is empty after change, it will go red
// var text = oInput.getParent().getAggregation("label").getText();
// var bundle = oInput.getModel("i18n").getResourceBundle();
// var errorText = bundle.getText("Enter",[text]);
// oInput.setValueStateText(errorText);
// oController.handleCheckFieldsMessages(
// errorText,
// sap.ui.core.MessageType.Error,
// oInput.getId() + "/value" );
// error = true;
// if(index == 0){
// oInput.focus();
// }
// index++;
// }
var errorflag = false;
if(oInput.$().is(":visible") ) {
if( oInput.getSelectedKey && oInput.getSelectedItem ){
var item = oInput.getSelectedItem();
if(!item)
errorflag = true;
}else if(oInput.getValue && oInput.getValue() == ''){
errorflag = true;
}
if(errorflag) {
oInput.setValueState(sap.ui.core.ValueState.Error); // if the field is empty after change, it will go red
var text = oInput.getParent().getAggregation("label").getText();
var bundle = oInput.getModel("i18n").getResourceBundle();
var errorText = bundle.getText("Enter",[text]);
oInput.setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
oInput.getId() + "/value" );
error = true;
if(index == 0){
oInput.focus();
}
index++;
}
}
/Not Required, as it will clear error flag marked by other checks/
// else {
// oInput.setValueState(sap.ui.core.ValueState.None); // if the field is not empty after change, the value state (if any) is removed
// oInput.setValueStateText("");
// oController.handleCheckFieldsMessages(
// "",
// "",
// oInput.getId() + "/value" );
// }
});
}
return error;
},
messageDataPrepare : function(messages) {
var oController = this;
if(!this.oMessageProcessor){
this.oMessageProcessor = new sap.ui.core.message.ControlMessageProcessor();
}
var oMessageManager = sap.ui.getCore().getMessageManager();
oMessageManager.registerMessageProcessor(this.oMessageProcessor);
var messageModel = oMessageManager.getMessageModel();
messageModel.setSizeLimit(vui5.cons.maxDataLimit);
oMessageManager.removeAllMessages();
underscoreJS.each(messages,function(obj) {
var type;
switch(obj['MSGTY']){
case 'S' :
type = sap.ui.core.MessageType.Success;
break;
case 'I' :
type = sap.ui.core.MessageType.Information;
break;
case 'E' :
type = sap.ui.core.MessageType.Error;
break;
case 'W' :
type = sap.ui.core.MessageType.Warning;
break;
}
oMessageManager.addMessages(
new sap.ui.core.message.Message({
message: obj['MSGLI'],
type: type,
processor: oController.oMessageProcessor
})
);
});
},
handleMessageButtonPress: function (oEvent) {
var oController = this;
var oSource = oEvent.getSource();
if(!oController._messagePopover){
oController._messagePopover = sap.ui.jsfragment(global.vui5.ui.fragments.Messages,oController);
oSource.addDependent(oController._messagePopover);
jQuery.sap.syncStyleClass(oController.getOwnerComponent().getContentDensityClass(),
oController.getView(), oController.messagePopover);
}
oController.messagePopover.toggle(oSource);
},
loginDataSet : function(mainModel,response) {
if(response && response['RESULT']){
mainModel.setProperty("/LOGIN",response['RESULT']['DATA']);
/var dateFormat = mainModel.getProperty("/LOGIN/DATEFORMAT");
dateFormat = dateFormat.toLowerCase().replace('mm', 'MM');
mainModel.setProperty('/LOGIN/DATEFORMAT', dateFormat);/
vui5.session.extensionPath = mainModel.getProperty('/LOGIN/EXTENSIONPATH');
global.vui5.session.ccounter = global.vui5.session.maxTime = parseInt(mainModel.getProperty('/LOGIN/TIMEOUT'));
vui5.themeRoot = mainModel.getProperty('/LOGIN/THEME_ROOT');
commonUtils.applyTheme(response['RESULT']['DATA'].THEME);
}
},
checkFloatField : function(oEvent){
var oController = this;
var oSource = oEvent.getSource();
var value = oSource.getValue();
var regx;
var mainModel = oController.getModel(vui5.modelName);
var decimalNotation = mainModel.getProperty("/LOGIN/DECIMALNOTATION");
switch(decimalNotation){
case 'X':
regx = /^[-+]?[0-9](,\d{0,})?.?[0-9]+([eE][-+]?[0-9]+)?$/;
break;
case 'Y':
regx = /^[-+]?[0-9](\s\d{0,})?,?[0-9]+([eE][-+]?[0-9]+)?$/;
break;
default:
regx = /^[-+]?[0-9](.\d{0,})?,?[0-9]+([eE][-+]?[0-9]+)?$/;
break;
}
value = value.trim();
if(value && !regx.test(value)){
oSource.setValueState(sap.ui.core.ValueState.Error);
var text;
if(oSource.getParent().getAggregation("label")){
text = oSource.getParent().getAggregation("label").getText();
}else if(oSource.getParent().getTitle()){
text = oSource.getParent().getTitle();
text = text.substr(5,text.length);
}else{
if(oSource.data("sap-ui-colid")){
// non responsive table
text = sap.ui.getCore().byId(oSource.data("sap-ui-colid")).getAggregation("label").getText();
}else{
// m.Table
/QA Issue 7022 Changes - START/
var ariaLabelledBy = oSource.getAriaLabelledBy();
for(var i=0; i < ariaLabelledBy.length ; i++){
var textElement = sap.ui.getCore().byId(ariaLabelledBy[i]);
if(textElement){
text = textElement.getText();
break;
}
}
// text = sap.ui.getCore().byId(oSource.getAriaLabelledBy()[0]).getText();
/QA Issue 7022 Changes - END/
}
}
// var text = source.getParent().getAggregation("label").getText();
var bundle = oSource.getModel("i18n").getResourceBundle();
var errorText = bundle.getText("EnterValid",[text]);
oSource.setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
oSource.getId() + "/value" );
}else{
oSource.setValueState(sap.ui.core.ValueState.None);
oSource.setValueStateText('');
oController.handleCheckFieldsMessages(
"",
"",
oSource.getId() + "/value" );
}
},
checkNumericField : function(oEvent){
var oController = this;
var source = oEvent.getSource();
var value;
if(oEvent.oSource.$input[0]['attributes']['role'] && oEvent.oSource.$input[0]['attributes']['role']['nodeValue'] === 'combobox'){
value = source.getSelectedKey();
}else{
value = source.getValue();
}
var regex;
regex = /^[0-9]*$/;
var error;
// text = sap.ui.getCore().byId(source.getAriaLabelledBy()[0]).getText();
/QA Issue 7022 Changes - END/
}
}
// var text = source.getParent().getAggregation("label").getText();
var bundle = source.getModel("i18n").getResourceBundle();
var errorText = bundle.getText("EnterValid",[text]);
source.setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
source.getId() + "/value" );
error = true;
}else{
source.setValueState(sap.ui.core.ValueState.None);
source.setValueStateText('');
oController.handleCheckFieldsMessages(
"",
"",
source.getId() + "/value" );
error = false;
}
return error;
},
checkPackedField : function(oEvent) {
var oController = this;
var source = oEvent.getSource();
var value = source.getValue();
var regex;
var mainModel = oController.getModel(vui5.modelName);
var decimalNotation = mainModel.getProperty("/LOGIN/DECIMALNOTATION");
/QA Issue 7022 Changes/
regex = oController.getDecimalNotationRegex(decimalNotation);
// var text = source.getParent().getAggregation("label").getText();
var text;
if(source.getParent().getAggregation("label")){
text = source.getParent().getAggregation("label").getText();
}else if(source.getParent().getTitle()){
text = source.getParent().getTitle();
text = text.substr(5,text.length);
}else{
if(source.data("sap-ui-colid")){
// non responsive table
text = sap.ui.getCore().byId(source.data("sap-ui-colid")).getAggregation("label").getText();
}else{
// m.Table
/QA Issue 7022 Changes - START/
var ariaLabelledBy = source.getAriaLabelledBy();
for(var i=0; i < ariaLabelledBy.length ; i++){
var textElement = sap.ui.getCore().byId(ariaLabelledBy[i]);
if(textElement){
text = textElement.getText();
break;
}
}
// text = sap.ui.getCore().byId(source.getAriaLabelledBy()[0]).getText();
/QA Issue 7022 Changes - END/
}
}
var bundle = source.getModel("i18n").getResourceBundle();
var errorText = bundle.getText("EnterValid",[text]);
source.setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
source.getId() + "/value" );
error = true;
}else{
source.setValueState(sap.ui.core.ValueState.None);
source.setValueStateText('');
oController.handleCheckFieldsMessages(
"",
"",
source.getId() + "/value" );
error = false;
}
return error;
},
checkIntegerField : function(oEvent) {
var oController = this;
var source = oEvent.getSource();
var value = source.getValue();
var regex;
regex = /^[0-9-]\d*(((,\d{1,}){0,})?)(([0-9-])?)$/ ;
var error;
value = value.trim();
if(value && !regex.test(value)){
source.setValueState(sap.ui.core.ValueState.Error);
var text;
if(source.getParent().getAggregation("label")){
text = source.getParent().getAggregation("label").getText();
}else if(source.getParent().getTitle()){
text = source.getParent().getTitle();
text = text.substr(5,text.length);
}else{
if(source.data("sap-ui-colid")){
// non responsive table
text = sap.ui.getCore().byId(source.data("sap-ui-colid")).getAggregation("label").getText();
}else{
// m.Table
/QA Issue 7022 Changes - START/
var ariaLabelledBy = source.getAriaLabelledBy();
for(var i=0; i < ariaLabelledBy.length ; i++){
var textElement = sap.ui.getCore().byId(ariaLabelledBy[i]);
if(textElement){
text = textElement.getText();
break;
}
}
// text = sap.ui.getCore().byId(source.getAriaLabelledBy()[0]).getText();
/QA Issue 7022 Changes - END/
}
}
// var text = source.getParent().getAggregation("label").getText();
var bundle = source.getModel("i18n").getResourceBundle();
var errorText = bundle.getText("EnterValid",[text]);
source.setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
source.getId() + "/value" );
error = true;
}else{
source.setValueState(sap.ui.core.ValueState.None);
source.setValueStateText('');
oController.handleCheckFieldsMessages(
"",
"",
source.getId() + "/value" );
error = false;
}
return error;
},
dateFieldCheck : function(oEvent) {
var oController = this;
var oSource = oEvent.getSource();
if(oEvent.getParameter("valid")){
oSource.setValueState(sap.ui.core.ValueState.None);
oSource.setValueStateText("");
oController.handleCheckFieldsMessages(
"",
"",
oSource.getId() + "/value" );
}else if(oEvent.getParameter("valid") == false){
oSource.setValueState(sap.ui.core.ValueState.Error);
var text;
if(oSource.getParent().getAggregation("label")){
text = oSource.getParent().getAggregation("label").getText();
}else if(oSource.getParent().getTitle()){
text = oSource.getParent().getTitle();
text = text.substr(5,text.length);
}else{
if(oSource.data("sap-ui-colid")){
// non responsive table
text = sap.ui.getCore().byId(oSource.data("sap-ui-colid")).getAggregation("label").getText();
}else{
// m.Table
/QA Issue 7022 Changes - START/
var ariaLabelledBy = oSource.getAriaLabelledBy();
for(var i=0; i < ariaLabelledBy.length ; i++){
var textElement = sap.ui.getCore().byId(ariaLabelledBy[i]);
if(textElement){
text = textElement.getText();
break;
}
}
// text = sap.ui.getCore().byId(oSource.getAriaLabelledBy()[0]).getText();
/QA Issue 7022 Changes - END/
}
}
// var text = source.getParent().getAggregation("label").getText();
var bundle = oSource.getModel("i18n").getResourceBundle();
var errorText = bundle.getText("EnterValid",[text]);
oSource.setValueStateText(errorText);
oController.handleCheckFieldsMessages(
errorText,
sap.ui.core.MessageType.Error,
oSource.getId() + "/value" );
}else{
var valid = oSource._bValid;
if(valid){
oSource.setValueState(sap.ui.core.ValueState.None);
oSource.setValueStateText("");
oController.handleCheckFieldsMessages(
"",
"",
oSource.getId() + "/value" );
}else{
oSource.setValueState(sap.ui.core.ValueState.Error);
var text;
if(oSource.getParent().getAggregation("label")){
// in case of form
text = oSource.getParent().getAggregation("label").getText();
}else{
if(oSource.data("sap-ui-colid")){
// non responsive table
text = sap.ui.getCore().byId(oSource.data("sap-ui-colid")).getAggregation("label").getText();
}else{
// m.Table
/QA Issue 7022 Changes - START/
var ariaLabelledBy = oSource.getAriaLabelledBy();
for(var i=0; i < ariaLabelledBy.length ; i++){
var textElement = sap.ui.getCore().byId(ariaLabelledBy[i]);
if(textElement){
text = textElement.getText();
break;
}
}
// text = sap.ui.getCore().byId(oSource.getAriaLabelledBy()[0]).getText();
/QA Issue 7022 Changes - END/
}
}
// index = underscoreJS.findIndex(model.getProperty(path), { SECTN: object['SECTN'] });
// funcIndex = underscoreJS.findIndex(model.getProperty(path + index + "/FUNC"), { FNCNM: object['FNCNM'] });
// var visible = "{=${" + oController.modelName + ">" + path + index + "/FUNC/" + funcIndex + "/HIDFN} === '' &&" + " ${" + oController.modelName + ">" + path + index + "/DISOL} === '' }";
// press: [oController.onFunctionPress,oController],
press: function(oEvent){
oEvent.getSource().data("SECTN",sectionID);
oEvent.getSource().data("FNCNM",object['FNCNM']);
oController.onFunctionPress(oEvent);
},
layoutData: new sap.m.OverflowToolbarLayoutData({
priority: priority
}),
visible: visible,
// visible: "{" + oController.modelName + ">/DATA/APTIT}"
};
if (priority == sap.m.OverflowToolbarPriority.AlwaysOverflow) {
buttonConfig['icon'] = object['FNICN'];
buttonConfig['text'] = object['DESCR'];
} else {
//showIcon ? buttonConfig['icon'] = object['FNICN'] : buttonConfig['text'] = object['DESCR'];
if (showIcon) {
buttonConfig['icon'] = object['FNICN'];
buttonConfig['text'] = object['DESCR'];
}
else {
buttonConfig['text'] = object['DESCR'];
}
}
return new buttonType(buttonConfig);
},
getMainModel: function() {
return this.getOwnerComponent().getModel(vui5.modelName);
},
_getBundleText: function(propertyName) {
var oController = this;
var bundle = oController.getOwnerComponent().getModel("i18n").getResourceBundle();
return bundle.getText(propertyName);
},
getViewContent: function(action) {
// "{= ${" + oController.modelName + ">" + path + index + "/HDSCT} === ''}";
tooltip: oController._getBundleText('Next'),
press: [oController.onSnappingAction, oController]
}).data("itemSwitch", "NEXT");
oController.navUpButton = new sap.m.Button({
icon: "sap-icon://navigation-up-arrow",
visible: false,
tooltip: oController._getBundleText('Previous'),
press: [oController.onSnappingAction, oController]
});
var pageObject;
pageObject = oController.pageObject = new sap.m.semantic.FullscreenPage({
// title: "page title",
title: "{" + vui5.modelName+ ">" + vui5.cons.modelPath.infocusUIPrf + "/DESCR}",
showNavButton: true,
messagesIndicator: msgBtn,
customHeaderContent: [oController.navUpButton, oController.navDownButton],
navButtonPress: [oController.handleNavButtonPress,oController]
});
// var currentKey = oController.getQueryParam('tab');
var currentKey = oController.clickedTab;
var currentModel = oController.getCurrentModel();
var scrollFlag;
var tabSections = tabRef.getSections(), currSection, currSectionId;
if (underscoreJS.isEmpty(tabSections)) {
return;
}
var flag = underscoreJS.find(tabSections, { sId: oController._currentSectionKey });
if (flag || oController.clickedTab) {
currSectionId = oController._currentSectionKey;
oController._subSectionSelectID = null;
}
else {
// currentTab = oController.getQueryParam("tab") || "";
// currSubSection = oController.getQueryParam("subsectn") || "";
// var subsection;
// var blocksArr = [];
// var objectPageSection = new sap.uxap.ObjectPageSection({
// // id:
// // oController.createId(contextObject['SECTN']),
// title: contextObject['DESCR'],
// titleUppercase: false,
// visible: oController.getBindingExpression("sectionVisible", contextObject, index)
// //visible: contextObject['HDSCT'] === '' && contextObject['SCGRP'] === ''
// }).data("id", contextObject['SECTN']);
// oController.showPanelContent(contextObject['SECTN']);
// if (!underscoreJS.isEmpty(contextObject['FILTER'])) {
// var oBlock = oController.addFilterContent(contextObject);
// if (!underscoreJS.isEmpty(oBlock)) {
// underscoreJS.each(oBlock, function(ob, i) {
// blocksArr.push(ob);
// });
// }
// }
// switchField = oController._prepareSwitchField();
// if (switchField) {
// blocksArr.push(switchField);
// }
// // blocksArr.push(oController.sectionRef[contextObject['SECTN']]);
// if (!underscoreJS.isEmpty(blocksArr)) {
// var vLayout = new sap.ui.layout.VerticalLayout({
// width: '100%',
// content: [blocksArr, oController.sectionRef[contextObject['SECTN']]]
// });
// subsection = new sap.uxap.ObjectPageSubSection({
// blocks: [vLayout]
// }).data("id", contextObject['SECTN']);
// }
// else {
// subsection = new sap.uxap.ObjectPageSubSection({
// blocks: oController.sectionRef[contextObject['SECTN']]
// }).data("id", contextObject['SECTN']);
// }
// if (currSubSection == contextObject["SECTN"]) {
// subSectionKey = subsection.getId();
// }
// objectPageSection.addSubSection(subsection);
// visible: oController.getBindingExpression("sectionVisible", contextObject, index)
//visible: contextObject['HDSCT'] === '' && contextObject['SCGRP'] === ''
}).data("id", contextObject['SECTN']);
oController.showPanelContent(contextObject['SECTN']);
// if (!underscoreJS.isEmpty(contextObject['FILTER'])) {
// var oBlock = oController.addFilterContent(contextObject);
// if (!underscoreJS.isEmpty(oBlock)) {
// underscoreJS.each(oBlock, function(ob, i) {
// blocksArr.push(ob)
// });
// }
// }
// switchField = oController._prepareSwitchField();
// if (switchField) {
// blocksArr.push(switchField);
// }
// blocksArr.push(oController.sectionRef[contextObject['SECTN']]);
if (!underscoreJS.isEmpty(blocksArr)) {
var vLayout = new sap.ui.layout.VerticalLayout({
width: '100%',
content: [blocksArr, oController.sectionRef[contextObject['SECTN']]]
});
// if (selectedSubSection === contextObject['SECTN']) {
// subSectionToSelect = subsection;
// scrollID = subsection.getId();
// }
objectPageSection.addSubSection(subsection);
// sectionConfig = oController.sectionConfig[sectionID];
jQuery.sap.require("bdoUtilsPath" + "/Controls/BdoSnappingHeader");
oController.sectionRef[sectionID] = new bdo.utility.snappingHeader({
controller: oController,
modelName: oController.modelName,
dropdownModel: vui5.modelName,
dataPath: dataPath + section['DARID'] + "/",
dataAreaPath: sectionModelPath + "/" + section['DARID'],
facetGroupsPath: sectionModelPath + '/FCTGRP/',
fieldsPath: sectionModelPath + "/FIELDS/",
// titlePath: "/DATA/OBHDR_TITLE/",
titlePath: dataPath + "OBHDR_TITLE/",
sectionPath:sectionModelPath
// breadCrumbLinkPress: [oController.processBreadCrumbLink, oController]
// oController.sectionRef[section['SECTN']].renderSummaryView();
// hasDrillDown = !sectionConfig.onDrillDownAction;
// hideDetailButton: hasDrillDown,
title: section['DESCR'],
// enablePersonalization: oController.getBindingExpression("enablePersonalization", section, index),
// handle: oController.getBindingExpression('handle', section, index),
// visible: oController.getBindingExpression('visible', section, index),
visible : true,
// totalNumberOfRows: oController.getBindingExpression("totalNumberOfRows", section, index),
// editable: oController.getBindingExpression("editable", section, index),
// enableLocalSearch: oController.getBindingExpression("enableLocalSearch", section, index),
// onPageChange: [oController.onNRServerSidePaging, oController]
});
tableRef.setSelectionMode(sap.ui.table.SelectionMode.None);
// if (hasDrillDown) {
// tableRef.attachOnDetailButton(function(evt) {
// oController.processAction.call(oController, sectionID, sectionConfig.onDrillDownAction, evt.getParameter('record'))
// });
// }
// if (object['BTNTP'] == vui5.cons.buttonType.menuButton) {
// if (!underscoreJS.isEmpty(object['MNITM'])) {
// var sMenu = [];
// funcIndex = underscoreJS.findIndex(model.getProperty(path + index + "/FUNC"), { FNCNM: object['FNCNM'] });
// var visible = "{=${" + oController.modelName + ">" + path + index + "/FUNC/" + funcIndex + "/HIDFN} === '' &&" + " ${" + oController.modelName + ">" + path + index + "/DISOL} === '' }";
// underscoreJS.each(object['MNITM'], function(obj) {
// var subactions = new sap.m.MenuItem({
// text: obj['VALUE'],
// key: obj['NAME']
// });
// sMenu.push(subactions);
// });
// var oMenu = new sap.m.Menu({
// items: sMenu,
// itemSelected: function(oEvt) {
// var params = {};
// var selectedAction = oEvt.getParameter('item');
// params['$SELMNITM'] = selectedAction.getKey();
// oController.processAction(sectionID, object, null, params)
// }
// });
// oButtonControl = new sap.m.MenuButton({
// menu: oMenu,
// icon: object['FNICN'],
// visible: visible
// });
// if (object['FDTYP'] == vui5.cons.functionDisplayType.text) {
// oButtonControl.setText(object['DESCR'])
// }
// }
// oController.sectionRef[sectionID].addToolBarButton(oButtonControl);
// }
// else {
oButtonControl = oController._prepareButtonControl(object, sectionID, true);
oController.sectionRef[sectionID].addToolBarButton(oButtonControl);
// var _currentEvent = $.extend(true,{},oEvent);
// var exportAll = oEvent.getParameter("exportAll");
var fieldPath = cfg.table.getFieldPath();
var infocusModel = oController.getModel(oController.modelName);
var mainModel = oController.getModel(vui5.modelName);
var fields = infocusModel.getProperty(fieldPath);
var sectionPath = cfg.table.getDataAreaPath().split('DATAR')[0];
var section = infocusModel.getProperty(sectionPath);
var downloadData = {
Data : [],
Columns : []
};
var tableData = {
COLUMNS : [],
SORT : [],
FILTER : []
};
// downloadData.Data = data['RESULT']['DATA'][section['DATAR']];
infocusModel.setProperty("/EXCEL_DATA",data['RESULT']['DATA'][section['DATAR']]);
}
objDefer.resolve();
});
});`
The text was updated successfully, but these errors were encountered: