Bugzilla – Attachment 64584 Details for
Bug 17843
Move C4::Koha::getitemtypeinfo to Koha::ItemTypes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17843: [QA Follow-up] Some polishing
Bug-17843-QA-Follow-up-Some-polishing.patch (text/plain), 5.15 KB, created by
Marcel de Rooy
on 2017-06-23 09:51:20 UTC
(
hide
)
Description:
Bug 17843: [QA Follow-up] Some polishing
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-06-23 09:51:20 UTC
Size:
5.15 KB
patch
obsolete
>From f8fcc93f82b7ba02deffefe4ecddc156a3b66178 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 23 Jun 2017 10:43:16 +0200 >Subject: [PATCH] Bug 17843: [QA Follow-up] Some polishing >Content-Type: text/plain; charset=utf-8 > >Resolve warning from members/summary-print.pl: > "my" variable $itemtype masks earlier declaration in same scope > >Test if find returns a Koha object in GetDescription. >Test if find returns a Koha object too in shelves.pl. While testing, I had >a crash on a biblioitem with itemtype NULL (bad record, but these things >tend to happen somehow.) >Can't call method "imageurl" on an undefined value at virtualshelves/shelves.pl line 253. >Same for opac/opac-shelves.pl. > >Note: Did not add tests everywhere but generally, I have the impression that >we do not sufficiently test on the results of Koha::Object->find. Mostly we >just assume that it will find a record. Several reports include fixes to >resolve that wrong assumption. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Template/Plugin/ItemTypes.pm | 5 +++-- > members/summary-print.pl | 2 +- > opac/opac-shelves.pl | 8 +++++--- > virtualshelves/shelves.pl | 6 +++--- > 4 files changed, 12 insertions(+), 9 deletions(-) > >diff --git a/Koha/Template/Plugin/ItemTypes.pm b/Koha/Template/Plugin/ItemTypes.pm >index 74ccacc..2091056 100644 >--- a/Koha/Template/Plugin/ItemTypes.pm >+++ b/Koha/Template/Plugin/ItemTypes.pm >@@ -25,8 +25,9 @@ use base qw( Template::Plugin ); > use Koha::ItemTypes; > > sub GetDescription { >- my ( $self, $itemtype ) = @_; >- return Koha::ItemTypes->find( $itemtype )->translated_description; >+ my ( $self, $itemtypecode ) = @_; >+ my $itemtype = Koha::ItemTypes->find( $itemtypecode ); >+ return $itemtype ? $itemtype->translated_description : q{}; > } > > sub Get { >diff --git a/members/summary-print.pl b/members/summary-print.pl >index 2d5eb47..a3d438c 100755 >--- a/members/summary-print.pl >+++ b/members/summary-print.pl >@@ -94,7 +94,7 @@ sub build_issue_data { > my ( $charge, $itemtype ) = > GetIssuingCharges( $issue->{itemnumber}, $borrowernumber ); > >- my $itemtype = Koha::ItemTypes->find( $itemtype ); >+ $itemtype = Koha::ItemTypes->find( $itemtype ); > $row{'itemtype_description'} = $itemtype->description; #FIXME Should not it be translated_description > > $row{'charge'} = sprintf( "%.2f", $charge ); >diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl >index 2dad56e..9a0c3f2 100755 >--- a/opac/opac-shelves.pl >+++ b/opac/opac-shelves.pl >@@ -282,9 +282,11 @@ if ( $op eq 'view' ) { > my $marcflavour = C4::Context->preference("marcflavour"); > my $itemtype = Koha::Biblioitems->search({ biblionumber => $content->biblionumber })->next->itemtype; > $itemtype = Koha::ItemTypes->find( $itemtype ); >- $this_item->{imageurl} = C4::Koha::getitemtypeimagelocation( 'opac', $itemtype->imageurl ); >- $this_item->{description} = $itemtype->description; #FIXME Should not it be translated_description? >- $this_item->{notforloan} = $itemtype->notforloan; >+ if( $itemtype ) { >+ $this_item->{imageurl} = C4::Koha::getitemtypeimagelocation( 'opac', $itemtype->imageurl ); >+ $this_item->{description} = $itemtype->description; #FIXME Should not it be translated_description? >+ $this_item->{notforloan} = $itemtype->notforloan; >+ } > $this_item->{'coins'} = GetCOinSBiblio($record); > $this_item->{'subtitle'} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $biblionumber ) ); > $this_item->{'normalized_upc'} = GetNormalizedUPC( $record, $marcflavour ); >diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl >index 8feaed4..043bd8a 100755 >--- a/virtualshelves/shelves.pl >+++ b/virtualshelves/shelves.pl >@@ -250,9 +250,9 @@ if ( $op eq 'view' ) { > $this_item->{title} = $biblio->title; > $this_item->{author} = $biblio->author; > $this_item->{dateadded} = $content->dateadded; >- $this_item->{imageurl} = C4::Koha::getitemtypeimagelocation( 'intranet', $itemtype->imageurl ); >- $this_item->{description} = $itemtype->description; #FIXME Should not it be translated_description >- $this_item->{notforloan} = $itemtype->notforloan; >+ $this_item->{imageurl} = $itemtype ? C4::Koha::getitemtypeimagelocation( 'intranet', $itemtype->imageurl ) : q{}; >+ $this_item->{description} = $itemtype ? $itemtype->description : q{}; #FIXME Should this be translated_description ? >+ $this_item->{notforloan} = $itemtype->notforloan if $itemtype; > $this_item->{'coins'} = GetCOinSBiblio($record); > $this_item->{'subtitle'} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $biblionumber ) ); > $this_item->{'normalized_upc'} = GetNormalizedUPC( $record, $marcflavour ); >-- >2.1.4
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 17843
:
58583
|
58584
|
61972
|
61973
|
62266
|
62267
|
64400
|
64401
|
64582
|
64583
| 64584