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 113-118 sub basket { Link Here
113
    return Koha::Acquisition::Basket->_new_from_dbic( $basket_rs );
114
    return Koha::Acquisition::Basket->_new_from_dbic( $basket_rs );
114
}
115
}
115
116
117
=head3 fund
118
119
    my $fund = $order->fund
120
121
Returns the fund (aqbudgets) associated to the order.
122
123
=cut
124
125
sub fund {
126
    my ( $self )  = @_;
127
    my $fund_rs = $self->_result->budget;
128
    return Koha::Acquisition::Fund->_new_from_dbic( $fund_rs );
129
}
130
116
=head2 Internal methods
131
=head2 Internal methods
117
132
118
=head3 _type
133
=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