@@ -, +, @@ - Add a basket and an order, close the basket - Go to the late oder page - Make sure your order shows up there - Apply the patch - Reload the late orders page - Verify a new column budget shows in the table - Verify the table configuration settings work for the new column - Run t/db_dependent/Koha/Acquisition/Fund.t --- Koha/Acquisition/Fund.pm | 16 ++++++++++++++++ admin/columns_settings.yml | 2 ++ .../intranet-tmpl/prog/en/modules/acqui/lateorders.tt | 5 +++-- t/db_dependent/Koha/Acquisition/Fund.t | 19 ++++++++++++++++++- 4 files changed, 39 insertions(+), 3 deletions(-) --- a/Koha/Acquisition/Fund.pm +++ a/Koha/Acquisition/Fund.pm @@ -17,6 +17,7 @@ package Koha::Acquisition::Fund; use Modern::Perl; +use Koha::Acquisition::Budgets; use Koha::Database; use base qw(Koha::Object); @@ -29,6 +30,21 @@ Koha::Acquisition::Fund object class =head2 Class methods +=head3 budget + + my $budget = $fund->budget; + +Returns the I object for the budget (aqbudgetperiods) +associated to the fund. + +=cut + +sub budget { + my ( $self ) = @_; + my $budget_rs = $self->_result->budget; + return Koha::Acquisition::Budget->_new_from_dbic( $budget_rs ); +} + =head3 to_api my $json = $fund->to_api; --- a/admin/columns_settings.yml +++ a/admin/columns_settings.yml @@ -60,6 +60,8 @@ modules: - columnname: library - + columnname: budget + - columnname: fund - columnname: claims_count --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt @@ -67,6 +67,7 @@ Basket Basket group Library + Budget Fund Claims count Claimed date @@ -131,8 +132,8 @@ [% Branches.GetName( lateorder.basket.authorizer.branchcode ) | html %] - [% lateorder.fund.budget_name | html %] - + [% lateorder.fund.budget.budget_period_description | html %] + [% lateorder.fund.budget_name | html %] [% lateorder.claims.count | html %] [% FOR claim IN lateorder.claims %] --- a/t/db_dependent/Koha/Acquisition/Fund.t +++ a/t/db_dependent/Koha/Acquisition/Fund.t @@ -19,7 +19,7 @@ use Modern::Perl; -use Test::More tests => 1; +use Test::More tests => 2; use t::lib::TestBuilder; @@ -42,3 +42,20 @@ subtest 'to_api() tests' => sub { $schema->storage->txn_rollback; }; + +subtest 'budget' => sub { + plan tests => 1; + + $schema->storage->txn_begin; + my $f = $builder->build_object( + { + class => 'Koha::Acquisition::Funds', + } + ); + + my $fund = Koha::Acquisition::Funds->find( $f->budget_id ); + is( ref( $fund->budget ), + 'Koha::Acquisition::Budget', + '->fund should return a Koha::Acquisition::Budget object' ); + $schema->storage->txn_rollback; +}; --