Bugzilla – Attachment 14726 Details for
Bug 9116
Code cleaning: Remove some useless temp variables
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
patch.txt (text/plain), 5.37 KB, created by
Marcel de Rooy
on 2013-01-20 17:11:45 UTC
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2013-01-20 17:11:45 UTC
Size:
5.37 KB
patch
obsolete
>From 4c4db17d1a8f41e3b216a660c2f008fb7631543c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 20 Nov 2012 15:57:13 +0100 >Subject: [PATCH] Bug 9116: Remove some useless tmp variables >Content-Type: text/plain; charset="utf-8" > >Some variables are useless in C4::Items::PrepareItemrecordDisplay. > >This patch removes its. > >Test plan: >Syspref AcqCreateItem = "receive an order" and try to receive an order. >Check there is no regression. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Items.pm | 38 ++++++++++++-------------------------- > 1 files changed, 12 insertions(+), 26 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index 012ec8a..dbd06b6 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -2645,52 +2645,39 @@ sub PrepareItemrecordDisplay { > $defaultvalue = $tagslib->{$tag}->{$subfield}->{defaultvalue} unless $defaultvalue; > if ( !defined $defaultvalue ) { > $defaultvalue = q||; >+ } else { >+ $defaultvalue =~ s/"/"/g; > } >- $defaultvalue =~ s/"/"/g; > > # search for itemcallnumber if applicable > if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber' > && C4::Context->preference('itemcallnumber') ) { > my $CNtag = substr( C4::Context->preference('itemcallnumber'), 0, 3 ); > my $CNsubfield = substr( C4::Context->preference('itemcallnumber'), 3, 1 ); >- if ($itemrecord) { >- my $temp = $itemrecord->field($CNtag); >- if ($temp) { >- $defaultvalue = $temp->subfield($CNsubfield); >- } >+ if ( $itemrecord and my $field = $itemrecord->field($CNtag) ) { >+ $defaultvalue = $field->subfield($CNsubfield); > } > } > if ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.itemcallnumber' > && $defaultvalues > && $defaultvalues->{'callnumber'} ) { >- my $temp; >- if ($itemrecord) { >- $temp = $itemrecord->field($subfield); >- } >- unless ($temp) { >- $defaultvalue = $defaultvalues->{'callnumber'} if $defaultvalues; >+ if( $itemrecord and $defaultvalues and not $itemrecord->field($subfield) ){ >+ $defaultvalue = $defaultvalues->{callnumber}; > } > } > if ( ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.holdingbranch' || $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.homebranch' ) > && $defaultvalues > && $defaultvalues->{'branchcode'} ) { >- my $temp; >- if ($itemrecord) { >- $temp = $itemrecord->field($subfield); >- } >- unless ($temp) { >- $defaultvalue = $defaultvalues->{branchcode} if $defaultvalues; >+ if ( $itemrecord and $defaultvalues and not $itemrecord->field($subfield) ) { >+ $defaultvalue = $defaultvalues->{branchcode}; > } > } > if ( ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.location' ) > && $defaultvalues > && $defaultvalues->{'location'} ) { > >- my $temp; # make perlcritic happy :) >- $temp = $itemrecord->field($subfield) if ($itemrecord); >- >- unless ($temp) { >- $defaultvalue = $defaultvalues->{location} if $defaultvalues; >+ if ( $itemrecord and $defaultvalues and not $itemrecord->field($subfield) ) { >+ $defaultvalue = $defaultvalues->{location}; > } > } > if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) { >@@ -2772,9 +2759,8 @@ sub PrepareItemrecordDisplay { > # opening plugin > my $plugin = C4::Context->intranetdir . "/cataloguing/value_builder/" . $tagslib->{$tag}->{$subfield}->{'value_builder'}; > if (do $plugin) { >- my $temp; >- my $extended_param = plugin_parameters( $dbh, $temp, $tagslib, $subfield_data{id}, undef ); >- my ( $function_name, $javascript ) = plugin_javascript( $dbh, $temp, $tagslib, $subfield_data{id}, undef ); >+ my $extended_param = plugin_parameters( $dbh, undef, $tagslib, $subfield_data{id}, undef ); >+ my ( $function_name, $javascript ) = plugin_javascript( $dbh, undef, $tagslib, $subfield_data{id}, undef ); > $subfield_data{random} = int(rand(1000000)); # why do we need 2 different randoms? > $subfield_data{marc_value} = qq[<input tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="67" maxlength="255" > onfocus="Focus$function_name($subfield_data{random}, '$subfield_data{id}');" >-- >1.7.7.6 >
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 9116
:
13557
|
13928
| 14726