Bugzilla – Attachment 161158 Details for
Bug 16122
Item record needs to keep local use count
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16122: Perltidy and spelling
Bug-16122-Perltidy-and-spelling.patch (text/plain), 4.73 KB, created by
Biblibre Sandboxes
on 2024-01-18 22:31:23 UTC
(
hide
)
Description:
Bug 16122: Perltidy and spelling
Filename:
MIME Type:
Creator:
Biblibre Sandboxes
Created:
2024-01-18 22:31:23 UTC
Size:
4.73 KB
patch
obsolete
>From ce1eec481b23229303b316b8bdd0a552d94c5f3f Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >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 <andrewfh@dubcolib.org> >--- > .../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
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16122
:
149281
|
149282
|
149283
|
149284
|
150231
|
150232
|
150233
|
150234
|
150235
|
150236
|
150623
|
150693
|
153193
|
153196
|
153197
|
153198
|
153199
|
153200
|
158466
|
158467
|
158468
|
158469
|
158470
|
158471
|
161001
|
161002
|
161003
|
161004
|
161005
|
161006
|
161144
|
161145
|
161146
|
161147
|
161148
|
161149
|
161150
|
161151
|
161153
|
161154
|
161155
|
161156
|
161157
|
161158
|
161159
|
161160
|
163072
|
163073
|
163074
|
163075
|
163076
|
163077
|
163243
|
163244
|
163245
|
163246
|
163247
|
163248
|
163296
|
163297
|
163298
|
163299
|
163300
|
163301
|
163302
|
163303
|
165313
|
165314
|
165315
|
165316
|
165317
|
165318
|
165319
|
165320