Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
fee14197 | 4 | | CiviCRM version 5 | |
6a488035 | 5 | +--------------------------------------------------------------------+ |
6b83d5bd | 6 | | Copyright CiviCRM LLC (c) 2004-2019 | |
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 | +--------------------------------------------------------------------+ | |
d25dd0ee | 26 | */ |
6a488035 TO |
27 | |
28 | /** | |
29 | * | |
30 | * @package CRM | |
6b83d5bd | 31 | * @copyright CiviCRM LLC (c) 2004-2019 |
6a488035 TO |
32 | */ |
33 | class CRM_Contribute_Page_Tab extends CRM_Core_Page { | |
34 | ||
35 | /** | |
fe482240 | 36 | * The action links that we need to display for the browse screen. |
6a488035 TO |
37 | * |
38 | * @var array | |
6a488035 TO |
39 | */ |
40 | static $_links = NULL; | |
6a488035 TO |
41 | static $_recurLinks = NULL; |
42 | public $_permission = NULL; | |
43 | public $_contactId = NULL; | |
44 | public $_crid = NULL; | |
45 | ||
6a488035 TO |
46 | /** |
47 | * This method returns the links that are given for recur search row. | |
48 | * currently the links added for each row are: | |
49 | * - View | |
50 | * - Edit | |
51 | * - Cancel | |
52 | * | |
6c8f6e67 EM |
53 | * @param bool $recurID |
54 | * @param string $context | |
55 | * | |
6a488035 | 56 | * @return array |
6a488035 | 57 | */ |
00be9182 | 58 | public static function &recurLinks($recurID = FALSE, $context = 'contribution') { |
6a488035 TO |
59 | if (!(self::$_links)) { |
60 | self::$_links = array( | |
61 | CRM_Core_Action::VIEW => array( | |
62 | 'name' => ts('View'), | |
63 | 'title' => ts('View Recurring Payment'), | |
64 | 'url' => 'civicrm/contact/view/contributionrecur', | |
65 | 'qs' => "reset=1&id=%%crid%%&cid=%%cid%%&context={$context}", | |
66 | ), | |
67 | CRM_Core_Action::UPDATE => array( | |
68 | 'name' => ts('Edit'), | |
69 | 'title' => ts('Edit Recurring Payment'), | |
70 | 'url' => 'civicrm/contribute/updaterecur', | |
71 | 'qs' => "reset=1&action=update&crid=%%crid%%&cid=%%cid%%&context={$context}", | |
72 | ), | |
73 | CRM_Core_Action::DISABLE => array( | |
74 | 'name' => ts('Cancel'), | |
75 | 'title' => ts('Cancel'), | |
4d17a233 | 76 | 'ref' => 'crm-enable-disable', |
6a488035 TO |
77 | ), |
78 | ); | |
79 | } | |
80 | ||
81 | if ($recurID) { | |
afcaa7e9 | 82 | $links = self::$_links; |
6a488035 | 83 | $paymentProcessorObj = CRM_Financial_BAO_PaymentProcessor::getProcessorForEntity($recurID, 'recur', 'obj'); |
c6d558dc MWMC |
84 | if (!is_object($paymentProcessorObj)) { |
85 | unset($links[CRM_Core_Action::DISABLE]); | |
86 | unset($links[CRM_Core_Action::UPDATE]); | |
87 | return $links; | |
88 | } | |
89 | if ($paymentProcessorObj->supports('cancelRecurring')) { | |
afcaa7e9 | 90 | unset($links[CRM_Core_Action::DISABLE]['extra'], $links[CRM_Core_Action::DISABLE]['ref']); |
91 | $links[CRM_Core_Action::DISABLE]['url'] = "civicrm/contribute/unsubscribe"; | |
92 | $links[CRM_Core_Action::DISABLE]['qs'] = "reset=1&crid=%%crid%%&cid=%%cid%%&context={$context}"; | |
6a488035 | 93 | } |
1524a007 | 94 | |
c6d558dc | 95 | if ($paymentProcessorObj->supports('UpdateSubscriptionBillingInfo')) { |
afcaa7e9 | 96 | $links[CRM_Core_Action::RENEW] = array( |
353ffa53 | 97 | 'name' => ts('Change Billing Details'), |
6a488035 TO |
98 | 'title' => ts('Change Billing Details'), |
99 | 'url' => 'civicrm/contribute/updatebilling', | |
100 | 'qs' => "reset=1&crid=%%crid%%&cid=%%cid%%&context={$context}", | |
101 | ); | |
102 | } | |
c6d558dc MWMC |
103 | |
104 | if (!$paymentProcessorObj->supports('ChangeSubscriptionAmount') && !$paymentProcessorObj->supports('EditRecurringContribution')) { | |
105 | unset($links[CRM_Core_Action::UPDATE]); | |
106 | } | |
afcaa7e9 | 107 | return $links; |
6a488035 TO |
108 | } |
109 | ||
110 | return self::$_links; | |
111 | } | |
6a488035 TO |
112 | |
113 | /** | |
fe482240 | 114 | * called when action is browse. |
6a488035 | 115 | * |
6a488035 | 116 | */ |
00be9182 | 117 | public function browse() { |
6a488035 TO |
118 | // add annual contribution |
119 | $annual = array(); | |
120 | list($annual['count'], | |
121 | $annual['amount'], | |
122 | $annual['avg'] | |
353ffa53 | 123 | ) = CRM_Contribute_BAO_Contribution::annual($this->_contactId); |
6a488035 TO |
124 | $this->assign('annual', $annual); |
125 | ||
126 | $controller = new CRM_Core_Controller_Simple( | |
127 | 'CRM_Contribute_Form_Search', | |
128 | ts('Contributions'), | |
129 | $this->_action, | |
130 | FALSE, FALSE, TRUE | |
131 | ); | |
132 | $controller->setEmbedded(TRUE); | |
133 | $controller->reset(); | |
134 | $controller->set('cid', $this->_contactId); | |
135 | $controller->set('crid', $this->_crid); | |
7a49693c | 136 | $controller->set('context', 'contribution'); |
c2874d9c | 137 | $controller->set('limit', 50); |
6a488035 TO |
138 | $controller->process(); |
139 | $controller->run(); | |
140 | ||
141 | // add recurring block | |
46097c9c MW |
142 | $this->addRecurringContributionsBlock(); |
143 | ||
144 | // enable/disable soft credit records for test contribution | |
145 | $isTest = 0; | |
146 | if (CRM_Utils_Request::retrieve('isTest', 'Positive', $this)) { | |
147 | $isTest = 1; | |
148 | } | |
149 | $this->assign('isTest', $isTest); | |
150 | ||
151 | $softCreditList = CRM_Contribute_BAO_ContributionSoft::getSoftContributionList($this->_contactId, NULL, $isTest); | |
152 | ||
153 | if (!empty($softCreditList)) { | |
154 | $softCreditTotals = array(); | |
155 | ||
156 | list($softCreditTotals['amount'], | |
157 | $softCreditTotals['avg'], | |
158 | $softCreditTotals['currency'], | |
159 | $softCreditTotals['cancelAmount'] // to get cancel amount | |
160 | ) = CRM_Contribute_BAO_ContributionSoft::getSoftContributionTotals($this->_contactId, $isTest); | |
161 | ||
162 | $this->assign('softCredit', TRUE); | |
163 | $this->assign('softCreditRows', $softCreditList); | |
164 | $this->assign('softCreditTotals', $softCreditTotals); | |
165 | } | |
166 | ||
167 | if ($this->_contactId) { | |
168 | $displayName = CRM_Contact_BAO_Contact::displayName($this->_contactId); | |
169 | $this->assign('displayName', $displayName); | |
7255972e MWMC |
170 | $tabCount = CRM_Contact_BAO_Contact::getCountComponent('contribution', $this->_contactId); |
171 | $this->assign('tabCount', $tabCount); | |
172 | $this->ajaxResponse['tabCount'] = $tabCount; | |
46097c9c MW |
173 | } |
174 | } | |
175 | ||
176 | /** | |
177 | * Get all the recurring contribution information and assign to the template | |
178 | */ | |
179 | private function addRecurringContributionsBlock() { | |
e2ef9c65 PN |
180 | list($activeContributions, $activeContributionsCount) = $this->getActiveRecurringContributions(); |
181 | list($inactiveRecurringContributions, $inactiveContributionsCount) = $this->getInactiveRecurringContributions(); | |
5963b706 CR |
182 | |
183 | if (!empty($activeContributions) || !empty($inactiveRecurringContributions)) { | |
184 | // assign vars to templates | |
185 | $this->assign('action', $this->_action); | |
186 | $this->assign('activeRecurRows', $activeContributions); | |
51e31e45 | 187 | $this->assign('contributionRecurCount', $activeContributionsCount + $inactiveContributionsCount); |
5963b706 CR |
188 | $this->assign('inactiveRecurRows', $inactiveRecurringContributions); |
189 | $this->assign('recur', TRUE); | |
190 | } | |
191 | } | |
192 | ||
193 | /** | |
194 | * Loads active recurring contributions for the current contact and formats | |
195 | * them to be used on the form. | |
196 | * | |
197 | * @return array; | |
198 | */ | |
199 | private function getActiveRecurringContributions() { | |
9e475c2d MW |
200 | try { |
201 | $contributionRecurResult = civicrm_api3('ContributionRecur', 'get', array( | |
202 | 'contact_id' => $this->_contactId, | |
c2047803 | 203 | 'contribution_status_id' => array('NOT IN' => CRM_Contribute_BAO_ContributionRecur::getInactiveStatuses()), |
0b3146b3 | 204 | 'options' => ['limit' => 0, 'sort' => 'is_test, start_date DESC'], |
5963b706 CR |
205 | )); |
206 | $recurContributions = CRM_Utils_Array::value('values', $contributionRecurResult); | |
207 | } | |
208 | catch (Exception $e) { | |
209 | $recurContributions = array(); | |
210 | } | |
211 | ||
212 | return $this->buildRecurringContributionsArray($recurContributions); | |
213 | } | |
214 | ||
215 | /** | |
216 | * Loads inactive recurring contributions for the current contact and formats | |
217 | * them to be used on the form. | |
218 | * | |
219 | * @return array; | |
220 | */ | |
221 | private function getInactiveRecurringContributions() { | |
9e475c2d MW |
222 | try { |
223 | $contributionRecurResult = civicrm_api3('ContributionRecur', 'get', array( | |
224 | 'contact_id' => $this->_contactId, | |
c2047803 | 225 | 'contribution_status_id' => array('IN' => CRM_Contribute_BAO_ContributionRecur::getInactiveStatuses()), |
0b3146b3 | 226 | 'options' => ['limit' => 0, 'sort' => 'is_test, start_date DESC'], |
9e475c2d MW |
227 | )); |
228 | $recurContributions = CRM_Utils_Array::value('values', $contributionRecurResult); | |
229 | } | |
230 | catch (Exception $e) { | |
231 | $recurContributions = NULL; | |
232 | } | |
6a488035 | 233 | |
5963b706 CR |
234 | return $this->buildRecurringContributionsArray($recurContributions); |
235 | } | |
6a488035 | 236 | |
5963b706 CR |
237 | /** |
238 | * @param $recurContributions | |
239 | * | |
240 | * @return mixed | |
241 | */ | |
242 | private function buildRecurringContributionsArray($recurContributions) { | |
e2ef9c65 | 243 | $liveRecurringContributionCount = 0; |
5963b706 CR |
244 | foreach ($recurContributions as $recurId => $recurDetail) { |
245 | $action = array_sum(array_keys($this->recurLinks($recurId))); | |
246 | // no action allowed if it's not active | |
247 | $recurContributions[$recurId]['is_active'] = (!CRM_Contribute_BAO_Contribution::isContributionStatusNegative($recurDetail['contribution_status_id'])); | |
46097c9c | 248 | |
e2ef9c65 PN |
249 | if (empty($recurDetail['is_test'])) { |
250 | $liveRecurringContributionCount++; | |
251 | } | |
252 | ||
5963b706 CR |
253 | // Get the name of the payment processor |
254 | if (!empty($recurDetail['payment_processor_id'])) { | |
255 | $recurContributions[$recurId]['payment_processor'] = CRM_Financial_BAO_PaymentProcessor::getPaymentProcessorName($recurDetail['payment_processor_id']); | |
256 | } | |
257 | // Get the label for the contribution status | |
258 | if (!empty($recurDetail['contribution_status_id'])) { | |
259 | $recurContributions[$recurId]['contribution_status'] = CRM_Core_PseudoConstant::getLabel('CRM_Contribute_BAO_ContributionRecur', 'contribution_status_id', $recurDetail['contribution_status_id']); | |
260 | } | |
6a488035 | 261 | |
5963b706 | 262 | if ($recurContributions[$recurId]['is_active']) { |
5963b706 CR |
263 | $recurContributions[$recurId]['action'] = CRM_Core_Action::formLink(self::recurLinks($recurId), $action, |
264 | array( | |
265 | 'cid' => $this->_contactId, | |
266 | 'crid' => $recurId, | |
267 | 'cxt' => 'contribution', | |
268 | ), | |
269 | ts('more'), | |
270 | FALSE, | |
271 | 'contribution.selector.recurring', | |
272 | 'Contribution', | |
273 | $recurId | |
274 | ); | |
6a488035 | 275 | } |
6a488035 | 276 | } |
5963b706 | 277 | |
e2ef9c65 | 278 | return [$recurContributions, $liveRecurringContributionCount]; |
6a488035 TO |
279 | } |
280 | ||
281 | /** | |
fe482240 | 282 | * called when action is view. |
6a488035 | 283 | * |
9e475c2d | 284 | * @return mixed |
6a488035 | 285 | */ |
00be9182 | 286 | public function view() { |
6a488035 TO |
287 | $controller = new CRM_Core_Controller_Simple( |
288 | 'CRM_Contribute_Form_ContributionView', | |
289 | ts('View Contribution'), | |
290 | $this->_action | |
291 | ); | |
292 | $controller->setEmbedded(TRUE); | |
293 | $controller->set('id', $this->_id); | |
294 | $controller->set('cid', $this->_contactId); | |
295 | ||
296 | return $controller->run(); | |
297 | } | |
298 | ||
299 | /** | |
fe482240 | 300 | * called when action is update or new. |
6a488035 | 301 | * |
9e475c2d MW |
302 | * @return mixed |
303 | * @throws \CRM_Core_Exception | |
304 | * @throws \Exception | |
6a488035 | 305 | */ |
00be9182 | 306 | public function edit() { |
6a488035 | 307 | // set https for offline cc transaction |
19046166 | 308 | $mode = CRM_Utils_Request::retrieve('mode', 'Alphanumeric', $this); |
6a488035 TO |
309 | if ($mode == 'test' || $mode == 'live') { |
310 | CRM_Utils_System::redirectToSSL(); | |
311 | } | |
312 | ||
313 | $controller = new CRM_Core_Controller_Simple( | |
314 | 'CRM_Contribute_Form_Contribution', | |
315 | 'Create Contribution', | |
316 | $this->_action | |
317 | ); | |
318 | $controller->setEmbedded(TRUE); | |
319 | $controller->set('id', $this->_id); | |
320 | $controller->set('cid', $this->_contactId); | |
321 | ||
322 | return $controller->run(); | |
323 | } | |
324 | ||
00be9182 | 325 | public function preProcess() { |
edc80cda | 326 | $context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this); |
6a488035 | 327 | $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); |
353ffa53 | 328 | $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); |
6a488035 TO |
329 | |
330 | if ($context == 'standalone') { | |
331 | $this->_action = CRM_Core_Action::ADD; | |
332 | } | |
333 | else { | |
f9009fe0 EM |
334 | $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, empty($this->_id)); |
335 | if (empty($this->_contactId)) { | |
353ffa53 TO |
336 | $this->_contactId = civicrm_api3('contribution', 'getvalue', array( |
337 | 'id' => $this->_id, | |
acb1052e | 338 | 'return' => 'contact_id', |
353ffa53 | 339 | )); |
f9009fe0 | 340 | } |
6a488035 TO |
341 | $this->assign('contactId', $this->_contactId); |
342 | ||
343 | // check logged in url permission | |
344 | CRM_Contact_Page_View::checkUserPermission($this); | |
6a488035 TO |
345 | } |
346 | $this->assign('action', $this->_action); | |
347 | ||
348 | if ($this->_permission == CRM_Core_Permission::EDIT && !CRM_Core_Permission::check('edit contributions')) { | |
349 | // demote to view since user does not have edit contrib rights | |
350 | $this->_permission = CRM_Core_Permission::VIEW; | |
351 | $this->assign('permission', 'view'); | |
352 | } | |
353 | } | |
354 | ||
355 | /** | |
dc195289 | 356 | * the main function that is called when the page |
6a488035 TO |
357 | * loads, it decides the which action has to be taken for the page. |
358 | * | |
76e7a76c | 359 | * @return null |
6a488035 | 360 | */ |
00be9182 | 361 | public function run() { |
6a488035 TO |
362 | $this->preProcess(); |
363 | ||
364 | // check if we can process credit card contribs | |
9be1374d | 365 | $this->assign('newCredit', CRM_Core_Config::isEnabledBackOfficeCreditCardPayments()); |
6a488035 TO |
366 | |
367 | $this->setContext(); | |
368 | ||
369 | if ($this->_action & CRM_Core_Action::VIEW) { | |
370 | $this->view(); | |
371 | } | |
372 | elseif ($this->_action & (CRM_Core_Action::UPDATE | CRM_Core_Action::ADD | CRM_Core_Action::DELETE)) { | |
373 | $this->edit(); | |
374 | } | |
375 | else { | |
376 | $this->browse(); | |
377 | } | |
378 | ||
379 | return parent::run(); | |
380 | } | |
381 | ||
00be9182 | 382 | public function setContext() { |
6a488035 | 383 | $qfKey = CRM_Utils_Request::retrieve('key', 'String', $this); |
edc80cda | 384 | $context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', |
6a488035 TO |
385 | $this, FALSE, 'search' |
386 | ); | |
387 | $compContext = CRM_Utils_Request::retrieve('compContext', 'String', $this); | |
388 | ||
29571f63 AS |
389 | $searchContext = CRM_Utils_Request::retrieve('searchContext', 'String', $this); |
390 | ||
6a488035 TO |
391 | //swap the context. |
392 | if ($context == 'search' && $compContext) { | |
393 | $context = $compContext; | |
394 | } | |
395 | else { | |
396 | $compContext = NULL; | |
397 | } | |
398 | ||
399 | // make sure we dont get tricked with a bad key | |
400 | // so check format | |
401 | if (!CRM_Core_Key::valid($qfKey)) { | |
402 | $qfKey = NULL; | |
403 | } | |
404 | ||
6a488035 TO |
405 | switch ($context) { |
406 | case 'user': | |
407 | $url = CRM_Utils_System::url('civicrm/user', 'reset=1'); | |
408 | break; | |
409 | ||
410 | case 'dashboard': | |
411 | $url = CRM_Utils_System::url('civicrm/contribute', | |
412 | 'reset=1' | |
413 | ); | |
414 | break; | |
415 | ||
416 | case 'pledgeDashboard': | |
417 | $url = CRM_Utils_System::url('civicrm/pledge', | |
418 | 'reset=1' | |
419 | ); | |
420 | break; | |
421 | ||
422 | case 'contribution': | |
6a488035 | 423 | $url = CRM_Utils_System::url('civicrm/contact/view', |
8381af80 | 424 | "reset=1&force=1&cid={$this->_contactId}&selectedChild=contribute" |
6a488035 TO |
425 | ); |
426 | break; | |
427 | ||
428 | case 'search': | |
429 | case 'advanced': | |
430 | $extraParams = "force=1"; | |
431 | if ($qfKey) { | |
432 | $extraParams .= "&qfKey=$qfKey"; | |
433 | } | |
434 | ||
435 | $this->assign('searchKey', $qfKey); | |
436 | if ($context == 'advanced') { | |
437 | $url = CRM_Utils_System::url('civicrm/contact/search/advanced', $extraParams); | |
438 | } | |
4c9b6178 | 439 | elseif ($searchContext) { |
29571f63 AS |
440 | $url = CRM_Utils_System::url("civicrm/$searchContext/search", $extraParams); |
441 | } | |
6a488035 TO |
442 | else { |
443 | $url = CRM_Utils_System::url('civicrm/contribute/search', $extraParams); | |
444 | } | |
445 | break; | |
446 | ||
447 | case 'home': | |
448 | $url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1'); | |
449 | break; | |
450 | ||
451 | case 'activity': | |
452 | $url = CRM_Utils_System::url('civicrm/contact/view', | |
453 | "reset=1&force=1&cid={$this->_contactId}&selectedChild=activity" | |
454 | ); | |
455 | break; | |
456 | ||
457 | case 'member': | |
458 | case 'membership': | |
459 | $componentId = CRM_Utils_Request::retrieve('compId', 'Positive', $this); | |
460 | $componentAction = CRM_Utils_Request::retrieve('compAction', 'Integer', $this); | |
461 | ||
462 | $context = 'membership'; | |
463 | $searchKey = NULL; | |
464 | if ($compContext) { | |
465 | $context = 'search'; | |
466 | if ($qfKey) { | |
467 | $searchKey = "&key=$qfKey"; | |
468 | } | |
469 | $compContext = "&compContext={$compContext}"; | |
470 | } | |
471 | if ($componentAction & CRM_Core_Action::VIEW) { | |
472 | $action = 'view'; | |
473 | } | |
474 | else { | |
475 | $action = 'update'; | |
476 | } | |
477 | $url = CRM_Utils_System::url('civicrm/contact/view/membership', | |
478 | "reset=1&action={$action}&id={$componentId}&cid={$this->_contactId}&context={$context}&selectedChild=member{$searchKey}{$compContext}" | |
479 | ); | |
480 | break; | |
481 | ||
482 | case 'participant': | |
483 | $componentId = CRM_Utils_Request::retrieve('compId', 'Positive', $this); | |
484 | $componentAction = CRM_Utils_Request::retrieve('compAction', 'Integer', $this); | |
485 | ||
486 | $context = 'participant'; | |
487 | $searchKey = NULL; | |
488 | if ($compContext) { | |
489 | $context = 'search'; | |
490 | if ($qfKey) { | |
491 | $searchKey = "&key=$qfKey"; | |
492 | } | |
493 | $compContext = "&compContext={$compContext}"; | |
494 | } | |
495 | if ($componentAction == CRM_Core_Action::VIEW) { | |
496 | $action = 'view'; | |
497 | } | |
498 | else { | |
499 | $action = 'update'; | |
500 | } | |
501 | $url = CRM_Utils_System::url('civicrm/contact/view/participant', | |
502 | "reset=1&action={$action}&id={$componentId}&cid={$this->_contactId}&context={$context}&selectedChild=event{$searchKey}{$compContext}" | |
503 | ); | |
504 | break; | |
505 | ||
506 | case 'pledge': | |
507 | $url = CRM_Utils_System::url('civicrm/contact/view', | |
508 | "reset=1&force=1&cid={$this->_contactId}&selectedChild=pledge" | |
509 | ); | |
510 | break; | |
511 | ||
512 | case 'standalone': | |
513 | $url = CRM_Utils_System::url('civicrm/dashboard', 'reset=1'); | |
514 | break; | |
515 | ||
516 | case 'fulltext': | |
353ffa53 | 517 | $keyName = '&qfKey'; |
6a488035 TO |
518 | $urlParams = 'force=1'; |
519 | $urlString = 'civicrm/contact/search/custom'; | |
520 | if ($this->_action == CRM_Core_Action::UPDATE) { | |
521 | if ($this->_contactId) { | |
522 | $urlParams .= '&cid=' . $this->_contactId; | |
523 | } | |
524 | $keyName = '&key'; | |
525 | $urlParams .= '&context=fulltext&action=view'; | |
526 | $urlString = 'civicrm/contact/view/contribution'; | |
527 | } | |
528 | if ($qfKey) { | |
529 | $urlParams .= "$keyName=$qfKey"; | |
530 | } | |
531 | $this->assign('searchKey', $qfKey); | |
532 | $url = CRM_Utils_System::url($urlString, $urlParams); | |
533 | break; | |
534 | ||
535 | default: | |
536 | $cid = NULL; | |
537 | if ($this->_contactId) { | |
538 | $cid = '&cid=' . $this->_contactId; | |
539 | } | |
540 | $url = CRM_Utils_System::url('civicrm/contribute/search', | |
541 | 'reset=1&force=1' . $cid | |
542 | ); | |
543 | break; | |
544 | } | |
545 | ||
546 | $session = CRM_Core_Session::singleton(); | |
547 | $session->pushUserContext($url); | |
548 | } | |
96025800 | 549 | |
6a488035 | 550 | } |