Commit c504596c authored by Boris Kocherov's avatar Boris Kocherov Committed by Romain Courteaud

[erp5_only_office] jslint fix

parent 92624cd3
/*global AscCommonExcel, RSVP, Xmla, console*/
/* jshint -W040 */ /* jshint -W040 */
/* /*
* Copyright (c) 2017 Nexedi SA and Contributors. All Rights Reserved. * Copyright (c) 2017 Nexedi SA and Contributors. All Rights Reserved.
...@@ -38,9 +39,8 @@ ...@@ -38,9 +39,8 @@
* @param {Object} RSVP * @param {Object} RSVP
* @param {Xmla} Xmla * @param {Xmla} Xmla
* @param {console} console * @param {console} console
* @param {undefined} undefined
*/ */
function (window, RSVP, Xmla, console, undefined) { function (window, RSVP, Xmla, console) {
var cBaseFunction = AscCommonExcel.cBaseFunction; var cBaseFunction = AscCommonExcel.cBaseFunction;
var cFormulaFunctionGroup = AscCommonExcel.cFormulaFunctionGroup, var cFormulaFunctionGroup = AscCommonExcel.cFormulaFunctionGroup,
cElementType = AscCommonExcel.cElementType, cElementType = AscCommonExcel.cElementType,
...@@ -66,22 +66,6 @@ ...@@ -66,22 +66,6 @@
cFormulaFunctionGroup.NotRealised.push(cCUBEKPIMEMBER, cCUBEMEMBERPROPERTY, cCUBERANKEDMEMBER, cFormulaFunctionGroup.NotRealised.push(cCUBEKPIMEMBER, cCUBEMEMBERPROPERTY, cCUBERANKEDMEMBER,
cCUBESET, cCUBESETCOUNT); cCUBESET, cCUBESETCOUNT);
var xmla = new Xmla({
// listeners: {
// events: Xmla.EVENT_ERROR,
// handler: function (eventName, eventData, xmla) {
// console.log(eventData.exception);
// // alert(
// // "Snap, an error occurred: " + eventData.exception.message + " (" + eventData.exception.code + ")" +
// // (eventData.exception.code === Xmla.Exception.HTTP_ERROR_CDE
// // ? "\nstatus: " + eventData.exception.data.status + "; statusText: " + eventData.exception.data.statusText
// // : "")
// // );
// }
// },
async: true
});
function xmla_request(func, prop) { function xmla_request(func, prop) {
var xmla = new Xmla({async: true}); var xmla = new Xmla({async: true});
// return function () { // return function () {
...@@ -364,7 +348,7 @@ ...@@ -364,7 +348,7 @@
}; };
for (axis_id = 0; axis_id < axis_count; axis_id++) { for (axis_id = 0; axis_id < axis_count; axis_id += 1) {
axis_array.push(dataset.getAxis(axis_id)); axis_array.push(dataset.getAxis(axis_id));
} }
...@@ -441,25 +425,25 @@ ...@@ -441,25 +425,25 @@
var ret = [], var ret = [],
uname, uname,
level, level,
cached_member; cached_member1;
while (r.hasMoreRows()) { while (r.hasMoreRows()) {
uname = r["getMemberUniqueName"](); uname = r["getMemberUniqueName"]();
level = r["getLevelUniqueName"](); level = r["getLevelUniqueName"]();
// we can check cache twice because fist check // we can check cache twice because fist check
// only if discover by member_uname // only if discover by member_uname
if (!scheme.members.hasOwnProperty(uname)) { if (!scheme.members.hasOwnProperty(uname)) {
cached_member = { cached_member1 = {
uname: uname, uname: uname,
h: r["getHierarchyUniqueName"](), h: r["getHierarchyUniqueName"](),
level: r["getLevelUniqueName"](), level: r["getLevelUniqueName"](),
caption: r["getMemberCaption"](), caption: r["getMemberCaption"](),
type: r["getMemberType"]() type: r["getMemberType"]()
}; };
scheme.members[uname] = cached_member; scheme.members[uname] = cached_member1;
} else { } else {
cached_member = scheme.members[uname]; cached_member1 = scheme.members[uname];
} }
ret.push(cached_member); ret.push(cached_member1);
r.nextRow(); r.nextRow();
if (!scheme.levels.hasOwnProperty(level)) { if (!scheme.levels.hasOwnProperty(level)) {
scheme.levels[level] = discover_level(connection, scheme, level); scheme.levels[level] = discover_level(connection, scheme, level);
...@@ -479,15 +463,17 @@ ...@@ -479,15 +463,17 @@
var i; var i;
function compare(a, b) { function compare(a, b) {
if (a.uname < b.uname) if (a.uname < b.uname) {
return -1; return -1;
if (a.uname > b.uname) }
return 1; if (a.uname > b.uname) {
return 1;
}
return 0; return 0;
} }
members.sort(compare); members.sort(compare);
for (i = 0; i < members.length; i++) { for (i = 0; i < members.length; i += 1) {
members[i].level_index = i; members[i].level_index = i;
} }
scheme.levels[level] = members; scheme.levels[level] = members;
...@@ -501,9 +487,8 @@ ...@@ -501,9 +487,8 @@
function check_interseption(hierarchy) { function check_interseption(hierarchy) {
if (hierarchies.hasOwnProperty(hierarchy)) { if (hierarchies.hasOwnProperty(hierarchy)) {
throw "The tuple is invalid because there is no intersection for the specified values."; throw "The tuple is invalid because there is no intersection for the specified values.";
} else {
hierarchies[hierarchy] = 1;
} }
hierarchies[hierarchy] = 1;
} }
members.forEach(function (member) { members.forEach(function (member) {
...@@ -514,11 +499,11 @@ ...@@ -514,11 +499,11 @@
member_uname: member member_uname: member
}) })
.push(function (members) { .push(function (members) {
var member; var m;
if (members.length > 0) { if (members.length > 0) {
member = members[0]; m = members[0];
check_interseption(member.h); check_interseption(m.h);
return member; return m;
} else { } else {
throw "member not found"; throw "member not found";
} }
...@@ -608,7 +593,7 @@ ...@@ -608,7 +593,7 @@
member, member,
new_member, new_member,
level; level;
for (i = 0; i < arg.length; i++) { for (i = 0; i < arg.length; i += 1) {
elem = arg[i]; elem = arg[i];
if (cElementType.string === elem.type) { if (cElementType.string === elem.type) {
member = scheme.members[elem.value]; member = scheme.members[elem.value];
...@@ -735,25 +720,25 @@ ...@@ -735,25 +720,25 @@
ret; ret;
function getHierarchyByMember(member_path) { function getHierarchyByMember(member_path) {
var h; var hierarchy;
h = cube.members[member_path]; hierarchy = cube.members[member_path];
if (h === undefined) { if (hierarchy === undefined) {
throw "query result not contain data for member:" + throw "query result not contain data for member:" +
member_path; member_path;
} }
h = h.hierarchy; hierarchy = hierarchy.hierarchy;
h = cube.hierarchies[h]; hierarchy = cube.hierarchies[hierarchy];
return h; return hierarchy;
} }
for (i = 0; i < cube.hierarchies.length; i++) { for (i = 0; i < cube.hierarchies.length; i += 1) {
h = cube.hierarchies[i]; h = cube.hierarchies[i];
if (!coordinate[h.axis_id]) { if (!coordinate[h.axis_id]) {
coordinate[h.axis_id] = []; coordinate[h.axis_id] = [];
} }
coordinate[h.axis_id][h.tuple_id] = null; coordinate[h.axis_id][h.tuple_id] = null;
} }
for (i = 0; i < members.length; i++) { for (i = 0; i < members.length; i += 1) {
member_path = members[i]; member_path = members[i];
h = getHierarchyByMember(members[i]); h = getHierarchyByMember(members[i]);
coordinate[h.axis_id][h.tuple_id] = member_path; coordinate[h.axis_id][h.tuple_id] = member_path;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment