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

(-)a/Koha/Patron/Quota/Usage.pm (+75 lines)
Line 0 Link Here
1
package Koha::Patron::Quota::Usage;
2
3
use base qw(Koha::Object);
4
use Modern::Perl;
5
use Koha::Patron::Quota;
6
use Koha::Patron::Quota::Usages;
7
8
=head1 NAME
9
10
Koha::Patron::Quota::Usage - Koha Patron Quota Usage Object class
11
12
=head1 API
13
14
=head2 Class methods
15
16
=cut
17
18
=head3 patron
19
20
Returns the patron this quota usage belongs to
21
22
=cut
23
24
sub patron {
25
    my ($self) = @_;
26
    my $rs = $self->_result->patron;
27
    return Koha::Patron->_new_from_dbic($rs);
28
}
29
30
=head3 quota
31
32
Returns the quota this usage belongs to
33
34
=cut
35
36
sub quota {
37
    my ($self) = @_;
38
    my $rs = $self->_result->patron_quota;
39
    return Koha::Patron::Quota->_new_from_dbic($rs);
40
}
41
42
=head3 store
43
44
Overloaded I<store> method to set implement issue_id foreign key in code
45
46
=cut
47
48
sub store {
49
    my ($self) = @_;
50
51
    # Check that we have a valid issue_id
52
    unless ( !$self->issue_id
53
        || Koha::Checkouts->find( $self->issue_id )
54
        || Koha::Old::Checkouts->find( $self->issue_id ) )
55
    {
56
        Koha::Exceptions::Object::FKConstraint->throw(
57
            error     => 'Broken FK Contraint',
58
            broken_fk => 'issue_id'
59
        );
60
    }
61
62
    return $self->SUPER::store();
63
}
64
65
=head2 Internal methods
66
67
=head3 _type
68
69
=cut
70
71
sub _type {
72
    return 'PatronQuotaUsage';
73
}
74
75
1;
(-)a/Koha/Patron/Quota/Usages.pm (-1 / +35 lines)
Line 0 Link Here
0
- 
1
package Koha::Patron::Quota::Usages;
2
3
use base qw(Koha::Objects);
4
use Modern::Perl;
5
use Koha::Patron::Quota::Usage;
6
7
=head1 NAME
8
9
Koha::Patron::Quota::Usages - Koha Patron Quota Usages Object set class
10
11
=head1 API
12
13
=head2 Class methods
14
15
=cut
16
17
=head2 Internal methods
18
19
=head3 _type
20
21
=cut
22
23
sub _type {
24
    return 'PatronQuotaUsage';
25
}
26
27
=head3 object_class
28
29
=cut
30
31
sub object_class {
32
    return 'Koha::Patron::Quota::Usage';
33
}
34
35
1;

Return to bug 38924