Dont activate an address if another system has it active
This commit is contained in:
parent
e3f2d6cf15
commit
f147b33b60
@ -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();
|
||||
|
||||
|
@ -131,6 +131,12 @@
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@error('susaddress')
|
||||
<span class="btn btn-sm btn-danger" role="alert" style="text-align: left;">
|
||||
{!! $message !!}
|
||||
</span>
|
||||
@enderror
|
||||
@endif
|
||||
|
||||
@can('admin',$o)
|
||||
@ -388,6 +394,13 @@
|
||||
@include('widgets.modal_purge')
|
||||
@endsection
|
||||
|
||||
@section('page-css')
|
||||
<style>
|
||||
span.btn.btn-danger a {
|
||||
color: white
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
@section('page-scripts')
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
|
Loading…
Reference in New Issue
Block a user