[Koha-patches] [PATCH] bug 2505: turn on warnings in C4/XSLT.pm
Galen Charlton
galen.charlton at liblime.com
Sun Jun 7 21:46:06 CEST 2009
---
C4/XSLT.pm | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
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