From 55b643743814688bd4239af8b0e907c3c56e58b9 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 1 Dec 2011 15:48:57 -0500 Subject: [PATCH] ACQ Vandelay : Ui refactor for standalone vl agent part deux Signed-off-by: Bill Erickson --- .../perlmods/lib/OpenILS/Application/Acq/Order.pm | 17 +++++--- Open-ILS/src/templates/acq/common/vlagent.tt2 | 40 +++++++++++++++++ Open-ILS/web/js/ui/default/acq/common/vlagent.js | 51 ++++++++++++++++++++++ 3 files changed, 102 insertions(+), 6 deletions(-) create mode 100644 Open-ILS/src/templates/acq/common/vlagent.tt2 create mode 100644 Open-ILS/web/js/ui/default/acq/common/vlagent.js diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm index 61eb569533..382048c12d 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm @@ -319,22 +319,27 @@ sub delete_lineitem { # begins and commit transactions as it goes sub create_lineitem_list_assets { - my($mgr, $li_ids) = @_; + my($mgr, $li_ids, $vandelay) = @_; return undef if check_import_li_marc_perms($mgr, $li_ids); + $li_ids = import_lineitems_via_vandelay($mgr, $li_ids, $vandelay); + # create the bibs/volumes/copies and ingest the records for my $li_id (@$li_ids) { $mgr->editor->xact_begin; my $data = create_lineitem_assets($mgr, $li_id) or return undef; $mgr->editor->xact_commit; - # XXX ingest is in-db now - #$mgr->push_ingest_queue($data->{li}->eg_bib_id) if $data->{new_bib}; $mgr->respond; } $mgr->process_ingest_records; return 1; } + +sub import_lineitems_via_vandelay { + my ($mgr, $li_ids, $vandelay) = @_; +} + # returns event on error, undef on success sub check_import_li_marc_perms { my($mgr, $li_ids) = @_; @@ -1204,7 +1209,7 @@ sub upload_records { my $create_po = $args->{create_po}; my $activate_po = $args->{activate_po}; my $ordering_agency = $args->{ordering_agency}; - my $create_assets = $args->{create_assets}; + my $vandelay = $args->{vandelay}; my $po; my $evt; @@ -1302,8 +1307,8 @@ sub upload_records { unlink($filename); $cache->delete_cache('vandelay_import_spool_' . $key); - if ($create_assets) { - create_lineitem_list_assets($mgr, \@li_list) or return $e->die_event; + if ($vandelay) { + create_lineitem_list_assets($mgr, \@li_list, $vandelay) or return $e->die_event; } return $mgr->respond_complete; diff --git a/Open-ILS/src/templates/acq/common/vlagent.tt2 b/Open-ILS/src/templates/acq/common/vlagent.tt2 new file mode 100644 index 0000000000..ce14f80d88 --- /dev/null +++ b/Open-ILS/src/templates/acq/common/vlagent.tt2 @@ -0,0 +1,40 @@ + + [% l('Record Match Set') %] +
+ + + [% l('Merge Profile') %] +
+ + + [% l('Import Non-Matching Records') %] + + + + [% l('Select a Record Source') %] +
+ + + [% l('Merge On Exact Match (901c)') %] + + + + [% l('Merge On Single Match') %] + + + + [% l('Merge On Best Match') %] + + + + [% l('Best/Single Match Minimum Quality Ratio') %] + + + [% l('New Record Quality / Quality of Best Match') %] + + + + [% l('Insufficient Quality Fall-Through Profile') %] +
+ + diff --git a/Open-ILS/web/js/ui/default/acq/common/vlagent.js b/Open-ILS/web/js/ui/default/acq/common/vlagent.js new file mode 100644 index 0000000000..bd305afbdc --- /dev/null +++ b/Open-ILS/web/js/ui/default/acq/common/vlagent.js @@ -0,0 +1,51 @@ +dojo.require('openils.widget.AutoFieldWidget'); + +function VLAgent(args) { + args = args || {}; + for (var key in args) { + this[key] = args[key]; + } + + this.widgets = [ + {key : 'import_no_match'}, + {key : 'auto_overlay_exact'}, + {key : 'auto_overlay_1match'}, + {key : 'auto_overlay_best_match'}, + {key : 'match_quality_ratio'}, + {key : 'match_set', cls : 'vms'}, + {key : 'bib_source', cls : 'cbs'}, + {key : 'merge_profile', cls : 'vmp'}, + {key : 'fall_through_merge_profile', cls : 'vmp'} + ]; + + this.init = function() { + var self = this; + + dojo.forEach(this.widgets, + function(widg) { + + if (widg.cls) { // selectors + new openils.widget.AutoFieldWidget({ + fmClass : widg.cls, + selfReference : true, + orgLimitPerms : [self.limitPerm || 'CREATE_PURCHASE_ORDER'], + parentNode : dojo.byId('acq_vl:' + widg.key) + }).build(function(w) { widg.dijit = w }); + + } else { // bools + widg.dijit = dijit.byId('acq_vl:' + widg.key); + } + } + ); + } + + this.values = function() { + var values = {}; + dojo.forEach(this.widgets, + function(widg) { + values[widg.key] = widg.dijit.attr('value'); + } + ); + return values; + } +} -- 2.11.0