ACQ+Vandelay schema and IDL changes w/ upgrade script

Adds a queued_record link from acq lineitems to vandelay queued record.
Ditto acq_lineitem_history.  This will be used to link vandelay-mediated
acq lineitems to the vandelay record used for their import.

For ease of future changes, port the queue_type column from bib and
authority queues to ENUMs and drop the constraint, which is implicit in
the ENUM.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
ACQ+Vandelay API to support Vandelay-mediated imports

Adds support for merging, overlaying, importing, and linking (a no-op
merge) acquisitions lineitems to catalog records via Vandelay.

All non-imported lineitems will now be processed through Vandelay during
record upload and asset creation (load bibs and items), based on the
Vandelay import parameters provided by the caller.  Each processed
lineitem will also be linked to its queued Vandelay record.  In the case
of a failed import, such records can be subsequently imported manually
from the Vandelay interface using the manual record overlay options.

ACQ API calls affected now report on the progress of Vandelay record
import in addition to lineitem creation, copy creation, etc.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
ACQ+Vandelay import/merge user interface components

Acquisitions support for leveraging Vandelay import/merge controls
for loading ACQ records and/or linking ACQ records to existing
catalog records.

Dev includes:

* General purpose Vandelay input form and merge progress indicator (VLAgent)
* VLAgent is now shown in the following interfaces when a bib load/merge/link action is required:
 * Vendor record upload interface
 * PO creation
 * PO "load bibs and items" action
 * PO activation

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
ACQ+Vandelay link to vandelay queue from lineitem list UI

In the general purpose lineitem interface (li_table), there is now a
link to the Vandelay queue which contains the queued bib record used to
load/merge/link the lineitem.  Queue opens in a new staff client tab.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
ACQ+Vandelay permission improvements

Be more vigilant about enforcing permissions for various ACQ and
Vandelay actions.

1. Using vandelay to create new bib records now requres the IMPORT_MARC
permission (same as open-ils.cat.biblio.record.xml.import).  If the
permission fails, the queued record will fail import and be stamped with
a new "import.record.perm_failure" vandelay import error.

2. Added suport for testing additional permissions before a new record
is created via vandelay.  This allows interfaces leveraging vandelay
(e.g. ACQ) to create a higher barrier to entry.  Added an ACQ perm
IMPORT_ACQ_LINEITEM_BIB_RECORD_UPLOAD that prevents users from creating
new bib records directly from the ACQ vendor MARC file upload interface.

The secondary permission is not meant as a security enhancement, per se,
since the user is required to have the IMPORT_MARC permission to get this
far in the process.  It's more of a feature-specific precautionary
permission to prevent unintended record creation within certain
permission groups.

3. Checking the CREATE_PURCHASE_ORDER permission during the ACQ vendor
file upload process.  It's absence appears to have been an oversight.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
ACQ+Vandelay ACQ Records in vandelay queue selector

Adds a new type of record to select from the Vandelay queue selector.
Selecting "Acquisitions Records" will show queues with type 'acq'.
Selecting the existing "Bibliographic Records" selector will only show
queues with queue_type 'bib' (i.e. non-acq queues).

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
ACQ+Vandelay API support for queue-and-match only from ACQ

Allow users to load ACQ records into Vandelay queues and apply a
match_set at queue creation time, without requiring the user to
import/merge the ACQ records.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
ACQ+Vandelay disallow match_set change on selected queue

Consistent with Vandelay, if a queue is selected, show the linked
match_set and disable the match_set selector.  Existing queues are
already linked to a match set, so allowing the user to select one has no
effect, which is confusing.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
ACQ+Vandelay limit upload queue selector to ACQ queues

When uploading bibs to vandelay queues from ACQ interfaces, only allow
records to be added to queues tagged as 'acq' queues (or to new 'acq'
queues).

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
ACQ+Vandelay detect existing queue with same name

Within the acq/vandelay agent, detect when a user has entered the name
of one of their existing queues.  When detected, update the queue
selector to match the found queue (which updates the linked match set
and clears the queue selector input).  Otherwise, users may not realize
they are adding items to an existing queue (with a pre-linked match
set).

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
ACQ+Vandelay open picklist/PO/queue in new tab

In the staff client, after a file upload, if a picklist, queue, or PO
are created, make the links open their respective pages in new tabs.
When not running inside the staff client, allow the links be regular
href's.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Acq upload UI re-use new picklist

In the ACQ file upload UI, if the user loads the records into a new
selection list, this change allows the user to continue using the new
list without having to refresh the page.

Without this change, re-using the new list would result in the system
trying to create a new list with the same name, which fails.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
AutoFieldWidget gets new useWriteStore option

If the useWriteStore attribute is set to true, the underlying data store
for dynamically create data will live in an ItemFileWriteStore instead
of a ReadStore, which allows the caller to modify the data after the
widget is rendered.  It's useful for in-place additions of newly created
items.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Acq+Vandelay form re-use new queue

In the Vandelay agent form, if a user creates a new destination queue
for the uploaded records, allow the user to re-use the new queue without
having to refresh the interface.  This is primarily useful in the ACQ
upload UI, where re-using the pre-filled form is possible.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Acq+Vandelay avoid premature asset creation

The presence of Vandelay parameters in API calls does not mean the user
necessarily wants to create PO assets (real copies/callnumbers).  That's
controlled by a different, existing API parameter.  This adds support
for processing bib data only in the presence of Vandelay parameters when
the user has not explicitly chosen to create assets.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Acq+Vandelay : more aggressive streamed response throttling

With the addition of Vandelay processing, the server now wants to
respond with status information a lot more often when uploading /
process ACQ records.  This patch applies the level of throttling to ACQ
processing as Vandelay uses natively, which starts verbose and quickly
cuts back on chatter as processing continues up to (currently) a
throttle window of 1 delivered response per 256 responses.  Apart from
saving bandwith, this helps alleviate a known problem in the staff
client where long-running, dense streams of multipart responses
eventually stop bubbling up from the browser to the application.
Making the responses more sparse seems to help this a lot.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Acq + Vandelay : exit early for 'load bibs and items' in picklist

The ACQ UI does not support loading bibs and items directly from the
picklist interface.  If the user selects "load bibs and items" from the
picklist page they will be presented with the vandelay options, but the
actual upload/merge/etc will not do anything.  This change prevents the
vandelay options from showing in this case.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Acq+Vandelay : skip unneeded vandeley forms

If all lineitems in question are linked to catalog records, avoid
showing the unnecessary vandelay form.  This was already true from the
PO activation action, but this patch adds the same check to the
create-po action from a selection list and PO 'load bibs and items'.

Minor label change for consistency in li_table (Queue -> queue).

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Acq+Vandelay: post-upload links open in embedded browser

This change causes the picklist, PO, and queue links which appear after
a vendor file upload to open their respective pages with the xul browser
wrapper.  Without this, the existing page CSS is ignored and everything,
including href's, are grey and washed out.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>
Acq+Vandelay : consistent post-upload link names

For consistency with POs and selection lists, label the newly created
Vandelay queue link as "View Upload Queue" instead of showing the queue
name.  While we're in there, let's i18n-ize those 3 labels.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Ben Shum <bshum@biblio.org>