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

(-)a/admin/aqbudgetperiods.pl (-21 / +52 lines)
Lines 72-78 my $budget_period_hashref= $input->Vars; Link Here
72
#my $sort1_authcat = $input->param('sort1_authcat');
72
#my $sort1_authcat = $input->param('sort1_authcat');
73
#my $sort2_authcat = $input->param('sort2_authcat');
73
#my $sort2_authcat = $input->param('sort2_authcat');
74
74
75
my $pagesize    = 20;
75
my $activepagesize = 20;
76
my $inactivepagesize = 20;
76
$searchfield =~ s/\,//g;
77
$searchfield =~ s/\,//g;
77
78
78
my ($template, $borrowernumber, $cookie, $staff_flags ) = get_template_and_user(
79
my ($template, $borrowernumber, $cookie, $staff_flags ) = get_template_and_user(
Lines 245-271 elsif ( $op eq 'duplicate_budget' ){ Link Here
245
# DEFAULT - DISPLAY AQPERIODS TABLE
246
# DEFAULT - DISPLAY AQPERIODS TABLE
246
# -------------------------------------------------------------------
247
# -------------------------------------------------------------------
247
# display the list of budget periods
248
# display the list of budget periods
248
    my $results = GetBudgetPeriods();
249
	$template->param( period_button_only => 1 ) unless (@$results) ;
250
    my $page = $input->param('page') || 1;
251
    my $first = ( $page - 1 ) * $pagesize;
252
    # if we are on the last page, the number of the last word to display
253
    # must not exceed the length of the results array
254
    my $last = min( $first + $pagesize - 1, scalar @{$results} - 1, );
255
    my $toggle = 0;
256
    my @period_loop;
257
    foreach my $result ( @{$results}[ $first .. $last ] ) {
258
        my $budgetperiod = $result;
259
		FormatData($budgetperiod);
260
        $budgetperiod->{'budget_period_total'}     = $num->format_price( $budgetperiod->{'budget_period_total'} );
261
        $budgetperiod->{budget_active} = 1;
262
        push( @period_loop, $budgetperiod );
263
    }
264
249
265
    $template->param(
250
my $activepage = $input->param('apage') || 1;
266
        period_loop           => \@period_loop,
251
my $inactivepage = $input->param('ipage') || 1;
267
		pagination_bar		  => pagination_bar("aqbudgetperiods.pl",getnbpages(scalar(@$results),$pagesize),$page),
252
# Get active budget periods
268
    );
253
my $results = GetBudgetPeriods(
254
    {budget_period_active => 1},
255
    [{budget_period_description => 0}]
256
);
257
my $first = ( $activepage - 1 ) * $activepagesize;
258
my $last = min( $first + $activepagesize - 1, scalar @{$results} - 1, );
259
my @period_active_loop;
260
261
foreach my $result ( @{$results}[ $first .. $last ] ) {
262
    my $budgetperiod = $result;
263
    FormatData($budgetperiod);
264
    $budgetperiod->{'budget_period_total'}     = $num->format_price( $budgetperiod->{'budget_period_total'} );
265
    $budgetperiod->{budget_active} = 1;
266
    push( @period_active_loop, $budgetperiod );
267
}
268
my $url = "aqbudgetperiods.pl";
269
$url .=  "?ipage=$inactivepage" if($inactivepage != 1);
270
my $active_pagination_bar = pagination_bar ($url, getnbpages( scalar(@$results), $activepagesize), $activepage, "apage");
271
272
# Get inactive budget periods
273
$results = GetBudgetPeriods(
274
    {budget_period_active => 0},
275
    [{budget_period_enddate => 1}]
276
);
277
my $first = ( $inactivepage - 1 ) * $inactivepagesize;
278
my $last = min( $first + $inactivepagesize - 1, scalar @{$results} - 1, );
279
my @period_inactive_loop;
280
foreach my $result ( @{$results}[ $first .. $last ] ) {
281
    my $budgetperiod = $result;
282
    FormatData($budgetperiod);
283
    $budgetperiod->{'budget_period_total'} = $num->format_price( $budgetperiod->{'budget_period_total'} );
284
    $budgetperiod->{budget_active} = 1;
285
    push( @period_inactive_loop, $budgetperiod );
286
}
287
$url = "aqbudgetperiods.pl?tab=2";
288
$url .= "&apage=$activepage" if($activepage != 1);
289
my $inactive_pagination_bar = pagination_bar ($url, getnbpages( scalar(@$results), $inactivepagesize), $inactivepage, "ipage");
290
291
my $tab = $input->param('tab') ? $input->param('tab') - 1 : 0;
292
$template->param(
293
    period_active_loop      => \@period_active_loop,
294
    period_inactive_loop    => \@period_inactive_loop,
295
    active_pagination_bar   => $active_pagination_bar,
296
    inactive_pagination_bar => $inactive_pagination_bar,
297
    tab                     => $tab,
298
    dateformat              => C4::Context->preference('dateformat'),
299
);
269
300
270
$template->param($op=>1);
301
$template->param($op=>1);
271
output_html_with_http_headers $input, $cookie, $template->output;
302
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt (-52 / +120 lines)
Lines 1-9 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
2
[% INCLUDE 'doc-head-close.inc' %]
3
[% INCLUDE 'doc-head-close.inc' %]
3
[% INCLUDE 'calendar.inc' %]
4
[% INCLUDE 'calendar.inc' %]
4
5
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
6
[% INCLUDE 'datatables-strings.inc' %]
7
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
5
<script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
8
<script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
6
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
7
<script type="text/javascript">
9
<script type="text/javascript">
8
// #################################################################################
10
// #################################################################################
9
// Javascript
11
// Javascript
Lines 70-82 Link Here
70
                    alert(alertString2);
72
                    alert(alertString2);
71
            }
73
            }
72
    }
