1 /* The code in this file relies on common.js */
3 dojo.require("dojo.cookie");
4 dojo.require("openils.Util");
5 dojo.require("openils.User");
6 dojo.require("openils.CGI");
7 dojo.require("openils.XUL");
8 dojo.require("openils.PermaCrud");
13 return dojo.byId("serialStrings").getString("batch_receive." + k).
18 return dojo.byId("serialStrings").
19 getFormattedString("batch_receive." + k, args).replace("\\n", "\n");
22 function BatchReceiver() {
25 this.init = function(authtoken, bib_id, sub_id) {
27 this.user = new openils.User({"authtoken": authtoken});
28 this.pcrud = new openils.PermaCrud({"authtoken": authtoken});
29 this.authtoken = authtoken;
32 hide("batch_receive_sub");
33 hide("batch_receive_entry");
34 hide("batch_receive_bibdata_bits");
35 hide("batch_receive_sub_bits");
36 hide("batch_receive_issuance_bits");
37 hide("batch_receive_issuance");
39 dojo.byId("bib_lookup_submit").disabled = false;
40 dojo.byId("bib_search_term").value = "";
43 show("batch_receive_bib");
44 dojo.byId("bib_search_term").focus();
47 if (!this.entry_tbody) {
48 this.entry_tbody = dojo.byId("entry_tbody");
49 this.template = this.entry_tbody.removeChild(
50 dojo.byId("entry_template")
54 this._clear_entry_batch_row();
56 this._call_number_cache = null;
57 this._prepared_call_number_controls = {};
58 this._location_by_lib = {};
59 this._copy_template_cache = {};
60 this._wants_print_routing = {};
62 /* empty the entry receiving table if we're starting over */
63 if (this.item_cache) {
64 for (var id in this.item_cache) {
65 this.finish_receipt(this.item_cache[id]);
66 hard_empty(this.entry_tbody);
68 /* XXX incredibly, running hard_empty() more than once seems to be
69 * good and necessary. There's a bug under the covers somewhere,
70 * but this keeps it out of sight for the moment. */
71 hard_empty(this.entry_tbody);
73 hard_empty(this.entry_tbody);
79 this.bib_lookup(bib_id, null, true, sub_id);
84 this._clear_entry_batch_row = function() {
86 dojo.byId("entry_batch_row").childNodes,
88 if (node.nodeType == 1 &&
89 node.getAttribute("name") != "barcode")
95 this._show_bibdata_bits = function() {
96 hard_empty("title_here");
97 dojo.byId("title_here").appendChild(T(this.bibdata.mvr.title()));
98 hard_empty("author_here");
100 if (this.bibdata.mvr.author()) {
101 dojo.byId("author_here").appendChild(T(this.bibdata.mvr.author()));
102 show("author_here_holder");
104 hide("author_here_holder");
107 show("batch_receive_bibdata_bits");
110 this._sub_label = function(sub) {
111 /* XXX use a formatting string from serial.properties */
112 return sub.id() + ": (" + sub.owning_lib().shortname() + ") " +
113 D(sub.start_date()) + " - " + D(sub.end_date());
116 this._show_sub_bits = function() {
117 hard_empty("sublabel_here");
119 T(this._sub_label(this.sub)),
123 hide("batch_receive_sub");
124 show("batch_receive_sub_bits");
127 this._show_issuance_bits = function() {
128 hide("batch_receive_issuance");
129 hard_empty("issuance_label_here");
131 T(this.issuance.label()),
132 "issuance_label_here",
135 show("batch_receive_issuance_bits");
138 this._get_receivable_issuances = function() {
143 fieldmapper.standardRequest(
144 ["open-ils.serial", "open-ils.serial.issuances.receivable"], {
145 "params": [this.authtoken, this.sub.id()],
147 "onresponse": function(r) {
148 if (r = openils.Util.readResponse(r))
161 this._build_circ_modifier_dropdown = function() {
162 if (!this._built_circ_modifier_dropdown) {
163 var menulist = dojo.create("menulist");
164 var menupopup = dojo.create("menupopup", null, menulist, "only");
166 "menuitem", {"value": 0, "label": S("none")},
171 fieldmapper.standardRequest(
172 ["open-ils.circ", "open-ils.circ.circ_modifier.retrieve.all"],{
173 "params": [{"full": true}],
175 "onresponse": function(r) {
176 if (mods = openils.Util.readResponse(r)) {
179 return a.code() > b.code() ? 1 :
180 b.code() > a.code() ? -1 :
188 "label": document.getElementById('commonStrings').getFormattedString('staff.circ_modifier.display',[mod.code(),mod.name(),mod.description()])
198 /* in this case, discard menulist and menupopup */
199 this._built_circ_modifier_dropdown =
200 dojo.create("description", {"value": "-"});
202 this._built_circ_modifier_dropdown = menulist;
206 return dojo.clone(this._built_circ_modifier_dropdown);
209 this._extend_circ_modifier_for_batch = function(control) {
211 "menuitem", {"value": -1, "label": "---"},
212 dojo.query("menupopup", control)[0],
219 this._build_location_dropdown = function(locs, add_unset_value) {
220 var menulist = dojo.create("menulist");
221 var menupopup = dojo.create("menupopup", null, menulist, "only");
223 if (add_unset_value) {
225 "menuitem", {"value": -1, "label": "---"}, menupopup, "first"
233 "value": loc.id(), "label": loc.name()
242 this._get_locations_for_lib = function(lib) {
243 if (!this._location_by_lib[lib]) {
244 fieldmapper.standardRequest(
245 ["open-ils.circ", "open-ils.circ.copy_location.retrieve.all"],{
246 "params": [lib, false, true],
248 "onresponse": function(r) {
249 if (locs = openils.Util.readResponse(r))
250 self._location_by_lib[lib] = locs;
256 return this._location_by_lib[lib];
259 this._build_call_number_control = function(item) {
260 /* In any case, give a dropdown of call numbers related to the
261 * same bre as the subscription relates to. */
262 if (!this._call_number_cache) {
263 this._call_number_cache = this.pcrud.search(
265 "record": this.sub.record_entry()
267 "order_by": {"acn": "label"}, /* XXX wrong sorting? */
272 if (typeof item == "undefined") {
273 /* In this case, no further limiting of call numbers for now,
274 * although ideally it might be nice to limit to call numbers
275 * with owning_lib matching the holding_lib of the distribs
276 * that ultimately relate to the items. */
278 var menulist = dojo.create("menulist", {
279 "editable": "true", "className": "cn"
281 var menupopup = dojo.create("menupopup", null, menulist, "only");
283 openils.Util.uniqueObjects(this._call_number_cache, "label").
288 "value": cn.label(), "label": cn.label()
296 /* In this case, limit call numbers by owning_lib matching
297 * distributions's holding_lib. */
299 var lib = item.stream().distribution().holding_lib().id();
300 if (!this._prepared_call_number_controls[lib]) {
301 var menulist = dojo.create("menulist", {
302 "editable": "true", "className": "cn"
304 var menupopup = dojo.create("menupopup", null, menulist,"only");
305 this._call_number_cache.filter(
306 function(cn) { return cn.owning_lib() == lib; }
311 "value": cn.label(), "label": cn.label()
316 this._prepared_call_number_controls[lib] = menulist;
318 return dojo.clone(this._prepared_call_number_controls[lib]);
322 this._build_batch_location_dropdown = function() {
323 var menulist = dojo.create("menulist");
324 var menupopup = dojo.create("menupopup",null,menulist);
325 dojo.create("menuitem", {"value": -1, "label": "---"}, menupopup);
327 fieldmapper.standardRequest(
329 "open-ils.circ.copy_location.retrieve.distinct.atomic"],{
332 "onresponse": function(r) {
333 if (list = openils.Util.readResponse(r)) {
338 "value": locname, "label": locname
351 this._build_print_routing_toggle = function(item) {
353 var checkbox = dojo.create(
355 "oncommand": function(ev) {
356 self._print_routing(item.id(), ev.target.checked);
358 "checked": start.toString()
361 this._print_routing(item.id(), start);
365 this._build_receive_toggle = function(item) {
368 "oncommand": function(ev) {
369 self._disable_row(item.id(), !ev.target.checked);
372 "name": "receive_" + item.id()
377 this._disable_row = function(item_id, disabled) {
378 var row = this.rows[item_id];
380 "textbox,menulist,checkbox:not([name^='receive_'])", row
382 function(element) { element.disabled = disabled; }
384 this._row_disabled(row, disabled);
387 this._row_disabled = function(row, disabled) {
388 if (typeof(row) == "string") row = this.rows[row];
390 var checkbox = dojo.query("checkbox", row)[1];
392 if (typeof(disabled) != "undefined")
393 checkbox.checked = !disabled;
395 return !checkbox.checked;
398 this._row_print_routing_disabled = function(row, disabled) {
399 if (typeof(row) == "string") row = this.rows[row];
401 var checkbox = dojo.query("checkbox", row)[0];
403 if (typeof(disabled) != "undefined") {
404 checkbox.checked = !disabled;
405 checkbox.doCommand();
408 return !checkbox.checked;
411 this._row_field_value = function(row, field, value) {
412 if (typeof(row) == "string") row = this.rows[row];
414 var node = dojo.query("*", node_by_name(field, row))[0];
416 if (typeof(value) == "undefined") {
419 /* XXX The new two lines /should/ each do the same thing, but
420 * apparently they don't. With only one or the other, I get
421 * skipped fields when this is called by the code that
422 * pre-populates fields based on copy templates. This may
423 * have something to do with Dojo and XUL not getting along
425 dojo.attr(node, "value", value);
430 this._print_routing = function(id, value) {
431 this._wants_print_routing[id] = value;
434 this._user_wants_autogen = function() {
435 return dojo.byId("autogen_barcodes").checked;
438 this._get_autogen_potentials = function(item_id) {
439 var hit_a_wall = false;
441 return [openils.Util.objectProperties(this.rows).sort(num_sort).filter(
445 } else if (id <= item_id || self._row_disabled(id)) {
447 } else if (self._row_field_value(id, "barcode")) {
457 this._prepare_autogen_control = function() {
458 dojo.attr("autogen_barcodes",
459 "command", function(ev) {
460 if (!ev.target.checked) {
461 var list = self._have_autogen_barcodes();
462 if (list.length && confirm(S("autogen_barcodes.remove"))) {
465 self._row_field_value(id, "barcode", "");
466 self.rows[id]._has_autogen_barcode = false;
475 this._have_autogen_barcodes = function() {
477 for (var id in this.rows)
478 if (this.rows[id]._has_autogen_barcode) list.push(id);
482 this._cn_exists_but_not_for_lib = function(lib, value) {
483 var exists = this._call_number_cache.filter(
484 function(cn) { return cn.label() == value }
486 var for_lib = exists.filter(
487 function(cn) { return cn.owning_lib() == lib; }
489 return (exists.length && !for_lib.length);
492 this._call_number_confirm_for_lib = function(lib, value) {
493 if (!this._has_confirmed_cn_for)
494 this._has_confirmed_cn_for = {};
496 if (typeof(this._has_confirmed_cn_for[lib.id()]) == "undefined") {
497 if (this._cn_exists_but_not_for_lib(lib.id(), value)) {
498 this._has_confirmed_cn_for[lib.id()] = confirm(
499 F("cn_for_lib", [lib.shortname()])
502 this._has_confirmed_cn_for[lib.id()] = true;
506 return this._has_confirmed_cn_for[lib.id()];
509 this._confirm_row_field_application = function(id, key, value) {
510 if (key == "call_number") { /* XXX make a dispatch table so we can do
511 this for other fields too */
512 return this._call_number_confirm_for_lib(
513 this.item_cache[id].stream().distribution().holding_lib(),
521 this._location_by_name = function(id, value) {
522 var lib = this.item_cache[id].stream().distribution().
524 var winners = this._location_by_lib[lib].filter(
525 function(loc) { return loc.name() == value; }
527 if (winners.length) {
528 return winners[0].id();
534 this._set_all_enabled_rows = function(key, value) {
535 /* do NOT do trimming here, set whitespace as is. */
536 for (var id in this.rows) {
537 if (!this._row_disabled(id)) {
538 if (this._confirm_row_field_application(id, key, value)) {
539 if (key == "location") /* kludge for this field */ {
540 if (actual = this._location_by_name(id, value))
541 this._row_field_value(id, key, actual);
543 this._row_field_value(id, key, value);
550 this.print_routing_lists = function(streams) {
551 fieldmapper.standardRequest(
553 "open-ils.serial.routing_list_users.fleshed_and_ordered.atomic"],{
555 this.authtoken, streams.map(function(o) { return o.id(); })
558 "oncomplete": function(r) {
559 if ((r = openils.Util.readResponse(r)) && r.length) {
560 openils.XUL.newTabEasy(
561 "/eg/serial/print_routing_list_users",
562 S("print_routing_list_users"), {
563 "show_print_button": false, /* we supply one */
564 "routing_list_data": {
565 "streams": streams, "mvr": self.bibdata.mvr,
566 "issuance": self.issuance, "users": r
568 }, true /* wrap_in_browser */
576 this.bib_lookup = function(bib_search_term, evt, is_actual_id, sub_id) {
577 if (evt && evt.keyCode != 13) return;
579 if (!bib_search_term) {
580 var bib_search_term = dojo.byId("bib_search_term").value.trim();
581 if (!bib_search_term.length) {
582 alert(S("bib_lookup.empty"));
587 hide("batch_receive_sub");
588 hide("batch_receive_entry");
591 dojo.byId("bib_lookup_submit").disabled = true;
592 fieldmapper.standardRequest(
594 "open-ils.serial.biblio.record_entry.by_identifier.atomic"], {
597 "require_subscriptions": true,
599 "is_actual_id": is_actual_id
603 "oncomplete": function(r) {
604 /* These two things better come before readResponse(),
605 * which can throw exceptions. */
607 dojo.byId("bib_lookup_submit").disabled = false;
609 var list = openils.Util.readResponse(r, false, true);
610 if (list && list.length) {
611 if (list.length > 1) {
612 /* XXX TODO just let the user pick one from a list,
613 * although this circumstance seems really
614 * unlikely. It just can't happen for TCN, and
615 * wouldn't be likely for ISxN or UPC... ? */
616 alert(S("bib_lookup.multiple"));
618 self.bibdata = list[0];
619 self._show_bibdata_bits();
620 self.choose_subscription(sub_id);
623 alert(S("bib_lookup.not_found"));
627 dojo.byId("bib_search_term").reset();
628 dojo.byId("bib_search_term").focus();
636 this.choose_subscription = function(sub_id) {
637 hide("batch_receive_bib");
638 hide("batch_receive_entry");
639 hide("batch_receive_sub_bits");
640 hide("batch_receive_issuance");
642 var subs = this.bibdata.bre.subscriptions();
645 this.choose_issuance(
646 subs.filter(function(o) { return o.id() == sub_id; })[0]
648 } else if (subs.length > 1) {
649 var menulist = dojo.create("menulist", {"id": "sub_chooser"});
650 var menupopup = dojo.create("menupopup", {}, menulist, "only");
652 this.bibdata.bre.subscriptions().forEach(
656 "label": self._sub_label(sub),
663 hard_empty(dojo.byId("sub_chooser_here"));
665 dojo.place(menulist, dojo.byId("sub_chooser_here"), "only");
666 show("batch_receive_sub");
668 this.choose_issuance(subs[0]);
672 this.choose_issuance = function(sub) {
673 hide("batch_receive_bib");
674 hide("batch_receive_entry");
675 hide("batch_receive_sub");
677 if (typeof(sub) == "undefined") { /* sub chosen from menu */
678 var sub_id = dojo.byId("sub_chooser").value;
679 this.sub = this.bibdata.bre.subscriptions().filter(
680 function(o) { return o.id() == sub_id; }
682 } else { /* only one sub possible, passed in directly */
686 this._show_sub_bits();
688 this.issuances = this._get_receivable_issuances(); /* sync */
690 if (this.issuances.length > 1) {
691 var menulist = dojo.create("menulist", {"id": "issuance_chooser"});
692 var menupopup = dojo.create("menupopup", {}, menulist, "only");
696 if (a.date_published()>b.date_published()) return 1;
697 else if (b.date_published()>a.date_published()) return -1;
704 "label": issuance.label(),
705 "value": issuance.id()
711 hard_empty("issuance_chooser_here");
712 dojo.place(menulist, dojo.byId("issuance_chooser_here"), "only");
714 show("batch_receive_issuance");
715 } else if (this.issuances.length) {
716 this.load_entry_form(this.issuances[0]);
718 alert(S("issuance_lookup.none"));
724 this._update_copy_template_cache = function() {
725 var templates_needed = openils.Util.uniqueElements(
726 openils.Util.objectProperties(this.item_cache).map(
728 return self.item_cache[id].stream().distribution().
729 receive_unit_template();
733 function(id) { return !self._copy_template_cache[id]; }
736 if (templates_needed.length) {
737 this.pcrud.search("act", {"id": templates_needed}).forEach(
739 self._copy_template_cache[tmpl.id()] = tmpl;
745 this.apply_copy_templates = function() {
746 this._update_copy_template_cache(); /* sync */
748 for (var id in this.item_cache) {
749 var item = this.item_cache[id];
751 item.stream().distribution().receive_unit_template();
752 var template = this._copy_template_cache[template_id];
754 var row = this.rows[id];
756 var tmpl_mod = template.circ_modifier();
757 var tmpl_loc = template.location();
758 var tmpl_price = template.price();
759 if (tmpl_mod != null) {
760 this._row_field_value(
761 row, "circ_modifier", tmpl_mod == "" ? 0 : tmpl_mod
765 this._row_field_value(row, "location", tmpl_loc);
767 this._row_field_value(row, "price", tmpl_price);
771 this.load_entry_form = function(issuance) {
772 if (typeof(issuance) == "undefined") {
773 var issuance_id = dojo.byId("issuance_chooser").value;
774 this.issuance = this.issuances.filter(
775 function(o) { return o.id() == issuance_id; }
778 this.issuance = issuance;
781 this._show_issuance_bits();
782 this._prepare_autogen_control();
786 fieldmapper.standardRequest(
788 "open-ils.serial.items.receivable.by_issuance.atomic"], {
789 "params": [this.authtoken, this.issuance.id()],
791 "onresponse": function(r) {
794 if (list = openils.Util.readResponse(r, false, true)) {
799 list.forEach(function(o) {self.add_entry_row(o);});
801 self.build_batch_entry_row();
803 var recv_with_units =
804 dojo.byId("batch_receive_with_units");
805 recv_with_units.doCommand();
806 if (recv_with_units.checked)
807 self.apply_copy_templates();
809 show("batch_receive_entry");
812 alert(S("item_lookup.none"));
813 if (self.issuances.length) self.choose_issuance();
822 this.toggle_receive_with_units = function(ev) {
823 var head_row = dojo.byId("batch_receive_entry_thead");
824 var batch_row = dojo.byId("entry_batch_row");
827 "barcode", "call_number", "price", "location", "circ_modifier"
830 var table_cell_func = ev.target.checked ?
831 show_table_cell : hide_table_cell;
834 if (batch_row) table_cell_func(node_by_name(key, batch_row));
835 if (head_row) table_cell_func(node_by_name(key, head_row));
837 for (var id in self.rows) {
838 table_cell_func(node_by_name(key, self.rows[id]));
843 if (!ev.target.checked) {
844 /* XXX As of the time of this writing, a blank barcode field will
845 * avoid unit creation */
846 this._set_all_enabled_rows("barcode", "");
850 this.toggle_all_receive = function(checked) {
851 for (var id in this.rows) {
852 this._disable_row(id, !checked);
856 this.toggle_all_print_routing = function(checked) {
857 for (var id in this.rows) {
858 this._row_print_routing_disabled(id, !checked);
862 this.build_batch_entry_row = function() {
863 var row = dojo.byId("entry_batch_row");
865 this.batch_controls = {};
867 node_by_name("note", row).appendChild(
868 this.batch_controls.note = dojo.create("textbox", {"size": 20})
871 node_by_name("location", row).appendChild(
872 this.batch_controls.location =
873 this._build_batch_location_dropdown()
876 node_by_name("circ_modifier", row).appendChild(
877 this.batch_controls.circ_modifier =
878 this._extend_circ_modifier_for_batch(
879 this._build_circ_modifier_dropdown() /* for all OUs */
883 node_by_name("call_number", row).appendChild(
884 this.batch_controls.call_number = this._build_call_number_control()
887 node_by_name("price", row).appendChild(
888 this.batch_controls.price = dojo.create("textbox", {"size": 9})
891 node_by_name("print_routing", row).appendChild(
894 "oncommand": function(ev) {
895 self.toggle_all_print_routing(ev.target.checked);
902 node_by_name("receive", row).appendChild(
905 "oncommand": function(ev) {
906 self.toggle_all_receive(ev.target.checked);
913 node_by_name("apply", row).appendChild(
914 dojo.create("button", {
916 "oncommand": function() { self.apply_batch_values(); }
921 this.apply_batch_values = function() {
922 var row = dojo.byId("entry_batch_row");
924 for (var key in this.batch_controls) {
925 var value = this.batch_controls[key].value;
926 if (value != "" && value != -1)
927 this._set_all_enabled_rows(key, value);
930 /* XXX genericize for all fields? */
931 delete this._has_confirmed_cn_for;
934 this.add_entry_row = function(item) {
935 this.item_cache[item.id()] = item;
936 var row = this.rows[item.id()] = dojo.clone(this.template);
938 function n(s) { return node_by_name(s, row); } /* typing saver */
940 var stream_dist_label = item.stream().distribution().label();
941 if (item.stream().routing_label())
942 stream_dist_label += " / " + item.stream().routing_label();
944 n("holding_lib").appendChild(
947 "value": item.stream().distribution().
948 holding_lib().shortname(),
949 "tooltiptext": stream_dist_label
954 n("barcode").appendChild(
958 "tabindex": 10000 + Number(item.id()), /* is this right? */
959 "onchange": function() {
960 self.autogen_if_appropriate(this, item.id());
966 n("location").appendChild(
967 this._build_location_dropdown(
968 this._get_locations_for_lib(
969 item.stream().distribution().holding_lib().id()
974 n("note").appendChild(dojo.create("textbox", {"size": 20}));
975 n("circ_modifier").appendChild(this._build_circ_modifier_dropdown());
976 n("call_number").appendChild(this._build_call_number_control(item));
977 n("price").appendChild(dojo.create("textbox", {"size": 9}));
978 n("print_routing").appendChild(this._build_print_routing_toggle(item));
979 n("receive").appendChild(this._build_receive_toggle(item));
981 this.entry_tbody.appendChild(row);
984 this.receive = function() {
986 var confirmed_missing_units = false;
988 for (var id in this.rows) {
989 if (this._row_disabled(id))
992 var item = this.item_cache[id];
994 /* Don't trim() call_number field, as existing call numbers
995 * are yielded by their label field, not by id, and if
996 * they start or end in spaces, we'll unintentionally create
997 * a new, different CN if we trim that */
998 var cn_string = this._row_field_value(id, "call_number");
999 var barcode = this._row_field_value(id, "barcode").trim();
1001 if (barcode && cn_string.length) {
1002 var unit = new sunit();
1003 unit.barcode(barcode);
1005 ["price", "location", "circ_modifier"].forEach(
1007 var value = self._row_field_value(id, field).trim();
1008 if (value) unit[field](value);
1012 unit.call_number(cn_string);
1014 } else if (barcode && !cn_string.length) {
1015 alert(S("missing_cn"));
1017 } else if (!confirmed_missing_units) {
1019 (!dojo.byId("batch_receive_with_units").checked) ||
1020 confirm(S("missing_units"))
1022 confirmed_missing_units = true;
1028 var note_value = this._row_field_value(id, "note").trim();
1030 var note = new sin();
1033 note.title(S("receive_time_note"));
1034 note.value(note_value);
1043 fieldmapper.standardRequest(
1044 ["open-ils.serial", "open-ils.serial.receive_items.one_unit_per"],{
1045 "params": [this.authtoken, items, this.sub.record_entry()],
1047 "oncomplete": function(r) {
1049 var streams_for_printing = [];
1050 while (item_id = openils.Util.readResponse(r)) {
1051 if (self._wants_print_routing[item_id]) {
1052 streams_for_printing.push(
1053 self.item_cache[item_id].stream()
1056 self.finish_receipt(item_id);
1058 if (streams_for_printing.length)
1059 self.print_routing_lists(streams_for_printing);
1069 this.finish_receipt = function(item_id) {
1070 hard_empty(this.rows[item_id]);
1071 dojo.destroy(this.rows[item_id]);
1072 delete this.rows[item_id];
1073 delete this.item_cache[item_id];
1076 this.autogen_if_appropriate = function(textbox, item_id) {
1077 if (this._user_wants_autogen() && textbox.value) {
1078 var kvlist = this._get_autogen_potentials(item_id);
1079 var list = kvlist[0];
1080 var question = kvlist[1];
1082 if (question && !confirm(S("autogen_barcodes.questionable")))
1087 fieldmapper.standardRequest(
1088 ["open-ils.cat", "open-ils.cat.item.barcode.autogen"], {
1090 this.authtoken, textbox.value, list.length
1093 "onresponse": function(r) {
1094 r = openils.Util.readResponse(r, false, true);
1096 for (var i = 0; i < r.length; i++) {
1097 var row = self.rows[list[i]];
1098 self._row_field_value(
1099 row, "barcode", r[i]
1101 row._has_autogen_barcode = true;
1111 } /* do nothing for empty list */
1115 this.init.apply(this, arguments);
1118 function my_init() {
1119 var cgi = new openils.CGI();
1121 batch_receiver = new BatchReceiver(
1122 (typeof ses == "function" ? ses() : 0) ||
1123 cgi.param("ses") || dojo.cookie("ses"),
1124 cgi.param("docid") || null, cgi.param("subid") || null