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