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

(-)a/Koha/Account/Line.pm (-5 / +4 lines)
Lines 90-101 Return the checkout linked to this account line if exists Link Here
90
=cut
90
=cut
91
91
92
sub checkout {
92
sub checkout {
93
    my ( $self ) = @_;
93
    my ($self) = @_;
94
    return unless $self->issue_id ;
94
    return unless $self->issue_id;
95
95
96
    $self->{_checkout} ||= Koha::Checkouts->find( $self->issue_id );
96
    return Koha::Checkouts->find( $self->issue_id )
97
    $self->{_checkout} ||= Koha::Old::Checkouts->find( $self->issue_id );
97
      || Koha::Old::Checkouts->find( $self->issue_id );
98
    return $self->{_checkout};
99
}
98
}
100
99
101
=head3 library
100
=head3 library
(-)a/Koha/ArticleRequest.pm (-15 / +12 lines)
Lines 178-186 Returns the Koha::Biblio object for this article request Link Here
178
sub biblio {
178
sub biblio {
179
    my ($self) = @_;
179
    my ($self) = @_;
180
180
181
    $self->{_biblio} ||= Koha::Biblios->find( $self->biblionumber() );
181
    my $rs = $self->result->biblionumber;
182
182
    return unless $rs;
183
    return $self->{_biblio};
183
    return Koha::Biblio->_new_from_dbic($rs);
184
}
184
}
185
185
186
=head3 debit
186
=head3 debit
Lines 208-217 Returns the Koha::Item object for this article request Link Here
208
208
209
sub item {
209
sub item {
210
    my ($self) = @_;
210
    my ($self) = @_;
211
211
    my $rs = $self->_result->itemnumber;
212
    $self->{_item} ||= Koha::Items->find( $self->itemnumber() );
212
    return unless $rs;
213
213
    return Koha::Item->_new_from_dbic($rs);
214
    return $self->{_item};
215
}
214
}
216
215
217
=head3 borrower
216
=head3 borrower
Lines 222-231 Returns the Koha::Patron object for this article request Link Here
222
221
223
sub borrower {
222
sub borrower {
224
    my ($self) = @_;
223
    my ($self) = @_;
225
224
    my $rs = $self->_result->borrowernumber;
226
    $self->{_borrower} ||= Koha::Patrons->find( $self->borrowernumber() );
225
    return unless $rs;
227
226
    return Koha::Patron->_new_from_dbic($rs);
228
    return $self->{_borrower};
229
}
227
}
230
228
231
=head3 branch
229
=head3 branch
Lines 236-245 Returns the Koha::Library object for this article request Link Here
236
234
237
sub branch {
235
sub branch {
238
    my ($self) = @_;
236
    my ($self) = @_;
239
237
    my $rs = $self->_result->branchcode;
240
    $self->{_branch} ||= Koha::Libraries->find( $self->branchcode() );
238
    return unless $rs;
241
239
    return Koha::Library->_new_from_dbic($rs);
242
    return $self->{_branch};
243
}
240
}
244
241
245
=head3 store
242
=head3 store
(-)a/Koha/Biblio.pm (-5 / +3 lines)
Lines 535-541 sub current_holds { Link Here
535
535
536
=head3 biblioitem
536
=head3 biblioitem
537
537
538
my $field = $self->biblioitem()->itemtype
538
my $field = $self->biblioitem
539
539
540
Returns the related Koha::Biblioitem object for this Biblio object
540
Returns the related Koha::Biblioitem object for this Biblio object
541
541
Lines 671-680 Returns the related Koha::Subscriptions object for this Biblio object Link Here
671
671
672
sub subscriptions {
672
sub subscriptions {
673
    my ($self) = @_;
673
    my ($self) = @_;
674
674
    my $rs = $self->_result->subscriptions;
675
    $self->{_subscriptions} ||= Koha::Subscriptions->search( { biblionumber => $self->biblionumber } );
675
    return Koha::Subscriptions->_new_from_dbic($rs);
676
677
    return $self->{_subscriptions};
678
}
676
}
679
677
680
=head3 has_items_waiting_or_intransit
678
=head3 has_items_waiting_or_intransit
(-)a/Koha/CirculationRule.pm (-12 / +9 lines)
Lines 41-50 Koha::CirculationRule - Koha CirculationRule object class Link Here
41
41
42
sub library {
42
sub library {
43
    my ($self) = @_;
43
    my ($self) = @_;
44
44
    my $rs = $self->_result->branchcode;
45
    $self->{_library} ||= Koha::Libraries->find( $self->branchcode );
45
    return unless $rs;
46
46
    return Koha::Library->_new_from_dbic($rs);
47
    return $self->{_library};
48
}
47
}
49
48
50
=head3 patron_category
49
=head3 patron_category
Lines 53-62 sub library { Link Here
53
52
54
sub patron_category {
53
sub patron_category {
55
    my ($self) = @_;
54
    my ($self) = @_;
56
55
    my $rs = $self->_result->categorycode;
57
    $self->{_patron_category} ||= Koha::Patron::Categories->find( $self->categorycode );
56
    return unless $rs;
58
57
    return Koha::Patron::Category->_new_from_dbic($rs);
59
    return $self->{_patron_category};
60
}
58
}
61
59
62
=head3 item_type
60
=head3 item_type
Lines 65-74 sub patron_category { Link Here
65
63
66
sub item_type {
64
sub item_type {
67
    my ($self) = @_;
65
    my ($self) = @_;
68
66
    my $rs = $self->_result->itemtype;
69
    $self->{_item_type} ||= Koha::ItemTypes->find( $self->itemtype );
67
    return unless $rs;
70
68
    return Koha::ItemTypes->_new_from_dbic($rs);
71
    return $self->{item_type};
72
}
69
}
73
70
74
=head3 clone
71
=head3 clone
(-)a/Koha/Hold.pm (-23 / +14 lines)
Lines 516-525 Returns the related Koha::Biblio object for this hold Link Here
516
516
517
sub biblio {
517
sub biblio {
518
    my ($self) = @_;
518
    my ($self) = @_;
519
519
    my $rs = $self->_result->biblionumber;
520
    $self->{_biblio} ||= Koha::Biblios->find( $self->biblionumber() );
520
    return Koha::Biblio->_new_from_dbic($rs);
521
522
    return $self->{_biblio};
523
}
521
}
524
522
525
=head3 patron
523
=head3 patron
Lines 530-538 Returns the related Koha::Patron object for this hold Link Here
530
528
531
sub patron {
529
sub patron {
532
    my ($self) = @_;
530
    my ($self) = @_;
533
531
    my $rs = $self->_result->patron;
534
    my $patron_rs = $self->_result->patron;
532
    return Koha::Patron->_new_from_dbic($rs);
535
    return Koha::Patron->_new_from_dbic($patron_rs);
536
}
533
}
537
534
538
=head3 item
535
=head3 item
Lines 543-552 Returns the related Koha::Item object for this Hold Link Here
543
540
544
sub item {
541
sub item {
545
    my ($self) = @_;
542
    my ($self) = @_;
546
543
    my $rs = $self->_result->itemnumber;
547
    $self->{_item} ||= Koha::Items->find( $self->itemnumber() );
544
    return unless $rs;
548
545
    return Koha::Item->_new_from_dbic($rs);
549
    return $self->{_item};
550
}
546
}
551
547
552
=head3 item_group
548
=head3 item_group
Lines 557-566 Returns the related Koha::Biblio::ItemGroup object for this Hold Link Here
557
553
558
sub item_group {
554
sub item_group {
559
    my ($self) = @_;
555
    my ($self) = @_;
560
556
    my $rs = $self->_result->item_group;
561
    my $item_group_rs = $self->_result->item_group;
557
    return unless $rs;
562
    return unless $item_group_rs;
558
    return Koha::Biblio::ItemGroup->_new_from_dbic($rs);
563
    return Koha::Biblio::ItemGroup->_new_from_dbic($item_group_rs);
564
}
559
}
565
560
566
=head3 branch
561
=head3 branch
Lines 571-580 Returns the related Koha::Library object for this Hold Link Here
571
566
572
sub branch {
567
sub branch {
573
    my ($self) = @_;
568
    my ($self) = @_;
574
569
    my $rs = $self->_result->branchcode;
575
    $self->{_branch} ||= Koha::Libraries->find( $self->branchcode() );
570
    return Koha::Library->_new_from_dbic($rs);
576
577
    return $self->{_branch};
578
}
571
}
579
572
580
=head3 desk
573
=head3 desk
Lines 599-608 Returns the related Koha::Patron object for this Hold Link Here
599
# FIXME Should be renamed with ->patron
592
# FIXME Should be renamed with ->patron
600
sub borrower {
593
sub borrower {
601
    my ($self) = @_;
594
    my ($self) = @_;
602
595
    my $rs = $self->_result->borrowernumber;
603
    $self->{_borrower} ||= Koha::Patrons->find( $self->borrowernumber() );
596
    return Koha::Patron->_new_from_dbic($rs);
604
605
    return $self->{_borrower};
606
}
597
}
607
598
608
=head3 is_suspended
599
=head3 is_suspended
(-)a/Koha/Library/Group.pm (-10 / +6 lines)
Lines 42-51 Koha::Library::Group - Koha Library::Group object class Link Here
42
42
43
sub parent {
43
sub parent {
44
    my ($self) = @_;
44
    my ($self) = @_;
45
45
    my $rs = $self->_result->parent;
46
    $self->{_parent} ||= Koha::Library::Groups->find( $self->parent_id );
46
    return unless $rs;
47
47
    return Koha::Library::Group->_new_from_dbic($rs);
48
    return $self->{_parent};
49
}
48
}
50
49
51
=head3 my @children = $self->children()
50
=head3 my @children = $self->children()
Lines 86-97 Returns the library for this group if one exists Link Here
86
85
87
sub library {
86
sub library {
88
    my ($self) = @_;
87
    my ($self) = @_;
89
88
    my $rs = $self->_result->branchcode;
90
    return unless $self->branchcode;
89
    return unless $rs;
91
90
    return Koha::Library->_new_from_dbic($rs);
92
    $self->{_library} ||= Koha::Libraries->find( $self->branchcode );
93
94
    return $self->{_library};
95
}
91
}
96
92
97
=head3 libraries
93
=head3 libraries
(-)a/Koha/Object/Limit/Library.pm (-5 / +1 lines)
Lines 178-188 Returns the internal resultset for the branch limitation table or creates it if Link Here
178
178
179
sub _library_limit_rs {
179
sub _library_limit_rs {
180
    my ($self) = @_;
180
    my ($self) = @_;
181
181
    return Koha::Database->new->schema->resultset( $self->_library_limits->{class} );
182
    $self->{_library_limit_rs} ||= Koha::Database->new->schema->resultset(
183
        $self->_library_limits->{class} );
184
185
    return $self->{_library_limit_rs};
186
}
182
}
187
183
188
1;
184
1;
(-)a/Koha/Virtualshelf.pm (-2 / +2 lines)
Lines 110-123 sub is_shelfname_valid { Link Here
110
110
111
sub get_shares {
111
sub get_shares {
112
    my ( $self ) = @_;
112
    my ( $self ) = @_;
113
    my $rs = $self->{_result}->virtualshelfshares;
113
    my $rs = $self->_result->virtualshelfshares;
114
    my $shares = Koha::Virtualshelfshares->_new_from_dbic( $rs );
114
    my $shares = Koha::Virtualshelfshares->_new_from_dbic( $rs );
115
    return $shares;
115
    return $shares;
116
}
116
}
117
117
118
sub get_contents {
118
sub get_contents {
119
    my ( $self ) = @_;
119
    my ( $self ) = @_;
120
    my $rs = $self->{_result}->virtualshelfcontents;
120
    my $rs = $self->_result->virtualshelfcontents;
121
    my $contents = Koha::Virtualshelfcontents->_new_from_dbic( $rs );
121
    my $contents = Koha::Virtualshelfcontents->_new_from_dbic( $rs );
122
    return $contents;
122
    return $contents;
123
}
123
}
(-)a/Koha/Virtualshelfshare.pm (-2 / +1 lines)
Lines 89-95 sub has_expired { Link Here
89
89
90
sub sharee {
90
sub sharee {
91
    my $self = shift;
91
    my $self = shift;
92
    return Koha::Patron->_new_from_dbic( $self->{_result}->borrowernumber );
92
    return Koha::Patron->_new_from_dbic( $self->_result->borrowernumber );
93
}
93
}
94
94
95
=head3 _type
95
=head3 _type
96
- 

Return to bug 32894