Skip to content

Commit bd094b7

Browse files
committed
Remove from/to parameters from simpleBulkSaveChangeHistory
1 parent 97ca8bc commit bd094b7

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

library/lib/tools.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,24 +298,23 @@ function simpleSaveChangeHistory($table, $record, $changes, $now = null, $from =
298298
db_query('INSERT INTO history (tablename, record_id, changes, user_id, ip, changedate, from_int, from_float, to_int, to_float) VALUES (:table,:id,:change,:user_id,:ip,:now, :from_int, :from_float, :to_int, :to_float)', ['table' => $table, 'id' => $record, 'change' => $changes, 'user_id' => $_SESSION['user']['id'], 'ip' => $_SERVER['REMOTE_ADDR'], 'now' => $now, 'from_int' => $from['int'], 'from_float' => $from['float'], 'to_int' => $to['int'], 'to_float' => $to['float']]);
299299
}
300300

301-
function simpleBulkSaveChangeHistory($table, $records, $changes, $from = [], $to = [])
301+
function simpleBulkSaveChangeHistory($table, $records, $changes)
302302
{
303-
// from and to variable must be arrays with entry 'int' or 'float'
304303
if (!db_tableexists('history')) {
305304
return;
306305
}
307306
$query = '';
308307
$params = [];
309308
if (is_iterable($records)) {
310309
for ($i = 0; $i < sizeof($records); ++$i) {
311-
$query .= "(:table{$i},:id{$i},:change{$i},:user_id{$i},:ip{$i},NOW(), :from_int{$i}, :from_float{$i}, :to_int{$i}, :to_float{$i})";
312-
$params = array_merge($params, ['table'.$i => $table, 'id'.$i => $records[$i], 'change'.$i => $changes, 'user_id'.$i => $_SESSION['user']['id'], 'ip'.$i => $_SERVER['REMOTE_ADDR'], 'from_int'.$i => $from['int'], 'from_float'.$i => $from['float'], 'to_int'.$i => $to['int'], 'to_float'.$i => $to['float']]);
310+
$query .= "(:table{$i},:id{$i},:change{$i},:user_id{$i},:ip{$i},NOW())";
311+
$params = array_merge($params, ['table'.$i => $table, 'id'.$i => $records[$i], 'change'.$i => $changes, 'user_id'.$i => $_SESSION['user']['id'], 'ip'.$i => $_SERVER['REMOTE_ADDR']]);
313312
if ($i !== sizeof($records) - 1) {
314313
$query .= ',';
315314
}
316315
}
317316
}
318317
if (strlen($query) > 0) {
319-
db_query("INSERT INTO history (tablename, record_id, changes, user_id, ip, changedate, from_int, from_float, to_int, to_float) VALUES {$query}", $params);
318+
db_query("INSERT INTO history (tablename, record_id, changes, user_id, ip, changedate) VALUES {$query}", $params);
320319
}
321320
}

0 commit comments

Comments
 (0)