Fix LedgerSMB::App_State::User not being initialized correctly.
Multiple improvements to processing of inventory upload:
 * initialize required invoice fields
 * off-by-one row numbering (0-based -> 1-based)
 * error handling for queries
 * insert perl-undefined and zero-length string values as NULL database values
 * fixes to SQL queries