Enhanced Ubercart EDI Order Export and Import Module

About

I've taken the current 5.x version of the Ubercart EDI module (uc_edi) and added a few 'enhancements'. The module now includes built in FTP transfers, the ability to specify a file header, and most importantly, I've included the ability to have this module automatically generate X12 BASIC 850 files.

This is not the 'official' release of the uc_edi module. However, my modifications are made using the official 1.0 version. Hopefully these modifications can be back-ported into the official release.

I will call this the 'unofficial' version 1.2

Requirements

  • Drupal 5.x - A 6.x version will be created soon
  • Ubercart version 1.x - A 2.x version will be created soon
  • PHP must be able to make outbound FTP connections if you wish to use the integrated FTP feature

How to Use

Install the module as you would any other Drupal module, just drop it into the "sites/all/modules" folder. If you already have the official uc_edi module installed, just overwrite the files and run update.php. (If you made your own modifications, you will need to merge your changes with my additions).

If you have not already, enable the module using the Drupal administration tools. Then go to Administer -> Store administration -> Configuration -> EDI Import/Export. Immediately your notice a bunch of new configuration variables:

  • SAN Number (uc_edi_san_number): Used mostly with the EDI X12 BASIC 850 format. This is a unique string assigned to you by the The Standard Address Number Agency. It's about $90 US to register for an official number. However, if you will be doing business with only a single supplier, you may be able to get a number to use with them. This field may be left as is if you will not be using this feature.
  • Export Format (uc_edi_order_export_format): Right now their are 2, the official X12 BASIC 850 PO and a user configurable 'other' format.
  • Order Export Header (uc_edi_order_export_header): Currently used only for the 'other' format. Some fulfillment warehouses require a header, you may enter it here. If you do not need the header, just leave this field blank.
  • Hostname (uc_edi_ftp_host): The DNS name or IP address of the FTP host you will connect to.
  • Username (uc_edi_ftp_login): Username to login with.
  • Password (uc_edi_ftp_password): Password to login with.
  • Import Directory (uc_edi_remote_import_dir): Location, relative to the FTP root, of where Ubercart should upload new orders.
  • Export Directory (uc_edi_remote_export_dir): Location, relative to the FTP root, of where Ubercart will look to download order status files.
  • Export Archive Directory (uc_edi_remote_export_archive_dir): Location, relative to the FTP root, of where Ubercart should move/rename order status files after they have been downloaded. If you do not use this, set it to the same as the Export Directory. This way ubercart will simply rename the files with a ".complete" at the end.
  • FTP Frequency (uc_edi_order_ftp_freq): It's pretty self explanatory, how often should the system upload/download files.
  • Ready for transmission order status (uc_edi_ftp_order_status): This currently has no effect, but it would be used to specify at what status Ubercart shoud send the orders through FTP.
  • Sent order status (uc_edi_ftpsent_order_status): What status to set orders which have been sent via FTP. This is functional, however, in the off chance that EDI files are generated at the same time FTP is processing, you could have some order's which are marked with the "sent" status, but not really sent. This will not affect the order in any negative way since it will be sent via FTP in the next time around.
  • Transmitted order comment (uc_edi_ftpsent_order_message): Status message as shown to the customer when the order has been sent via FTP.

Just fill in the above with your info, and save your configuration.

You'll also notice another field set in Administer-> Store administration-> Orders -> EDI import/export called "FTP transfer details". It works the same way as the other two.

Behind the Scenes

I made changes to the following existing functions:

uc_edi_cron()
_export_orders()
uc_edi_order_values()
uc_edi_order_admin_form()
uc_edi_order_admin_form_submit()
uc_edi_settings_form()
uc_edi_create_export()

I added the following additional new functions:

uc_edi_generate_X12BASIC850()
uc_edi_generate_order_product_export_X12BASIC850()
_ftp_orders()
_default_order_export_header()

The following new variables are used:

uc_edi_san_number
uc_edi_san_number_r
uc_edi_order_export_format
uc_edi_order_export_header
uc_edi_order_ftp_freq
uc_edi_last_order_ftp
uc_edi_ftp_host
uc_edi_ftp_login
uc_edi_ftp_password
uc_edi_remote_import_dir
uc_edi_remote_export_dir
uc_edi_remote_export_archive_dir
uc_edi_ftp_order_status
uc_edi_ftpsent_order_status
uc_edi_ftpsent_order_message

Where to get it

You can download it using the link below.

Support

You may submit your questions, issues, bugs, and/or requests at the Unibia.net forums under the appropriate section.

AttachmentSize
Binary Data uc_edi-5.x-1.2.tar_.gz16.59 KB