Bugzilla – Attachment 165319 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: Tidy changed code blocks
Bug-16122-Tidy-changed-code-blocks.patch (text/plain), 5.89 KB, created by
Lucas Gass (lukeg)
on 2024-04-22 15:36:00 UTC
(
hide
)
Description:
Bug 16122: Tidy changed code blocks
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2024-04-22 15:36:00 UTC
Size:
5.89 KB
patch
obsolete
>From cddad836d8e54522e9732e2fc0af891c78d29327 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 18 Mar 2024 10:06:25 +0000 >Subject: [PATCH] Bug 16122: Tidy changed code blocks > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Circulation.pm | 10 ++++---- > circ/circulation.pl | 3 ++- > .../update_localuse_from_statistics.pl | 19 ++++++++------- > t/db_dependent/Circulation.t | 23 +++++++++++-------- > 4 files changed, 29 insertions(+), 26 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 688b071514..d524e9d6f1 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2159,11 +2159,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/circ/circulation.pl b/circ/circulation.pl >index f5c82fdef6..76b2fc99d9 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -380,8 +380,9 @@ if (@$barcodes && $op eq 'cud-checkout') { > #increment items.localuse > my $localuse_count = $item->localuse; > $localuse_count++; >- $item->localuse( $localuse_count )->store; >+ $item->localuse($localuse_count)->store; > } >+ > # Fix for bug 7494: optional checkout-time fallback search for a book > > if ( $issuingimpossible->{'UNKNOWN_BARCODE'} >diff --git a/misc/maintenance/update_localuse_from_statistics.pl b/misc/maintenance/update_localuse_from_statistics.pl >index 5da3b79e3c..ac8ef0d92a 100755 >--- a/misc/maintenance/update_localuse_from_statistics.pl >+++ b/misc/maintenance/update_localuse_from_statistics.pl >@@ -25,8 +25,7 @@ use C4::Context; > use Koha::Items; > use Koha::Statistics; > use Getopt::Long qw( GetOptions ); >-use Pod::Usage qw( pod2usage ); >- >+use Pod::Usage qw( pod2usage ); > > sub usage { > pod2usage( -verbose => 2 ); >@@ -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; >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 337f9cddab..703594e44a 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -6287,7 +6287,7 @@ subtest 'Tests for RecordLocalUseOnReturn' => sub { > > plan tests => 5; > >- t::lib::Mocks::mock_preference('RecordLocalUseOnReturn', 0); >+ t::lib::Mocks::mock_preference( 'RecordLocalUseOnReturn', 0 ); > my $item = $builder->build_sample_item(); > > my $item_2 = $builder->build_sample_item( >@@ -6300,25 +6300,28 @@ subtest 'Tests for RecordLocalUseOnReturn' => sub { > my @return = AddReturn( $item->barcode, $item->homebranch, 0, undef ); > is_deeply( > \@return, >- [ 0, { NotIssued => $item->barcode, withdrawn => 1 }, undef, {} ], "RecordLocalUSeOnReturn is off, no local use recorded"); >+ [ 0, { NotIssued => $item->barcode, withdrawn => 1 }, undef, {} ], >+ "RecordLocalUSeOnReturn is off, no local use recorded" >+ ); > > AddReturn( $item_2->barcode, $item_2->homebranch ); >- $item_2->discard_changes; # refresh >- is( $item_2->localuse, undef , 'Without RecordLocalUseOnReturn no localuse is recorded.'); >+ $item_2->discard_changes; # refresh >+ is( $item_2->localuse, undef, 'Without RecordLocalUseOnReturn no localuse is recorded.' ); > >- t::lib::Mocks::mock_preference('RecordLocalUseOnReturn', 1); >+ t::lib::Mocks::mock_preference( 'RecordLocalUseOnReturn', 1 ); > my @return2 = AddReturn( $item->barcode, $item->homebranch, 0, undef ); > is_deeply( > \@return2, >- [ 0, { NotIssued => $item->barcode, withdrawn => 1, LocalUse => 1 }, undef, {} ], "Local use is recorded"); >+ [ 0, { NotIssued => $item->barcode, withdrawn => 1, LocalUse => 1 }, undef, {} ], "Local use is recorded" >+ ); > > AddReturn( $item_2->barcode, $item_2->homebranch ); >- $item_2->discard_changes; # refresh >- is( $item_2->localuse, 1 , 'With RecordLocalUseOnReturn localuse is recorded.'); >+ $item_2->discard_changes; # refresh >+ is( $item_2->localuse, 1, 'With RecordLocalUseOnReturn localuse is recorded.' ); > > AddReturn( $item_2->barcode, $item_2->homebranch ); >- $item_2->discard_changes; # refresh >- is( $item_2->localuse, 2 , 'With RecordLocalUseOnReturn localuse is recorded.'); >+ $item_2->discard_changes; # refresh >+ is( $item_2->localuse, 2, 'With RecordLocalUseOnReturn localuse is recorded.' ); > }; > > subtest 'Test CanBookBeIssued param ignore_reserves (Bug 35322)' => sub { >-- >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