diff --git a/includes/html/forms/delete-service-template.inc.php b/includes/html/forms/delete-service-template.inc.php new file mode 100644 index 0000000000..e745ee354a --- /dev/null +++ b/includes/html/forms/delete-service-template.inc.php @@ -0,0 +1,28 @@ + + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ + +if (!Auth::user()->hasGlobalAdmin()) { + $status = array('status' =>1, 'message' => 'ERROR: You need to be admin to delete services templates'); +} else { + if (!is_numeric($vars['service_template_id'])) { + $status = array('status' =>1, 'message' => 'No Service Template has been selected'); + } else { + if (delete_service_template($vars['service_template_id'])) { + $status = array('status' =>0, 'message' => 'Service Template: '.$vars['service_template_id'].', has been deleted.'); + } else { + $status = array('status' =>1, 'message' => 'Service Template: '.$vars['service_template_id'].', has NOT been deleted.'); + } + } +} +header('Content-Type: application/json'); +echo _json_encode($status);