1 dojo.require('openils.widget.AutoFieldWidget');
3 function VLAgent(args) {
5 for (var key in args) {
10 {key : 'import_no_match'},
11 {key : 'auto_overlay_exact'},
12 {key : 'auto_overlay_1match'},
13 {key : 'auto_overlay_best_match'},
14 {key : 'match_quality_ratio'},
16 {key : 'match_set', cls : 'vms'},
17 {key : 'bib_source', cls : 'cbs'},
18 {key : 'merge_profile', cls : 'vmp'},
19 {key : 'fall_through_merge_profile', cls : 'vmp'},
20 {key : 'existing_queue', cls : 'vbq'}
25 this.init = function() {
28 dojo.forEach(this.widgets,
30 if (widg.cls) { // selectors
32 new openils.widget.AutoFieldWidget({
35 orgLimitPerms : [self.limitPerm || 'CREATE_PURCHASE_ORDER'],
36 parentNode : dojo.byId('acq_vl:' + widg.key)
37 }).build(function(dijit) {
42 widg.dijit = dijit.byId('acq_vl:' + widg.key);
47 // loaded != all widgets are done rendering,
48 // only that init() has been called.
52 this.values = function() {
54 dojo.forEach(this.widgets,
56 values[widg.key] = widg.dijit.attr('value');
62 this.handleResponse = function(resp, oncomplete) {
66 console.log('vandelay import returned : ' + js2JSON(resp));
68 // update the display counts
69 dojo.byId('acq_vl:li-processed').innerHTML = resp.li;
70 dojo.byId('acq_vl:vqbr-processed').innerHTML = resp.vqbr;
71 dojo.byId('acq_vl:bibs-processed').innerHTML = resp.bibs;
72 dojo.byId('acq_vl:lid-processed').innerHTML = resp.lid;
73 dojo.byId('acq_vl:debits-processed').innerHTML = resp.debits_accrued;
74 dojo.byId('acq_vl:copies-processed').innerHTML = resp.copies;
79 res.picklist_url = oilsBasePath + '/acq/picklist/view/' + resp.picklist.id();
82 if(resp.purchase_order) {
83 res.po_url = oilsBasePath + '/acq/po/view/' + resp.purchase_order.id();
87 res.queue_url = oilsBasePath + '/vandelay/vandelay?qtype=bib&qid=' + resp.queue.id();
91 oncomplete(resp, res);
96 return false; // not yet complete