Bugzilla – Attachment 9635 Details for
Bug 8117
Divide budget periods into two tabs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8117: Divide budget periods into two tabs
0001-Bug-8117-Divide-budget-periods-into-two-tabs.patch (text/plain), 12.58 KB, created by
Jonathan Druart
on 2012-05-18 10:40:30 UTC
(
hide
)
Description:
Bug 8117: Divide budget periods into two tabs
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2012-05-18 10:40:30 UTC
Size:
12.58 KB
patch
obsolete
>From 1186aa54171303c4e9979d0af96a60429e920738 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Fri, 18 May 2012 12:02:25 +0200 >Subject: [PATCH 1/1] Bug 8117: Divide budget periods into two tabs > >Budget periods are now divided into two tabs : active and inactive >budget periods. > >The original author of this patch is Julian Maurice >--- > admin/aqbudgetperiods.pl | 73 ++++++--- > .../prog/en/modules/admin/aqbudgetperiods.tt | 171 ++++++++++++++------ > 2 files changed, 172 insertions(+), 72 deletions(-) > >diff --git a/admin/aqbudgetperiods.pl b/admin/aqbudgetperiods.pl >index 64b333a..c2d2441 100755 >--- a/admin/aqbudgetperiods.pl >+++ b/admin/aqbudgetperiods.pl >@@ -72,7 +72,8 @@ my $budget_period_hashref= $input->Vars; > #my $sort1_authcat = $input->param('sort1_authcat'); > #my $sort2_authcat = $input->param('sort2_authcat'); > >-my $pagesize = 20; >+my $activepagesize = 20; >+my $inactivepagesize = 20; > $searchfield =~ s/\,//g; > > my ($template, $borrowernumber, $cookie, $staff_flags ) = get_template_and_user( >@@ -245,27 +246,57 @@ elsif ( $op eq 'duplicate_budget' ){ > # DEFAULT - DISPLAY AQPERIODS TABLE > # ------------------------------------------------------------------- > # display the list of budget periods >- my $results = GetBudgetPeriods(); >- $template->param( period_button_only => 1 ) unless (@$results) ; >- my $page = $input->param('page') || 1; >- my $first = ( $page - 1 ) * $pagesize; >- # if we are on the last page, the number of the last word to display >- # must not exceed the length of the results array >- my $last = min( $first + $pagesize - 1, scalar @{$results} - 1, ); >- my $toggle = 0; >- my @period_loop; >- foreach my $result ( @{$results}[ $first .. $last ] ) { >- my $budgetperiod = $result; >- FormatData($budgetperiod); >- $budgetperiod->{'budget_period_total'} = $num->format_price( $budgetperiod->{'budget_period_total'} ); >- $budgetperiod->{budget_active} = 1; >- push( @period_loop, $budgetperiod ); >- } > >- $template->param( >- period_loop => \@period_loop, >- pagination_bar => pagination_bar("aqbudgetperiods.pl",getnbpages(scalar(@$results),$pagesize),$page), >- ); >+my $activepage = $input->param('apage') || 1; >+my $inactivepage = $input->param('ipage') || 1; >+# Get active budget periods >+my $results = GetBudgetPeriods( >+ {budget_period_active => 1}, >+ [{budget_period_description => 0}] >+); >+my $first = ( $activepage - 1 ) * $activepagesize; >+my $last = min( $first + $activepagesize - 1, scalar @{$results} - 1, ); >+my @period_active_loop; >+ >+foreach my $result ( @{$results}[ $first .. $last ] ) { >+ my $budgetperiod = $result; >+ FormatData($budgetperiod); >+ $budgetperiod->{'budget_period_total'} = $num->format_price( $budgetperiod->{'budget_period_total'} ); >+ $budgetperiod->{budget_active} = 1; >+ push( @period_active_loop, $budgetperiod ); >+} >+my $url = "aqbudgetperiods.pl"; >+$url .= "?ipage=$inactivepage" if($inactivepage != 1); >+my $active_pagination_bar = pagination_bar ($url, getnbpages( scalar(@$results), $activepagesize), $activepage, "apage"); >+ >+# Get inactive budget periods >+$results = GetBudgetPeriods( >+ {budget_period_active => 0}, >+ [{budget_period_enddate => 1}] >+); >+my $first = ( $inactivepage - 1 ) * $inactivepagesize; >+my $last = min( $first + $inactivepagesize - 1, scalar @{$results} - 1, ); >+my @period_inactive_loop; >+foreach my $result ( @{$results}[ $first .. $last ] ) { >+ my $budgetperiod = $result; >+ FormatData($budgetperiod); >+ $budgetperiod->{'budget_period_total'} = $num->format_price( $budgetperiod->{'budget_period_total'} ); >+ $budgetperiod->{budget_active} = 1; >+ push( @period_inactive_loop, $budgetperiod ); >+} >+$url = "aqbudgetperiods.pl?tab=2"; >+$url .= "&apage=$activepage" if($activepage != 1); >+my $inactive_pagination_bar = pagination_bar ($url, getnbpages( scalar(@$results), $inactivepagesize), $inactivepage, "ipage"); >+ >+my $tab = $input->param('tab') ? $input->param('tab') - 1 : 0; >+$template->param( >+ period_active_loop => \@period_active_loop, >+ period_inactive_loop => \@period_inactive_loop, >+ active_pagination_bar => $active_pagination_bar, >+ inactive_pagination_bar => $inactive_pagination_bar, >+ tab => $tab, >+ dateformat => C4::Context->preference('dateformat'), >+); > > $template->param($op=>1); > output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt >index aae5925..81d860f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt >@@ -1,9 +1,11 @@ > [% INCLUDE 'doc-head-open.inc' %] >+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> > [% INCLUDE 'doc-head-close.inc' %] > [% INCLUDE 'calendar.inc' %] >- >+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script> >+[% INCLUDE 'datatables-strings.inc' %] >+<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script> > <script type="text/javascript" src="[% themelang %]/js/acq.js"></script> >-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script> > <script type="text/javascript"> > // ################################################################################# > // Javascript >@@ -70,13 +72,33 @@ > alert(alertString2); > } > } >- $(document).ready(function() { >- $("#periodsh").tablesorter({ >- widgets : ['zebra'], >- sortList: [[0,0]], >- headers: {6:{sorter:false}} >- }); >- }); >+ >+ >+ >+ [% IF ( dateformat == 'metric' ) %] >+ dt_add_type_uk_date(); >+ [% END %] >+ $(document).ready(function() { >+ var tabs = $('#budgetsTabs > ul').tabs(); >+ [% IF ( tab ) %] >+ tabs.tabs('select', [% tab %]); >+ [% END %] >+ $("table").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { >+ [% IF ( dateformat == 'metric' ) %] >+ "aTargets": [ 1, 2 ], "sType": "uk_date", >+ [% END %] >+ "bSortable": false, 'aTargets':['_all'], >+ }, >+ ], >+ "sPaginationType": "four_button", >+ "bAutoWidth": false, >+ "bPaginate": false, >+ "bInfo": false, >+ "bFilter": false, >+ } ) ); >+ }); > </script> > > <title> >@@ -327,48 +349,95 @@ > [% END %] > <!-- DEFAULT display budget periods list --> > [% IF ( else ) %] >- <h2>Budgets administration</h2> >- >- [% INCLUDE 'budgets-active-currency.inc' %] >- >- <table id="periodsh"> >- <thead> >- <tr> >- <th>Budget name</th> >- <th>Start date</th> >- <th>End date</th> >- <th>Active</th> >- <th>Locked</th> >- <th>Total</th> >- <th>Actions</th> >- </tr> >- </thead> >- <tbody> >- [% FOREACH period_loo IN period_loop %] >- [% IF ( loop.odd ) %] >- <tr> >- [% ELSE %] >- <tr class="highlight"> >- [% END %] >- <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> >- <td>[% period_loo.budget_period_startdate %]</td> >- <td>[% period_loo.budget_period_enddate %]</td> >- <td>[% IF ( period_loo.budget_period_active ) %]<span style="color:green;">Active</span> [% ELSE %][% END %] </td> >- <td> [% IF ( period_loo.budget_period_locked ) %]<span style="color:green;">Locked</span> [% ELSE %][% END %] </td> >- <td align='right'>[% period_loo.budget_period_total %]</td> >- <td> >- <a href="[% period_loo.script_name %]?op=add_form&budget_period_id=[% period_loo.budget_period_id |html %]">Edit</a> >- <a href="[% period_loo.script_name %]?op=delete_confirm&budget_period_id=[% period_loo.budget_period_id %]">Delete</a> >- <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_period_id=[% period_loo.budget_period_id %]">Add fund</a> >- </td> >- </tr> >- [% END %] >- [% UNLESS ( period_loop ) %] >- <tr><td colspan="7">No budget</td></tr> >- [% END %] >- </tbody> >- </table> >- <div class="pages">[% pagination_bar %]</div> >+ <h2>Budgets administration</h2> >+ >+ [% INCLUDE 'budgets-active-currency.inc' %] >+ >+ <div id="budgetsTabs" class="toptabs"> >+ <ul> >+ <li><a href="/cgi-bin/koha/admin/aqbudgetperiods.pl#active">Active Budgets</a></li> >+ <li><a href="/cgi-bin/koha/admin/aqbudgetperiods.pl#inactive">Inactive Budgets</a></li> >+ </ul> >+ >+ <div id="active"> >+ <h3>Active Budgets</h3> >+ <table id="activeperiodst"> >+ <thead> >+ <tr> >+ <th>Budget Name</th> >+ <th>Start Date</th> >+ <th>End Date</th> >+ <th>Locked</th> >+ <th>Total</th> >+ <th>Actions</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH period_active IN period_active_loop %] >+ <tr> >+ <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> >+ <td>[% period_active.budget_period_startdate %]</td> >+ <td>[% period_active.budget_period_enddate %]</td> >+ <td> >+ [% IF ( period_active.budget_period_locked ) %] >+ <span style="color:green;">Locked</span> >+ [% END %] >+ </td> >+ <td align='right'>[% period_active.budget_period_total %]</td> >+ <td> >+ <a href="[% script_name %]?op=add_form&budget_period_id=[% period_active.budget_period_id |html %]">Edit</a> >+ <a href="[% script_name %]?op=delete_confirm&budget_period_id=[% period_active.budget_period_id %]">Delete</a> >+ <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_period_id=[% period_active.budget_period_id %]">Add Fund</a> >+ </td> >+ </tr> >+ [% END %] >+ [% UNLESS ( period_active_loop ) %] >+ <tr><td colspan="7">No budget</td></tr> >+ [% END %] >+ </tbody> >+ </table> >+ <div class="paginationBar">[% active_pagination_bar %]</div> >+ </div> >+ <div id="inactive"> >+ <h3>Inactive Budgets</h3> >+ <table id="inactiveperiodst"> >+ <thead> >+ <tr> >+ <th>Budget name</th> >+ <th>Start date</th> >+ <th>End date</th> >+ <th>Locked</th> >+ <th>Total</th> >+ <th>Actions</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH period_loo IN period_inactive_loop %] >+ [% IF ( loop.odd ) %] >+ <tr> >+ [% ELSE %] >+ <tr class="highlight"> >+ [% END %] >+ <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> >+ <td>[% period_loo.budget_period_startdate %]</td> >+ <td>[% period_loo.budget_period_enddate %]</td> >+ <td> [% IF ( period_loo.budget_period_locked ) %]<span style="color:green;">Locked</span> [% ELSE %][% END %] </td> >+ <td align='right'>[% period_loo.budget_period_total %]</td> >+ <td> >+ <a href="[% period_loo.script_name %]?op=add_form&budget_period_id=[% period_loo.budget_period_id |html %]">Edit</a> >+ <a href="[% period_loo.script_name %]?op=delete_confirm&budget_period_id=[% period_loo.budget_period_id %]">Delete</a> >+ <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_period_id=[% period_loo.budget_period_id %]">Add fund</a> >+ </td> >+ </tr> >+ [% END %] >+ [% UNLESS ( period_inactive_loop ) %] >+ <tr><td colspan="7">No budget</td></tr> >+ [% END %] >+ </tbody> >+ </table> >+ <div class="pages">[% inactive_pagination_bar %]</div> >+ </div> >+ </div> > [% END %] > > >-- >1.7.7.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8117
:
9634
|
9635
|
10138
|
10160
|
10161
|
10178
|
10179
|
10180
|
10231
|
10235
|
11047
|
11052
|
11325
|
13713
|
13727
|
13821