Merge pull request #6559 from jitendrapurohit/CRM-16877
[civicrm-core.git] / CRM / Contact / Form / Inline / OpenID.php
index 06aa2985320d599e94256e4651a98da703a9688e..b0cb88ff59f1d8cf5a96c5cd6aacf9d1990cea35 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.6                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
- * $Id$
- *
+ * @copyright CiviCRM LLC (c) 2004-2015
  */
 
 /**
- * form helper class for an OpenID object
+ * Form helper class for an OpenID object.
  */
 class CRM_Contact_Form_Inline_OpenID extends CRM_Contact_Form_Inline {
 
   /**
-   * Ims of the contact that is been viewed
+   * Ims of the contact that is been viewed.
    */
   private $_openids = array();
 
   /**
-   * No of openid blocks for inline edit
+   * No of openid blocks for inline edit.
    */
   private $_blockCount = 6;
 
   /**
-   * Call preprocess
+   * Call preprocess.
    */
   public function preProcess() {
     parent::preProcess();
@@ -62,9 +60,7 @@ class CRM_Contact_Form_Inline_OpenID extends CRM_Contact_Form_Inline {
   }
 
   /**
-   * Build the form object elements for openID object
-   *
-   * @return void
+   * Build the form object elements for openID object.
    */
   public function buildQuickForm() {
     parent::buildQuickForm();
@@ -96,7 +92,7 @@ class CRM_Contact_Form_Inline_OpenID extends CRM_Contact_Form_Inline {
   }
 
   /**
-   * Global validation rules for the form
+   * Global validation rules for the form.
    *
    * @param array $fields
    *   Posted values of the form.
@@ -134,7 +130,7 @@ class CRM_Contact_Form_Inline_OpenID extends CRM_Contact_Form_Inline {
   }
 
   /**
-   * Set defaults for the form
+   * Set defaults for the form.
    *
    * @return array
    */
@@ -154,9 +150,7 @@ class CRM_Contact_Form_Inline_OpenID extends CRM_Contact_Form_Inline {
   }
 
   /**
-   * Process the form
-   *
-   * @return void
+   * Process the form.
    */
   public function postProcess() {
     $params = $this->exportValues();
@@ -164,6 +158,12 @@ class CRM_Contact_Form_Inline_OpenID extends CRM_Contact_Form_Inline {
     // Process / save openID
     $params['contact_id'] = $this->_contactId;
     $params['updateBlankLocInfo'] = TRUE;
+    $params['openid']['isIdSet'] = TRUE;
+    foreach ($this->_openids as $count => $value) {
+      if (!empty($value['id']) && isset($params['openid'][$count])) {
+        $params['openid'][$count]['id'] = $value['id'];
+      }
+    }
     CRM_Core_BAO_Block::create('openid', $params);
 
     $this->log();