+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2016 |
+ | Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2016
+ * @copyright CiviCRM LLC (c) 2004-2017
*/
/**
*/
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');
* @return array
*/
public function setDefaultValues() {
- if (isset($this->_id) && empty($this->_values)) {
+ // Fetch defaults from the db
+ if (!empty($this->_id) && empty($this->_values) && CRM_Utils_Rule::positiveInteger($this->_id)) {
$this->_values = array();
$params = array('id' => $this->_id);
$baoName = $this->_BAOName;
}
$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'])
) {