74
    }
73
	$(document).ready(function() {
75
74
		 $("#periodsh").tablesorter({
76
75
	            widgets : ['zebra'],
77
76
	            sortList: [[0,0]],
78
    [% IF ( dateformat == 'metric' ) %]
77
	            headers:  {6:{sorter:false}}
79
        dt_add_type_uk_date();
78
	     });
80
    [% END %]
79
	});
81
    $(document).ready(function() {
82
        var tabs = $('#budgetsTabs > ul').tabs();
83
        [% IF ( tab ) %]
84
            tabs.tabs('select', [% tab %]);
85
        [% END %]
86
        $("table").dataTable($.extend(true, {}, dataTablesDefaults, {
87
            "aoColumnDefs": [
88
                {
89
                    [% IF ( dateformat == 'metric' ) %]
90
                        "aTargets": [ 1, 2 ], "sType": "uk_date",
91
                    [% END %]
92
                    "bSortable": false, 'aTargets':['_all'],
93
                },
94
            ],
95
            "sPaginationType": "four_button",
96
            "bAutoWidth": false,
97
            "bPaginate": false,
98
            "bInfo": false,
99
            "bFilter": false,
100
        } ) );
101
    });
80
</script>
102
</script>
81
103
82
<title>
104
<title>
Lines 331-378 Link Here
331
[% END %]
353
[% END %]
332
<!--  DEFAULT  display budget periods list -->
354
<!--  DEFAULT  display budget periods list -->
333
[% IF ( else ) %]
355
[% IF ( else ) %]
334
    <h2>Budgets administration</h2>
356
  <h2>Budgets administration</h2>
335
357
336
    [% INCLUDE 'budgets-active-currency.inc' %]
358
  [% INCLUDE 'budgets-active-currency.inc' %]
337
359
338
    <table id="periodsh">
360
  <div id="budgetsTabs" class="toptabs">
339
    <thead>
361
    <ul>
340
	    <tr>
362
        <li><a href="/cgi-bin/koha/admin/aqbudgetperiods.pl#active">Active Budgets</a></li>
341
            <th>Budget name</th>
363
        <li><a href="/cgi-bin/koha/admin/aqbudgetperiods.pl#inactive">Inactive Budgets</a></li>
342
            <th>Start date</th>
364
    </ul>
343
            <th>End date</th>
365
344
	        <th>Active</th>
366
    <div id="active">
345
	        <th>Locked</th>
367
      <h3>Active Budgets</h3>
346
	        <th>Total</th>
368
      <table id="activeperiodst">
347
	        <th>Actions</th>
369
        <thead>
348
	    </tr>
370
          <tr>
349
	</thead>
371
            <th>Budget Name</th>
350
	<tbody>
372
            <th>Start Date</th>
351
	    [% FOREACH period_loo IN period_loop %]
373
            <th>End Date</th>
352
	        [% IF ( loop.odd ) %]
374
            <th>Locked</th>
353
	            <tr>
375
            <th>Total</th>
354
	        [% ELSE %]
376
            <th>Actions</th>
355
	            <tr class="highlight">
377
          </tr>
356
	        [% END %]
378
        </thead>
357
	        <td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% period_loo.budget_period_id %]" title="View funds for [% period_loo.budget_period_description %]">[% period_loo.budget_period_description %]</a></td>
379
        <tbody>
358
	        <td>[% period_loo.budget_period_startdate %]</td>
