CRM-15562 - Remove 'save and new' button for users without 'add contacts' perm
authorColeman Watts <coleman@civicrm.org>
Wed, 5 Nov 2014 22:26:44 +0000 (17:26 -0500)
committerColeman Watts <coleman@civicrm.org>
Wed, 5 Nov 2014 22:26:44 +0000 (17:26 -0500)
CRM/Contact/Form/Contact.php

index 2842a8015bb492eb35725dd3be9545d4d336248b..056d50ff05963ea75fcf233a24a741cf6d52db00 100644 (file)
@@ -822,16 +822,18 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
         'subName' => 'view',
         'isDefault' => TRUE,
       ),
-      array(
+    );
+    if (CRM_Core_Permission::check('add contacts')) {
+      $buttons[] = array(
         'type' => 'upload',
         'name' => ts('Save and New'),
         'spacing' => '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;',
         'subName' => 'new',
-      ),
-      array(
-        'type' => 'cancel',
-        'name' => ts('Cancel'),
-      ),
+      );
+    }
+    $buttons[] = array(
+      'type' => 'cancel',
+      'name' => ts('Cancel'),
     );
 
     if (!empty($this->_values['contact_sub_type'])) {