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

(-)a/C4/Budgets.pm (-1 / +1 lines)
Lines 498-504 sub GetBudgetHierarchy { Link Here
498
    my @bind_params;
498
    my @bind_params;
499
    my $dbh   = C4::Context->dbh;
499
    my $dbh   = C4::Context->dbh;
500
    my $query = qq|
500
    my $query = qq|
501
                    SELECT aqbudgets.*, aqbudgetperiods.budget_period_active
501
                    SELECT aqbudgets.*, aqbudgetperiods.budget_period_active, aqbudgetperiods.budget_period_description
502
                    FROM aqbudgets 
502
                    FROM aqbudgets 
503
                    JOIN aqbudgetperiods USING (budget_period_id)|;
503
                    JOIN aqbudgetperiods USING (budget_period_id)|;
504
                        
504
                        
(-)a/admin/aqbudgets.pl (-53 / +45 lines)
Lines 36-48 use C4::Context; Link Here
36
use C4::Output;
36
use C4::Output;
37
use C4::Koha;
37
use C4::Koha;
38
use C4::Debug;
38
use C4::Debug;
39
#use POSIX qw(locale_h);
40
39
41
my $input = new CGI;
40
my $input = new CGI;
42
my $dbh     = C4::Context->dbh;
41
my $dbh     = C4::Context->dbh;
43
42
44
my ($template, $borrowernumber, $cookie, $staffflags ) = get_template_and_user(
43
my ($template, $borrowernumber, $cookie, $staffflags ) = get_template_and_user(
45
    {   template_name   => "admin/aqbudgets.tmpl",
44
    {   template_name   => "admin/aqbudgets.tt",
46
        query           => $input,
45
        query           => $input,
47
        type            => "intranet",
46
        type            => "intranet",
48
        authnotrequired => 0,
47
        authnotrequired => 0,
Lines 56-95 $template->param( symbol => $cur->{symbol}, Link Here
56
                  currency => $cur->{currency}
55
                  currency => $cur->{currency}
57
               );
56
               );
58
57
59
my $op = $input->param('op') // '';
58
my $op = $input->param('op') || 'list';
60
59
61
# see if the user want to see all budgets or only owned ones
60
# see if the user want to see all budgets or only owned ones by default
62
my $show_mine    = 1; #SHOW BY DEFAULT
61
my $show_mine = $input->param('show_mine') // 1;
63
my $show         = $input->param('show') // 0; # SET TO 1, BY A FORM SUMBIT
64
$show_mine       = $input->param('show_mine') if $show == 1;
65
62
66
# IF USER DOESNT HAVE PERM FOR AN 'ADD', THEN REDIRECT TO THE DEFAULT VIEW...
63
# IF USER DOESNT HAVE PERM FOR AN 'ADD', THEN REDIRECT TO THE DEFAULT VIEW...
67
if (not defined $template->{VARS}->{'CAN_user_acquisition_budget_add_del'}
64
if (not defined $template->{VARS}->{'CAN_user_acquisition_budget_add_del'}
68
    and $op eq 'add_form')
65
    and $op eq 'add_form')
69
{
66
{
70
    $op = '';
67
    $op = 'list';
71
}
68
}
72
my $num=FormatNumber;
69
my $num=FormatNumber;
73
70
74
my $script_name               = "/cgi-bin/koha/admin/aqbudgets.pl";
75
my $budget_hash               = $input->Vars;
71
my $budget_hash               = $input->Vars;
76
my $budget_id                 = $$budget_hash{budget_id};
72
my $budget_id                 = $$budget_hash{budget_id};
73
my $budget_period_id          = $input->param('budget_period_id');
77
my $budget_permission         = $input->param('budget_permission');
74
my $budget_permission         = $input->param('budget_permission');
78
my $filter_budgetbranch       = $input->param('filter_budgetbranch') // '';
75
my $filter_budgetbranch       = $input->param('filter_budgetbranch') // '';
79
my $filter_budgetname         = $input->param('filter_budgetname');
76
my $filter_budgetname         = $input->param('filter_budgetname');
80
#filtering non budget keys
77
#filtering non budget keys
81
delete $$budget_hash{$_} foreach grep {/filter|^op$|show/} keys %$budget_hash;
78
delete $$budget_hash{$_} foreach grep {/filter|^op$|show/} keys %$budget_hash;
82
79
83
$template->param(
84
    notree => ($filter_budgetbranch or $show_mine)
85
);
86
# ' ------- get periods stuff ------------------'
80
# ' ------- get periods stuff ------------------'
87
# IF PERIODID IS DEFINED,  GET THE PERIOD - ELSE JUST GET THE ACTIVE PERIOD BY DEFAULT
81
# IF PERIODID IS DEFINED,  GET THE PERIOD - ELSE JUST GET THE ACTIVE PERIOD BY DEFAULT
88
my $period = GetBudgetPeriod($$budget_hash{budget_period_id});
82
my $period;
83
if ( $budget_period_id ) {
84
    $period = GetBudgetPeriod( $budget_period_id );
85
}
89
86
90
$template->param(
91
	%$period
92
);
93
# ------- get periods stuff ------------------
87
# ------- get periods stuff ------------------
94
88
95
# USED FOR PERMISSION COMPARISON LATER
89
# USED FOR PERMISSION COMPARISON LATER
Lines 98-110 my $user = GetMemberDetails($borrower_id); Link Here
98
my $user_branchcode     = $user->{'branchcode'};
92
my $user_branchcode     = $user->{'branchcode'};
99
93
100
$template->param(
94
$template->param(
101
    action      => $script_name,
102
    script_name => $script_name,
103
    show_mine   => $show_mine,
95
    show_mine   => $show_mine,
104
    $op || else => 1,
96
    op  => $op,
105
);
97
);
106
98
107
108
# retrieve branches
99
# retrieve branches
109
my ( $budget, );
100
my ( $budget, );
110
101
Lines 119-125 foreach my $thisbranch (keys %$branches) { Link Here
119
    push @branchloop2, \%row;
110
    push @branchloop2, \%row;
120
}
111
}
121
112
122
$template->param(auth_cats_loop => GetBudgetAuthCats($$period{budget_period_id}) );
113
$template->param(auth_cats_loop => GetBudgetAuthCats( $budget_period_id ))
114
    if $budget_period_id;
123
115
124
# Used to create form to add or  modify a record
116
# Used to create form to add or  modify a record
125
if ($op eq 'add_form') {
117
if ($op eq 'add_form') {
Lines 216-222 if ($op eq 'add_form') { Link Here
216
208
217
    # if no buget_id is passed then its an add
209
    # if no buget_id is passed then its an add
218
    $template->param(
210
    $template->param(
219
        add_validate                  => 1,
220
        budget_parent_id    		  => $budget_parent->{'budget_id'},
211
        budget_parent_id    		  => $budget_parent->{'budget_id'},
221
        budget_parent_name    		  => $budget_parent->{'budget_name'},
212
        budget_parent_name    		  => $budget_parent->{'budget_name'},
222
        branchloop_select         => \@branchloop_select,
213
        branchloop_select         => \@branchloop_select,
Lines 238-270 if ($op eq 'add_form') { Link Here
238
    );
229
    );
239
                                                    # END $OP eq DELETE_CONFIRM
230
                                                    # END $OP eq DELETE_CONFIRM
240
# called by delete_confirm, used to effectively confirm deletion of data in DB
231
# called by delete_confirm, used to effectively confirm deletion of data in DB
241
}  else{
232
} elsif ( $op eq 'delete_confirmed' ) {
242
    if ( $op eq 'delete_confirmed' ) {
233
    my $rc = DelBudget($budget_id);
243
        my $rc = DelBudget($budget_id);
234
    $op = 'list';
244
    }elsif( $op eq 'add_validate' ) {
235
} elsif( $op eq 'add_validate' ) {
245
        my @budgetusersid;
236
    my @budgetusersid;
246
        if (defined $$budget_hash{'budget_users_ids'}){
237
    if (defined $$budget_hash{'budget_users_ids'}){
247
            @budgetusersid = split(':', $budget_hash->{'budget_users_ids'});
238
        @budgetusersid = split(':', $budget_hash->{'budget_users_ids'});
248
        }
239
    }
249
240
250
        if ( defined $$budget_hash{budget_id} ) {
241
    if ( defined $$budget_hash{budget_id} ) {
251
            if (CanUserModifyBudget($borrowernumber, $budget_hash->{budget_id},
242
        if (CanUserModifyBudget($borrowernumber, $budget_hash->{budget_id},
252
                $staffflags)
243
            $staffflags)
253
            ) {
244
        ) {
254
                ModBudget( $budget_hash );
245
            ModBudget( $budget_hash );
255
                ModBudgetUsers($budget_hash->{budget_id}, @budgetusersid);
256
            }
257
            else {
258
                $template->param(error_not_authorised_to_modify => 1);
259
            }
260
        } else {
261
            AddBudget( $budget_hash );
262
            ModBudgetUsers($budget_hash->{budget_id}, @budgetusersid);
246
            ModBudgetUsers($budget_hash->{budget_id}, @budgetusersid);
263
        }
247
        }
248
        else {
249
            $template->param(error_not_authorised_to_modify => 1);
250
        }
251
    } else {
252
        AddBudget( $budget_hash );
253
        ModBudgetUsers($budget_hash->{budget_id}, @budgetusersid);
264
    }
254
    }
255
    $op = 'list';
256
}
257
258
if ( $op eq 'list' ) {
265
    my $branches = GetBranches();
259
    my $branches = GetBranches();
266
    $template->param(
260
    $template->param(
267
        budget_id                 => $budget_id,
261
        budget_id => $budget_id,
268
        %$period,
262
        %$period,
269
    );
263
    );
270
264
Lines 273-280 if ($op eq 'add_form') { Link Here
273
            C4::Context->userenv->{branchcode}, $show_mine ? $borrower_id : '')
267
            C4::Context->userenv->{branchcode}, $show_mine ? $borrower_id : '')
274
    };
268
    };
275
269
276
    my $toggle = 0;
277
    my @loop;
278
    my $period_total = 0;
270
    my $period_total = 0;
279
    my ($period_alloc_total, $spent_total, $ordered_total, $available_total) = (0,0,0,0);
271
    my ($period_alloc_total, $spent_total, $ordered_total, $available_total) = (0,0,0,0);
280
272
Lines 344-354 if ($op eq 'add_form') { Link Here
344
        push  @budget_hierarchy, { element_name => $period->{"budget_period_description"} };
336
        push  @budget_hierarchy, { element_name => $period->{"budget_period_description"} };
345
        @budget_hierarchy = reverse(@budget_hierarchy);
337
        @budget_hierarchy = reverse(@budget_hierarchy);
346
338
347
        push( @loop, {  %{$budget},
339
        $budget->{branchname} = $branches->{ $budget->{branchcode} }->{branchname};
348
                        branchname  => $branches->{ $budget->{branchcode} }->{branchname},
340
        $budget->{budget_hierarchy} = \@budget_hierarchy;
349
                        budget_hierarchy => \@budget_hierarchy,
350
                    }
351
        );
352
    }
341
    }
353
342
354
    my $budget_period_total = $period->{budget_period_total};
343
    my $budget_period_total = $period->{budget_period_total};
Lines 357-365 if ($op eq 'add_form') { Link Here
357
        $_ = $num->format_price($_);
346
        $_ = $num->format_price($_);
358
    }
347
    }
359
348
349
    my $periods = GetBudgetPeriods();
350
360
    $template->param(
351
    $template->param(
361
        else                   => 1,
352
        op                     => 'list',
362
        budget                 => \@loop,
353
        budgets                => \@budgets,
354
        periods                => $periods,
363
        budget_period_total    => $budget_period_total,
355
        budget_period_total    => $budget_period_total,
364
        period_alloc_total     => $period_alloc_total,
356
        period_alloc_total     => $period_alloc_total,
365
        spent_total            => $spent_total,
357
        spent_total            => $spent_total,
Lines 368-373 if ($op eq 'add_form') { Link Here
368
        branchloop             => \@branchloop2,
360
        branchloop             => \@branchloop2,
369
    );
361
    );
370
362
371
} #---- END $OP eq DEFAULT
363
} #---- END list
372
364
373
output_html_with_http_headers $input, $cookie, $template->output;
365
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt (-111 / +128 lines)
Lines 1-5 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Administration &rsaquo; Funds[% IF ( add_form ) %] &rsaquo; [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund [% END %][% END %]</title>
2
<title>Koha &rsaquo; Administration &rsaquo; Funds[% IF op == 'add_form' %] &rsaquo; [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund [% END %][% END %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
3
[% INCLUDE 'doc-head-close.inc' %]
4
<script type="text/javascript">
4
<script type="text/javascript">
5
//<![CDATA[
5
//<![CDATA[
Lines 10-17 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
10
</script>
10
</script>
11
11
12
<script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
12
<script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
13
13
[% IF op == 'add_form' %]
14
[% IF ( add_form ) %]
15
<script type="text/javascript">
14
<script type="text/javascript">
16
//<![CDATA[
15
//<![CDATA[
17
16
Lines 143-200 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
143
    }
142
    }
144
//]]>
143
//]]>
145
</script>
144
</script>
146
[% ELSE %]
145
[% ELSIF op == 'list' %]
147
    [% IF ( notree ) %]
146
    <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
148
        <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
147
    [% INCLUDE 'datatables.inc' %]
149
        [% INCLUDE 'datatables.inc' %]
148
    <link href="[% interface %]/lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css" rel="stylesheet" type="text/css" />
150
    [% ELSE %]
149
    <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/treetable/jquery.treetable.js"></script>
151
        <link href="[% themelang %]/lib/jquery/plugins/treetable/stylesheets/jquery.treeTable.css" rel="stylesheet" type="text/css" />
152
        <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/treetable/jquery.treeTable.min.js"></script>
153
    [% END %]
154
155
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.qtip.js"></script>
156
150
157
<script type="text/javascript">
151
<script type="text/javascript">
158
//<![CDATA[
152
//<![CDATA[
159
    //
153
    //
160
    $(document).ready(function() {
154
    $(document).ready(function() {
161
        var tooltipcontent = $(".tooltipcontent");
155
        var oTable = $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
162
        tooltipcontent.hide();
156
            "fnDrawCallback": function ( oSettings ) {
163
157
                if ( oSettings.aiDisplay.length == 0 )
164
        $(".tooltiped td").each(function (){
158
                {
165
            contentelem = $(this).parent().children().filter(".tooltipcontent");
159
                    return;
166
            if(contentelem.html() != ""){
160
                }
167
            $(this).qtip({
161
168
                content: contentelem.html(),
162
                var nTrs = $('#budgeth tbody tr');
169
                show: "mouseover",
163
                var iColspan = nTrs[0].getElementsByTagName('td').length;
170
                hide: "mouseout",
164
                var sLastGroup = "";
171
                style: {
165
                for ( var i=0 ; i<nTrs.length ; i++ )
172
                    name: "light",
166
                {
173
                    tip: "bottomLeft",
167
                    var iDisplayIndex = oSettings._iDisplayStart + i;
174
                    border: {
168
                    var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0];
175
                        radius: 5,
169
                    if ( sGroup != sLastGroup )
176
                        color: "#356CA1"
170
                    {
177
                    }
171
                        var nGroup = document.createElement( 'tr' );
178
                },
172
                        var nCell = document.createElement( 'td' );
179
                position: {
173
                        nCell.colSpan = iColspan;
180
                    corner: {
174
                        nCell.className = "group";
181
                        target: "topRight",
175
                        nCell.innerHTML = sGroup;
182
                        tooltip: "bottomRight"
176
                        nGroup.appendChild( nCell );
177
                        nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
178
                        sLastGroup = sGroup;
183
                    }
179
                    }
184
                }
180
                }
185
            });
181
            },
186
            }
182
            "aoColumnDefs": [
183
                { "bVisible": false, "aTargets": [ 0 ] }
184
            ],
185
            "aaSortingFixed": [[ 0, 'asc' ]],
186
            "aaSorting": [[ 1, 'asc' ]],
187
            'bSort': false,
188
            'bPaginate': false,
189
            "bAutoWidth": false
190
        }));
191
192
        $(oTable).treetable({
193
            expandable: true
194
        });
195
        $(oTable).treetable('expandAll');
196
        $("#expand_all").click(function(e){
197
            e.preventDefault();
198
            $(oTable).treetable('expandAll');
199
        });
200
        $("#collapse_all").click(function(e){
201
            e.preventDefault();
202
            $(oTable).treetable('collapseAll');
187
        });
203
        });
188
        [% IF ( notree ) %]
189
            $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
190
                "aoColumnDefs": [
191
                    { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
192
                ],
193
                "sPaginationType": "four_button"
194
            }));
