Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
6a488035 | 2 | /* |
bc77d7c0 TO |
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 | +--------------------------------------------------------------------+ | |
006389de | 10 | */ |
6a488035 TO |
11 | |
12 | /** | |
13 | * | |
14 | * @package CRM | |
ca5cec67 | 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
16 | */ |
17 | ||
18 | ||
19 | /** | |
20 | * Page for displaying list of financial batches | |
21 | */ | |
22 | class CRM_Financial_Page_BatchTransaction extends CRM_Core_Page_Basic { | |
23 | /** | |
fe482240 | 24 | * The action links that we need to display for the browse screen. |
6a488035 TO |
25 | * |
26 | * @var array | |
6a488035 | 27 | */ |
7b966967 SL |
28 | public static $_links = NULL; |
29 | public static $_entityID; | |
6a488035 | 30 | |
7b966967 SL |
31 | public static $_columnHeader = NULL; |
32 | public static $_returnvalues = NULL; | |
353ffa53 | 33 | |
6a488035 | 34 | /** |
fe482240 | 35 | * Get BAO Name. |
6a488035 | 36 | * |
a6c01b45 CW |
37 | * @return string |
38 | * Classname of BAO. | |
6a488035 | 39 | */ |
00be9182 | 40 | public function getBAOName() { |
6a488035 TO |
41 | return 'CRM_Batch_BAO_Batch'; |
42 | } | |
43 | ||
44 | /** | |
fe482240 | 45 | * Get action Links. |
6a488035 | 46 | * |
243a28d6 | 47 | * @todo: |
48 | * While this function only references static self::$_links, we can't make | |
49 | * the function static because we need to match CRM_Core_Page_Basic. Possibly | |
50 | * the intent was caching, but there's nothing very time-consuming in here | |
51 | * that needs it so do we even need $_links? The variable is public - a quick | |
52 | * look doesn't seem like it's used on its own, but it's hard to fully check | |
53 | * that. | |
54 | * | |
a6c01b45 CW |
55 | * @return array |
56 | * (reference) of action links | |
6a488035 | 57 | */ |
00be9182 | 58 | public function &links() { |
6a488035 | 59 | if (!(self::$_links)) { |
be2fb01f CW |
60 | self::$_links = [ |
61 | 'view' => [ | |
353ffa53 TO |
62 | 'name' => ts('View'), |
63 | 'url' => 'civicrm/contact/view/contribution', | |
64 | 'qs' => 'reset=1&id=%%contid%%&cid=%%cid%%&action=view&context=contribution&selectedChild=contribute', | |
6a488035 | 65 | 'title' => ts('View Contribution'), |
be2fb01f CW |
66 | ], |
67 | 'remove' => [ | |
353ffa53 | 68 | 'name' => ts('Remove'), |
6a488035 TO |
69 | 'title' => ts('Remove Transaction'), |
70 | 'extra' => 'onclick = "assignRemove( %%id%%,\'' . 'remove' . '\' );"', | |
be2fb01f CW |
71 | ], |
72 | ]; | |
6a488035 TO |
73 | } |
74 | return self::$_links; | |
75 | } | |
76 | ||
77 | /** | |
78 | * Run the page. | |
79 | * | |
80 | * This method is called after the page is created. It checks for the | |
81 | * type of action and executes that action. | |
82 | * Finally it calls the parent's run method. | |
6a488035 | 83 | */ |
00be9182 | 84 | public function run() { |
6a488035 | 85 | // get the requested action |
7b966967 SL |
86 | // default to 'browse' |
87 | $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); | |
03e04002 | 88 | |
6a488035 TO |
89 | // assign vars to templates |
90 | $this->assign('action', $action); | |
03e04002 | 91 | |
045f52a3 | 92 | self::$_entityID = CRM_Utils_Request::retrieve('bid', 'Positive'); |
0efdabe7 | 93 | $statusID = NULL; |
6a488035 TO |
94 | if (isset(self::$_entityID)) { |
95 | $statusID = CRM_Core_DAO::getFieldValue('CRM_Batch_BAO_Batch', self::$_entityID, 'status_id'); | |
96 | } | |
acb1052e | 97 | $breadCrumb |
be2fb01f CW |
98 | = [ |
99 | [ | |
6a488035 TO |
100 | 'title' => ts('Accounting Batches'), |
101 | 'url' => CRM_Utils_System::url('civicrm/financial/financialbatches', | |
102 | "reset=1&batchStatus=$statusID"), | |
be2fb01f CW |
103 | ], |
104 | ]; | |
6a488035 TO |
105 | |
106 | CRM_Utils_System::appendBreadCrumb($breadCrumb); | |
107 | $this->edit($action, self::$_entityID); | |
108 | return parent::run(); | |
109 | } | |
110 | ||
6a488035 | 111 | /** |
fe482240 | 112 | * Get name of edit form. |
6a488035 | 113 | * |
a6c01b45 CW |
114 | * @return string |
115 | * Classname of edit form. | |
6a488035 | 116 | */ |
00be9182 | 117 | public function editForm() { |
6a488035 TO |
118 | return 'CRM_Financial_Form_BatchTransaction'; |
119 | } | |
120 | ||
121 | /** | |
fe482240 | 122 | * Get edit form name. |
6a488035 | 123 | * |
a6c01b45 CW |
124 | * @return string |
125 | * name of this page. | |
6a488035 | 126 | */ |
00be9182 | 127 | public function editName() { |
6a488035 TO |
128 | return 'Batch'; |
129 | } | |
130 | ||
131 | /** | |
132 | * Get user context. | |
133 | * | |
dd244018 EM |
134 | * @param null $mode |
135 | * | |
a6c01b45 CW |
136 | * @return string |
137 | * user context. | |
6a488035 | 138 | */ |
045f52a3 | 139 | public function userContext($mode = NULL) { |
6a488035 TO |
140 | return 'civicrm/batchtransaction'; |
141 | } | |
96025800 | 142 | |
6a488035 | 143 | } |