Merge pull request #19521 from civicrm/5.34
[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 // set https for offline cc transaction
265 $mode = CRM_Utils_Request::retrieve('mode', 'Alphanumeric', $this);
266 if ($mode == 'test' || $mode == 'live') {
267 CRM_Utils_System::redirectToSSL();
268 }
269
270 // build associated contributions ( note: this is called to show associated contributions in edit mode )
271 if ($this->_action & CRM_Core_Action::UPDATE) {
272 $this->assign('accessContribution', FALSE);
273 if (CRM_Core_Permission::access('CiviContribute')) {
274 $this->assign('accessContribution', TRUE);
275 CRM_Member_Page_Tab::associatedContribution($this->_contactId, $this->_id);
276
277 //show associated soft credit when contribution payment is paid by different person in edit mode
278 if ($this->_id && $this->_contactId) {
279 $filter = " AND cc.id IN (SELECT contribution_id FROM civicrm_membership_payment WHERE membership_id = {$this->_id})";
280 $softCreditList = CRM_Contribute_BAO_ContributionSoft::getSoftContributionList($this->_contactId, $filter);
281 if (!empty($softCreditList)) {
282 $this->assign('softCredit', TRUE);
283 $this->assign('softCreditRows', $softCreditList);
284 }
285 }
286 }
287 }
288
289 if ($this->_action & CRM_Core_Action::RENEW) {
290 $path = 'CRM_Member_Form_MembershipRenewal';
291 $title = ts('Renew Membership');
292 }
293 else {
294 $path = 'CRM_Member_Form_Membership';
295 $title = ts('Create Membership');
296 }
297
298 $controller = new CRM_Core_Controller_Simple($path, $title, $this->_action);
299 $controller->setEmbedded(TRUE);
300 $controller->set('BAOName', $this->getBAOName());
301 $controller->set('id', $this->_id);
302 $controller->set('cid', $this->_contactId);
303 return $controller->run();
304 }
305
306 public function preProcess() {
307 $context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this);
308 $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
309 $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
310
311 if ($context == 'standalone') {
312 $this->_action = CRM_Core_Action::ADD;
313 }
314 else {
315 $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE);
316 $this->assign('contactId', $this->_contactId);
317
318 // check logged in url permission
319 CRM_Contact_Page_View::checkUserPermission($this);
320 }
321
322 $this->assign('action', $this->_action);
323
324 if ($this->_permission == CRM_Core_Permission::EDIT && !CRM_Core_Permission::check('edit memberships')) {
325 // demote to view since user does not have edit membership rights
326 $this->_permission = CRM_Core_Permission::VIEW;
327 $this->assign('permission', 'view');
328 }
329 }
330
331 /**
332 * the main function that is called when the page loads, it decides the which action has to be taken for the page.
333 *
334 * @return null
335 */
336 public function run() {
337 $this->preProcess();
338
339 // check if we can process credit card membership
340 if (CRM_Core_Config::isEnabledBackOfficeCreditCardPayments()) {
341 $this->_isPaymentProcessor = TRUE;
342 }
343 else {
344 $this->_isPaymentProcessor = FALSE;
345 }
346
347 // Only show credit card membership signup if user has CiviContribute permission
348 if (CRM_Core_Permission::access('CiviContribute')) {
349 $this->_accessContribution = TRUE;
350 $this->assign('accessContribution', TRUE);
351
352 //show associated soft credit when contribution payment is paid by different person
353 if ($this->_id && $this->_contactId) {
354 $filter = " AND cc.id IN (SELECT contribution_id FROM civicrm_membership_payment WHERE membership_id = {$this->_id})";
355 $softCreditList = CRM_Contribute_BAO_ContributionSoft::getSoftContributionList($this->_contactId, $filter);
356 if (!empty($softCreditList)) {
357 $this->assign('softCredit', TRUE);
358 $this->assign('softCreditRows', $softCreditList);
359 }
360 }
361 }
362 else {
363 $this->_accessContribution = FALSE;
364 $this->assign('accessContribution', FALSE);
365 $this->assign('softCredit', FALSE);
366 }
367
368 if ($this->_action & CRM_Core_Action::VIEW) {
369 $this->view();
370 }
371 elseif ($this->_action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD | CRM_Core_Action::DELETE | CRM_Core_Action::RENEW)) {
372 self::setContext($this);
373 $this->edit();
374 }
375 else {
376 self::setContext($this);
377 $this->browse();
378 }
379
380 return parent::run();
381 }
382
383 /**
384 * @param CRM_Core_Form $form
385 * @param int $contactId
386 */
387 public static function setContext(&$form, $contactId = NULL) {
388 $context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $form, FALSE, 'search');
389
390 $qfKey = CRM_Utils_Request::retrieve('key', 'String', $form);
391
392 $searchContext = CRM_Utils_Request::retrieve('searchContext', 'String', $form);
393
394 //validate the qfKey
395 if (!CRM_Utils_Rule::qfKey($qfKey)) {
396 $qfKey = NULL;
397 }
398
399 if (!$contactId) {
400 $contactId = $form->_contactId;
401 }
402
403 switch ($context) {
404 case 'dashboard':
405 $url = CRM_Utils_System::url('civicrm/member', 'reset=1');
406 break;
407
408 case 'membership':
409 $url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&force=1&cid={$contactId}&selectedChild=member");
410 break;
411
412 case 'search':
413 $urlParams = 'force=1';
414 if ($qfKey) {
415 $urlParams .= "&qfKey=$qfKey";
416 }
417 $form->assign('searchKey', $qfKey);
418
419 if ($searchContext) {
420 $url = CRM_Utils_System::url("civicrm/$searchContext/search", $urlParams);
421 }
422 else {
423 $url = CRM_Utils_System::url('civicrm/member/search', $urlParams);
424 }
425 break;
426
427 case 'home':
428 $url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
429 break;
430
431 case 'activity':
432 $url = CRM_Utils_System::url('civicrm/contact/view',
433 "reset=1&force=1&cid={$contactId}&selectedChild=activity"
434 );
435 break;
436
437 case 'standalone':
438 $url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1');
439 break;
440
441 case 'fulltext':
442 $action = CRM_Utils_Request::retrieve('action', 'String', $form);
443 $keyName = '&qfKey';
444 $urlParams = 'force=1';
445 $urlString = 'civicrm/contact/search/custom';
446 if ($action == CRM_Core_Action::UPDATE) {
447 if ($form->_contactId) {
448 $urlParams .= '&cid=' . $form->_contactId;
449 }
450 $keyName = '&key';
451 $urlParams .= '&context=fulltext&action=view';
452 $urlString = 'civicrm/contact/view/membership';
453 }
454 if ($qfKey) {
455 $urlParams .= "$keyName=$qfKey";
456 }
457 $form->assign('searchKey', $qfKey);
458 $url = CRM_Utils_System::url($urlString, $urlParams);
459 break;
460
461 default:
462 $cid = NULL;
463 if ($contactId) {
464 $cid = '&cid=' . $contactId;
465 }
466 $url = CRM_Utils_System::url('civicrm/member/search', 'force=1' . $cid);
467 break;
468 }
469
470 $session = CRM_Core_Session::singleton();
471 $session->pushUserContext($url);
472 }
473
474 /**
475 * Get action links.
476 *
477 * @param string $status
478 * @param null $isPaymentProcessor
479 * @param null $accessContribution
480 * @param bool $isCancelSupported
481 * @param bool $isUpdateBilling
482 *
483 * @return array
484 * (reference) of action links
485 */
486 public static function &links(
487 $status = 'all',
488 $isPaymentProcessor = NULL,
489 $accessContribution = NULL,
490 $isCancelSupported = FALSE,
491 $isUpdateBilling = FALSE
492 ) {
493 if (empty(self::$_links['view'])) {
494 self::$_links['view'] = [
495 CRM_Core_Action::VIEW => [
496 'name' => ts('View'),
497 'url' => 'civicrm/contact/view/membership',
498 'qs' => 'action=view&reset=1&cid=%%cid%%&id=%%id%%&context=membership&selectedChild=member',
499 'title' => ts('View Membership'),
500 ],
501 ];
502 }
503
504 if (empty(self::$_links['all'])) {
505 $extraLinks = [
506 CRM_Core_Action::UPDATE => [
507 'name' => ts('Edit'),
508 'url' => 'civicrm/contact/view/membership',
509 'qs' => 'action=update&reset=1&cid=%%cid%%&id=%%id%%&context=membership&selectedChild=member',
510 'title' => ts('Edit Membership'),
511 ],
512 CRM_Core_Action::RENEW => [
513 'name' => ts('Renew'),
514 'url' => 'civicrm/contact/view/membership',
515 'qs' => 'action=renew&reset=1&cid=%%cid%%&id=%%id%%&context=membership&selectedChild=member',
516 'title' => ts('Renew Membership'),
517 ],
518 CRM_Core_Action::FOLLOWUP => [
519 'name' => ts('Renew-Credit Card'),
520 'url' => 'civicrm/contact/view/membership',
521 'qs' => 'action=renew&reset=1&cid=%%cid%%&id=%%id%%&context=membership&selectedChild=member&mode=live',
522 'title' => ts('Renew Membership Using Credit Card'),
523 ],
524 CRM_Core_Action::DELETE => [
525 'name' => ts('Delete'),
526 'url' => 'civicrm/contact/view/membership',
527 'qs' => 'action=delete&reset=1&cid=%%cid%%&id=%%id%%&context=membership&selectedChild=member',
528 'title' => ts('Delete Membership'),
529 ],
530 ];
531 if (!$isPaymentProcessor || !$accessContribution) {
532 //unset the renew with credit card when payment
533 //processor is not available or user is not permitted to create contributions
534 unset($extraLinks[CRM_Core_Action::FOLLOWUP]);
535 }
536 self::$_links['all'] = self::$_links['view'] + $extraLinks;
537 }
538
539 if ($isCancelSupported) {
540 $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.');
541 self::$_links['all'][CRM_Core_Action::DISABLE] = [
542 'name' => ts('Cancel Auto-renewal'),
543 'url' => 'civicrm/contribute/unsubscribe',
544 'qs' => 'reset=1&cid=%%cid%%&mid=%%id%%&context=membership&selectedChild=member',
545 'title' => ts('Cancel Auto Renew Subscription'),
546 'extra' => 'onclick = "if (confirm(\'' . $cancelMessage . '\') ) { return true; else return false;}"',
547 ];
548 }
549 elseif (isset(self::$_links['all'][CRM_Core_Action::DISABLE])) {
550 unset(self::$_links['all'][CRM_Core_Action::DISABLE]);
551 }
552
553 if ($isUpdateBilling) {
554 self::$_links['all'][CRM_Core_Action::MAP] = [
555 'name' => ts('Change Billing Details'),
556 'url' => 'civicrm/contribute/updatebilling',
557 'qs' => 'reset=1&cid=%%cid%%&mid=%%id%%&context=membership&selectedChild=member',
558 'title' => ts('Change Billing Details'),
559 ];
560 }
561 elseif (isset(self::$_links['all'][CRM_Core_Action::MAP])) {
562 unset(self::$_links['all'][CRM_Core_Action::MAP]);
563 }
564 return self::$_links[$status];
565 }
566
567 /**
568 * Define action links for membership types of related organization.
569 *
570 * @return array
571 * self::$_membershipTypesLinks array of action links
572 */
573 public static function &membershipTypesLinks() {
574 if (!self::$_membershipTypesLinks) {
575 self::$_membershipTypesLinks = [
576 CRM_Core_Action::VIEW => [
577 'name' => ts('Members'),
578 'url' => 'civicrm/member/search/',
579 'qs' => 'reset=1&force=1&type=%%id%%',
580 'title' => ts('Search'),
581 ],
582 CRM_Core_Action::UPDATE => [
583 'name' => ts('Edit'),
584 'url' => 'civicrm/admin/member/membershipType',
585 'qs' => 'action=update&id=%%id%%&reset=1',
586 'title' => ts('Edit Membership Type'),
587 ],
588 ];
589 }
590 return self::$_membershipTypesLinks;
591 }
592
593 /**
594 * used for the to show the associated.
595 * contribution for the membership
596 *
597 * @param int $contactId
598 * @param int $membershipId
599 */
600 public static function associatedContribution($contactId = NULL, $membershipId = NULL) {
601 $controller = new CRM_Core_Controller_Simple(
602 'CRM_Contribute_Form_Search',
603 ts('Contributions'),
604 NULL,
605 FALSE, FALSE, TRUE
606 );
607 $controller->setEmbedded(TRUE);
608 $controller->reset();
609 $controller->set('force', 1);
610 $controller->set('skip_cid', TRUE);
611 $controller->set('memberId', $membershipId);
612 $controller->set('context', 'contribution');
613 $controller->process();
614 $controller->run();
615 }
616
617 /**
618 * Get BAO Name.
619 *
620 * @return string
621 * Classname of BAO.
622 */
623 public function getBAOName() {
624 return 'CRM_Member_BAO_Membership';
625 }
626
627 /**
628 * Get a list of links based on permissioned FTs.
629 *
630 * @param int $memTypeID
631 * membership type ID
632 * @param int $links
633 * (reference ) action links
634 */
635 public static function getPermissionedLinks($memTypeID, &$links) {
636 if (!CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()) {
637 return FALSE;
638 }
639 $finTypeId = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $memTypeID, 'financial_type_id');
640 $finType = CRM_Contribute_PseudoConstant::financialType($finTypeId);
641 if (!CRM_Core_Permission::check('edit contributions of type ' . $finType)) {
642 unset($links[CRM_Core_Action::UPDATE]);
643 unset($links[CRM_Core_Action::RENEW]);
644 unset($links[CRM_Core_Action::FOLLOWUP]);
645 }
646 if (!CRM_Core_Permission::check('delete contributions of type ' . $finType)) {
647 unset($links[CRM_Core_Action::DELETE]);
648 }
649 }
650
651 }