Bug 18572 - QA Followup

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Nick Clemens 2017-07-19 18:26:07 +00:00 committed by Jonathan Druart
parent e9374dcf63
commit 9b92d79817
3 changed files with 12 additions and 6 deletions

View file

@ -2815,7 +2815,6 @@ sub AddRenewal {
my $branch = shift;
my $datedue = shift;
my $lastreneweddate = shift || DateTime->now(time_zone => C4::Context->tz)->ymd();
my $opacrenewal = shift;
my $item = GetItem($itemnumber) or return;
my $item_object = Koha::Items->find( $itemnumber ); # Should replace $item
@ -2916,7 +2915,7 @@ sub AddRenewal {
DelUniqueDebarment({ borrowernumber => $borrowernumber, type => 'OVERDUES' });
}
unless ( $opacrenewal ) { #if from opac we are obeying OpacRenewalBranch as calculated in opac-renew.pl
unless ( C4::Context->interface eq 'opac' ) { #if from opac we are obeying OpacRenewalBranch as calculated in opac-renew.pl
$branch = C4::Context->userenv ? C4::Context->userenv->{branch} : $branch;
}

View file

@ -82,7 +82,7 @@ else {
else {
$branchcode = 'OPACRenew';
}
AddRenewal( $borrowernumber, $itemnumber, $branchcode, undef, undef, 1 );
AddRenewal( $borrowernumber, $itemnumber, $branchcode, undef, undef );
push( @renewed, $itemnumber );
}
else {

View file

@ -216,6 +216,9 @@ is ($countaccount,1,"1 accountline has been added");
# Test AddRenewal
my $se = Test::MockModule->new( 'C4::Context' );
$se->mock( 'interface', sub {return 'intranet'});
# Let's renew this one at a different library for statistical purposes to test Bug 17781
C4::Context->set_userenv(@USERENV_DIFFERENT_LIBRARY);
my $datedue3 = AddRenewal( $borrower_id1, $item_id1, $branchcode_1, $datedue1, $daysago10 );
@ -230,14 +233,18 @@ like(
my $stat = $dbh->selectrow_hashref("SELECT * FROM statistics WHERE type = 'renew' AND borrowernumber = ? AND itemnumber = ? AND branch = ?", undef, $borrower_id1, $item_id1, $branchcode_3 );
ok( $stat, "Bug 17781 - 'Improper branchcode set during renewal' still fixed" );
$se->mock( 'interface', sub {return 'opac'});
#Let's do an opac renewal - whatever branchcode we send should be used
my $opac_renew_issue = $builder->build({ source=>"Issue",value=>{
my $opac_renew_issue = $builder->build({
source=>"Issue",
value=>{
date_due => '2017-01-01',
branch => $branchcode_1,
itype => $itemtype,
borrowernumber => $borrower_id1
}
});
});
my $datedue4 = AddRenewal( $opac_renew_issue->{borrowernumber}, $opac_renew_issue->{itemnumber}, "Stavromula", $datedue1, $daysago10, 1 );