From 8173a5a93a930757d9cae1b234d7e6f856450c41 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 29 May 2013 12:44:44 -0400 Subject: [PATCH] Bug 10378 - Enable checked out items to be transferred without returning them [ v3.10.05 ] When items are transferred, they are automatically returned to the transferred-from library. Some libraries would like to be able to use the transfer system without automatically returning the item and having it removed from the patron record. Scenario: LibraryA of multi-library system is checking in items from the overnight dropbox. The librarian pulls out a damaged item, but it is an item owned and checked out from LibraryB. Instead of removing the item from the patrons checked out items, the library would like to transfer the item, still checked out, back to LibraryB so that LibraryB may decide how to deal with the damaged item. Test Plan: 1) Apply this patch 2) Run updatedatabase.pl 3) Ensure that ReturnItemWhenTransferred is enabled 4) Check an item out to a borrower 5) Transfer the item to another library 6) Verify the item was returned and removed from the patron's issues 7) Disable ReturnItemWhenTransferred 8) Check an item out to a borrower 9) Transfer the item to another library 10) Verify the item is still listed in the patron's current issues --- C4/Circulation.pm | 8 +++++- circ/branchtransfers.pl | 9 ++++++++ installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 22 ++++++++++++++++++++ .../en/modules/admin/preferences/circulation.pref | 7 ++++++ .../prog/en/modules/circ/branchtransfers.tt | 5 ++++ 6 files changed, 50 insertions(+), 2 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 981939f..c1ae7ba 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -338,8 +338,12 @@ sub transferbook { # check if it is still issued to someone, return it... if ($issue->{borrowernumber}) { - AddReturn( $barcode, $fbr ); - $messages->{'WasReturned'} = $issue->{borrowernumber}; + if ( C4::Context->preference('ReturnItemWhenTransferred') ) { + AddReturn( $barcode, $fbr ); + $messages->{'WasReturned'} = $issue->{borrowernumber}; + } else { + $messages->{'NotReturned'} = $issue->{borrowernumber}; + } } # find reserves..... diff --git a/circ/branchtransfers.pl b/circ/branchtransfers.pl index ad7aa9a..f7f441b 100755 --- a/circ/branchtransfers.pl +++ b/circ/branchtransfers.pl @@ -221,6 +221,15 @@ foreach my $code ( keys %$messages ) { $err{surname} = $borrower->{'surname'}; $err{cardnumber} = $borrower->{'cardnumber'}; } + elsif ( $code eq 'NotReturned' ) { + $err{NotReturned} = 1; + $err{borrowernumber} = $messages->{'NotReturned'}; + my $borrower = GetMember('borrowernumber'=>$messages->{'NotReturned'}); + $err{title} = $borrower->{'title'}; + $err{firstname} = $borrower->{'firstname'}; + $err{surname} = $borrower->{'surname'}; + $err{cardnumber} = $borrower->{'cardnumber'}; + } $err{errdesteqholding} = ( $code eq 'DestinationEqualsHolding' ); push( @errmsgloop, \%err ); } diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index af1d85f..6fe36d7 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -390,3 +390,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('OPACNumbersPreferPhrase','0', NULL, 'Control the use of phr operator in callnumber and standard number OPAC searches', 'YesNo'); INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('IntranetNumbersPreferPhrase','0', NULL, 'Control the use of phr operator in callnumber and standard number staff client searches', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('UNIMARCAuthorsFacetsSeparator',', ', 'UNIMARC authors facets separator', NULL, 'short'); +INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ReturnItemWhenTransferred','1',NULL,'If enabled, items will be automatically returned when transferred. If disabled, items will not be returned when transferred, and if the item is checked out to a patron, it will remain checked out.','YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 2c1f1f4..feed1a3 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6214,6 +6214,28 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.13.00.XXX"; +if(CheckVersion($DBversion)) { + $dbh->do( + q{ + INSERT INTO systempreferences ( + variable, + value, + options, + explanation, + type + ) VALUES ( + 'ReturnItemWhenTransferred', + '1', + NULL , + 'If enabled, items will be automatically returned when transferred. If disabled, items will not be returned when transferred, and if the item is checked out to a patron, it will remain checked out.', + 'YesNo' + ) + } + ); + print "Upgrade to $DBversion done (Bug 10378 - Enable checked out items to be transferred without returning them)\n"; + SetVersion($DBversion); +} =head1 FUNCTIONS 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 c583bbe..1776939 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 @@ -497,3 +497,10 @@ Circulation: - and this password - pref: AutoSelfCheckPass - . + Transfers Policy: + - + - pref: ReturnItemWhenTransferred + choices: + yes: "Do" + no: "Don't" + - automatically check in items when they are transferred. diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt index 1d47060..b684ee1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt @@ -120,6 +120,11 @@ [% errmsgloo.firstname %] [% errmsgloo.surname %] ([% errmsgloo.cardnumber %]) and has been returned. [% END %] + [% IF ( errmsgloo.NotReturned ) %] +
  • Item is on loan to + [% errmsgloo.firstname %] [% errmsgloo.surname %] + ([% errmsgloo.cardnumber %]) but has been not been returned.
  • + [% END %] [% END %] -- 1.7.2.5