Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
grant_program
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Extensions
grant_program
Commits
8ce39eb9
Commit
8ce39eb9
authored
Sep 04, 2018
by
Monish Deb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 'Find Grant' search form and other refactoring changes
parent
469da524
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
857 additions
and
920 deletions
+857
-920
CRM/Grant/BAO/GrantPayment.php
CRM/Grant/BAO/GrantPayment.php
+10
-17
CRM/Grant/BAO/GrantProgram.php
CRM/Grant/BAO/GrantProgram.php
+121
-6
CRM/Grant/BAO/PaymentSearch.php
CRM/Grant/BAO/PaymentSearch.php
+181
-168
CRM/Grant/DAO/GrantPayment.php
CRM/Grant/DAO/GrantPayment.php
+8
-147
CRM/Grant/Form/Task/GrantPayment.php
CRM/Grant/Form/Task/GrantPayment.php
+277
-74
CRM/Grant/Form/Task/Pay.php
CRM/Grant/Form/Task/Pay.php
+64
-109
CRM/Grant/Form/Task/Reprint.php
CRM/Grant/Form/Task/Reprint.php
+59
-70
CRM/Grant/Selector/PaymentSearch.php
CRM/Grant/Selector/PaymentSearch.php
+124
-126
CRM/Grant/Words.php
CRM/Grant/Words.php
+0
-151
grantprograms.php
grantprograms.php
+4
-11
sql/grantprograms_install.sql
sql/grantprograms_install.sql
+1
-9
templates/CRM/Grant/Form/Task/GrantPayment.tpl
templates/CRM/Grant/Form/Task/GrantPayment.tpl
+8
-32
No files found.
CRM/Grant/BAO/GrantPayment.php
View file @
8ce39eb9
...
@@ -36,7 +36,9 @@
...
@@ -36,7 +36,9 @@
class
CRM_Grant_BAO_GrantPayment
extends
CRM_Grant_DAO_GrantPayment
{
class
CRM_Grant_BAO_GrantPayment
extends
CRM_Grant_DAO_GrantPayment
{
const
STOP
=
1
,
REPRINT
=
2
;
/**
/**
* static field for all the grant information that we can potentially export
* static field for all the grant information that we can potentially export
* @var array
* @var array
...
@@ -93,7 +95,7 @@ class CRM_Grant_BAO_GrantPayment extends CRM_Grant_DAO_GrantPayment {
...
@@ -93,7 +95,7 @@ class CRM_Grant_BAO_GrantPayment extends CRM_Grant_DAO_GrantPayment {
'data_type'
=>
CRM_Utils_Type
::
T_INT
'data_type'
=>
CRM_Utils_Type
::
T_INT
),
),
'payment_number'
=>
array
(
'payment_number'
=>
array
(
'title'
=>
'
Payment
Number'
,
'title'
=>
'
Check
Number'
,
'name'
=>
'payment_number'
,
'name'
=>
'payment_number'
,
'data_type'
=>
CRM_Utils_Type
::
T_INT
'data_type'
=>
CRM_Utils_Type
::
T_INT
),
),
...
@@ -170,26 +172,19 @@ class CRM_Grant_BAO_GrantPayment extends CRM_Grant_DAO_GrantPayment {
...
@@ -170,26 +172,19 @@ class CRM_Grant_BAO_GrantPayment extends CRM_Grant_DAO_GrantPayment {
* @static
* @static
* @return object
* @return object
*/
*/
static
function
add
(
&
$params
,
&
$ids
)
{
static
function
add
(
&
$params
,
&
$ids
=
[])
{
if
(
empty
(
$params
))
{
if
(
empty
(
$params
))
{
return
;
return
;
}
}
if
(
isset
(
$params
[
'total_amount'
]))
{
if
(
isset
(
$params
[
'total_amount'
]))
{
$params
[
$field
]
=
CRM_Utils_Rule
::
cleanMoney
(
$params
[
'total_amount'
]);
$params
[
$field
]
=
CRM_Utils_Rule
::
cleanMoney
(
$params
[
'total_amount'
]);
}
}
// convert dates to mysql format
// convert dates to mysql format
$dates
=
array
(
if
(
isset
(
$params
[
'payment_created_date'
]))
{
'payment_date'
,
$params
[
'payment_created_date'
]
=
CRM_Utils_Date
::
processDate
(
$params
[
'payment_created_date'
],
NULL
,
TRUE
);
'payment_created_date'
);
foreach
(
$dates
as
$date
)
{
if
(
isset
(
$params
[
$date
]))
{
$params
[
$date
]
=
CRM_Utils_Date
::
processDate
(
$params
[
$date
],
NULL
,
TRUE
);
}
}
}
$grantPayment
=
new
CRM_Grant_DAO_GrantPayment
();
$grantPayment
=
new
CRM_Grant_DAO_GrantPayment
();
$grantPayment
->
id
=
CRM_Utils_Array
::
value
(
'id'
,
$ids
);
$grantPayment
->
id
=
CRM_Utils_Array
::
value
(
'id'
,
$ids
);
...
@@ -321,9 +316,7 @@ class CRM_Grant_BAO_GrantPayment extends CRM_Grant_DAO_GrantPayment {
...
@@ -321,9 +316,7 @@ class CRM_Grant_BAO_GrantPayment extends CRM_Grant_DAO_GrantPayment {
$grantDao
->
fetch
();
$grantDao
->
fetch
();
if
(
!
$grantDao
->
N
)
{
if
(
!
$grantDao
->
N
)
{
if
(
$params
[
'messageTemplateID'
])
{
CRM_Core_Error
::
fatal
(
ts
(
'No such message template.'
));
CRM_Core_Error
::
fatal
(
ts
(
'No such message template.'
));
}
}
}
$subject
=
$grantDao
->
subject
;
$subject
=
$grantDao
->
subject
;
$html
=
$grantDao
->
html
;
$html
=
$grantDao
->
html
;
...
...
CRM/Grant/BAO/GrantProgram.php
View file @
8ce39eb9
...
@@ -309,14 +309,12 @@ WHERE civicrm_contact.id = $id ";
...
@@ -309,14 +309,12 @@ WHERE civicrm_contact.id = $id ";
if
(
CRM_Utils_Array
::
value
(
'is_auto_email'
,
$values
))
{
if
(
CRM_Utils_Array
::
value
(
'is_auto_email'
,
$values
))
{
list
(
$displayName
,
$email
)
=
CRM_Contact_BAO_Contact_Location
::
getEmailDetails
(
$contactID
);
list
(
$displayName
,
$email
)
=
CRM_Contact_BAO_Contact_Location
::
getEmailDetails
(
$contactID
);
if
(
isset
(
$email
))
{
if
(
isset
(
$email
))
{
$grantStatuses
=
CRM_Core_OptionGroup
::
values
(
'grant_status'
,
FALSE
,
FALSE
,
FALSE
,
NULL
,
'name'
);
$valueName
=
strtolower
(
$grantStatus
);
$grantStatuses
=
$grantStatuses
[
$values
[
'status_id'
]];
if
(
$grantStatus
==
'Awaiting Information'
)
{
$valueName
=
strtolower
(
$grantStatuses
);
$explode
=
explode
(
' '
,
$grantStatuse
);
if
(
$grantStatuses
==
'Awaiting Information'
)
{
$explode
=
explode
(
' '
,
$grantStatuses
);
$valueName
=
strtolower
(
$explode
[
0
])
.
'_info'
;
$valueName
=
strtolower
(
$explode
[
0
])
.
'_info'
;
}
}
elseif
(
strstr
(
$grantStatus
es
,
'Approved'
))
{
elseif
(
strstr
(
$grantStatus
,
'Approved'
))
{
$valueName
=
strtolower
(
'Approved'
);
$valueName
=
strtolower
(
'Approved'
);
}
}
$sendTemplateParams
=
array
(
$sendTemplateParams
=
array
(
...
@@ -451,4 +449,121 @@ WHERE civicrm_contact.id = $id ";
...
@@ -451,4 +449,121 @@ WHERE civicrm_contact.id = $id ";
);
);
CRM_Activity_BAO_Activity
::
create
(
$params
);
CRM_Activity_BAO_Activity
::
create
(
$params
);
}
}
public
static
function
getAssetFinancialAccountID
()
{
$relationTypeId
=
key
(
CRM_Core_PseudoConstant
::
accountOptionValues
(
'financial_account_type'
,
NULL
,
" AND v.name LIKE 'Asset' "
));
return
CRM_Core_DAO
::
singleValueQuery
(
"SELECT id FROM civicrm_financial_account WHERE is_default = 1 AND financial_account_type_id = %1"
,
[
1
=>
[
$relationTypeId
,
'Integer'
]]
);
}
public
static
function
convertNumberToWords
(
$number
)
{
$hyphen
=
'-'
;
$conjunction
=
' and '
;
$separator
=
', '
;
$negative
=
'negative '
;
$decimal
=
' and '
;
$dictionary
=
array
(
0
=>
'zero'
,
1
=>
'one'
,
2
=>
'two'
,
3
=>
'three'
,
4
=>
'four'
,
5
=>
'five'
,
6
=>
'six'
,
7
=>
'seven'
,
8
=>
'eight'
,
9
=>
'nine'
,
10
=>
'ten'
,
11
=>
'eleven'
,
12
=>
'twelve'
,
13
=>
'thirteen'
,
14
=>
'fourteen'
,
15
=>
'fifteen'
,
16
=>
'sixteen'
,
17
=>
'seventeen'
,
18
=>
'eighteen'
,
19
=>
'nineteen'
,
20
=>
'twenty'
,
30
=>
'thirty'
,
40
=>
'fourty'
,
50
=>
'fifty'
,
60
=>
'sixty'
,
70
=>
'seventy'
,
80
=>
'eighty'
,
90
=>
'ninety'
,
100
=>
'hundred'
,
1000
=>
'thousand'
,
1000000
=>
'million'
,
1000000000
=>
'billion'
,
1000000000000
=>
'trillion'
,
1000000000000000
=>
'quadrillion'
,
1000000000000000000
=>
'quintillion'
);
if
(
!
is_numeric
(
$number
))
{
return
FALSE
;
}
if
((
$number
>=
0
&&
(
int
)
$number
<
0
)
||
(
int
)
$number
<
0
-
PHP_INT_MAX
)
{
// overflow
trigger_error
(
'convertNumberToWords only accepts numbers between -'
.
PHP_INT_MAX
.
' and '
.
PHP_INT_MAX
,
E_USER_WARNING
);
return
FALSE
;
}
if
(
$number
<
0
)
{
return
$negative
.
self
::
convertNumberToWords
(
abs
(
$number
));
}
$string
=
$fraction
=
NULL
;
if
(
strpos
(
$number
,
'.'
)
!==
FALSE
)
{
list
(
$number
,
$fraction
)
=
explode
(
'.'
,
$number
);
}
switch
(
TRUE
)
{
case
$number
<
21
:
$string
=
$dictionary
[
$number
];
break
;
case
$number
<
100
:
$tens
=
((
int
)
(
$number
/
10
))
*
10
;
$units
=
$number
%
10
;
$string
=
$dictionary
[
$tens
];
if
(
$units
)
{
$string
.
=
$hyphen
.
$dictionary
[
$units
];
}
break
;
case
$number
<
1000
:
$hundreds
=
$number
/
100
;
$remainder
=
$number
%
100
;
$string
=
$dictionary
[
$hundreds
]
.
' '
.
$dictionary
[
100
];
if
(
$remainder
)
{
$string
.
=
$conjunction
.
self
::
convertNumberToWords
(
abs
(
$remainder
));
}
break
;
default
:
$baseUnit
=
pow
(
1000
,
floor
(
log
(
$number
,
1000
)));
$numBaseUnits
=
(
int
)
(
$number
/
$baseUnit
);
$remainder
=
$number
%
$baseUnit
;
$string
=
self
::
convertNumberToWords
(
$numBaseUnits
)
.
' '
.
$dictionary
[
$baseUnit
];
if
(
$remainder
)
{
$string
.
=
$remainder
<
100
?
$conjunction
:
$separator
;
$string
.
=
self
::
convertNumberToWords
(
$remainder
);
}
break
;
}
if
(
NULL
!==
$fraction
&&
is_numeric
(
$fraction
))
{
$string
.
=
$decimal
;
$string
.
=
$fraction
.
'/100'
;
}
return
$string
;
}
}
}
CRM/Grant/BAO/PaymentSearch.php
View file @
8ce39eb9
This diff is collapsed.
Click to expand it.
CRM/Grant/DAO/GrantPayment.php
View file @
8ce39eb9
...
@@ -86,30 +86,7 @@ class CRM_Grant_DAO_GrantPayment extends CRM_Core_DAO
...
@@ -86,30 +86,7 @@ class CRM_Grant_DAO_GrantPayment extends CRM_Core_DAO
* @var int unsigned
* @var int unsigned
*/
*/
public
$id
;
public
$id
;
/**
public
$financial_trxn_id
;
* Payment Batch Nnumber
*
* @var int unsigned
*/
public
$payment_batch_number
;
/**
* Payment Number
*
* @var int unsigned
*/
public
$payment_number
;
/**
* Financial Type ID
*
* @var int unsigned
*/
public
$financial_type_id
;
/**
* Contact ID
*
* @var int unsigned
*/
public
$contact_id
;
/**
/**
* Payment Created Date.
* Payment Created Date.
*
*
...
@@ -122,35 +99,6 @@ class CRM_Grant_DAO_GrantPayment extends CRM_Core_DAO
...
@@ -122,35 +99,6 @@ class CRM_Grant_DAO_GrantPayment extends CRM_Core_DAO
* @var date
* @var date
*/
*/
public
$payment_date
;
public
$payment_date
;
/**
* Payable To Name.
*
* @var string
*/
public
$payable_to_name
;
/**
* Payable To Address.
*
* @var string
*/
public
$payable_to_address
;
/**
* Requested grant amount, in default currency.
*
* @var float
*/
public
$amount
;
/**
* 3 character string, value from config setting or input via user.
*
* @var string
*/
public
$currency
;
/**
* Payment Reason.
*
* @var string
*/
public
$payment_reason
;
public
$payment_reason
;
/**
/**
* Payment Status ID
* Payment Status ID
...
@@ -196,46 +144,13 @@ class CRM_Grant_DAO_GrantPayment extends CRM_Core_DAO
...
@@ -196,46 +144,13 @@ class CRM_Grant_DAO_GrantPayment extends CRM_Core_DAO
'dataPattern'
=>
''
,
'dataPattern'
=>
''
,
'export'
=>
true
,
'export'
=>
true
,
)
,
)
,
'
payment_batch_number
'
=>
array
(
'
financial_trxn_id
'
=>
array
(
'name'
=>
'
payment_batch_number
'
,
'name'
=>
'
financial_trxn_id
'
,
'type'
=>
CRM_Utils_Type
::
T_INT
,
'type'
=>
CRM_Utils_Type
::
T_INT
,
'title'
=>
ts
(
'
Payment Batch Nnumber
'
)
,
'title'
=>
ts
(
'
Financial Trxn ID
'
)
,
'required'
=>
true
,
'required'
=>
true
,
'import'
=>
true
,
'import'
=>
true
,
'where'
=>
'civicrm_payment.payment_batch_number'
,
'where'
=>
'civicrm_payment.financial_trxn_id'
,
'headerPattern'
=>
''
,
'dataPattern'
=>
''
,
'export'
=>
true
,
)
,
'payment_number'
=>
array
(
'name'
=>
'payment_number'
,
'type'
=>
CRM_Utils_Type
::
T_INT
,
'title'
=>
ts
(
'Payment Number'
)
,
'required'
=>
true
,
'import'
=>
true
,
'where'
=>
'civicrm_payment.payment_number'
,
'headerPattern'
=>
''
,
'dataPattern'
=>
''
,
'export'
=>
true
,
)
,
'financial_type_id'
=>
array
(
'name'
=>
'financial_type_id'
,
'type'
=>
CRM_Utils_Type
::
T_INT
,
'title'
=>
ts
(
'Financial Type ID'
)
,
'required'
=>
true
,
'import'
=>
true
,
'where'
=>
'civicrm_payment.financial_type_id'
,
'headerPattern'
=>
''
,
'dataPattern'
=>
''
,
'export'
=>
true
,
)
,
'contact_id'
=>
array
(
'name'
=>
'contact_id'
,
'type'
=>
CRM_Utils_Type
::
T_INT
,
'title'
=>
ts
(
'Contact ID'
)
,
'required'
=>
true
,
'import'
=>
true
,
'where'
=>
'civicrm_payment.contact_id'
,
'headerPattern'
=>
''
,
'headerPattern'
=>
''
,
'dataPattern'
=>
''
,
'dataPattern'
=>
''
,
'export'
=>
true
,
'export'
=>
true
,
...
@@ -250,63 +165,6 @@ class CRM_Grant_DAO_GrantPayment extends CRM_Core_DAO
...
@@ -250,63 +165,6 @@ class CRM_Grant_DAO_GrantPayment extends CRM_Core_DAO
'dataPattern'
=>
''
,
'dataPattern'
=>
''
,
'export'
=>
true
,
'export'
=>
true
,
)
,
)
,
'payment_date'
=>
array
(
'name'
=>
'payment_date'
,
'type'
=>
CRM_Utils_Type
::
T_DATE
,
'title'
=>
ts
(
'Payment Date'
)
,
'import'
=>
true
,
'where'
=>
'civicrm_payment.payment_date'
,
'headerPattern'
=>
''
,
'dataPattern'
=>
''
,
'export'
=>
true
,
)
,
'payable_to_name'
=>
array
(
'name'
=>
'payable_to_name'
,
'type'
=>
CRM_Utils_Type
::
T_STRING
,
'title'
=>
ts
(
'Payable To Name'
)
,
'maxlength'
=>
255
,
'size'
=>
CRM_Utils_Type
::
HUGE
,
'import'
=>
true
,
'where'
=>
'civicrm_payment.payable_to_name'
,
'headerPattern'
=>
''
,
'dataPattern'
=>
''
,
'export'
=>
true
,
)
,
'payable_to_address'
=>
array
(
'name'
=>
'payable_to_address'
,
'type'
=>
CRM_Utils_Type
::
T_STRING
,
'title'
=>
ts
(
'Payable To Address'
)
,
'maxlength'
=>
255
,
'size'
=>
CRM_Utils_Type
::
HUGE
,
'import'
=>
true
,
'where'
=>
'civicrm_payment.payable_to_address'
,
'headerPattern'
=>
''
,
'dataPattern'
=>
''
,
'export'
=>
true
,
)
,
'amount'
=>
array
(
'name'
=>
'amount'
,
'type'
=>
CRM_Utils_Type
::
T_MONEY
,
'title'
=>
ts
(
'Amount'
)
,
'required'
=>
true
,
'import'
=>
true
,
'where'
=>
'civicrm_payment.amount'
,
'headerPattern'
=>
''
,
'dataPattern'
=>
'/^\d+(\.\d{2})?$/'
,
'export'
=>
true
,
)
,
'currency'
=>
array
(
'name'
=>
'currency'
,
'type'
=>
CRM_Utils_Type
::
T_STRING
,
'title'
=>
ts
(
'Currency'
)
,
'maxlength'
=>
3
,
'size'
=>
CRM_Utils_Type
::
FOUR
,
'import'
=>
true
,
'where'
=>
'civicrm_payment.currency'
,
'headerPattern'
=>
'/cur(rency)?/i'
,
'dataPattern'
=>
'/^[A-Z]{3}$/i'
,
'export'
=>
true
,
)
,
'payment_reason'
=>
array
(
'payment_reason'
=>
array
(
'name'
=>
'payment_reason'
,
'name'
=>
'payment_reason'
,
'type'
=>
CRM_Utils_Type
::
T_STRING
,
'type'
=>
CRM_Utils_Type
::
T_STRING
,
...
@@ -323,6 +181,9 @@ class CRM_Grant_DAO_GrantPayment extends CRM_Core_DAO
...
@@ -323,6 +181,9 @@ class CRM_Grant_DAO_GrantPayment extends CRM_Core_DAO
'name'
=>
'payment_status_id'
,
'name'
=>
'payment_status_id'
,
'type'
=>
CRM_Utils_Type
::
T_INT
,
'type'
=>
CRM_Utils_Type
::
T_INT
,
'title'
=>
ts
(
'Payment Status'
)
,
'title'
=>
ts
(
'Payment Status'
)
,
'pseudoconstant'
=>
[
'optionGroupName'
=>
'grant_payment_status'
,
]
)
,
)
,
'replaces_payment_id'
=>
array
(
'replaces_payment_id'
=>
array
(
'name'
=>
'replaces_payment_id'
,
'name'
=>
'replaces_payment_id'
,
...
...
CRM/Grant/Form/Task/GrantPayment.php
View file @
8ce39eb9
...
@@ -38,14 +38,12 @@
...
@@ -38,14 +38,12 @@
* This class generates form components for Payments
* This class generates form components for Payments
*
*
*/
*/
class
CRM_Grant_Form_Task_GrantPayment
extends
CRM_Core_Form
class
CRM_Grant_Form_Task_GrantPayment
extends
CRM_Core_Form
{
{
protected
$_id
=
null
;
protected
$_id
=
null
;
protected
$_fields
=
null
;
protected
$_fields
=
null
;
function
preProcess
(
)
{
function
preProcess
()
{
parent
::
preProcess
(
);
$this
->
_action
=
CRM_Utils_Request
::
retrieve
(
'action'
,
'String'
,
$this
);
$this
->
_action
=
CRM_Utils_Request
::
retrieve
(
'action'
,
'String'
,
$this
);
$this
->
_prid
=
CRM_Utils_Request
::
retrieve
(
'prid'
,
'Positive'
,
$this
);
$this
->
_prid
=
CRM_Utils_Request
::
retrieve
(
'prid'
,
'Positive'
,
$this
);
if
(
$this
->
_prid
)
{
if
(
$this
->
_prid
)
{
$session
=
CRM_Core_Session
::
singleton
();
$session
=
CRM_Core_Session
::
singleton
();
...
@@ -54,104 +52,308 @@ class CRM_Grant_Form_Task_GrantPayment extends CRM_Core_Form
...
@@ -54,104 +52,308 @@ class CRM_Grant_Form_Task_GrantPayment extends CRM_Core_Form
}
}
}
}
function
setDefaultValues
(
)
/**
{
* Get payment fields
$defaults
=
array
();
*/
$paymentNumbers
=
CRM_Grant_BAO_GrantPayment
::
getMaxPayementBatchNumber
(
);
public
function
getPaymentFields
()
{
$defaults
[
'payment_date'
]
=
strftime
(
"%m/%d/%Y"
,
strtotime
(
date
(
'Y/m/d'
)
));
return
array
(
$defaults
[
'payment_number'
]
=
$paymentNumbers
[
'payment_number'
]
+
1
;
'check_number'
=>
array
(
$defaults
[
'payment_batch_number'
]
=
$paymentNumbers
[
'payment_batch_number'
]
+
1
;
'is_required'
=>
TRUE
,
'add_field'
=>
TRUE
,
return
$defaults
;
),
'trxn_id'
=>
array
(
'add_field'
=>
TRUE
,
'is_required'
=>
FALSE
,
),
'description'
=>
array
(
'htmlType'
=>
'textarea'
,
'name'
=>
'description'
,
'title'
=>
ts
(
'Payment reason'
),
'is_required'
=>
FALSE
,
'attributes'
=>
[],
),
'trxn_date'
=>
array
(
'htmlType'
=>
'datepicker'
,
'name'
=>
'trxn_date'
,
'title'
=>
ts
(
'Payment date to appear on cheques'
),
'is_required'
=>
TRUE
,
'attributes'
=>
array
(
'date'
=>
'yyyy-mm-dd'
,
'time'
=>
24
,
'context'
=>
'create'
,
'action'
=>
'create'
,
),
),
'contribution_batch_id'
=>
[
'htmlType'
=>
'select'
,
'name'
=>
'contribution_batch_id'
,
'title'
=>
ts
(
'Assign to Batch'
),
'attributes'
=>
[
''
=>
ts
(
'None'
)]
+
CRM_Contribute_PseudoConstant
::
batch
(),
'is_required'
=>
TRUE
,
],
);
}
}
/**
/**
* Function to build the form
* Function to build the form
*
*
* @return None
* @return None
* @access public
* @access public
*/
*/
public
function
buildQuickForm
(
$check
=
false
)
public
function
buildQuickForm
(){
{
if
(
$this
->
_action
&
CRM_Core_Action
::
DELETE
)
{
parent
::
buildQuickForm
(
);
$this
->
addButtons
([
if
(
$this
->
_action
&
CRM_Core_Action
::
DELETE
)
{
[
'type'
=>
'next'
,
$this
->
addButtons
(
array
(
'name'
=>
ts
(
'Delete'
),
array
(
'type'
=>
'next'
,
'isDefault'
=>
TRUE
,
'name'
=>
ts
(
'Delete'
),
],
'isDefault'
=>
true
),
[
'type'
=>
'cancel'
,
array
(
'type'
=>
'cancel'
,
'name'
=>
ts
(
'Cancel'
),
'name'
=>
ts
(
'Cancel'
)
),
],
)
]);
);
return
;
return
;
}
}
$this
->
applyFilter
(
'__ALL__'
,
'trim'
);
$paymentFields
=
$this
->
getPaymentFields
();
$attributes
=
CRM_Core_DAO
::
getAttribute
(
'CRM_Grant_DAO_GrantProgram'
);
$this
->
assign
(
'paymentFields'
,
$paymentFields
);
foreach
(
$paymentFields
as
$name
=>
$paymentField
)
{
if
(
!
empty
(
$paymentField
[
'add_field'
]))
{
$attributes
=
array
(
'entity'
=>
'FinancialTrxn'
,
'name'
=>
$name
,
'context'
=>
'create'
,
'action'
=>
'create'
,
);
$this
->
addField
(
$name
,
$attributes
,
$paymentField
[
'is_required'
]);
}
else
{
$this
->
add
(
$paymentField
[
'htmlType'
],
$name
,
$paymentField
[
'title'
],
$paymentField
[
'attributes'
],
$paymentField
[
'is_required'
]
);
}
}
$this
->
_contributionTypes
=
CRM_Grant_BAO_GrantProgram
::
contributionTypes
();
$buttonName
=
$this
->
_prid
?
'Reprint Checks and CSV Export'
:
'Create Checks and CSV Export'
;
$this
->
add
(
'select'
,
'financial_type_id'
,
ts
(
'From account'
),
$this
->
addButtons
([
array
(
''
=>
ts
(
'- select -'
)
)
+
$this
->
_contributionTypes
,
true
);
[
'type'
=>
'upload'
,
'name'
=>
ts
(
$buttonName
),
'isDefault'
=>
TRUE
,
],
[
'type'
=>
'cancel'
,
'name'
=>
ts
(
'Cancel'
),
],
]);
}
$this
->
add
(
'text'
,
'payment_batch_number'
,
ts
(
'Payment Batch number'
),
public
function
postProcess
()
{
$attributes
[
'label'
],
true
);
$values
=
$this
->
controller
->
exportValues
(
$this
->
_name
);
$approvedGrants
=
$this
->
get
(
'approvedGrants'
);
$approvedGrantIDs
=
array_keys
(
$approvedGrants
);
$grantPrograms
=
CRM_Grant_BAO_GrantProgram
::
getGrantPrograms
();
$contributionStatuses
=
CRM_Contribute_PseudoConstant
::
contributionStatus
(
NULL
,
'name'
);
$financialItemStatus
=
CRM_Core_PseudoConstant
::
accountOptionValues
(
'financial_item_status'
);
$checkID
=
CRM_Core_PseudoConstant
::
getKey
(
'CRM_Contribute_DAO_Contribution'
,
'payment_instrument_id'
,
'Check'
);
$mailParams
=
$printedRows
=
$files
=
[];
$totalAmount
=
$counter
=
0
;
$maxLimit
=
CRM_Utils_Array
::
value
(
'Maximum number of checks per pdf file'
,
CRM_Core_OptionGroup
::
values
(
'grant_thresholds'
,
TRUE
));
$config
=
CRM_Core_Config
::
singleton
();
$entityFileDAO
=
new
CRM_Core_DAO_EntityFile
();
$this
->
add
(
'text'
,
'payment_number'
,
ts
(
'Starting cheque number'
),
$dao
=
CRM_Core_DAO
::
executeQuery
(
sprintf
(
"
$attributes
[
'label'
],
true
);
SELECT ft.id as ft_id, g.id as grant_id, fi.id as fi_id,