[Patches] [PATCH] bug_7144: renamed HomeOrHoldingBranchReturn to returnBranch and added
koha-patchbot at kohaaloha.com
koha-patchbot at kohaaloha.com
Fri Nov 4 19:56:53 NZDT 2011
From: Srdjan Jankovic <srdjan at catalyst.net.nz>
Date: Fri, 4 Nov 2011 18:21:55 +1300
Subject: [PATCH] bug_7144: renamed HomeOrHoldingBranchReturn to returnBranch and added
returningbranch option for floating collections
Added returningbranch support to returns
---
C4/Circulation.pm | 24 ++++++++++++-------
admin/systempreferences.pl | 2 +-
circ/returns.pl | 10 ++++++-
installer/data/mysql/sysprefs.sql | 2 +-
installer/data/mysql/updatedatabase.pl | 7 +++++
.../en/modules/admin/preferences/circulation.pref | 9 ++++---
6 files changed, 37 insertions(+), 17 deletions(-)
diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 9f81773..70df97f 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -1543,19 +1543,25 @@ sub AddReturn {
my $item = GetItem($itemnumber) or die "GetItem($itemnumber) failed";
# full item data, but no borrowernumber or checkout info (no issue)
# we know GetItem should work because GetItemnumberFromBarcode worked
- my $hbr = C4::Context->preference("HomeOrHoldingBranchReturn") || "homebranch";
- $hbr = $item->{$hbr} || '';
+ my $hbr;
+ my $branchreturn = C4::Context->preference("ReturnBranch") || "homebranch";
+ if ($branchreturn eq 'returningbranch') {
+ $hbr = $branch;
+ }
+ else {
+ $hbr = $item->{$hbr} || '';
# item must be from items table -- issues table has branchcode and issuingbranch, not homebranch nor holdingbranch
- my $borrowernumber = $borrower->{'borrowernumber'} || undef; # we don't know if we had a borrower or not
-
- # check if the book is in a permanent collection....
- # FIXME -- This 'PE' attribute is largely undocumented. afaict, there's no user interface that reflects this functionality.
- if ( $hbr ) {
- my $branches = GetBranches(); # a potentially expensive call for a non-feature.
- $branches->{$hbr}->{PE} and $messages->{'IsPermanent'} = $hbr;
+ # check if the book is in a permanent collection....
+ # FIXME -- This 'PE' attribute is largely undocumented. afaict, there's no user interface that reflects this functionality.
+ if ( $hbr ) {
+ my $branches = GetBranches(); # a potentially expensive call for a non-feature.
+ $branches->{$hbr}->{PE} and $messages->{'IsPermanent'} = $hbr;
+ }
}
+ my $borrowernumber = $borrower->{'borrowernumber'} || undef; # we don't know if we had a borrower or not
+
# if indy branches and returning to different branch, refuse the return
if ($hbr ne $branch && C4::Context->preference("IndependantBranches")){
$messages->{'Wrongbranch'} = {
diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl
index 78d0768..0fc89b6 100755
--- a/admin/systempreferences.pl
+++ b/admin/systempreferences.pl
@@ -183,7 +183,7 @@ $tabsysprefs{finesCalendar} = "Circulation";
$tabsysprefs{previousIssuesDefaultSortOrder} = "Circulation";
$tabsysprefs{todaysIssuesDefaultSortOrder} = "Circulation";
$tabsysprefs{HomeOrHoldingBranch} = "Circulation";
-$tabsysprefs{HomeOrHoldingBranchReturn} = "Circulation";
+$tabsysprefs{ReturnBranch} = "Circulation";
$tabsysprefs{RandomizeHoldsQueueWeight} = "Circulation";
$tabsysprefs{StaticHoldsQueueWeight} = "Circulation";
$tabsysprefs{AllowOnShelfHolds} = "Circulation";
diff --git a/circ/returns.pl b/circ/returns.pl
index afe574f..cee6358 100755
--- a/circ/returns.pl
+++ b/circ/returns.pl
@@ -222,7 +222,13 @@ if ($barcode) {
#
( $returned, $messages, $issueinformation, $borrower ) =
AddReturn( $barcode, $userenv_branch, $exemptfine, $dropboxmode); # do the return
- my $homeorholdingbranchreturn = C4::Context->preference('HomeOrHoldingBranchReturn') or 'homebranch';
+ my $homebranchname;
+ my $branchreturn = C4::Context->preference('ReturnBranch') || 'homebranch';
+ if ($branchreturn eq 'returningbranch') {
+ $branchreturn = "Floating collection, home branch ";
+ $branchreturn = 'homebranch';
+ }
+ $homebranchname .= GetBranchName( $biblio->{$branchreturn} );
# get biblio description
my $biblio = GetBiblioFromItemNumber($itemnumber);
@@ -232,7 +238,7 @@ if ($barcode) {
$template->param(
title => $biblio->{'title'},
homebranch => $biblio->{'homebranch'},
- homebranchname => GetBranchName( $biblio->{$homeorholdingbranchreturn} ),
+ homebranchname => $homebranchname,
author => $biblio->{'author'},
itembarcode => $biblio->{'barcode'},
itemtype => $biblio->{'itemtype'},
diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index ae2c1cb..d7591ca 100755
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -183,7 +183,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacRenewalAllowed',0,'If ON, users can renew their issues directly from their OPAC account',NULL,'YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('PatronsPerPage','20','Number of Patrons Per Page displayed by default','20','Integer');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('HomeOrHoldingBranch','holdingbranch','Used by Circulation to determine which branch of an item to check with independent branches on, and by search to determine which branch to choose for availability ','holdingbranch|homebranch','Choice');
-INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('HomeOrHoldingBranchReturn','homebranch','Used by Circulation to determine which branch of an item to check checking-in items','holdingbranch|homebranch','Choice');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReturnBranch','homebranch','Used by Circulation to determine which branch of an item to check checking-in items','holdingbranch|homebranch','Choice');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OpacHighlightedWords','1','If Set, then queried words are higlighted in OPAC','','YesNo');
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OAI-PMH','0','if ON, OAI-PMH server is enabled',NULL,'YesNo');
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index a8cd166..b17b48b 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -4550,6 +4550,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
SetVersion ($DBversion);
}
+$DBversion = "3.06.00.XXX";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+ $dbh->do("UPDATE `systempreferences` SET variable = 'ReturnBranch' WHERE variable = 'HomeOrHoldingBranchReturn';");
+ print "Upgrade to $DBversion done (Renamed HomeOrHoldingBranchReturn system preference to ReturnBranch)\n";
+ SetVersion ($DBversion);
+}
+
=head1 FUNCTIONS
=head2 DropAllForeignKeys($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 f4946b5..07a4e43 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
@@ -216,12 +216,13 @@ Circulation:
confirmation: Ask for confirmation
- when checking out to a borrower that has overdues outstanding
-
- - On checkin route the returned item to
- - pref: HomeOrHoldingBranchReturn
+ - On checkin
+ - pref: ReturnBranch
type: choice
choices:
- homebranch: the library the item is from.
- holdingbranch: the library the item was checked out from.
+ homebranch: route the returned item to the library the item is from (home).
+ holdingbranch: route the returned item to the library the item was checked out from.
+ returningbranch: leave the item in the library the item is checked in (floating collection).
Holds Policy:
-
- pref: AllowHoldPolicyOverride
--
1.6.5
More information about the Patches
mailing list