| Lines 59-65
          use C4::Koha;
      
      
        Link Here | 
        
          | 59 | use List::MoreUtils qw( any uniq ); | 59 | use List::MoreUtils qw( any uniq ); | 
        
          | 60 | use Koha::Biblios; | 60 | use Koha::Biblios; | 
        
          | 61 | use Koha::CirculationRules; | 61 | use Koha::CirculationRules; | 
            
              | 62 | use Koha::Items; |  |  | 
        
          | 63 | use Koha::ItemTypes; | 62 | use Koha::ItemTypes; | 
        
          | 64 | use Koha::Patrons; | 63 | use Koha::Patrons; | 
        
          | 65 | use Koha::RecordProcessor; | 64 | use Koha::RecordProcessor; | 
  
    | Lines 85-123
          my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
      
      
        Link Here | 
        
          | 85 |     } | 84 |     } | 
        
          | 86 | ); | 85 | ); | 
        
          | 87 |  | 86 |  | 
          
            
              | 88 | my $patron = Koha::Patrons->find( $loggedinuser ); | 87 | my $biblio = Koha::Biblios->find( $biblionumber, { prefetch => [ 'metadata', 'items' ] } ); | 
            
              | 89 | my $borcat = q{}; |  |  | 
            
              | 90 | if ( C4::Context->preference('OpacHiddenItemsExceptions') ) { | 
            
              | 91 |     # we need to fetch the borrower info here, so we can pass the category | 
            
              | 92 |     $borcat = $patron ? $patron->categorycode : $borcat; | 
            
              | 93 | } | 
        
          | 94 |  | 88 |  | 
          
            
              | 95 | my $record = GetMarcBiblio({ | 89 | unless ( $biblio ) { | 
            
              | 96 |     biblionumber => $biblionumber, |  |  | 
            
              | 97 |     embed_items  => 1, | 
            
              | 98 |     opac         => 1, | 
            
              | 99 |     borcat       => $borcat }); | 
            
              | 100 | if ( ! $record ) { | 
        
          | 101 |     print $query->redirect("/cgi-bin/koha/errors/404.pl"); | 90 |     print $query->redirect("/cgi-bin/koha/errors/404.pl"); | 
        
          | 102 |     exit; | 91 |     exit; | 
        
          | 103 | } | 92 | } | 
        
          | 104 |  | 93 |  | 
          
            
              | 105 | my @all_items = GetItemsInfo($biblionumber); | 94 | my $patron = Koha::Patrons->find( $loggedinuser ); | 
            
              | 106 | my $biblio = Koha::Biblios->find( $biblionumber ); | 95 |  | 
            
              | 107 | my $framework = $biblio ? $biblio->frameworkcode : q{}; | 96 | my $opachiddenitems_rules = C4::Context->yaml_preference('OpacHiddenItems'); | 
            
              | 108 | my $tagslib = &GetMarcStructure( 0, $framework ); | 97 |  | 
            
              | 109 | my ($tag_itemnumber,$subtag_itemnumber) = &GetMarcFromKohaField( 'items.itemnumber' ); | 98 | unless ( $patron and $patron->category->override_hidden_items ) { | 
            
              | 110 | my @nonhiddenitems = $record->field($tag_itemnumber); | 99 |     # only skip this check if there's a logged in user | 
            
              | 111 | if (scalar @all_items >= 1 && scalar @nonhiddenitems == 0) { | 100 |     # and its category overrides OpacHiddenItems | 
            
              | 112 |     print $query->redirect("/cgi-bin/koha/errors/404.pl"); | 101 |     if ( $biblio->hidden_in_opac({ rules => $opachiddenitems_rules }) ) { | 
            
              | 113 |     exit; | 102 |         print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early | 
            
              |  |  | 103 |         exit; | 
            
              | 104 |     } | 
        
          | 114 | } | 105 | } | 
        
          | 115 |  | 106 |  | 
            
              |  |  | 107 | my $record      = $biblio->metadata->record; | 
            
              | 108 | my $marcflavour = C4::Context->preference("marcflavour"); | 
            
              | 109 |  | 
        
          | 116 | my $record_processor = Koha::RecordProcessor->new({ | 110 | my $record_processor = Koha::RecordProcessor->new({ | 
        
          | 117 |     filters => 'ViewPolicy', | 111 |     filters => 'ViewPolicy', | 
        
          | 118 |     options => { | 112 |     options => { | 
        
          | 119 |         interface => 'opac', | 113 |         interface => 'opac', | 
          
            
              | 120 |         frameworkcode => $framework | 114 |         frameworkcode => $biblio->frameworkcode | 
        
          | 121 |     } | 115 |     } | 
        
          | 122 | }); | 116 | }); | 
        
          | 123 | $record_processor->process($record); | 117 | $record_processor->process($record); | 
  
    | Lines 130-135
          if(my $cart_list = $query->cookie("bib_list")){
      
      
        Link Here | 
        
          | 130 |     } | 124 |     } | 
        
          | 131 | } | 125 | } | 
        
          | 132 |  | 126 |  | 
            
              |  |  | 127 | my $tagslib = &GetMarcStructure( 0, $biblio->frameworkcode ); | 
        
          | 133 | my ($bt_tag,$bt_subtag) = GetMarcFromKohaField( 'biblio.title' ); | 128 | my ($bt_tag,$bt_subtag) = GetMarcFromKohaField( 'biblio.title' ); | 
        
          | 134 | $template->param( | 129 | $template->param( | 
        
          | 135 |     bibliotitle => $biblio->title, | 130 |     bibliotitle => $biblio->title, | 
  
    | Lines 137-144
          $template->param(
      
      
        Link Here | 
        
          | 137 |      $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8;   # except -8; | 132 |      $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8;   # except -8; | 
        
          | 138 |  | 133 |  | 
        
          | 139 | my $allow_onshelf_holds; | 134 | my $allow_onshelf_holds; | 
          
            
              | 140 | for my $itm (@all_items) { | 135 | my $items = $biblio->items; | 
            
              | 141 |     my $item = Koha::Items->find( $itm->{itemnumber} ); | 136 | while ( my $item = $items->next ) { | 
        
          | 142 |     $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } ); | 137 |     $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } ); | 
        
          | 143 |     last if $allow_onshelf_holds; | 138 |     last if $allow_onshelf_holds; | 
        
          | 144 | } | 139 | } | 
  
    | Lines 341-347
          if ( C4::Context->preference("OPACISBD") ) {
      
      
        Link Here | 
        
          | 341 | } | 336 | } | 
        
          | 342 |  | 337 |  | 
        
          | 343 | #Search for title in links | 338 | #Search for title in links | 
            
              | 344 | my $marcflavour  = C4::Context->preference("marcflavour"); |  |  | 
        
          | 345 | my $dat = TransformMarcToKoha( $record ); | 339 | my $dat = TransformMarcToKoha( $record ); | 
        
          | 346 | my $isbn = GetNormalizedISBN(undef,$record,$marcflavour); | 340 | my $isbn = GetNormalizedISBN(undef,$record,$marcflavour); | 
        
          | 347 | my $marccontrolnumber   = GetMarcControlnumber ($record, $marcflavour); | 341 | my $marccontrolnumber   = GetMarcControlnumber ($record, $marcflavour); | 
            
              | 348 | -  |  |  |