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

(-)a/Koha/Patron.pm (-6 / +17 lines)
Lines 93-98 sub delete { Link Here
93
    return $deleted;
93
    return $deleted;
94
}
94
}
95
95
96
97
=head3 category
98
99
my $patron_category = $patron->category
100
101
Return the patron category for this patron
102
103
=cut
104
105
sub category {
106
    my ( $self ) = @_;
107
    return Koha::Patron::Category->_new_from_dbic( $self->_result->categorycode );
108
}
109
96
=head3 guarantor
110
=head3 guarantor
97
111
98
Returns a Koha::Patron object for this patron's guarantor
112
Returns a Koha::Patron object for this patron's guarantor
Lines 200-207 sub wants_check_for_previous_checkout { Link Here
200
    return 0 if ($self->checkprevcheckout eq 'no');
214
    return 0 if ($self->checkprevcheckout eq 'no');
201
215
202
    # More complex: patron inherits -> determine category preference
216
    # More complex: patron inherits -> determine category preference
203
    my $checkPrevCheckoutByCat = Koha::Patron::Categories
217
    my $checkPrevCheckoutByCat = $self->category->checkprevcheckout;
204
        ->find($self->categorycode)->checkprevcheckout;
205
    return 1 if ($checkPrevCheckoutByCat eq 'yes');
218
    return 1 if ($checkPrevCheckoutByCat eq 'yes');
206
    return 0 if ($checkPrevCheckoutByCat eq 'no');
219
    return 0 if ($checkPrevCheckoutByCat eq 'no');
207
220
Lines 304-311 sub renew_account { Link Here
304
            ? dt_from_string( $self->dateexpiry )
317
            ? dt_from_string( $self->dateexpiry )
305
            : dt_from_string;
318
            : dt_from_string;
306
    }
319
    }
307
    my $patron_category = Koha::Patron::Categories->find( $self->categorycode );    # FIXME Should be $self->category
320
    my $expiry_date = $self->category->get_expiry_date($date);
308
    my $expiry_date     = $patron_category->get_expiry_date($date);
309
321
310
    $self->dateexpiry($expiry_date)->store;
322
    $self->dateexpiry($expiry_date)->store;
311
323
Lines 440-447 Add enrolment fee for a patron if needed. Link Here
440
452
441
sub add_enrolment_fee_if_needed {
453
sub add_enrolment_fee_if_needed {
442
    my ($self) = @_;
454
    my ($self) = @_;
443
    my $patron_category = Koha::Patron::Categories->find( $self->categorycode );
455
    my $enrolment_fee = $self->category->enrolmentfee;
444
    my $enrolment_fee = $patron_category->enrolmentfee;
445
    if ( $enrolment_fee && $enrolment_fee > 0 ) {
456
    if ( $enrolment_fee && $enrolment_fee > 0 ) {
446
        # insert fee in patron debts
457
        # insert fee in patron debts
447
        C4::Accounts::manualinvoice( $self->borrowernumber, '', '', 'A', $enrolment_fee );
458
        C4::Accounts::manualinvoice( $self->borrowernumber, '', '', 'A', $enrolment_fee );
(-)a/t/db_dependent/Koha/Patrons.t (-2 / +8 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 11;
22
use Test::More tests => 12;
23
use Test::Warn;
23
use Test::Warn;
24
24
25
use C4::Members;
25
use C4::Members;
Lines 89-94 subtest 'guarantees' => sub { Link Here
89
    $_->delete for @guarantees;
89
    $_->delete for @guarantees;
90
};
90
};
91
91
92
subtest 'category' => sub {
93
    plan tests => 2;
94
    my $patron_category = $new_patron_1->category;
95
    is( ref( $patron_category), 'Koha::Patron::Category', );
96
    is( $patron_category->categorycode, $category->{categorycode}, );
97
};
98
92
subtest 'siblings' => sub {
99
subtest 'siblings' => sub {
93
    plan tests => 7;
100
    plan tests => 7;
94
    my $siblings = $new_patron_1->siblings;
101
    my $siblings = $new_patron_1->siblings;
95
- 

Return to bug 17555