Commit 0baa5d4d authored by mcramer's avatar mcramer
Browse files

Do not process sub templates if no main template (master template) is present!

parent 341c3dd5
...@@ -9,11 +9,9 @@ ...@@ -9,11 +9,9 @@
class client_templates { class client_templates {
function apply_client_templates($clientId, $limits = array()) { function apply_client_templates($clientId) {
global $app; global $app;
if(!is_array($limits)) $limits = array();
/* /*
* Get the master-template for the client * Get the master-template for the client
*/ */
...@@ -28,6 +26,11 @@ class client_templates { ...@@ -28,6 +26,11 @@ class client_templates {
if ($masterTemplateId > 0){ if ($masterTemplateId > 0){
$sql = "SELECT * FROM client_template WHERE template_id = " . intval($masterTemplateId); $sql = "SELECT * FROM client_template WHERE template_id = " . intval($masterTemplateId);
$limits = $app->db->queryOneRecord($sql); $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;
} }
/* /*
......
...@@ -29,6 +29,6 @@ class clients_template_plugin { ...@@ -29,6 +29,6 @@ class clients_template_plugin {
global $app; global $app;
$app->uses('client_templates'); $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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment