Bugzilla – Attachment 18259 Details for
Bug 10291
Misleading Variable names in batchMod.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch
0001-Bug-10291-Clarify-misleading-variable-names.patch (text/plain), 4.38 KB, created by
Colin Campbell
on 2013-05-20 16:03:57 UTC
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Colin Campbell
Created:
2013-05-20 16:03:57 UTC
Size:
4.38 KB
patch
obsolete
>From dfeae8f3fa4befef31b540efe320c6b98e399157 Mon Sep 17 00:00:00 2001 >From: Colin Campbell <colin.campbell@ptfs-europe.com> >Date: Mon, 20 May 2013 16:54:53 +0100 >Subject: [PATCH] Bug 10291: Clarify misleading variable names > >Two variables in batchMod.pl have names incorporating >'hashref' neither is a hashref both contain references >tp arrays of hashrefs. The misnomer is propaged into >the templates by passing one under a similar name. >Save future developers/maintainers a minute or two >by changing to less inaccurate names >--- > .../intranet-tmpl/prog/en/modules/tools/batchMod-del.tt | 4 ++-- > .../intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt | 4 ++-- > tools/batchMod.pl | 12 ++++++------ > 3 files changed, 10 insertions(+), 10 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt >index 5404f02..9bbef2d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt >@@ -119,8 +119,8 @@ for( x=0; x<allColumns.length; x++ ){ > > [% IF ( too_many_items ) %] > <p>Too many items ([% too_many_items %]) to display individually.</p> >- [% FOREACH itemnumbers_hashre IN itemnumbers_hashref %] >- <input type="hidden" name="itemnumber" value="[% itemnumbers_hashre.itemnumber %]" /> >+ [% FOREACH item IN itemnumbers_array %] >+ <input type="hidden" name="itemnumber" value="[% item.itemnumber %]" /> > [% END %] > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt >index 85a8db9..3997f2f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt >@@ -141,8 +141,8 @@ $(document).ready(function(){ > > [% IF ( too_many_items ) %] > <p>Too many items ([% too_many_items %]): not displaying each one individually.</p> >- [% FOREACH itemnumbers_hashre IN itemnumbers_hashref %] >- <input type="hidden" name="itemnumber" value="[% itemnumbers_hashre.itemnumber %]" /> >+ [% FOREACH item IN itemnumbers_array %] >+ <input type="hidden" name="itemnumber" value="[% item.itemnumber %]" /> > [% END %] > [% END %]<!-- /too_many_items --> > >diff --git a/tools/batchMod.pl b/tools/batchMod.pl >index e416d44..b8a85e1 100755 >--- a/tools/batchMod.pl >+++ b/tools/batchMod.pl >@@ -77,7 +77,7 @@ $template->param(del => $del); > my $itemrecord; > my $nextop=""; > my @errors; # store errors found while checking data BEFORE saving item. >-my $items_display_hashref; >+my $items_display_refs; > my $frameworkcode=""; > my $tagslib = &GetMarcStructure(1,$frameworkcode); > >@@ -111,7 +111,7 @@ if ($op eq "action") { > if ($completedJobID) { > # If we have a reasonable amount of items, we display them > if (scalar(@itemnumbers) <= 1000) { >- $items_display_hashref=BuildItemsData(@itemnumbers); >+ $items_display_refs=BuildItemsData(@itemnumbers); > } else { > # Else, we only display the barcode > my @simple_items_display = map {{ itemnumber => $_, barcode => (GetBarcodeFromItemnumber($_) or ""), biblionumber => (GetBiblionumberFromItemnumber($_) or "") }} @itemnumbers; >@@ -257,12 +257,12 @@ if ($op eq "show"){ > if(scalar(@itemnumbers) > 0){ $template->param("itemresults" => 1); } > # Only display the items if there are no more than 1000 > if (scalar(@itemnumbers) <= 1000) { >- $items_display_hashref=BuildItemsData(@itemnumbers); >+ $items_display_refs=BuildItemsData(@itemnumbers); > } else { > $template->param("too_many_items" => scalar(@itemnumbers)); > # Even if we do not display the items, we need the itemnumbers >- my @itemnumbers_hashref = map {{itemnumber => $_}} @itemnumbers; >- $template->param("itemnumbers_hashref" => \@itemnumbers_hashref); >+ my @itemnumbers_arr = map {{itemnumber => $_}} @itemnumbers; >+ $template->param("itemnumbers_array" => \@itemnumbers_arr); > } > # now, build the item form for entering a new item > my @loop_data =(); >@@ -447,7 +447,7 @@ $authorised_values_sth->finish; > $nextop="action" > } # -- End action="show" > >-$template->param(%$items_display_hashref) if $items_display_hashref; >+$template->param(%{$items_display_refs}) if $items_display_refs; > $template->param( > op => $nextop, > ); >-- >1.8.3.rc2 >
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 10291
:
18259
|
18629
|
18634
|
19076