From 334fa36fb16d61715b47df7906002389d52b24cd Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 16 Jul 2014 07:44:12 -0400 Subject: [PATCH] [PASSED QA] Bug 12582 - Control of branch displayed in search results linked to HomeOrHoldingBranch Some libraries would like the ability choose to display the home branch on search results while having circulation rules based on the holding branch. This is currently impossible because both the display of the branch in search results, and the selection of the home or holding branch for circulation rules are controlled by the same system preference: HomeOrHoldingBranch. This preference is described as being used only for circulation rules, and makes no mention of its use for display control. The display control should be split off into a separate preference. Test Plan: 1) Apply this patch 2) Run updatedatabase.pl 3) Note the value of the new system preference StaffSearchResultsDisplayBranch matches the current value of HomeOrHoldingBranch 4) Set the preference to home branch 5) Perform a staff catalog search with results having items with differing home and holding branches. 6) Note the home branch displays 7) Set the preference to holding branch 8) Repeat step 5 9) Note the holding branch displays Signed-off-by: Jason Robb Signed-off-by: Katrin Fischer Works as described, logic is now tied to a new system preference. Passes tests and QA script. --- C4/Search.pm | 4 ++-- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 9 +++++++++ .../prog/en/modules/admin/preferences/circulation.pref | 7 +++++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index c704c63..c58692b 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1900,8 +1900,8 @@ sub searchResults { } } - my $hbranch = C4::Context->preference('HomeOrHoldingBranch') eq 'homebranch' ? 'homebranch' : 'holdingbranch'; - my $otherbranch = C4::Context->preference('HomeOrHoldingBranch') eq 'homebranch' ? 'holdingbranch' : 'homebranch'; + my $hbranch = C4::Context->preference('StaffSearchResultsDisplayBranch'); + my $otherbranch = $hbranch eq 'homebranch' ? 'holdingbranch' : 'homebranch'; # set item's branch name, use HomeOrHoldingBranch syspref first, fall back to the other one if ($item->{$hbranch}) { diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 7eb08a8..e147fe7 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -372,6 +372,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('StaffAuthorisedValueImages','1',NULL,'','YesNo'), ('staffClientBaseURL','',NULL,'Specify the base URL of the staff client','free'), ('StaffDetailItemSelection', '1', NULL, 'Enable item selection in record detail page', 'YesNo'), +('StaffSearchResultsDisplayBranch','holdingbranch','holdingbranch|homebranch','Controls the display of the home or holding branch for staff search results','Choice'), ('StaffSerialIssueDisplayCount','3','','Number of serial issues to display per subscription in the Staff client','Integer'), ('StaticHoldsQueueWeight','0',NULL,'Specify a list of library location codes separated by commas -- the list of codes will be traversed and weighted with first values given higher weight for holds fulfillment -- alternatively, if RandomizeHoldsQueueWeight is set, the list will be randomly selective','Integer'), ('SubfieldsToUseWhenPrefill','','','Define a list of subfields to use when prefilling items (separated by space)','Free'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index de77bf3..ea9d4ac 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -8613,6 +8613,15 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.17.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + my $pref = C4::Context->preference('HomeOrHoldingBranch'); + $dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type) + VALUES ('StaffSearchResultsDisplayBranch', ?,'homebranch|holdingbranch','Controls the display of the home or holding branch for staff search results','choice')", undef, $pref); + print "Upgrade to $DBversion done (Bug 12582 - Control of branch displayed in search results linked to HomeOrHoldingBranch)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref index 37c368c..c1873d6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -240,6 +240,13 @@ Circulation: holdingbranch: only the library the item was checked out from. homeorholdingbranch: either the library the item is from or the library it was checked out from. - + - For search results in the staff client, display the branch of + - pref: StaffSearchResultsDisplayBranch + type: choice + choices: + homebranch: the library the item is from. + holdingbranch: the library the item is held by. + - - Calculate the due date using - pref: useDaysMode choices: -- 1.9.1