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 (-103 / +129 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-202 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
        //$("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
162
        tooltipcontent.hide();
156
        //    "aoColumnDefs": [
163
157
        //        { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
164
        $(".tooltiped td").each(function (){
158
        //    ],
165
            contentelem = $(this).parent().children().filter(".tooltipcontent");
159
        //    "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
166
            if(contentelem.html() != ""){
160
        //    "iDisplayLength": 20,
167
            $(this).qtip({
161
        //    "sPaginationType": "four_button"
168
                content: contentelem.html(),
162
        //}));
169
                show: "mouseover",
163
170
                hide: "mouseout",
164
        var oTable = $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
171
                style: {
165
            "fnDrawCallback": function ( oSettings ) {
172
                    name: "light",
166
                if ( oSettings.aiDisplay.length == 0 )
173
                    tip: "bottomLeft",
167
                {
174
                    border: {
168
                    return;
175
                        radius: 5,
169
                }
176
                        color: "#356CA1"
170
177
                    }
171
                var nTrs = $('#budgeth tbody tr');
178
                },
172
                var iColspan = nTrs[0].getElementsByTagName('td').length;
179
                position: {
173
                var sLastGroup = "";
180
                    corner: {
174
                for ( var i=0 ; i<nTrs.length ; i++ )
181
                        target: "topRight",
175
                {
182
                        tooltip: "bottomRight"
176
                    var iDisplayIndex = oSettings._iDisplayStart + i;
177
                    var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0];
178
                    if ( sGroup != sLastGroup )
179
                    {
180
                        var nGroup = document.createElement( 'tr' );
181
                        var nCell = document.createElement( 'td' );
182
                        nCell.colSpan = iColspan;
183
                        nCell.className = "group";
184
                        nCell.innerHTML = sGroup;
185
                        nGroup.appendChild( nCell );
186
                        nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
187
                        sLastGroup = sGroup;
183
                    }
188
                    }
184
                }
189
                }
185
            });
190
            },
186
            }
191
            "aoColumnDefs": [
192
                { "bVisible": false, "aTargets": [ 0 ] }
193
            ],
194
            "aaSortingFixed": [[ 0, 'asc' ]],
195
            "aaSorting": [[ 1, 'asc' ]],
196
            'bSort': false,
197
            'bPaginate': false,
198
            "bAutoWidth": false
199
        }));
200
201
        $(oTable).treetable({
202
            expandable: true
203
        });
204
        $(oTable).treetable('expandAll');
205
        $("#expand_all").click(function(e){
206
            e.preventDefault();
207
            $(oTable).treetable('expandAll');
208
        });
209
        $("#collapse_all").click(function(e){
210
            e.preventDefault();
211
            $(oTable).treetable('collapseAll');
187
        });
212
        });
188
        [% IF ( notree ) %]
189
            $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
190
                "aoColumnDefs": [
191
                    { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
192
                ],
193
                "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
194
                "iDisplayLength": 20,
195
                "sPaginationType": "four_button"
196
            }));
197
        [% ELSE %]
198
        $("#budgeth").treeTable();
199
        [% END %]
200
213
201
        $("#filterbutton").click(function() {
214
        $("#filterbutton").click(function() {
202
            $("#fundfilters").slideToggle(0);
215
            $("#fundfilters").slideToggle(0);
Lines 212-220 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
212
[% INCLUDE 'budgets-admin-search.inc' %]
225
[% INCLUDE 'budgets-admin-search.inc' %]
213
226
214
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
227
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
215
    <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 ) %]
228
    <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 %]
216
    <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 ) %]
229
    [% IF op == 'add_form' %]
217
    <a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a> &rsaquo; Delete fund?[% END %]</div>
230
      <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 %]
231
    [% END %]
232
    [% IF op == 'delete_confirm' %]
233
      <a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a> &rsaquo; Delete fund?
234
    [% END %]
