use OpenILS::Application::AppUtils;
use DateTime;
use Data::Dumper;
+use MARC::Record;
+use MARC::File::XML (BinaryEncoding => 'UTF-8');
use OpenSRF::EX qw(:try);
use OpenILS::Perm;
use OpenILS::Event;
my( $mvr, $volume, $copy, $issuance, $part, $bre ) = find_hold_mvr($e, $hold, $args);
+ # --------------------
+ # KCLS - include bib call number if no asset.call_number is available
+ my $bibcn;
+ if (!$volume) {
+ my $marc;
+ eval { $marc = MARC::Record->new_from_xml($bre->marc()) };
+ if ($@) {
+ $logger->error(
+ "Error processing MARC record for bib ".$bre->id." $@");
+ } else {
+ $bibcn = $marc->subfield('092',"a");
+ }
+ }
+ # --------------------
+
flesh_hold_notices([$hold], $e) unless $args->{suppress_notices};
flesh_hold_transits([$hold]) unless $args->{suppress_transits};
my $resp = {
hold => $hold,
bre_id => $bre->id,
+ # Allows data from the bib call number to be used
+ ($bibcn ? (bibcn => $bibcn) : ()),
($copy ? (copy => $copy) : ()),
($volume ? (volume => $volume) : ()),
($issuance ? (issuance => $issuance) : ()),
row.my.status = blob.status;
row.my.ahr.status( blob.status );
row.my.acp = blob.copy;
- row.my.acn = blob.volume;
+ // KCLS --------------------------
+ // If we're waiting for Copy, create a new ACN object and
+ // generate its data using the bib call number.
+ if (!blob.volume) {
+ var bibacn = new acn();
+ bibacn.id("No Copy"); //Mocks an ID, required for the Call Number to show.
+ bibacn.label("Bib: " + blob.bibcn);
+ bibacn.prefix(-1); //Prevents acnp errors
+ bibacn.suffix(-1); //Prevents acns errors
+ row.my.acn = bibacn;
+ } else { //Otherwise, use the data from the current copy.
+ row.my.acn = blob.volume;
+ }
row.my.mvr = blob.mvr;
row.my.part = blob.part;
if (blob.part) {