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 * Base class for offline membership / membership type / membership renewal and membership status forms
22 class CRM_Member_Form_MembershipConfig
extends CRM_Core_Form
{
25 * The id of the object being edited / created
32 * The name of the BAO object for this form.
39 * Set default values for the form. MobileProvider that in edit/view mode
40 * the default values are retrieved from the database
45 public function setDefaultValues() {
48 if (isset($this->_id
)) {
49 $params = ['id' => $this->_id
];
50 $baoName = $this->_BAOName
;
51 $baoName::retrieve($params, $defaults);
54 if (isset($defaults['minimum_fee'])) {
55 $defaults['minimum_fee'] = CRM_Utils_Money
::formatLocaleNumericRoundedForDefaultCurrency($defaults['minimum_fee']);
58 if (isset($defaults['status'])) {
59 $this->assign('membershipStatus', $defaults['status']);
62 if ($this->_action
& CRM_Core_Action
::ADD
) {
63 $defaults['is_active'] = 1;
66 if (isset($defaults['member_of_contact_id']) &&
67 $defaults['member_of_contact_id']
69 $defaults['member_org'] = CRM_Core_DAO
::getFieldValue('CRM_Contact_DAO_Contact',
70 $defaults['member_of_contact_id'], 'display_name'
77 * Build the form object.
81 public function buildQuickForm() {
82 if ($this->_action
& CRM_Core_Action
::RENEW
) {
86 'name' => ts('Renew'),
91 'name' => ts('Cancel'),
95 elseif ($this->_action
& CRM_Core_Action
::DELETE
) {
99 'name' => ts('Delete'),
104 'name' => ts('Cancel'),
112 'name' => ts('Save'),
117 'name' => ts('Save and New'),
122 'name' => ts('Cancel'),