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, $base_spent_total );
271
    my ( $period_alloc_total, $base_spent_total );
280
272
Lines 335-345 if ($op eq 'add_form') { Link Here
335
        push  @budget_hierarchy, { element_name => $period->{"budget_period_description"} };
327
        push  @budget_hierarchy, { element_name => $period->{"budget_period_description"} };
336
        @budget_hierarchy = reverse(@budget_hierarchy);
328
        @budget_hierarchy = reverse(@budget_hierarchy);
337
329
338
        push( @loop, {  %{$budget},
330
        $budget->{branchname} = $branches->{ $budget->{branchcode} }->{branchname};
339
                        branchname  => $branches->{ $budget->{branchcode} }->{branchname},
331
        $budget->{budget_hierarchy} = \@budget_hierarchy;
340
                        budget_hierarchy => \@budget_hierarchy,
341
                    }
342
        );
343
    }
332
    }
344
333
345
    my $budget_period_total;
334
    my $budget_period_total;
Lines 356-370 if ($op eq 'add_form') { Link Here
356
        $base_spent_total = $num->format_price($base_spent_total);
345
        $base_spent_total = $num->format_price($base_spent_total);
357
    }
346
    }
358
347
348
    my $periods = GetBudgetPeriods();
349
359
    $template->param(
350
    $template->param(
360
        else                   => 1,
351
        op                     => 'list',
361
        budget                 => \@loop,
352
        budgets                => \@budgets,
353
        periods                => $periods,
362
        budget_period_total    => $budget_period_total,
354
        budget_period_total    => $budget_period_total,
363
        period_alloc_total     => $period_alloc_total,
355
        period_alloc_total     => $period_alloc_total,
364
        base_spent_total       => $base_spent_total,
356
        base_spent_total       => $base_spent_total,
365
        branchloop             => \@branchloop2,
357
        branchloop             => \@branchloop2,
366
    );
358
    );
