Bugzilla – Attachment 2049 Details for
Bug 4367
shelfbrowser should take collection code into consideration
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed fix
0001-Respect-ccode-in-OPAC-shelfbrowser.patch (text/plain), 5.80 KB, created by
Chris Cormack
on 2010-04-28 19:22:00 UTC
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2010-04-28 19:22:00 UTC
Size:
5.80 KB
patch
obsolete
>From ccf9065e0e02928c93728130ec3b8756e3cba7d8 Mon Sep 17 00:00:00 2001 >From: Jared CAMINS-ESAKOV <camins@numismatics.org> >Date: Fri, 9 Apr 2010 11:40:12 -0400 >Subject: [PATCH] Respect ccode in OPAC shelfbrowser >Content-Type: text/plain; charset="utf-8" > >Take the item ccode into account when identifying adjacent books for the OPAC shelfbrowser. >--- > .../opac-tmpl/prog/en/modules/opac-detail.tmpl | 2 +- > opac/opac-detail.pl | 31 +++++++++++++++++-- > 2 files changed, 28 insertions(+), 5 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl >index df0b1db..1b9085b 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl >@@ -427,7 +427,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > > <!-- TMPL_IF NAME="OpenOPACShelfBrowser" --> > <div id="shelfbrowser"> >-<h5 style="text-align: center;"><!-- TMPL_IF NAME="starting_homebranch" -->Browsing <!-- TMPL_VAR NAME="starting_homebranch" --> Shelves<!-- /TMPL_IF --><!-- TMPL_IF NAME="starting_location" -->, Shelving Location:</span><!-- TMPL_VAR NAME="starting_location" --> <!-- /TMPL_IF --> <a style="font-size: 75%;" href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Close Shelf Browser</a></h5> >+<h5 style="text-align: center;"><!-- TMPL_IF NAME="starting_homebranch" -->Browsing <!-- TMPL_VAR NAME="starting_homebranch" --> Library<!-- /TMPL_IF --><!-- TMPL_IF NAME="starting_ccode" -->, Collection:</span><!-- TMPL_VAR NAME="starting_ccode" --> <!-- /TMPL_IF --><!-- TMPL_IF NAME="starting_location" -->, Shelving Location:</span><!-- TMPL_VAR NAME="starting_location" --> <!-- /TMPL_IF --> <a style="font-size: 75%;" href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->">Close Shelf Browser</a></h5> > > > <table><tr> >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index db4939e..c6d14ba 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -449,8 +449,8 @@ if (C4::Context->preference("OPACShelfBrowser")) { > my $starting_itemnumber = $query->param('shelfbrowse_itemnumber'); # || $items[0]->{itemnumber}; > $template->param( OpenOPACShelfBrowser => 1) if $starting_itemnumber; > # find the right cn_sort value for this item >- my ($starting_cn_sort, $starting_homebranch, $starting_location); >- my $sth_get_cn_sort = $dbh->prepare("SELECT cn_sort,homebranch,location from items where itemnumber=?"); >+ my ($starting_cn_sort, $starting_homebranch, $starting_location, $starting_ccode); >+ my $sth_get_cn_sort = $dbh->prepare("SELECT cn_sort,homebranch,location,ccode from items where itemnumber=?"); > $sth_get_cn_sort->execute($starting_itemnumber); > while (my $result = $sth_get_cn_sort->fetchrow_hashref()) { > $starting_cn_sort = $result->{'cn_sort'}; >@@ -458,6 +458,8 @@ if (C4::Context->preference("OPACShelfBrowser")) { > $starting_homebranch->{description} = $branches->{$result->{'homebranch'}}{branchname}; > $starting_location->{code} = $result->{'location'}; > $starting_location->{description} = GetAuthorisedValueDesc('','', $result->{'location'} ,'','','LOC', 'opac'); >+ $starting_ccode->{code} = $result->{'ccode'}; >+ $starting_ccode->{description} = GetAuthorisedValueDesc('','', $result->{'ccode'} ,'','','CCODE'); > > } > >@@ -465,7 +467,17 @@ if (C4::Context->preference("OPACShelfBrowser")) { > # order by cn_sort, which should include everything we need for ordering purposes (though not > # for limits, those need to be handled separately > my $sth_shelfbrowse_previous; >- if (defined $starting_location->{code}) { >+ if (defined $starting_ccode->{code} && defined $starting_location->{code}) { >+ $sth_shelfbrowse_previous = $dbh->prepare(" >+ SELECT * >+ FROM items >+ WHERE >+ ((cn_sort = ? AND itemnumber < ?) OR cn_sort < ?) AND >+ homebranch = ? AND location = ? AND ccode = ? >+ ORDER BY cn_sort DESC, itemnumber LIMIT 3 >+ "); >+ $sth_shelfbrowse_previous->execute($starting_cn_sort, $starting_itemnumber, $starting_cn_sort, $starting_homebranch->{code}, $starting_location->{code}, $starting_ccode->{code}); >+ } elsif (defined $starting_location->{code}) { > $sth_shelfbrowse_previous = $dbh->prepare(" > SELECT * > FROM items >@@ -502,7 +514,17 @@ if (C4::Context->preference("OPACShelfBrowser")) { > > ## List of Next Items; this also intentionally catches the current item > my $sth_shelfbrowse_next; >- if (defined $starting_location->{code}) { >+ if (defined $starting_ccode->{code} && defined $starting_location->{code}) { >+ $sth_shelfbrowse_next = $dbh->prepare(" >+ SELECT * >+ FROM items >+ WHERE >+ ((cn_sort = ? AND itemnumber >= ?) OR cn_sort > ?) AND >+ homebranch = ? AND location = ? AND ccode = ? >+ ORDER BY cn_sort, itemnumber LIMIT 3 >+ "); >+ $sth_shelfbrowse_next->execute($starting_cn_sort, $starting_itemnumber, $starting_cn_sort, $starting_homebranch->{code}, $starting_location->{code}, $starting_ccode->{code}); >+ } elsif (defined $starting_location->{code}) { > $sth_shelfbrowse_next = $dbh->prepare(" > SELECT * > FROM items >@@ -544,6 +566,7 @@ if (C4::Context->preference("OPACShelfBrowser")) { > $template->param( > starting_homebranch => $starting_homebranch->{description}, > starting_location => $starting_location->{description}, >+ starting_ccode => $starting_ccode->{description}, > starting_itemnumber => $starting_itemnumber, > shelfbrowser_prev_itemnumber => (@previous_items ? $previous_items[0]->{itemnumber} : 0), > shelfbrowser_next_itemnumber => $shelfbrowser_next_itemnumber, >-- >1.7.0.4 >
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 4367
: 2049