#
# 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'},
$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') {
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;