X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=opac%2Fopac-detail.pl;h=bab4ff6983be155338ffa8138034d56df5db1043;hb=afccbfcce7192c6e1fcd73f137135cb5289c3d3d;hp=4371f6524bef3cee3fa64518fd0f7d85e2a0a6cb;hpb=90c323f7135d1089e4b2fa22a0c270fba3870b39;p=koha.git diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 4371f6524b..bab4ff6983 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -441,6 +441,38 @@ if ($hideitems) { @items = @all_items; } +my $branches = GetBranches(); +my $branch = C4::Context->userenv->{branch}; +if ( C4::Context->preference('HighlightOwnItemsOnOPAC') ) { + if ( + ( ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) && $branch ) + || + C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch' + ) { + my $branchname; + if ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) { + $branchname = $branches->{$branch}->{'branchname'}; + } + elsif ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch' ) { + $branchname = $branches->{ $ENV{'BRANCHCODE'} }->{'branchname'}; + } + + my @our_items; + my @other_items; + + foreach my $item ( @items ) { + if ( $item->{'branchname'} eq $branchname ) { + $item->{'this_branch'} = 1; + push( @our_items, $item ); + } else { + push( @other_items, $item ); + } + } + + @items = ( @our_items, @other_items ); + } +} + my $dat = &GetBiblioData($biblionumber); my $itemtypes = GetItemTypes(); @@ -511,7 +543,6 @@ if ( $show_holds_count || $show_priority) { $template->param( show_priority => $has_hold ) ; my $norequests = 1; -my $branches = GetBranches(); my %itemfields; my (@itemloop, @otheritemloop); my $currentbranch = C4::Context->userenv ? C4::Context->userenv->{branch} : undef;