View | Details | Raw Unified | Return to bug 38340
Collapse All | Expand All

(-)a/Koha/Patron.pm (+14 lines)
Lines 46-51 use Koha::Encryption; Link Here
46
use Koha::Exceptions;
46
use Koha::Exceptions;
47
use Koha::Exceptions::Password;
47
use Koha::Exceptions::Password;
48
use Koha::Holds;
48
use Koha::Holds;
49
use Koha::ILL::Requests;
49
use Koha::Old::Checkouts;
50
use Koha::Old::Checkouts;
50
use Koha::OverdueRules;
51
use Koha::OverdueRules;
51
use Koha::Patron::Attributes;
52
use Koha::Patron::Attributes;
Lines 1481-1486 sub checkouts { Link Here
1481
    return Koha::Checkouts->_new_from_dbic($checkouts);
1482
    return Koha::Checkouts->_new_from_dbic($checkouts);
1482
}
1483
}
1483
1484
1485
=head3 ill_requests
1486
1487
    my $ill_requests = $patron->ill_requests();
1488
1489
Method that returns the related I<Koha::ILL::Requests> iterator.
1490
1491
=cut
1492
1493
sub ill_requests {
1494
    my ($self) = @_;
1495
    return Koha::ILL::Requests->_new_from_dbic( scalar $self->_result->ill_requests );
1496
}
1497
1484
=head3 pending_checkouts
1498
=head3 pending_checkouts
1485
1499
1486
my $pending_checkouts = $patron->pending_checkouts
1500
my $pending_checkouts = $patron->pending_checkouts
(-)a/Koha/Schema/Result/Borrower.pm (+7 lines)
Lines 2230-2235 __PACKAGE__->add_columns( Link Here
2230
    '+protected'               => { is_boolean => 1 },
2230
    '+protected'               => { is_boolean => 1 },
2231
);
2231
);
2232
2232
2233
__PACKAGE__->has_many(
2234
  "ill_requests",
2235
  "Koha::Schema::Result::Illrequest",
2236
  { "foreign.borrowernumber" => "self.borrowernumber" },
2237
  { cascade_copy => 0, cascade_delete => 0 },
2238
);
2239
2233
=head2 koha_objects_class
2240
=head2 koha_objects_class
2234
2241
2235
Missing POD for koha_objects_class.
2242
Missing POD for koha_objects_class.
(-)a/t/db_dependent/Koha/Patron.t (-2 / +23 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 38;
22
use Test::More tests => 39;
23
use Test::Exception;
23
use Test::Exception;
24
use Test::Warn;
24
use Test::Warn;
25
use Time::Fake;
25
use Time::Fake;
Lines 2846-2848 subtest 'preferred_name' => sub { Link Here
2846
    is( $patron->preferred_name, "Preferred again", "Preferred name set on update when passed" );
2846
    is( $patron->preferred_name, "Preferred again", "Preferred name set on update when passed" );
2847
2847
2848
};
2848
};
2849
- 
2849
2850
subtest 'ill_requests() tests' => sub {
2851
2852
    plan tests => 3;
2853
2854
    $schema->storage->txn_begin;
2855
2856
    my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
2857
2858
    my $reqs_rs = $patron->ill_requests();
2859
    is( ref($reqs_rs),   'Koha::ILL::Requests', 'Returned object type is correct' );
2860
    is( $reqs_rs->count, 0,                     'No linked ILL requests for the patron' );
2861
2862
    # add two requests
2863
    $builder->build_object( { class => 'Koha::ILL::Requests', value => { borrowernumber => $patron->id } } );
2864
    $builder->build_object( { class => 'Koha::ILL::Requests', value => { borrowernumber => $patron->id } } );
2865
2866
    $reqs_rs = $patron->ill_requests();
2867
    is( $reqs_rs->count, 2, 'Two linked ILL requests for the patron' );
2868
2869
    $schema->storage->txn_rollback;
2870
};

Return to bug 38340