From 739edebf4bd67bab6f38fb9b2d03e073849de659 Mon Sep 17 00:00:00 2001 From: John Spiliotopoulos Date: Tue, 14 Jan 2020 18:03:30 +0200 Subject: [PATCH] Add return values for SS2 Record operations according to NS documentation --- modules/SS2/Record.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/modules/SS2/Record.js b/modules/SS2/Record.js index 770053d..2734018 100644 --- a/modules/SS2/Record.js +++ b/modules/SS2/Record.js @@ -78,6 +78,8 @@ module.exports = class Record { } else { this[fieldId].value = value; } + + return this; } setText(options){ @@ -91,6 +93,8 @@ module.exports = class Record { } else { this[fieldId].value = value; } + + return this; } getText(options){ @@ -134,12 +138,16 @@ module.exports = class Record { } else { this.currentLines[sublistId] = (this.sublists[sublistId].push({})) - 1 } + + return this; } selectLine(options){ const sublistId = options.sublistId; const line = options.line; this.currentLines[sublistId] = line; + + return this; } setCurrentSublistValue(options){ @@ -153,6 +161,8 @@ module.exports = class Record { const line = this.currentLines[sublistId]; this.sublists[sublistId][line][fieldId] = value + + return this; } insertLine(options){ @@ -168,6 +178,8 @@ module.exports = class Record { } this.sublists[sublistId].splice( line, 0, {}) + + return this; } setSublistValue(options){ @@ -177,6 +189,8 @@ module.exports = class Record { const line = options.line; this.sublists[sublistId][line][fieldId] = value + + return this; } setSublistText(options){ @@ -186,12 +200,15 @@ module.exports = class Record { const line = options.line; this.sublists[sublistId][line][fieldId] = text + + return this; } getSublistValue(options){ const sublistId = options.sublistId; const index = options.line; const field = options.fieldId; + return this.sublists[sublistId] ? this.sublists[sublistId][index][field] : undefined } @@ -216,6 +233,8 @@ module.exports = class Record { if(!exists) { this.nRecord.addRecord(this); } + + return this.id; } hasSublistSubrecord(options){