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 1451-1457 sub GetDailyQuote { Link Here
1451
        # Fall through... we also return a random quote as a catch-all if all else fails
1451
        # Fall through... we also return a random quote as a catch-all if all else fails
1452
    }
1452
    }
1453
    else {
1453
    else {
1454
        $query = 'SELECT * FROM quotes WHERE timestamp LIKE CONCAT(CURRENT_DATE,\'%\') ORDER BY timestamp DESC LIMIT 0,1';
1454
        $query = 'SELECT * FROM quotes WHERE timestamp LIKE CONCAT(CAST(now() AS date),\'%\') ORDER BY timestamp DESC LIMIT 0,1';
1455
        $sth = $dbh->prepare($query);
1455
        $sth = $dbh->prepare($query);
1456
        $sth->execute();
1456
        $sth->execute();
1457
        $quote = $sth->fetchrow_hashref();
1457
        $quote = $sth->fetchrow_hashref();
(-)a/C4/Reserves.pm (-1 / +1 lines)
Lines 974-980 sub AutoUnsuspendReserves { Link Here
974
974
975
    my $dbh = C4::Context->dbh;
975
    my $dbh = C4::Context->dbh;
976
976
977
    my $query = "UPDATE reserves SET suspend = 0, suspend_until = NULL WHERE DATE( suspend_until ) < DATE( CURDATE() )";
977
    my $query = "UPDATE reserves SET suspend = 0, suspend_until = NULL WHERE DATE( suspend_until ) < CAST(now() AS date)";
978
    my $sth = $dbh->prepare( $query );
978
    my $sth = $dbh->prepare( $query );
979
    $sth->execute();
979
    $sth->execute();
980
980
(-)a/misc/cronjobs/cleanup_database.pl (-6 / +5 lines)
Lines 128-134 if ($zebraqueue_days) { Link Here
128
    }
128
    }
129
    $sth = $dbh->prepare(
129
    $sth = $dbh->prepare(
130
        "SELECT id,biblio_auth_number,server,time FROM zebraqueue
130
        "SELECT id,biblio_auth_number,server,time FROM zebraqueue
131
                          WHERE done=1 and time < date_sub(curdate(), interval ? day)"
131
                          WHERE done=1 and time < date_sub(CAST(now() AS date), interval ? day)"
132
    );
132
    );
133
    $sth->execute($zebraqueue_days) or die $dbh->errstr;
133
    $sth->execute($zebraqueue_days) or die $dbh->errstr;
134
    $sth2 = $dbh->prepare("DELETE FROM zebraqueue WHERE id=?");
134
    $sth2 = $dbh->prepare("DELETE FROM zebraqueue WHERE id=?");
Lines 144-150 if ($zebraqueue_days) { Link Here
144
if ($mail) {
144
if ($mail) {
145
    print "Mail queue purge triggered for $mail days.\n" if ($verbose);
145
    print "Mail queue purge triggered for $mail days.\n" if ($verbose);
146
146
147
    $sth = $dbh->prepare("DELETE FROM message_queue WHERE time_queued < date_sub(curdate(), interval ? day)");
147
    $sth = $dbh->prepare("DELETE FROM message_queue WHERE time_queued < date_sub(CAST(now() AS date), interval ? day)");
148
    $sth->execute($mail) or die $dbh->errstr;
148
    $sth->execute($mail) or die $dbh->errstr;
149
    my $count = $sth->rows;
149
    my $count = $sth->rows;
150
    $sth->finish;
150
    $sth->finish;
Lines 167-173 if($pImport) { Link Here
167
167
168
if($pLogs) {
168
if($pLogs) {
169
    print "Purging records from action_logs.\n" if $verbose;
169
    print "Purging records from action_logs.\n" if $verbose;
170
    $sth = $dbh->prepare("DELETE FROM action_logs WHERE timestamp < date_sub(curdate(), interval ? DAY)");
170
    $sth = $dbh->prepare("DELETE FROM action_logs WHERE timestamp < date_sub(CAST(now() AS date), interval ? DAY)");
171
    $sth->execute($pLogs) or die $dbh->errstr;
171
    $sth->execute($pLogs) or die $dbh->errstr;
172
    print "Done with purging action_logs.\n" if $verbose;
172
    print "Done with purging action_logs.\n" if $verbose;
173
}
173
}
Lines 204-210 sub RemoveOldSessions { Link Here
204
sub PurgeImportTables {
204
sub PurgeImportTables {
205
    #First purge import_records
205
    #First purge import_records
206
    #Delete cascades to import_biblios, import_items and import_record_matches
206
    #Delete cascades to import_biblios, import_items and import_record_matches
207
    $sth = $dbh->prepare("DELETE FROM import_records WHERE upload_timestamp < date_sub(curdate(), interval ? DAY)");
207
    $sth = $dbh->prepare("DELETE FROM import_records WHERE upload_timestamp < date_sub(CAST(now() AS date), interval ? DAY)");
208
    $sth->execute($pImport) or die $dbh->errstr;
208
    $sth->execute($pImport) or die $dbh->errstr;
209
209
210
    # Now purge import_batches
210
    # Now purge import_batches
Lines 216-221 sub PurgeImportTables { Link Here
216
 FROM import_batches ba
216
 FROM import_batches ba
217
 LEFT JOIN import_records re ON re.import_batch_id=ba.import_batch_id
217
 LEFT JOIN import_records re ON re.import_batch_id=ba.import_batch_id
218
 WHERE re.import_record_id IS NULL AND
218
 WHERE re.import_record_id IS NULL AND
219
 ba.upload_timestamp < date_sub(curdate(), interval ? DAY)");
219
 ba.upload_timestamp < date_sub(CAST(now() AS date), interval ? DAY)");
220
    $sth->execute($pImport) or die $dbh->errstr;
220
    $sth->execute($pImport) or die $dbh->errstr;
221
}
221
}
222
- 

Return to bug 7802