From 5ec406ed88b8cc4e209d1d70f6dcc2454fce637f Mon Sep 17 00:00:00 2001 From: Barry O'Donovan Date: Fri, 21 Oct 2022 15:41:20 +0100 Subject: [PATCH] [BF] Check for patch panels when deleting racks [ref: 055-9-14] --- app/Http/Controllers/CabinetController.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Http/Controllers/CabinetController.php b/app/Http/Controllers/CabinetController.php index 1a00421d8..8540ad7c2 100644 --- a/app/Http/Controllers/CabinetController.php +++ b/app/Http/Controllers/CabinetController.php @@ -234,6 +234,12 @@ protected function preDelete(): bool $okay = false; } + if( ( $cnt = $this->object->patchPanels()->count() ) ) { + AlertContainer::push( "Could not delete the rack as at least one patch panel is located here. Reassign or delete the panel first.", Alert::DANGER ); + $okay = false; + } + + return $okay; }