From ce1eec481b23229303b316b8bdd0a552d94c5f3f Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Fri, 12 Jan 2024 23:00:49 +0000 Subject: [PATCH] Bug 16122: Perltidy and spelling To test: 1. Apply patch, updatedatabase & schema, restart all Services 2. Go to Administration > Table setting. Find the holdings table ( Catalog > holdings_table ) and turn the local use column on. 3. Go to an item record and notice the column 'Local uses' 4. Turn the system preference RecordLocalUseOnReturn Off. 5. Check in an item that is not checkout out. No local use should be recorded for the item. 6. Turn RecordLocalUseOnReturn on and check in an item that is not checked out. Local use on that item should increment by 1. 7. Create a statistical patron and check an item out to them. Local use should increment by 1. 8. Go to /api/v1/items?external_id={barcode} and make sure the numbers for localuse look correct. To test maintainence script: 1. Without the patch, have RecordLocalUseOnReturn on. 2. Check in some items to record localuse in the stats table. Keep note of those stats. 3. Apply the patches, updatedatabase. 4. Run the maintenance script, perl update_localuse_from_statistics.pl 5. Now check that items.localuse is congruent with what is in the stats table Signed-off-by: Andrew Fuerste-Henry --- .../atomicupdate/bug_16122_atomicupdate.pl | 30 +++++++++++-------- .../update_localuse_from_statistics.pl | 17 +++++------ 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug_16122_atomicupdate.pl b/installer/data/mysql/atomicupdate/bug_16122_atomicupdate.pl index b423ae618d..a959a13bc7 100755 --- a/installer/data/mysql/atomicupdate/bug_16122_atomicupdate.pl +++ b/installer/data/mysql/atomicupdate/bug_16122_atomicupdate.pl @@ -1,27 +1,31 @@ use Modern::Perl; return { - bug_number => "16122", - description => "Add localuser column to items table", - up => sub { + bug_number => "16122", + description => "Add local use column to items table", + up => sub { my ($args) = @_; - my ($dbh, $out) = @$args{qw(dbh out)}; - if( !column_exists( 'items', 'localuse' ) ) { - $dbh->do(q{ + my ( $dbh, $out ) = @$args{qw(dbh out)}; + if ( !column_exists( 'items', 'localuse' ) ) { + $dbh->do( + q{ ALTER TABLE items ADD COLUMN localuse smallint(6) NULL DEFAULT NULL - COMMENT "item's local use count" + COMMENT "number of times this item has been recorded as local use" AFTER renewals - }); + } + ); say $out "Added column 'items.localuse'"; } - if( !column_exists( 'deleteditems', 'localuse' ) ) { - $dbh->do(q{ + if ( !column_exists( 'deleteditems', 'localuse' ) ) { + $dbh->do( + q{ ALTER TABLE deleteditems ADD COLUMN localuse smallint(6) NULL DEFAULT NULL - COMMENT "deleteditems local use count" + COMMENT "number of times this item has been recorded as local use" AFTER renewals - }); + } + ); say $out "Added column 'deleteditems.localuse'"; } }, -} + } diff --git a/misc/maintenance/update_localuse_from_statistics.pl b/misc/maintenance/update_localuse_from_statistics.pl index 5da3b79e3c..b8ca44d698 100755 --- a/misc/maintenance/update_localuse_from_statistics.pl +++ b/misc/maintenance/update_localuse_from_statistics.pl @@ -27,7 +27,6 @@ use Koha::Statistics; use Getopt::Long qw( GetOptions ); use Pod::Usage qw( pod2usage ); - sub usage { pod2usage( -verbose => 2 ); exit; @@ -40,20 +39,20 @@ sub update_localuse { my $items = Koha::Items->search(); # Loop through each item and update it with statistics info - while( my $item = $items->next ){ - my $itemnumber = $item->itemnumber; + while ( my $item = $items->next ) { + my $itemnumber = $item->itemnumber; - my $localuse_count = Koha::Statistics->search( { itemnumber => $itemnumber, type => 'localuse' } )->count; - $item->localuse( $localuse_count ); - $item->store; + my $localuse_count = Koha::Statistics->search( { itemnumber => $itemnumber, type => 'localuse' } )->count; + $item->localuse($localuse_count); + $item->store; - print "Updated item $itemnumber with localuse statistics info.\n"; + print "Updated item $itemnumber with localuse statistics info.\n"; } } -my ( $help ); +my ($help); my $result = GetOptions( - 'help|h' => \$help, + 'help|h' => \$help, ); usage() if $help; -- 2.30.2