Fixed button display based on permission
authorGuanhuan Chen <oooomic@gmail.com>
Wed, 13 May 2015 13:05:46 +0000 (14:05 +0100)
committerGuanhuan Chen <oooomic@gmail.com>
Wed, 13 May 2015 13:05:46 +0000 (14:05 +0100)
CRM/Core/Permission.php
templates/CRM/Contribute/Page/UserDashboard.tpl

index d8756cf2ba15b6ca167cff2ee9201868b48391f9..2159844e126996ca7b60cf8e0d401f76285861e8 100644 (file)
@@ -823,7 +823,7 @@ class CRM_Core_Permission {
         $prefix . ts('edit message templates'),
       ),
       'view my invoices' => array(
         $prefix . ts('edit message templates'),
       ),
       'view my invoices' => array(
-        $prefix . ts('download my invoices'),
+        $prefix . ts('view my invoices'),
         ts('Allow users to view/ download their own invoices'),
       ),
     );
         ts('Allow users to view/ download their own invoices'),
       ),
     );
index ac43bd615acb65bc21cc19350cd42885c9a83f96..33a1a32b51394c40aab73d9bba9c87b2a7809058 100644 (file)
                     {if $invoicing && $invoices}
                       {if $row.contribution_status_name != 'Cancelled'}
                         <td>
                     {if $invoicing && $invoices}
                       {if $row.contribution_status_name != 'Cancelled'}
                         <td>
-              {assign var='id' value=$row.contribution_id}
-        {assign var='contact_id' value=$row.contact_id}
+                          {assign var='id' value=$row.contribution_id}
+                          {assign var='contact_id' value=$row.contact_id}
                           {assign var='urlParams' value="reset=1&id=$id&cid=$contact_id"}
                           {assign var='urlParams' value="reset=1&id=$id&cid=$contact_id"}
-        <a class="crm-invoiceButton" href="{crmURL p='civicrm/contribute/invoice' q=$urlParams}">
-              {if $row.contribution_status != 'Refunded'}
-                            <span>{ts}Print Invoice{/ts}</span>
-              {else}
-          <span>{ts}Print Invoice and Credit Note{/ts}</span>
-              {/if}
-                          </a>
+                          {if call_user_func(array('CRM_Core_Permission','check'), 'view my invoices') OR call_user_func(array('CRM_Core_Permission','check'), 'access CiviContribute')}
+                            <a class="button no-popup " href="{crmURL p='civicrm/contribute/invoice' q=$urlParams}">
+                              <span class="icon ui-icon-print"></span>
+                            {if $row.contribution_status != 'Refunded'}
+                              <span>{ts}Print Invoice{/ts}</span>
+                            {else}
+                              <span>{ts}Print Invoice and Credit Note{/ts}</span>
+                            {/if}
+                            </a>
+                          {/if}
                         </td>
                       {else}
             <td></td>
                         </td>
                       {else}
             <td></td>