CRM-12882 - Allow all admins to view payment processors page. Clarify error message...
[civicrm-core.git] / CRM / Admin / Form / RelationshipType.php
index e9d3d00b45512d3daf0d4e23f21b1f17ada01683..d40d93fbd76a992e1530a29840c30582811eb0b2 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -42,7 +42,7 @@ class CRM_Admin_Form_RelationshipType extends CRM_Admin_Form {
   /**
    * Function to build the form
    *
-   * @return None
+   * @return void
    * @access public
    */
   public function buildQuickForm() {
@@ -74,9 +74,7 @@ class CRM_Admin_Form_RelationshipType extends CRM_Admin_Form {
       CRM_Core_DAO::getAttribute('CRM_Contact_DAO_RelationshipType', 'description')
     );
 
-
-
-    $contactTypes = CRM_Contact_BAO_ContactType::getSelectElements();
+    $contactTypes = CRM_Contact_BAO_ContactType::getSelectElements(FALSE, TRUE, '__');
 
     // add select for contact type
     $contactTypeA = &$this->add('select', 'contact_types_a', ts('Contact Type A') . ' ',
@@ -99,9 +97,6 @@ class CRM_Admin_Form_RelationshipType extends CRM_Admin_Form {
 
     if ($this->_action & CRM_Core_Action::VIEW) {
       $this->freeze();
-      $url = CRM_Utils_System::url('civicrm/admin/reltype&reset=1');
-      $location = "window.location='$url'";
-      $this->addElement('button', 'done', ts('Done'), array('onclick' => $location));
     }
   }
 
@@ -114,13 +109,13 @@ class CRM_Admin_Form_RelationshipType extends CRM_Admin_Form {
       $baoName = $this->_BAOName;
       $baoName::retrieve($params, $defaults);
       $defaults['contact_types_a'] = CRM_Utils_Array::value('contact_type_a', $defaults);
-      if (CRM_Utils_Array::value('contact_sub_type_a', $defaults)) {
-        $defaults['contact_types_a'] .= CRM_Core_DAO::VALUE_SEPARATOR . $defaults['contact_sub_type_a'];
+      if (!empty($defaults['contact_sub_type_a'])) {
+        $defaults['contact_types_a'] .= '__' . $defaults['contact_sub_type_a'];
       }
 
       $defaults['contact_types_b'] = $defaults['contact_type_b'];
-      if (CRM_Utils_Array::value('contact_sub_type_b', $defaults)) {
-        $defaults['contact_types_b'] .= CRM_Core_DAO::VALUE_SEPARATOR . $defaults['contact_sub_type_b'];
+      if (!empty($defaults['contact_sub_type_b'])) {
+        $defaults['contact_types_b'] .= '__' . $defaults['contact_sub_type_b'];
       }
       return $defaults;
     }
@@ -134,7 +129,7 @@ class CRM_Admin_Form_RelationshipType extends CRM_Admin_Form {
    *
    * @access public
    *
-   * @return None
+   * @return void
    */
   public function postProcess() {
     if ($this->_action & CRM_Core_Action::DELETE) {
@@ -153,11 +148,11 @@ class CRM_Admin_Form_RelationshipType extends CRM_Admin_Form {
         $ids['relationshipType'] = $this->_id;
       }
 
-      $cTypeA = CRM_Utils_System::explode(CRM_Core_DAO::VALUE_SEPARATOR,
+      $cTypeA = CRM_Utils_System::explode('__',
         $params['contact_types_a'],
         2
       );
-      $cTypeB = CRM_Utils_System::explode(CRM_Core_DAO::VALUE_SEPARATOR,
+      $cTypeB = CRM_Utils_System::explode('__',
         $params['contact_types_b'],
         2
       );