3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
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 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * This class generates form components generic to Contribution admin.
21 class CRM_Contribute_Form
extends CRM_Admin_Form
{
24 * Set default values for the form.
28 public function setDefaultValues() {
31 if (isset($this->_id
)) {
32 $params = ['id' => $this->_id
];
33 if (!empty($this->_BAOName
)) {
34 $baoName = $this->_BAOName
;
35 $baoName::retrieve($params, $defaults);
38 if ($this->_action
== CRM_Core_Action
::DELETE
&& !empty($defaults['name'])) {
39 $this->assign('delName', $defaults['name']);
41 elseif ($this->_action
== CRM_Core_Action
::ADD
) {
42 $condition = " AND is_default = 1";
43 $values = CRM_Core_OptionGroup
::values('financial_account_type', FALSE, FALSE, FALSE, $condition);
44 $defaults['financial_account_type_id'] = array_keys($values);
45 $defaults['is_active'] = 1;
48 elseif ($this->_action
& CRM_Core_Action
::UPDATE
) {
49 if (!empty($defaults['contact_id']) ||
!empty($defaults['created_id'])) {
50 $contactID = !empty($defaults['created_id']) ?
$defaults['created_id'] : $defaults['contact_id'];
51 $this->assign('created_id', $contactID);
52 $this->assign('organisationId', $contactID);
55 if ($parentId = CRM_Utils_Array
::value('parent_id', $defaults)) {
56 $this->assign('parentId', $parentId);