3 +--------------------------------------------------------------------+
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2019 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2019
37 * Base class for offline membership / membership type / membership renewal and membership status forms
40 class CRM_Member_Form_MembershipConfig
extends CRM_Core_Form
{
43 * The id of the object being edited / created
50 * The name of the BAO object for this form.
57 * Set default values for the form. MobileProvider that in edit/view mode
58 * the default values are retrieved from the database
63 public function setDefaultValues() {
66 if (isset($this->_id
)) {
67 $params = ['id' => $this->_id
];
68 $baoName = $this->_BAOName
;
69 $baoName::retrieve($params, $defaults);
72 if (isset($defaults['minimum_fee'])) {
73 $defaults['minimum_fee'] = CRM_Utils_Money
::format($defaults['minimum_fee'], NULL, '%a');
76 if (isset($defaults['status'])) {
77 $this->assign('membershipStatus', $defaults['status']);
80 if ($this->_action
& CRM_Core_Action
::ADD
) {
81 $defaults['is_active'] = 1;
84 if (isset($defaults['member_of_contact_id']) &&
85 $defaults['member_of_contact_id']
87 $defaults['member_org'] = CRM_Core_DAO
::getFieldValue('CRM_Contact_DAO_Contact',
88 $defaults['member_of_contact_id'], 'display_name'
95 * Build the form object.
99 public function buildQuickForm() {
100 if ($this->_action
& CRM_Core_Action
::RENEW
) {
104 'name' => ts('Renew'),
109 'name' => ts('Cancel'),
113 elseif ($this->_action
& CRM_Core_Action
::DELETE
) {
117 'name' => ts('Delete'),
122 'name' => ts('Cancel'),
130 'name' => ts('Save'),
135 'name' => ts('Save and New'),
140 'name' => ts('Cancel'),