Bug 7614: Don't allow un-usable pickup locations in the opac pickup locations pulldown
authorKyle M Hall <kyle@bywatersolutiosn.com>
Mon, 20 Aug 2018 14:48:07 +0000 (10:48 -0400)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 25 Jan 2019 14:47:00 +0000 (14:47 +0000)
Also fully qualifies some subroutine calls that fail for reasons unkown.

Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

C4/Items.pm
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt
opac/opac-reserve.pl

index 3b006c6..04fe579 100644 (file)
@@ -223,9 +223,9 @@ sub AddItemFromMarc {
     my $frameworkcode = C4::Biblio::GetFrameworkCode( $biblionumber );
     my ($itemtag,$itemsubfield)=C4::Biblio::GetMarcFromKohaField("items.itemnumber",$frameworkcode);
 
-    my $localitemmarc=MARC::Record->new;
-    $localitemmarc->append_fields($source_item_marc->field($itemtag));
-    my $item = TransformMarcToKoha( $localitemmarc, $frameworkcode ,'items');
+       my $localitemmarc=MARC::Record->new;
+       $localitemmarc->append_fields($source_item_marc->field($itemtag));
+    my $item = C4::Biblio::TransformMarcToKoha( $localitemmarc, $frameworkcode ,'items');
     my $unlinked_item_subfields = _get_unlinked_item_subfields($localitemmarc, $frameworkcode);
     return AddItem($item, $biblionumber, $dbh, $frameworkcode, $unlinked_item_subfields);
 }
@@ -284,7 +284,7 @@ sub AddItem {
 
     $item->{'itemnumber'} = $itemnumber;
 
-    ModZebra( $item->{biblionumber}, "specialUpdate", "biblioserver" );
+    C4::Biblio::ModZebra( $item->{biblionumber}, "specialUpdate", "biblioserver" );
 
     logaction( "CATALOGUING", "ADD", $itemnumber, "item" )
       if C4::Context->preference("CataloguingLog");
@@ -2032,7 +2032,7 @@ sub _get_unlinked_item_subfields {
     my $original_item_marc = shift;
     my $frameworkcode = shift;
 
-    my $marcstructure = GetMarcStructure(1, $frameworkcode, { unsafe => 1 });
+    my $marcstructure = C4::Biblio::GetMarcStructure(1, $frameworkcode, { unsafe => 1 });
 
     # assume that this record has only one field, and that that
     # field contains only the item information
index d55672f..15dfe5e 100644 (file)
                                                         </li>
                                                     [% END %]
 
-
                                                     [% UNLESS ( singleBranchMode ) %]
                                                         [% IF ( bibitemloo.holdable && Koha.Preference('OPACAllowUserToChooseBranch')) %]
                                                             <li class="branch">
index e896975..bb71dc7 100755 (executable)
@@ -173,6 +173,7 @@ foreach my $biblioNumber (@biblionumbers) {
 
     # Compute the priority rank.
     my $biblio = Koha::Biblios->find( $biblioNumber );
+    $biblioData->{object} = $biblio;
     my $holds = $biblio->holds;
     my $rank = $holds->count;
     $biblioData->{reservecount} = 1;    # new reserve
@@ -390,7 +391,6 @@ $template->param('item_level_itypes' => $itemLevelTypes);
 
 foreach my $biblioNum (@biblionumbers) {
 
-    my @not_available_at = ();
     my $record = GetMarcBiblio({ biblionumber => $biblioNum });
     # Init the bib item with the choices for branch pickup
     my %biblioLoopIter;
@@ -402,6 +402,12 @@ foreach my $biblioNum (@biblionumbers) {
         &get_out($query, $cookie, $template->output);
     }
 
+    my @not_available_at = ();
+    my $biblio = $biblioData->{object};
+    foreach my $library ( $pickup_locations->as_list ) {
+        push( @not_available_at, $library->branchcode ) unless $biblio->can_be_transferred({ to => $library });
+    }
+
     my $frameworkcode = GetFrameworkCode( $biblioData->{biblionumber} );
     $biblioLoopIter{biblionumber} = $biblioData->{biblionumber};
     $biblioLoopIter{title} = $biblioData->{title};