Revize 1660
Přidáno uživatelem David Raška před asi 12 roky(ů)
freenetis/branches/testing/application/controllers/ip_addresses.php | ||
---|---|---|
|
||
$ip_address->save_throwable();
|
||
|
||
$ip_address->transaction_commit();
|
||
|
||
$member_id = $device->user->member_id;
|
||
|
||
|
||
// this block of code cannot be in database transation otherwise
|
||
// you will get error
|
||
// subnet has been changed and ip address was the only one of this member
|
||
// from this subnet -> deletes subnet from allowed subnets of member
|
||
if ($old_subnet_id != $ip_address->subnet_id &&
|
||
... | ... | |
$member_id, array($ip_address->subnet_id)
|
||
);
|
||
|
||
$ip_address->transaction_commit();
|
||
|
||
status::success('IP address has been successfully updated.');
|
||
}
|
||
catch (Exception $e)
|
freenetis/branches/testing/application/controllers/devices.php | ||
---|---|---|
$form_data = $form->as_array();
|
||
$dm = new Device_Model();
|
||
|
||
$update_allowed_params = array();
|
||
|
||
try
|
||
{
|
||
$dm->transaction_start();
|
||
... | ... | |
$ipm->save_throwable();
|
||
|
||
// allowed subnet to added IP
|
||
Allowed_subnets_Controller::update_enabled(
|
||
$dm->user->member_id, array($ipm->subnet_id)
|
||
$update_allowed_params[] = array
|
||
(
|
||
'member_id' => $dm->user->member_id,
|
||
'to_enable' => array($ipm->subnet_id)
|
||
);
|
||
}
|
||
}
|
||
... | ... | |
// done
|
||
unset($form_data);
|
||
$dm->transaction_commit();
|
||
|
||
//Update allowed subnets after transaction is successfully commited
|
||
foreach ($update_allowed_params as $params)
|
||
{
|
||
Allowed_subnets_Controller::update_enabled(
|
||
$params['member_id'],
|
||
$params['to_enable']
|
||
);
|
||
}
|
||
|
||
status::success('Device has been successfully saved.');
|
||
url::redirect('devices/show/'.$dm->id);
|
||
}
|
Také k dispozici: Unified diff
Opravy:
- #254: treti pokus o opravu chyby