Merge pull request #2061 from civicrm/4.3
[civicrm-core.git] / CRM / Financial / Page / BatchTransaction.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.4 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
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-2013
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 * Get BAO Name
54 *
55 * @return string Classname of BAO.
56 */
57 function getBAOName() {
58 return 'CRM_Batch_BAO_Batch';
59 }
60
61 /**
62 * Get action Links
63 *
64 * @return array (reference) of action links
65 */
66 function &links() {
67 if (!(self::$_links)) {
68 self::$_links = array(
69 'view' => array(
70 'name' => ts('View'),
71 'url' => 'civicrm/contact/view/contribution',
72 'qs' => 'reset=1&id=%%contid%%&cid=%%cid%%&action=view&context=contribution&selectedChild=contribute',
73 'title' => ts('View Contribution'),
74 ),
75 'remove' => array(
76 'name' => ts('Remove'),
77 'title' => ts('Remove Transaction'),
78 'extra' => 'onclick = "assignRemove( %%id%%,\'' . 'remove' . '\' );"',
79 ),
80 );
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.
91 *
92 * @return void
93 * @access public
94 *
95 */
96 function run() {
97 // get the requested action
98 $action = CRM_Utils_Request::retrieve('action', 'String', $this, false, 'browse'); // default to 'browse'
99
100 // assign vars to templates
101 $this->assign('action', $action);
102
103 self::$_entityID = CRM_Utils_Request::retrieve('bid' , 'Positive');
104 if (isset(self::$_entityID)) {
105 $statusID = CRM_Core_DAO::getFieldValue('CRM_Batch_BAO_Batch', self::$_entityID, 'status_id');
106 }
107 $breadCrumb =
108 array(
109 array(
110 'title' => ts('Accounting Batches'),
111 'url' => CRM_Utils_System::url('civicrm/financial/financialbatches',
112 "reset=1&batchStatus=$statusID"),
113 )
114 );
115
116 CRM_Utils_System::appendBreadCrumb($breadCrumb);
117 $this->edit($action, self::$_entityID);
118 return parent::run();
119 }
120
121 /**
122 * Browse all financial batch transactions
123 *
124 *
125 * @return void
126 * @access public
127 * @static
128 */
129 function browse() {
130 }
131
132 /**
133 * Get name of edit form
134 *
135 * @return string Classname of edit form.
136 */
137 function editForm() {
138 return 'CRM_Financial_Form_BatchTransaction';
139 }
140
141 /**
142 * Get edit form name
143 *
144 * @return string name of this page.
145 */
146 function editName() {
147 return 'Batch';
148 }
149
150 /**
151 * Get user context.
152 *
153 * @return string user context.
154 */
155 function userContext($mode = null) {
156 return 'civicrm/batchtransaction';
157 }
158 }
159
160