Merge pull request #17512 from semseysandor/relative-date-filter
[civicrm-core.git] / CRM / Financial / Page / BatchTransaction.php
CommitLineData
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 */
22class 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 *
a6c01b45
CW
47 * @return array
48 * (reference) of action links
6a488035 49 */
00be9182 50 public function &links() {
6a488035 51 if (!(self::$_links)) {
be2fb01f
CW
52 self::$_links = [
53 'view' => [
353ffa53
TO
54 'name' => ts('View'),
55 'url' => 'civicrm/contact/view/contribution',
56 'qs' => 'reset=1&id=%%contid%%&cid=%%cid%%&action=view&context=contribution&selectedChild=contribute',
6a488035 57 'title' => ts('View Contribution'),
be2fb01f
CW
58 ],
59 'remove' => [
353ffa53 60 'name' => ts('Remove'),
6a488035
TO
61 'title' => ts('Remove Transaction'),
62 'extra' => 'onclick = "assignRemove( %%id%%,\'' . 'remove' . '\' );"',
be2fb01f
CW
63 ],
64 ];
6a488035
TO
65 }
66 return self::$_links;
67 }
68
69 /**
70 * Run the page.
71 *
72 * This method is called after the page is created. It checks for the
73 * type of action and executes that action.
74 * Finally it calls the parent's run method.
6a488035 75 */
00be9182 76 public function run() {
6a488035 77 // get the requested action
7b966967
SL
78 // default to 'browse'
79 $action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse');
03e04002 80
6a488035
TO
81 // assign vars to templates
82 $this->assign('action', $action);
03e04002 83
045f52a3 84 self::$_entityID = CRM_Utils_Request::retrieve('bid', 'Positive');
0efdabe7 85 $statusID = NULL;
6a488035
TO
86 if (isset(self::$_entityID)) {
87 $statusID = CRM_Core_DAO::getFieldValue('CRM_Batch_BAO_Batch', self::$_entityID, 'status_id');
88 }
acb1052e 89 $breadCrumb
be2fb01f
CW
90 = [
91 [
6a488035
TO
92 'title' => ts('Accounting Batches'),
93 'url' => CRM_Utils_System::url('civicrm/financial/financialbatches',
94 "reset=1&batchStatus=$statusID"),
be2fb01f
CW
95 ],
96 ];
6a488035
TO
97
98 CRM_Utils_System::appendBreadCrumb($breadCrumb);
99 $this->edit($action, self::$_entityID);
100 return parent::run();
101 }
102
6a488035 103 /**
fe482240 104 * Get name of edit form.
6a488035 105 *
a6c01b45
CW
106 * @return string
107 * Classname of edit form.
6a488035 108 */
00be9182 109 public function editForm() {
6a488035
TO
110 return 'CRM_Financial_Form_BatchTransaction';
111 }
112
113 /**
fe482240 114 * Get edit form name.
6a488035 115 *
a6c01b45
CW
116 * @return string
117 * name of this page.
6a488035 118 */
00be9182 119 public function editName() {
6a488035
TO
120 return 'Batch';
121 }
122
123 /**
124 * Get user context.
125 *
dd244018
EM
126 * @param null $mode
127 *
a6c01b45
CW
128 * @return string
129 * user context.
6a488035 130 */
045f52a3 131 public function userContext($mode = NULL) {
6a488035
TO
132 return 'civicrm/batchtransaction';
133 }
96025800 134
6a488035 135}