View | Details | Raw Unified | Return to bug 10824
Collapse All | Expand All

(-)a/opac/oai.pl (-5 / +16 lines)
Lines 99-104 sub new { Link Here
99
            my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = gmtime( time );
99
            my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = gmtime( time );
100
            $until = sprintf( "%.4d-%.2d-%.2d", $year+1900, $mon+1,$mday );
100
            $until = sprintf( "%.4d-%.2d-%.2d", $year+1900, $mon+1,$mday );
101
        }
101
        }
102
        #Add times to the arguments, when necessary, so they correctly match against the DB timestamps
103
        $from .= 'T00:00:00Z' if length($from) == 10;
104
        $until .= 'T23:59:59Z' if length($until) == 10;
102
        $offset = $args{ offset } || 0;
105
        $offset = $args{ offset } || 0;
103
        $set = $args{set};
106
        $set = $args{set};
104
    }
107
    }
Lines 108-113 sub new { Link Here
108
    $self->{ from            } = $from;
111
    $self->{ from            } = $from;
109
    $self->{ until           } = $until;
112
    $self->{ until           } = $until;
110
    $self->{ set             } = $set;
113
    $self->{ set             } = $set;
114
    $self->{ from_arg        } = _strip_UTC_designators($from);
115
    $self->{ until_arg       } = _strip_UTC_designators($until);
111
116
112
    $self->resumptionToken(
117
    $self->resumptionToken(
113
        join( '/', $metadata_prefix, $offset, $from, $until, $set ) );
118
        join( '/', $metadata_prefix, $offset, $from, $until, $set ) );
Lines 116-121 sub new { Link Here
116
    return $self;
121
    return $self;
117
}
122
}
118
123
124
sub _strip_UTC_designators {
125
    my ( $timestamp ) = @_;
126
    $timestamp =~ s/T/ /g;
127
    $timestamp =~ s/Z//g;
128
    return $timestamp;
129
}
130
119
# __END__ C4::OAI::ResumptionToken
131
# __END__ C4::OAI::ResumptionToken
120
132
121
133
Lines 320-333 sub new { Link Here
320
        FROM biblioitems
332
        FROM biblioitems
321
    ";
333
    ";
322
    $sql .= " JOIN oai_sets_biblios ON biblioitems.biblionumber = oai_sets_biblios.biblionumber " if defined $set;
334
    $sql .= " JOIN oai_sets_biblios ON biblioitems.biblionumber = oai_sets_biblios.biblionumber " if defined $set;
323
    $sql .= " WHERE DATE(timestamp) >= ? AND DATE(timestamp) <= ? ";
335
    $sql .= " WHERE timestamp >= ? AND timestamp <= ? ";
324
    $sql .= " AND oai_sets_biblios.set_id = ? " if defined $set;
336
    $sql .= " AND oai_sets_biblios.set_id = ? " if defined $set;
325
    $sql .= "
337
    $sql .= "
326
        LIMIT " . ($max+1) . "
338
        LIMIT " . ($max+1) . "
327
        OFFSET $token->{offset}
339
        OFFSET $token->{offset}
328
    ";
340
    ";
329
    my $sth = $dbh->prepare( $sql );
341
    my $sth = $dbh->prepare( $sql );
330
    my @bind_params = ($token->{'from'}, $token->{'until'});
342
    my @bind_params = ($token->{'from_arg'}, $token->{'until_arg'});
331
    push @bind_params, $set->{'id'} if defined $set;
343
    push @bind_params, $set->{'id'} if defined $set;
332
    $sth->execute( @bind_params );
344
    $sth->execute( @bind_params );
333
345
Lines 477-483 sub new { Link Here
477
        FROM biblioitems
489
        FROM biblioitems
478
    ";
490
    ";
479
    $sql .= " JOIN oai_sets_biblios ON biblioitems.biblionumber = oai_sets_biblios.biblionumber " if defined $set;
491
    $sql .= " JOIN oai_sets_biblios ON biblioitems.biblionumber = oai_sets_biblios.biblionumber " if defined $set;
480
    $sql .= " WHERE DATE(timestamp) >= ? AND DATE(timestamp) <= ? ";
492
    $sql .= " WHERE timestamp >= ? AND timestamp <= ? ";
481
    $sql .= " AND oai_sets_biblios.set_id = ? " if defined $set;
493
    $sql .= " AND oai_sets_biblios.set_id = ? " if defined $set;
482
    $sql .= "
494
    $sql .= "
483
        LIMIT " . ($max + 1) . "
495
        LIMIT " . ($max + 1) . "
Lines 485-491 sub new { Link Here
485
    ";
497
    ";
486
498
487
    my $sth = $dbh->prepare( $sql );
499
    my $sth = $dbh->prepare( $sql );
488
    my @bind_params = ($token->{'from'}, $token->{'until'});
500
    my @bind_params = ($token->{'from_arg'}, $token->{'until_arg'});
489
    push @bind_params, $set->{'id'} if defined $set;
501
    push @bind_params, $set->{'id'} if defined $set;
490
    $sth->execute( @bind_params );
502
    $sth->execute( @bind_params );
491
503
492
- 

Return to bug 10824