mcramer
2012-09-10 0baa5d4d41c79e841dfc35a35a377f7316a145bb
Do not process sub templates if no main template (master template) is present!

2 files modified
11 ■■■■■ changed files
interface/lib/classes/client_templates.inc.php 9 ●●●●● patch | view | raw | blame | history
interface/lib/plugins/clients_template_plugin.inc.php 2 ●●● patch | view | raw | blame | history
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;
        }
        /*
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);
    }
}