'LI_ATTR_SEARCH_TOO_LARGE': "That file is too large for this operation.",
'SELECT_AN_LI_ATTRIBUTE': "You must select an LI attribute.",
'NO_RESULTS': "No results.",
- 'ISBN_SAVE_DIALOG_TITLE': "Save ISBNs to a file",
- 'ISBN_SHORT_LIST': "Not all of the selected items had ISBNs.\nChoose OK to save the ISBNs that could be found.",
- 'ISBN_EMPTY_LIST': "No ISBNs found."
+ 'EXPORT_SAVE_DIALOG_TITLE': "Save field values to a file",
+ 'EXPORT_SHORT_LIST': "Not all of the selected items had the attribute '${0}'.\nChoose OK to save those values that could be found.",
+ 'EXPORT_EMPTY_LIST': "No values for attribute '${0}' found."
}
dojo.requireLocalization('openils.acq', 'acq');
var localeStrings = dojo.i18n.getLocalization('openils.acq', 'acq');
const XUL_OPAC_WRAPPER = 'chrome://open_ils_staff_client/content/cat/opac.xul';
+var li_exportable_attrs = ["issn", "isbn", "upc"];
function nodeByName(name, context) {
return dojo.query('[name='+name+']', context)[0];
this.createAssets();
break;
- case 'export_isbn_list':
- this.exportISBNList();
+ case 'export_attr_list':
+ this.chooseExportAttr();
break;
case 'add_brief_record':
);
}
- /* Should really think about generalizing this to do more than ISBN #s */
- this.exportISBNList = function() {
- var selected = this.getSelected();
- var isbn_list = selected.map(
+ this.chooseExportAttr = function() {
+ if (!acqLitExportAttrSelector._li_setup) {
+ var self = this;
+ acqLitExportAttrSelector.store = new dojo.data.ItemFileReadStore(
+ {
+ "data": acqliad.toStoreData(
+ (new openils.PermaCrud()).search(
+ "acqliad", {"code": li_exportable_attrs}
+ )
+ )
+ }
+ );
+ acqLitExportAttrSelector.setValue();
+ acqLitExportAttrButton.onClick = function(){self.exportAttrList();};
+ acqLitExportAttrSelector._li_setup = true;
+ }
+ openils.Util.show("acq-lit-export-attr-holder", "inline");
+ };
+
+ this.exportAttrList = function() {
+ var attr_def = acqLitExportAttrSelector.item;
+ var li_list = this.getSelected();
+ var value_list = li_list.map(
function(li) {
return (new openils.acq.Lineitem({"lineitem": li})).findAttr(
- "isbn", "lineitem_marc_attr_definition"
+ attr_def.code, "lineitem_marc_attr_definition"
);
}
).filter(function(attr) { return Boolean(attr); });
- if (isbn_list.length > 0) {
- if (isbn_list.length < selected.length) {
- if (!confirm(localeStrings.ISBN_SHORT_LIST)) {
+ if (value_list.length > 0) {
+ if (value_list.length < li_list.length) {
+ if (!confirm(
+ dojo.string.substitute(
+ localeStrings.EXPORT_SHORT_LIST, [attr_def.description]
+ )
+ )) {
return;
}
}
try {
openils.XUL.contentToFileSaveDialog(
- isbn_list.join("\n"),
- localeStrings.ISBN_SAVE_DIALOG_TITLE
+ value_list.join("\n"),
+ localeStrings.EXPORT_SAVE_DIALOG_TITLE
);
} catch (E) {
alert(E);
}
} else {
- alert(localeStrings.ISBN_EMPTY_LIST);
+ alert(dojo.string.substitute(
+ localeStrings.EXPORT_EMPTY_LIST, [attr_def.description]
+ ));
}
+
+ openils.Util.hide("acq-lit-export-attr-holder");
};
this.printPO = function() {
dojo.require("openils.XUL");
dojo.require("openils.widget.AutoFieldWidget");
-var _searchable_by_array = ["issn", "isbn", "upc"];
var combinedAttrValueArray = [];
var scalarAttrSearchManager;
var liTable;
function prepareArraySearchStore(pcrud) {
attrArrayDefSelector.store = new dojo.data.ItemFileReadStore({
"data": acqliad.toStoreData(
- pcrud.search("acqliad", {"code": _searchable_by_array})
+ pcrud.search("acqliad", {"code": li_exportable_attrs})
)
});
}
<option mask='pl' value='order_ready'>Mark Ready for Order</option>
<option mask='*' value='delete_selected'>Delete Selected Items</option>
<option mask='*' value='add_brief_record'>Add Brief Record</option>
- <option mask='*' value='export_isbn_list'>Export ISBN List</option>
+ <option mask='*' value='export_attr_list'>Export Single Attribute List</option>
<option mask='po' value='' disabled='disabled'>----PO----</option>
<option mask='sr|pl' value='create_order'>Create Purchase Order</option>
<option mask='po' value='create_assets'>Load Bibs and Items</option>
<option mask='po' value='rollback_receive_po'>Un-Receive Purchase Order</option>
<option mask='po' value='print_po'>Print Purchase Order</option>
</select>
+ <span id="acq-lit-export-attr-holder" class="hidden">
+ <input dojoType="dijit.form.FilteringSelect" id="acq-lit-export-attr" jsId="acqLitExportAttrSelector" labelAttr="description" searchAttr="description" />
+ <span dojoType="dijit.form.Button" jsId="acqLitExportAttrButton">Export List</span>
+ </span>
</span>
<span id='acq-lit-generic-progress' class='hidden'>
<span dojoType="dijit.ProgressBar" style="width:300px" jsId="litGenericProgress"></span>