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