var importItemDefs = [];
var matchSets = {};
var mergeProfiles = [];
+var copyStatusCache = {};
+var copyLocationCache = {};
/**
* Grab initial data
*/
function vlInit() {
authtoken = openils.User.authtoken;
- var initNeeded = 7; // how many async responses do we need before we're init'd
+ var initNeeded = 8; // how many async responses do we need before we're init'd
var initCount = 0; // how many async reponses we've received
openils.Util.registerEnterHandler(
}
);
+ new openils.PermaCrud().retrieveAll('ccs',
+ { async: true,
+ oncomplete: function(r) {
+ var stats = openils.Util.readResponse(r);
+ dojo.forEach(stats, function(stat){copyStatusCache[stat.id()] = stat});
+ checkInitDone();
+ }
+ }
+ );
+
vlAttrEditorInit();
vlExportInit();
}
return '';
}
+function vlCopyStatus(rowIdx, item) {
+ if(!item) return '';
+ var value = this.grid.store.getValue(item, this.field);
+ if(value) return copyStatusCache[value].name();
+ return '';
+}
+
+// Note, we don't pre-fetch all copy locations because there could be
+// a lot of them. Instead, fetch-and-cache on demand.
+function vlCopyLocation(rowIdx, item) {
+ if(item) {
+ var value = this.grid.store.getValue(item, this.field);
+ if(value) {
+ if(!copyLocationCache[value]) {
+ copyLocationCache[value] =
+ new openils.PermaCrud().retrieve('acpl', value);
+ }
+ return copyLocationCache[value].name();
+ }
+ }
+ return '';
+}
+
function vlFormatViewMatchMARC(id) {
return '<a href="javascript:void(0);" onclick="vlLoadMARCHtml(' + id + ', true, '+
'function(){displayGlobalDiv(\'vl-match-div\');});">' + this.name + '</a>';
<tr>
<th field='owning_lib' get='vlGetOrg'/>
<th field='circ_lib' get='vlGetOrg'/>
+ <th field='status' get='vlCopyStatus'/>
+ <th field='location' get='vlCopyLocation'/>
</tr>
</thead>
</table>
<tr>
<th field='owning_lib' get='vlGetOrg'/>
<th field='circ_lib' get='vlGetOrg'/>
+ <th field='status' get='vlCopyStatus'/>
+ <th field='location' get='vlCopyLocation'/>
</tr>
</thead>
</table>