本文整理汇总了PHP中CRM_Utils_Money类的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Money类的具体用法?PHP CRM_Utils_Money怎么用?PHP CRM_Utils_Money使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CRM_Utils_Money类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: buildQuickForm
/**
* Function to actually build the form
*
* @return void
* @access public
*/
public function buildQuickForm()
{
require_once 'CRM/Utils/Money.php';
$this->_first = true;
$attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage');
// name
$this->add('text', 'title', ts('Title'), $attributes['title'], true);
$this->add('select', 'contribution_type_id', ts('Contribution Type'), CRM_Contribute_PseudoConstant::contributionType(), true);
$this->addWysiwyg('intro_text', ts('Introductory Message'), $attributes['intro_text']);
$this->addWysiwyg('footer_text', ts('Footer Message'), $attributes['footer_text']);
// is on behalf of an organization ?
$this->addElement('checkbox', 'is_organization', ts('Allow individuals to contribute and / or signup for membership on behalf of an organization?'), null, array('onclick' => "showHideByValue('is_organization',true,'for_org_text','table-row','radio',false);showHideByValue('is_organization',true,'for_org_option','table-row','radio',false);"));
$options = array();
$options[] = HTML_QuickForm::createElement('radio', null, null, ts('Optional'), 1);
$options[] = HTML_QuickForm::createElement('radio', null, null, ts('Required'), 2);
$this->addGroup($options, 'is_for_organization', ts(''));
$this->add('textarea', 'for_organization', ts('On behalf of Label'), $attributes['for_organization']);
// collect goal amount
$this->add('text', 'goal_amount', ts('Goal Amount'), array('size' => 8, 'maxlength' => 12));
$this->addRule('goal_amount', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' '))), 'money');
// is this page active ?
$this->addElement('checkbox', 'is_active', ts('Is this Online Contribution Page Active?'));
// should the honor be enabled
$this->addElement('checkbox', 'honor_block_is_active', ts('Honoree Section Enabled'), null, array('onclick' => "showHonor()"));
$this->add('text', 'honor_block_title', ts('Honoree Section Title'), $attributes['honor_block_title']);
$this->add('textarea', 'honor_block_text', ts('Honoree Introductory Message'), $attributes['honor_block_text']);
// add optional start and end dates
$this->addDateTime('start_date', ts('Start Date'));
$this->addDateTime('end_date', ts('End Date'));
$this->addFormRule(array('CRM_Contribute_Form_ContributionPage_Settings', 'formRule'));
parent::buildQuickForm();
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:38,代码来源:Settings.php
示例2: setDefaultValues
function setDefaultValues()
{
$dafaults = array();
$dao = new CRM_PCP_DAO_PCP();
if ($this->_pageId) {
$dao->id = $this->_pageId;
if ($dao->find(TRUE)) {
CRM_Core_DAO::storeValues($dao, $defaults);
}
// fix the display of the monetary value, CRM-4038
if (isset($defaults['goal_amount'])) {
$defaults['goal_amount'] = CRM_Utils_Money::format($defaults['goal_amount'], NULL, '%a');
}
$defaults['pcp_title'] = CRM_Utils_Array::value('title', $defaults);
$defaults['pcp_intro_text'] = CRM_Utils_Array::value('intro_text', $defaults);
}
if ($this->get('action') & CRM_Core_Action::ADD) {
$defaults['is_active'] = 1;
$defaults['is_honor_roll'] = 1;
$defaults['is_thermometer'] = 1;
}
$this->_contactID = CRM_Utils_Array::value('contact_id', $defaults);
$this->_contriPageId = CRM_Utils_Array::value('page_id', $defaults);
//MV: to set customData default values;
if (CRM_Core_Permission::check('administer CiviCRM')) {
$customDataDefaults = CRM_Custom_Form_CustomData::setDefaultValues($this);
$defaults += $customDataDefaults;
}
//END
return $defaults;
}
开发者ID:eruraindil,项目名称:uk.co.vedaconsulting.pcpteams,代码行数:31,代码来源:Campaign.php
示例3: getMemberTypeDefaults
/**
* Function to setDefaults according to membership type
*/
function getMemberTypeDefaults($config)
{
if (!$_POST['mtype']) {
$details['name'] = '';
$details['auto_renew'] = '';
$details['total_amount'] = '';
echo json_encode($details);
CRM_Utils_System::civiExit();
}
$memType = CRM_Utils_Type::escape($_POST['mtype'], 'Integer');
$query = "SELECT name, minimum_fee AS total_amount, financial_type_id, auto_renew\nFROM civicrm_membership_type\nWHERE id = %1";
$dao = CRM_Core_DAO::executeQuery($query, array(1 => array($memType, 'Positive')));
$properties = array('financial_type_id', 'total_amount', 'name', 'auto_renew');
while ($dao->fetch()) {
foreach ($properties as $property) {
$details[$property] = $dao->{$property};
}
}
$details['total_amount_numeric'] = $details['total_amount'];
// fix the display of the monetary value, CRM-4038
$details['total_amount'] = CRM_Utils_Money::format($details['total_amount'], NULL, '%a');
$options = array(ts('No auto-renew option'), ts('Give option, but not required'), ts('Auto-renew required '));
$details['auto_renew'] = CRM_Utils_Array::value('auto_renew', $options[$details]);
echo json_encode($details);
CRM_Utils_System::civiExit();
}
开发者ID:hguru,项目名称:224Civi,代码行数:29,代码来源:AJAX.php
示例4: run
public function run()
{
CRM_Utils_System::setTitle(ts('PersonalCampaigns'));
$contactID = $id = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE, 0);
$query = "\n\t\t\t\tSELECT id,title, is_active,page_type,goal_amount,pcp_block_id\n\t\t\t\tFROM civicrm_pcp pcp\n\t\t\t\tWHERE pcp.contact_id = %1\n\t\t\t\tORDER BY page_type, page_id";
$params = array(1 => array($contactID, 'Integer'));
$dao = CRM_Core_DAO::executeQuery($query, $params);
$results = array();
while ($dao->fetch()) {
$results[$dao->id]['title'] = $dao->title;
$results[$dao->id]['is_active'] = $dao->is_active ? 'Active' : 'Inactive';
$results[$dao->id]['page_type'] = $this->getContributionPageTitle($dao->id, $dao->page_type);
$results[$dao->id]['goal_amount'] = CRM_Utils_Money::format($dao->goal_amount, $dao->currency);
$contributionDetails = $this->getContributionDetails($dao->id);
$results[$dao->id]['amout_raised'] = CRM_Utils_Money::format(0, $dao->currency);
$results[$dao->id]['no_of_contributions'] = 0;
if ($contributionDetails) {
$results[$dao->id]['amout_raised'] = CRM_Utils_Money::format($contributionDetails[0], $dao->currency);
$results[$dao->id]['no_of_contributions'] = $contributionDetails[1];
}
$results[$dao->id]['view_page_link'] = CRM_Utils_System::url('civicrm/pcp/info', 'reset=1&id=' . $dao->id . '&component=' . $dao->page_type);
$results[$dao->id]['edit_page_link'] = CRM_Utils_System::url('civicrm/pcp/info', "action=update&reset=1&id={$dao->id}&context=dashboard");
}
$this->assign('campignResults', $results);
parent::run();
}
开发者ID:aneeshbhadran,项目名称:org.civicrm.extension.personalcampaign,代码行数:26,代码来源:PersonalCampaign.php
示例5: setDefaultValues
public function setDefaultValues()
{
$defaults = array();
$dao = new CRM_PCP_DAO_PCP();
if ($this->_pageId) {
$dao->id = $this->_pageId;
if ($dao->find(TRUE)) {
CRM_Core_DAO::storeValues($dao, $defaults);
}
// fix the display of the monetary value, CRM-4038
if (isset($defaults['goal_amount'])) {
$defaults['goal_amount'] = CRM_Utils_Money::format($defaults['goal_amount'], NULL, '%a');
}
$defaults['pcp_title'] = CRM_Utils_Array::value('title', $defaults);
$defaults['pcp_intro_text'] = CRM_Utils_Array::value('intro_text', $defaults);
}
if ($this->get('action') & CRM_Core_Action::ADD) {
$defaults['is_active'] = 1;
$defaults['is_honor_roll'] = 1;
$defaults['is_thermometer'] = 1;
$defaults['is_notify'] = 1;
}
$this->_contactID = CRM_Utils_Array::value('contact_id', $defaults);
$this->_contriPageId = CRM_Utils_Array::value('page_id', $defaults);
return $defaults;
}
开发者ID:aydun,项目名称:uk.co.vedaconsulting.quickdonate,代码行数:26,代码来源:Campaign.php
示例6: setDefaultValues
/**
* Set default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
* @return array|void array of default values
*/
public function setDefaultValues()
{
if ($this->_action == CRM_Core_Action::DELETE) {
return NULL;
}
$defaults = array();
if (isset($this->_oid)) {
$params = array('id' => $this->_oid);
CRM_Price_BAO_PriceFieldValue::retrieve($params, $defaults);
// fix the display of the monetary value, CRM-4038
$defaults['value'] = CRM_Utils_Money::format(CRM_Utils_Array::value('value', $defaults), NULL, '%a');
}
$memberComponentId = CRM_Core_Component::getComponentID('CiviMember');
$extendComponentId = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_sid, 'extends', 'id');
if (!isset($defaults['membership_num_terms']) && $memberComponentId == $extendComponentId) {
$defaults['membership_num_terms'] = 1;
}
// set financial type used for price set to set default for new option
if (!$this->_oid) {
$defaults['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_sid, 'financial_type_id', 'id');
}
if (!isset($defaults['weight']) || !$defaults['weight']) {
$fieldValues = array('price_field_id' => $this->_fid);
$defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Price_DAO_PriceFieldValue', $fieldValues);
$defaults['is_active'] = 1;
}
return $defaults;
}
开发者ID:kcristiano,项目名称:civicrm-core,代码行数:34,代码来源:Option.php
示例7: testGetSoftContributionSelector
/**
* Test retrieve Soft Contribution through AJAX
*/
public function testGetSoftContributionSelector()
{
$softTypes = array(3, 2, 5);
$amounts = array('100', '600', '150');
// create sample soft contribution for contact
foreach ($this->_primaryContacts as $seq => $contactId) {
$this->callAPISuccess('Contribution', 'create', array('contact_id' => $contactId, 'receive_date' => date('Ymd'), 'total_amount' => $amounts[$seq], 'financial_type_id' => 1, 'non_deductible_amount' => '10', 'contribution_status_id' => 1, 'soft_credit' => array('1' => array('contact_id' => $this->_softContactId, 'amount' => $amounts[$seq], 'soft_credit_type_id' => $softTypes[$seq]))));
}
$_GET = array_merge($this->_params, array('cid' => $this->_softContactId, 'context' => 'contribution'));
$softCreditList = CRM_Contribute_Page_AJAX::getSoftContributionRows();
foreach ($this->_fields as $columnName) {
$_GET['columns'][] = array('data' => $columnName);
}
// get the results in descending order
$_GET['order'] = array('0' => array('column' => 0, 'dir' => 'desc'));
$amountSortedList = CRM_Contribute_Page_AJAX::getSoftContributionRows();
$this->assertEquals(3, $softCreditList['recordsTotal']);
$this->assertEquals(3, $amountSortedList['recordsTotal']);
rsort($amounts);
foreach ($amounts as $key => $amount) {
$amount = CRM_Utils_Money::format($amount, 'USD');
$this->assertEquals($amount, $amountSortedList['data'][$key]['amount']);
}
// sort with soft credit types
$_GET['order'][0]['column'] = 1;
foreach ($softTypes as $id) {
$softLabels[] = CRM_Core_PseudoConstant::getLabel('CRM_Contribute_BAO_ContributionSoft', 'soft_credit_type_id', $id);
}
rsort($softLabels);
$softTypeSortedList = CRM_Contribute_Page_AJAX::getSoftContributionRows();
foreach ($softLabels as $key => $labels) {
$this->assertEquals($labels, $softTypeSortedList['data'][$key]['sct_label']);
}
}
开发者ID:nielosz,项目名称:civicrm-core,代码行数:37,代码来源:AjaxTest.php
示例8: getCurrencyFormats
/**
* Get a list of templates demonstrating how to format currencies.
*/
static function getCurrencyFormats()
{
$currencies = CRM_Core_PseudoConstant::get('CRM_HRJob_DAO_HRJobPay', 'pay_currency');
$formats = array();
foreach ($currencies as $currency => $label) {
$formats[$currency] = CRM_Utils_Money::format(1234.56, $currency);
}
return $formats;
}
开发者ID:JoeMurray,项目名称:civihr,代码行数:12,代码来源:JobsTab.php
示例9: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
$values = $ids = array();
$params = array('id' => $this->get('id'));
CRM_Pledge_BAO_Pledge::getValues($params, $values, $ids);
$values['frequencyUnit'] = ts('%1(s)', array(1 => $values['frequency_unit']));
if (isset($values["honor_contact_id"]) && $values["honor_contact_id"]) {
$sql = "SELECT display_name FROM civicrm_contact WHERE id = " . $values["honor_contact_id"];
$dao = new CRM_Core_DAO();
$dao->query($sql);
if ($dao->fetch()) {
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$values['honor_contact_id']}");
$values["honor_display"] = "<A href = {$url}>" . $dao->display_name . "</A>";
}
$honor = CRM_Core_PseudoConstant::get('CRM_Pledge_DAO_Pledge', 'honor_type_id');
$values['honor_type'] = $honor[$values['honor_type_id']];
}
//handle custom data.
$groupTree = CRM_Core_BAO_CustomGroup::getTree('Pledge', $this, $params['id']);
CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
if (!empty($values['contribution_page_id'])) {
$values['contribution_page'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $values['contribution_page_id'], 'title');
}
$values['financial_type'] = CRM_Utils_Array::value($values['financial_type_id'], CRM_Contribute_PseudoConstant::financialType());
if ($values['status_id']) {
$values['pledge_status'] = CRM_Utils_Array::value($values['status_id'], CRM_Contribute_PseudoConstant::contributionStatus());
}
$url = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=view&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
$recentOther = array();
if (CRM_Core_Permission::checkActionPermission('CiviPledge', CRM_Core_Action::UPDATE)) {
$recentOther['editUrl'] = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=update&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
}
if (CRM_Core_Permission::checkActionPermission('CiviPledge', CRM_Core_Action::DELETE)) {
$recentOther['deleteUrl'] = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=delete&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
}
$displayName = CRM_Contact_BAO_Contact::displayName($values['contact_id']);
$this->assign('displayName', $displayName);
$title = $displayName . ' - (' . ts('Pledged') . ' ' . CRM_Utils_Money::format($values['pledge_amount']) . ' - ' . $values['financial_type'] . ')';
// add Pledge to Recent Items
CRM_Utils_Recent::add($title, $url, $values['id'], 'Pledge', $values['contact_id'], NULL, $recentOther);
// Check if this is default domain contact CRM-10482
if (CRM_Contact_BAO_Contact::checkDomainContact($values['contact_id'])) {
$displayName .= ' (' . ts('default organization') . ')';
}
// omitting contactImage from title for now since the summary overlay css doesn't work outside of our crm-container
CRM_Utils_System::setTitle(ts('View Pledge by') . ' ' . $displayName);
//do check for campaigns
if ($campaignId = CRM_Utils_Array::value('campaign_id', $values)) {
$campaigns = CRM_Campaign_BAO_Campaign::getCampaigns($campaignId);
$values['campaign'] = $campaigns[$campaignId];
}
$this->assign($values);
}
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:59,代码来源:PledgeView.php
示例10: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
$this->_contactID = CRM_Utils_Request::retrieve('cid', 'Positive', $this);
$this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this);
$context = CRM_Utils_Request::retrieve('context', 'String', $this);
$this->assign('context', $context);
$values = array();
$params['id'] = $this->_id;
require_once 'CRM/Grant/BAO/Grant.php';
CRM_Grant_BAO_Grant::retrieve($params, $values);
require_once 'CRM/Grant/PseudoConstant.php';
$grantType = CRM_Grant_PseudoConstant::grantType();
$grantStatus = CRM_Grant_PseudoConstant::grantStatus();
$this->assign('grantType', $grantType[$values['grant_type_id']]);
$this->assign('grantStatus', $grantStatus[$values['status_id']]);
$grantTokens = array('amount_total', 'amount_requested', 'amount_granted', 'rationale', 'grant_report_received', 'application_received_date', 'decision_date', 'money_transfer_date', 'grant_due_date');
foreach ($grantTokens as $token) {
$this->assign($token, CRM_Utils_Array::value($token, $values));
}
if (isset($this->_id)) {
require_once 'CRM/Core/BAO/Note.php';
$noteDAO = new CRM_Core_BAO_Note();
$noteDAO->entity_table = 'civicrm_grant';
$noteDAO->entity_id = $this->_id;
if ($noteDAO->find(true)) {
$this->_noteId = $noteDAO->id;
}
}
if (isset($this->_noteId)) {
$this->assign('note', CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Note', $this->_noteId, 'note'));
}
// add Grant to Recent Items
require_once 'CRM/Utils/Recent.php';
require_once 'CRM/Contact/BAO/Contact.php';
require_once 'CRM/Utils/Money.php';
$url = CRM_Utils_System::url('civicrm/contact/view/grant', "action=view&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
$title = CRM_Contact_BAO_Contact::displayName($values['contact_id']) . ' - ' . ts('Grant') . ': ' . CRM_Utils_Money::format($values['amount_total']) . ' (' . $grantType[$values['grant_type_id']] . ')';
$recentOther = array();
if (CRM_Core_Permission::checkActionPermission('CiviGrant', CRM_Core_Action::UPDATE)) {
$recentOther['editUrl'] = CRM_Utils_System::url('civicrm/contact/view/grant', "action=update&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
}
if (CRM_Core_Permission::checkActionPermission('CiviGrant', CRM_Core_Action::DELETE)) {
$recentOther['deleteUrl'] = CRM_Utils_System::url('civicrm/contact/view/grant', "action=delete&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
}
CRM_Utils_Recent::add($title, $url, $values['id'], 'Grant', $values['contact_id'], null, $recentOther);
require_once 'CRM/Core/BAO/File.php';
$attachment = CRM_Core_BAO_File::attachmentInfo('civicrm_grant', $this->_id);
$this->assign('attachment', $attachment);
$groupTree =& CRM_Core_BAO_CustomGroup::getTree("Grant", $this, $this->_id, 0);
CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
$this->assign('id', $this->_id);
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:58,代码来源:GrantView.php
示例11: getMemberTypeDefaults
/**
* Function to setDefaults according to membership type
*/
function getMemberTypeDefaults($config)
{
require_once 'CRM/Utils/Type.php';
$memType = CRM_Utils_Type::escape($_POST['mtype'], 'Integer');
$contributionType = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $memType, 'contribution_type_id');
$totalAmount = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $memType, 'minimum_fee');
// fix the display of the monetary value, CRM-4038
require_once 'CRM/Utils/Money.php';
$totalAmount = CRM_Utils_Money::format($totalAmount, null, '%a');
$details = array('contribution_type_id' => $contributionType, 'total_amount' => $totalAmount);
echo json_encode($details);
CRM_Utils_System::civiExit();
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:16,代码来源:AJAX.php
示例12: renderPayments
private function renderPayments()
{
$from = $this->get('range_from');
$to = $this->get('range_to');
if (!empty($from) && !empty($to)) {
$bao = $this->controller->getImportBAO();
$paymentsApi = $bao->fetchAllPayments($from, $to);
$pays = array();
require_once 'CRM/Utils/Money.php';
foreach ($paymentsApi as $item) {
$pays[] = array('id' => $item->PaymentRef, 'date' => $item->PaymentDate, 'net' => CRM_Utils_Money::format($item->Net));
}
$this->assign('payments', $pays);
}
}
开发者ID:hoegrammer,项目名称:uk.co.vedaconsulting.module.justgivingImports,代码行数:15,代码来源:SourceUpload.php
示例13: setDefaultValues
/**
* This function sets the default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
* @param null
*
* @return array array of default values
* @access public
*/
function setDefaultValues()
{
$defaults = array();
if (isset($this->_oid)) {
$params = array('id' => $this->_oid);
CRM_Price_BAO_FieldValue::retrieve($params, $defaults);
// fix the display of the monetary value, CRM-4038
$defaults['value'] = CRM_Utils_Money::format(CRM_Utils_Array::value('value', $defaults), NULL, '%a');
}
if (!isset($defaults['weight']) || !$defaults['weight']) {
$fieldValues = array('price_field_id' => $this->_fid);
$defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Price_DAO_FieldValue', $fieldValues);
$defaults['is_active'] = 1;
}
return $defaults;
}
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:25,代码来源:Option.php
示例14: run
function run()
{
if (isset($_REQUEST['group_id'])) {
// get some values
$group_id = (int) $_REQUEST['group_id'];
$financial_types = CRM_Contribute_PseudoConstant::financialType();
// load the group
$txgroup = civicrm_api('SepaTransactionGroup', 'getsingle', array('id' => $group_id, 'version' => 3));
if (isset($txgroup['is_error']) && $txgroup['is_error']) {
CRM_Core_Session::setStatus(sprintf(ts("Cannot read SEPA transaction group [%s]. Error was: '%s'"), $group_id, $txgroup['error_message']), ts("Error"), "error");
}
// load the group's contributions
$sql = "\n SELECT\n civicrm_sdd_txgroup.reference AS reference,\n civicrm_contact.display_name AS contact_display_name,\n civicrm_contact.contact_type AS contact_contact_type,\n civicrm_contact.id AS contact_id,\n civicrm_contribution.id AS contribution_id,\n civicrm_contribution.total_amount AS contribution_amount,\n civicrm_contribution.financial_type_id AS contribution_financial_type_id,\n civicrm_campaign.title AS contribution_campaign\n FROM \n civicrm_sdd_txgroup\n LEFT JOIN \n civicrm_sdd_contribution_txgroup ON civicrm_sdd_txgroup.id = civicrm_sdd_contribution_txgroup.txgroup_id\n LEFT JOIN \n civicrm_contribution ON civicrm_contribution.id = civicrm_sdd_contribution_txgroup.contribution_id\n LEFT JOIN \n civicrm_contact ON civicrm_contact.id = civicrm_contribution.contact_id\n LEFT JOIN \n civicrm_campaign ON civicrm_campaign.id = civicrm_contribution.campaign_id\n WHERE \n civicrm_sdd_txgroup.id = {$group_id};";
$total_amount = 0.0;
$total_count = 0;
$total_campaigns = array();
$total_types = array();
$total_contacts = array();
$contact_base_link = CRM_Utils_System::url('civicrm/contact/view', '&reset=1&cid=');
$contribution_base_link = CRM_Utils_System::url('civicrm/contact/view/contribution', '&reset=1&id=_cid_&cid=_id_&action=view');
$contributions = array();
$result = CRM_Core_DAO::executeQuery($sql);
while ($result->fetch()) {
$contributions[$total_count] = array('contact_display_name' => $result->contact_display_name, 'contact_type' => $result->contact_contact_type, 'contact_id' => $result->contact_id, 'contact_link' => $contact_base_link . $result->contact_id, 'contribution_link' => str_replace('_id_', $result->contact_id, str_replace('_cid_', $result->contribution_id, $contribution_base_link)), 'contribution_id' => $result->contribution_id, 'contribution_amount' => $result->contribution_amount, 'contribution_amount_str' => CRM_Utils_Money::format($result->contribution_amount, 'EUR'), 'financial_type' => $financial_types[$result->contribution_financial_type_id], 'campaign' => $result->contribution_campaign);
$total_count += 1;
$total_amount += $result->contribution_amount;
$total_types[$result->contribution_financial_type_id] = 1;
$total_contacts[$result->contact_id] = 1;
$total_campaigns[$result->contribution_campaign] = 1;
$reference = $result->reference;
}
}
$this->assign("txgroup", $txgroup);
$this->assign("reference", $reference);
$this->assign("group_id", $group_id);
$this->assign("total_count", $total_count);
$this->assign("total_amount", $total_amount);
$this->assign("total_amount_str", CRM_Utils_Money::format($total_amount, 'EUR'));
$this->assign("contributions", $contributions);
$this->assign("different_campaigns", count($total_campaigns));
$this->assign("different_types", count($total_types));
$this->assign("different_contacts", count($total_contacts));
parent::run();
}
开发者ID:FundingWorks,项目名称:org.project60.sepa,代码行数:44,代码来源:ListGroup.php
示例15: setDefaultValues
/**
* This function sets the default values for the form. Note that in edit/view mode
* the default values are retrieved from the database
*
* @param null
*
* @return array array of default values
* @access public
*/
function setDefaultValues()
{
$defaults = array();
require_once 'CRM/Price/BAO/FieldValue.php';
if (isset($this->_oid)) {
$params = array('id' => $this->_oid);
CRM_Price_BAO_FieldValue::retrieve($params, $defaults);
// fix the display of the monetary value, CRM-4038
require_once 'CRM/Utils/Money.php';
$defaults['value'] = CRM_Utils_Money::format($defaults['value'], null, '%a');
}
require_once 'CRM/Core/DAO.php';
require_once 'CRM/Utils/Weight.php';
if (!isset($defaults['weight']) || !$defaults['weight']) {
$fieldValues = array('price_field_id' => $this->_fid);
$defaults['weight'] = CRM_Utils_Weight::getDefaultWeight('CRM_Price_DAO_FieldValue', $fieldValues);
$defaults['is_active'] = 1;
}
return $defaults;
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:29,代码来源:Option.php
示例16: getContributionParams
/**
* Set the parameters to be passed to contribution create function.
*
* @param array $params
* @param int $financialTypeID
* @param float $nonDeductibleAmount
* @param bool $pending
* @param array $paymentProcessorOutcome
* @param string $receiptDate
* @param int $recurringContributionID
*
* @return array
*/
public static function getContributionParams($params, $financialTypeID, $nonDeductibleAmount, $pending, $paymentProcessorOutcome, $receiptDate, $recurringContributionID)
{
$contributionParams = array('financial_type_id' => $financialTypeID, 'receive_date' => CRM_Utils_Array::value('receive_date', $params) ? CRM_Utils_Date::processDate($params['receive_date']) : date('YmdHis'), 'non_deductible_amount' => $nonDeductibleAmount, 'total_amount' => $params['amount'], 'tax_amount' => CRM_Utils_Array::value('tax_amount', $params), 'amount_level' => CRM_Utils_Array::value('amount_level', $params), 'invoice_id' => $params['invoiceID'], 'currency' => $params['currencyID'], 'is_pay_later' => CRM_Utils_Array::value('is_pay_later', $params, 0), 'cancel_reason' => CRM_Utils_Array::value('cancel_reason', $params, 0), 'cancel_date' => isset($params['cancel_date']) ? CRM_Utils_Date::format($params['cancel_date']) : NULL, 'thankyou_date' => isset($params['thankyou_date']) ? CRM_Utils_Date::format($params['thankyou_date']) : NULL, 'skipLineItem' => CRM_Utils_Array::value('skipLineItem', $params, 0));
if ($paymentProcessorOutcome) {
$contributionParams['payment_processor'] = CRM_Utils_Array::value('payment_processor', $paymentProcessorOutcome);
}
if (!$pending && $paymentProcessorOutcome) {
$contributionParams += array('fee_amount' => CRM_Utils_Array::value('fee_amount', $paymentProcessorOutcome), 'net_amount' => CRM_Utils_Array::value('net_amount', $paymentProcessorOutcome, $params['amount']), 'trxn_id' => $paymentProcessorOutcome['trxn_id'], 'receipt_date' => $receiptDate, 'trxn_result_code' => CRM_Utils_Array::value('trxn_result_code', $paymentProcessorOutcome));
}
// CRM-4038: for non-en_US locales, CRM_Contribute_BAO_Contribution::add() expects localised amounts
$contributionParams['non_deductible_amount'] = trim(CRM_Utils_Money::format($contributionParams['non_deductible_amount'], ' '));
$contributionParams['total_amount'] = trim(CRM_Utils_Money::format($contributionParams['total_amount'], ' '));
if ($recurringContributionID) {
$contributionParams['contribution_recur_id'] = $recurringContributionID;
}
$contributionParams['contribution_status_id'] = $pending ? 2 : 1;
if (isset($contributionParams['invoice_id'])) {
$contributionParams['id'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $contributionParams['invoice_id'], 'id', 'invoice_id');
}
return $contributionParams;
}
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:34,代码来源:Confirm.php
示例17: preProcess
/**
* Function to set variables up before form is built
*
* @return void
* @access public
*/
public function preProcess()
{
require_once 'CRM/Pledge/BAO/Pledge.php';
$values = $ids = array();
$params = array('id' => $this->get('id'));
CRM_Pledge_BAO_Pledge::getValues($params, $values, $ids);
$values['frequencyUnit'] = ts('%1(s)', array(1 => $values['frequency_unit']));
$values['eachPaymentAmount'] = floor($values['amount'] / $values['installments']);
if (isset($values["honor_contact_id"]) && $values["honor_contact_id"]) {
$sql = "SELECT display_name FROM civicrm_contact WHERE id = " . $values["honor_contact_id"];
$dao =& new CRM_Core_DAO();
$dao->query($sql);
if ($dao->fetch()) {
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$values['honor_contact_id']}");
$values["honor_display"] = "<A href = {$url}>" . $dao->display_name . "</A>";
}
$honor = CRM_Core_PseudoConstant::honor();
$values['honor_type'] = $honor[$values['honor_type_id']];
}
//handle custom data.
$groupTree =& CRM_Core_BAO_CustomGroup::getTree('Pledge', $this, $params['id']);
CRM_Core_BAO_CustomGroup::buildCustomDataView($this, $groupTree);
if (CRM_Utils_Array::value('contribution_page_id', $values)) {
$values['contribution_page'] = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_ContributionPage', $values['contribution_page_id'], 'title');
}
$values['contribution_type'] = CRM_Utils_Array::value($values['contribution_type_id'], CRM_Contribute_PseudoConstant::contributionType());
if ($values['status_id']) {
$values['pledge_status'] = CRM_Utils_Array::value($values['status_id'], CRM_Contribute_PseudoConstant::contributionStatus());
}
require_once 'CRM/Utils/Recent.php';
require_once 'CRM/Contact/BAO/Contact.php';
$url = CRM_Utils_System::url('civicrm/contact/view/pledge', "action=view&reset=1&id={$values['id']}&cid={$values['contact_id']}&context=home");
require_once 'CRM/Utils/Money.php';
$displayName = CRM_Contact_BAO_Contact::displayName($values['contact_id']);
$this->assign('displayName', $displayName);
$title = $displayName . ' - (' . ts('Pledged') . ' ' . CRM_Utils_Money::format($values['pledge_amount']) . ' - ' . $values['contribution_type'] . ')';
// add Pledge to Recent Items
CRM_Utils_Recent::add($title, $url, $values['id'], 'Pledge', $values['contact_id'], null);
$this->assign($values);
}
开发者ID:bhirsch,项目名称:voipdev,代码行数:46,代码来源:PledgeView.php
示例18: civicrm_api3_campaign_details_activity_get
/**
* CampaignDetails.CampaignDetailsActivity API
*
* @param array $params
* @return array API result descriptor
* @see civicrm_api3_create_success
* @see civicrm_api3_create_error
* @throws API_Exception
*/
function civicrm_api3_campaign_details_activity_get()
{
$query = "\n SELECT id,title, is_active,page_type,goal_amount,pcp_block_id\n FROM civicrm_pcp ";
$dao = CRM_Core_DAO::executeQuery($query);
$result = array();
while ($dao->fetch()) {
$results[$dao->id]['title'] = $dao->title;
$results[$dao->id]['is_active'] = $dao->is_active ? 'Active' : 'Inactive';
$results[$dao->id]['page_type'] = getContributionPageTitle($dao->id, $dao->page_type);
$results[$dao->id]['goal_amount'] = CRM_Utils_Money::format($dao->goal_amount, $dao->currency);
$contributionDetails = getContributionDetails($dao->id);
$results[$dao->id]['amout_raised'] = CRM_Utils_Money::format(0, $dao->currency);
$results[$dao->id]['no_of_contributions'] = 0;
if ($contributionDetails) {
$results[$dao->id]['amout_raised'] = CRM_Utils_Money::format($contributionDetails[0], $dao->currency);
$results[$dao->id]['no_of_contributions'] = $contributionDetails[1];
}
$results[$dao->id]['view_page_link'] = CRM_Utils_System::url('civicrm/pcp/info', 'reset=1&id=' . $dao->id . '&component=' . $dao->page_type);
$results[$dao->id]['edit_page_link'] = CRM_Utils_System::url('civicrm/pcp/info', "action=update&reset=1&id={$dao->id}&context=dashboard");
}
return civicrm_api3_create_success($results);
}
开发者ID:aneeshbhadran,项目名称:org.civicrm.extension.pcdetails,代码行数:31,代码来源:CampaignDetailsActivity.php
示例19: setDefaultValues
/**
* Set default values for the form. MobileProvider that in edit/view mode
* the default values are retrieved from the database
*
*
* @return array
* defaults
*/
public function setDefaultValues()
{
$defaults = array();
if (isset($this->_id)) {
$params = array('id' => $this->_id);
$baoName = $this->_BAOName;
$baoName::retrieve($params, $defaults);
}
if (isset($defaults['minimum_fee'])) {
$defaults['minimum_fee'] = CRM_Utils_Money::format($defaults['minimum_fee'], NULL, '%a');
}
if (isset($defaults['status'])) {
$this->assign('membershipStatus', $defaults['status']);
}
if ($this->_action & CRM_Core_Action::ADD) {
$defaults['is_active'] = 1;
}
if (isset($defaults['member_of_contact_id']) && $defaults['member_of_contact_id']) {
$defaults['member_org'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $defaults['member_of_contact_id'], 'display_name');
}
return $defaults;
}
开发者ID:sarehag,项目名称:civicrm-core,代码行数:30,代码来源:MembershipConfig.php
示例20: setDefaultValues
/**
* This function sets the default values for the form. MobileProvider that in edit/view mode
* the default values are retrieved from the database
*
* @access public
*
* @return None
*/
function setDefaultValues()
{
$defaults = array();
$params = array();
if (isset($this->_id)) {
$params = array('id' => $this->_id);
require_once str_replace('_', DIRECTORY_SEPARATOR, $this->_BAOName) . ".php";
eval($this->_BAOName . '::retrieve( $params, $defaults );');
}
if (isset($defaults['minimum_fee'])) {
$defaults['minimum_fee'] = CRM_Utils_Money::format($defaults['minimum_fee'], NULL, '%a');
}
if (isset($defaults['status'])) {
$this->assign('membershipStatus', $defaults['status']);
}
i
|
请发表评论