Bugzilla – Attachment 145520 Details for
Bug 30642
We should record the renewal type (automatic/manual)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30642: (QA follow-up) Do not rely on script names in modules, add unit test
Bug-30642-QA-follow-up-Do-not-rely-on-script-names.patch (text/plain), 4.01 KB, created by
Kyle M Hall
on 2023-01-20 14:59:14 UTC
(
hide
)
Description:
Bug 30642: (QA follow-up) Do not rely on script names in modules, add unit test
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2023-01-20 14:59:14 UTC
Size:
4.01 KB
patch
obsolete
>From a2f3261dfeb124fd1a8ab4d4a8b71a4483345afb Mon Sep 17 00:00:00 2001 >From: John Doe <you@example.com> >Date: Fri, 20 Jan 2023 14:57:21 +0000 >Subject: [PATCH] Bug 30642: (QA follow-up) Do not rely on script names in > modules, add unit test > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Circulation.pm | 8 +++++--- > misc/cronjobs/automatic_renewals.pl | 2 +- > t/db_dependent/Circulation.t | 5 +++-- > 3 files changed, 9 insertions(+), 6 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index b4cdd6c7e2..480ed11924 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3018,7 +3018,7 @@ sub CanBookBeRenewed { > > =head2 AddRenewal > >- &AddRenewal($borrowernumber, $itemnumber, $branch, [$datedue], [$lastreneweddate], [$seen]); >+ &AddRenewal($borrowernumber, $itemnumber, $branch, [$datedue], [$lastreneweddate], [$seen], [$automatic]); > > Renews a loan. > >@@ -3047,6 +3047,8 @@ C<$seen> is a boolean flag indicating if the item was seen or not during the ren > informs the incrementing of the unseen_renewals column. If this flag is not supplied, we > fallback to a true value > >+C<$automatic> is a boolean flag indicating the renewal was triggered automatically and not by a person ( librarian or patron ) >+ > =cut > > sub AddRenewal { >@@ -3057,6 +3059,7 @@ sub AddRenewal { > my $lastreneweddate = shift || dt_from_string(); > my $skipfinecalc = shift; > my $seen = shift; >+ my $automatic = shift; > > # Fallback on a 'seen' renewal > $seen = defined $seen && $seen == 0 ? 0 : 1; >@@ -3066,8 +3069,7 @@ sub AddRenewal { > my $issue = $item_object->checkout; > my $item_unblessed = $item_object->unblessed; > >- my ($package, $filename, $line) = caller; >- my $renewal_type = $filename =~ m/automatic_renewals.pl/ ? "Automatic" : "Manual"; >+ my $renewal_type = $automatic ? "Automatic" : "Manual"; > > my $dbh = C4::Context->dbh; > >diff --git a/misc/cronjobs/automatic_renewals.pl b/misc/cronjobs/automatic_renewals.pl >index 4884eee2f3..0a843843ab 100755 >--- a/misc/cronjobs/automatic_renewals.pl >+++ b/misc/cronjobs/automatic_renewals.pl >@@ -180,7 +180,7 @@ while ( my $auto_renew = $auto_renews->next ) { > $auto_renew->issue_id, $auto_renew->borrowernumber, $auto_renew->itemnumber, $confirm ? 'will' : 'would'; > } > if ($confirm){ >- my $date_due = AddRenewal( $auto_renew->borrowernumber, $auto_renew->itemnumber, $auto_renew->branchcode, undef, undef, undef, 0 ); >+ my $date_due = AddRenewal( $auto_renew->borrowernumber, $auto_renew->itemnumber, $auto_renew->branchcode, undef, undef, undef, 0, 1 ); > $auto_renew->auto_renew_error(undef)->store; > } > push @{ $report{ $auto_renew->borrowernumber } }, $auto_renew >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index c96f9cac60..632d0ba36c 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -4606,7 +4606,7 @@ subtest 'AddRenewal and AddIssuingCharge tests' => sub { > }; > > subtest 'AddRenewal() adds to renewals' => sub { >- plan tests => 4; >+ plan tests => 5; > > my $library = $builder->build_object({ class => 'Koha::Libraries' }); > my $patron = $builder->build_object({ >@@ -4623,7 +4623,7 @@ subtest 'AddRenewal() adds to renewals' => sub { > is(ref($issue), 'Koha::Checkout', 'Issue added'); > > # Renew item >- my $duedate = AddRenewal( $patron->id, $item->id, $library->id ); >+ my $duedate = AddRenewal( $patron->id, $item->id, $library->id, undef, undef, undef, undef, 1 ); > > ok( $duedate, "Renewal added" ); > >@@ -4631,6 +4631,7 @@ subtest 'AddRenewal() adds to renewals' => sub { > is($renewals->count, 1, 'One renewal added'); > my $THE_renewal = $renewals->next; > is( $THE_renewal->renewer_id, C4::Context->userenv->{'number'}, 'Renewer recorded from context' ); >+ is( $THE_renewal->renewal_type, 'Automatic', 'AddRenewal "automatic" parameter sets renewal type to "Automatic"'); > }; > > subtest 'ProcessOfflinePayment() tests' => 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 30642
:
144451
|
144457
|
144463
|
144499
|
144504
|
144505
|
145518
|
145519
|
145520
|
146471
|
146472
|
146473
|
146474
|
146476
|
146614