Bugzilla – Attachment 27295 Details for
Bug 9264
Make getitems default sort to set by a preference instead of hard coded to homebranch.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9264 - Make getitems default sort to set by a preference instead of hard coded to homebranch.
Bug-9264---Make-getitems-default-sort-to-set-by-a-.patch (text/plain), 5.27 KB, created by
Mark Tompsett
on 2014-04-19 02:58:57 UTC
(
hide
)
Description:
Bug 9264 - Make getitems default sort to set by a preference instead of hard coded to homebranch.
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2014-04-19 02:58:57 UTC
Size:
5.27 KB
patch
obsolete
>From 10830dfe0cc6edc74288f9380e1bcc1dd704c2ba Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 11 Dec 2012 12:08:14 -0500 >Subject: [PATCH] Bug 9264 - Make getitems default sort to set by a preference > instead of hard coded to homebranch. > >The sort order in GetItemsInfo has been switched from home branch to holding >branch and then back again at different points in time. Some libraries liked >it when it was by holding branch, rather than home branch. > >This patch makes the choice of sorting by home or holding branch a system preference. > >Test Plan: >1) Apply patch >2) Run updatedatabase.pl >3) Test the sorting order for items with the preference set each way. > >NOTE: I only rebased to make it apply. I still think Owen's > feedback in comment #4 still applys. Hence the move from > 'Patch does not apply' to 'In Discussion'. >--- > C4/Items.pm | 3 ++- > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 10 ++++++++++ > .../en/modules/admin/preferences/searching.pref | 8 ++++++++ > 4 files changed, 21 insertions(+), 1 deletion(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index 12dce85..d8ce1d1 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -1251,6 +1251,7 @@ sub GetItemsInfo { > my ( $biblionumber ) = @_; > my $dbh = C4::Context->dbh; > # note biblioitems.* must be avoided to prevent large marc and marcxml fields from killing performance. >+ my $branch = C4::Context->preference("DefaultItemSortOrder") || 'home'; > my $query = " > SELECT items.*, > biblio.*, >@@ -1278,7 +1279,7 @@ sub GetItemsInfo { > LEFT JOIN biblioitems ON biblioitems.biblioitemnumber = items.biblioitemnumber > LEFT JOIN itemtypes ON itemtypes.itemtype = " > . (C4::Context->preference('item-level_itypes') ? 'items.itype' : 'biblioitems.itemtype'); >- $query .= " WHERE items.biblionumber = ? ORDER BY home.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ; >+ $query .= " WHERE items.biblionumber = ? ORDER BY $branch.branchname, items.enumchron, LPAD( items.copynumber, 8, '0' ), items.dateaccessioned DESC" ; > my $sth = $dbh->prepare($query); > $sth->execute($biblionumber); > my $i = 0; >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 661910b..272116a 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -89,6 +89,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('decreaseLoanHighHoldsDuration',NULL,'','Specifies a number of days that a loan is reduced to when used in conjunction with decreaseLoanHighHolds','Integer'), > ('decreaseLoanHighHoldsValue',NULL,'','Specifies a threshold for the minimum number of holds needed to trigger a reduction in loan duration (used with decreaseLoanHighHolds)','Integer'), > ('DefaultClassificationSource','ddc',NULL,'Default classification scheme used by the collection. E.g., Dewey, LCC, etc.','ClassSources'), >+('DefaultItemSortOrder', 'home', 'home|holding', 'Define the default sort order for items.', 'Choice' ), > ('DefaultLanguageField008','','','Fill in the default language for field 008 Range 35-37 of MARC21 records (e.g. eng, nor, ger, see <a href=\"http://www.loc.gov/marc/languages/language_code.html\">MARC Code List for Languages</a>)','Free'), > ('defaultSortField','relevance','relevance|popularity|call_number|pubdate|acqdate|title|author','Specify the default field used for sorting','Choice'), > ('defaultSortOrder','dsc','asc|dsc|az|za','Specify the default sort order','Choice'), >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 6db5569..c0e81a2 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -8120,6 +8120,16 @@ if ( CheckVersion($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "3.15.00.XXX"; >+if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do(q{ >+ INSERT INTO systempreferences ( variable, value, options, explanation, type ) VALUES ( 'DefaultItemSortOrder', 'home', 'home|holding', 'Define the default sort order for items.', 'Choice' ); >+ }); >+ print "Upgrade to $DBversion done (Bug 9264 - Make getitems default sort to set by a preference instead of hard coded to homebranch.)\n"; >+ SetVersion ($DBversion); >+} >+ >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >index 29da64e..d09e045 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >@@ -187,3 +187,11 @@ Searching: > - Use the following text as separator for UNIMARC authors facets > - pref: UNIMARCAuthorsFacetsSeparator > class: short >+ - >+ - The default sort order for items should be by the item's >+ - pref: DefaultItemSortOrder >+ type: choice >+ default: home >+ choices: >+ home: "home library" >+ holding: "holding library" >-- >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 9264
:
14006
|
14887
|
27295
|
123705