367
359
368
} #---- END $OP eq DEFAULT
360
} #---- END list
369
361
370
output_html_with_http_headers $input, $cookie, $template->output;
362
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt (-101 / +120 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>Total<br />allocated</th>
266
            <th>Total<br />allocated</th>
Lines 246-310 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
246
            <th>Base-level<br />spent</th>
268
            <th>Base-level<br />spent</th>
247
            <th>Total sublevels<br />spent</th>
269
            <th>Total sublevels<br />spent</th>
248
            <th>Base-level<br />remaining</th>
270
            <th>Base-level<br />remaining</th>
249
            <th class="tooltipcontent">&nbsp;</th>
250
            <th>Actions</th>
271
            <th>Actions</th>
251
        </tr>
272
        </tr>
252
    </thead>
273
    </thead>
253
<tfoot>
274
    <tfoot>
254
    <tr>
275
    <tr>
276
    <th></th>
255
    <th colspan="2" style="text-align: left;" nowrap="nowrap">Period allocated [% IF ( budget_period_total ) %][% budget_period_total %][% END %]  </th>
277
    <th colspan="2" style="text-align: left;" nowrap="nowrap">Period allocated [% IF ( budget_period_total ) %][% budget_period_total %][% END %]  </th>
256
    <th nowrap="nowrap" class="data"> [% period_alloc_total %]</th>
278
    <th nowrap="nowrap" class="data"> [% period_alloc_total %]</th>
257
    <th nowrap="nowrap"  class="data"> [% base_alloc_total %]</th>
279
    <th nowrap="nowrap"  class="data"> [% base_alloc_total %]</th>
258
    <th class="data">[% base_spent_total %]</th>
280
    <th class="data">[% base_spent_total %]</th>
259
    <th class="data">[% base_spent_total %]</th>
281
    <th class="data">[% base_spent_total %]</th>
260
    <th class="data">[% base_remaining_total %]</th>
282
    <th class="data">[% base_remaining_total %]</th>
261
    <th class="tooltipcontent"></th>
262
    <th></th>
283
    <th></th>
263
    </tr>
284
    </tr>
264
    </tfoot>
285
    </tfoot>
265
    <tbody>
286
    <tbody>
266
        [% FOREACH budge IN budget %]
287
        [% FOREACH budget IN budgets %]
267
    [% IF ( budge.toggle ) %]
288
268
    <tr id="node-[% budge.budget_id %]" class="highlight[% IF ( budge.budget_parent_id ) %] child-of-node-[% budge.budget_parent_id %][% END %] tooltiped">
289
    <tr data-tt-id="[% budget.budget_id %]" [% IF ( budget.budget_parent_id ) %]data-tt-parent-id="[% budget.budget_parent_id %]"[% END %]>
269
    [% ELSE %]
290
    <td>Budget [% budget.budget_period_description %]</td>
270
    <tr id="node-[% budge.budget_id %]" class="tooltiped [% IF ( budge.budget_parent_id ) %] child-of-node-[% budge.budget_parent_id %][% END %]">
291
    <td>[% budget.budget_code_indent %]</td>
271
    [% END %]
292
    <td>[% budget.budget_name %]</td>
272
293
    <td class="data">[% budget.budget_amount_total %]</td>
273
    <td>[% budge.budget_code_indent %]</td>
294
    <td class="data">[% budget.budget_amount %] </td>
274
    <td>[% budge.budget_name %]</td>
295
    <td class="data">[% budget.budget_spent %] </td>
275
    <td class="data">[% budge.budget_amount_total %]</td>
296
    <td class="data">[% budget.total_levels_spent %]</td>
276
    <td class="data">[% budge.budget_amount %] </td>
297
    [% IF ( budget.remaining_pos ) %]
277
    <td class="data">[% budge.budget_spent %] </td>
278
    <td class="data">[% budge.total_levels_spent %]</td>
279
    [% IF ( budge.remaining_pos ) %]
280
        <td class="data" style="color: green;">
298
        <td class="data" style="color: green;">
281
    [% ELSIF ( budge.remaining_neg ) %] 
299
    [% ELSIF ( budget.remaining_neg ) %] 
282
        <td class="data" style="color: red;">
300
        <td class="data" style="color: red;">
283
    [% ELSE %]
301
    [% ELSE %]
284
        <td class="data">
302
        <td class="data">
285
    [% END %]
303
    [% END %]
286
            [% budge.budget_remaining %] </td>
304
            [% budget.budget_remaining %] </td>
287
305
288
    <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 %]
306
    [% IF ( budget.budget_lock ) %]
289
        [% IF ( budge.budget_branchcode ) %]<br /><strong>Library: </strong>[% budge.budget_branchcode %][% END %]
290
        [% IF ( budge.budget_notes ) %]<br /><strong>Notes: </strong>[% budge.budget_notes %][% END %]
291
        [% IF ( budge.budget_hierarchy ) %]
292
            <ul class="budget_hierarchy">[% FOREACH budget_hierarch IN budge.budget_hierarchy %]
293
                [% IF ( budget_hierarch.element_id ) %]
294
                    <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>
295
                [% ELSE %]
296
                    <li><strong>[% budget_hierarch.element_name %] : </strong></li>
297
                [% END %]
298
                [% END %]
299
            </ul>
300
        [% END %]</td>
301
    [% IF ( budge.budget_lock ) %]
302
        <td> <span style="color: gray;"> Edit Delete </span> </td>
307
        <td> <span style="color: gray;"> Edit Delete </span> </td>
303
    [% ELSE %]
308
    [% ELSE %]
304
        <td>
309
        <td>
305
            <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>
310
            <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>
306
            <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>
311
            <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>
307
            <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>
312
            <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>
308
        </td>
313
        </td>
309
    [% END %]
314
    [% END %]
310
    </tr>
315
    </tr>
Lines 316-327 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
316
    No fund found
321
    No fund found
