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 319-332 sub new { Link Here
319
        FROM biblioitems
331
        FROM biblioitems
320
    ";
332
    ";
321
    $sql .= " JOIN oai_sets_biblios ON biblioitems.biblionumber = oai_sets_biblios.biblionumber " if defined $set;
333
    $sql .= " JOIN oai_sets_biblios ON biblioitems.biblionumber = oai_sets_biblios.biblionumber " if defined $set;
322
    $sql .= " WHERE DATE(timestamp) >= ? AND DATE(timestamp) <= ? ";
334
    $sql .= " WHERE timestamp >= ? AND timestamp <= ? ";
323
    $sql .= " AND oai_sets_biblios.set_id = ? " if defined $set;
335
    $sql .= " AND oai_sets_biblios.set_id = ? " if defined $set;
324
    $sql .= "
336
    $sql .= "
325
        LIMIT $repository->{'koha_max_count'}
337
        LIMIT $repository->{'koha_max_count'}
326
        OFFSET $token->{'offset'}
338
        OFFSET $token->{'offset'}
327
    ";
339
    ";
328
    my $sth = $dbh->prepare( $sql );
340
    my $sth = $dbh->prepare( $sql );
329
    my @bind_params = ($token->{'from'}, $token->{'until'});
341
    my @bind_params = ($token->{'from_arg'}, $token->{'until_arg'});
330
    push @bind_params, $set->{'id'} if defined $set;
342
    push @bind_params, $set->{'id'} if defined $set;
331
    $sth->execute( @bind_params );
343
    $sth->execute( @bind_params );
332
344
Lines 472-478 sub new { Link Here
472
        FROM biblioitems
484
        FROM biblioitems
473
    ";
485
    ";
474
    $sql .= " JOIN oai_sets_biblios ON biblioitems.biblionumber = oai_sets_biblios.biblionumber " if defined $set;
486
    $sql .= " JOIN oai_sets_biblios ON biblioitems.biblionumber = oai_sets_biblios.biblionumber " if defined $set;
475
    $sql .= " WHERE DATE(timestamp) >= ? AND DATE(timestamp) <= ? ";
487
    $sql .= " WHERE timestamp >= ? AND timestamp <= ? ";
476
    $sql .= " AND oai_sets_biblios.set_id = ? " if defined $set;
488
    $sql .= " AND oai_sets_biblios.set_id = ? " if defined $set;
477
    $sql .= "
489
    $sql .= "
478
        LIMIT $repository->{'koha_max_count'}
490
        LIMIT $repository->{'koha_max_count'}
Lines 480-486 sub new { Link Here
480
    ";
492
    ";
481
493
482
    my $sth = $dbh->prepare( $sql );
494
    my $sth = $dbh->prepare( $sql );
483
    my @bind_params = ($token->{'from'}, $token->{'until'});
495
    my @bind_params = ($token->{'from_arg'}, $token->{'until_arg'});
484
    push @bind_params, $set->{'id'} if defined $set;
496
    push @bind_params, $set->{'id'} if defined $set;
485
    $sth->execute( @bind_params );
497
    $sth->execute( @bind_params );
486
498
487
- 

Return to bug 10824