195
        [% ELSE %]
196
        $("#budgeth").treeTable();
197
        [% END %]
198
204
199
        $("#filterbutton").click(function() {
205
        $("#filterbutton").click(function() {
200
            $("#fundfilters").slideToggle(0);
206
            $("#fundfilters").slideToggle(0);
Lines 210-218 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
210
[% INCLUDE 'budgets-admin-search.inc' %]
216
[% INCLUDE 'budgets-admin-search.inc' %]
211
217
212
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
218
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
213
    <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> &rsaquo; [% IF ( else ) %]Funds for '[% budget_period_description %]'[% END %][% IF ( add_form ) %]
219
    <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> &rsaquo; [% IF op == 'list' %][% IF budget_period_id %]Funds for '[% budget_period_description %]'[% ELSE %]All funds[% END %][% END %]
214
    <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">Funds</a> &rsaquo; [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund[% END %][% END %]  [% IF ( delete_confirm ) %]
220
    [% IF op == 'add_form' %]
215
    <a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a> &rsaquo; Delete fund?[% END %]</div>
221
      <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">Funds</a> &rsaquo; [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund[% END %]
222
    [% END %]
223
    [% IF op == 'delete_confirm' %]
224
      <a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a> &rsaquo; Delete fund?
225
    [% END %]
226
</div>
216
227
217
<div id="doc3" class="yui-t2">
228
<div id="doc3" class="yui-t2">
218
<div id="bd">
229
<div id="bd">
Lines 220-226 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
220
<div class="yui-b" id="content">
231
<div class="yui-b" id="content">
221
232
222
233
223
[% UNLESS ( delete_confirm ) %][% INCLUDE 'budgets-admin-toolbar.inc' %][% END %]
234
[% UNLESS op == 'delete_confirm' %][% INCLUDE 'budgets-admin-toolbar.inc' %][% END %]
224
235
225
[% IF (error_not_authorised_to_modify) %]
236
[% IF (error_not_authorised_to_modify) %]
226
    <div class="error">
237
    <div class="error">
Lines 228-244 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
228
    </div>
239
    </div>
229
[% END %]
240
[% END %]
230
241
231
[% IF ( else ) %]
242
[% IF op == 'list' %]
232
243
233
<h1>Funds for '[% budget_period_description %]'</h1>
244
<h1>
245
  [% IF budget_period_id %]
246
    Funds for '[% budget_period_description %]'
247
  [% ELSE %]
248
    All funds
249
  [% END %]
250
</h1>
234
251
235
[% INCLUDE 'budgets-active-currency.inc' %]
252
[% INCLUDE 'budgets-active-currency.inc' %]
236
253
237
[% IF ( budget ) %]
254
[% IF budgets %]
238
255
239
<table id="budgeth">
256
<table id="budgeth">
257
    <caption>
258
        <span class="actions"><a href="#" id="expand_all">Expand all</a>
259
        | <a href="#" id="collapse_all">Collapse all</a></span>
260
    </caption>
240
    <thead>
261
    <thead>
241
        <tr>
262
        <tr>
263
            <th>Budget period description</th>
242
            <th>Fund code</th>
264
            <th>Fund code</th>
243
            <th>Fund name</th>
265
            <th>Fund name</th>
244
            <th>Base-level allocated</th>
266
            <th>Base-level allocated</th>
Lines 248-259 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
248
            <th>Total spent</th>
270
            <th>Total spent</th>
249
            <th>Base-level available</th>
271
            <th>Base-level available</th>
250
            <th>Total available</th>
272
            <th>Total available</th>
251
            <th class="tooltipcontent">&nbsp;</th>
252
            <th>Actions</th>
273
            <th>Actions</th>
253
        </tr>
274
        </tr>
254
    </thead>
275
    </thead>
255
<tfoot>
276
    <tfoot>
256
    <tr>
277
    <tr>
278
    <th></th>
257
    <th colspan="2" style="text-align: left;" nowrap="nowrap">Period allocated [% IF ( budget_period_total ) %][% budget_period_total %][% END %]  </th>
279
    <th colspan="2" style="text-align: left;" nowrap="nowrap">Period allocated [% IF ( budget_period_total ) %][% budget_period_total %][% END %]  </th>
258
    <th nowrap="nowrap" class="data"> [% period_alloc_total %]</th>
280
    <th nowrap="nowrap" class="data"> [% period_alloc_total %]</th>
259
    <th></th>
281
    <th></th>
Lines 261-314 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
261
    <th></th>
283
    <th></th>
262
    <th class="data">[% spent_total %]</th>
284
    <th class="data">[% spent_total %]</th>
263
    <th></th>
285
    <th></th>
264
    <th class="tooltipcontent"></th>
265
    <th class="data">[% available_total %]</th>
286
    <th class="data">[% available_total %]</th>
266
    <th></th>
287
    <th></th>
267
    </tr>
288
    </tr>
268
    </tfoot>
289
    </tfoot>
269
    <tbody>
290
    <tbody>
270
        [% FOREACH budge IN budget %]
291
    [% FOREACH budget IN budgets %]
271
    [% IF ( budge.toggle ) %]
292
    <tr data-tt-id="[% budget.budget_id %]" [% IF ( budget.budget_parent_id ) %]data-tt-parent-id="[% budget.budget_parent_id %]"[% END %]>
272
    <tr id="node-[% budge.budget_id %]" class="highlight[% IF ( budge.budget_parent_id ) %] child-of-node-[% budge.budget_parent_id %][% END %] tooltiped">
293
    <td>Budget [% budget.budget_period_description %]</td>
273
    [% ELSE %]
294
    <td>[% budget.budget_code_indent %]</td>
274
    <tr id="node-[% budge.budget_id %]" class="tooltiped [% IF ( budge.budget_parent_id ) %] child-of-node-[% budge.budget_parent_id %][% END %]">
295
    <td>[% budget.budget_name %]</td>
275
    [% END %]
276
277
    <td>[% budge.budget_code_indent %]</td>
278
    <td>[% budge.budget_name %]</td>
279
    <td class="data">
296
    <td class="data">
280
      [% IF budge.budget_parent_id %]
297
      [% IF budget.budget_parent_id %]
281
        <span class="child_fund_amount">[% budge.budget_amount %]</span>
298
        <span class="child_fund_amount">[% budget.budget_amount %]</span>
282
      [% ELSE %]
299
      [% ELSE %]
283
        [% budge.budget_amount %]
300
        [% budget.budget_amount %]
284
      [% END %]
301
      [% END %]
285
    </td>
302
    </td>
286
    <td class="data">
303
    <td class="data">
287
      [% IF budge.budget_parent_id %]
304
      [% IF budget.budget_parent_id %]
288
        <span class="child_fund_amount">[% budge.budget_ordered %]</span>
305
        <span class="child_fund_amount">[% budget.budget_ordered %]</span>
289
      [% ELSE %]
306
      [% ELSE %]
290
        [% budge.budget_ordered %]
307
        [% budget.budget_ordered %]
291
      [% END %]
308
      [% END %]
292
    </td>
309
    </td>
293
    <td class="data">
310
    <td class="data">
294
      [% IF budge.budget_parent_id %]
311
      [% IF budget.budget_parent_id %]
295
        <span class="child_fund_amount">[% budge.total_ordered %]</span>
312
        <span class="child_fund_amount">[% budget.total_ordered %]</span>
296
      [% ELSE %]
313
      [% ELSE %]
297
        [% budge.total_ordered %]
314
        [% budget.total_ordered %]
298
      [% END %]
315
      [% END %]
299
    </td>
316
    </td>
300
    <td class="data">
317
    <td class="data">
301
      [% IF budge.budget_parent_id %]
318
      [% IF budget.budget_parent_id %]
302
        <span class="child_fund_amount">[% budge.budget_spent %]</span>
319
        <span class="child_fund_amount">[% budget.budget_spent %]</span>
303
      [% ELSE %]
320
      [% ELSE %]
304
        [% budge.budget_spent %]
321
        [% budget.budget_spent %]
305
      [% END %]
322
      [% END %]
306
    </td>
323
    </td>
307
    <td class="data">
324
    <td class="data">
308
      [% IF budge.budget_parent_id %]
325
      [% IF budget.budget_parent_id %]
309
        <span class="child_fund_amount">[% budge.total_spent %]</span>
326
        <span class="child_fund_amount">[% budget.total_spent %]</span>
310
      [% ELSE %]
327
      [% ELSE %]
311
        [% budge.total_spent %]
328
        [% budget.total_spent %]
312
      [% END %]
329
      [% END %]
313
    </td>
330
    </td>
314
331
Lines 335-366 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
335
        </span>
352
        </span>
336
    [% END %]
353
    [% END %]
337
    <td class="data">
354
    <td class="data">
338
        [% INCLUDE colorcellvalue value=budge.budget_remaining text=budge.budget_remaining_display parent=budge.budget_parent_id %]
355
        [% INCLUDE colorcellvalue value=budget.budget_remaining text=budget.budget_remaining_display parent=budget.budget_parent_id %]
339
    </td>
356
    </td>
340
    <td class="data">
357
    <td class="data">
341
        [% INCLUDE colorcellvalue value=budge.total_remaining text=budge.total_remaining_display parent=budge.budget_parent_id %]
358
        [% INCLUDE colorcellvalue value=budget.total_remaining text=budget.total_remaining_display parent=budget.budget_parent_id %]
342
    </td>
359
    </td>
343
360
    [% IF ( budget.budget_lock ) %]
344
    <td class="tooltipcontent">[% IF ( budge.budget_owner_id ) %]<strong>Owner: </strong><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% budge.budget_owner_id %]">[% budge.budget_owner_name %]</a>[% END %]
345
        [% IF ( budge.budget_branchcode ) %]<br /><strong>Library: </strong>[% budge.budget_branchcode %][% END %]
346
        [% IF ( budge.budget_notes ) %]<br /><strong>Notes: </strong>[% budge.budget_notes %][% END %]
347
        [% IF ( budge.budget_hierarchy ) %]
348
            <ul class="budget_hierarchy">[% FOREACH budget_hierarch IN budge.budget_hierarchy %]
349
                [% IF ( budget_hierarch.element_id ) %]
350
                    <li><a href="?op=add_form&amp;budget_id=[% budget_hierarch.element_id %]&amp;budget_period_id=[% budget_hierarch.budget_period_id %]">[% budget_hierarch.element_name %]</a></li>
351
                [% ELSE %]
352
                    <li><strong>[% budget_hierarch.element_name %] : </strong></li>
353
                [% END %]
354
                [% END %]
355
            </ul>
356
        [% END %]</td>
357
    [% IF ( budge.budget_lock ) %]
358
        <td> <span style="color: gray;"> Edit Delete </span> </td>
361
        <td> <span style="color: gray;"> Edit Delete </span> </td>
359
    [% ELSE %]
362
    [% ELSE %]
360
        <td>
363
        <td>
361
            <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_id=[% budge.budget_id %]&amp;budget_period_id=[% budge.budget_period_id %]" >Edit</a>
364
            <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_id=[% budget.budget_id %]&amp;budget_period_id=[% budget.budget_period_id %]" >Edit</a>
362
            <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=delete_confirm&amp;budget_id=[% budge.budget_id %]&amp;budget_period_id=[% budge.budget_period_id %]">Delete</a>
365
            <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=delete_confirm&amp;budget_id=[% budget.budget_id %]&amp;budget_period_id=[% budget.budget_period_id %]">Delete</a>
363
            <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_parent_id=[% budge.budget_id %]&amp;budget_period_id=[% budge.budget_period_id %]">Add child fund</a>
366
            <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_parent_id=[% budget.budget_id %]&amp;budget_period_id=[% budget.budget_period_id %]">Add child fund</a>
364
        </td>
367
        </td>
365
    [% END %]
368
    [% END %]
366
    </tr>
369
    </tr>
Lines 372-383 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
372
    No fund found
375
    No fund found
373
[% END %]
376
[% END %]
374
377
375
[% IF ( pagination_bar ) %]<div class="pages">[% pagination_bar %]</div>[% END %]
378
[% END %] <!-- list -->
376
[% END %] <!-- else -->
377
379
378
<!-- ********************************************************************************************** -->
380
<!-- ********************************************************************************************** -->
379
<!-- create add/mod entry form -->
381
<!-- create add/mod entry form -->
380
[% IF ( add_form && !error_not_authorised_to_modify ) %]
382
[% IF op == 'add_form' && !error_not_authorised_to_modify %]
381
<form action="/cgi-bin/koha/admin/aqbudgets.pl" name="Aform" method="post">
383
<form action="/cgi-bin/koha/admin/aqbudgets.pl" name="Aform" method="post">
382
    <fieldset class="rows">
384
    <fieldset class="rows">
383
    <legend>[% IF ( budget_id ) %]Modify[% ELSE %]Add[% END %] Fund
385
    <legend>[% IF ( budget_id ) %]Modify[% ELSE %]Add[% END %] Fund
Lines 559-565 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
559
561
560
[% END %] <!-- add_form -->
562
[% END %] <!-- add_form -->
561
563
562
[% IF ( delete_confirm ) %]
564
[% IF op == 'delete_confirm' %]
563
<div class="dialog alert"> <h3>Delete fund [% budget_name %]?</h3>
565
<div class="dialog alert"> <h3>Delete fund [% budget_name %]?</h3>
564
<table>
566
<table>
565
    <tr>
567
    <tr>
Lines 568-581 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
568
    </tr>
570
    </tr>
569
</table>
571
</table>
570
572
571
<form action="[% action %]" method="post">
573
<form action="/cgi-bin/koha/admin/aqbudgets.pl" method="post">
572
    <input type="hidden" name="op" value="delete_confirmed" />
574
    <input type="hidden" name="op" value="delete_confirmed" />
573
    <input type="hidden" name="budget_id" value="[% budget_id %]" />
575
    <input type="hidden" name="budget_id" value="[% budget_id %]" />
574
    <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
576
    <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
575
    <input type="submit" value="Delete" class="approve" />
577
    <input type="submit" value="Delete" class="approve" />
576
</form>
578
</form>
577
579
578
<form action="[% action %]" method="get">
580
<form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
579
    <input type="submit" class="deny" value="Cancel" />
581
    <input type="submit" class="deny" value="Cancel" />
580
</form>
582
</form>
581
</div>
583
</div>
Lines 584-590 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
584
</div>
586
</div>
585
</div>
587
</div>
586
<div class="yui-b">
588
<div class="yui-b">
587
[% IF ( else ) %]<form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
589
[% IF op == 'list' %]
590
  <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
588
    <a href="#" id="filterbutton">Filters</a>
591
    <a href="#" id="filterbutton">Filters</a>
589
    <fieldset class="brief" id="fundfilters">
592
    <fieldset class="brief" id="fundfilters">
590
    <h4>Fund filters</h4>
593
    <h4>Fund filters</h4>
Lines 609-618 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
609
                <input type="checkbox" id="show_mine"  name="show_mine" value="1" />
612
                <input type="checkbox" id="show_mine"  name="show_mine" value="1" />
610
        [% END %]
613
        [% END %]
611
        </li>
614
        </li>
615
616
        [% IF periods %]
617
          <li>
618
            <label for="periods">Budget:</label>
619
            <select id="periods" name="budget_period_id">
620
              <option value="">All budgets</option>
621
              [% FOR period IN periods %]
622
                [% IF budget_period_id && period.budget_period_id == budget_period_id %]
623
                  <option value="[% period.budget_period_id %]" selected="selected">[% period.budget_period_description %]</option>
624
                [% ELSE %]
625
                  <option value="[% period.budget_period_id %]">[% period.budget_period_description %]</option>
626
                [% END %]
627
              [% END %]
628
            </select>
629
          </li>
630
        [% END %]
612
        </ol>
631
        </ol>
613
632
614
        <input type="hidden" name="show" value="1" />
633
        <input type="hidden" name="op" value="list" />
615
        <input type="hidden"  name="budget_period_id" value="[% budget_period_id %]" />
616
        <input type="submit" class="submit" name="filter" value="Go" />
634
        <input type="submit" class="submit" name="filter" value="Go" />
617
    </fieldset>
635
    </fieldset>
618
</form>[% END %]
636
</form>[% END %]
619
- 

Return to bug 11578