Change address promot/demote to only apply to normal nodes and hubs

This commit is contained in:
2024-12-06 08:45:29 +11:00
parent e7336a942b
commit 70f3a049f6
2 changed files with 13 additions and 7 deletions

View File

@@ -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));
}
/**