X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=Koha%2FCheckout.pm;h=178a8c0da4aa0bfa56efefc3160d891a22abdcb1;hb=689446fda0fa665202c9e32c50705ba828337c94;hp=cc00194248521189d982e2f46d7530928894f75a;hpb=9d6d641d1f8b77271800f43bc027b651f9aea52b;p=koha-ffzg.git diff --git a/Koha/Checkout.pm b/Koha/Checkout.pm index cc00194248..178a8c0da4 100644 --- a/Koha/Checkout.pm +++ b/Koha/Checkout.pm @@ -24,6 +24,7 @@ use DateTime; use Try::Tiny qw( catch try ); use C4::Circulation qw( LostItem MarkIssueReturned ); +use Koha::Checkouts::Renewals; use Koha::Checkouts::ReturnClaims; use Koha::Database; use Koha::DateUtils qw( dt_from_string ); @@ -78,6 +79,20 @@ sub item { return Koha::Item->_new_from_dbic( $item_rs ); } +=head3 account_lines + +my $account_lines = $checkout->account_lines; + +Return the checked out account_lines + +=cut + +sub account_lines { + my ( $self ) = @_; + my $account_lines_rs = $self->_result->account_lines; + return Koha::Account::Lines->_new_from_dbic( $account_lines_rs ); +} + =head3 library my $library = $checkout->library; @@ -102,7 +117,7 @@ Return the patron for who the checkout has been done sub patron { my ( $self ) = @_; - my $patron_rs = $self->_result->borrower; + my $patron_rs = $self->_result->patron; return Koha::Patron->_new_from_dbic( $patron_rs ); } @@ -121,6 +136,21 @@ sub issuer { return Koha::Patron->_new_from_dbic( $issuer_rs ); } +=head3 renewals + + my $renewals = $checkout->renewals; + +Return a Koha::Checkouts::Renewals set attached to this checkout + +=cut + +sub renewals { + my ( $self ) = @_; + my $renewals_rs = $self->_result->renewals; + return unless $renewals_rs; + return Koha::Checkouts::Renewals->_new_from_dbic( $renewals_rs ); +} + =head3 to_api_mapping This method returns the mapping for representing a Koha::Checkout object @@ -199,12 +229,12 @@ sub claim_returned { ); } catch { - if ( $_->isa('Koha::Exceptions::Exception') ) { + if ( $_->isa('Koha::Exception') ) { $_->rethrow(); } else { # ? - Koha::Exceptions::Exception->throw( "Unhandled exception" ); + Koha::Exception->throw( "Unhandled exception" ); } }; }