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

(-)a/C4/Budgets.pm (-3 / +5 lines)
Lines 82-88 BEGIN { Link Here
82
82
83
# ----------------------------BUDGETS.PM-----------------------------";
83
# ----------------------------BUDGETS.PM-----------------------------";
84
84
85
86
=head1 FUNCTIONS ABOUT BUDGETS
85
=head1 FUNCTIONS ABOUT BUDGETS
87
86
88
=cut
87
=cut
Lines 463-468 sub GetBudgetPeriod { Link Here
463
}
462
}
464
463
465
# -------------------------------------------------------------------
464
# -------------------------------------------------------------------
465
466
=head2 GetBudgetPeriodDescription
466
=head2 GetBudgetPeriodDescription
467
467
468
       $description = GetBudgetPeriodDescription($budget_id);
468
       $description = GetBudgetPeriodDescription($budget_id);
Lines 474-479 sub GetBudgetPeriod { Link Here
474
    Description is fetched from aqbudgetperiods, id is compared aqbudgets. (INNER JOIN on budget_period_id)
474
    Description is fetched from aqbudgetperiods, id is compared aqbudgets. (INNER JOIN on budget_period_id)
475
475
476
=cut
476
=cut
477
477
sub GetBudgetPeriodDescription {
478
sub GetBudgetPeriodDescription {
478
    my ($budget_id) = @_;
479
    my ($budget_id) = @_;
479
    my $dbh = C4::Context->dbh;
480
    my $dbh = C4::Context->dbh;
Lines 638-643 sub DelBudget { Link Here
638
639
639
640
640
# -------------------------------------------------------------------
641
# -------------------------------------------------------------------
642
641
=head2 GetBudget
643
=head2 GetBudget
642
644
643
  &GetBudget($budget_id);
645
  &GetBudget($budget_id);
Lines 750-755 sub GetBudgetsByActivity { Link Here
750
    return @results;
752
    return @results;
751
}
753
}
752
# --------------------------------------------------------------------
754
# --------------------------------------------------------------------
755
753
=head2 GetBudgetsReport
756
=head2 GetBudgetsReport
754
757
755
  &GetBudgetsReport( [$activity] );
758
  &GetBudgetsReport( [$activity] );
Lines 1151-1157 sub ConvertCurrency { Link Here
1151
    return ( $price / $cur );
1154
    return ( $price / $cur );
1152
}
1155
}
1153
1156
1154
1155
=head2 CloneBudgetPeriod
1157
=head2 CloneBudgetPeriod
1156
1158
1157
  my $new_budget_period_id = CloneBudgetPeriod({
1159
  my $new_budget_period_id = CloneBudgetPeriod({
Lines 1383-1386 __END__ Link Here
1383
1385
1384
Koha Development Team <http://koha-community.org/>
1386
Koha Development Team <http://koha-community.org/>
1385
1387
1386
=cut
1388
=cut
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/orders_by_budget.tt (-5 / +27 lines)
Lines 6-12 Link Here
6
[% INCLUDE 'header.inc' %]
6
[% INCLUDE 'header.inc' %]
7
[% INCLUDE 'cat-search.inc' %]
7
[% INCLUDE 'cat-search.inc' %]
8
8
9
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>[% IF ( get_orders ) %] &rsaquo; <a href="/cgi-bin/koha/reports/orders_by_budget.pl">Orders by fund</a> &rsaquo; Results[% ELSE %] &rsaquo; Orders by fund[% END %]</div>
9
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
10
[% INCLUDE 'datatables.inc' %]
11
<script type="text/javascript">
12
    $(document).ready( function () {
13
        $('#funds').DataTable($.extend(true, {}, dataTablesDefaults,{"sPaginationType": "full_numbers"}));
14
    } );
15
</script>
16
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>[% IF ( get_orders ) %] &rsaquo; <a href="/cgi-bin/koha/reports/orders_by_fund.pl">Orders by fund</a> &rsaquo; Results[% ELSE %] &rsaquo; Orders by fund[% END %]</div>
10
17
11
<div id="doc3" class="yui-t2">
18
<div id="doc3" class="yui-t2">
12
19
Lines 29-38 Link Here
29
    [% END %]
36
    [% END %]
30
</div>
37
</div>
31
38
32
    [% IF ( ordersloop ) %]<table>
39
    [% IF ( ordersloop ) %]<table id="funds">
40
    <thead>
33
    <tr>
41
    <tr>
34
        <th>Fund</th>
42
        <th>Fund</th>
35
        <th>Basket</th>
43
        <th>Basket</th>
44
        <th>Basket Name</th>
36
        <th>Basket By</th>
45
        <th>Basket By</th>
37
        <th>Title</th>
46
        <th>Title</th>
38
        <th>Currency</th>
47
        <th>Currency</th>
Lines 46-51 Link Here
46
        <th>Date Received</th>
55
        <th>Date Received</th>
47
        <th>Notes</th>
56
        <th>Notes</th>
48
    </tr>
57
    </tr>
58
    </thead>
59
    <tbody>
49
     [% FOREACH ordersloo IN ordersloop %]
60
     [% FOREACH ordersloo IN ordersloop %]
50
        [% UNLESS ( loop.odd ) %]
61
        [% UNLESS ( loop.odd ) %]
51
        <tr class="highlight">
62
        <tr class="highlight">
Lines 56-61 Link Here
56
            <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% ordersloo.basketno %]">
67
            <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% ordersloo.basketno %]">
57
                [% ordersloo.basketno |html %]
68
                [% ordersloo.basketno |html %]
58
            </a></td>
69
            </a></td>
70
            <td>[% ordersloo.basketname |html %]</td>
59
        <td>[% ordersloo.authorisedbyname %]</td>
71
        <td>[% ordersloo.authorisedbyname %]</td>
60
            <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% ordersloo.biblionumber %]">
72
            <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% ordersloo.biblionumber %]">
61
            [% ordersloo.title |html %]
73
            [% ordersloo.title |html %]
Lines 72-83 Link Here
72
            <td>[% ordersloo.notes |html %]</td>
84
            <td>[% ordersloo.notes |html %]</td>
73
        </tr>
85
        </tr>
74
    [% END %]
86
    [% END %]
75
    <tr><th>TOTAL</th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th>[% total_quantity %]</th><th>[% total_rrp %]</th><th>[% total_ecost %]</th><th></th><th></th><th></th></tr>
87
    </tbody>
88
    <tfoot>
89
    <tr><th>TOTAL</th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th></th><th>[% total_quantity %]</th><th>[% total_rrp %]</th><th>[% total_ecost %]</th><th></th><th></th><th></th></tr>
90
    </tfoot>
76
    </table>
91
    </table>
77
    [% END %]
92
    [% END %]
78
    [% ELSE %]
93
    [% ELSE %]
79
94
80
    <form name="f" action="/cgi-bin/koha/reports/orders_by_budget.pl" method="post">
95
    <form name="f" action="/cgi-bin/koha/reports/orders_by_fund.pl" method="post">
81
<fieldset class="rows">
96
<fieldset class="rows">
82
    <legend>Filters</legend>
97
    <legend>Filters</legend>
83
    <ol><li><label for="budgetfilter">Fund (Budget): </label><select name="budgetfilter" id="budgetfilter">
98
    <ol><li><label for="budgetfilter">Fund (Budget): </label><select name="budgetfilter" id="budgetfilter">
Lines 104-110 Link Here
104
    </select>
119
    </select>
105
    <select id='sep' name='sep' size='1'>
120
    <select id='sep' name='sep' size='1'>
106
    [% FOREACH delimiterloo IN delimiterloop %]
121
    [% FOREACH delimiterloo IN delimiterloop %]
107
        <option value="[% delimiterloo %]">[% delimiterloo %]</option>
122
        [% IF delimiterloo == delimiterPreference %]
123
            <option value="[% delimiterloo %]">[% delimiterloo %]</option>
124
        [% END %]
125
    [% END %]
126
    [% FOREACH delimiterloo IN delimiterloop %]
127
        [% IF delimiterloo != delimiterPreference %]
128
            <option value="[% delimiterloo %]">[% delimiterloo %]</option>
129
            [% END %]
108
    [% END %]
130
    [% END %]
109
    </select>
131
    </select>
110
    </li></ol>
132
    </li></ol>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt (-1 / +1 lines)
Lines 61-67 Link Here
61
    <h2>Other</h2>
61
    <h2>Other</h2>
62
    <ul>
62
    <ul>
63
        <li><a href="/cgi-bin/koha/reports/itemslost.pl">Items lost</a></li>
63
        <li><a href="/cgi-bin/koha/reports/itemslost.pl">Items lost</a></li>
64
                <li><a href="/cgi-bin/koha/reports/orders_by_budget.pl">Orders by fund</a></li>
64
                <li><a href="/cgi-bin/koha/reports/orders_by_fund.pl">Orders by fund</a></li>
65
        <li><a href="/cgi-bin/koha/reports/manager.pl?report_name=itemtypes">Catalog by itemtype</a></li>
65
        <li><a href="/cgi-bin/koha/reports/manager.pl?report_name=itemtypes">Catalog by itemtype</a></li>
66
        <li><a href="/cgi-bin/koha/reports/issues_avg_stats.pl">Average loan time</a></li>
66
        <li><a href="/cgi-bin/koha/reports/issues_avg_stats.pl">Average loan time</a></li>
67
                <li><a href="http://schema.koha-community.org/" target="blank">Koha database schema</a></li>
67
                <li><a href="http://schema.koha-community.org/" target="blank">Koha database schema</a></li>
(-)a/reports/orders_by_budget.pl (-4 / +5 lines)
Lines 35-41 use C4::Budgets; Link Here
35
use C4::Biblio;
35
use C4::Biblio;
36
use C4::Reports;
36
use C4::Reports;
37
use C4::Dates qw/format_date/;
37
use C4::Dates qw/format_date/;
38
use C4::SQLHelper qw<:all>;
39
use C4::Acquisition; #GetBasket()
38
use C4::Acquisition; #GetBasket()
40
39
41
40
Lines 103-108 if ( $get_orders ) { Link Here
103
        my $biblio = C4::Biblio::GetBiblio($order->{'biblionumber'});
102
        my $biblio = C4::Biblio::GetBiblio($order->{'biblionumber'});
104
        my $basket = C4::Acquisition::GetBasket($order->{'basketno'});
103
        my $basket = C4::Acquisition::GetBasket($order->{'basketno'});
105
104
105
        $order->{'basketname'} = $basket->{'basketname'};
106
        $order->{'authorisedbyname'} = $basket->{'authorisedbyname'};
106
        $order->{'authorisedbyname'} = $basket->{'authorisedbyname'};
107
107
108
        $order->{'title'} = $biblio->{'title'} || $order->{'biblionumber'};
108
        $order->{'title'} = $biblio->{'title'} || $order->{'biblionumber'};
Lines 164-169 if ( $get_orders ) { Link Here
164
            my @row;
164
            my @row;
165
            push(@row, _surround($order->{'budget_name'}));
165
            push(@row, _surround($order->{'budget_name'}));
166
            push(@row, _surround($order->{'basketno'}));
166
            push(@row, _surround($order->{'basketno'}));
167
            push(@row, _surround($order->{'basketname'}));
167
            push(@row, _surround($order->{'authorisedbyname'}));
168
            push(@row, _surround($order->{'authorisedbyname'}));
168
            push(@row, _surround($order->{'biblionumber'}));
169
            push(@row, _surround($order->{'biblionumber'}));
169
            push(@row, _surround($order->{'title'}));
170
            push(@row, _surround($order->{'title'}));
Lines 196-202 if ( $get_orders ) { Link Here
196
else {
197
else {
197
    # Set file export choices
198
    # Set file export choices
198
    my @outputFormats = ('CSV');
199
    my @outputFormats = ('CSV');
199
    my @CSVdelimiters = qw(; tabulation , \\ / #);
200
    my @CSVdelimiters =(',','#',qw(; tabulation \\ /));
200
201
201
    # getting all budgets
202
    # getting all budgets
202
    # active budgets
203
    # active budgets
Lines 222-231 else { Link Here
222
        );
223
        );
223
        push @budgetsloop, \%row;
224
        push @budgetsloop, \%row;
224
    }
225
    }
225
226
    $template->param(   budgetsloop   => \@budgetsloop,
226
    $template->param(   budgetsloop   => \@budgetsloop,
227
        outputFormatloop => \@outputFormats,
227
        outputFormatloop => \@outputFormats,
228
        delimiterloop => \@CSVdelimiters
228
        delimiterloop => \@CSVdelimiters,
229
        delimiterPreference => C4::Context->preference('delimiter')
229
    );
230
    );
230
}
231
}
231
232
(-)a/t/db_dependent/Budgets.t (-7 / +3 lines)
Lines 1-3 Link Here
1
#!/usr/bin/perl
1
use Modern::Perl;
2
use Modern::Perl;
2
use Test::More tests => 120;
3
use Test::More tests => 120;
3
4
Lines 432-454 ok($bpid=AddBudgetPeriod( Link Here
432
            { budget_period_startdate   =>'01-01-2008'
433
            { budget_period_startdate   =>'01-01-2008'
433
            , budget_period_enddate     =>'31-12-2008'
434
            , budget_period_enddate     =>'31-12-2008'
434
            , budget_period_description =>"MAPERI"
435
            , budget_period_description =>"MAPERI"
435
            , budget_period_active      =>1
436
            , budget_period_active      =>1}),
436
            , budget_description        =>"MAPERI"}),
437
    "AddBudgetPeriod returned $bpid");
437
    "AddBudgetPeriod returned $bpid");
438
} elsif (C4::Context->preference('dateformat') eq "us"){
438
} elsif (C4::Context->preference('dateformat') eq "us"){
439
ok($bpid=AddBudgetPeriod(
439
ok($bpid=AddBudgetPeriod(
440
            { budget_period_startdate   =>'01-01-2008'
440
            { budget_period_startdate   =>'01-01-2008'
441
            , budget_period_enddate     =>'12-31-2008'
441
            , budget_period_enddate     =>'12-31-2008'
442
            , budget_period_description =>"MAPERI"
442
            , budget_period_description =>"MAPERI"
443
            , budget_period_active      =>1
443
            , budget_period_active      =>1}),
444
            , budget_description        =>"MAPERI"}),
445
    "AddBudgetPeriod returned $bpid");
444
    "AddBudgetPeriod returned $bpid");
446
}
445
}
447
else{
446
else{
448
ok($bpid=AddBudgetPeriod(
447
ok($bpid=AddBudgetPeriod(
449
            {budget_period_startdate=>'2008-01-01'
448
            {budget_period_startdate=>'2008-01-01'
450
            ,budget_period_enddate  =>'2008-12-31'
449
            ,budget_period_enddate  =>'2008-12-31'
451
            ,budget_description     =>"MAPERI"
452
            ,budget_period_active   =>1
450
            ,budget_period_active   =>1
453
            ,budget_period_description  =>"MAPERI"
451
            ,budget_period_description  =>"MAPERI"
454
            }),
452
            }),
Lines 497-503 ok($second_budget_id=AddBudget( Link Here
497
                            budget_amount       => "500.00",
495
                            budget_amount       => "500.00",
498
                            budget_name     => "Art",
496
                            budget_name     => "Art",
499
                            budget_notes        => "This is a note",
497
                            budget_notes        => "This is a note",
500
                            budget_description=> "Art",
501
                            budget_active       => 1,
498
                            budget_active       => 1,
502
                            budget_period_id    => $bpid,
499
                            budget_period_id    => $bpid,
503
                        }
500
                        }
504
- 

Return to bug 11371