From: Dan Reuther Date: Tue, 29 Sep 2015 16:26:52 +0000 (-0400) Subject: KMAIN-1829 Bib Call Number on Holds X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=08c98ff2b881e11e3386c28d56a67db486454820;p=working%2FEvergreen.git KMAIN-1829 Bib Call Number on Holds Problem: Call Number wouldn't show up in list view of patron holds screen when status was "Waiting for Copy." Solution: Add check to Call Number column for specific copy, and if nonexistant, pull from MARC info for selected item. Signed-off-by: Kyle Huckins --- Modified by berick to avoid bib call number / MARC processing when a call number is available, since this is already a heavy API call. Replaced some tabs. Added some comments. Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm index a0fb2c5a71..131e512330 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm @@ -20,6 +20,8 @@ use strict; use warnings; 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; @@ -3461,6 +3463,21 @@ sub uber_hold_impl { 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}; @@ -3470,6 +3487,8 @@ sub uber_hold_impl { 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) : ()), diff --git a/Open-ILS/xul/staff_client/server/patron/holds.js b/Open-ILS/xul/staff_client/server/patron/holds.js index 35bf91a3f2..de69e915a2 100644 --- a/Open-ILS/xul/staff_client/server/patron/holds.js +++ b/Open-ILS/xul/staff_client/server/patron/holds.js @@ -94,7 +94,19 @@ patron.holds.prototype = { 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) {