Fixed invoice error handling

Also removed depricated PHP4-style uses of the var keyword and added error messages when core osCommerce functions are not available.