<input type="file" eg-file-reader
container="barcodesFromFile" value="[% l('Upload from File') %]">
</div>
+ <eg-help-popover help-text="[% l('File Format: One barcode per line. All whitespace and commas will be removed before processing.') %]">
</div>
</div>
<div class="flex-cell"></div><!-- force the final divs to the right -->
$scope.args.barcode = '';
var barcodes = [];
- angular.forEach(newVal.split(/\n/), function(line) {
+ angular.forEach(newVal.split(/\r?\n/), function(line) {
+ //remove all whitespace and commas
+ line = line.replace(/[\s,]+/g,'');
+
+ //Or remove leading/trailing whitespace
+ //line = line.replace(/(^[\s,]+|[\s,]+$/g,'');
+
if (!line) return;
- // scrub any trailing spaces or commas from the barcode
- line = line.replace(/(.*?)($|\s.*|,.*)/,'$1');
barcodes.push(line);
});
var barcode = barcodes.pop();
egProgressDialog.increment();
- if (!barcode) { // All done here.
+ if (barcode == undefined) { // All done here.
egProgressDialog.close();
copyGrid.refresh();
- copyGrid.selectItems([itemSvc.copies[0].index]);
+ if(itemSvc.copies[0]){ // Were any copies actually retrieved
+ copyGrid.selectItems([itemSvc.copies[0].index]);
+ }
return;
}