Bugzilla – Attachment 158471 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: (QA follow-up) Perltidy, fix spelling and db comments
Bug-16122-QA-follow-up-Perltidy-fix-spelling-and-d.patch (text/plain), 5.66 KB, created by
Katrin Fischer
on 2023-11-05 13:01:41 UTC
(
hide
)
Description:
Bug 16122: (QA follow-up) Perltidy, fix spelling and db comments
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2023-11-05 13:01:41 UTC
Size:
5.66 KB
patch
obsolete
>From cb0ea71dddbfd9fc168d6eee341d9e5251521e79 Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <katrin.fischer.83@web.de> >Date: Sun, 5 Nov 2023 12:56:45 +0000 >Subject: [PATCH] Bug 16122: (QA follow-up) Perltidy, fix spelling and db > comments > >* COMMENT in database update and kohastructure didn't match up >* Fix some localuse to local use in text/descriptions >* Perltidy > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/Circulation.pm | 12 ++++---- > api/v1/swagger/definitions/item.yaml | 2 +- > .../atomicupdate/bug_16122_atomicupdate.pl | 30 +++++++++++-------- > .../update_localuse_from_statistics.pl | 17 +++++------ > 4 files changed, 32 insertions(+), 29 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 227dbe98f5..2a5a1993f2 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -830,7 +830,7 @@ sub CanBookBeIssued { > #increment items.localuse > my $localuse_count = $item_object->localuse; > $localuse_count++; >- $item_object->localuse( $localuse_count )->store; >+ $item_object->localuse($localuse_count)->store; > > ModDateLastSeen( $item_object->itemnumber ); # FIXME Move to Koha::Item > return( { STATS => 1 }, {}); >@@ -2148,11 +2148,11 @@ sub AddReturn { > $doreturn = 0; > # No issue, no borrowernumber. ONLY if $doreturn, *might* you have a $borrower later. > # Record this as a local use, instead of a return, if the RecordLocalUseOnReturn is on >- if (C4::Context->preference("RecordLocalUseOnReturn")) { >- $localuse_count++; >- $item->localuse( $localuse_count )->store; >- $messages->{'LocalUse'} = 1; >- $stat_type = 'localuse'; >+ if ( C4::Context->preference("RecordLocalUseOnReturn") ) { >+ $localuse_count++; >+ $item->localuse($localuse_count)->store; >+ $messages->{'LocalUse'} = 1; >+ $stat_type = 'localuse'; > } > } > >diff --git a/api/v1/swagger/definitions/item.yaml b/api/v1/swagger/definitions/item.yaml >index b719043dc5..7d9eb69b12 100644 >--- a/api/v1/swagger/definitions/item.yaml >+++ b/api/v1/swagger/definitions/item.yaml >@@ -117,7 +117,7 @@ properties: > type: > - integer > - "null" >- description: Number of times this item has been recorded for localuse >+ description: Number of times this item has been recorded for local use > holds_count: > type: > - integer >diff --git a/installer/data/mysql/atomicupdate/bug_16122_atomicupdate.pl b/installer/data/mysql/atomicupdate/bug_16122_atomicupdate.pl >index b423ae618d..bc69d7e62b 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 tables", >+ 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..c0bf2f761c 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 local use statistics information.\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