From 7453b458c206f981a0ebe9cf01b65ccdf0e21b96 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 20 Jul 2012 11:43:34 -0400 Subject: [PATCH] [SIGNED-OFF] Bug 8484 - Add ability to choose of lost items are removed from a borrowers record. Content-Type: text/plain; charset="utf-8" Adds the system preference ReturnLostItems to control whether setting an item as lost will remove the item from the borrower's record. Note, this system preference does not affect misc/cronjobs/longoverdue.pl which has its own command line switch to choose this behavior. Test plan: Apply the patch and let the database update run. Test the process of marking something lost with the ReturnLostItems preference in the default "on" state: - Find an item which is checked out and mark it lost from moredetail.pl - Find an item which is checked out and mark it lost using the batch item modification tool In both cases the item should be removed from the patron's account (checked in) and a fine applied. Next test with the ReturnLostItems preference turned off. The same procedure should result in the item being checked in but the fine applied. Signed-off-by: Owen Leonard Passes the test plan which I made up. --- catalogue/updateitem.pl | 2 +- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 6 ++++++ .../en/modules/admin/preferences/circulation.pref | 8 ++++++++ tools/batchMod.pl | 2 +- 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/catalogue/updateitem.pl b/catalogue/updateitem.pl index abc809d..6d317b0 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, 'MARK RETURNED', 'CHARGE FEE') if $itemlost; +LostItem($itemnumber, C4::Context->preference("ReturnLostItems"), '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 9032bfa..45d0c7d 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -411,3 +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'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index ed922b8..8119c70 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6399,6 +6399,12 @@ if ( CheckVersion($DBversion) ) { SetVersion($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"; + 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 82c1c02..7ba03b4 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 @@ -537,3 +537,11 @@ Circulation: - and this password - pref: AutoSelfCheckPass - . + Lost Items Policy: + - + - pref: ReturnLostItems + type: choice + choices: + yes: "Check in" + no: "Don't check in" + - items marked as lost that are checked out to a patron. diff --git a/tools/batchMod.pl b/tools/batchMod.pl index e416d44..0ded118 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, 'MARK RETURNED', 'CHARGE FEE') if $item->{itemlost}; + LostItem($itemnumber, C4::Context->preference("ReturnLostItems"), 'CHARGE FEE') if $item->{itemlost}; } }; } -- 1.7.9.5