Bugzilla – Attachment 67028 Details for
Bug 19276
CanBookBeIssued: unsuccessfully refers to borrower category_type X
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19276: (bug 17829 follow-up) Fix Statistic patrons behaviour
Bug-19276-bug-17829-follow-up-Fix-Statistic-patron.patch (text/plain), 3.96 KB, created by
Alex Buckley
on 2017-09-09 02:35:14 UTC
(
hide
)
Description:
Bug 19276: (bug 17829 follow-up) Fix Statistic patrons behaviour
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2017-09-09 02:35:14 UTC
Size:
3.96 KB
patch
obsolete
>From 1ce0418491aca500bfe0b9a3793c620c93c6c79f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 8 Sep 2017 12:47:03 -0300 >Subject: [PATCH] Bug 19276: (bug 17829 follow-up) Fix Statistic patrons > behaviour > >Bug 17829 must have been handle this specific case: GetMember set >category_type, but now $borrower is a Koha::Patron unblessed and does >not contain the category_type. >The fix is to call ->category->category_type on the Koha::Patron object >to be able to know if they are a statistic patrons. > >Test plan: >Run the tests > >Tests pass, as does QA test tool >Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz> >--- > C4/Circulation.pm | 5 +++-- > t/db_dependent/Circulation.t | 46 +++++++++++++++++++++++++++++++++++++++++++- > 2 files changed, 48 insertions(+), 3 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index e4fee8f..ecdc512 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -716,7 +716,8 @@ sub CanBookBeIssued { > # > # BORROWER STATUS > # >- if ( $borrower->{'category_type'} eq 'X' && ( $item->{barcode} )) { >+ my $patron = Koha::Patrons->find( $borrower->{borrowernumber} ); >+ if ( $patron->category->category_type eq 'X' && ( $item->{barcode} )) { > # stats only borrower -- add entry to statistics table, and return issuingimpossible{STATS} = 1 . > &UpdateStats({ > branch => C4::Context->userenv->{'branch'}, >@@ -810,7 +811,7 @@ sub CanBookBeIssued { > $alerts{OTHER_CHARGES} = sprintf( "%.2f", $other_charges ); > } > >- my $patron = Koha::Patrons->find( $borrower->{borrowernumber} ); >+ $patron = Koha::Patrons->find( $borrower->{borrowernumber} ); > if ( my $debarred_date = $patron->is_debarred ) { > # patron has accrued fine days or has a restriction. $count is a date > if ($debarred_date eq '9999-12-31') { >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 3e81576..98f6790 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 100; >+use Test::More tests => 101; > > use DateTime; > >@@ -1360,6 +1360,50 @@ subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub { > is( $error->{USERBLOCKEDNOENDDATE}, '9999-12-31', 'USERBLOCKEDNOENDDATE should be 9999-12-31 for unlimited debarments' ); > }; > >+subtest 'CanBookBeIssued + Statistic patrons "X"' => sub { >+ plan tests => 1; >+ >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $patron_category = $builder->build_object( >+ { >+ class => 'Koha::Patron::Categories', >+ value => { category_type => 'X' } >+ } >+ ); >+ my $patron = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { >+ categorycode => $patron_category->categorycode, >+ gonenoaddress => undef, >+ lost => undef, >+ debarred => undef, >+ borrowernotes => "" >+ } >+ } >+ ); >+ my $biblioitem_1 = $builder->build( { source => 'Biblioitem' } ); >+ my $item_1 = $builder->build( >+ { >+ source => 'Item', >+ value => { >+ homebranch => $library->branchcode, >+ holdingbranch => $library->branchcode, >+ notforloan => 0, >+ itemlost => 0, >+ withdrawn => 0, >+ restricted => 0, >+ biblionumber => $biblioitem_1->{biblionumber} >+ } >+ } >+ ); >+ >+ my ( $error, $question, $alerts ) = CanBookBeIssued( $patron->unblessed, $item_1->{barcode} ); >+ is( $error->{STATS}, 1, '"Error" flag "STATS" must be set if CanBookBeIssued is called with a statistic patron (category_type=X)' ); >+ >+ # TODO There are other tests to provide here >+}; >+ > subtest 'MultipleReserves' => sub { > plan tests => 3; > >-- >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 19276
:
66997
|
67028
|
67445
|
67491