Acq: Improvements to account-matching incoming EDI messages
The way the EDI fetcher works gives us a problem. That process iterates
over EDI accounts for which it has FTP host and credential information,
downloads documents from each of those sites, and files the messages
within those documents under the EDI account from which the login
credentials came. The problem is that in practice the exact same host
and login information is used by multiple accounts under the same
vendor, and files relating to these sub-accounts are commingled, so that
you can't make the decision about which messages should be filed under
which accounts based on the name of the document or its location. You
have to make that decision later, based on its contents.
We are already incompletely doing this, distinguishing between
sub-accounts under which we could file our messages when the vendor
specifies the buyer's SAN next to the specific sub-account number *and*
those sub-accounts belong to different Evergreen org units. We still
need ways to distinguish in other cases.
This will do what is natural for at least one vendor, and match the
message content against the vendacct field of the acq.edi_account table.
*Also,*
We were re-retrieving the working acq.edi_message row from the database
before writing it, throwing away possible changes to the object in hand
made by O::A::Acq::EDI::process_parsed_msg(). We should only do that in
the case where that function has raised an exception.
We were doing the same kind of thing in another place actually inside
process_parsed_msg() where we set the edi_message's purchase_order field
based on the first lineitem encountered if the message itself didn't
specify a valid PO identifier.
This supports making account-correction work for ORDRSP messages in
addition to INVOIC messages.
We also propagate that same correction to the provider and shipper
fields of any invoices that get created from said edi_message.
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Signed-off-by: Ben Shum <bshum@biblio.org>