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

(-)a/C4/Budgets.pm (+2 lines)
Lines 713-718 sub GetBudgetByCode { Link Here
713
        SELECT *
713
        SELECT *
714
        FROM aqbudgets
714
        FROM aqbudgets
715
        WHERE budget_code = ?
715
        WHERE budget_code = ?
716
        ORDER BY budget_id DESC
717
        LIMIT 1
716
    };
718
    };
717
    my $sth = $dbh->prepare( $query );
719
    my $sth = $dbh->prepare( $query );
718
    $sth->execute( $budget_code );
720
    $sth->execute( $budget_code );
(-)a/t/db_dependent/Budgets.t (-2 / +7 lines)
Lines 1-6 Link Here
1
use strict;
1
use strict;
2
use warnings;
2
use warnings;
3
use Test::More tests=>20;
3
use Test::More tests => 22;
4
4
5
BEGIN {use_ok('C4::Budgets') }
5
BEGIN {use_ok('C4::Budgets') }
6
use C4::Dates;
6
use C4::Dates;
Lines 94-99 ok($budget_id=AddBudget( Link Here
94
94
95
my $budget;
95
my $budget;
96
ok($budget=GetBudget($budget_id) ,"GetBudget OK");
96
ok($budget=GetBudget($budget_id) ,"GetBudget OK");
97
$budget_id = $budget->{budget_id};
97
$$budget{budget_permission}=1;
98
$$budget{budget_permission}=1;
98
ok($mod_status=ModBudget($budget),"ModBudget OK");
99
ok($mod_status=ModBudget($budget),"ModBudget OK");
99
ok(GetBudgets()>0,
100
ok(GetBudgets()>0,
Lines 109-114 ok(GetBudgets({budget_period_id=>GetBudgetPeriod($bpid)->{budget_period_id}},[{" Link Here
109
my $budget_name = GetBudgetName( $budget_id );
110
my $budget_name = GetBudgetName( $budget_id );
110
is($budget_name, $budget->{budget_name}, "Test the GetBudgetName routine");
111
is($budget_name, $budget->{budget_name}, "Test the GetBudgetName routine");
111
112
113
my $budget_code = $budget->{budget_code};
114
my $budget_by_code = GetBudgetByCode( $budget_code );
115
is($budget_by_code->{budget_id}, $budget_id, "GetBudgetByCode, check id");
116
is($budget_by_code->{budget_notes}, 'This is a note', "GetBudgetByCode, check notes");
117
112
my $second_budget_id;
118
my $second_budget_id;
113
ok($second_budget_id=AddBudget(
119
ok($second_budget_id=AddBudget(
114
                        {   budget_code         => "ZZZZ",
120
                        {   budget_code         => "ZZZZ",
115
- 

Return to bug 7180