sub recent_changes {
my $self = shift;
my $client = shift;
- my $when = shift;
+ my $when = shift || '1-01-01';
my $limit = shift;
- if (!$when) {
- my ($d,$m,$y) = (localtime)[4,5,6];
- $when = sprintf('%4d-%02d-%02d', $y + 1900, $m + 1, $d);
- }
-
my $type = 'biblio';
$type = 'authority' if ($self->api_name =~ /authority/o);
return $_storage
->request(
"open-ils.cstore.direct.$type.record_entry.id_list.atomic",
- { $axis => { ">" => $when } },
+ { $axis => { ">" => $when }, id => { '>' => 0 } },
{ order_by => "$axis desc", limit => $limit } )
->gather(1);
}
$path =~ s/^\///og;
- my ($type,$rtype,$axis,$date,$limit) = split '/', $path;
- $date ||= 'today';
+ my ($type,$rtype,$axis,$limit,$date) = split '/', $path;
$limit ||= 10;
my $list = $supercat->request("open-ils.supercat.$rtype.record.$axis.recent", $date, $limit)->gather(1);
my $feed = create_record_feed( $type, $list, $unapi);
$feed->root($root);
- $feed->title("$limit most recent $rtype changes from $date forward");
+ if ($date) {
+ $feed->title("Up to $limit recent $rtype ${axis}s from $date forward");
+ } else {
+ $feed->title("$limit most recent $rtype ${axis}s");
+ }
+
$feed->creator($host);
$feed->update_ts(gmtime_ISO8601());
my $item_tag = "tag:$host,$year:biblio-record_entry/$rec/$lib";
-
my $xml = $supercat->request(
"open-ils.supercat.record.$type.retrieve",
$rec
)->gather(1);
+ next unless $xml;
my $node = $feed->add_item($xml);
+ next unless $node;
if ($lib && $type eq 'marcxml') {
$xml = $supercat->request( "open-ils.supercat.record.holdings_xml.retrieve", $rec, $lib )->gather(1);
sub build {
my $class = shift;
my $xml = shift;
+ return undef unless $xml;
$parser = new XML::LibXML if (!$parser);
my $item_xml = shift;
my $entry = $class->new($item_xml);
+ return undef unless $entry;
$entry->base($self->base);
$entry->unapi($self->unapi);
my $class = shift;
my $xml = shift;
my $self = $class->SUPER::build($xml);
+ return undef unless $self;
$self->{doc}->documentElement->setNamespace('http://www.loc.gov/MARC21/slim', 'marc');
$self->{type} = 'application/xml';
$self->{holdings_xpath} = '/marc:record';