Bugzilla – Attachment 14887 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), 4.80 KB, created by
Kyle M Hall (khall)
on 2013-01-28 14:06:27 UTC
(
hide
)
Description:
Bug 9264 - Make getitems default sort to set by a preference instead of hard coded to homebranch.
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2013-01-28 14:06:27 UTC
Size:
4.80 KB
patch
obsolete
>From 04bf845e149c0c317ca20a3e4e92eddaef1dbc46 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. >--- > C4/Items.pm | 3 ++- > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 9 +++++++++ > .../en/modules/admin/preferences/searching.pref | 8 ++++++++ > 4 files changed, 20 insertions(+), 1 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index dbd06b6..60258e9 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -1203,6 +1203,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.*, >@@ -1230,7 +1231,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 7e9f43d..8c2fad9 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -408,3 +408,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' > INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('NotesBlacklist','','List of notes fields that should not appear in the title notes/description separator of details',NULL,'free'); > INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserCSS', '', NULL, 'Add CSS to be included in the SCO module in an embedded <style> tag.', 'free'); > INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserJS', '', NULL, 'Define custom javascript for inclusion in the SCO module', 'free'); >+INSERT INTO systempreferences ( variable, value, options, explanation, type ) VALUES ( 'DefaultItemSortOrder', 'home', 'home|holding', 'Define the default sort order for items.', 'Choice' ); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index bd0fc99..0e022d9 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6347,6 +6347,15 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > SetVersion($DBversion); > } > >+$DBversion = "3.11.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 7b99173..b4bf390 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 >@@ -160,3 +160,11 @@ Searching: > - pref: FacetLabelTruncationLength > class: integer > - characters, in OPAC/staff interface. >+ - >+ - 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.2.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