317
[% END %]
322
[% END %]
318
323
319
[% IF ( pagination_bar ) %]<div class="pages">[% pagination_bar %]</div>[% END %]
324
[% END %] <!-- list -->
320
[% END %] <!-- else -->
321
325
322
<!-- ********************************************************************************************** -->
326
<!-- ********************************************************************************************** -->
323
<!-- create add/mod entry form -->
327
<!-- create add/mod entry form -->
324
[% IF ( add_form && !error_not_authorised_to_modify ) %]
328
[% IF op == 'add_form' && !error_not_authorised_to_modify %]
325
<form action="/cgi-bin/koha/admin/aqbudgets.pl" name="Aform" method="post">
329
<form action="/cgi-bin/koha/admin/aqbudgets.pl" name="Aform" method="post">
326
    <fieldset class="rows">
330
    <fieldset class="rows">
327
    <legend>[% IF ( budget_id ) %]Modify[% ELSE %]Add[% END %] Fund
331
    <legend>[% IF ( budget_id ) %]Modify[% ELSE %]Add[% END %] Fund
Lines 503-509 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
503
507
504
[% END %] <!-- add_form -->
508
[% END %] <!-- add_form -->
505
509
506
[% IF ( delete_confirm ) %]
510
[% IF op == 'delete_confirm' %]
507
<div class="dialog alert"> <h3>Delete fund [% budget_name %]?</h3>
511
<div class="dialog alert"> <h3>Delete fund [% budget_name %]?</h3>
508
<table>
512
<table>
509
    <tr>
513
    <tr>
Lines 512-525 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
512
    </tr>
516
    </tr>
513
</table>
517
</table>
514
518
515
<form action="[% action %]" method="post">
519
<form action="/cgi-bin/koha/admin/aqbudgets.pl" method="post">
516
    <input type="hidden" name="op" value="delete_confirmed" />
520
    <input type="hidden" name="op" value="delete_confirmed" />
517
    <input type="hidden" name="budget_id" value="[% budget_id %]" />
521
    <input type="hidden" name="budget_id" value="[% budget_id %]" />
518
    <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
522
    <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
519
    <input type="submit" value="Delete" class="approve" />
523
    <input type="submit" value="Delete" class="approve" />
520
</form>
524
</form>
521
525
522
<form action="[% action %]" method="get">
526
<form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
523
    <input type="submit" class="deny" value="Cancel" />
527
    <input type="submit" class="deny" value="Cancel" />
524
</form>
528
</form>
525
</div>
529
</div>
Lines 528-534 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
528
</div>
532
</div>
529
</div>
533
</div>
530
<div class="yui-b">
534
<div class="yui-b">
531
[% IF ( else ) %]<form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
535
[% IF op == 'list' %]
536
  <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
532
    <a href="#" id="filterbutton">Filters</a>
537
    <a href="#" id="filterbutton">Filters</a>
533
    <fieldset class="brief" id="fundfilters">
538
    <fieldset class="brief" id="fundfilters">
534
    <h4>Fund filters</h4>
539
    <h4>Fund filters</h4>
Lines 553-562 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
553
                <input type="checkbox" id="show_mine"  name="show_mine" value="1" />
558
                <input type="checkbox" id="show_mine"  name="show_mine" value="1" />
554
        [% END %]
559
        [% END %]
555
        </li>
560
        </li>
561
562
        [% IF periods %]
563
          <li>
564
            <label for="periods">Budget:</label>
565
            <select id="periods" name="budget_period_id">
566
              <option value="">All budgets</option>
567
              [% FOR period IN periods %]
568
                [% IF budget_period_id && period.budget_period_id == budget_period_id %]
569
                  <option value="[% period.budget_period_id %]" selected="selected">[% period.budget_period_description %]</option>
570
                [% ELSE %]
571
                  <option value="[% period.budget_period_id %]">[% period.budget_period_description %]</option>
572
                [% END %]
573
              [% END %]
574
            </select>
575
          </li>
576
        [% END %]
556
        </ol>
577
        </ol>
557
578
558
        <input type="hidden" name="show" value="1" />
579
        <input type="hidden" name="op" value="list" />
559
        <input type="hidden"  name="budget_period_id" value="[% budget_period_id %]" />
560
        <input type="submit" class="submit" name="filter" value="Go" />
580
        <input type="submit" class="submit" name="filter" value="Go" />
561
    </fieldset>
581
    </fieldset>
562
</form>[% END %]
582
</form>[% END %]
563
- 

Return to bug 11578