Merge pull request #16670 from demeritcowboy/audit-tpl-3
[civicrm-core.git] / CRM / Contact / Form / Inline / Demographics.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17
18 /**
19 * Form helper class for demographics section.
20 */
21 class CRM_Contact_Form_Inline_Demographics extends CRM_Contact_Form_Inline {
22
23 /**
24 * Build the form object elements.
25 */
26 public function buildQuickForm() {
27 parent::buildQuickForm();
28 CRM_Contact_Form_Edit_Demographics::buildQuickForm($this);
29 }
30
31 /**
32 * Process the form.
33 */
34 public function postProcess() {
35 $params = $this->exportValues();
36
37 // Process / save demographics
38 if (empty($params['is_deceased'])) {
39 $params['is_deceased'] = FALSE;
40 $params['deceased_date'] = NULL;
41 }
42
43 $params['contact_type'] = 'Individual';
44 $params['contact_id'] = $this->_contactId;
45
46 if (!empty($this->_contactSubType)) {
47 $params['contact_sub_type'] = $this->_contactSubType;
48 }
49
50 CRM_Contact_BAO_Contact::create($params);
51
52 $this->response();
53 }
54
55 }