[Koha-patches] [PATCH] Bug 10291: Clarify misleading variable names
Colin Campbell
colin.campbell at ptfs-europe.com
Mon May 20 18:07:07 CEST 2013
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
More information about the Koha-patches
mailing list