phpcs - Fix error, "Visibility must be declared on method"
[civicrm-core.git] / CRM / Member / Page / Tab.php
CommitLineData
6a488035
TO
1<?php
2/*
3 +--------------------------------------------------------------------+
39de6fd5 4 | CiviCRM version 4.6 |
6a488035 5 +--------------------------------------------------------------------+
06b69b18 6 | Copyright CiviCRM LLC (c) 2004-2014 |
6a488035
TO
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
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. |
13 | |
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. |
18 | |
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 +--------------------------------------------------------------------+
26*/
27
28/**
29 *
30 * @package CRM
06b69b18 31 * @copyright CiviCRM LLC (c) 2004-2014
6a488035
TO
32 * $Id$
33 *
34 */
35class CRM_Member_Page_Tab extends CRM_Core_Page {
36
37 /**
38 * The action links that we need to display for the browse screen
39 *
40 * @var array
41 * @static
42 */
43 static $_links = NULL;
44 static $_membershipTypesLinks = NULL;
45
46 public $_permission = NULL;
47 public $_contactId = NULL;
48
49 /**
50 * This function is called when action is browse
51 *
52 * return null
53 * @access public
54 */
00be9182 55 public function browse() {
6a488035
TO
56 $links = self::links('all', $this->_isPaymentProcessor, $this->_accessContribution);
57
8d8bd076 58 $membership = array();
59 $dao = new CRM_Member_DAO_Membership();
6a488035 60 $dao->contact_id = $this->_contactId;
8d8bd076 61 $dao->is_test = 0;
6a488035
TO
62 //$dao->orderBy('name');
63 $dao->find();
64
65 //CRM--4418, check for view, edit, delete
66 $permissions = array(CRM_Core_Permission::VIEW);
67 if (CRM_Core_Permission::check('edit memberships')) {
68 $permissions[] = CRM_Core_Permission::EDIT;
69 }
70 if (CRM_Core_Permission::check('delete in CiviMember')) {
71 $permissions[] = CRM_Core_Permission::DELETE;
72 }
73 $mask = CRM_Core_Action::mask($permissions);
74
75 // get deceased status id
76 $allStatus = CRM_Member_PseudoConstant::membershipStatus();
77 $deceasedStatusId = array_search('Deceased', $allStatus);
78
79 //get all campaigns.
80 $allCampaigns = CRM_Campaign_BAO_Campaign::getCampaigns(NULL, NULL, FALSE, FALSE, FALSE, TRUE);
81
82 //checks membership of contact itself
83 while ($dao->fetch()) {
84 $membership[$dao->id] = array();
85 CRM_Core_DAO::storeValues($dao, $membership[$dao->id]);
86
87 //carry campaign.
88 $membership[$dao->id]['campaign'] = CRM_Utils_Array::value($dao->campaign_id, $allCampaigns);
89
90 //get the membership status and type values.
91 $statusANDType = CRM_Member_BAO_Membership::getStatusANDTypeValues($dao->id);
8d8bd076 92 foreach (array('status', 'membership_type') as $fld) {
6a488035
TO
93 $membership[$dao->id][$fld] = CRM_Utils_Array::value($fld, $statusANDType[$dao->id]);
94 }
a7488080 95 if (!empty($statusANDType[$dao->id]['is_current_member'])) {
6a488035
TO
96 $membership[$dao->id]['active'] = TRUE;
97 }
98 if (empty($dao->owner_membership_id)) {
99 // unset renew and followup link for deceased membership
100 $currentMask = $mask;
101 if ($dao->status_id == $deceasedStatusId) {
102 $currentMask = $currentMask & ~CRM_Core_Action::RENEW & ~CRM_Core_Action::FOLLOWUP;
103 }
104
8d8bd076 105 $isUpdateBilling = FALSE;
106 $paymentObject = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity(
107 $membership[$dao->id]['membership_id'], 'membership', 'obj');
6a488035
TO
108 if (!empty($paymentObject)) {
109 $isUpdateBilling = $paymentObject->isSupported('updateSubscriptionBillingInfo');
110 }
111
8d8bd076 112 $isCancelSupported = CRM_Member_BAO_Membership::isCancelSubscriptionSupported(
113 $membership[$dao->id]['membership_id']);
6a488035
TO
114
115 $membership[$dao->id]['action'] = CRM_Core_Action::formLink(self::links('all',
116 NULL,
117 NULL,
118 $isCancelSupported,
119 $isUpdateBilling
120 ),
121 $currentMask,
122 array(
123 'id' => $dao->id,
124 'cid' => $this->_contactId,
87dab4a4
AH
125 ),
126 ts('more'),
127 FALSE,
128 'membership.tab.row',
129 'Membership',
130 $dao->id
6a488035
TO
131 );
132 }
133 else {
134 $membership[$dao->id]['action'] = CRM_Core_Action::formLink(self::links('view'),
135 $mask,
136 array(
137 'id' => $dao->id,
138 'cid' => $this->_contactId,
87dab4a4
AH
139 ),
140 ts('more'),
141 FALSE,
142 'membership.tab.row',
143 'Membership',
144 $dao->id
6a488035
TO
145 );
146 }
147
148 //does membership have auto renew CRM-7137.
a7488080 149 if (!empty($membership[$dao->id]['contribution_recur_id']) &&
6a488035
TO
150 !CRM_Member_BAO_Membership::isSubscriptionCancelled($membership[$dao->id]['membership_id'])
151 ) {
152 $membership[$dao->id]['auto_renew'] = 1;
153 }
154 else {
155 $membership[$dao->id]['auto_renew'] = 0;
156 }
157
158 // if relevant, count related memberships
8d8bd076 159 if (CRM_Utils_Array::value('is_current_member', $statusANDType[$dao->id]) // membership is active
160 && CRM_Utils_Array::value('relationship_type_id', $statusANDType[$dao->id]) // membership type allows inheritance
161 && empty($dao->owner_membership_id)
162 ) { // not an related membership
6a488035
TO
163 $query = "
164 SELECT COUNT(m.id)
165 FROM civicrm_membership m
166 LEFT JOIN civicrm_membership_status ms ON ms.id = m.status_id
86c838ac
CW
167 LEFT JOIN civicrm_contact ct ON ct.id = m.contact_id
168 WHERE m.owner_membership_id = {$dao->id} AND m.is_test = 0 AND ms.is_current_member = 1 AND ct.is_deleted = 0";
6a488035
TO
169 $num_related = CRM_Core_DAO::singleValueQuery($query);
170 $max_related = CRM_Utils_Array::value('max_related', $membership[$dao->id]);
171 $membership[$dao->id]['related_count'] = ($max_related == '' ?
172 ts('%1 created', array(1 => $num_related)) :
173 ts('%1 out of %2', array(1 => $num_related, 2 => $max_related))
174 );
8d8bd076 175 }
176 else {
6a488035
TO
177 $membership[$dao->id]['related_count'] = ts('N/A');
178 }
179 }
180
181 //Below code gives list of all Membership Types associated
182 //with an Organization(CRM-2016)
183 $membershipTypes = CRM_Member_BAO_MembershipType::getMembershipTypesByOrg($this->_contactId);
184 foreach ($membershipTypes as $key => $value) {
185 $membershipTypes[$key]['action'] = CRM_Core_Action::formLink(self::membershipTypeslinks(),
186 $mask,
187 array(
188 'id' => $value['id'],
189 'cid' => $this->_contactId,
87dab4a4
AH
190 ),
191 ts('more'),
192 FALSE,
193 'membershipType.organization.action',
194 'MembershipType',
195 $value['id']
6a488035
TO
196 );
197 }
198
199 $activeMembers = CRM_Member_BAO_Membership::activeMembers($membership);
200 $inActiveMembers = CRM_Member_BAO_Membership::activeMembers($membership, 'inactive');
201 $this->assign('activeMembers', $activeMembers);
202 $this->assign('inActiveMembers', $inActiveMembers);
203 $this->assign('membershipTypes', $membershipTypes);
204
205 if ($this->_contactId) {
206 $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId);
207 $this->assign('displayName', $displayName);
4e8065a9 208 $this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('membership', $this->_contactId);
fa9fbb61 209 // Refresh other tabs with related data
2840a035 210 $this->ajaxResponse['updateTabs'] = array(
fa9fbb61
CW
211 '#tab_activity' => CRM_Contact_BAO_Contact::getCountComponent('activity', $this->_contactId),
212 '#tab_rel' => CRM_Contact_BAO_Contact::getCountComponent('rel', $this->_contactId),
2840a035 213 );
c312052e
CW
214 if (CRM_Core_Permission::access('CiviContribute')) {
215 $this->ajaxResponse['updateTabs']['#tab_contribute'] = CRM_Contact_BAO_Contact::getCountComponent('contribution', $this->_contactId);
216 }
6a488035
TO
217 }
218 }
219
220 /**
221 * This function is called when action is view
222 *
223 * return null
224 * @access public
225 */
00be9182 226 public function view() {
6a488035
TO
227 $controller = new CRM_Core_Controller_Simple(
228 'CRM_Member_Form_MembershipView',
229 ts('View Membership'),
230 $this->_action
231 );
232 $controller->setEmbedded(TRUE);
233 $controller->set('id', $this->_id);
234 $controller->set('cid', $this->_contactId);
235
236 return $controller->run();
237 }
238
239 /**
240 * This function is called when action is update or new
241 *
242 * return null
243 * @access public
244 */
00be9182 245 public function edit() {
6a488035
TO
246 // set https for offline cc transaction
247 $mode = CRM_Utils_Request::retrieve('mode', 'String', $this);
248 if ($mode == 'test' || $mode == 'live') {
249 CRM_Utils_System::redirectToSSL();
250 }
251
8d8bd076 252 // build associated contributions ( note: this is called to show associated contributions in edit mode )
253 if ($this->_action & CRM_Core_Action::UPDATE) {
254 $this->assign('accessContribution', FALSE);
255 if (CRM_Core_Permission::access('CiviContribute')) {
256 $this->assign('accessContribution', TRUE);
257 CRM_Member_Page_Tab::associatedContribution($this->_contactId, $this->_id);
eb3cfcd6 258
259 //show associated soft credit when contribution payment is paid by different person in edit mode
260 if ($this->_id && $this->_contactId) {
261 $filter = " AND cc.id IN (SELECT contribution_id FROM civicrm_membership_payment WHERE membership_id = {$this->_id})";
262 $softCreditList = CRM_Contribute_BAO_ContributionSoft::getSoftContributionList($this->_contactId, $filter);
263 if (!empty($softCreditList)) {
264 $this->assign('softCredit', TRUE);
265 $this->assign('softCreditRows', $softCreditList);
266 }
267 }
8d8bd076 268 }
6a488035
TO
269 }
270
271 if ($this->_action & CRM_Core_Action::RENEW) {
272 $path = 'CRM_Member_Form_MembershipRenewal';
273 $title = ts('Renew Membership');
274 }
275 else {
276 $path = 'CRM_Member_Form_Membership';
277 $title = ts('Create Membership');
278 }
8d8bd076 279
280 $controller = new CRM_Core_Controller_Simple($path, $title, $this->_action);
6a488035
TO
281 $controller->setEmbedded(TRUE);
282 $controller->set('BAOName', $this->getBAOName());
283 $controller->set('id', $this->_id);
284 $controller->set('cid', $this->_contactId);
285 return $controller->run();
286 }
287
00be9182 288 public function preProcess() {
8d8bd076 289 $context = CRM_Utils_Request::retrieve('context', 'String', $this);
6a488035 290 $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
8d8bd076 291 $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
6a488035
TO
292
293 if ($context == 'standalone') {
294 $this->_action = CRM_Core_Action::ADD;
295 }
296 else {
297 $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
298 $this->assign('contactId', $this->_contactId);
299
300 // check logged in url permission
301 CRM_Contact_Page_View::checkUserPermission($this);
6a488035
TO
302 }
303
304 $this->assign('action', $this->_action);
305
306 if ($this->_permission == CRM_Core_Permission::EDIT && !CRM_Core_Permission::check('edit memberships')) {
307 // demote to view since user does not have edit membership rights
308 $this->_permission = CRM_Core_Permission::VIEW;
309 $this->assign('permission', 'view');
310 }
311 }
312
313 /**
314 * This function is the main function that is called when the page loads, it decides the which action has to be taken for the page.
315 *
316 * return null
317 * @access public
318 */
00be9182 319 public function run() {
6a488035
TO
320 $this->preProcess();
321
322 // check if we can process credit card membership
9be1374d
EM
323 $newCredit = CRM_Core_Config::isEnabledBackOfficeCreditCardPayments();
324 $this->assign('newCredit', $newCredit);
325
6a488035
TO
326 if ($newCredit) {
327 $this->_isPaymentProcessor = TRUE;
328 }
329 else {
330 $this->_isPaymentProcessor = FALSE;
331 }
332
333 // Only show credit card membership signup if user has CiviContribute permission
334 if (CRM_Core_Permission::access('CiviContribute')) {
335 $this->_accessContribution = TRUE;
336 $this->assign('accessContribution', TRUE);
91ef9be0 337
338 //show associated soft credit when contribution payment is paid by different person
339 if ($this->_id && $this->_contactId) {
340 $filter = " AND cc.id IN (SELECT contribution_id FROM civicrm_membership_payment WHERE membership_id = {$this->_id})";
341 $softCreditList = CRM_Contribute_BAO_ContributionSoft::getSoftContributionList($this->_contactId, $filter);
342 if (!empty($softCreditList)) {
343 $this->assign('softCredit', TRUE);
344 $this->assign('softCreditRows', $softCreditList);
345 }
346 }
6a488035
TO
347 }
348 else {
349 $this->_accessContribution = FALSE;
350 $this->assign('accessContribution', FALSE);
91ef9be0 351 $this->assign('softCredit', FALSE);
6a488035
TO
352 }
353
354 if ($this->_action & CRM_Core_Action::VIEW) {
355 $this->view();
356 }
8d8bd076 357 elseif ($this->_action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD | CRM_Core_Action::DELETE
358 | CRM_Core_Action::RENEW)) {
359 self::setContext($this);
6a488035
TO
360 $this->edit();
361 }
362 else {
8d8bd076 363 self::setContext($this);
6a488035
TO
364 $this->browse();
365 }
366
367 return parent::run();
368 }
369
bb3a214a 370 /**
c490a46a 371 * @param CRM_Core_Form $form
100fef9d 372 * @param int $contactId
bb3a214a 373 */
8d8bd076 374 public static function setContext(&$form, $contactId = NULL) {
375 $context = CRM_Utils_Request::retrieve('context', 'String', $form, FALSE, 'search' );
6a488035 376
8d8bd076 377 $qfKey = CRM_Utils_Request::retrieve('key', 'String', $form);
29571f63 378
e803fd5a 379 $searchContext = CRM_Utils_Request::retrieve('searchContext', 'String', $form);
29571f63 380
6a488035
TO
381 //validate the qfKey
382 if (!CRM_Utils_Rule::qfKey($qfKey)) {
383 $qfKey = NULL;
384 }
385
386 if (!$contactId) {
8d8bd076 387 $contactId = $form->_contactId;
6a488035
TO
388 }
389
390 switch ($context) {
391 case 'dashboard':
8d8bd076 392 $url = CRM_Utils_System::url('civicrm/member', 'reset=1');
6a488035
TO
393 break;
394
395 case 'membership':
8d8bd076 396 $url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&force=1&cid={$contactId}&selectedChild=member");
6a488035
TO
397 break;
398
399 case 'search':
400 $urlParams = 'force=1';
401 if ($qfKey) {
402 $urlParams .= "&qfKey=$qfKey";
403 }
8d8bd076 404 $form->assign('searchKey', $qfKey);
2a6da8d7 405
29571f63
AS
406 if ($searchContext) {
407 $url = CRM_Utils_System::url("civicrm/$searchContext/search", $urlParams);
408 }
409 else {
410 $url = CRM_Utils_System::url('civicrm/member/search', $urlParams);
411 }
6a488035
TO
412 break;
413
414 case 'home':
415 $url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
416 break;
417
418 case 'activity':
419 $url = CRM_Utils_System::url('civicrm/contact/view',
420 "reset=1&force=1&cid={$contactId}&selectedChild=activity"
421 );
422 break;
423
424 case 'standalone':
425 $url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
426 break;
427
428 case 'fulltext':
8d8bd076 429 $action = CRM_Utils_Request::retrieve('action', 'String', $form);
430 $keyName = '&qfKey';
6a488035
TO
431 $urlParams = 'force=1';
432 $urlString = 'civicrm/contact/search/custom';
433 if ($action == CRM_Core_Action::UPDATE) {
8d8bd076 434 if ($form->_contactId) {
ec6d9c07 435 $urlParams .= '&cid=' . $form->_contactId;
6a488035
TO
436 }
437 $keyName = '&key';
438 $urlParams .= '&context=fulltext&action=view';
439 $urlString = 'civicrm/contact/view/membership';
440 }
441 if ($qfKey) {
442 $urlParams .= "$keyName=$qfKey";
443 }
8d8bd076 444 $form->assign('searchKey', $qfKey);
6a488035
TO
445 $url = CRM_Utils_System::url($urlString, $urlParams);
446 break;
447
448 default:
449 $cid = NULL;
450 if ($contactId) {
451 $cid = '&cid=' . $contactId;
452 }
8d8bd076 453 $url = CRM_Utils_System::url('civicrm/member/search', 'force=1' . $cid);
6a488035
TO
454 break;
455 }
456
457 $session = CRM_Core_Session::singleton();
458 $session->pushUserContext($url);
459 }
460
461 /**
462 * Get action links
463 *
2a6da8d7
EM
464 * @param string $status
465 * @param null $isPaymentProcessor
466 * @param null $accessContribution
467 * @param bool $isCancelSupported
468 * @param bool $isUpdateBilling
469 *
6a488035
TO
470 * @return array (reference) of action links
471 * @static
472 */
473 static function &links($status = 'all',
8d8bd076 474 $isPaymentProcessor = NULL,
475 $accessContribution = NULL,
476 $isCancelSupported = FALSE,
477 $isUpdateBilling = FALSE
6a488035
TO
478 ) {
479 if (!CRM_Utils_Array::value('view', self::$_links)) {
480 self::$_links['view'] = array(
481 CRM_Core_Action::VIEW => array(
482 'name' => ts('View'),
483 'url' => 'civicrm/contact/view/membership',
484 'qs' => 'action=view&reset=1&cid=%%cid%%&id=%%id%%&context=membership&selectedChild=member',
485 'title' => ts('View Membership'),
486 ),
487 );
488 }
489
490 if (!CRM_Utils_Array::value('all', self::$_links)) {
491 $extraLinks = array(
492 CRM_Core_Action::UPDATE => array(
493 'name' => ts('Edit'),
494 'url' => 'civicrm/contact/view/membership',
495 'qs' => 'action=update&reset=1&cid=%%cid%%&id=%%id%%&context=membership&selectedChild=member',
496 'title' => ts('Edit Membership'),
497 ),
498 CRM_Core_Action::RENEW => array(
499 'name' => ts('Renew'),
500 'url' => 'civicrm/contact/view/membership',
501 'qs' => 'action=renew&reset=1&cid=%%cid%%&id=%%id%%&context=membership&selectedChild=member',
502 'title' => ts('Renew Membership'),
503 ),
504 CRM_Core_Action::FOLLOWUP => array(
505 'name' => ts('Renew-Credit Card'),
506 'url' => 'civicrm/contact/view/membership',
507 'qs' => 'action=renew&reset=1&cid=%%cid%%&id=%%id%%&context=membership&selectedChild=member&mode=live',
508 'title' => ts('Renew Membership Using Credit Card'),
509 ),
510 CRM_Core_Action::DELETE => array(
511 'name' => ts('Delete'),
512 'url' => 'civicrm/contact/view/membership',
513 'qs' => 'action=delete&reset=1&cid=%%cid%%&id=%%id%%&context=membership&selectedChild=member',
514 'title' => ts('Delete Membership'),
515 ),
516 );
517 if (!$isPaymentProcessor || !$accessContribution) {
518 //unset the renew with credit card when payment
519 //processor is not available or user is not permitted to create contributions
520 unset($extraLinks[CRM_Core_Action::FOLLOWUP]);
521 }
522 self::$_links['all'] = self::$_links['view'] + $extraLinks;
523 }
524
525
526 if ($isCancelSupported) {
527 $cancelMessage = ts('WARNING: If you cancel the recurring contribution associated with this membership, the membership will no longer be renewed automatically. However, the current membership status will not be affected.');
528 self::$_links['all'][CRM_Core_Action::DISABLE] = array(
529 'name' => ts('Cancel Auto-renewal'),
530 'url' => 'civicrm/contribute/unsubscribe',
531 'qs' => 'reset=1&cid=%%cid%%&mid=%%id%%&context=membership&selectedChild=member',
532 'title' => ts('Cancel Auto Renew Subscription'),
533 'extra' => 'onclick = "if (confirm(\'' . $cancelMessage . '\') ) { return true; else return false;}"',
534 );
535 }
536 elseif (isset(self::$_links['all'][CRM_Core_Action::DISABLE])) {
537 unset(self::$_links['all'][CRM_Core_Action::DISABLE]);
538 }
539
540 if ($isUpdateBilling) {
541 self::$_links['all'][CRM_Core_Action::MAP] = array(
542 'name' => ts('Change Billing Details'),
543 'url' => 'civicrm/contribute/updatebilling',
544 'qs' => 'reset=1&cid=%%cid%%&mid=%%id%%&context=membership&selectedChild=member',
545 'title' => ts('Change Billing Details'),
546 );
547 }
548 elseif (isset(self::$_links['all'][CRM_Core_Action::MAP])) {
549 unset(self::$_links['all'][CRM_Core_Action::MAP]);
550 }
551 return self::$_links[$status];
552 }
553
554 /**
100fef9d 555 * Define action links for membership types of related organization
6a488035
TO
556 *
557 * @return array self::$_membershipTypesLinks array of action links
558 * @access public
559 */
00be9182 560 public static function &membershipTypesLinks() {
6a488035
TO
561 if (!self::$_membershipTypesLinks) {
562 self::$_membershipTypesLinks = array(
563 CRM_Core_Action::VIEW => array(
564 'name' => ts('Members'),
565 'url' => 'civicrm/member/search/',
566 'qs' => 'reset=1&force=1&type=%%id%%',
567 'title' => ts('Search'),
568 ),
569 CRM_Core_Action::UPDATE => array(
570 'name' => ts('Edit'),
571 'url' => 'civicrm/admin/member/membershipType',
572 'qs' => 'action=update&id=%%id%%&reset=1',
573 'title' => ts('Edit Membership Type'),
574 ),
575 );
576 }
577 return self::$_membershipTypesLinks;
578 }
579
580 /**
581 * This function is used for the to show the associated
582 * contribution for the membership
583 * @form array $form (ref.) an assoc array of name/value pairs
584 * return null
585 * @access public
586 */
141d3170 587 public static function associatedContribution($contactId = NULL, $membershipId = NULL) {
8d8bd076 588 $controller = new CRM_Core_Controller_Simple(
589 'CRM_Contribute_Form_Search',
590 ts('Contributions'),
591 NULL,
592 FALSE, FALSE, TRUE
593 );
594 $controller->setEmbedded(TRUE);
595 $controller->reset();
596 $controller->set('force', 1);
597 $controller->set('cid', $contactId);
598 $controller->set('memberId', $membershipId);
599 $controller->set('context', 'contribution');
600 $controller->process();
601 $controller->run();
6a488035
TO
602 }
603
604 /**
605 * Get BAO Name
606 *
607 * @return string Classname of BAO.
608 */
00be9182 609 public function getBAOName() {
6a488035
TO
610 return 'CRM_Member_BAO_Membership';
611 }
612}
613