Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | /* | |
3 | +--------------------------------------------------------------------+ | |
bc77d7c0 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 5 | | | |
bc77d7c0 TO |
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 | | |
6a488035 | 9 | +--------------------------------------------------------------------+ |
d25dd0ee | 10 | */ |
6a488035 TO |
11 | |
12 | /** | |
13 | * | |
14 | * @package CRM | |
ca5cec67 | 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
16 | */ |
17 | class CRM_Pledge_Page_Payment extends CRM_Core_Page { | |
18 | ||
19 | /** | |
dc195289 | 20 | * the main function that is called when the page loads, it decides the which action has to be taken for the page. |
6a488035 | 21 | * |
76e7a76c | 22 | * @return null |
6a488035 | 23 | */ |
00be9182 | 24 | public function run() { |
6a488035 | 25 | $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); |
edc80cda | 26 | $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this); |
6a488035 TO |
27 | |
28 | $this->assign('action', $this->_action); | |
29 | $this->assign('context', $this->_context); | |
30 | ||
31 | $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this); | |
32 | ||
341c6436 | 33 | CRM_Pledge_Page_Tab::setContext($this); |
6a488035 TO |
34 | |
35 | if ($this->_action & CRM_Core_Action::UPDATE) { | |
36 | $this->edit(); | |
6a488035 TO |
37 | } |
38 | else { | |
39 | $pledgeId = CRM_Utils_Request::retrieve('pledgeId', 'Positive', $this); | |
40 | ||
41 | $paymentDetails = CRM_Pledge_BAO_PledgePayment::getPledgePayments($pledgeId); | |
42 | ||
43 | $this->assign('rows', $paymentDetails); | |
44 | $this->assign('pledgeId', $pledgeId); | |
45 | $this->assign('contactId', $this->_contactId); | |
46 | ||
52767de0 | 47 | // check if we can process credit card contributions |
9be1374d | 48 | $this->assign('newCredit', CRM_Core_Config::isEnabledBackOfficeCreditCardPayments()); |
6a488035 TO |
49 | |
50 | // check is the user has view/edit signer permission | |
51 | $permission = 'view'; | |
52 | if (CRM_Core_Permission::check('edit pledges')) { | |
53 | $permission = 'edit'; | |
54 | } | |
55 | $this->assign('permission', $permission); | |
56 | } | |
57 | ||
58 | return parent::run(); | |
59 | } | |
60 | ||
61 | /** | |
fe482240 | 62 | * called when action is update or new. |
6a488035 | 63 | * |
76e7a76c | 64 | * @return null |
6a488035 | 65 | */ |
00be9182 | 66 | public function edit() { |
6a488035 TO |
67 | $controller = new CRM_Core_Controller_Simple('CRM_Pledge_Form_Payment', |
68 | 'Update Pledge Payment', | |
69 | $this->_action | |
70 | ); | |
71 | ||
72 | $pledgePaymentId = CRM_Utils_Request::retrieve('ppId', 'Positive', $this); | |
73 | ||
74 | $controller->setEmbedded(TRUE); | |
75 | $controller->set('id', $pledgePaymentId); | |
76 | ||
77 | return $controller->run(); | |
78 | } | |
96025800 | 79 | |
6a488035 | 80 | } |