--- /dev/null
+Setting Up EDI Acquisitions\r
+---------------------------\r
+\r
+Introduction\r
+~~~~~~~~~~~~\r
+\r
+Electronic Data Interchange (EDI) is used to exchange information between \r
+participating vendors and Evergreen. This chapter contains technical \r
+information for installation and configuration of the components necessary \r
+to run EDI Acquisitions for Evergreen.\r
+\r
+Installation\r
+~~~~~~~~~~~~\r
+\r
+Install EDI Translator\r
+^^^^^^^^^^^^^^^^^^^^^^\r
+\r
+The EDI Translator is used to convert data into EDI format. It runs\r
+on localhost and listens on port 9191 by default. This is controlled via \r
+the edi_webrick.cnf file located in the edi_translator directory. It should\r
+not be necessary to edit this configuration if you install EDI Translator \r
+on the same server used for running Action/Triggers events.\r
+\r
+[NOTE]\r
+If you are running Evergreen with a multi-server configuration, make sure\r
+to install EDI Translator on the same server used for Action/Trigger event\r
+generation.\r
+\r
+.Steps for Installing\r
+\r
+1. As the *opensrf* user, copy the EDI Translator code found in \r
+ Open-ILS/src/edi_translator to somewhere accessible \r
+ (for example, /openils/var/edi):\r
++\r
+[source, bash]\r
+--------------------------------------------------\r
+cp -r Open-ILS/src/edi_translator /openils/var/edi\r
+--------------------------------------------------\r
+2. Navigate to where you have saved the code to begin next step:\r
++\r
+[source, bash]\r
+-------------------\r
+cd /openils/var/edi\r
+-------------------\r
+3. Next, as the *root* user (or a user with sudo rights), install the \r
+ dependencies, via "install.sh". This will perform some apt-get routines \r
+ to install the code needed for the EDI translator to function. \r
+ (Note: subversion must be installed first)\r
++\r
+[source, bash]\r
+-----------\r
+./install.sh\r
+-----------\r
+4. Now, we're ready to start "edi_webrick.bash" which is the script that calls \r
+ the "Ruby" code to translate EDI. This script needs to be started in \r
+ order for EDI to function so please take appropriate measures to ensure this \r
+ starts following reboots/upgrades/etc. As the *opensrf* user:\r
++\r
+[source, bash]\r
+-----------------\r
+./edi_webrick.bash\r
+-----------------\r
+5. You can check to see if EDI translator is running.\r
+ * Using the command "ps aux | grep edi" should show you something similar \r
+ if the script is running properly:\r
++\r
+[source, bash]\r
+------------------------------------------------------------------------------------------\r
+root 30349 0.8 0.1 52620 10824 pts/0 S 13:04 0:00 ruby ./edi_webrick.rb\r
+------------------------------------------------------------------------------------------\r
+ * To shutdown EDI Translator you can use something like pkill (assuming \r
+ no other ruby processes are running on that server):\r
++\r
+[source, bash]\r
+-----------------------\r
+kill -INT $(pgrep ruby)\r
+-----------------------\r
+\r
+Install EDI Scripts\r
+^^^^^^^^^^^^^^^^^^^\r
+\r
+The EDI scripts are "edi_pusher.pl" and "edi_fetcher.pl" and are used to\r
+"push" and "fetch" EDI messages for configured EDI accounts.\r
+\r
+1. As the *opensrf* user, copy edi_pusher.pl and edi_fetcher.pl from\r
+ Open-ILS/src/support-scripts into /openils/bin:\r
++\r
+[source, bash]\r
+--------------------------------------------------\r
+cp Open-ILS/src/support-scripts/edi_pusher.pl /openils/bin\r
+cp Open-ILS/src/support-scripts/edi_fetcher.pl /openils/bin\r
+--------------------------------------------------\r
+2. Setup the edi_pusher.pl and edi_fetcher.pl scripts to run as cron jobs\r
+ in order to regularly push and receive EDI messages.\r
+ * Add to the opensrf user's crontab the following entries:\r
++\r
+[source, bash]\r
+-----------------------------------------------------------------------\r
+10 * * * * cd /openils/bin && /usr/bin/perl ./edi_pusher.pl > /dev/null\r
+0 1 * * * cd /openils/bin && /usr/bin/perl ./edi_fetcher.pl > /dev/null\r
+-----------------------------------------------------------------------\r
+ * The example for edi_pusher.pl sets the script to run at \r
+ 10 minutes past the hour, every hour.\r
+ * The example for edi_fetcher.pl sets the script to run at\r
+ 1 AM every night.\r
+\r
+[NOTE]\r
+You may choose to run the EDI scripts more or less frequently based on the \r
+necessary response times from your vendors.\r
+\r
+Configuration\r
+~~~~~~~~~~~~~\r
+\r
+Configuring Providers\r
+^^^^^^^^^^^^^^^^^^^^^\r
+\r
+Look in Admin > Server Administration > Acquisitions > Providers\r
+\r
+[options="header"]\r
+|======================================================================================\r
+|Column |Description/Notes\r
+|Provider Name |A unique name to identify the provider\r
+|Code |A unique code to identify the provider\r
+|Owner |The org unit who will "own" the provider.\r
+|Currency |The currency format the provider accepts\r
+|Active |Whether or not the Provider is "active" for use\r
+|Default Claim Policy|??\r
+|EDI Default |The default "EDI Account" to use (see EDI Accounts Configuration)\r
+|Email |The email address for the provider\r
+|Fax Phone |A fax number for the provider\r
+|Holdings Tag |The holdings tag to be utilized (usually 852, for Evergreen)\r
+|Phone |A phone number for the provider\r
+|Prepayment Required |Whether or not prepayment is required\r
+|SAN |The vendor provided, org unit specific SAN code\r
+|URL |The vendor website\r
+|======================================================================================\r
+\r
+Configuring EDI Accounts\r
+^^^^^^^^^^^^^^^^^^^^^^^^\r
+\r
+Look in Admin > Server Administration > Acquisitions > EDI Accounts\r
+\r
+[options="header"]\r
+|===============================================================================================================\r
+|Column |Description/Notes\r
+|Label |A unique name to identify the provider\r
+|Host |FTP/SFTP/SSH hostname - vendor assigned\r
+|Username |FTP/SFTP/SSH username - vendor assigned\r
+|Password |FTP/SFTP/SSH password - vendor assigned\r
+|Account |Vendor assigned account number associated with your organization\r
+|Owner |The organizational unit who owns the EDI account\r
+|Last Activity |The date of last activity for the account\r
+|Provider |This is a link to one of the "codes" in the "Providers" interface\r
+|Path |The path on the vendor's server where Evergreen will send it's outgoing .epo files\r
+|Incoming Directory |The path on the vendor's server where "incoming" .epo files are stored\r
+|Vendor Account Number|Vendor assigned account number.\r
+|Vendor Assigned Code |Usually a sub-account designation. Can be used with or without the Vendor Account Number.\r
+|===============================================================================================================\r
+\r
+Configuring Organizational Unit SAN code\r
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r
+\r
+Look in Admin > Server Settings > Organizational Units\r
+\r
+This interface allows a library to configure their SAN, alongside \r
+their address, phone, etc.\r
+\r
+Troubleshooting\r
+~~~~~~~~~~~~~~~\r
+\r
+PO JEDI Template Issues\r
+^^^^^^^^^^^^^^^^^^^^^^^\r
+\r
+Some libraries may run into issues with the action/trigger (PO JEDI). \r
+The template has to be modified to handle different vendor codes that \r
+may be used. For instance, if you use "ingra" instead of INGRAM this \r
+may cause a problem because they are hardcoded in the template. The \r
+following is an example of one modification that seems to work.\r
+\r
+.Original template has:\r
+\r
+[source, bash]\r
+----------------------------------------------------------------------------------------------------------------------------------------------\r
+"buyer":[\r
+ [% IF target.provider.edi_default.vendcode && (target.provider.code == 'BT' || target.provider.name.match('(?i)^BAKER & TAYLOR')) -%]\r
+ {"id-qualifier": 91, "id":"[% target.ordering_agency.mailing_address.san _ ' ' _ target.provider.edi_default.vendcode %]"}\r
+ [%- ELSIF target.provider.edi_default.vendcode && target.provider.code == 'INGRAM' -%]\r
+ {"id":"[% target.ordering_agency.mailing_address.san %]"},\r
+ {"id-qualifier": 91, "id":"[% target.provider.edi_default.vendcode %]"}\r
+ [%- ELSE -%]\r
+ {"id":"[% target.ordering_agency.mailing_address.san %]"}\r
+ [%- END -%]\r
+],\r
+----------------------------------------------------------------------------------------------------------------------------------------------\r
+\r
+.Modified template has the following where it matches on provider SAN instead of code:\r
+\r
+[source, bash]\r
+------------------------------------------------------------------------------------------------------------------------------------------\r
+"buyer":[\r
+ [% IF target.provider.edi_default.vendcode && (target.provider.san == '1556150') -%]\r
+ {"id-qualifier": 91, "id":"[% target.ordering_agency.mailing_address.san _ ' ' _ target.provider.edi_default.vendcode %]"}\r
+ {"id-qualifier": 91, "id":"[% target.ordering_agency.mailing_address.san _ ' ' _ target.provider.edi_default.vendcode %]"}\r
+ [%- ELSIF target.provider.edi_default.vendcode && (target.provider.san == '1697978') -%]\r
+ {"id":"[% target.ordering_agency.mailing_address.san %]"},\r
+ {"id-qualifier": 91, "id":"[% target.provider.edi_default.vendcode %]"}\r
+ [%- ELSE -%]\r
+ {"id":"[% target.ordering_agency.mailing_address.san %]"}\r
+ [%- END -%]\r
+],\r
+------------------------------------------------------------------------------------------------------------------------------------------\r
+\r