use XML::Simple;
use HTML::Entities;
use CGI;
+use DateTime;
=head1 NAME
# Get the biblioitem from the biblionumber
my $biblioitem = ( GetBiblioItemByBiblioNumber( $biblionumber, undef ) )[0];
if ( not $biblioitem->{'biblionumber'} ) {
- $biblioitem = "RecordNotFound";
+ $biblioitem->{code} = "RecordNotFound";
}
# We don't want MARC to be displayed
delete $biblioitem->{'marc'};
- # nor the XML declaration of MARCXML
- $biblioitem->{'marcxml'} =~ s/<\?xml version="1.0" encoding="UTF-8"\?>//go;
-
# Get most of the needed data
my $biblioitemnumber = $biblioitem->{'biblioitemnumber'};
my @reserves = GetReservesFromBiblionumber( $biblionumber, undef, undef );
$biblioitem->{'reserves'}->{'reserve'} = $reserves[1];
$biblioitem->{'issues'}->{'issue'} = $issues;
- map { $biblioitem->{$_} = encode_entities( $biblioitem->{$_}, '&' ) } grep( !/marcxml/, keys %$biblioitem );
-
push @records, $biblioitem;
}
return { code => 'UnsupportedSchema' };
}
- my $records;
+ my @records;
# Let's loop over the authority IDs
foreach my $authid ( split( / /, $cgi->param('id') ) ) {
# Get the record as XML string, or error code
- my $record = GetAuthorityXML($authid) || "<record><code>RecordNotFound</code></record>";
- $record =~ s/<\?xml(.*)\?>//go;
- $records .= $record;
+ push @records, GetAuthorityXML($authid) || { code => 'RecordNotFound' };
}
- return $records;
+ return { record => \@records };
}
=head2 LookupPatron
my ($cgi) = @_;
# Check if borrower exists, using a C4::Auth function...
- unless( checkpw( C4::Context->dbh, $cgi->param('username'), $cgi->param('password') ) ) {
+ unless( C4::Auth::checkpw( C4::Context->dbh, $cgi->param('username'), $cgi->param('password') ) ) {
return { code => 'PatronNotFound' };
}
# Hashref building
my $out;
$out->{'renewals'} = $issue->{'renewals'};
- $out->{'date_due'} = $issue->{'date_due'};
+ $out->{date_due} = $issue->{date_due}->strftime('%Y-%m-%d %H:%S');
$out->{'success'} = $renewal[0];
$out->{'error'} = $renewal[1];