gvaughan
Posts: 0
Joined: Mon Aug 18, 2014 3:55 pm

Trying to understand why the Food Essentials plugin scanner is limited to UPC-A and is there work around?

I fixed this for US barcodes EAN_13 format by modifying BarcodeServiceHelper beginning line 506 in FE_Script javascript library:

var BarcodeServiceHelper = {

Code: Select all

 successHandler: function(data, serviceName) { 
     try { 
         if (data.cancelled !== true) { 
             if (data.format == 'UPC_A') { 
                 if (data.text.length == 12) { 
                     localStorage.setItem('UPC', data.text); 
                     window[serviceName].execute({}); 
                 } else { 
                     localStorage.setItem('popupMessage', 'Wrong UPC number'); 
                     navigateTo('FE_PopupScreen', {}); 
                 } 
             } else if (data.format == 'EAN_13') { 
                 if ((data.text.length == 13) && (data.text.substr(0, data.text.length-12) == '0')) { 
                     localStorage.setItem('UPC', data.text.substr(1)); 
                     window[serviceName].execute({}); 
                 } else { 
                     localStorage.setItem('popupMessage', 'Wrong UPC number'); 
                     navigateTo('FE_PopupScreen', {}); 
                 }         
             } else { 
                 localStorage.setItem('popupMessage', 
                                      data.format + ' ' + data.text + 'Sorry, this application supports only UPC_A or EAN_13 USA barcode format'); 
                 navigateTo('FE_PopupScreen', {}); 
             } 
         } 
     } catch (err) { 
         localStorage.setItem('popupMessage', 'An error occured'); 
         navigateTo('FE_PopupScreen', {}); 
     } 
 }, 

 failHandler: function() { 
     localStorage.setItem('popupMessage', 'Barcode scan failed'); 
     navigateTo('FE_PopupScreen', {}); 
 } 

};

obullei
Posts: 0
Joined: Thu Jun 05, 2014 12:17 am

Trying to understand why the Food Essentials plugin scanner is limited to UPC-A and is there work around?

Hello!

Thank you for information.
If you need any help, please contact us.

Return to “Issues”