Skip to content
Snippets Groups Projects
Commit c0f39a4d authored by tbrehm's avatar tbrehm
Browse files

Added option to force updates in datalogUpdate function.

parent 62b385fc
No related branches found
No related tags found
2 merge requests!46Master,!21Master
...@@ -297,10 +297,14 @@ public function toLower($record) { ...@@ -297,10 +297,14 @@ public function toLower($record) {
} }
//** Updates a record and saves the changes into the datalog //** Updates a record and saves the changes into the datalog
public function datalogUpdate($tablename, $update_data, $index_field, $index_value) { public function datalogUpdate($tablename, $update_data, $index_field, $index_value, $force_update = false) {
global $app; global $app;
$old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'"); if($force_update == true) {
$old_rec = array();
} else {
$old_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
}
$this->query("UPDATE $tablename SET $update_data WHERE $index_field = '$index_value'"); $this->query("UPDATE $tablename SET $update_data WHERE $index_field = '$index_value'");
$new_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'"); $new_rec = $this->queryOneRecord("SELECT * FROM $tablename WHERE $index_field = '$index_value'");
$this->datalogSave($tablename, 'UPDATE', $index_field, $index_value, $old_rec, $new_rec); $this->datalogSave($tablename, 'UPDATE', $index_field, $index_value, $old_rec, $new_rec);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment