Skip to content

Commit 0baa5d4

Browse files
author
mcramer
committed
Do not process sub templates if no main template (master template) is present!
1 parent 341c3dd commit 0baa5d4

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

interface/lib/classes/client_templates.inc.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99

1010
class client_templates {
1111

12-
function apply_client_templates($clientId, $limits = array()) {
12+
function apply_client_templates($clientId) {
1313
global $app;
1414

15-
if(!is_array($limits)) $limits = array();
16-
1715
/*
1816
* Get the master-template for the client
1917
*/
@@ -28,6 +26,11 @@ function apply_client_templates($clientId, $limits = array()) {
2826
if ($masterTemplateId > 0){
2927
$sql = "SELECT * FROM client_template WHERE template_id = " . intval($masterTemplateId);
3028
$limits = $app->db->queryOneRecord($sql);
29+
} else {
30+
// if there is no master template it makes NO SENSE adding sub templates.
31+
// adding subtemplates are stored in client limits, so they would add up
32+
// on every save action for the client -> too high limits!
33+
return;
3134
}
3235

3336
/*

interface/lib/plugins/clients_template_plugin.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ function apply_client_templates($event_name, $page_form) {
2929
global $app;
3030

3131
$app->uses('client_templates');
32-
$app->client_templates->apply_client_templates($page_form->id, $page_form->dataRecord);
32+
$app->client_templates->apply_client_templates($page_form->id);
3333
}
3434
}

0 commit comments

Comments
 (0)