diff --git a/app/Http/Controllers/SystemController.php b/app/Http/Controllers/SystemController.php index 95902d8..3e3222e 100644 --- a/app/Http/Controllers/SystemController.php +++ b/app/Http/Controllers/SystemController.php @@ -173,7 +173,9 @@ class SystemController extends Controller // Make sure that no other system has this address active. if ($o->role_id === Address::NODE_NN) - return redirect()->back()->withErrors(['address'=>sprintf('%s cannot be demoted any more',$o->ftn3D)]); + return redirect() + ->back() + ->withErrors(['address'=>sprintf('%s cannot be demoted any more',$o->ftn3D)]); $off = $o->role_id; $o->role &= ~$off; @@ -181,7 +183,8 @@ class SystemController extends Controller $o->save(); - return redirect()->to(sprintf('system/addedit/%d',$o->system_id)); + return redirect() + ->to(sprintf('system/addedit/%d',$o->system_id)); } public function address_merge(AddressMerge $request,int $id) @@ -351,8 +354,10 @@ class SystemController extends Controller session()->flash('accordion','address'); // Make sure that no other system has this address active. - if ($o->role_id === Address::NODE_NC) - return redirect()->back()->withErrors(['address'=>sprintf('%s cannot be promoted any more',$o->ftn3D)]); + if ($o->role_id === Address::NODE_HC) + return redirect() + ->back() + ->withErrors(['address'=>sprintf('%s cannot be promoted any more',$o->ftn3D)]); $off = $o->role_id; $o->role &= ~$off; @@ -360,7 +365,8 @@ class SystemController extends Controller $o->save(); - return redirect()->to(sprintf('system/addedit/%d',$o->system_id)); + return redirect() + ->to(sprintf('system/addedit/%d',$o->system_id)); } /** diff --git a/resources/views/system/addedit.blade.php b/resources/views/system/addedit.blade.php index b241555..c73f3b0 100644 --- a/resources/views/system/addedit.blade.php +++ b/resources/views/system/addedit.blade.php @@ -142,10 +142,10 @@ - @if ((Address::NODE_HC|Address::NODE_NN) & $oo->role_id) + @if ($oo->role_id === Address::NODE_NN) @endif - @if ((Address::NODE_NC|Address::NODE_HC) & $oo->role_id) + @if ($oo->role_id === Address::NODE_HC) @endif @endif