<field reporter:label="Code" name="code" reporter:datatype="text" oils_obj:required="true"/>
<field reporter:label="Value" name="value" reporter:datatype="text" oils_obj:required="true"/>
<field reporter:label="Description" name="description" reporter:datatype="text"/>
+ <field reporter:label="OPAC Visible" name="opac_visible" reporter:datatype="bool"/>
+ <field reporter:label="Search Label" name="search_label" reporter:datatype="text" oils_persist:i18n="true"/>
</fields>
<links>
<link field="ctype" reltype="has_a" key="name" map="" class="crad"/>
# search for objects of class $hint where field=value
$cache{search}{$hint} = {};
$ro_object_subs->{$search_key} = sub {
- my ($field, $val) = @_;
+ my ($field, $val, $filterfield, $filterval) = @_;
my $method = "search_$eclass";
+ my $cacheval = $val;
+ my $search_obj = {$field => $val};
+ if($filterfield) {
+ $search_obj->{$filterfield} = $filterval;
+ $cacheval .= ':' . $filterfield . ':' . $filterval;
+ }
$cache{search}{$hint}{$field} = {} unless $cache{search}{$hint}{$field};
- $cache{search}{$hint}{$field}{$val} = $e->$method({$field => $val})
- unless $cache{search}{$hint}{$field}{$val};
- return $cache{search}{$hint}{$field}{$val};
+ $cache{search}{$hint}{$field}{$cacheval} = $e->$method($search_obj)
+ unless $cache{search}{$hint}{$field}{$cacheval};
+ return $cache{search}{$hint}{$field}{$cacheval};
};
}
);
CREATE TABLE config.coded_value_map (
- id SERIAL PRIMARY KEY,
- ctype TEXT NOT NULL REFERENCES config.record_attr_definition (name) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
- code TEXT NOT NULL,
- value TEXT NOT NULL,
- description TEXT
+ id SERIAL PRIMARY KEY,
+ ctype TEXT NOT NULL REFERENCES config.record_attr_definition (name) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
+ code TEXT NOT NULL,
+ value TEXT NOT NULL,
+ description TEXT,
+ opac_visible BOOL NOT NULL DEFAULT TRUE, -- For TPac selectors
+ search_label TEXT
);
CREATE VIEW config.language_map AS SELECT code, value FROM config.coded_value_map WHERE ctype = 'item_lang';
--- /dev/null
+ALTER TABLE config.coded_value_map
+ ADD COLUMN opac_visible BOOL NOT NULL DEFAULT TRUE,
+ ADD COLUMN search_label TEXT;
<table jsId="ccvmGrid"
autoHeight='true'
dojoType="openils.widget.AutoGrid"
- fieldOrder="['ctype', 'code', 'value', 'description']"
+ fieldOrder="['ctype', 'code', 'value', 'description', 'opac_visible', 'search_label']"
query="{code: '*'}"
defaultCellWidth='"25%"'
fmClass='ccvm'
all_values = [];
attr_class = '';
FOR attr_class IN attr;
- all_values = ctx.search_ccvm('ctype', attr_class);
+ all_values = ctx.search_ccvm('ctype', attr_class, 'opac_visible', 't');
IF all_values.size > 0; LAST; END;
END;
name = name || "fi:" _ attr_class;
# leverage TT's array.sort('<hashkey>') behavior
sorter = [];
FOR o IN all_values;
- sorter.push({code => o.code, value => o.value});
+ sorter.push({code => o.code, value => (o.search_label ? o.search_label : o.value)});
END;
FOR o IN sorter.sort('value') %]
<option value='[% o.code | uri %]'[% values.grep('^' _ o.code _ '$').size ? ' selected="selected"' : '' %]>[% o.value | html %]</option>
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}});
+ var req = new Request('open-ils.fielder:open-ils.fielder.ccvm.atomic', {"cache":1,"query":{"ctype":ctypes, "opac_visible":"t"}});
req.callback(advDrawBibExtras);
req.request.ctypes = ctypes;
req.send();
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;
+ return ((a.search_label ? a.search_label : a.value) < (b.search_label ? b.search_label : b.value)) ? -1 : 1;
}
);
dojo.forEach(ctypeData,
function(thing) {
- var opt = insertSelectorVal(sel, -1, thing.value, thing.code);
- opt.setAttribute('title', thing.value);
+ var opt = insertSelectorVal(sel, -1, (thing.search_label ? thing.search_label : thing.value), thing.code);
+ opt.setAttribute('title', (thing.search_label ? thing.search_label : thing.value));
}
);
}