4 +--------------------------------------------------------------------+
5 | CiviCRM version 4.3 |
6 +--------------------------------------------------------------------+
7 | Copyright CiviCRM LLC (c) 2004-2013 |
8 +--------------------------------------------------------------------+
9 | This file is a part of CiviCRM. |
11 | CiviCRM is free software; you can copy, modify, and distribute it |
12 | under the terms of the GNU Affero General Public License |
13 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
15 | CiviCRM is distributed in the hope that it will be useful, but |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. |
20 | You should have received a copy of the GNU Affero General Public |
21 | License and the CiviCRM Licensing Exception along |
22 | with this program; if not, contact CiviCRM LLC |
23 | at info[AT]civicrm[DOT]org. If you have questions about the |
24 | GNU Affero General Public License or the licensing of CiviCRM, |
25 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
26 +--------------------------------------------------------------------+
32 * @copyright CiviCRM LLC (c) 2004-2013
38 * This class generates form components for Financial Type
41 class CRM_Financial_Form_BatchTransaction
extends CRM_Contribute_Form
{
42 static $_links = NULL;
49 protected $_batchStatusId;
51 function preProcess() {
52 self
::$_entityID = CRM_Utils_Request
::retrieve( 'bid' , 'Positive' ) ? CRM_Utils_Request
::retrieve( 'bid' , 'Positive' ) : $_POST['batch_id'];
53 $this->assign('entityID', self
::$_entityID);
54 if (isset(self
::$_entityID)) {
55 $this->_batchStatusId
= CRM_Core_DAO
::getFieldValue('CRM_Batch_BAO_Batch', self
::$_entityID, 'status_id');
56 $this->assign('statusID', $this->_batchStatusId
);
58 $batchTitle = CRM_Core_DAO
::getFieldValue('CRM_Batch_BAO_Batch', self
::$_entityID, 'title');
59 CRM_Utils_System
::setTitle(ts('Accounting Batch - %1', array(1 => $batchTitle)));
63 'created_by' => ts('Created By'),
64 'status' => ts('Status'),
65 'description'=> ts('Description'),
66 'payment_instrument' => ts('Payment Instrument'),
67 'item_count' => ts('Entered Transactions'),
68 'assigned_item_count' => ts('Assigned Transactions'),
69 'total' => ts('Entered Total'),
70 'assigned_total' => ts('Assigned Total'),
71 'opened_date' => ts('Opened'),
73 $this->assign('columnHeaders', $columnHeaders);
77 * Function to build the form
82 public function buildQuickForm() {
83 if ($this->_batchStatusId
== 2) {
84 $this->add('submit', 'export_batch', ts('Export Batch'));
87 // do not build rest of form unless it is open batch
88 if ($this->_batchStatusId
!= 1 ) {
92 parent
::buildQuickForm();
93 $this->add('submit', 'close_batch', ts('Close Batch'));
94 $this->add('submit', 'export_batch', ts('Close & Export Batch'));
97 $this->addElement('text',
99 ts('Contributor Name or Email'),
100 CRM_Core_DAO
::getAttribute('CRM_Contact_DAO_Contact',
105 $this->_group
= CRM_Core_PseudoConstant
::group();
107 // multiselect for groups
109 $this->add('select', 'group', ts('Groups'), $this->_group
, FALSE,
110 array('id' => 'group', 'multiple' => 'multiple', 'title' => ts('- select -'))
113 $contactTags = CRM_Core_BAO_Tag
::getTags();
116 $this->add('select', 'contact_tags', ts('Tags'), $contactTags, FALSE,
117 array('id' => 'contact_tags', 'multiple' => 'multiple', 'title' => ts('- select -'))
120 CRM_Contribute_BAO_Query
::buildSearchForm($this);
121 $this->addElement('checkbox', 'toggleSelects', NULL, NULL);
123 $this->add( 'select',
126 array( '' => ts( '- actions -' )) +
array( 'Remove' => ts('Remove from Batch')));
128 $this->add('submit','rSubmit', ts('Go'),
130 'class' => 'form-submit',
134 self
::$_entityID = CRM_Utils_Request
::retrieve('bid' , 'Positive');
138 array('type' => 'submit',
139 'name' => ts('Search'),
145 $this->addElement('checkbox', 'toggleSelect', NULL, NULL);
146 $this->add( 'select',
149 array( '' => ts( '- actions -' )) +
array( 'Assign' => ts( 'Assign to Batch' )));
151 $this->add('submit','submit', ts('Go'),
153 'class' => 'form-submit',
156 $this->applyFilter('__ALL__', 'trim');
158 $this->addElement('hidden', 'batch_id', self
::$_entityID);
160 $this->add('text', 'name', ts('Batch Name'));
163 function setDefaultValues() {
164 // do not setdefault unless it is open batch
165 if ($this->_batchStatusId
!= 1 ) {
168 if (isset(self
::$_entityID)) {
169 $paymentInstrumentID = CRM_Core_DAO
::getFieldValue('CRM_Batch_BAO_Batch', self
::$_entityID, 'payment_instrument_id');
170 $defaults['contribution_payment_instrument_id'] = $paymentInstrumentID;
171 $this->assign('paymentInstrumentID', $paymentInstrumentID);
177 if (!(self
::$_links)) {
178 self
::$_links = array(
180 'name' => ts('View'),
181 'url' => 'civicrm/contact/view/contribution',
182 'qs' => 'reset=1&id=%%contid%%&cid=%%cid%%&action=view&context=contribution&selectedChild=contribute',
183 'title' => ts('View Contribution'),
186 'name' => ts('Assign'),
187 'ref' => 'disable-action',
188 'title' => ts('Assign Transaction'),
189 'extra' => 'onclick = "assignRemove( %%id%%,\'' . 'assign' . '\' );"',
193 return self
::$_links;