Skip to content

Commit c0f39a4

Browse files
committed
Added option to force updates in datalogUpdate function.
1 parent 62b385f commit c0f39a4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

interface/lib/classes/db_mysql.inc.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,14 @@ public function datalogInsert($tablename, $insert_data, $index_field) {
297297
}
298298

299299
//** Updates a record and saves the changes into the datalog
300-
public function datalogUpdate($tablename, $update_data, $index_field, $index_value) {
300+
public function datalogUpdate($tablename, $update_data, $index_field, $index_value, $force_update = false) {
301301
global $app;
302-
303-
$old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
302+
303+
if($force_update == true) {
304+
$old_rec = array();
305+
} else {
306+
$old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
307+
}
304308
$this->query("UPDATE $tablename SET $update_data WHERE $index_field = '$index_value'");
305309
$new_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
306310
$this->datalogSave($tablename, 'UPDATE', $index_field, $index_value, $old_rec, $new_rec);

0 commit comments

Comments
 (0)