From a5a473a1a570b6611b44c5b225c4972975ae59dc Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 8 Feb 2013 10:02:26 -0500 Subject: [PATCH] Bug 8484 - Add ability to choose if lost items are removed from a borrowers record. - Followup --- C4/Circulation.pm | 4 ++-- catalogue/updateitem.pl | 2 +- installer/data/mysql/sysprefs.sql | 2 +- installer/data/mysql/updatedatabase.pl | 4 ++-- .../en/modules/admin/preferences/circulation.pref | 2 +- misc/cronjobs/longoverdue.pl | 5 +---- tools/batchMod.pl | 2 +- 7 files changed, 9 insertions(+), 12 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 2c568b4b..cbc0164 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -3290,7 +3290,7 @@ sub ReturnLostItem{ sub LostItem{ - my ($itemnumber, $mark_returned, $charge_fee) = @_; + my ( $itemnumber, $charge_fee ) = @_; my $dbh = C4::Context->dbh(); my $sth=$dbh->prepare("SELECT issues.*,items.*,biblio.title @@ -3310,7 +3310,7 @@ sub LostItem{ if $charge_fee; #FIXME : Should probably have a way to distinguish this from an item that really was returned. #warn " $issues->{'borrowernumber'} / $itemnumber "; - MarkIssueReturned($borrowernumber,$itemnumber,undef,undef,$borrower->{'privacy'}) if $mark_returned; + MarkIssueReturned( $borrowernumber, $itemnumber, undef, undef, $borrower->{'privacy'} ) if C4::Context->preference("WhenLostReturnItems"); } } diff --git a/catalogue/updateitem.pl b/catalogue/updateitem.pl index 6d317b0..6c735c1 100755 --- a/catalogue/updateitem.pl +++ b/catalogue/updateitem.pl @@ -74,6 +74,6 @@ if (defined $itemnotes) { # i.e., itemnotes parameter passed from form ModItem($item_changes, $biblionumber, $itemnumber); -LostItem($itemnumber, C4::Context->preference("ReturnLostItems"), 'CHARGE FEE') if $itemlost; +LostItem($itemnumber, 'CHARGE FEE') if $itemlost; print $cgi->redirect("moredetail.pl?biblionumber=$biblionumber&itemnumber=$itemnumber#item$itemnumber"); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index f314e53..a3b4a2d 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -314,7 +314,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('ReservesNeedReturns','1','','If ON, a hold placed on an item available in this library must be checked-in, otherwise, a hold on a specific item, that is in the library & available is considered available','YesNo'), ('ReturnBeforeExpiry','0',NULL,'If ON, checkout will be prevented if returndate is after patron card expiry','YesNo'), ('ReturnLog','1',NULL,'If ON, enables the circulation (returns) log','YesNo'), -('ReturnLostItems', '1', NULL, 'If enabled, items marked as lost via the librarian intranet will be automatically returned. Note, the cronjob for marking items as lost has its own command line switch and is not affected by this system preference.','YesNo'), ('ReturnToShelvingCart','0','','If set, when any item is \'checked in\', it\'s location code will be changed to CART.','YesNo'), ('reviewson','1','','If ON, enables patron reviews of bibliographic records in the OPAC','YesNo'), ('RoutingListAddReserves','1','','If ON the patrons on routing lists are automatically added to holds on the issue.','YesNo'), @@ -407,6 +406,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('virtualshelves','1','','If ON, enables Lists management','YesNo'), ('WaitingNotifyAtCheckin','0',NULL,'If ON, notify librarians of waiting holds for the patron whose items they are checking in.','YesNo'), ('WebBasedSelfCheck','0',NULL,'If ON, enables the web-based self-check system','YesNo'), +('WhenLostReturnItems', '1', NULL, 'If enabled, items marked as lost will be automatically returned.', 'YesNo'), ('XISBN','0','','Use with FRBRizeEditions. If ON, Koha will use the OCLC xISBN web service in the Editions tab on the detail pages. See: http://www.worldcat.org/affiliate/webservices/xisbn/app.jsp','YesNo'), ('XISBNDailyLimit','999','','The xISBN Web service is free for non-commercial use when usage does not exceed 1000 requests per day','Integer'), ('XSLTDetailsDisplay','default','','Enable XSL stylesheet control over details page display on intranet','Free'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 8883a51..1444df5 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -7069,8 +7069,8 @@ if ( CheckVersion($DBversion) ) { $DBversion ="3.13.00.XXX"; if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { - $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('ReturnLostItems', '1', '','If enabled, items marked as lost via the librarian intranet will be automatically returned. Note, the cronjob for marking items as lost has its own command line switch and is not affected by this system preference.', 'YesNo')"); - print "Upgrade to $DBversion done (Add system preference ReturnLostItems)\n"; + $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('WhenLostReturnItems', '1', '','If enabled, items marked as lost will be automatically returned.', 'YesNo')"); + print "Upgrade to $DBversion done (Add system preference WhenLostReturnItems)\n"; SetVersion($DBversion); } 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 2462080..aad1d9d 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 @@ -571,7 +571,7 @@ Circulation: - course reserves Lost Items Policy: - - - pref: ReturnLostItems + - pref: WhenLostReturnItems type: choice choices: yes: "Check in" diff --git a/misc/cronjobs/longoverdue.pl b/misc/cronjobs/longoverdue.pl index 159db51..9ca4551 100755 --- a/misc/cronjobs/longoverdue.pl +++ b/misc/cronjobs/longoverdue.pl @@ -50,7 +50,6 @@ GetOptions( 'verbose' => \$verbose, 'quiet' => \$quiet, 'maxdays=s' => \$endrange, - 'mark-returned' => \$mark_returned, ); my $usage = << 'ENDUSAGE'; @@ -77,8 +76,6 @@ This script takes the following parameters : --maxdays Specifies the end of the range of overdue days to deal with (defaults to 366). This value is universal to all lost num days overdue passed. - --mark-returned When an item is marked lost, remove it from the borrowers issued items. - examples : $PERL5LIB/misc/cronjobs/longoverdue.pl --lost 30=1 Would set LOST=1 after 30 days (up to one year), but not charge the account. @@ -165,7 +162,7 @@ foreach my $startrange (sort keys %$lost) { printf ("Due %s: item %5s from borrower %5s to lost: %s\n", $row->{date_due}, $row->{itemnumber}, $row->{borrowernumber}, $lostvalue) if($verbose); if($confirm) { ModItem({ itemlost => $lostvalue }, $row->{'biblionumber'}, $row->{'itemnumber'}); - LostItem($row->{'itemnumber'}, $mark_returned, 'CHARGE FEE') if( $charge && $charge eq $lostvalue); + LostItem($row->{'itemnumber'}, 'CHARGE FEE') if( $charge && $charge eq $lostvalue); } $count++; } diff --git a/tools/batchMod.pl b/tools/batchMod.pl index 1ede7ed..7f46902 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -189,7 +189,7 @@ if ($op eq "action") { UpdateMarcWith( $marcitem, $localmarcitem ); eval{ if ( my $item = ModItemFromMarc( $localmarcitem, $itemdata->{biblionumber}, $itemnumber ) ) { - LostItem($itemnumber, C4::Context->preference("ReturnLostItems"), 'CHARGE FEE') if $item->{itemlost}; + LostItem($itemnumber, 'CHARGE FEE') if $item->{itemlost}; } }; } -- 1.7.2.5