fix saving Monitors

This commit is contained in:
Isaac 2017-12-22 16:12:34 +01:00
parent 915ea93348
commit 9dfad4886d
1 changed files with 5 additions and 3 deletions

View File

@ -293,8 +293,8 @@ private $control_fields = array(
}
return $filters;
}
public function save( $new_values = null ) {
public function save( $new_values = null ) {
if ( $new_values ) {
foreach ( $new_values as $k=>$v ) {
@ -302,8 +302,10 @@ private $control_fields = array(
}
}
$sql = 'UPDATE Monitors SET '.implode(', ', array_map( function($field) {return $field.'=?';}, array_keys( $this->defaults ) ) ) . ' WHERE Id=?';
$values = array_map( function($field){return $this->{$field};}, $this->fields );
$fields = array_keys( $this->defaults );
$sql = 'UPDATE Monitors SET '.implode(', ', array_map( function($field) {return $field.'=?';}, $fields ) ) . ' WHERE Id=?';
$values = array_map( function($field){return $this->{$field};}, $fields );
$values[] = $this->{'Id'};
dbQuery( $sql, $values );
} // end function save