Browse Source

Bug 15329: Add new column for budget to the late orders table

The table currently displays the fund, but as late orders can be
from a past budget with the same fund names, this can be confusing.
So adding the budget in addition to the fund will be helpful.

To test:
- 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

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Katrin Fischer 1 year ago
committed by Jonathan Druart
parent
commit
ee028855c2
  1. 16
      Koha/Acquisition/Fund.pm
  2. 2
      admin/columns_settings.yml
  3. 5
      koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt
  4. 19
      t/db_dependent/Koha/Acquisition/Fund.t

16
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<Koha::Acquisition::Budget> 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;

2
admin/columns_settings.yml

@ -59,6 +59,8 @@ modules:
columnname: basket_group
-
columnname: library
-
columnname: budget
-
columnname: fund
-

5
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt

@ -67,6 +67,7 @@
<th>Basket</th>
<th>Basket group</th>
<th>Library</th>
<th>Budget</th>
<th>Fund</th>
<th>Claims count</th>
<th class="title-string">Claimed date</th>
@ -131,8 +132,8 @@
</td>
<td>[% Branches.GetName( lateorder.basket.authorizer.branchcode ) | html %]
</td>
<td>[% lateorder.fund.budget_name | html %]
</td>
<td>[% lateorder.fund.budget.budget_period_description | html %]</td>
<td>[% lateorder.fund.budget_name | html %]</td>
<td>[% lateorder.claims.count | html %]</td>
<td>
[% FOR claim IN lateorder.claims %]

19
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;
};

Loading…
Cancel
Save