__PACKAGE__->register_method(
method => 'bib_extras',
- api_name => 'open-ils.search.biblio.lit_form_map.retrieve.all'
+ api_name => 'open-ils.search.biblio.lit_form_map.retrieve.all',
+ ctype => 'lit_form'
);
__PACKAGE__->register_method(
method => 'bib_extras',
- api_name => 'open-ils.search.biblio.item_form_map.retrieve.all'
+ api_name => 'open-ils.search.biblio.item_form_map.retrieve.all',
+ ctype => 'item_form'
);
__PACKAGE__->register_method(
method => 'bib_extras',
- api_name => 'open-ils.search.biblio.item_type_map.retrieve.all'
+ api_name => 'open-ils.search.biblio.item_type_map.retrieve.all',
+ ctype => 'item_type',
);
__PACKAGE__->register_method(
method => 'bib_extras',
- api_name => 'open-ils.search.biblio.bib_level_map.retrieve.all'
+ api_name => 'open-ils.search.biblio.bib_level_map.retrieve.all',
+ ctype => 'bib_level'
);
__PACKAGE__->register_method(
method => 'bib_extras',
- api_name => 'open-ils.search.biblio.audience_map.retrieve.all'
+ api_name => 'open-ils.search.biblio.audience_map.retrieve.all',
+ ctype => 'audience'
);
sub bib_extras {
my $self = shift;
+ $logger->warn("deprecation warning: " .$self->api_name);
my $e = new_editor();
- return $e->retrieve_all_config_lit_form_map()
- if( $self->api_name =~ /lit_form/ );
+ my $ctype = $self->{ctype};
+ my $ccvms = $e->search_config_coded_value_map({ctype => $ctype});
- return $e->retrieve_all_config_item_form_map()
- if( $self->api_name =~ /item_form_map/ );
-
- return $e->retrieve_all_config_item_type_map()
- if( $self->api_name =~ /item_type_map/ );
-
- return $e->retrieve_all_config_bib_level_map()
- if( $self->api_name =~ /bib_level_map/ );
-
- return $e->retrieve_all_config_audience_map()
- if( $self->api_name =~ /audience_map/ );
+ my @objs;
+ for my $ccvm (@$ccvms) {
+ my $obj = "Fieldmapper::config::${ctype}_map"->new;
+ $obj->value($ccvm->value);
+ $obj->code($ccvm->code);
+ $obj->description($ccvm->description) if $obj->can('description');
+ push(@objs, $obj);
+ }
- return [];
+ return \@objs;
}
var FETCH_COPY_LOCATIONS = 'open-ils.circ:open-ils.circ.copy_location.retrieve.all';
var FETCH_COPY_NOTES = 'open-ils.circ:open-ils.circ.copy_note.retrieve.all';
var FETCH_COPY_STAT_CATS = 'open-ils.circ:open-ils.circ.asset.stat_cat_entries.fleshed.retrieve_by_copy';
-var FETCH_LIT_FORMS = 'open-ils.search:open-ils.search.biblio.lit_form_map.retrieve.all';
-var FETCH_ITEM_FORMS = 'open-ils.search:open-ils.search.biblio.item_form_map.retrieve.all';
-var FETCH_ITEM_TYPES = 'open-ils.search:open-ils.search.biblio.item_type_map.retrieve.all';
-var FETCH_BIB_LEVELS = 'open-ils.search:open-ils.search.biblio.bib_level_map.retrieve.all';
-var FETCH_AUDIENCES = 'open-ils.search:open-ils.search.biblio.audience_map.retrieve.all';
+
+/* XXX deprecated. Use ccvm's instead */
+var FETCH_LIT_FORMS = 'open-ils.search:open-ils.search.biblio.lit_form_map.retrieve.all';
+var FETCH_ITEM_FORMS = 'open-ils.search:open-ils.search.biblio.item_form_map.retrieve.all';
+var FETCH_ITEM_TYPES = 'open-ils.search:open-ils.search.biblio.item_type_map.retrieve.all';
+var FETCH_BIB_LEVELS = 'open-ils.search:open-ils.search.biblio.bib_level_map.retrieve.all';
+var FETCH_AUDIENCES = 'open-ils.search:open-ils.search.biblio.audience_map.retrieve.all';
+/* ----------------------------------- */
+
//var FETCH_HOLD_STATUS = 'open-ils.circ:open-ils.circ.hold.status.retrieve';
var FETCH_HOLD_STATUS = 'open-ils.circ:open-ils.circ.hold.queue_stats.retrieve';
var FETCH_NON_CAT_CIRCS = 'open-ils.circ:open-ils.circ.open_non_cataloged_circulation.user';
$n($('adv_global_tbody'), 'term').focus();
- var extras = [
- FETCH_LIT_FORMS,
- FETCH_ITEM_FORMS,
- FETCH_ITEM_TYPES,
- FETCH_AUDIENCES,
- FETCH_BIB_LEVELS
- ];
-
- for( var x in extras ) {
-
- var req = new Request(extras[x]);
-
- if(x == 0) req.request.sel = $('adv_global_lit_form');
- if(x == 1) req.request.sel = $('adv_global_item_form');
- if(x == 2) req.request.sel = $('adv_global_item_type');
- if(x == 3) req.request.sel = $('adv_global_audience');
- if(x == 4) req.request.sel = $('adv_global_bib_level');
-
- req.callback(advDrawBibExtras);
- req.send();
- }
+ var ctypes = ["bib_level", "item_form", "item_type", "audience", "lit_form"];
+
+ var req = new Request('open-ils.fielder:open-ils.fielder.ccvm.atomic', {"cache":1,"query":{"ctype":ctypes}});
+ req.callback(advDrawBibExtras);
+ req.request.ctypes = ctypes;
+ req.send();
var input = $n($('adv_global_trow'), 'term');
input.focus();
function advDrawBibExtras(r) {
var data = r.getResultObject();
- var sel = r.sel;
-
- data = data.sort( /* sort alphabetically */
- function(a,b) {
- if( a.value() < b.value() ) return -1;
- if( a.value() > b.value() ) return 1;
- return 0;
- }
- );
-
- for( var d = 0; d < data.length; d++ ) {
- var thing = data[d];
- var opt = insertSelectorVal( sel, -1, thing.value(), thing.code() );
- opt.setAttribute('title', thing.value());
- }
+ var ctypes = r.ctypes
+ dojo.forEach(ctypes,
+ function(ctype) {
+ var sel = $('adv_global_' + ctype);
+ var ctypeData = dojo.filter(data, function(item) { return item.ctype == ctype } );
+ ctypeData = ctypeData.sort(
+ function(a,b) { /* sort alphabetically */
+ return (a.value < b.value) ? -1 : 1;
+ }
+ );
+ dojo.forEach(ctypeData,
+ function(thing) {
+ var opt = insertSelectorVal(sel, -1, thing.value, thing.code);
+ opt.setAttribute('title', thing.value);
+ }
+ );
+ }
+ );
}
function advSelToStringList(sel) {