stream => 1,
record_type => 'bib'
);
-
-sub import_record_asset_list {
- my($self, $conn, $auth, $rec_ids) = @_;
- my $e = new_editor(authtoken => $auth);
- return $e->event unless $e->checkauth;
- my $err = import_record_asset_list_impl($conn, $rec_ids, $e->requestor);
- return $err if $err;
- return {complete => 1};
-}
-
__PACKAGE__->register_method(
api_name => "open-ils.vandelay.bib_record.queue.asset.import",
method => 'import_record_queue_assets',
);
sub import_record_list_assets {
- my($self, $conn, $auth, $rec_ids) = @_;
+ my($self, $conn, $auth, $import_def, $rec_ids) = @_;
my $e = new_editor(authtoken => $auth);
return $e->event unless $e->checkauth;
- my $err = import_record_asset_list_impl($conn, $rec_ids, $e->requestor);
+ my $err = import_record_asset_list_impl($conn, $import_def, $rec_ids, $e->requestor);
return $err if $err;
return {complete => 1};
}
sub import_record_queue_assets {
- my($self, $conn, $auth, $q_id) = @_;
+ my($self, $conn, $auth, $import_def, $q_id) = @_;
my $e = new_editor(authtoken => $auth);
return $e->event unless $e->checkauth;
my $rec_ids = $e->search_vandelay_queued_bib_record(
{queue => $q_id, import_time => {'!=' => undef}}, {idlist => 1});
- my $err = import_record_asset_list_impl($conn, $rec_ids, $e->requestor);
+ my $err = import_record_asset_list_impl($conn, $import_def, $rec_ids, $e->requestor);
return $err if $err;
return {complete => 1};
}
# Given a list of queued record IDs, imports all items attached to those records
# --------------------------------------------------------------------------------
sub import_record_asset_list_impl {
- my($conn, $rec_ids, $requestor) = @_;
+ my($conn, $import_def, $rec_ids, $requestor) = @_;
my $total = @$rec_ids;
my $try_count = 0;
for my $rec_id (@$rec_ids) {
my $rec = $roe->retrieve_vandelay_queued_bib_record($rec_id);
next unless $rec and $rec->import_time;
- my $item_ids = $roe->search_vandelay_import_item({record => $rec->id}, {idlist=>1});
+ my $item_ids = $roe->search_vandelay_import_item({definition => $import_def, record => $rec->id}, {idlist=>1});
for my $item_id (@$item_ids) {
my $e = new_editor(requestor => $requestor, xact => 1);
dojo.require('dojo.date.stamp');
dojo.require("fieldmapper.Fieldmapper");
dojo.require("fieldmapper.dojoData");
+dojo.require("fieldmapper.OrgUtils");
dojo.require('openils.CGI');
dojo.require('openils.User');
dojo.require('openils.Event');
dojo.require('openils.Util');
dojo.require('openils.MarcXPathParser');
dojo.require('openils.widget.GridColumnPicker');
+dojo.require('openils.PermaCrud');
var globalDivs = [
var cgi = new openils.CGI();
var vlQueueGridColumePicker = {};
var vlBibSources = [];
+var importItemDefs = [];
/**
* Grab initial data
*/
function vlInit() {
authtoken = openils.User.authtoken;
- var initNeeded = 5; // how many async responses do we need before we're init'd
+ var initNeeded = 6; // how many async responses do we need before we're init'd
var initCount = 0; // how many async reponses we've received
openils.Util.registerEnterHandler(
}
);
+ var owner = fieldmapper.aou.orgNodeTrail(fieldmapper.aou.findOrgUnit(new openils.User().user.ws_ou()));
+ new openils.PermaCrud().search('viiad',
+ {owner: owner.map(function(org) { return org.id(); })},
+ { async: true,
+ oncomplete: function(r) {
+ importItemDefs = openils.Util.readResponse(r);
+ checkInitDone();
+ }
+ }
+ );
+
vlAttrEditorInit();
}
}
+function vlImportHoldings(queueId, importProfile, onload) {
+ displayGlobalDiv('vl-generic-progress-with-total');
+ fieldmapper.standardRequest(
+ ['open-ils.vandelay', 'open-ils.vandelay.bib_record.queue.asset.import'],
+ { async: true,
+ params: [authtoken, importProfile, queueId],
+ onresponse: function(r) {
+ var resp = openils.Util.readResponse(r);
+ vlControlledProgressBar.update({maximum:resp.total, progress:resp.progress});
+ },
+ oncomplete: function() {onload();}
+ }
+ );
+}
+
/**
* Create queue, upload MARC, process spool, load the newly created queue
*/
if(vlUploadQueueAutoImport.checked) {
vlImportRecordQueue(currentType, currentQueueId, true,
function() {
- retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
+ if(vlUploadQueueHoldingsImport.checked) {
+ vlImportHoldings(
+ currentQueueId,
+ vlUploadQueueHoldingsImportProfile.attr('value'),
+ function() {
+ retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
+ }
+ );
+ } else {
+ retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
+ }
}
);
} else {
vlUploadSourceSelector.store =
new dojo.data.ItemFileReadStore({data:cbs.toStoreData(vlBibSources, 'source')});
vlUploadSourceSelector.setValue(vlBibSources[0].id());
+ vlUploadQueueHoldingsImportProfile.store =
+ new dojo.data.ItemFileReadStore({data:viiad.toStoreData(importItemDefs)});
+ vlUploadQueueHoldingsImportProfile.attr('disabled', true);
+ dojo.connect(vlUploadQueueHoldingsImport, 'onChange',
+ function(val) {
+ if(val)
+ vlUploadQueueHoldingsImportProfile.attr('disabled', false);
+ else
+ vlUploadQueueHoldingsImportProfile.attr('disabled', true);
+ }
+ );
}
function vlShowQueueSelect() {
<h1>&vandelay.export.records;</h1><br/>
-<form method="POST" enctype="multipart/form-data" action='/exporter'>
+<form method="POST" enctype="multipart/form-data" action='https://[% ctx.hostname %]/exporter'>
<table class='form_table'>
<tr class='export_tr_border'>
<td>&vandelay.export.use_field_no;</td>
</td>
</tr>
<tr>
+ <td>Import Attached Holdings</td>
+ <td colspan='4'>
+ <input jsId='vlUploadQueueHoldingsImport' dojoType='dijit.form.CheckBox'/>
+ </td>
+ </tr>
+ <tr>
+ <td>Holdings Import Profile</td>
+ <td>
+ <input jsId='vlUploadQueueHoldingsImportProfile'
+ dojoType='dijit.form.FilteringSelect' labelAttr='name' searchAttr='name'/>
+ </td>
+ </tr>
+ <tr>
<td>&vandelay.import.bib_sources;</td>
<td>
- <select name='bib_source' jsId='vlUploadSourceSelector' dojoType='dijit.form.FilteringSelect' labelAttr='source' searchAttr='source'>
- </select>
+ <select name='bib_source' jsId='vlUploadSourceSelector'
+ dojoType='dijit.form.FilteringSelect' labelAttr='source' searchAttr='source'/>
</td>
</tr>
<tr>