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

(-)a/Koha/Account/Line.pm (-4 / +6 lines)
Lines 62-72 Return the checkout linked to this account line if exists Link Here
62
62
63
sub checkout {
63
sub checkout {
64
    my ( $self ) = @_;
64
    my ( $self ) = @_;
65
    return unless $self->issue_id ;
65
    return unless $self->issue_id;
66
    my $issue_rs = $self->_result->issue;
67
    return Koha::Checkout->_new_from_dbic( $issue_rs ) if $issue_rs;
66
68
67
    $self->{_checkout} ||= Koha::Checkouts->find( $self->issue_id );
69
    my $old_issue_rs = $self->_result->old_issue;
68
    $self->{_checkout} ||= Koha::Old::Checkouts->find( $self->issue_id );
70
    return Koha::Old::Checkout->_new_from_dbic( $old_issue_rs ) if $old_issue_rs;
69
    return $self->{_checkout};
71
    return undef;
70
}
72
}
71
73
72
=head3 void
74
=head3 void
(-)a/Koha/Schema/Result/Accountline.pm (-1 / +44 lines)
Lines 279-282 sub koha_object_class { Link Here
279
    'Koha::Account::Line';
279
    'Koha::Account::Line';
280
}
280
}
281
281
282
=head2 issue
283
284
Type: belongs_to
285
286
Related object: L<Koha::Schema::Result::Issue>
287
288
Note: This DBIC only relationship should be removed (as it will get automatically recreated)
289
if we add a proper foreign key for accountlines.issue_id
290
291
=cut
292
293
__PACKAGE__->belongs_to(
294
  "issue",
295
  "Koha::Schema::Result::Issue",
296
  { "foriegn.issue_id" => "self.issue_id" },
297
  {
298
    is_deferrable => 1,
299
    join_type     => "LEFT"
300
  },
301
);
302
303
=head2 old_issue
304
305
Type: belongs_to
306
307
Related object: L<Koha::Schema::Result::OldIssue>
308
309
Note: This DBIC only relationship should be removed (as it will get automatically recreated)
310
if we add a proper foreign key for accountlines.issue_id
311
312
=cut
313
314
__PACKAGE__->belongs_to(
315
  "old_issue",
316
  "Koha::Schema::Result::OldIssue",
317
  { "foriegn.issue_id" => "self.issue_id" },
318
  {
319
    is_deferrable => 1,
320
    join_type     => "LEFT",
321
    on_delete     => "SET NULL",
322
    on_update     => "CASCADE",
323
  },
324
);
325
282
1;
326
1;
283
- 

Return to bug 22683