Dont activate an address if another system has it active
This commit is contained in:
@@ -528,6 +528,18 @@ class SystemController extends Controller
|
||||
$this->authorize('admin',$o);
|
||||
session()->flash('accordion','address');
|
||||
|
||||
// Make sure that no other system has this address active.
|
||||
if (! $o->active && ($x=Address::where([
|
||||
'zone_id'=>$o->zone_id,
|
||||
'host_id'=>$o->host_id,
|
||||
'node_id'=>$o->node_id,
|
||||
'point_id'=>$o->point_id,
|
||||
'active'=>TRUE,
|
||||
])->single())) {
|
||||
|
||||
return redirect()->back()->withErrors(['susaddress'=>sprintf('%s is already active on system [<a href="%s">%s</a>]',$o->ftn,url('ftn/system/addedit',$x->system_id),$x->system->name)]);
|
||||
}
|
||||
|
||||
$o->active = (! $o->active);
|
||||
$o->save();
|
||||
|
||||
|
Reference in New Issue
Block a user