return Koha::Item->_new_from_dbic( $item_rs );
}
+=head3 accountlines
+
+my $accountlines = $checkout->accountlines;
+
+Return the checked out accountlines
+
+=cut
+
+sub accountlines {
+ my ( $self ) = @_;
+ my $accountlines_rs = $self->_result->accountlines;
+ return Koha::Account::Lines->_new_from_dbic( $accountlines_rs );
+}
+
=head3 library
my $library = $checkout->library;
return Koha::Item->_new_from_dbic( $item_rs );
}
+=head3 accountlines
+
+my $accountlines = $checkout->accountlines;
+
+Return the checked out accountlines
+
+=cut
+
+sub accountlines {
+ my ( $self ) = @_;
+ my $accountlines_rs = $self->_result->accountlines;
+ return Koha::Account::Lines->_new_from_dbic( $accountlines_rs );
+}
+
=head3 library
my $library = $checkout->library;
subtest 'apply() tests' => sub {
- plan tests => 31;
+ plan tests => 32;
$schema->storage->txn_begin;
}
)->store();
+ my $a = $checkout->accountlines->next;
+ is( $a->id, $accountline->id, "Koha::Checkout::accountlines returns the related acountline" );
+
# Enable renewing upon fine payment
t::lib::Mocks::mock_preference( 'RenewAccruingItemWhenPaid', 1 );
my $called = 0;
use Modern::Perl;
-use Test::More tests => 10;
+use Test::More tests => 11;
use C4::Circulation qw( MarkIssueReturned AddReturn );
use Koha::Checkouts;
'Koha::Checkout->item should return the correct item' );
};
+subtest 'accountlines' => sub {
+ plan tests => 3;
+
+ my $accountline = Koha::Account::Line->new(
+ {
+ issue_id => $retrieved_checkout_1->id,
+ borrowernumber => $retrieved_checkout_1->borrowernumber,
+ itemnumber => $retrieved_checkout_1->itemnumber,
+ branchcode => $retrieved_checkout_1->branchcode,
+ date => \'NOW()',
+ debit_type_code => 'OVERDUE',
+ status => 'UNRETURNED',
+ interface => 'cli',
+ amount => '1',
+ amountoutstanding => '1',
+ }
+ )->store();
+
+ my $accountlines = $retrieved_checkout_1->accountlines;
+ is( ref($accountlines), 'Koha::Account::Lines',
+ 'Koha::Checkout->accountlines should return a Koha::Item' );
+
+ my $line = $accountlines->next;
+ is( ref($line), 'Koha::Account::Line',
+ 'next returns a Koha::Account::Line' );
+
+ is(
+ $accountline->id,
+ $line->id,
+ 'Koha::Checkout->accountlines should return the correct accountlines'
+ );
+};
+
subtest 'patron' => sub {
plan tests => 3;
my $patron = $builder->build_object(