Serial number update when adding a record to dns zone
Hi!
In this function in all the dns_*_edit.php in interface/web/dns:
function onAfterInsert() { global $app, $conf;
//* Set the sys_groupid of the rr record to be the same then the sys_groupid of the soa record
$soa = $app->db->queryOneRecord("SELECT sys_groupid FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'));
$app->db->datalogUpdate('dns_rr', "sys_groupid = ".$soa['sys_groupid'], 'id', $this->id);
//* Update the serial number of the SOA record
$soa_id = intval($_POST["zone"]);
$serial = $app->validate_dns->increase_serial($soa["serial"]);
$app->db->datalogUpdate('dns_soa', "serial = $serial", 'id', $soa_id);
}
sys_groupid is being selected from dns_soa, but later in the function $soa["serial"] is used to get the current serial, but that doesn't work because serial is not being fetched in the sql query.
Query should look like this: ("SELECT sys_groupid,serial FROM dns_soa WHERE id = '".intval($this->dataRecord["zone"])."' AND ".$app->tform->getAuthSQL('r'))
Note the added "serial".
Ain't I right ? :D
Thanks, Bergur