Skip to content

Commit

Permalink
Fix skip output issue
Browse files Browse the repository at this point in the history
  • Loading branch information
fttx committed Oct 17, 2019
1 parent 2b1fffb commit 9e5707c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions electron/src/handlers/scans.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class ScansHandler implements Handler {
if (outputBlock.skipOutput) {
continue;
}

switch (outputBlock.type) {
case 'key': this.keyTap(outputBlock.value, outputBlock.modifiers); break;
case 'text': this.typeString(outputBlock.value); break;
Expand Down Expand Up @@ -85,7 +85,7 @@ export class ScansHandler implements Handler {
newLineCharacter
);

// prepare device_name variable
// Prepare device_name variable for file name injection
let deviceName = 'Please add a DEVICE_NAME component to the Output template';
let deviceNameOutputBlock = scanSession.scannings[0].outputBlocks.find(x => x.name.toLowerCase() == 'device_name');
if (typeof (deviceNameOutputBlock) != "undefined") {
Expand Down
2 changes: 1 addition & 1 deletion ionic/src/models/scan.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class ScanModel {
}
return scan.outputBlocks.map(block => {
if (block.skipOutput) {
return; // acts like a continue inside a cycle
return ''; // acts like a continue inside a cycle
}
switch (block.type) {
case 'key': {
Expand Down
17 changes: 7 additions & 10 deletions ionic/src/pages/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,13 @@ export class SettingsPage {
{ name: 'Custom key', value: '', type: 'key', modifiers: [], editable: true },

// VARIABLES
{ name: 'TIMESTAMP', value: 'timestamp', type: 'variable' },
{ name: 'DATE', value: 'date', type: 'variable' },
{ name: 'TIME', value: 'time', type: 'variable' },
{ name: 'DATE_TIME', value: 'date_time', type: 'variable' },
{ name: 'SCAN_SESSION_NAME', value: 'scan_session_name', type: 'variable' },
// { name: 'SCAN_INDEX', value: 'scan_index', type: 'variable' },
{ name: 'DEVICE_NAME', value: 'deviceName', type: 'variable' },

// Only Quantity and Barcode have the skipOutput option.
// If you add this option to another component you also must update the scans.handler.ts and scan.model.ts/ToString,ToCSV files
{ name: 'TIMESTAMP', value: 'timestamp', type: 'variable', skipOutput: false },
{ name: 'DATE', value: 'date', type: 'variable', skipOutput: false },
{ name: 'TIME', value: 'time', type: 'variable', skipOutput: false },
{ name: 'DATE_TIME', value: 'date_time', type: 'variable', skipOutput: false },
{ name: 'SCAN_SESSION_NAME', value: 'scan_session_name', type: 'variable', skipOutput: false },
// { name: 'SCAN_INDEX', value: 'scan_index', type: 'variable', skipOutput: false },
{ name: 'DEVICE_NAME', value: 'deviceName', type: 'variable', skipOutput: false },
{ name: 'QUANTITY', value: 'quantity', type: 'variable', editable: true, skipOutput: false, label: null },
{ name: 'BARCODE', value: 'BARCODE', type: 'barcode', editable: true, skipOutput: false, label: null },

Expand Down

0 comments on commit 9e5707c

Please sign in to comment.