-- added code to set default website type during add new contact mode, CRM-9288
authorPradeep Nayak <pradeep.nayak@webaccess.co.in>
Sat, 3 May 2014 10:50:11 +0000 (16:20 +0530)
committerPradeep Nayak <pradeep.nayak@webaccess.co.in>
Sat, 3 May 2014 10:50:11 +0000 (16:20 +0530)
----------------------------------------
* CRM-9288: Website type improvements: allow multiple websites in Profiles, respect default type and update type options
  https://issues.civicrm.org/jira/browse/CRM-9288

CRM/Contact/Form/Contact.php

index 11fa202aca7ca9125173db4722a8d7d458049412..2445ba7299b4aeb207f2271c167dc5b8a4041ed8 100644 (file)
@@ -476,6 +476,9 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
     $defIMProviderId = key(CRM_Core_OptionGroup::values('instant_messenger_service',
         FALSE, FALSE, FALSE, ' AND is_default = 1'
       ));
+    $defWebsiteTypeId = key(CRM_Core_OptionGroup::values('website_type',
+      FALSE, FALSE, FALSE, ' AND is_default = 1'
+    ));
 
     $allBlocks = $this->_blocks;
     if (array_key_exists('Address', $this->_editOptions)) {
@@ -532,6 +535,10 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
         if ($name == 'phone' && $defPhoneTypeId) {
           $defaults[$name][$instance]['phone_type_id'] = $defPhoneTypeId;
         }
+        //set default website type.
+        if ($name == 'website' && $defWebsiteTypeId) {
+          $defaults[$name][$instance]['website_type_id'] = $defWebsiteTypeId;
+        }
 
         //set default im provider.
         if ($name == 'im' && $defIMProviderId) {