X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FAdmin%2FForm.php;h=cc3186887fcc6cf3cce791421ca49978d3b14808;hb=4324b8d7c8e69ac6f94dc89da86d11332c3a5864;hp=897274d55e34c32995c0c44642f32925ccfea300;hpb=4c68b3ac2f3b9539f5d8918632bfd7a460633f04;p=civicrm-core.git diff --git a/CRM/Admin/Form.php b/CRM/Admin/Form.php index 897274d55e..cc3186887f 100644 --- a/CRM/Admin/Form.php +++ b/CRM/Admin/Form.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 4.7 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2015 | + | Copyright CiviCRM LLC (c) 2004-2017 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -28,7 +28,7 @@ /** * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2015 + * @copyright CiviCRM LLC (c) 2004-2017 */ /** @@ -68,6 +68,9 @@ class CRM_Admin_Form extends CRM_Core_Form { * Basic setup. */ public function preProcess() { + Civi::resources()->addStyleFile('civicrm', 'css/admin.css'); + Civi::resources()->addScriptFile('civicrm', 'js/crm.admin.js'); + $this->_id = $this->get('id'); $this->_BAOName = $this->get('BAOName'); $this->_values = array(); @@ -87,6 +90,7 @@ class CRM_Admin_Form extends CRM_Core_Form { * @return array */ public function setDefaultValues() { + // Fetch defaults from the db if (isset($this->_id) && empty($this->_values)) { $this->_values = array(); $params = array('id' => $this->_id); @@ -95,6 +99,15 @@ class CRM_Admin_Form extends CRM_Core_Form { } $defaults = $this->_values; + // Allow defaults to be set from the url + if (empty($this->_id) && $this->_action & CRM_Core_Action::ADD) { + foreach ($_GET as $key => $val) { + if ($this->elementExists($key)) { + $defaults[$key] = $val; + } + } + } + if ($this->_action == CRM_Core_Action::DELETE && isset($defaults['name']) ) {