Commit d73ef2fd authored by Monish Deb's avatar Monish Deb

remove remaining code to support civicrm_entity_payment

parent 6eee4d89
......@@ -262,11 +262,6 @@ class CRM_Grant_BAO_PaymentSearch {
return $result;
}
function grantID(&$values) {
$this->_where[$grouping][] = " ( civicrm_entity_payment.entity_id = $values )";
$this->_tables['civicrm_entity_payment'] = $this->_whereTables['civicrm_entity_payment'] = 1;
}
/**
* build select for CiviGrant
*
......
<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.3 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| CiviCRM is free software; you can copy, modify, and distribute it |
| under the terms of the GNU Affero General Public License |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
| |
| CiviCRM is distributed in the hope that it will be useful, but |
| WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| See the GNU Affero General Public License for more details. |
| |
| You should have received a copy of the GNU Affero General Public |
| License and the CiviCRM Licensing Exception along |
| with this program; if not, contact CiviCRM LLC |
| at info[AT]civicrm[DOT]org. If you have questions about the |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
*/
/**
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2013
* $Id$
*
*/
require_once 'CRM/Core/DAO.php';
require_once 'CRM/Utils/Type.php';
class CRM_Grant_DAO_EntityPayment extends CRM_Core_DAO
{
/**
* static instance to hold the table name
*
* @var string
* @static
*/
static $_tableName = 'civicrm_entity_payment';
/**
* static instance to hold the field values
*
* @var array
* @static
*/
static $_fields = null;
/**
* static instance to hold the FK relationships
*
* @var string
* @static
*/
static $_links = null;
/**
* static instance to hold the values that can
* be imported
*
* @var array
* @static
*/
static $_import = null;
/**
* static instance to hold the values that can
* be exported
*
* @var array
* @static
*/
static $_export = null;
/**
* static value to see if we should log any modifications to
* this table in the civicrm_log table
*
* @var boolean
* @static
*/
static $_log = true;
/**
* ID
*
* @var int unsigned
*/
public $id;
/**
* Type of grant. Implicit FK to civicrm_payment.
*
* @var int unsigned
*/
public $payment_id;
/**
* Entity Table.
*
* @var string
*/
public $entity_table;
/**
* Entity ID
*
* @var int unsigned
*/
public $entity_id;
/**
* class constructor
*
* @access public
* @return civicrm_entity_payment
*/
function __construct()
{
$this->__table = 'civicrm_entity_payment';
parent::__construct();
}
/**
* return foreign links
*
* @access public
* @return array
*/
function links()
{
if (!(self::$_links)) {
self::$_links = array(
'payment_id' => 'civicrm_payment:id',
);
}
return self::$_links;
}
/**
* returns all the column names of this table
*
* @access public
* @return array
*/
static function &fields()
{
if (!(self::$_fields)) {
self::$_fields = array(
'id' => array(
'name' => 'id',
'type' => CRM_Utils_Type::T_INT,
'title' => ts('ID') ,
'required' => true,
'import' => true,
'where' => 'civicrm_entity_payment.id',
'headerPattern' => '',
'dataPattern' => '',
'export' => true,
) ,
'payment_id' => array(
'name' => 'payment_id',
'type' => CRM_Utils_Type::T_INT,
'title' => ts('Payment Id') ,
'required' => true,
'export' => false,
'where' => 'civicrm_entity_payment.payment_id',
'headerPattern' => '',
'dataPattern' => '',
'FKClassName' => 'CRM_Grant_DAO_GrantPayment',
) ,
'entity_table' => array(
'name' => 'entity_table',
'type' => CRM_Utils_Type::T_STRING,
'title' => ts('Entity Table') ,
'maxlength' => 255,
'size' => CRM_Utils_Type::HUGE,
'import' => true,
'where' => 'civicrm_entity_payment.entity_table',
'headerPattern' => '',
'dataPattern' => '',
'export' => true,
) ,
'id' => array(
'name' => 'entity_id',
'type' => CRM_Utils_Type::T_INT,
'title' => ts('Entity ID') ,
'required' => true,
'import' => true,
'where' => 'civicrm_entity_payment.entity_id',
'headerPattern' => '',
'dataPattern' => '',
'export' => true,
) ,
);
}
return self::$_fields;
}
/**
* returns the names of this table
*
* @access public
* @static
* @return string
*/
static function getTableName()
{
return self::$_tableName;
}
/**
* returns if this table needs to be logged
*
* @access public
* @return boolean
*/
function getLog()
{
return self::$_log;
}
/**
* returns the list of fields that can be imported
*
* @access public
* return array
* @static
*/
static function &import($prefix = false)
{
if (!(self::$_import)) {
self::$_import = array();
$fields = self::fields();
foreach($fields as $name => $field) {
if (CRM_Utils_Array::value('import', $field)) {
if ($prefix) {
self::$_import['entity_payment'] = & $fields[$name];
} else {
self::$_import[$name] = & $fields[$name];
}
}
}
}
return self::$_import;
}
/**
* returns the list of fields that can be exported
*
* @access public
* return array
* @static
*/
static function &export($prefix = false)
{
if (!(self::$_export)) {
self::$_export = array();
$fields = self::fields();
foreach($fields as $name => $field) {
if (CRM_Utils_Array::value('export', $field)) {
if ($prefix) {
self::$_export['entity_payment'] = & $fields[$name];
} else {
self::$_export[$name] = & $fields[$name];
}
}
}
}
return self::$_export;
}
}
......@@ -105,11 +105,16 @@ class CRM_Grant_Form_Payment_View extends CRM_Core_Form {
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/grant/payment/reprint', 'reset=1&prid=' . $this->_id));
}
elseif ($this->_action & CRM_Core_Action::WITHDRAW) {
$query = "SELECT cp.id as pid, cg.amount_granted as total_amount, cp.currency, cp.payment_reason, cp.contact_id as id, cep.entity_id as grant_id, cg.grant_program_id, cg.grant_type_id FROM civicrm_payment as cp LEFT JOIN civicrm_entity_payment as cep ON cep.payment_id = cp.id LEFT JOIN civicrm_grant as cg ON cg.id = cep.entity_id WHERE cp.id IN (".$this->_id.")";
$query = "
SELECT cp.id as pid, cg.amount_granted as total_amount, cp.currency, cg.contact_id, cg.id as grant_id, cg.grant_program_id, cg.grant_type_id
FROM civicrm_payment as cp
LEFT JOIN civicrm_entity_financial_trxn ceft ON ceft.financial_trxn_id = cp.financial_trxn_id AND ceft.entity_table = 'civicrm_grant'
LEFT JOIN civicrm_grant as cg ON cg.id = ceft.entity_id
WHERE cp.id IN (" . $this->_id . ")";
$grantDao = CRM_Grant_DAO_Grant::executeQuery($query);
while ($grantDao->fetch()) {
$ids['grant_id'] = $grantDao->grant_id;
$grantParams['contact_id'] = $grantDao->id;
$grantParams['contact_id'] = $grantDao->contact_id;
$grantParams['grant_program_id'] = $grantDao->grant_program_id;
$grantParams['grant_type_id'] = $grantDao->grant_type_id;
$grantParams['id'] = $grantDao->grant_id;
......
......@@ -113,10 +113,6 @@ function from($name, $mode, $side) {
elseif ($name == 'status_weight') {
return " $side JOIN civicrm_option_value v ON (civicrm_grant.status_id = v.value AND v.option_group_id=21)";
}
elseif ($name == 'civicrm_payment') {
return " $side JOIN civicrm_entity_payment ep ON (civicrm_grant.id = ep.entity_id AND ep.entity_table = 'civicrm_grant')" .
" $side JOIN civicrm_payment civicrm_payment ON (ep.payment_id = civicrm_payment.id) ";
}
}
public static function getPanesMapper(&$panes) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment