From 15388f8cb310b8bd7bd89418255201d58f2db559 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 2 Nov 2016 18:04:05 +0000 Subject: [PATCH] Bug 17541 - Add ability to log all barcodes scanned at checkin On occasion, librarians claim that a barcode was scanned successfully at checkin but the item was not returned. It would be useful to be able to log all scanned barcodes at checkin regardless of validity to know if the barcode scan made it to Koha or if there is an issue keeping it from being received by the server. Test Plan: 1) Apply the patch 2) Run updatedatabase.pl 3) Enable the new system preference CirculationCheckinLog 4) Can some valid and invalid barcdes through the checkin screen 5) View the circulation log from the log viewer tool 6) Note the barcodes are there! --- circ/returns.pl | 3 +++ installer/data/mysql/atomicupdate/bug_17541.perl | 10 ++++++++++ installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/logs.pref | 6 ++++++ .../intranet-tmpl/prog/en/modules/tools/viewlog.tt | 23 +++++++++++++++++++--- tools/viewlog.pl | 2 +- 6 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_17541.perl diff --git a/circ/returns.pl b/circ/returns.pl index 619228f..7b58dab 100755 --- a/circ/returns.pl +++ b/circ/returns.pl @@ -47,6 +47,7 @@ use C4::Members; use C4::Members::Messaging; use C4::Koha; # FIXME : is it still useful ? use C4::RotatingCollections; +use C4::Log; use Koha::AuthorisedValues; use Koha::DateUtils; use Koha::Calendar; @@ -251,6 +252,8 @@ if ($canceltransfer){ # actually return book and prepare item table..... my $returnbranch; if ($barcode) { + logaction("CIRCULATION", "BARCODE_SCAN_CHECKIN", $barcode, $barcode ) if C4::Context->preference('CirculationCheckinLog'); + $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace $barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter'); $itemnumber = GetItemnumberFromBarcode($barcode); diff --git a/installer/data/mysql/atomicupdate/bug_17541.perl b/installer/data/mysql/atomicupdate/bug_17541.perl new file mode 100644 index 0000000..a630371 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_17541.perl @@ -0,0 +1,10 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{ + INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES + ('CirculationCheckinLog','0',NULL,'If ON, log all barcodes scanned at during checkin, regardless of validity.','YesNo'); + }); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 17541 - Add ability to log all barcodes scanned at checkin)\n"; +} diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 7c69940..a38512c 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -101,6 +101,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('CircAutocompl','1',NULL,'If ON, autocompletion is enabled for the Circulation input','YesNo'), ('CircAutoPrintQuickSlip','qslip',NULL,'Choose what should happen when an empty barcode field is submitted in circulation: Display a print quick slip window, Display a print slip window or Clear the screen.','Choice'), ('CircControl','ItemHomeLibrary','PickupLibrary|PatronLibrary|ItemHomeLibrary','Specify the agency that controls the circulation and fines policy','Choice'), +('CirculationCheckinLog','0',NULL,'If ON, log all barcodes scanned at during checkin, regardless of validity.','YesNo'), ('ClaimsBccCopy','0','','Bcc the ClaimAcquisition and ClaimIssues alerts','YesNo'), ('Coce','0', NULL, 'If on, enables cover retrieval from the configured Coce server', 'YesNo'), ('CoceHost', '', NULL, 'Coce server URL', 'Free'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref index 4aa5790..a6c96a1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref @@ -66,6 +66,12 @@ Logging: on: Log off: "Don't log" - when reports are added, deleted or changed. + - + - pref: CirculationCheckinLog + choices: + on: Log + off: "Don't log" + - log all barcodes scanned at during checkin, regardless of validity. Debugging: - - pref: DumpTemplateVarsIntranet diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt index e5706c6..c591298 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/viewlog.tt @@ -50,6 +50,7 @@ [% CASE 'CHANGE PASS' %]Change password [% CASE 'ADDCIRCMESSAGE' %]Add circulation message [% CASE 'DELCIRCMESSAGE' %]Delete circulation message +[% CASE 'BARCODE_SCAN_CHECKIN' %]Scanned barcode at checkin [% CASE 'Run' %]Run [% CASE %][% action %] [% END %] @@ -117,7 +118,7 @@ [% END %] - [% FOREACH actx IN [ 'ADD' 'DELETE' 'MODIFY' 'ISSUE' 'RETURN' 'RENEW' 'CREATE' 'CANCEL' 'SUSPEND' 'RESUME' 'ADDCIRCMESSAGE' 'DELCIRCMESSAGE' 'CHANGE PASS' 'Run' ] %] + [% FOREACH actx IN [ 'ADD' 'DELETE' 'MODIFY' 'ISSUE' 'RETURN' 'RENEW' 'CREATE' 'CANCEL' 'SUSPEND' 'RESUME' 'ADDCIRCMESSAGE' 'DELCIRCMESSAGE' 'CHANGE PASS' 'Run' 'BARCODE_SCAN_CHECKIN'] %] [% IF actions.grep(actx).size %] [% ELSE %] @@ -214,7 +215,19 @@ [% PROCESS translate_log_action action=loopro.action %] [% IF ( loopro.module == 'MEMBERS' ) || ( loopro.module == 'CIRCULATION' ) || ( loopro.module == 'FINES' ) %] - [% IF ( loopro.object ) %][% IF ( loopro.borrowerfirstname ) || ( loopro.borrowersurname ) %][% loopro.borrowerfirstname %] [% loopro.borrowersurname %] ([% loopro.object %]) [% ELSE %]Member [% loopro.object %][% END %][% END %] + [% IF loopro.action == 'BARCODE_SCAN_CHECKIN' %] + [% loopro.info %] + [% ELSE %] + + [% IF ( loopro.object ) %] + [% IF ( loopro.borrowerfirstname ) || ( loopro.borrowersurname ) %] + [% loopro.borrowerfirstname %] [% loopro.borrowersurname %] ([% loopro.object %]) + [% ELSE %] + Member [% loopro.object %] + [% END %] + [% END %] + + [% END %] [% ELSE %] [% IF ( loopro.module == 'CATALOGUING' ) %] [% IF ( loopro.info.substr(0, 4) == 'item' ) %] @@ -239,7 +252,11 @@ [% IF ( loopro.module == 'CIRCULATION' ) %] - Item [% loopro.barcode |html %] + [% IF loopro.biblionumber %] + + Item [% loopro.barcode |html %] + + [% END %] [% ELSE %] [% loopro.info |html %] [% END %] diff --git a/tools/viewlog.pl b/tools/viewlog.pl index 3c37162..d3b0e4d 100755 --- a/tools/viewlog.pl +++ b/tools/viewlog.pl @@ -126,7 +126,7 @@ if ($do_it) { # get item information so we can create a working link my $itemnumber = $result->{'object'}; $itemnumber = $result->{'info'} if ( $result->{module} eq "CIRCULATION" ); - my $item = GetItem($itemnumber); + my $item = GetItem($itemnumber) || GetItem( undef, $itemnumber ); if ($item) { $result->{'biblionumber'} = $item->{'biblionumber'}; $result->{'biblioitemnumber'} = $item->{'biblionumber'}; -- 2.1.4