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