380
            [% FOREACH period_active IN period_active_loop %]
359
	        <td>[% period_loo.budget_period_enddate %]</td>
381
              <tr>
360
	        <td>[% IF ( period_loo.budget_period_active ) %]<span style="color:green;">Active</span>&nbsp;[% ELSE %][% END %] </td>
382
              <td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% period_active.budget_period_id %]" title="View funds for [% period_active.budget_period_description %]">[% period_active.budget_period_description %]</a></td>
361
	        <td> [% IF ( period_loo.budget_period_locked ) %]<span style="color:green;">Locked</span>&nbsp;[% ELSE %][% END %] </td>
383
              <td>[% period_active.budget_period_startdate %]</td>
362
	        <td align='right'>[% period_loo.budget_period_total %]</td>
384
              <td>[% period_active.budget_period_enddate %]</td>
363
	        <td>
385
              <td>
364
	            <a href="[% period_loo.script_name %]?op=add_form&amp;budget_period_id=[% period_loo.budget_period_id |html %]">Edit</a>
386
                [% IF ( period_active.budget_period_locked ) %]
365
	            <a href="[% period_loo.script_name %]?op=delete_confirm&amp;budget_period_id=[% period_loo.budget_period_id %]">Delete</a>
387
                  <span style="color:green;">Locked</span>&nbsp;
366
            <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_period_id=[% period_loo.budget_period_id %]">Add fund</a>
388
                [% END %]
367
	        </td>
389
              </td>
368
	        </tr>
390
              <td align='right'>[% period_active.budget_period_total %]</td>
369
	    [% END %]
391
              <td>
370
	    [% UNLESS ( period_loop ) %]
392
                <a href="[% script_name %]?op=add_form&amp;budget_period_id=[% period_active.budget_period_id |html %]">Edit</a>
371
    	<tr><td colspan="7">No budget</td></tr>
393
                <a href="[% script_name %]?op=delete_confirm&amp;budget_period_id=[% period_active.budget_period_id %]">Delete</a>
372
    	[% END %]
394
                <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_period_id=[% period_active.budget_period_id %]">Add Fund</a>
373
    </tbody>
395
              </td>
374
    </table>
396
              </tr>
375
    <div class="pages">[% pagination_bar %]</div>
397
            [% END %]
398
            [% UNLESS ( period_active_loop ) %]
399
              <tr><td colspan="7">No budget</td></tr>
400
            [% END %]
401
        </tbody>
402
      </table>
403
      <div class="paginationBar">[% active_pagination_bar %]</div>
404
    </div>
405
    <div id="inactive">
406
      <h3>Inactive Budgets</h3>
407
      <table id="inactiveperiodst">
408
        <thead>
409
            <tr>
410
                <th>Budget name</th>
411
                <th>Start date</th>
412
                <th>End date</th>
413
                <th>Locked</th>
414
                <th>Total</th>
415
                <th>Actions</th>
416
            </tr>
417
        </thead>
418
        <tbody>
419
            [% FOREACH period_loo IN period_inactive_loop %]
420
                [% IF ( loop.odd ) %]
421
                    <tr>
422
                [% ELSE %]
423
                    <tr class="highlight">
424
                [% END %]
425
                <td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% period_loo.budget_period_id %]" title="View funds for [% period_loo.budget_period_description %]">[% period_loo.budget_period_description %]</a></td>
426
                <td>[% period_loo.budget_period_startdate %]</td>
427
                <td>[% period_loo.budget_period_enddate %]</td>
428
                <td> [% IF ( period_loo.budget_period_locked ) %]<span style="color:green;">Locked</span>&nbsp;[% ELSE %][% END %] </td>
429
                <td align='right'>[% period_loo.budget_period_total %]</td>
430
                <td>
431
                    <a href="[% period_loo.script_name %]?op=add_form&amp;budget_period_id=[% period_loo.budget_period_id |html %]">Edit</a>
432
                    <a href="[% period_loo.script_name %]?op=delete_confirm&amp;budget_period_id=[% period_loo.budget_period_id %]">Delete</a>
433
                <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_period_id=[% period_loo.budget_period_id %]">Add fund</a>
434
                </td>
435
                </tr>
436
            [% END %]
437
            [% UNLESS ( period_inactive_loop ) %]
438
            <tr><td colspan="7">No budget</td></tr>
439
            [% END %]
440
        </tbody>
441
      </table>
442
      <div class="pages">[% inactive_pagination_bar %]</div>
443
    </div>
444
  </div>
376
[% END %]
445
[% END %]
377
446
378
447
379
- 

Return to bug 8117