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