235
</div>
218
236
219
<div id="doc3" class="yui-t2">
237
<div id="doc3" class="yui-t2">
220
<div id="bd">
238
<div id="bd">
Lines 222-228 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
222
<div class="yui-b" id="content">
240
<div class="yui-b" id="content">
223
241
224
242
225
[% UNLESS ( delete_confirm ) %][% INCLUDE 'budgets-admin-toolbar.inc' %][% END %]
243
[% UNLESS op == 'delete_confirm' %][% INCLUDE 'budgets-admin-toolbar.inc' %][% END %]
226
244
227
[% IF (error_not_authorised_to_modify) %]
245
[% IF (error_not_authorised_to_modify) %]
228
    <div class="error">
246
    <div class="error">
Lines 230-246 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
230
    </div>
248
    </div>
231
[% END %]
249
[% END %]
232
250
233
[% IF ( else ) %]
251
[% IF op == 'list' %]
234
252
235
<h1>Funds for '[% budget_period_description %]'</h1>
253
<h1>
254
  [% IF budget_period_id %]
255
    Funds for '[% budget_period_description %]'
256
  [% ELSE %]
257
    All funds
258
  [% END %]
259
</h1>
236
260
237
[% INCLUDE 'budgets-active-currency.inc' %]
261
[% INCLUDE 'budgets-active-currency.inc' %]
238
262
239
[% IF ( budget ) %]
263
[% IF budgets %]
240
264
241
<table id="budgeth">
265
<table id="budgeth">
266
    <caption>
267
        <span class="actions"><a href="#" id="expand_all">Expand all</a>
268
        | <a href="#" id="collapse_all">Collapse all</a></span>
269
    </caption>
242
    <thead>
270
    <thead>
243
        <tr>
271
        <tr>
272
            <th>Budget period description</th>
244
            <th>Fund code</th>
273
            <th>Fund code</th>
245
            <th>Fund name</th>
274
            <th>Fund name</th>
246
            <th>Total<br />allocated</th>
275
            <th>Total<br />allocated</th>
Lines 248-312 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
248
            <th>Base-level<br />spent</th>
277
            <th>Base-level<br />spent</th>
249
            <th>Total sublevels<br />spent</th>
278
            <th>Total sublevels<br />spent</th>
250
            <th>Base-level<br />remaining</th>
279
            <th>Base-level<br />remaining</th>
251
            <th class="tooltipcontent">&nbsp;</th>
252
            <th>Actions</th>
280
            <th>Actions</th>
253
        </tr>
281
        </tr>
254
    </thead>
282
    </thead>
255
<tfoot>
283
    <tfoot>
256
    <tr>
284
    <tr>
285
    <th></th>
257
    <th colspan="2" style="text-align: left;" nowrap="nowrap">Period allocated [% IF ( budget_period_total ) %][% budget_period_total %][% END %]  </th>
286
    <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>
287
    <th nowrap="nowrap" class="data"> [% period_alloc_total %]</th>
259
    <th nowrap="nowrap"  class="data"> [% base_alloc_total %]</th>
288
    <th nowrap="nowrap"  class="data"> [% base_alloc_total %]</th>
260
    <th class="data">[% base_spent_total %]</th>
289
    <th class="data">[% base_spent_total %]</th>
261
    <th class="data">[% base_spent_total %]</th>
290
    <th class="data">[% base_spent_total %]</th>
262
    <th class="data">[% base_remaining_total %]</th>
291
    <th class="data">[% base_remaining_total %]</th>
263
    <th class="tooltipcontent"></th>
264
    <th></th>
292
    <th></th>
265
    </tr>
293
    </tr>
266
    </tfoot>
294
    </tfoot>
267
    <tbody>
295
    <tbody>
268
        [% FOREACH budge IN budget %]
296
        [% FOREACH budget IN budgets %]
269
    [% IF ( budge.toggle ) %]
297
270
    <tr id="node-[% budge.budget_id %]" class="highlight[% IF ( budge.budget_parent_id ) %] child-of-node-[% budge.budget_parent_id %][% END %] tooltiped">
