3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.4 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2013 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
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. |
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. |
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 +--------------------------------------------------------------------+
31 * @copyright CiviCRM LLC (c) 2004-2013
37 * This class generates form components for Financial Type
40 class CRM_Financial_Form_BatchTransaction
extends CRM_Contribute_Form
{
41 static $_links = NULL;
48 protected $_batchStatusId;
50 function preProcess() {
51 self
::$_entityID = CRM_Utils_Request
::retrieve( 'bid' , 'Positive' ) ? CRM_Utils_Request
::retrieve( 'bid' , 'Positive' ) : $_POST['batch_id'];
52 $this->assign('entityID', self
::$_entityID);
53 if (isset(self
::$_entityID)) {
54 $this->_batchStatusId
= CRM_Core_DAO
::getFieldValue('CRM_Batch_BAO_Batch', self
::$_entityID, 'status_id');
55 $this->assign('statusID', $this->_batchStatusId
);
57 $batchTitle = CRM_Core_DAO
::getFieldValue('CRM_Batch_BAO_Batch', self
::$_entityID, 'title');
58 CRM_Utils_System
::setTitle(ts('Accounting Batch - %1', array(1 => $batchTitle)));
62 'created_by' => ts('Created By'),
63 'status' => ts('Status'),
64 'description'=> ts('Description'),
65 'payment_instrument' => ts('Payment Instrument'),
66 'item_count' => ts('Entered Transactions'),
67 'assigned_item_count' => ts('Assigned Transactions'),
68 'total' => ts('Entered Total'),
69 'assigned_total' => ts('Assigned Total'),
70 'opened_date' => ts('Opened'),
72 $this->assign('columnHeaders', $columnHeaders);
76 * Function to build the form
81 public function buildQuickForm() {
82 if ($this->_batchStatusId
== 2) {
83 $this->add('submit', 'export_batch', ts('Export Batch'));
86 // do not build rest of form unless it is open batch
87 if ($this->_batchStatusId
!= 1 ) {
91 parent
::buildQuickForm();
92 $this->add('submit', 'close_batch', ts('Close Batch'));
93 $this->add('submit', 'export_batch', ts('Close & Export Batch'));
96 $this->addElement('text',
98 ts('Contributor Name or Email'),
99 CRM_Core_DAO
::getAttribute('CRM_Contact_DAO_Contact',
104 $this->_group
= CRM_Core_PseudoConstant
::group();
106 // multiselect for groups
108 $this->add('select', 'group', ts('Groups'), $this->_group
, FALSE,
109 array('id' => 'group', 'multiple' => 'multiple', 'title' => ts('- select -'))
112 $contactTags = CRM_Core_BAO_Tag
::getTags();
115 $this->add('select', 'contact_tags', ts('Tags'), $contactTags, FALSE,
116 array('id' => 'contact_tags', 'multiple' => 'multiple', 'title' => ts('- select -'))
119 CRM_Contribute_BAO_Query
::buildSearchForm($this);
120 $this->addElement('checkbox', 'toggleSelects', NULL, NULL);
122 $this->add( 'select',
125 array( '' => ts( '- actions -' )) +
array( 'Remove' => ts('Remove from Batch')));
127 $this->add('submit','rSubmit', ts('Go'),
129 'class' => 'form-submit',
133 self
::$_entityID = CRM_Utils_Request
::retrieve('bid' , 'Positive');
137 array('type' => 'submit',
138 'name' => ts('Search'),
144 $this->addElement('checkbox', 'toggleSelect', NULL, NULL);
145 $this->add( 'select',
148 array( '' => ts( '- actions -' )) +
array( 'Assign' => ts( 'Assign to Batch' )));
150 $this->add('submit','submit', ts('Go'),
152 'class' => 'form-submit',
155 $this->applyFilter('__ALL__', 'trim');
157 $this->addElement('hidden', 'batch_id', self
::$_entityID);
159 $this->add('text', 'name', ts('Batch Name'));
162 function setDefaultValues() {
163 // do not setdefault unless it is open batch
164 if ($this->_batchStatusId
!= 1 ) {
167 if (isset(self
::$_entityID)) {
168 $paymentInstrumentID = CRM_Core_DAO
::getFieldValue('CRM_Batch_BAO_Batch', self
::$_entityID, 'payment_instrument_id');
169 $defaults['contribution_payment_instrument_id'] = $paymentInstrumentID;
170 $this->assign('paymentInstrumentID', $paymentInstrumentID);
176 if (!(self
::$_links)) {
177 self
::$_links = array(
179 'name' => ts('View'),
180 'url' => 'civicrm/contact/view/contribution',
181 'qs' => 'reset=1&id=%%contid%%&cid=%%cid%%&action=view&context=contribution&selectedChild=contribute',
182 'title' => ts('View Contribution'),
185 'name' => ts('Assign'),
186 'ref' => 'disable-action',
187 'title' => ts('Assign Transaction'),
188 'extra' => 'onclick = "assignRemove( %%id%%,\'' . 'assign' . '\' );"',
192 return self
::$_links;