From 4569cae57f127afd093794310ccd290d2d9fdf36 Mon Sep 17 00:00:00 2001 From: Marius Burkard <m.burkard@pixcept.de> Date: Wed, 20 Apr 2016 10:58:46 -0400 Subject: [PATCH] Merge branch 'stable-3.1' --- interface/web/client/client_template_del.php | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-) diff --git a/interface/web/client/client_template_del.php b/interface/web/client/client_template_del.php index 1dcdbac..359b5bb 100644 --- a/interface/web/client/client_template_del.php +++ b/interface/web/client/client_template_del.php @@ -1,6 +1,6 @@ <?php /* -Copyright (c) 2007-2008, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com +Copyright (c) 2007-2010, Till Brehm, projektfarm Gmbh and Oliver Vogel www.muv.com All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -39,12 +39,12 @@ * End Form configuration ******************************************/ -require_once('../../lib/config.inc.php'); -require_once('../../lib/app.inc.php'); +require_once '../../lib/config.inc.php'; +require_once '../../lib/app.inc.php'; //* Check permissions for module $app->auth->check_module_permissions('client'); -if(!$_SESSION["s"]["user"]["typ"] == 'admin') die('Client-Templates are for Admins only.'); +if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) die('Client-Templates are for Admins and Resellers only.'); $app->uses('tpl,tform'); $app->load('tform_actions'); @@ -52,16 +52,24 @@ 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."/%'"); + + // check new style + $rec = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client_template_assigned WHERE client_template_id = ?", $this->id); if($rec['number'] > 0) { $app->error($app->tform->lng('template_del_aborted_txt')); } - + + // check old style + $rec = $app->db->queryOneRecord("SELECT count(client_id) as number FROM client WHERE template_master = ? OR template_additional like ?", $this->id, '%/".$this->id."/%'); + if($rec['number'] > 0) { + $app->error($app->tform->lng('template_del_aborted_txt')); + } + } + } $page = new page_action; $page->onDelete() -?> \ No newline at end of file +?> -- Gitblit v1.9.1