Gateways: Single - as part of the migration strategy we moved most of the boilerplate in our master branch, this just has the side affect of storing default (unchanged) values in system_gateways_edit.php. This commit aims to prevent these entries from being stored to offer a smoother migration to MVC later.

This commit is contained in:
Ad Schellevis 2023-10-17 09:11:17 +02:00
parent 4ae21be887
commit dc94c78015

View File

@ -35,6 +35,7 @@ $gateways = new \OPNsense\Routing\Gateways();
$a_gateways = array_values($gateways->gatewaysIndexedByName(true, false, true));
$dpinger_default = $gateways->getDpingerDefaults();
// form processing
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$pconfig = $_POST;
@ -334,6 +335,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} elseif (isset($gateway['fargw'])) {
unset($gateway['fargw']);
}
/* XXX: temporary solution to prevent default values being stored when unchanged */
foreach ($dpinger_default as $key => $value) {
if (isset($gateway[$key]) && $gateway[$key] == $value) {
unset($gateway[$key]);
}
}
/* when saving the manual gateway we use the attribute which has the corresponding id */
if (isset($realid)) {