From feb5a10a0d3fc0de9e084efe9d213de777a52c48 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 3fc124f..bc8ea4b 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -3262,7 +3262,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 @@ -3282,7 +3282,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 98fd674..0ad73c0 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -423,4 +423,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('DisplayIconsXSLT', '1', '', 'If ON, displays the format, audience, and material type icons in XSLT MARC21 results and detail pages.', 'YesNo'); INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('HighlightOwnItemsOnOPAC','0','','If on, and a patron is logged into the OPAC, items from his or her home library will be emphasized and shown first in search results and item details.','YesNo'); INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('HighlightOwnItemsOnOPACWhich','PatronBranch','PatronBranch|OpacURLBranch','Decides which branch''s items to emphasize. If PatronBranch, emphasize the logged in user''s library''s items. If OpacURLBranch, highlight the items of the Apache var BRANCHCODE defined in Koha''s Apache configuration file.','Choice') -INSERT INTO systempreferences (variable,value,explanation,options,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'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('WhenLostReturnItems', '1', 'If enabled, items marked as lost will be automatically returned.','', 'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 78c99cb..4c45df0 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6773,8 +6773,8 @@ if ( CheckVersion($DBversion) ) { $DBversion ="3.11.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 429ec57..16a477e 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 @@ -545,7 +545,7 @@ Circulation: - . 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 0ded118..24ecb4a 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -190,7 +190,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