From 404e3fc57bc76434e1ab20922cac520750b6e749 Mon Sep 17 00:00:00 2001
From: miker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Mon, 4 May 2009 23:42:00 +0000
Subject: [PATCH] quiet warnings about undef string escaping; add more fields
 to the top level copy element

git-svn-id: svn://svn.open-ils.org/ILS/trunk@13065 dcc99617-32d9-48b4-a31d-7c20da2025e4
---
 Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
index a28dfe27ae..7f0bbcf1ed 100644
--- a/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
+++ b/Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
@@ -1060,6 +1060,7 @@ Returns the XML representation of the requested bibliographic record's holdings
 sub escape {
 	my $self = shift;
 	my $text = shift;
+    return '' unless $text;
 	$text =~ s/&/&amp;/gsom;
 	$text =~ s/</&lt;/gsom;
 	$text =~ s/>/&gt;/gsom;
@@ -1785,10 +1786,15 @@ sub as_xml {
     my $self = shift;
     my $args = shift;
 
-    my $xml = '<copy xmlns="http://open-ils.org/spec/holdings/v1" ';
+    my $xml = '<copy xmlns="http://open-ils.org/spec/holdings/v1" '.
+        'id="tag:open-ils.org:asset-copy/' . $self->obj->id . '" ';
 
-    $xml .= 'id="tag:open-ils.org:asset-copy/' . $self->obj->id . '" ';
-    $xml .= 'barcode="' . $self->escape( $self->obj->barcode  ) . '">';
+    $xml .= $_ . '="' . $self->escape( $self->obj->$_  ) . '" ' for (qw/
+        create_date edit_date copy_number circulate deposit ref holdable deleted
+        deposit_amount price barcode circ_modifier circ_as_type opac_visible
+    /);
+
+    $xml .= '>';
 
     $xml .= '<status ident="' . $self->obj->status->id . '">' . $self->escape( $self->obj->status->name  ) . '</status>';
     $xml .= '<location ident="' . $self->obj->location->id . '">' . $self->escape( $self->obj->location->name  ) . '</location>';
-- 
2.11.0