require_once 'LanguageHandler.php'; require_once 'DbHandler.php'; require_once 'CRMDefaults.php'; $lh = \creamy\LanguageHandler::getInstance(); // check required fields $validated = 1; if (!isset($_POST["customertype"])) { $validated = 0; } if ($validated == 1) { $db = new \creamy\DbHandler(); // check customer type $customerType = $_POST["customertype"]; if ($customerType == 1) { // we can't delete the basic client customer type $lh->translateText("unable_delete_contacts_type"); } else { // proceed $result = $db->deleteCustomerType($customerType); if ($result === false) { ob_clean(); $lh->translateText("unable_delete_customer_type"); } else { ob_clean(); print CRM_DEFAULT_SUCCESS_RESPONSE; } } } else { ob_clean(); $lh->translateText("some_fields_missing"); }