diff --git a/admin/adminVendors.php b/admin/adminVendors.php index 750ba3b..56046d9 100644 --- a/admin/adminVendors.php +++ b/admin/adminVendors.php @@ -22,14 +22,25 @@ if ($_REQUEST['sub']) { if($_REQUEST['sub'] == 'delete') { - $sQuery = "DELETE FROM vendor WHERE vendorId = ".$_REQUEST['vendorId'].";"; - echo "$sQuery"; + $sQuery = "SELECT * FROM appFamily WHERE vendorId = ".$_REQUEST['vendorId'].";"; + if (debugging()) echo "$sQuery"; $hResult = query_appdb($sQuery); - echo html_frame_start("Delete vendor: ".$_REQUEST['vendorId'],400,"",0); - if($hResult) + + + if(!$hResult || !mysql_num_rows($hResult)) { - //success - echo "
Vendor was successfully deleted
\n"; + $sQuery = "DELETE FROM vendor WHERE vendorId = ".$_REQUEST['vendorId'].";"; + if (debugging()) echo "$sQuery"; + $hResult = query_appdb($sQuery); + echo html_frame_start("Delete vendor: ".$_REQUEST['vendorId'],400,"",0); + if($hResult) + { + //success + echo "Vendor was successfully deleted
\n"; + } + } else + { + echo "Error: Can not delete a vendor with applications attached to it!
\n"; } echo html_frame_end(" "); echo html_back_link(1,'adminVendors.php'); @@ -64,7 +75,7 @@ if ($_REQUEST['sub']) { if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; } echo "