CRM-12910, fixes to also consider ajax calls and do re-binding when calling crmRevisi...
authorDeepak Srivastava <deepak.srivastava@webaccess.co.in>
Mon, 12 Aug 2013 11:40:13 +0000 (17:10 +0530)
committerDeepak Srivastava <deepak.srivastava@webaccess.co.in>
Mon, 12 Aug 2013 11:40:13 +0000 (17:10 +0530)
CRM/Report/BAO/Hook.php
templates/CRM/common/logButton.tpl

index 12bbbf95f0feaaee1fe7ee1e2fbf6192dc372a5f..6c2cee9f6c87a53801024041a098bf6a6b9e3a7b 100644 (file)
@@ -69,7 +69,6 @@ class CRM_Report_BAO_Hook {
       $this->_queryObjects = array();
       CRM_Utils_Hook::queryObjects($this->_queryObjects, 'Report');
     }
-    CRM_Core_Error::debug( '$this->_queryObjects', $this->_queryObjects );
     return $this->_queryObjects;
   }
 
index c9cef83fc8dc0ee85d3fbf0252e6f72fc2dee2db..c22a2f9e0b7099408f3b336bdf0eba50e415612b 100644 (file)
   Note: This file is used by CivHR
 *}
 
-<a class="css_right {$snippet.css_class}" href="#" title="{ts}View Revisions{/ts}">View Revisions</a>
+{if !$onlyScript}
+  <a class="css_right {$snippet.css_class}" href="#" title="{ts}View Revisions{/ts}">View Revisions</a>
+{/if}
 
 {literal}
 <script type="text/javascript">
 (function($, CRM) {
-  $(".{/literal}{$snippet.css_class}{literal}").crmRevisionLink({
-    contactId: {/literal}{$snippet.contact_id}{literal},
-    tableName: "{/literal}{$snippet.table_name}{literal}",
-    reportId: {/literal}{$snippet.instance_id}{literal}
-  });
+  {/literal}{if $onajax}{literal}
+    $(document).ajaxSuccess(function() {
+  {/literal}{/if}{literal}
+      if ($(".{/literal}{$snippet.css_class}{literal}").length) {
+         $(".{/literal}{$snippet.css_class}{literal}").crmRevisionLink({
+           contactId: {/literal}{$snippet.contact_id}{literal},
+           tableName: "{/literal}{$snippet.table_name}{literal}",
+           reportId: {/literal}{$snippet.instance_id}{literal}
+         });
+      }
+  {/literal}{if $onajax}{literal}
+    });
+  {/literal}{/if}{literal}
 })(cj, CRM);
 </script>
 {/literal}