Browse Source

Bug 20912: (QA follow-up) Fix for missed signature failure

We missed a change in calling parameters passed to CalcDateDue in AddRenewal
during the initial QAing. This patch corrects the call and adds a test to catch
regressions.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Dobrica Pavlinusic <dpavlin@rot13.org>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
19.05.x
Martin Renvoize 5 years ago
committed by Nick Clemens
parent
commit
d3059e6c94
  1. 2
      C4/Circulation.pm
  2. 9
      t/db_dependent/Circulation.t

2
C4/Circulation.pm

@ -2842,7 +2842,7 @@ sub AddRenewal {
$datedue = (C4::Context->preference('RenewalPeriodBase') eq 'date_due') ?
dt_from_string( $issue->date_due, 'sql' ) :
DateTime->now( time_zone => C4::Context->tz());
$datedue = CalcDateDue($datedue, $itemtype, $circ_library, $patron_unblessed, 'is a renewal');
$datedue = CalcDateDue($datedue, $itemtype, $circ_library->branchcode, $patron_unblessed, 'is a renewal');
}
my $fees = Koha::Charges::Fees->new(

9
t/db_dependent/Circulation.t

@ -18,11 +18,12 @@
use Modern::Perl;
use utf8;
use Test::More tests => 125;
use Test::More tests => 126;
use Test::MockModule;
use Data::Dumper;
use DateTime;
use Time::Fake;
use POSIX qw( floor );
use t::lib::Mocks;
use t::lib::TestBuilder;
@ -489,9 +490,13 @@ my ( $reused_itemnumber_1, $reused_itemnumber_2 );
action => "ISSUE"
);
my $old_log_size = Koha::ActionLogs->count( \%params_renewal );
AddRenewal( $renewing_borrower->{borrowernumber}, $item_7->itemnumber, $branch );
my $dt = dt_from_string();
Time::Fake->offset( $dt->epoch );
my $datedue1 = AddRenewal( $renewing_borrower->{borrowernumber}, $item_7->itemnumber, $branch );
my $new_log_size = Koha::ActionLogs->count( \%params_renewal );
is ($new_log_size, $old_log_size, 'renew log not added because of the syspref RenewalLog');
isnt (DateTime->compare($datedue1, $dt), 0, "AddRenewal returned a good duedate");
Time::Fake->reset;
t::lib::Mocks::mock_preference('RenewalLog', 1);
$date = output_pref( { dt => dt_from_string(), dateonly => 1, dateformat => 'iso' } );

Loading…
Cancel
Save