}
if ($allowEdit) {
- $values[$dao->id]['status'] = '<a class="crm-activity-status crm-activity-status-' . $dao->id . ' ' . $values[$dao->id]['class'] . ' crm-activity-change-status crm-editable-enabled" activity_id=' . $dao->id . ' current_status=' . $dao->status . ' case_id=' . $caseID . ' href="#" title=\'' . $statusTitle . '\'>' . $values[$dao->id]['status'] . '</a>';
+ $values[$dao->id]['status'] = '<div class="crmf-status_id crm-activity-status-' . $dao->id . ' ' . $values[$dao->id]['class'] . ' crm-editable" data-type="select" data-action="create" data-refresh="true">' . $values[$dao->id]['status'] . '</div>';
}
}
$dao->free();
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
- +--------------------------------------------------------------------+
- | 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-2014
- * $Id$
- *
- */
-
-/**
- * This class generates form components for building changing activity status interface in a case
- *
- */
-class CRM_Case_Form_ActivityChangeStatus extends CRM_Core_Form {
-
- /**
- * Build the form object
- *
- * @return void
- */
- public function buildQuickForm() {
- $activityStatus = CRM_Core_PseudoConstant::activityStatus();
- $this->add('select', 'activity_change_status', ts('New Status'), $activityStatus);
- }
-
-}
<path>civicrm/ajax/delcaserole</path>
<page_callback>CRM_Case_Page_AJAX::deleteCaseRoles</page_callback>
</item>
- <item>
- <path>civicrm/case/changeactivitystatus</path>
- <title>Change Activity Status</title>
- <page_callback>CRM_Case_Form_ActivityChangeStatus</page_callback>
- </item>
</menu>
protected $_doDirectPaymentResult = array();
/**
+ * Set result from do Direct Payment for test purposes.
+ *
* @param array $doDirectPaymentResult
+ * Result to be returned from test.
*/
public function setDoDirectPaymentResult($doDirectPaymentResult) {
$this->_doDirectPaymentResult = $doDirectPaymentResult;
+ if (empty($this->_doDirectPaymentResult['trxn_id'])) {
+ $this->_doDirectPaymentResult['trxn_id'] = array();
+ }
+ else {
+ $this->_doDirectPaymentResult['trxn_id'] = (array) $doDirectPaymentResult['trxn_id'];
+ }
}
/**
);
//end of hook invocation
if (!empty($this->_doDirectPaymentResult)) {
- return $this->_doDirectPaymentResult;
+ $result = $this->_doDirectPaymentResult;
+ $result['trxn_id'] = array_shift($this->_doDirectPaymentResult['trxn_id']);
+ return $result;
}
if ($this->_mode == 'test') {
$query = "SELECT MAX(trxn_id) FROM civicrm_contribution WHERE trxn_id LIKE 'test\\_%'";
}
/**
- * @param null $errorCode
- * @param null $errorMessage
+ * Generate error object.
+ *
+ * Throwing exceptions is preferred over this.
+ *
+ * @param string $errorCode
+ * @param string $errorMessage
*
- * @return object
+ * @return CRM_Core_Error
+ * Error object.
*/
public function &error($errorCode = NULL, $errorMessage = NULL) {
$e = CRM_Core_Error::singleton();
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
class CRM_Logging_ReportSummary extends CRM_Report_Form {
protected $cid;
protected $loggingDB;
/**
+ * Class constructor.
*/
public function __construct() {
// don’t display the ‘Add these Contacts to Group’ button
$customTables = $logging->entityCustomDataLogTables('Address');
foreach ($customTables as $table) {
$this->_logTables[$table] = array(
- 'fk' => 'contact_id', // for join of fk_table with contact table
+ // For join of fk_table with contact table.
+ 'fk' => 'contact_id',
'joins' => array(
- 'table' => 'log_civicrm_address', // fk_table
+ // fk_table
+ 'table' => 'log_civicrm_address',
'join' => 'entity_log_civireport.entity_id = fk_table.id',
),
'log_type' => 'Contact',
);
}
- // allow log tables to be extended via report hooks
+ // Allow log tables to be extended via report hooks.
CRM_Report_BAO_Hook::singleton()->alterLogTables($this, $this->_logTables);
parent::__construct();
}
/**
- * @param $entity
+ * Get log type.
+ *
+ * @param string $entity
*
* @return string
*/
}
/**
+ * Get entity value.
+ *
* @param int $id
* @param $entity
* @param $logDate
}
/**
+ * Get entity action.
+ *
* @param int $id
* @param int $connId
* @param $entity
* @return CRM_Contribute_BAO_Contribution
*/
public static function processSecondaryFinancialTransaction($contactID, &$form, $tempParams, $isTest, $lineItems, $minimumFee, $financialTypeID) {
- $contributionType = new CRM_Financial_DAO_FinancialType();
- $contributionType->id = $financialTypeID;
- if (!$contributionType->find(TRUE)) {
+ $financialType = new CRM_Financial_DAO_FinancialType();
+ $financialType->id = $financialTypeID;
+ if (!$financialType->find(TRUE)) {
CRM_Core_Error::fatal(ts("Could not find a system table"));
}
$tempParams['amount'] = $minimumFee;
if ($form->_contributeMode == 'express') {
$result = $payment->doExpressCheckout($tempParams);
+ if (is_a($result, 'CRM_Core_Error')) {
+ throw new CRM_Core_Exception(CRM_Core_Error::getMessages($result));
+ }
}
else {
- $result = $payment->doDirectPayment($tempParams);
+ $result = $payment->doPayment($tempParams, 'contribute');
}
}
- if (is_a($result, 'CRM_Core_Error')) {
- throw new CRM_Core_Exception(CRM_Core_Error::getMessages($result));
- }
- else {
- //assign receive date when separate membership payment
- //and contribution amount not selected.
- if ($form->_amount == 0) {
- $now = date('YmdHis');
- $form->_params['receive_date'] = $now;
- $receiveDate = CRM_Utils_Date::mysqlToIso($now);
- $form->set('params', $form->_params);
- $form->assign('receive_date', $receiveDate);
- }
-
- $form->set('membership_trx_id', $result['trxn_id']);
- $form->set('membership_amount', $minimumFee);
-
- $form->assign('membership_trx_id', $result['trxn_id']);
- $form->assign('membership_amount', $minimumFee);
-
- // we don't need to create the user twice, so lets disable cms_create_account
- // irrespective of the value, CRM-2888
- $tempParams['cms_create_account'] = 0;
-
- $pending = $form->_params['is_pay_later'] ? (($minimumFee > 0.0) ? TRUE : FALSE) : FALSE;
-
- //set this variable as we are not creating pledge for
- //separate membership payment contribution.
- //so for differentiating membership contribution from
- //main contribution.
- $form->_params['separate_membership_payment'] = 1;
- $membershipContribution = CRM_Contribute_Form_Contribution_Confirm::processContribution($form,
- $tempParams,
- $result,
- $contactID,
- $contributionType,
- $pending,
- TRUE,
- $isTest,
- $lineItems
- );
- return $membershipContribution;
+ //assign receive date when separate membership payment
+ //and contribution amount not selected.
+ if ($form->_amount == 0) {
+ $now = date('YmdHis');
+ $form->_params['receive_date'] = $now;
+ $receiveDate = CRM_Utils_Date::mysqlToIso($now);
+ $form->set('params', $form->_params);
+ $form->assign('receive_date', $receiveDate);
}
+
+ $form->set('membership_trx_id', $result['trxn_id']);
+ $form->set('membership_amount', $minimumFee);
+
+ $form->assign('membership_trx_id', $result['trxn_id']);
+ $form->assign('membership_amount', $minimumFee);
+
+ // we don't need to create the user twice, so lets disable cms_create_account
+ // irrespective of the value, CRM-2888
+ $tempParams['cms_create_account'] = 0;
+
+ $pending = $form->_params['is_pay_later'] ? (($minimumFee > 0.0) ? TRUE : FALSE) : FALSE;
+
+ //set this variable as we are not creating pledge for
+ //separate membership payment contribution.
+ //so for differentiating membership contribution from
+ //main contribution.
+ $form->_params['separate_membership_payment'] = 1;
+ $membershipContribution = CRM_Contribute_Form_Contribution_Confirm::processContribution($form,
+ $tempParams,
+ $result,
+ $contactID,
+ $financialType,
+ $pending,
+ TRUE,
+ $isTest,
+ $lineItems
+ );
+ return $membershipContribution;
}
/**
if ($id) {
self::updateAllPriceFieldValue($id, $params);
}
-
+ self::flush();
return $membershipType;
}
+ /**
+ * Flush anywhere that membership types might be cached
+ * @throws \CiviCRM_API3_Exception
+ */
+ public static function flush() {
+ CRM_Member_PseudoConstant::membershipType(NULL, TRUE);
+ civicrm_api3('membership', 'getfields', array('cache_clear' => 1, 'fieldname' => 'membership_type_id'));
+ civicrm_api3('profile', 'getfields', array('action' => 'submit', 'cache_clear' => 1));
+ }
+
/**
* Delete membership Types
*
//check dependencies
$check = FALSE;
$status = array();
- $dependancy = array(
+ $dependency = array(
'Membership' => 'membership_type_id',
'MembershipBlock' => 'membership_type_default',
);
- foreach ($dependancy as $name => $field) {
+ foreach ($dependency as $name => $field) {
$baoString = 'CRM_Member_BAO_' . $name;
$dao = new $baoString();
$dao->$field = $membershipTypeId;
}
}
- $membershipDates = array();
-
- $dates = array(
- 'start_date' => 'startDate',
- 'end_date' => 'endDate',
- 'join_date' => 'joinDate',
+ $membershipDates = array(
+ 'start_date' => CRM_Utils_Date::customFormat($startDate, '%Y%m%d'),
+ 'end_date' => CRM_Utils_Date::customFormat($endDate, '%Y%m%d'),
+ 'join_date' => CRM_Utils_Date::customFormat($joinDate, '%Y%m%d'),
);
- foreach ($dates as $varName => $valName) {
- $membershipDates[$varName] = CRM_Utils_Date::customFormat($$valName, '%Y%m%d');
- }
return $membershipDates;
}
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2014
* $Id$
- *
*/
class CRM_Report_Form_Contact_LoggingSummary extends CRM_Logging_ReportSummary {
/**
+ * Class constructor.
*/
public function __construct() {
parent::__construct();
),
'log_action' => array(
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => array('Insert' => ts('Insert'), 'Update' => ts('Update'), 'Delete' => ts('Delete')),
+ 'options' => array(
+ 'Insert' => ts('Insert'),
+ 'Update' => ts('Update'),
+ 'Delete' => ts('Delete'),
+ ),
'title' => ts('Action'),
'type' => CRM_Utils_Type::T_STRING,
),
}
/**
- * @param $rows
+ * Alter Report Display.
+ *
+ * @param array $rows
+ * Rows from report query.
*/
public function alterDisplay(&$rows) {
// cache for id → is_deleted mapping
}
/**
- * @param null $logTable
+ * Generate From Clause.
+ *
+ * @param string $logTable
*/
public function from($logTable = NULL) {
static $entity = NULL;
return self::getByProcessor($processor);
}
+ /**
+ * Flush processors from static cache.
+ *
+ * This is particularly used for tests.
+ *
+ */
+ public function flushProcessors() {
+ $this->cache = array();
+ }
+
}
*
* @package CiviCRM_APIv3
* @subpackage API_acl
- *
*/
/**
$case_id = '';
$createRevision = FALSE;
$oldActivityValues = array();
+ // Lookup case id if not supplied
+ if (!isset($params['case_id']) && !empty($params['id'])) {
+ $params['case_id'] = CRM_Core_DAO::singleValueQuery("SELECT case_id FROM civicrm_case_activity WHERE activity_id = " . (int) $params['id']);
+ }
if (!empty($params['case_id'])) {
$case_id = $params['case_id'];
if (!empty($params['id'])) {
* @package CiviCRM_APIv3
* @subpackage API_Case
* @copyright CiviCRM LLC (c) 2004-2014
- *
*/
/**
- * Open a new case, add client and manager roles, and add standard timeline
+ * Open a new case, add client and manager roles, and add standard timeline.
*
* @param array $params
* //REQUIRED:
}
/**
- * Adjust Metadata for Get Action
+ * Adjust Metadata for Get Action.
*
* @param array $params
- * Array or parameters determined by getfields.
+ * Parameters determined by getfields.
*/
function _civicrm_api3_case_get_spec(&$params) {
$params['contact_id']['api.aliases'] = array('client_id');
}
/**
- * Adjust Metadata for Create Action
+ * Adjust Metadata for Create Action.
*
* @param array $params
* Array or parameters determined by getfields.
}
/**
- * Adjust Metadata for Update action
+ * Adjust Metadata for Update action.
*
* @param array $params
* Array or parameters determined by getfields.
+--------------------------------------------------------------------+
*/
/**
- * Generic api wrapper used for quicksearch and autocomplete
+ * Generic api wrapper used for quicksearch and autocomplete.
*
* @param array $apiRequest
+ *
* @return mixed
*/
function civicrm_api3_generic_getList($apiRequest) {
<?php
/**
- * params must contain at least id=xx & {one of the fields from getfields}=value
+ * Set a single value using the api.
+ *
+ * This function is called when no specific setvalue api exists.
+ * Params must contain at least id=xx & {one of the fields from getfields}=value
*
* @param array $apiRequest
*
civicrm_api3_verify_mandatory($params, NULL, array('id', 'field', 'value'));
$id = $params['id'];
if (!is_numeric($id)) {
- return civicrm_api3_create_error(ts('Please enter a number'), array('error_code' => 'NaN', 'field' => "id"));
+ return civicrm_api3_create_error(ts('Please enter a number'), array(
+ 'error_code' => 'NaN',
+ 'field' => "id",
+ ));
}
$field = CRM_Utils_String::munge($params['field']);
* newly created or updated membership type property values.
*/
function civicrm_api3_membership_type_create($params) {
- $ids['membershipType'] = CRM_Utils_Array::value('id', $params);
- $ids['memberOfContact'] = CRM_Utils_Array::value('member_of_contact_id', $params);
- $ids['contributionType'] = CRM_Utils_Array::value('financial_type_id', $params);
-
- $membershipTypeBAO = CRM_Member_BAO_MembershipType::add($params, $ids);
- $membershipType = array();
- _civicrm_api3_object_to_array($membershipTypeBAO, $membershipType[$membershipTypeBAO->id]);
- CRM_Member_PseudoConstant::membershipType(NULL, TRUE);
- civicrm_api3('membership', 'getfields', array('cache_clear' => 1, 'fieldname' => 'membership_type_id'));
- civicrm_api3('profile', 'getfields', array('action' => 'submit', 'cache_clear' => 1));
- return civicrm_api3_create_success($membershipType, $params, 'membership_type', 'create', $membershipTypeBAO);
+ return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params, 'Membership_type');
}
/**
<?php
/**
- * Retrieve one or more phones
+ * Retrieve one or more phones.
+ *
* This function has been declared there instead than in api/v3/Phone.php
* for no specific reasons, beside to demonstrate this feature
* (that might be useful in your module, eg if you want to implement a
*/
/**
- * Add a Tag. Tags are used to classify CRM entities (including Contacts, Groups and Actions).
+ * Add a Tag.
+ *
+ * Tags are used to classify CRM entities (including Contacts, Groups and Actions).
*
* Allowed @params array keys are:
*
}
/**
- * Specify Meta data for create. Note that this data is retrievable via the getfields function
+ * Specify Meta data for create.
+ *
+ * Note that this data is retrievable via the getfields function
* and is used for pre-filling defaults and ensuring mandatory requirements are met.
*
* @param array $params
}
/**
- * Deletes an existing Tag
+ * Delete an existing Tag.
*
* @param array $params
*
- * @example TagDelete.ph
- *
* @return array
* API result array
- * {@getfields tag_delete}
*/
function civicrm_api3_tag_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
+++ /dev/null
-{*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
- +--------------------------------------------------------------------+
- | 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 |
- +--------------------------------------------------------------------+
-*}
-{* CiviCase - change activity status inline *}
-<div class="crm-block crm-form-block crm-case-activitychangestatus-form-block">
- <table class="form-layout">
- <tr class="crm-case-activitychangestatus-form-block-status">
- <td class="label">{$form.activity_change_status.label}</td>
- <td>{$form.activity_change_status.html}</td>
- </tr>
- </table>
-</div>
+++ /dev/null
-{*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
- +--------------------------------------------------------------------+
- | 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 |
- +--------------------------------------------------------------------+
-*}
-{* CiviCase - change activity status inline *}
-{literal}
- <script type="text/javascript">
- CRM.$(function($) {
- // Elements are sometimes in a jQuery dialog box which is outside crm-container,
- // So gotta attach this handler to the whole body - sorry.
- $('body').off('click.changeActivityStatus');
- $('body').on('click.changeActivityStatus', 'a.crm-activity-change-status', function() {
- var link = $(this),
- activityId = $(this).attr('activity_id'),
- current_status_id = $(this).attr('current_status'),
- caseId = $(this).attr('case_id'),
- data = 'snippet=1&reset=1',
- $el = $('<div class="crm-activity_change_status"></div>');
- $el.block();
-
- $el.load(CRM.url('civicrm/case/changeactivitystatus'), data, function() {
- $el.unblock().trigger('crmLoad');
- $("#activity_change_status").val(current_status_id);
- });
-
- CRM.confirm({
- title: {/literal}'{ts escape='js'}Change Activity Status{/ts}'{literal},
- message: $el
- })
- .on('crmConfirm:yes', function() {
- // update the status
- var status_id = $("#activity_change_status").val();
- if (status_id === current_status_id) {
- return false;
- }
-
- var dataUrl = CRM.url('civicrm/ajax/rest');
- var data = 'json=1&version=3&entity=Activity&action=update&id=' + activityId + '&status_id=' + status_id
- + '&case_id=' + caseId;
- var request = $.ajax({
- type : 'POST',
- dataType : 'json',
- url : dataUrl,
- data : data,
- success : function(values) {
- if (values.is_error) {
- CRM.alert(values.error_message, {/literal}'{ts escape='js'}Unable to change status{/ts}'{literal}, 'error');
- return false;
- }
- else {
- CRM.refreshParent(link);
- }
- },
- error : function(jqXHR) {
- CRM.alert(jqXHR.responseText, jqXHR.statusText, 'error');
- return false;
- }
- });
- CRM.status({}, request);
- });
- return false;
- });
- });
- </script>
-{/literal}
<div id="activities" class="crm-accordion-body">
<div class="crm-accordion-wrapper crm-accordion-inner crm-search_filters-accordion collapsed">
<div class="crm-accordion-header">
- {ts}Search Filters{/ts}</a>
+ {ts}Search Filters{/ts}
</div><!-- /.crm-accordion-header -->
<div class="crm-accordion-body">
<table class="no-border form-layout-compressed" id="searchOptions">
</td>
<td style="vertical-align: bottom;">
{assign var=caseid value=$caseID}
- <span class="crm-button"><input class="crm-form-submit default" name="_qf_Basic_refresh" value="Search" type="button" onclick="buildCaseActivities( true,{$caseid} )"; /></span>
+ <span class="crm-button crm-icon-button">
+ <span class="crm-button-icon ui-icon-check"></span>
+ <input class="crm-form-submit default" name="_qf_Basic_refresh" value="{ts}Search{/ts}" type="button" data-case-id="{$caseid}" />
+ </span>
</td>
</tr>
<tr>
{literal}
<script type="text/javascript">
CRM.$(function($) {
- buildCaseActivities(false,{/literal}{$caseID}{literal});
-});
-
-function buildCaseActivities(filterSearch , CaseId) {
- if (filterSearch) {
- oTable.fnDestroy();
- }
- var count = 0;
- var columns = '';
- var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/activity' h=0 q='snippet=4&caseID='}"{literal}+CaseId;
- sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
- sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
+ var CaseId = {/literal}{$caseID}{literal};
+ buildCaseActivities(false);
+ $('input.crm-form-submit[data-case-id=' + CaseId + ']').click(buildCaseActivities);
- CRM.$('#case_id_'+CaseId+' th').each(function( ) {
- if (CRM.$(this).attr('id') != 'nosort') {
- columns += '{"sClass": "' + CRM.$(this).attr('class') +'"},';
- }
- else {
- columns += '{ "bSortable": false },';
+ function buildCaseActivities(filterSearch) {
+ if (filterSearch) {
+ oTable.fnDestroy();
}
- count++;
- });
+ var count = 0;
+ var columns = '';
+ var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/activity' h=0 q='snippet=4&caseID='}"{literal}+CaseId;
+ sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
+ sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
- columns = columns.substring(0, columns.length - 1 );
- eval('columns =[' + columns + ']');
+ $('#case_id_'+CaseId+' th').each(function( ) {
+ if ($(this).attr('id') != 'nosort') {
+ columns += '{"sClass": "' + $(this).attr('class') +'"},';
+ }
+ else {
+ columns += '{ "bSortable": false },';
+ }
+ count++;
+ });
- oTable = CRM.$('#case_id_'+CaseId).dataTable({
- "bFilter" : false,
- "bAutoWidth" : false,
- "aaSorting" : [],
- "aoColumns" : columns,
- "bProcessing": true,
- "bJQueryUI": true,
- "asStripClasses" : [ "odd-row", "even-row" ],
- "sPaginationType": "full_numbers",
- "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
- "bServerSide": true,
- "sAjaxSource": sourceUrl,
- "iDisplayLength": 10,
- "bDestroy": true,
- "fnDrawCallback": function() { setSelectorClass(CaseId); },
- "fnServerData": function ( sSource, aoData, fnCallback ) {
+ columns = columns.substring(0, columns.length - 1 );
+ eval('columns =[' + columns + ']');
- if ( filterSearch ) {
- var activity_deleted = 0;
- if ( CRM.$("#activity_deleted_"+CaseId+":checked").val() == 1 ) {
- activity_deleted = 1;
+ oTable = $('#case_id_'+CaseId).dataTable({
+ "bFilter" : false,
+ "bAutoWidth" : false,
+ "aaSorting" : [],
+ "aoColumns" : columns,
+ "bProcessing": true,
+ "bJQueryUI": true,
+ "asStripClasses" : [ "odd-row", "even-row" ],
+ "sPaginationType": "full_numbers",
+ "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
+ "bServerSide": true,
+ "sAjaxSource": sourceUrl,
+ "iDisplayLength": 10,
+ "bDestroy": true,
+ "fnDrawCallback": function() {
+ setSelectorClass();
+ setRowIds();
+ // FIXME: trigger crmLoad and crmEditable would happen automatically
+ $('.crm-editable', '#case_id_'+CaseId).crmEditable();
+ },
+ "fnServerData": function ( sSource, aoData, fnCallback ) {
+
+ if ( filterSearch ) {
+ var activity_deleted = 0;
+ if ( $("#activity_deleted_"+CaseId+":checked").val() == 1 ) {
+ activity_deleted = 1;
+ }
+ aoData.push(
+ {name:'status_id', value: $("select#status_id_"+CaseId).val()},
+ {name:'reporter_id', value: $("select#reporter_id_"+CaseId).val()},
+ {name:'activity_type_id', value: $("select#activity_type_filter_id_"+CaseId).val()},
+ {name:'activity_date_low', value: $("#activity_date_low_"+CaseId).val()},
+ {name:'activity_date_high', value: $("#activity_date_high_"+CaseId).val() },
+ {name:'activity_deleted', value: activity_deleted }
+ );
}
- aoData.push(
- {name:'status_id', value: CRM.$("select#status_id_"+CaseId).val()},
- {name:'reporter_id', value: CRM.$("select#reporter_id_"+CaseId).val()},
- {name:'activity_type_id', value: CRM.$("select#activity_type_filter_id_"+CaseId).val()},
- {name:'activity_date_low', value: CRM.$("#activity_date_low_"+CaseId).val()},
- {name:'activity_date_high', value: CRM.$("#activity_date_high_"+CaseId).val() },
- {name:'activity_deleted', value: activity_deleted }
- );
+ $.ajax( {
+ "dataType": 'json',
+ "type": "POST",
+ "url": sSource,
+ "data": aoData,
+ "success": fnCallback
+ } );
}
- CRM.$.ajax( {
- "dataType": 'json',
- "type": "POST",
- "url": sSource,
- "data": aoData,
- "success": fnCallback
- } );
- }
- });
-}
+ });
+ }
-function setSelectorClass(CaseId) {
- CRM.$("#case_id_"+CaseId+" td:last-child").each( function( ) {
- CRM.$(this).parent().addClass(CRM.$(this).text() );
- });
-}
+ function setRowIds() {
+ $("#case_id_"+CaseId+" tbody tr").each(function() {
+ var link, id;
+ link = $('a.action-item', this).attr('href');
+ if (link) {
+ id = link.match(/&id=(\d+)/);
+ }
+ if (id) {
+ $(this)
+ .addClass('crm-entity')
+ .data('entity', 'activity')
+ .data('id', id[1]);
+ }
+ });
+ }
+
+ function setSelectorClass() {
+ $("#case_id_"+CaseId+" td:last-child").each(function() {
+ $(this).parent().addClass($(this).text());
+ });
+ }
+});
</script>
{/literal}
{include file="CRM/Case/Form/ActivityTab.tpl"}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
-
- {include file="CRM/Case/Form/ActivityChangeStatusJs.tpl"}
{/if} {* view related cases if end *}
</div>
</div>
{/if}
{/if}
-
-{include file="CRM/Case/Form/ActivityChangeStatusJs.tpl"}
{counter start=0 skip=1 print=false}
{foreach from=$rows item=row}
- <tr class="{$row.class}">
+ <tr class="crm-entity {$row.class}" data-entity="activity" data-id="{$row.id}">
<td class="crm-case-display_date">{$row.display_date}</td>
<td class="crm-case-subject">{$row.subject}</td>
<td class="crm-case-type">{$row.type}</td>
{/if}
{/if}
</div>
-
-{include file="CRM/Case/Form/ActivityChangeStatusJs.tpl"}
<script type="text/javascript">
function {/literal}{$context}{$list}{literal}CaseDetails( caseId, contactId, type, context )
{
- var dataUrl = {/literal}"{crmURL p='civicrm/case/details' h=0 q='snippet=4&caseId='}{literal}" + caseId +'&cid=' + contactId + '&type=' + type;
- cj.ajax({
- url : dataUrl,
- dataType: "html",
- timeout : 5000, //Time in milliseconds
- success : function( data ){
- cj( '#'+ context + '-' + type +'-casedetails-' + caseId ).html( data );
- },
- error : function( XMLHttpRequest, textStatus, errorThrown ) {
- CRM.console('error', 'Error: ', textStatus);
- }
- });
+ var dataUrl = CRM.url('civicrm/case/details', {caseId: caseId, cid: contactId, type: type});
+ CRM.loadPage(dataUrl, {target: '#'+ context + '-' + type +'-casedetails-' + caseId});
}
function showCaseActivities( caseId, type, context ) {
</script>
{/literal}
-
-{include file="CRM/Case/Form/ActivityChangeStatusJs.tpl"}
{if $rows}
{include file="CRM/Case/Form/Selector.tpl"}
- {include file="CRM/Case/Form/ActivityChangeStatusJs.tpl"}
{else}
<div class="messages status no-popup">
<div class="icon inform-icon"></div>
* <http://www.gnu.org/licenses/>.
*/
+use Civi\Payment\System;
+
/**
* Include configuration
*/
$this->restoreDefaultPriceSetConfig();
$var = TRUE;
CRM_Member_BAO_Membership::createRelatedMemberships($var, $var, TRUE);
+ Civi\Payment\System::singleton()->flushProcessors();
}
public function restoreDefaultPriceSetConfig() {
/**
* Test submit recurring membership with immediate confirmation (IATS style)
* - we process 2 membership transactions against with a recurring contribution against a contribution page with an immediate
- * processor (IASTS style - denoted by returning trxn_id)
+ * processor (IATS style - denoted by returning trxn_id)
* - the first creates a new membership, completed contribution, in progress recurring. Check these
* - create another - end date should be extended
*/
/**
- * Test that if datesdate are not set they not over-ridden if id is passed in
+ * Test that if dates are set they not over-ridden if id is passed in
*/
public function testMembershipDatesNotOverridden() {
$result = $this->callAPISuccess($this->_entity, 'create', $this->_params);
'visibility' => 'public',
);
- $membershiptype = $this->callAPIAndDocument('membership_type', 'create', $params, __FUNCTION__, __FILE__);
- $this->assertNotNull($membershiptype['values']);
- $this->membershipTypeDelete(array('id' => $membershiptype['id']));
+ $membershipType = $this->callAPIAndDocument('membership_type', 'create', $params, __FUNCTION__, __FILE__);
+ $this->assertNotNull($membershipType['values']);
+ $this->membershipTypeDelete(array('id' => $membershipType['id']));
}
+ /**
+ * Test mandatory parameter check.
+ */
public function testUpdateWithEmptyParams() {
- $params = array();
- $membershiptype = $this->callAPIFailure('membership_type', 'create', $params);
- $this->assertEquals($membershiptype['error_message'],
- 'Mandatory key(s) missing from params array: domain_id, member_of_contact_id, financial_type_id, duration_unit, duration_interval, name'
- );
+ $this->callAPIFailure('membership_type', 'create', array());
}
+ /**
+ * Test update fails with no ID.
+ */
public function testUpdateWithoutId() {
$params = array(
'name' => '60+ Membership',
'visibility' => 'public',
);
- $membershiptype = $this->callAPIFailure('membership_type', 'create', $params);
- $this->assertEquals($membershiptype['error_message'], 'Mandatory key(s) missing from params array: domain_id');
+ $membershipType = $this->callAPIFailure('membership_type', 'create', $params);
+ $this->assertEquals($membershipType['error_message'], 'Mandatory key(s) missing from params array: domain_id');
}
public function testUpdate() {
$this->getAndCheck($params, $id, $this->_entity);
}
+ /**
+ * Test for failure when id is not valid.
+ */
public function testDeleteNotExists() {
$params = array(
'id' => 'doesNotExist',
);
- $membershiptype = $this->callAPIFailure('membership_type', 'delete', $params,
- 'Error while deleting membership type. id : ' . $params['id']
- );
+ $this->callAPIFailure('membership_type', 'delete', $params,
+ 'Error while deleting membership type. id : ' . $params['id']
+ );
}
public function testDelete() {
'id' => $membershipTypeID,
);
- $result = $this->callAPIAndDocument('membership_type', 'delete', $params, __FUNCTION__, __FILE__);
+ $this->callAPIAndDocument('membership_type', 'delete', $params, __FUNCTION__, __FILE__);
}
}