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

(-)a/admin/aqbudgetperiods.pl (-24 / +50 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 116-126 if ( $op eq 'add_form' ) { Link Here
116
    ## add or modify a budget period (preparation)
117
    ## add or modify a budget period (preparation)
117
    ## get information about the budget period that must be modified
118
    ## get information about the budget period that must be modified
118
119
119
120
    if ($budget_period_id) {    # MOD
120
    if ($budget_period_id) {    # MOD
121
		my $budgetperiod_hash=GetBudgetPeriod($budget_period_id);
121
		my $budgetperiod_hash=GetBudgetPeriod($budget_period_id);
122
        # get dropboxes
122
        # get dropboxes
123
		FormatData($budgetperiod_hash);
124
123
125
        my $editnum = new Number::Format(
124
        my $editnum = new Number::Format(
126
            'int_curr_symbol'   => '',
125
            'int_curr_symbol'   => '',
Lines 159-165 elsif ( $op eq 'delete_confirm' ) { Link Here
159
    my $total = 0;
158
    my $total = 0;
160
    my $data = GetBudgetPeriod( $budget_period_id);
159
    my $data = GetBudgetPeriod( $budget_period_id);
161
160
162
	FormatData($data);
163
	$$data{'budget_period_total'}=$num->format_price(  $data->{'budget_period_total'});
161
	$$data{'budget_period_total'}=$num->format_price(  $data->{'budget_period_total'});
164
    $template->param(
162
    $template->param(
165
		%$data
163
		%$data
Lines 245-271 elsif ( $op eq 'duplicate_budget' ){ Link Here
245
# DEFAULT - DISPLAY AQPERIODS TABLE
243
# DEFAULT - DISPLAY AQPERIODS TABLE
246
# -------------------------------------------------------------------
244
# -------------------------------------------------------------------
247
# display the list of budget periods
245
# 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
246
265
    $template->param(
247
my $activepage = $input->param('apage') || 1;
266
        period_loop           => \@period_loop,
248
my $inactivepage = $input->param('ipage') || 1;
267
		pagination_bar		  => pagination_bar("aqbudgetperiods.pl",getnbpages(scalar(@$results),$pagesize),$page),
249
# Get active budget periods
268
    );
250
my $results = GetBudgetPeriods(
251
    {budget_period_active => 1},
252
    [{budget_period_description => 0}]
253
);
254
my $first = ( $activepage - 1 ) * $activepagesize;
255
my $last = min( $first + $activepagesize - 1, scalar @{$results} - 1, );
256
my @period_active_loop;
257
258
foreach my $result ( @{$results}[ $first .. $last ] ) {
259
    my $budgetperiod = $result;
260
    $budgetperiod->{'budget_period_total'}     = $num->format_price( $budgetperiod->{'budget_period_total'} );
261
    $budgetperiod->{budget_active} = 1;
262
    push( @period_active_loop, $budgetperiod );
263
}
264
my $url = "aqbudgetperiods.pl";
265
$url .=  "?ipage=$inactivepage" if($inactivepage != 1);
266
my $active_pagination_bar = pagination_bar ($url, getnbpages( scalar(@$results), $activepagesize), $activepage, "apage");
267
268
# Get inactive budget periods
269
$results = GetBudgetPeriods(
270
    {budget_period_active => 0},
271
    [{budget_period_enddate => 1}]
272
);
273
my $first = ( $inactivepage - 1 ) * $inactivepagesize;
274
my $last = min( $first + $inactivepagesize - 1, scalar @{$results} - 1, );
275
my @period_inactive_loop;
276
foreach my $result ( @{$results}[ $first .. $last ] ) {
277
    my $budgetperiod = $result;
278
    $budgetperiod->{'budget_period_total'} = $num->format_price( $budgetperiod->{'budget_period_total'} );
279
    $budgetperiod->{budget_active} = 1;
280
    push( @period_inactive_loop, $budgetperiod );
281
}
282
$url = "aqbudgetperiods.pl?tab=2";
283
$url .= "&apage=$activepage" if($activepage != 1);
284
my $inactive_pagination_bar = pagination_bar ($url, getnbpages( scalar(@$results), $inactivepagesize), $inactivepage, "ipage");
285
286
my $tab = $input->param('tab') ? $input->param('tab') - 1 : 0;
287
$template->param(
288
    period_active_loop      => \@period_active_loop,
289
    period_inactive_loop    => \@period_inactive_loop,
290
    active_pagination_bar   => $active_pagination_bar,
291
    inactive_pagination_bar => $inactive_pagination_bar,
292
    tab                     => $tab,
293
    dateformat              => C4::Context->preference('dateformat'),
294
);
269
295
270
$template->param($op=>1);
296
$template->param($op=>1);
271
output_html_with_http_headers $input, $cookie, $template->output;
297
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt (-55 / +127 lines)
Lines 1-8 Link Here
1
[% USE KohaDates %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
2
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
3
[% INCLUDE 'calendar.inc' %]
5
[% INCLUDE 'calendar.inc' %]
6
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script>
7
[% INCLUDE 'datatables-strings.inc' %]
8
<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>
4
<script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
9
<script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
5
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
6
<script type="text/javascript">
10
<script type="text/javascript">
7
// #################################################################################
11
// #################################################################################
8
// Javascript
12
// Javascript
Lines 69-81 Link Here
69
                    alert(alertString2);
73
                    alert(alertString2);
70
            }
74
            }
71
    }
75
    }
72
	$(document).ready(function() {
76
73
		 $("#periodsh").tablesorter({
77
74
	            widgets : ['zebra'],
78
75
	            sortList: [[0,0]],
79
    [% IF ( dateformat == 'metric' ) %]
76
	            headers:  {6:{sorter:false}}
80
        dt_add_type_uk_date();
77
	     });
81
    [% END %]
78
	});
82
    $(document).ready(function() {
83
        var tabs = $('#budgetsTabs').tabs();
84
        [% IF ( tab ) %]
85
            tabs.tabs('select', [% tab %]);
86
        [% END %]
87
        $("table").dataTable($.extend(true, {}, dataTablesDefaults, {
88
            "aoColumnDefs": [
89
                {
90
                    [% IF ( dateformat == 'metric' ) %]
91
                        "aTargets": [ 1, 2 ], "sType": "uk_date",
92
                    [% END %]
93
                    "bSortable": false, 'aTargets':['_all'],
94
                },
95
            ],
96
            "sPaginationType": "four_button",
97
            "bAutoWidth": false,
98
            "bPaginate": false,
99
            "bInfo": false,
100
            "bFilter": false,
101
        } ) );
102
    });
79
</script>
103
</script>
80
104
81
<title>
105
<title>
Lines 164-176 Link Here
164
188
165
    <li>
189
    <li>
166
    <label class="required" for="from">Start date</label>
190
    <label class="required" for="from">Start date</label>
167
    <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate %]" class="datepickerfrom" />
191
    <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
168
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
192
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
169
    </li>
193
    </li>
170
    <li>
194
    <li>
171
195
172
    <label class="required" for="to">End date</label>
196
    <label class="required" for="to">End date</label>
173
    <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate %]" class="datepickerto" />
197
    <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
174
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
198
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
175
    </li>
199
    </li>
176
200
Lines 203-215 Link Here
203
    <ol>
227
    <ol>
204
    <li>
228
    <li>
205
    <label class="required" for="from">Start date</label>
229
    <label class="required" for="from">Start date</label>
206
    <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate %]" class="datepickerfrom" />
230
    <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
207
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
231
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
208
    </li>
232
    </li>
209
    <li>
233
    <li>
210
234
211
    <label class="required" for="to">End date</label>
235
    <label class="required" for="to">End date</label>
212
    <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate %]" class="datepickerto" />
236
    <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
213
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
237
				<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
214
    </li>
238
    </li>
215
239
Lines 290-337 Link Here
290
[% END %]
314
[% END %]
291
<!--  DEFAULT  display budget periods list -->
315
<!--  DEFAULT  display budget periods list -->
292
[% IF ( else ) %]
316
[% IF ( else ) %]
293
    <h2>Budgets administration</h2>
317
  <h2>Budgets administration</h2>
294
318
295
    [% INCLUDE 'budgets-active-currency.inc' %]
319
  [% INCLUDE 'budgets-active-currency.inc' %]
296
320
297
    <table id="periodsh">
321
  <div id="budgetsTabs" class="toptabs">
298
    <thead>
322
    <ul>
299
	    <tr>
323
        <li><a href="#active">Active Budgets</a></li>
300
            <th>Budget name</th>
324
        <li><a href="#inactive">Inactive Budgets</a></li>
301
            <th>Start date</th>
325
    </ul>
302
            <th>End date</th>
326
303
	        <th>Active</th>
327
    <div id="active">
304
	        <th>Locked</th>
328
      <h3>Active Budgets</h3>
305
	        <th>Total</th>
329
      [% IF ( period_active_loop ) %]
306
	        <th>Actions</th>
330
        <table id="activeperiodst">
307
	    </tr>
331
          <thead>
308
	</thead>
332
            <tr>
309
	<tbody>
333
              <th>Budget name</th>
310
	    [% FOREACH period_loo IN period_loop %]
334
              <th>Start date</th>
311
	        [% IF ( loop.odd ) %]
335
              <th>End date</th>
312
	            <tr>
336
              <th>Locked</th>
313
	        [% ELSE %]
337
              <th>Total</th>
314
	            <tr class="highlight">
338
              <th>Actions</th>
315
	        [% END %]
339
            </tr>
316
	        <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>
340
          </thead>
317
	        <td>[% period_loo.budget_period_startdate %]</td>
341
          <tbody>
318
	        <td>[% period_loo.budget_period_enddate %]</td>
342
              [% FOREACH period_active IN period_active_loop %]
319
	        <td>[% IF ( period_loo.budget_period_active ) %]<span style="color:green;">Active</span>&nbsp;[% ELSE %][% END %] </td>
343
                <tr>
320
	        <td> [% IF ( period_loo.budget_period_locked ) %]<span style="color:green;">Locked</span>&nbsp;[% ELSE %][% END %] </td>
344
                <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>
321
	        <td align='right'>[% period_loo.budget_period_total %]</td>
345
                <td>[% period_active.budget_period_startdate | $KohaDates %]</td>
322
	        <td>
346
                <td>[% period_active.budget_period_enddate | $KohaDates %]</td>
323
	            <a href="[% period_loo.script_name %]?op=add_form&amp;budget_period_id=[% period_loo.budget_period_id |html %]">Edit</a>
347
                <td>
324
	            <a href="[% period_loo.script_name %]?op=delete_confirm&amp;budget_period_id=[% period_loo.budget_period_id %]">Delete</a>
348
                  [% IF ( period_active.budget_period_locked ) %]
325
            <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_period_id=[% period_loo.budget_period_id %]">Add fund</a>
349
                    <span style="color:green;">Locked</span>&nbsp;
326
	        </td>
350
                  [% END %]
327
	        </tr>
351
                </td>
328
	    [% END %]
352
                <td align='right'>[% period_active.budget_period_total %]</td>
329
	    [% UNLESS ( period_loop ) %]
353
                <td>
330
    	<tr><td colspan="7">No budget</td></tr>
354
                  <a href="[% script_name %]?op=add_form&amp;budget_period_id=[% period_active.budget_period_id |html %]">Edit</a>
331
    	[% END %]
355
                  <a href="[% script_name %]?op=delete_confirm&amp;budget_period_id=[% period_active.budget_period_id %]">Delete</a>
332
    </tbody>
356
                  <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_period_id=[% period_active.budget_period_id %]">Add Fund</a>
333
    </table>
357
                </td>
334
    <div class="pages">[% pagination_bar %]</div>
358
                </tr>
359
              [% END %]
360
          </tbody>
361
        </table>
362
      [% ELSE %]
363
        No active budgets
364
      [% END %]
365
      <div class="paginationBar">[% active_pagination_bar %]</div>
366
    </div>
367
    <div id="inactive">
368
      <h3>Inactive Budgets</h3>
369
      [% IF ( period_inactive_loop ) %]
370
        <table id="inactiveperiodst">
371
          <thead>
372
              <tr>
373
                  <th>Budget name</th>
374
                  <th>Start date</th>
375
                  <th>End date</th>
376
                  <th>Locked</th>
377
                  <th>Total</th>
378
                  <th>Actions</th>
379
              </tr>
380
          </thead>
381
          <tbody>
382
              [% FOREACH period_loo IN period_inactive_loop %]
383
                  [% IF ( loop.odd ) %]
384
                      <tr>
385
                  [% ELSE %]
386
                      <tr class="highlight">
387
                  [% END %]
388
                  <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>
389
                  <td>[% period_loo.budget_period_startdate | $KohaDates %]</td>
390
                  <td>[% period_loo.budget_period_enddate | $KohaDates %]</td>
391
                  <td> [% IF ( period_loo.budget_period_locked ) %]<span style="color:green;">Locked</span>&nbsp;[% ELSE %][% END %] </td>
392
                  <td align='right'>[% period_loo.budget_period_total %]</td>
393
                  <td>
394
                      <a href="[% period_loo.script_name %]?op=add_form&amp;budget_period_id=[% period_loo.budget_period_id |html %]">Edit</a>
395
                      <a href="[% period_loo.script_name %]?op=delete_confirm&amp;budget_period_id=[% period_loo.budget_period_id %]">Delete</a>
396
                  <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_period_id=[% period_loo.budget_period_id %]">Add fund</a>
397
                  </td>
398
                  </tr>
399
              [% END %]
400
          </tbody>
401
        </table>
402
      [% ELSE %]
403
        No inactive budgets
404
      [% END %]
405
      <div class="pages">[% inactive_pagination_bar %]</div>
406
    </div>
407
  </div>
335
[% END %]
408
[% END %]
336
409
337
410
338
- 

Return to bug 8117