Bugzilla – Attachment 30507 Details for
Bug 12675
Remove CGI::scrolling_list from labeledMARCdetail.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 12675: Remove CGI::scrolling_list from labeledMARCdetail.pl
PASSED-QA-Bug-12675-Remove-CGIscrollinglist-from-l.patch (text/plain), 7.72 KB, created by
Katrin Fischer
on 2014-08-03 09:50:37 UTC
(
hide
)
Description:
[PASSED QA] Bug 12675: Remove CGI::scrolling_list from labeledMARCdetail.pl
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2014-08-03 09:50:37 UTC
Size:
7.72 KB
patch
obsolete
>From 89894369e8b0ba4ecface14557231aa1eae454f0 Mon Sep 17 00:00:00 2001 >From: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >Date: Tue, 29 Jul 2014 15:49:44 -0300 >Subject: [PATCH] [PASSED QA] Bug 12675: Remove CGI::scrolling_list from > labeledMARCdetail.pl > >This patch removes only instance in this file. > >Also updates getframework POD on C4/Koha.pm, >adds new GetFrameworksLoop() func on same file from >suggested code, but with ordered result. > >To test: >1. Apply the patch >2. Enable viewLabeledMARC syspref >3. On staff, search for a record, goto detail view >4. Clic on Labeled MARC >5. Framework pulldown was replaced, check changing >framework. > >A bug was fixed, because selecting any fw and then Default >tries to load values from 'Default' fw code, which does not >exists. > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >Works as described, passes tests and QA script. >--- > C4/Koha.pm | 71 +++++++++++++++++++--- > catalogue/labeledMARCdetail.pl | 27 +------- > .../prog/en/modules/catalogue/labeledMARCdetail.tt | 13 +++- > 3 files changed, 78 insertions(+), 33 deletions(-) > >diff --git a/C4/Koha.pm b/C4/Koha.pm >index 6f98ac6..ee4bd67 100644 >--- a/C4/Koha.pm >+++ b/C4/Koha.pm >@@ -46,6 +46,7 @@ BEGIN { > &GetSupportName &GetSupportList > &get_itemtypeinfos_of > &getframeworks &getframeworkinfo >+ &GetFrameworksLoop > &getauthtypes &getauthtype > &getallthemes > &getFacets >@@ -363,12 +364,13 @@ build a HTML select with the following code : > > =head3 in PERL SCRIPT > >- my $frameworks = frameworks(); >+ my $frameworks = getframeworks(); > my @frameworkloop; > foreach my $thisframework (keys %$frameworks) { > my $selected = 1 if $thisframework eq $frameworkcode; >- my %row =(value => $thisframework, >- selected => $selected, >+ my %row =( >+ value => $thisframework, >+ selected => $selected, > description => $frameworks->{$thisframework}->{'frameworktext'}, > ); > push @frameworksloop, \%row; >@@ -377,14 +379,18 @@ build a HTML select with the following code : > > =head3 in TEMPLATE > >- <form action='<!-- TMPL_VAR name="script_name" -->' method=post> >+ <form action="[% script_name %] method=post> > <select name="frameworkcode"> > <option value="">Default</option> >- <!-- TMPL_LOOP name="frameworkloop" --> >- <option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="frameworktext" --></option> >- <!-- /TMPL_LOOP --> >+ [% FOREACH framework IN frameworkloop %] >+ [% IF ( framework.selected ) %] >+ <option value="[% framework.value %]" selected="selected">[% framework.description %]</option> >+ [% ELSE %] >+ <option value="[% framework.value %]">[% framework.description %]</option> >+ [% END %] >+ [% END %] > </select> >- <input type=text name=searchfield value="<!-- TMPL_VAR name="searchfield" -->"> >+ <input type=text name=searchfield value="[% searchfield %]"> > <input type="submit" value="OK" class="button"> > </form> > >@@ -403,6 +409,55 @@ sub getframeworks { > return ( \%itemtypes ); > } > >+=head2 GetFrameworksLoop >+ >+ $frameworks = GetFrameworksLoop( $frameworkcode ); >+ >+Returns the loop suggested on getframework(), but ordered by framework description. >+ >+build a HTML select with the following code : >+ >+=head3 in PERL SCRIPT >+ >+ $template->param( frameworkloop => GetFrameworksLoop( $frameworkcode ) ); >+ >+=head3 in TEMPLATE >+ >+ Same as getframework() >+ >+ <form action="[% script_name %] method=post> >+ <select name="frameworkcode"> >+ <option value="">Default</option> >+ [% FOREACH framework IN frameworkloop %] >+ [% IF ( framework.selected ) %] >+ <option value="[% framework.value %]" selected="selected">[% framework.description %]</option> >+ [% ELSE %] >+ <option value="[% framework.value %]">[% framework.description %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ <input type=text name=searchfield value="[% searchfield %]"> >+ <input type="submit" value="OK" class="button"> >+ </form> >+ >+=cut >+ >+sub GetFrameworksLoop { >+ my $frameworkcode = shift; >+ my $frameworks = getframeworks(); >+ my @frameworkloop; >+ foreach my $thisframework (sort { uc($frameworks->{$a}->{'frameworktext'}) cmp uc($frameworks->{$b}->{'frameworktext'}) } keys %$frameworks) { >+ my $selected = ( $thisframework eq $frameworkcode ) ? 1 : undef; >+ my %row = ( >+ value => $thisframework, >+ selected => $selected, >+ description => $frameworks->{$thisframework}->{'frameworktext'}, >+ ); >+ push @frameworkloop, \%row; >+ } >+ return \@frameworkloop; >+} >+ > =head2 getframeworkinfo > > $frameworkinfo = &getframeworkinfo($frameworkcode); >diff --git a/catalogue/labeledMARCdetail.pl b/catalogue/labeledMARCdetail.pl >index 66c0f74..11f8f85 100755 >--- a/catalogue/labeledMARCdetail.pl >+++ b/catalogue/labeledMARCdetail.pl >@@ -29,6 +29,7 @@ use C4::Items; > use C4::Members; # to use GetMember > use C4::Search; # enabled_staff_search_views > use C4::Acquisition qw(GetOrdersByBiblionumber); >+use C4::Koha qw( GetFrameworksLoop ); > > my $query = new CGI; > my $dbh = C4::Context->dbh; >@@ -79,30 +80,8 @@ my $itemcount = GetItemsCount($biblionumber); > $template->param( count => $itemcount, > bibliotitle => $biblio->{title}, ); > >-#Getting the list of all frameworks >-my $queryfwk = >- $dbh->prepare("select frameworktext, frameworkcode from biblio_framework"); >-$queryfwk->execute; >-my %select_fwk; >-my @select_fwk; >-my $curfwk; >-push @select_fwk, "Default"; >-$select_fwk{"Default"} = "Default"; >- >-while ( my ( $description, $fwk ) = $queryfwk->fetchrow ) { >- push @select_fwk, $fwk; >- $select_fwk{$fwk} = $description; >-} >-$curfwk=$frameworkcode; >-my $framework=CGI::scrolling_list( -name => 'Frameworks', >- -id => 'Frameworks', >- -default => $curfwk, >- -OnChange => 'Changefwk(this);', >- -values => \@select_fwk, >- -labels => \%select_fwk, >- -size => 1, >- -multiple => 0 ); >-$template->param(framework => $framework); >+#Getting framework loop >+$template->param(frameworkloop => GetFrameworksLoop( $frameworkcode ) ); > > my @marc_data; > my $prevlabel = ''; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/labeledMARCdetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/labeledMARCdetail.tt >index 882a90c..957f6ce 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/labeledMARCdetail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/labeledMARCdetail.tt >@@ -57,7 +57,18 @@ > [% UNLESS ( popup ) %] > <h1>Labeled MARC biblio : [% biblionumber %] ( [% bibliotitle %] )</h1> > [% END %] >- <p><b>With framework :[% framework %]</b></p> >+ <p><b>With framework: >+ <select name="Frameworks" id="Frameworks" size="1" onchange="Changefwk(this);"> >+ <option value="">Default</option> >+ [% FOREACH framework IN frameworkloop %] >+ [% IF ( framework.selected ) %] >+ <option value="[% framework.value %]" selected="selected">[% framework.description %]</option> >+ [% ELSE %] >+ <option value="[% framework.value %]">[% framework.description %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </b></p> > <!-- div id="bibliotabs" class="toptabs numbered" --> > <div> > <table class="labeledmarc-table"> >-- >1.9.1
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 12675
:
30306
|
30408
|
30409
|
30413
|
30436
|
30437
|
30505
| 30507 |
30508