From 0baa5d4d41c79e841dfc35a35a377f7316a145bb Mon Sep 17 00:00:00 2001 From: mcramer <m.cramer@pixcept.de> Date: Mon, 10 Sep 2012 10:37:31 -0400 Subject: [PATCH] Do not process sub templates if no main template (master template) is present! --- interface/lib/classes/client_templates.inc.php | 9 ++++++--- interface/lib/plugins/clients_template_plugin.inc.php | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/interface/lib/classes/client_templates.inc.php b/interface/lib/classes/client_templates.inc.php index 8631db0..7c86fcf 100644 --- a/interface/lib/classes/client_templates.inc.php +++ b/interface/lib/classes/client_templates.inc.php @@ -9,10 +9,8 @@ class client_templates { - function apply_client_templates($clientId, $limits = array()) { + function apply_client_templates($clientId) { global $app; - - if(!is_array($limits)) $limits = array(); /* * Get the master-template for the client @@ -28,6 +26,11 @@ if ($masterTemplateId > 0){ $sql = "SELECT * FROM client_template WHERE template_id = " . intval($masterTemplateId); $limits = $app->db->queryOneRecord($sql); + } else { + // if there is no master template it makes NO SENSE adding sub templates. + // adding subtemplates are stored in client limits, so they would add up + // on every save action for the client -> too high limits! + return; } /* diff --git a/interface/lib/plugins/clients_template_plugin.inc.php b/interface/lib/plugins/clients_template_plugin.inc.php index 51f1e98..4bf222e 100644 --- a/interface/lib/plugins/clients_template_plugin.inc.php +++ b/interface/lib/plugins/clients_template_plugin.inc.php @@ -29,6 +29,6 @@ global $app; $app->uses('client_templates'); - $app->client_templates->apply_client_templates($page_form->id, $page_form->dataRecord); + $app->client_templates->apply_client_templates($page_form->id); } } \ No newline at end of file -- Gitblit v1.9.1