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

(-)a/Koha/Acquisition/Order.pm (+15 lines)
Lines 20-25 use Modern::Perl; Link Here
20
use Carp qw( croak );
20
use Carp qw( croak );
21
21
22
use Koha::Acquisition::Baskets;
22
use Koha::Acquisition::Baskets;
23
use Koha::Acquisition::Funds;
23
use Koha::Database;
24
use Koha::Database;
24
use Koha::DateUtils qw( dt_from_string output_pref );
25
use Koha::DateUtils qw( dt_from_string output_pref );
25
26
Lines 120-125 sub basket { Link Here
120
    return Koha::Acquisition::Basket->_new_from_dbic( $basket_rs );
121
    return Koha::Acquisition::Basket->_new_from_dbic( $basket_rs );
121
}
122
}
122
123
124
=head3 fund
125
126
    my $fund = $order->fund
127
128
Returns the fund (aqbudgets) associated to the order.
129
130
=cut
131
132
sub fund {
133
    my ( $self )  = @_;
134
    my $fund_rs = $self->_result->budget;
135
    return Koha::Acquisition::Fund->_new_from_dbic( $fund_rs );
136
}
137
123
=head2 Internal methods
138
=head2 Internal methods
124
139
125
=head3 _type
140
=head3 _type
(-)a/t/db_dependent/Koha/Acquisition/Order.t (-2 / +18 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 2;
22
use Test::More tests => 3;
23
23
24
use t::lib::TestBuilder;
24
use t::lib::TestBuilder;
25
use t::lib::Mocks;
25
use t::lib::Mocks;
Lines 97-99 subtest 'store' => sub { Link Here
97
    };
97
    };
98
    $schema->storage->txn_rollback;
98
    $schema->storage->txn_rollback;
99
};
99
};
100
- 
100
101
subtest 'fund' => sub {
102
    plan tests => 1;
103
104
    $schema->storage->txn_begin;
105
    my $o = $builder->build_object(
106
        {
107
            class => 'Koha::Acquisition::Orders',
108
        }
109
    );
110
111
    my $order = Koha::Acquisition::Orders->find( $o->ordernumber );
112
    is( ref( $order->fund ),
113
        'Koha::Acquisition::Fund',
114
        '->fund should return a Koha::Acquisition::Fund object' );
115
    $schema->storage->txn_rollback;
116
};

Return to bug 20726