[Koha-patches] [PATCH] bug 2505: turn on warnings in seven modules
Galen Charlton
galen.charlton at liblime.com
Sun Jun 7 23:39:06 CEST 2009
C4::XSLT
C4::VirtualShelves
C4::Review
C4::Output
C4::Boolean
C4::Charset
C4::Stats
---
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 c9259df..934a64f 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 5c5e7ce..bbeef24 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 fb87e0f..5bebf6c 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 e08d24c..e3abaf7 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 77d5d14..b4875aa 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 b3e5b26..31dcdb7 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 edba9bf..76e7ea7 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.= "<item><homebranch>$homebranch</homebranch>".
"<status>$status</status>".
- "<itemcallnumber>".$item->{'itemcallnumber'}."</itemcallnumber></item>";
+ (defined $item->{'itemcallnumber'} ? "<itemcallnumber>".$item->{'itemcallnumber'}."</itemcallnumber>"
+ : "<itemcallnumber />")
+ . "</item>";
}
$xml = "<items xmlns=\"http://www.koha.org/items\">".$xml."</items>";
--
1.5.6.5
More information about the Koha-patches
mailing list