Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
6a488035 TO |
2 | /* |
3 | +--------------------------------------------------------------------+ | |
bc77d7c0 | 4 | | Copyright CiviCRM LLC. All rights reserved. | |
6a488035 | 5 | | | |
bc77d7c0 TO |
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 | | |
6a488035 | 9 | +--------------------------------------------------------------------+ |
d25dd0ee | 10 | */ |
6a488035 TO |
11 | |
12 | /** | |
13 | * | |
14 | * @package CRM | |
ca5cec67 | 15 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
6a488035 TO |
16 | */ |
17 | ||
18 | /** | |
19 | * Page for displaying list of financial types | |
20 | */ | |
21 | class CRM_Financial_Page_FinancialBatch extends CRM_Core_Page_Basic { | |
22 | ||
23 | /** | |
fe482240 | 24 | * The action links that we need to display for the browse screen. |
6a488035 TO |
25 | * |
26 | * @var array | |
6a488035 | 27 | */ |
7b966967 | 28 | public static $_links = NULL; |
6a488035 TO |
29 | |
30 | /** | |
fe482240 | 31 | * Get BAO Name. |
6a488035 | 32 | * |
a6c01b45 CW |
33 | * @return string |
34 | * classname of BAO. | |
6a488035 | 35 | */ |
00be9182 | 36 | public function getBAOName() { |
6a488035 TO |
37 | return 'CRM_Batch_BAO_Batch'; |
38 | } | |
39 | ||
40 | /** | |
fe482240 | 41 | * Get action Links. |
6a488035 | 42 | * |
a6c01b45 CW |
43 | * @return array |
44 | * (reference) of action links | |
6a488035 | 45 | */ |
00be9182 | 46 | public function &links() { |
6a488035 | 47 | if (!(self::$_links)) { |
be2fb01f | 48 | self::$_links = []; |
6a488035 TO |
49 | } |
50 | return self::$_links; | |
51 | } | |
52 | ||
53 | /** | |
54 | * Run the page. | |
55 | * | |
56 | * This method is called after the page is created. It checks for the | |
57 | * type of action and executes that action. | |
58 | * Finally it calls the parent's run method. | |
6a488035 | 59 | */ |
00be9182 | 60 | public function run() { |
edc80cda | 61 | $context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this); |
6a488035 | 62 | $this->set("context", $context); |
5d6d0104 AH |
63 | |
64 | $id = $this->getIdAndAction(); | |
23cb875c | 65 | |
66 | // what action to take ? | |
5d6d0104 | 67 | if ($this->_action & (CRM_Core_Action::UPDATE | |
23cb875c | 68 | CRM_Core_Action::ADD | |
69 | CRM_Core_Action::CLOSE | | |
70 | CRM_Core_Action::REOPEN | | |
71 | CRM_Core_Action::EXPORT) | |
72 | ) { | |
5d6d0104 | 73 | $this->edit($this->_action, $id); |
23cb875c | 74 | } |
6a488035 | 75 | // parent run |
5d6d0104 | 76 | return CRM_Core_Page::run(); |
6a488035 TO |
77 | } |
78 | ||
6a488035 | 79 | /** |
fe482240 | 80 | * Get name of edit form. |
6a488035 | 81 | * |
a6c01b45 CW |
82 | * @return string |
83 | * classname of edit form. | |
6a488035 | 84 | */ |
00be9182 | 85 | public function editForm() { |
6a488035 TO |
86 | return 'CRM_Financial_Form_FinancialBatch'; |
87 | } | |
88 | ||
89 | /** | |
fe482240 | 90 | * Get edit form name. |
6a488035 | 91 | * |
a6c01b45 CW |
92 | * @return string |
93 | * name of this page. | |
6a488035 | 94 | */ |
00be9182 | 95 | public function editName() { |
6a488035 TO |
96 | return 'Accounting Batch'; |
97 | } | |
98 | ||
99 | /** | |
100 | * Get user context. | |
03e04002 | 101 | * |
6a488035 TO |
102 | * Redirect to civicrm home page when clicked on cancel button |
103 | * | |
6c8f6e67 EM |
104 | * @param null $mode |
105 | * | |
a6c01b45 CW |
106 | * @return string |
107 | * user context. | |
6a488035 | 108 | */ |
045f52a3 | 109 | public function userContext($mode = NULL) { |
6a488035 TO |
110 | $context = $this->get("context"); |
111 | if ($mode == CRM_Core_Action::UPDATE || ($mode = CRM_Core_Action::ADD & isset($context))) { | |
112 | return "civicrm/financial/financialbatches"; | |
113 | } | |
114 | return 'civicrm'; | |
115 | } | |
116 | ||
e0ef6999 EM |
117 | /** |
118 | * @param null $mode | |
119 | * | |
120 | * @return string | |
121 | */ | |
00be9182 | 122 | public function userContextParams($mode = NULL) { |
6a488035 TO |
123 | $context = $this->get("context"); |
124 | if ($mode == CRM_Core_Action::UPDATE || ($mode = CRM_Core_Action::ADD & isset($context))) { | |
125 | return "reset=1&batchStatus={$context}"; | |
126 | } | |
127 | } | |
128 | ||
232624b1 | 129 | } |