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

(-)a/C4/HoldsQueue.pm (-2 / +2 lines)
Lines 230-236 sub GetBibsWithPendingHoldRequests { Link Here
230
                     FROM reserves
230
                     FROM reserves
231
                     WHERE found IS NULL
231
                     WHERE found IS NULL
232
                     AND priority > 0
232
                     AND priority > 0
233
                     AND reservedate <= CURRENT_DATE()
233
                     AND reservedate <= CAST(now() AS date)
234
                     AND suspend = 0
234
                     AND suspend = 0
235
                     ";
235
                     ";
236
    my $sth = $dbh->prepare($bib_query);
236
    my $sth = $dbh->prepare($bib_query);
Lines 274-280 sub GetPendingHoldRequestsForBib { Link Here
274
                         WHERE biblionumber = ?
274
                         WHERE biblionumber = ?
275
                         AND found IS NULL
275
                         AND found IS NULL
276
                         AND priority > 0
276
                         AND priority > 0
277
                         AND reservedate <= CURRENT_DATE()
277
                         AND reservedate <= CAST(now() AS date)
278
                         AND suspend = 0
278
                         AND suspend = 0
279
                         ORDER BY priority";
279
                         ORDER BY priority";
280
    my $sth = $dbh->prepare($request_query);
280
    my $sth = $dbh->prepare($request_query);
(-)a/C4/Koha.pm (-1 / +1 lines)
Lines 1431-1437 sub GetDailyQuote { Link Here
1431
        # Fall through... we also return a random quote as a catch-all if all else fails
1431
        # Fall through... we also return a random quote as a catch-all if all else fails
1432
    }
1432
    }
1433
    else {
1433
    else {
1434
        $query = 'SELECT * FROM quotes WHERE timestamp LIKE CONCAT(CURRENT_DATE,\'%\') ORDER BY timestamp DESC LIMIT 0,1';
1434
        $query = 'SELECT * FROM quotes WHERE timestamp LIKE CONCAT(CAST(now() AS date),\'%\') ORDER BY timestamp DESC LIMIT 0,1';
1435
        $sth = $dbh->prepare($query);
1435
        $sth = $dbh->prepare($query);
1436
        $sth->execute();
1436
        $sth->execute();
1437
        $quote = $sth->fetchrow_hashref();
1437
        $quote = $sth->fetchrow_hashref();
(-)a/C4/Reserves.pm (-1 / +1 lines)
Lines 984-990 sub AutoUnsuspendReserves { Link Here
984
984
985
    my $dbh = C4::Context->dbh;
985
    my $dbh = C4::Context->dbh;
986
986
987
    my $query = "UPDATE reserves SET suspend = 0, suspend_until = NULL WHERE DATE( suspend_until ) < DATE( CURDATE() )";
987
    my $query = "UPDATE reserves SET suspend = 0, suspend_until = NULL WHERE DATE( suspend_until ) < CAST(now() AS date)";
988
    my $sth = $dbh->prepare( $query );
988
    my $sth = $dbh->prepare( $query );
989
    $sth->execute();
989
    $sth->execute();
990
990
(-)a/misc/cronjobs/cleanup_database.pl (-6 / +5 lines)
Lines 135-141 if ($zebraqueue_days) { Link Here
135
    }
135
    }
136
    $sth = $dbh->prepare(
136
    $sth = $dbh->prepare(
137
        "SELECT id,biblio_auth_number,server,time FROM zebraqueue
137
        "SELECT id,biblio_auth_number,server,time FROM zebraqueue
138
                          WHERE done=1 and time < date_sub(curdate(), interval ? day)"
138
                          WHERE done=1 and time < date_sub(CAST(now() AS date), interval ? day)"
139
    );
139
    );
140
    $sth->execute($zebraqueue_days) or die $dbh->errstr;
140
    $sth->execute($zebraqueue_days) or die $dbh->errstr;
141
    $sth2 = $dbh->prepare("DELETE FROM zebraqueue WHERE id=?");
141
    $sth2 = $dbh->prepare("DELETE FROM zebraqueue WHERE id=?");
Lines 151-157 if ($zebraqueue_days) { Link Here
151
if ($mail) {
151
if ($mail) {
152
    print "Mail queue purge triggered for $mail days.\n" if ($verbose);
152
    print "Mail queue purge triggered for $mail days.\n" if ($verbose);
153
153
154
    $sth = $dbh->prepare("DELETE FROM message_queue WHERE time_queued < date_sub(curdate(), interval ? day)");
154
    $sth = $dbh->prepare("DELETE FROM message_queue WHERE time_queued < date_sub(CAST(now() AS date), interval ? day)");
155
    $sth->execute($mail) or die $dbh->errstr;
155
    $sth->execute($mail) or die $dbh->errstr;
156
    my $count = $sth->rows;
156
    my $count = $sth->rows;
157
    $sth->finish;
157
    $sth->finish;
Lines 174-180 if($pImport) { Link Here
174
174
175
if($pLogs) {
175
if($pLogs) {
176
    print "Purging records from action_logs.\n" if $verbose;
176
    print "Purging records from action_logs.\n" if $verbose;
177
    $sth = $dbh->prepare("DELETE FROM action_logs WHERE timestamp < date_sub(curdate(), interval ? DAY)");
177
    $sth = $dbh->prepare("DELETE FROM action_logs WHERE timestamp < date_sub(CAST(now() AS date), interval ? DAY)");
178
    $sth->execute($pLogs) or die $dbh->errstr;
178
    $sth->execute($pLogs) or die $dbh->errstr;
179
    print "Done with purging action_logs.\n" if $verbose;
179
    print "Done with purging action_logs.\n" if $verbose;
180
}
180
}
Lines 217-223 sub RemoveOldSessions { Link Here
217
sub PurgeImportTables {
217
sub PurgeImportTables {
218
    #First purge import_records
218
    #First purge import_records
219
    #Delete cascades to import_biblios, import_items and import_record_matches
219
    #Delete cascades to import_biblios, import_items and import_record_matches
220
    $sth = $dbh->prepare("DELETE FROM import_records WHERE upload_timestamp < date_sub(curdate(), interval ? DAY)");
220
    $sth = $dbh->prepare("DELETE FROM import_records WHERE upload_timestamp < date_sub(CAST(now() AS date), interval ? DAY)");
221
    $sth->execute($pImport) or die $dbh->errstr;
221
    $sth->execute($pImport) or die $dbh->errstr;
222
222
223
    # Now purge import_batches
223
    # Now purge import_batches
Lines 229-234 sub PurgeImportTables { Link Here
229
 FROM import_batches ba
229
 FROM import_batches ba
230
 LEFT JOIN import_records re ON re.import_batch_id=ba.import_batch_id
230
 LEFT JOIN import_records re ON re.import_batch_id=ba.import_batch_id
231
 WHERE re.import_record_id IS NULL AND
231
 WHERE re.import_record_id IS NULL AND
232
 ba.upload_timestamp < date_sub(curdate(), interval ? DAY)");
232
 ba.upload_timestamp < date_sub(CAST(now() AS date), interval ? DAY)");
233
    $sth->execute($pImport) or die $dbh->errstr;
233
    $sth->execute($pImport) or die $dbh->errstr;
234
}
234
}
235
- 

Return to bug 7802