Skip to content
Snippets Groups Projects
Commit c86da31b authored by tbrehm's avatar tbrehm
Browse files

Fixed: FS#1111 - Delete an 'in use' template should be blocked

parent 4bf3f93e
No related branches found
No related tags found
No related merge requests found
...@@ -44,12 +44,21 @@ require_once('../../lib/app.inc.php'); ...@@ -44,12 +44,21 @@ require_once('../../lib/app.inc.php');
//* Check permissions for module //* Check permissions for module
$app->auth->check_module_permissions('client'); $app->auth->check_module_permissions('client');
if(!$_SESSION["s"]["user"]["typ"] == 'admin') die('Client-Templates are only for Admins.'); if(!$_SESSION["s"]["user"]["typ"] == 'admin') die('Client-Templates are for Admins only.');
$app->uses('tpl,tform'); $app->uses('tpl,tform');
$app->load('tform_actions'); $app->load('tform_actions');
class page_action extends tform_actions { class page_action extends tform_actions {
function onBeforeDelete() {
global $app;
$rec = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client WHERE template_master = ".$this->id." OR template_additional like '%/".$this->id."/%'");
if($rec['number'] > 0) {
$app->error($app->tform->lng('template_del_aborted_txt'));
}
}
} }
$page = new page_action; $page = new page_action;
......
...@@ -57,4 +57,5 @@ $wb["error_template_name_empty"] = 'Please enter a Template name'; ...@@ -57,4 +57,5 @@ $wb["error_template_name_empty"] = 'Please enter a Template name';
$wb["limit_web_quota_txt"] = 'Web Quota'; $wb["limit_web_quota_txt"] = 'Web Quota';
$wb["limit_traffic_quota_txt"] = 'Traffic Quota'; $wb["limit_traffic_quota_txt"] = 'Traffic Quota';
$wb["limit_trafficquota_error_notint"] = 'Traffic Quota must be a number.'; $wb["limit_trafficquota_error_notint"] = 'Traffic Quota must be a number.';
$wb["template_del_aborted_txt"] = 'Delete aborted. There is still a client which has this template selected.';
?> ?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment