Bugzilla – Attachment 30405 Details for
Bug 766
Omnibus: Use of CGI::scrolling_list prevents customization in template
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 766: Remove CGI::scrollinglist from authorised_values.pl
Bug-766-Remove-CGIscrollinglist-from-authorisedval.patch (text/plain), 4.55 KB, created by
Bernardo Gonzalez Kriegel
on 2014-07-31 14:05:22 UTC
(
hide
)
Description:
Bug 766: Remove CGI::scrollinglist from authorised_values.pl
Filename:
MIME Type:
Creator:
Bernardo Gonzalez Kriegel
Created:
2014-07-31 14:05:22 UTC
Size:
4.55 KB
patch
obsolete
>From 959575b59ca94c88c0c7977d88fe35741f1c92bc Mon Sep 17 00:00:00 2001 >From: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >Date: Sat, 19 Jul 2014 00:22:12 -0300 >Subject: [PATCH] Bug 766: Remove CGI::scrollinglist from authorised_values.pl > >This patch removes the only instance in this file. >Also fixes array sorting, removes some tabs, removes >an unneeded $dbh handler (there is a global one). >Makes use of C4::Koha::GetAuthorisedValueCategories. > >To test: >1. Apply the patch >2. Go to Administration > Authorised values >3. Replaced pulldown next to 'Show category' must >show all (present & system) categories correctly ordered. >4. Select some and check for regressions, e.g. CCODE, Bsort2, YES_NO >no changes must be observed >--- > admin/authorised_values.pl | 32 +++++++++----------- > .../prog/en/modules/admin/authorised_values.tt | 14 ++++++++- > 2 files changed, 27 insertions(+), 19 deletions(-) > >diff --git a/admin/authorised_values.pl b/admin/authorised_values.pl >index 8a44256..35afaca 100755 >--- a/admin/authorised_values.pl >+++ b/admin/authorised_values.pl >@@ -237,12 +237,10 @@ exit 0; > > sub default_form { > # build categories list >- my $sth = $dbh->prepare("select distinct category from authorised_values"); >- $sth->execute; >- my @category_list; >+ my $category_list = C4::Koha::GetAuthorisedValueCategories(); >+ my @category_list = @{$category_list}; > my %categories; # a hash, to check that some hardcoded categories exist. >- while ( my ($category) = $sth->fetchrow_array ) { >- push( @category_list, $category ); >+ for my $category ( @category_list ) { > $categories{$category} = 1; > } > >@@ -252,23 +250,19 @@ sub default_form { > } > > #reorder the list >- @category_list = sort {$a cmp $b} @category_list; >- my $tab_list = CGI::scrolling_list(-name=>'searchfield', >- -id=>'searchfield', >- -values=> \@category_list, >- -default=>"", >- -size=>1, >- -multiple=>0, >- ); >+ @category_list = sort {lc($a) cmp lc($b)} @category_list; > if (!$searchfield) { > $searchfield=$category_list[0]; > } >+ my $tab_list = { >+ values => \@category_list, >+ default => $searchfield, >+ }; > my ($results) = AuthorizedValuesForCategory($searchfield); > my $count = scalar(@$results); > my @loop_data = (); > # builds value list >- my $dbh = C4::Context->dbh; >- $sth = $dbh->prepare("SELECT b.branchcode, b.branchname FROM authorised_values_branches AS avb, branches AS b WHERE avb.branchcode = b.branchcode AND avb.av_id = ?"); >+ my $sth = $dbh->prepare("SELECT b.branchcode, b.branchname FROM authorised_values_branches AS avb, branches AS b WHERE avb.branchcode = b.branchcode AND avb.av_id = ?"); > for (my $i=0; $i < $count; $i++){ > $sth->execute( $results->[$i]{id} ); > my @selected_branches; >@@ -287,8 +281,10 @@ sub default_form { > push(@loop_data, \%row_data); > } > >- $template->param( loop => \@loop_data, >- tab_list => $tab_list, >- category => $searchfield ); >+ $template->param( >+ loop => \@loop_data, >+ tab_list => $tab_list, >+ category => $searchfield, >+ ); > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt >index 9e96c34..2549a0f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt >@@ -194,7 +194,19 @@ $(document).ready(function() { > <div class="dialog alert">Could not add value "[% duplicate_value %]" for category "[% duplicate_category %]" — value already present. > </div> > [% END %] >-<form action="/cgi-bin/koha/admin/authorised_values.pl" method="post" id="category"><label for="searchfield">Show category: </label>[% tab_list %] <input type="submit" value="Submit" /></form> >+<form action="/cgi-bin/koha/admin/authorised_values.pl" method="post" id="category"> >+ <label for="searchfield">Show category: </label> >+ <select name="searchfield" id="searchfield" size="1"> >+ [% FOREACH value IN tab_list.values %] >+ [% IF ( value == tab_list.default ) %] >+ <option value="[% value %]" selected="selected">[% value %]</option> >+ [% ELSE %] >+ <option value="[% value %]">[% value %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ <input type="submit" value="Submit" /> >+</form> > [% IF ( category == 'Bsort1' ) %] > <p>An authorized value attached to patrons, that can be used for stats purposes</p> > [% END %] >-- >1.7.9.5
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 766
:
18538
|
18550
|
18664
|
25904
|
25905
|
25906
|
25907
|
26401
|
27010
|
27011
|
27012
|
27013
|
27014
|
27044
|
27045
|
27046
|
27047
|
27048
|
27396
|
27400
|
27441
|
27442
|
27443
|
27444
|
27445
|
27446
|
27447
|
27448
|
27479
|
27495
|
27665
|
27666
|
27667
|
27668
|
27669
|
27670
|
27671
|
29870
|
29871
|
29872
|
29877
|
30404
|
30405
|
30406
|
30428
|
30430
|
30432
|
30510
|
30511
|
30512