298
    <tr data-tt-id="[% budget.budget_id %]" [% IF ( budget.budget_parent_id ) %]data-tt-parent-id="[% budget.budget_parent_id %]"[% END %]>
271
    [% ELSE %]
299
    <td>Budget [% budget.budget_period_description %]</td>
272
    <tr id="node-[% budge.budget_id %]" class="tooltiped [% IF ( budge.budget_parent_id ) %] child-of-node-[% budge.budget_parent_id %][% END %]">
300
    <td>[% budget.budget_code_indent %]</td>
273
    [% END %]
301
    <td>[% budget.budget_name %]</td>
274
302
    <td class="data">[% budget.budget_amount_total %]</td>
275
    <td>[% budge.budget_code_indent %]</td>
303
    <td class="data">[% budget.budget_amount %] </td>
276
    <td>[% budge.budget_name %]</td>
304
    <td class="data">[% budget.budget_spent %] </td>
277
    <td class="data">[% budge.budget_amount_total %]</td>
305
    <td class="data">[% budget.total_levels_spent %]</td>
278
    <td class="data">[% budge.budget_amount %] </td>
306
    [% IF ( budget.remaining_pos ) %]
279
    <td class="data">[% budge.budget_spent %] </td>
280
    <td class="data">[% budge.total_levels_spent %]</td>
281
    [% IF ( budge.remaining_pos ) %]
282
        <td class="data" style="color: green;">
307
        <td class="data" style="color: green;">
283
    [% ELSIF ( budge.remaining_neg ) %] 
308
    [% ELSIF ( budget.remaining_neg ) %] 
284
        <td class="data" style="color: red;">
309
        <td class="data" style="color: red;">
285
    [% ELSE %]
310
    [% ELSE %]
286
        <td class="data">
311
        <td class="data">
287
    [% END %]
312
    [% END %]
288
            [% budge.budget_remaining %] </td>
313
            [% budget.budget_remaining %] </td>
289
314
290
    <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 %]
315
    [% IF ( budget.budget_lock ) %]
291
        [% IF ( budge.budget_branchcode ) %]<br /><strong>Library: </strong>[% budge.budget_branchcode %][% END %]
292
        [% IF ( budge.budget_notes ) %]<br /><strong>Notes: </strong>[% budge.budget_notes %][% END %]
293
        [% IF ( budge.budget_hierarchy ) %]
294
            <ul class="budget_hierarchy">[% FOREACH budget_hierarch IN budge.budget_hierarchy %]
295
                [% IF ( budget_hierarch.element_id ) %]
296
                    <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>
297
                [% ELSE %]
298
                    <li><strong>[% budget_hierarch.element_name %] : </strong></li>
299
                [% END %]
300
                [% END %]
301
            </ul>
302
        [% END %]</td>
303
    [% IF ( budge.budget_lock ) %]
304
        <td> <span style="color: gray;"> Edit Delete </span> </td>
316
        <td> <span style="color: gray;"> Edit Delete </span> </td>
305
    [% ELSE %]
317
    [% ELSE %]
306
        <td>
318
        <td>
307
            <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>
319
            <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>
308
            <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>
320
            <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>
309
            <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>
321
            <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>
310
        </td>
322
        </td>
311
    [% END %]
323
    [% END %]
312
    </tr>
324
    </tr>
Lines 318-329 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
318
    No fund found
330
    No fund found
319
[% END %]
331
[% END %]
320
332
321
[% IF ( pagination_bar ) %]<div class="pages">[% pagination_bar %]</div>[% END %]
333
[% END %] <!-- list -->
322
[% END %] <!-- else -->
323
334
324
<!-- ********************************************************************************************** -->
335
<!-- ********************************************************************************************** -->
325
<!-- create add/mod entry form -->
336
<!-- create add/mod entry form -->
326
[% IF ( add_form && !error_not_authorised_to_modify ) %]
337
[% IF op == 'add_form' && !error_not_authorised_to_modify %]
327
<form action="/cgi-bin/koha/admin/aqbudgets.pl" name="Aform" method="post">
338
<form action="/cgi-bin/koha/admin/aqbudgets.pl" name="Aform" method="post">
328
    <fieldset class="rows">
