Bugzilla – Attachment 73730 Details for
Bug 18816
Make CataloguingLog work in production by preventing circulation from spamming the log
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18816 [QA Followup]: Convert param to hashref, fix typo
Bug-18816-QA-Followup-Convert-param-to-hashref-fix.patch (text/plain), 5.75 KB, created by
Marcel de Rooy
on 2018-04-06 06:10:49 UTC
(
hide
)
Description:
Bug 18816 [QA Followup]: Convert param to hashref, fix typo
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2018-04-06 06:10:49 UTC
Size:
5.75 KB
patch
obsolete
>From ea8694e435e920bbfbfa02413f611a69f8b04df9 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatetsolutions.com> >Date: Thu, 22 Mar 2018 06:43:44 -0400 >Subject: [PATCH] Bug 18816 [QA Followup]: Convert param to hashref, fix typo >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Circulation.pm | 16 ++++++++-------- > C4/Items.pm | 6 ++++-- > t/db_dependent/Items.t | 10 +++++----- > 3 files changed, 17 insertions(+), 15 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 15c05fc..b9bd533 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -1398,7 +1398,7 @@ sub AddIssue { > }, > $item->{'biblionumber'}, > $item->{'itemnumber'}, >- 0 >+ { log_action => 0 } > ); > ModDateLastSeen( $item->{'itemnumber'} ); > >@@ -1831,7 +1831,7 @@ sub AddReturn { > $item->{location} = $item->{permanent_location}; > } > >- ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'}, 0 ); >+ ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'}, { log_action => 0 } ); > } > > # full item data, but no borrowernumber or checkout info (no issue) >@@ -1855,7 +1855,7 @@ sub AddReturn { > foreach my $key ( keys %$rules ) { > if ( $item->{notforloan} eq $key ) { > $messages->{'NotForLoanStatusUpdated'} = { from => $item->{notforloan}, to => $rules->{$key} }; >- ModItem( { notforloan => $rules->{$key} }, undef, $itemnumber, 0 ); >+ ModItem( { notforloan => $rules->{$key} }, undef, $itemnumber, { log_action => 0 } ); > last; > } > } >@@ -1921,7 +1921,7 @@ sub AddReturn { > > } > >- ModItem( { onloan => undef }, $item->{biblionumber}, $item->{itemnumber}, 0 ); >+ ModItem( { onloan => undef }, $item->{biblionumber}, $item->{itemnumber}, { log_action => 0 } ); > } > > # the holdingbranch is updated if the document is returned to another location. >@@ -2157,7 +2157,7 @@ sub MarkIssueReturned { > # And finally delete the issue > $issue->delete; > >- ModItem( { 'onloan' => undef }, undef, $itemnumber, 0 ); >+ ModItem( { 'onloan' => undef }, undef, $itemnumber, { log_action => 0 } ); > > if ( C4::Context->preference('StoreLastBorrower') ) { > my $item = Koha::Items->find( $itemnumber ); >@@ -2396,7 +2396,7 @@ sub _FixAccountForLostAndReturned { > } > ); > >- ModItem( { paidfor => '' }, undef, $itemnumber, 0 ); >+ ModItem( { paidfor => '' }, undef, $itemnumber, { log_action => 0 } ); > > return $credit_id; > } >@@ -2821,7 +2821,7 @@ sub AddRenewal { > > # Update the renewal count on the item, and tell zebra to reindex > $renews = $item->{renewals} + 1; >- ModItem( { renewals => $renews, onloan => $datedue->strftime('%Y-%m-%d %H:%M')}, $item->{biblionumber}, $itemnumber, 0 ); >+ ModItem( { renewals => $renews, onloan => $datedue->strftime('%Y-%m-%d %H:%M')}, $item->{biblionumber}, $itemnumber, { log_action => 0 } ); > > # Charge a new rental fee, if applicable? > my ( $charge, $type ) = GetIssuingCharges( $itemnumber, $borrowernumber ); >@@ -3701,7 +3701,7 @@ sub ProcessOfflineReturn { > { renewals => 0, onloan => undef }, > $issue->{'biblionumber'}, > $itemnumber, >- 0 >+ { log_action => 0 } > ); > return "Success."; > } else { >diff --git a/C4/Items.pm b/C4/Items.pm >index f2c7dc2..5de34a5 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -547,7 +547,9 @@ sub ModItem { > my $item = shift; > my $biblionumber = shift; > my $itemnumber = shift; >- my $log_action = shift // 1; >+ my $additional_params = shift; >+ >+ my $log_action = $additional_params->{log_action} // 1; > > # if $biblionumber is undefined, get it from the current item > unless (defined $biblionumber) { >@@ -653,7 +655,7 @@ sub ModDateLastSeen { > my ($itemnumber) = @_; > > my $today = output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }); >- ModItem( { itemlost => 0, datelastseen => $today }, undef, $itemnumber, 0 ); >+ ModItem( { itemlost => 0, datelastseen => $today }, undef, $itemnumber, { log_action => 0 } ); > } > > =head2 DelItem >diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t >index da74ca3..ef09873 100755 >--- a/t/db_dependent/Items.t >+++ b/t/db_dependent/Items.t >@@ -31,7 +31,7 @@ use Koha::Caches; > use t::lib::Mocks; > use t::lib::TestBuilder; > >-use Test::More tests => 13; >+use Test::More tests => 14; > > use Test::Warn; > >@@ -796,7 +796,7 @@ subtest 'get_hostitemnumbers_of' => sub { > is( @itemnumbers, 0, ); > }; > >-subtest 'Test logging for AddItem' => sub { >+subtest 'Test logging for ModItem' => sub { > > plan tests => 3; > >@@ -821,13 +821,13 @@ subtest 'Test logging for AddItem' => sub { > > # False means no logging > $schema->resultset('ActionLog')->search()->delete(); >- ModItem({ location => $location }, $bibnum, $itemnumber, 0); >+ ModItem({ location => $location }, $bibnum, $itemnumber, { log_action => 0 }); > is( $schema->resultset('ActionLog')->count(), 0, 'False value does not trigger logging' ); > > # True means logging > $schema->resultset('ActionLog')->search()->delete(); >- ModItem({ location => $location }, $bibnum, $itemnumber, 1, 'True value does trigger logging'); >- is( $schema->resultset('ActionLog')->count(), 1 ); >+ ModItem({ location => $location }, $bibnum, $itemnumber, { log_action => 1 }); >+ is( $schema->resultset('ActionLog')->count(), 1, 'True value does trigger logging' ); > > # Undefined defaults to true > $schema->resultset('ActionLog')->search()->delete(); >-- >2.1.4
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 18816
:
64383
|
64393
|
65711
|
65712
|
68600
|
68647
|
73154
|
73155
|
73169
|
73170
|
73171
|
73729
| 73730 |
73731
|
73732
|
73733