Add icon to 'file-on-case' button
authorColeman Watts <coleman@civicrm.org>
Sat, 6 Sep 2014 01:00:16 +0000 (21:00 -0400)
committerColeman Watts <coleman@civicrm.org>
Sat, 6 Sep 2014 01:00:16 +0000 (21:00 -0400)
CRM/Activity/Form/Activity.php
templates/CRM/Activity/Form/Activity.tpl

index 798ff23ae8ef7f2f7958a50c38f420f727012d2b..28f9de52f28c112ac2b9b4f0026828faab948f75 100644 (file)
@@ -278,6 +278,8 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
     $this->_activityTypeId = CRM_Utils_Request::retrieve('atype', 'Positive', $this);
     $this->assign('atype', $this->_activityTypeId);
 
+    $this->assign('activityId', $this->_activityId);
+
     //check for required permissions, CRM-6264
     if ($this->_activityId &&
       in_array($this->_action, array(
@@ -740,24 +742,14 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
       if (isset($this->_groupTree)) {
         CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $this->_groupTree);
       }
-      $buttons = array();
-      // do check for permissions
-      if (CRM_Case_BAO_Case::checkPermission($this->_activityId, 'File On Case', $this->_activityTypeId)) {
-        $buttons[] = array(
-          'type' => 'cancel',
-          'name' => ts('File on case'),
-          'subName' => 'file_on_case',
-          'js' => array('onClick' => "javascript:fileOnCase( \"file\", $this->_activityId ); return false;")
-        );
-      }
       // form should be frozen for view mode
       $this->freeze();
 
+      $buttons = array();
       $buttons[] = array(
         'type' => 'cancel',
         'name' => ts('Done')
       );
-
       $this->addButtons($buttons);
     }
     else {
index 62bb3afe51f2de569e7edc0f0859ebec97b81314..8d6a6a24411b9601144de2f45a578e437ae61a01 100644 (file)
       <a href="{crmURL p='civicrm/contact/view/activity' q=$urlParams}" class="delete button" title="{ts}Delete{/ts}"><span><div class="icon delete-icon"></div>{ts}Delete{/ts}</span></a>
     {/if}
   {/if}
+  {if $action eq 4 and call_user_func(array('CRM_Case_BAO_Case','checkPermission'), $activityId, 'File On Case', $atype)}
+    <a href="#" onclick="fileOnCase('file', {$activityId}, null, this); return false;" class="cancel button" title="{ts}File On Case{/ts}"><span><div class="icon ui-icon-clipboard"></div>{ts}File On Case{/ts}</span></a>
+  {/if}
   {include file="CRM/common/formButtons.tpl" location="bottom"}
   </div>