From a244ff667199445ef5e81d5c8f976b34f5ac17b9 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 8 Jun 2009 10:02:42 +1200 Subject: [PATCH] bug 2505: turn on warnings in seven modules C4::XSLT C4::VirtualShelves C4::Review C4::Output C4::Boolean C4::Charset C4::Stats Signed-off-by: Chris Cormack Signed-off-by: Galen Charlton --- C4/Boolean.pm | 2 ++ C4/Charset.pm | 2 ++ C4/Output.pm | 1 + C4/Review.pm | 2 ++ C4/Stats.pm | 2 +- C4/VirtualShelves.pm | 2 ++ C4/XSLT.pm | 18 ++++++++++-------- 7 files changed, 20 insertions(+), 9 deletions(-) diff --git a/C4/Boolean.pm b/C4/Boolean.pm index c9259df035..934a64f22c 100644 --- a/C4/Boolean.pm +++ b/C4/Boolean.pm @@ -22,6 +22,8 @@ package C4::Boolean; # Suite 330, Boston, MA 02111-1307 USA use strict; +use warnings; + use POSIX; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK); diff --git a/C4/Charset.pm b/C4/Charset.pm index 5c5e7ce2dd..bbeef2424e 100644 --- a/C4/Charset.pm +++ b/C4/Charset.pm @@ -18,6 +18,8 @@ package C4::Charset; # Suite 330, Boston, MA 02111-1307 USA use strict; +use warnings; + use MARC::Charset qw/marc8_to_utf8/; use Text::Iconv; diff --git a/C4/Output.pm b/C4/Output.pm index fb87e0f90c..5bebf6c0c6 100644 --- a/C4/Output.pm +++ b/C4/Output.pm @@ -26,6 +26,7 @@ package C4::Output; # templates. use strict; +use warnings; use C4::Context; use C4::Languages qw(getTranslatedLanguages get_bidi regex_lang_subtags language_get_description accept_language ); diff --git a/C4/Review.pm b/C4/Review.pm index e08d24ccc5..e3abaf713d 100644 --- a/C4/Review.pm +++ b/C4/Review.pm @@ -18,6 +18,8 @@ package C4::Review; # Suite 330, Boston, MA 02111-1307 USA use strict; +use warnings; + use C4::Context; use vars qw($VERSION @ISA @EXPORT); diff --git a/C4/Stats.pm b/C4/Stats.pm index 77d5d1442b..b4875aa780 100644 --- a/C4/Stats.pm +++ b/C4/Stats.pm @@ -19,7 +19,7 @@ package C4::Stats; # Suite 330, Boston, MA 02111-1307 USA use strict; -#use warnings; # FIXME +use warnings; require Exporter; use C4::Context; use C4::Debug; diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm index b3e5b26ced..31dcdb76b5 100644 --- a/C4/VirtualShelves.pm +++ b/C4/VirtualShelves.pm @@ -22,6 +22,8 @@ package C4::VirtualShelves; # Suite 330, Boston, MA 02111-1307 USA use strict; +use warnings; + use Carp; use C4::Context; use C4::Circulation; diff --git a/C4/XSLT.pm b/C4/XSLT.pm index edba9bfc34..76e7ea7bfb 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -17,6 +17,9 @@ package C4::XSLT; # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, # Suite 330, Boston, MA 02111-1307 USA +use strict; +use warnings; + use C4::Context; use C4::Branch; use C4::Items; @@ -27,8 +30,6 @@ use Encode; use XML::LibXML; use XML::LibXSLT; -use strict; - use vars qw($VERSION @ISA @EXPORT); BEGIN { @@ -147,15 +148,14 @@ sub buildKohaItemsNamespace { my @items = C4::Items::GetItemsInfo($biblionumber); my $branches = GetBranches(); my $itemtypes = GetItemTypes(); - - my $xml; + my $xml = ''; for my $item (@items) { my $status; my ( $transfertwhen, $transfertfrom, $transfertto ) = C4::Circulation::GetTransfers($item->{itemnumber}); - if ( $itemtypes->{ $item->{itype} }->{notforloan} == 1 || $item->{notforloan} || $item->{onloan} || $item->{wthdrawn} || $item->{itemlost} || $item->{damaged} || - ($transfertwhen ne '') || $item->{itemnotforloan} ) { + if ( $itemtypes->{ $item->{itype} }->{notforloan} || $item->{notforloan} || $item->{onloan} || $item->{wthdrawn} || $item->{itemlost} || $item->{damaged} || + (defined $transfertwhen && $transfertwhen ne '') || $item->{itemnotforloan} ) { if ( $item->{notforloan} < 0) { $status = "On order"; } @@ -174,7 +174,7 @@ sub buildKohaItemsNamespace { if ($item->{damaged}) { $status = "Damaged"; } - if ($transfertwhen ne '') { + if (defined $transfertwhen && $transfertwhen ne '') { $status = 'In transit'; } } else { @@ -183,7 +183,9 @@ sub buildKohaItemsNamespace { my $homebranch = $branches->{$item->{homebranch}}->{'branchname'}; $xml.= "$homebranch". "$status". - "".$item->{'itemcallnumber'}.""; + (defined $item->{'itemcallnumber'} ? "".$item->{'itemcallnumber'}."" + : "") + . ""; } $xml = "".$xml.""; -- 2.39.5