339
    <fieldset class="rows">
329
    <legend>[% IF ( budget_id ) %]Modify[% ELSE %]Add[% END %] Fund
340
    <legend>[% IF ( budget_id ) %]Modify[% ELSE %]Add[% END %] Fund
Lines 505-511 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
505
516
506
[% END %] <!-- add_form -->
517
[% END %] <!-- add_form -->
507
518
508
[% IF ( delete_confirm ) %]
519
[% IF op == 'delete_confirm' %]
509
<div class="dialog alert"> <h3>Delete fund [% budget_name %]?</h3>
520
<div class="dialog alert"> <h3>Delete fund [% budget_name %]?</h3>
510
<table>
521
<table>
511
    <tr>
522
    <tr>
Lines 514-527 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
514
    </tr>
525
    </tr>
515
</table>
526
</table>
516
527
517
<form action="[% action %]" method="post">
528
<form action="/cgi-bin/koha/admin/aqbudgets.pl" method="post">
518
    <input type="hidden" name="op" value="delete_confirmed" />
529
    <input type="hidden" name="op" value="delete_confirmed" />
519
    <input type="hidden" name="budget_id" value="[% budget_id %]" />
530
    <input type="hidden" name="budget_id" value="[% budget_id %]" />
520
    <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
531
    <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
521
    <input type="submit" value="Delete" class="approve" />
532
    <input type="submit" value="Delete" class="approve" />
522
</form>
533
</form>
523
534
524
<form action="[% action %]" method="get">
535
<form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
525
    <input type="submit" class="deny" value="Cancel" />
536
    <input type="submit" class="deny" value="Cancel" />
526
</form>
537
</form>
527
</div>
538
</div>
Lines 530-536 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
530
</div>
541
</div>
531
</div>
542
</div>
532
<div class="yui-b">
543
<div class="yui-b">
533
[% IF ( else ) %]<form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
544
[% IF op == 'list' %]
545
  <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
534
    <a href="#" id="filterbutton">Filters</a>
546
    <a href="#" id="filterbutton">Filters</a>
535
    <fieldset class="brief" id="fundfilters">
547
    <fieldset class="brief" id="fundfilters">
536
    <h4>Fund filters</h4>
548
    <h4>Fund filters</h4>
Lines 555-564 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") Link Here
555
                <input type="checkbox" id="show_mine"  name="show_mine" value="1" />
567
                <input type="checkbox" id="show_mine"  name="show_mine" value="1" />
556
        [% END %]
568
        [% END %]
557
        </li>
569
        </li>
570
571
        [% IF periods %]
572
          <li>
573
            <label for="periods">Budget:</label>
574
            <select id="periods" name="budget_period_id">
575
              <option value="">All budgets</option>
576
              [% FOR period IN periods %]
577
                [% IF budget_period_id && period.budget_period_id == budget_period_id %]
578
                  <option value="[% period.budget_period_id %]" selected="selected">[% period.budget_period_description %]</option>
579
                [% ELSE %]
580
                  <option value="[% period.budget_period_id %]">[% period.budget_period_description %]</option>
581
                [% END %]
582
              [% END %]
583
            </select>
584
          </li>
585
        [% END %]
558
        </ol>
586
        </ol>
559
587
560
        <input type="hidden" name="show" value="1" />
588
        <input type="hidden" name="op" value="list" />
561
        <input type="hidden"  name="budget_period_id" value="[% budget_period_id %]" />
562
        <input type="submit" class="submit" name="filter" value="Go" />
589
        <input type="submit" class="submit" name="filter" value="Go" />
563
    </fieldset>
590
    </fieldset>
564
</form>[% END %]
591
</form>[% END %]
565
- 

Return to bug 11578