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