Bugzilla – Attachment 11498 Details for
Bug 7690
hidelostitems not working in Normal Display
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch
Bug-7690-hidelostitems-not-working-in-Normal-Display.patch (text/plain), 6.00 KB, created by
Fridolin Somers
on 2012-08-09 14:03:11 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2012-08-09 14:03:11 UTC
Size:
6.00 KB
patch
obsolete
>From 785580196607af774c754c0dd56826e633a775ef Mon Sep 17 00:00:00 2001 >From: Fridolyn SOMERS <fridolyn.somers@biblibre.com> >Date: Thu, 9 Aug 2012 12:43:20 +0200 >Subject: [PATCH] Bug 7690: hidelostitems not working in Normal Display > >--- > C4/Search.pm | 35 ++++++++++++-------- > .../opac-tmpl/prog/en/modules/opac-results.tt | 4 +-- > 2 files changed, 23 insertions(+), 16 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index fd81610..01a918a 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -1415,7 +1415,7 @@ sub buildQuery { > > my @search_results = searchResults($search_context, $searchdesc, $hits, > $results_per_page, $offset, $scan, >- @marcresults, $hidelostitems); >+ @marcresults); > > Format results in a form suitable for passing to the template > >@@ -1629,9 +1629,9 @@ sub searchResults { > my $items_count = scalar(@fields); > my $maxitems_pref = C4::Context->preference('maxItemsinSearchResults'); > my $maxitems = $maxitems_pref ? $maxitems_pref - 1 : 1; >+ my @hiddenitems; # hidden itemnumbers based on OpacHiddenItems syspref > > # loop through every item >- my @hiddenitems; > foreach my $field (@fields) { > my $item; > >@@ -1641,11 +1641,20 @@ sub searchResults { > } > $item->{description} = $itemtypes{ $item->{itype} }{description}; > >- # Hidden items >+ # OPAC hidden items > if ($is_opac) { >+ # hidden because lost >+ if ($hidelostitems && $item->{itemlost}) { >+ $hideatopac_count++; >+ next; >+ } >+ # hidden based on OpacHiddenItems syspref > my @hi = C4::Items::GetHiddenItemnumbers($item); >- $item->{'hideatopac'} = @hi; >- push @hiddenitems, @hi; >+ if (scalar @hi) { >+ push @hiddenitems, @hi; >+ $hideatopac_count++; >+ next; >+ } > } > > my $hbranch = C4::Context->preference('HomeOrHoldingBranch') eq 'homebranch' ? 'homebranch' : 'holdingbranch'; >@@ -1724,14 +1733,12 @@ sub searchResults { > || $item->{itemlost} > || $item->{damaged} > || $item->{notforloan} > 0 >- || $item->{hideatopac} > || $reservestatus eq 'Waiting' > || ($transfertwhen ne '')) > { > $wthdrawn_count++ if $item->{wthdrawn}; > $itemlost_count++ if $item->{itemlost}; > $itemdamaged_count++ if $item->{damaged}; >- $hideatopac_count++ if $item->{hideatopac}; > $item_in_transit_count++ if $transfertwhen ne ''; > $item_onhold_count++ if $reservestatus eq 'Waiting'; > $item->{status} = $item->{wthdrawn} . "-" . $item->{itemlost} . "-" . $item->{damaged} . "-" . $item->{notforloan}; >@@ -1747,7 +1754,7 @@ sub searchResults { > $other_count++; > > my $key = $prefix . $item->{status}; >- foreach (qw(wthdrawn itemlost damaged branchname itemcallnumber hideatopac)) { >+ foreach (qw(wthdrawn itemlost damaged branchname itemcallnumber)) { > $other_items->{$key}->{$_} = $item->{$_}; > } > $other_items->{$key}->{intransit} = ( $transfertwhen ne '' ) ? 1 : 0; >@@ -1763,7 +1770,7 @@ sub searchResults { > $can_place_holds = 1; > $available_count++; > $available_items->{$prefix}->{count}++ if $item->{$hbranch}; >- foreach (qw(branchname itemcallnumber hideatopac description)) { >+ foreach (qw(branchname itemcallnumber description)) { > $available_items->{$prefix}->{$_} = $item->{$_}; > } > $available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} }; >@@ -1771,10 +1778,12 @@ sub searchResults { > } > } > } # notforloan, item level and biblioitem level >- if ($items_count > 0) { >- next if $is_opac && $hideatopac_count >= $items_count; >- next if $hidelostitems && $itemlost_count >= $items_count; >- } >+ >+ # if all items are hidden, do not show the record >+ if ($items_count > 0 && $hideatopac_count == $items_count) { >+ next; >+ } >+ > my ( $availableitemscount, $onloanitemscount, $otheritemscount ); > for my $key ( sort keys %$onloan_items ) { > (++$onloanitemscount > $maxitems) and last; >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt >index 67b1686..3b72b05 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt >@@ -464,10 +464,9 @@ $(document).ready(function(){ > > <span class="results_summary"> > <span class="label">Availability:</span> >- [% IF ( SEARCH_RESULT.available_items_loop.0 ) %] >+ [% IF ( SEARCH_RESULT.available_items_loop.size() ) %] > <span class="available"><strong>Copies available:</strong> > [% FOREACH available_items_loo IN SEARCH_RESULT.available_items_loop %] >- [% UNLESS ( available_items_loo.hideatopac ) %] > [% IF ( singleBranchMode ) %] > [% available_items_loo.location %] > [% ELSE %] >@@ -480,7 +479,6 @@ $(document).ready(function(){ > [% END %] > ([% available_items_loo.count %]), > [% END %] >- [% END %] > </span> > [% ELSE %] > [% IF ( SEARCH_RESULT.ALTERNATEHOLDINGS ) %] >-- >1.7.9.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7690
:
8122
|
11498
|
11878