From 30cd9005114d701677ff3e859102d281a62c21f8 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 063a409..ee3041a 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -3286,7 +3286,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 @@ -3306,7 +3306,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 45d0c7d..5f00811 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -411,4 +411,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReviews','0','Display book review snippets from IDreamBooks.com','','YesNo'); INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReadometer','0','Display Readometer from IDreamBooks.com','','YesNo'); INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksResults','0','Display IDreamBooks.com rating in search results','','YesNo'); -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 8119c70..ad4b7a9 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6401,8 +6401,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 7ba03b4..cf9879b 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 @@ -539,7 +539,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