return $deleteClause;
}
- $user = CRM_Core_Session::getLoggedInContactID();
- if ($contactID == NULL) {
- $contactID = $user ? $user : 0;
- }
-
- // Check if contact has permissions on self
- if ($user && $contactID == $user) {
- if (CRM_Core_Permission::check('edit my contact') ||
- ($type == self::VIEW && CRM_Core_Permission::check('view my contact'))
- ) {
- return ' ( 1 ) ';
- }
+ if (!$contactID) {
+ $contactID = CRM_Core_Session::getLoggedInContactID();
}
+ $contactID = (int) $contactID;
- return implode(' AND ',
+ $where = implode(' AND ',
array(
CRM_ACL_BAO_ACL::whereClause($type,
$tables,
$deleteClause,
)
);
+
+ // Add permission on self
+ if ($contactID && (CRM_Core_Permission::check('edit my contact') ||
+ $type == self::VIEW && CRM_Core_Permission::check('view my contact'))
+ ) {
+ $where = "contact_a.id = $contactID OR ($where)";
+ }
+ return $where;
}
/**
}
$form->addFormRule(array('CRM_Contact_Form_Task_EmailCommon', 'formRule'), $form);
- CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Contact/Form/Task/EmailCommon.js');
+ CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'templates/CRM/Contact/Form/Task/EmailCommon.js', 0, 'html-header');
}
/**
//only valid processors get display to user
if ($this->_mode) {
- $this->assign('processorSupportsFutureStartDate', CRM_Financial_BAO_PaymentProcessor::hasPaymentProcessorSupporting(array('supportsFutureRecurStartDate')));
+ $this->assign('processorSupportsFutureStartDate', CRM_Financial_BAO_PaymentProcessor::hasPaymentProcessorSupporting(array('FutureRecurStartDate')));
$this->_paymentProcessors = $this->getValidProcessors();
if (!isset($this->_paymentProcessor['id'])) {
// if the payment processor isn't set yet (as indicated by the presence of an id,) we'll grab the first one which should be the default
ts('Progress Bar Color'),
'text',
FALSE,
- '#FFFFFF',
+ '#2786C2',
),
'color_main_text' => array(
ts('Additional Text Color'),
'#96C0E7',
),
'color_about_link' => array(
- ts('Button Link Color'),
+ ts('Button Text Color'),
'text',
FALSE,
'#556C82',
$repeatEvent = ($actionSchedule->end_action == 'before' ? 'DATE_SUB' : 'DATE_ADD') . "({$dateField}, INTERVAL {$actionSchedule->end_frequency_interval} {$actionSchedule->end_frequency_unit})";
if ($actionSchedule->repetition_frequency_unit == 'day') {
- $hrs = 24 * $actionSchedule->repetition_frequency_interval;
+ $interval = "{$actionSchedule->repetition_frequency_interval} DAY";
}
elseif ($actionSchedule->repetition_frequency_unit == 'week') {
- $hrs = 24 * $actionSchedule->repetition_frequency_interval * 7;
+ $interval = "{$actionSchedule->repetition_frequency_interval} WEEK";
}
elseif ($actionSchedule->repetition_frequency_unit == 'month') {
- $hrs = "24*(DATEDIFF(DATE_ADD(latest_log_time, INTERVAL 1 MONTH ), latest_log_time))";
+ $interval = "{$actionSchedule->repetition_frequency_interval} MONTH";
}
elseif ($actionSchedule->repetition_frequency_unit == 'year') {
- $hrs = "24*(DATEDIFF(DATE_ADD(latest_log_time, INTERVAL 1 YEAR ), latest_log_time))";
+ $interval = "{$actionSchedule->repetition_frequency_interval} YEAR";
}
else {
- $hrs = $actionSchedule->repetition_frequency_interval;
+ $interval = "{$actionSchedule->repetition_frequency_interval} HOUR";
}
// (now <= repeat_end_time )
$repeatEventClause = "'{$now}' <= {$repeatEvent}";
// diff(now && logged_date_time) >= repeat_interval
- $havingClause = "HAVING TIMEDIFF({$now}, latest_log_time) >= TIME('{$hrs}:00:00')";
+ $havingClause = "HAVING TIMESTAMPDIFF(HOUR, latest_log_time, CAST({$now} AS datetime)) >= TIMESTAMPDIFF(HOUR, latest_log_time, DATE_ADD(latest_log_time, INTERVAL $interval))";
$groupByClause = 'GROUP BY reminder.contact_id, reminder.entity_id, reminder.entity_table';
$selectClause .= ', MAX(reminder.action_date_time) as latest_log_time';
//CRM-15376 - do not send our reminders if original criteria no longer applies
WHERE (li.entity_table = 'civicrm_participant' AND li.entity_id = {$participantId})";
CRM_Core_DAO::executeQuery($updateLineItem);
}
+ $amountLevel = array();
+ $totalParticipant = $participantCount = 0;
if (!empty($updateLines)) {
foreach ($updateLines as $valueId => $vals) {
+ $taxAmount = "NULL";
if (isset($vals['tax_amount'])) {
$taxAmount = $vals['tax_amount'];
}
- else {
- $taxAmount = "NULL";
+ $amountLevel[] = $vals['label'] . ' - ' . (float) $vals['qty'];
+ if (isset($vals['participant_count'])) {
+ $participantCount = $vals['participant_count'];
+ $totalParticipant += $vals['participant_count'];
}
$updateLineItem = "
UPDATE civicrm_line_item li
li.line_total = {$vals['line_total']},
li.tax_amount = {$taxAmount},
li.unit_price = {$vals['unit_price']},
+ li.participant_count = {$participantCount},
li.label = %1
WHERE (li.entity_table = 'civicrm_participant' AND li.entity_id = {$participantId}) AND
(price_field_value_id = {$valueId})
else {
$taxAmount = "NULL";
}
- $trxn = self::recordAdjustedAmt($updatedAmount, $paidAmount, $contributionId, $taxAmount);
+ $displayParticipantCount = '';
+ if ($totalParticipant > 0) {
+ $displayParticipantCount = ' Participant Count -' . $totalParticipant;
+ }
+ $updateAmountLevel = NULL;
+ if (!empty($amountLevel)) {
+ $updateAmountLevel = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, $amountLevel) . $displayParticipantCount . CRM_Core_DAO::VALUE_SEPARATOR;
+ }
+ $trxn = self::recordAdjustedAmt($updatedAmount, $paidAmount, $contributionId, $taxAmount, $updateAmountLevel);
$trxnId = array();
if ($trxn) {
$trxnId['id'] = $trxn->id;
* @param $paidAmount
* @param int $contributionId
*/
- public static function recordAdjustedAmt($updatedAmount, $paidAmount, $contributionId, $taxAmount = NULL) {
+ public static function recordAdjustedAmt($updatedAmount, $paidAmount, $contributionId, $taxAmount = NULL, $updateAmountLevel = NULL) {
$pendingAmount = CRM_Core_BAO_FinancialTrxn::getBalanceTrxnAmt($contributionId);
$pendingAmount = CRM_Utils_Array::value('total_amount', $pendingAmount, 0);
$balanceAmt = $updatedAmount - $paidAmount;
$updatedContributionDAO->total_amount = $updatedContributionDAO->net_amount = $updatedAmount;
$updatedContributionDAO->fee_amount = 0;
$updatedContributionDAO->tax_amount = $taxAmount;
+ if (!empty($updateAmountLevel)) {
+ $updatedContributionDAO->amount_level = $updateAmountLevel;
+ }
$updatedContributionDAO->save();
// adjusted amount financial_trxn creation
$updatedContribution = CRM_Contribute_BAO_Contribution::getValues(
$this->_values['event']
));
$eventEndDate = CRM_Utils_Date::processDate(CRM_Utils_Array::value('event_end_date', $this->_values['event']));
- if (($regEndDate && ($regEndDate < $now)) || (empty($regEndDate) && ($eventEndDate < $now))) {
+ if (($regEndDate && ($regEndDate < $now)) || (empty($regEndDate) && !empty($eventEndDate) && ($eventEndDate < $now))) {
$endDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('registration_end_date', $this->_values['event']));
if (empty($regEndDate)) {
$endDate = CRM_Utils_Date::customFormat(CRM_Utils_Array::value('event_end_date', $this->_values['event']));
$params = array('id' => $this->_id);
CRM_Pledge_BAO_Pledge::getValues($params, $this->_values);
- $this->_isPending = (CRM_Pledge_BAO_Pledge::pledgeHasFinancialTransactions($this->_id, CRM_Utils_Array::value('status_id', $this->_values))) ? FALSE : T;
+ $this->_isPending = (CRM_Pledge_BAO_Pledge::pledgeHasFinancialTransactions($this->_id, CRM_Utils_Array::value('status_id', $this->_values))) ? FALSE : TRUE;
}
//get the pledge frequency units.
/**
* Setter for $_force.
*
- * @param $isForce
+ * @param bool $isForce
*/
public function setForce($isForce) {
$this->_force = $isForce;
}
/**
- * A form rule function to ensure that fields selected in group_by
- * (if any) should only be the ones present in display/select fields criteria;
+ * A form rule function for custom data.
+ *
+ * The rule ensures that fields selected in group_by if any) should only be the ones
+ * present in display/select fields criteria;
* note: works if and only if any custom field selected in group_by.
*
* @param array $fields
* Get SQL where clause for a date field.
*
* @param string $fieldName
- * @param $relative
+ * @param string $relative
* @param string $from
* @param string $to
* @param string $type
}
/**
- * @param $value
- * @param $customField
- * @param $fieldValueMap
+ * Format custom values.
+ *
+ * @param mixed $value
+ * @param array $customField
+ * @param array $fieldValueMap
*
* @return float|string|void
*/
}
/**
- * @param $rows
+ * Remove duplicate rows.
+ *
+ * @param array $rows
*/
public function removeDuplicates(&$rows) {
if (empty($this->_noRepeats)) {
}
/**
- * @param $row
- * @param $fields
+ * Fix subtotal display.
+ *
+ * @param array $row
+ * @param array $fields
* @param bool $subtotal
*/
public function fixSubTotalDisplay(&$row, $fields, $subtotal = TRUE) {
}
/**
- * @param $rows
+ * Calculate grant total.
+ *
+ * @param array $rows
*
* @return bool
*/
}
/**
- * @param $rows
+ * Format display output.
+ *
+ * @param array $rows
* @param bool $pager
*/
public function formatDisplay(&$rows, $pager = TRUE) {
}
/**
- * @param $rows
+ * Build chart.
+ *
+ * @param array $rows
*/
public function buildChart(&$rows) {
// override this method for building charts.
// towards generalizing the select() method below.
/**
- * Generate the SELECT clause and set class variable $_select
+ * Generate the SELECT clause and set class variable $_select.
*/
public function select() {
$select = $this->_selectAliases = array();
) {
// 1. In many cases we want select clause to be built in slightly different way
- // for a particular field of a particular type.
+ // for a particular field of a particular type.
// 2. This method when used should receive params by reference and modify $this->_columnHeaders
- // as needed.
+ // as needed.
$selectClause = $this->selectClause($tableName, 'fields', $fieldName, $field);
if ($selectClause) {
$select[] = $selectClause;
$this->_phoneField = TRUE;
}
// 1. In many cases we want select clause to be built in slightly different way
- // for a particular field of a particular type.
+ // for a particular field of a particular type.
// 2. This method when used should receive params by reference and modify $this->_columnHeaders
- // as needed.
+ // as needed.
$selectClause = $this->selectClause($tableName, 'group_bys', $fieldName, $field);
if ($selectClause) {
$select[] = $selectClause;
}
/**
+ * Build select clause for a single field.
+ *
* @param string $tableName
- * @param $tableKey
+ * @param string $tableKey
* @param string $fieldName
- * @param $field
+ * @param string $field
*
* @return bool
*/
return FALSE;
}
+ /**
+ * Build where clause.
+ */
public function where() {
$this->storeWhereHavingClauseArray();
}
/**
- * Store Where clauses into an array - breaking out this step makes
- * over-riding more flexible as the clauses can be used in constructing a
+ * Store Where clauses into an array.
+ *
+ * Breaking out this step makes over-riding more flexible as the clauses can be used in constructing a
* temp table that may not be part of the final where clause or added
* in other functions
*/
}
+ /**
+ * Set output mode.
+ */
public function processReportMode() {
$buttonName = $this->controller->getButtonName();
}
/**
- * Post Processing function for Form (postProcessCommon should be used to set other variables from input as the api accesses that function)
+ * Post Processing function for Form.
+ *
+ * postProcessCommon should be used to set other variables from input as the api accesses that function.
*/
public function beginPostProcess() {
$this->setParams($this->controller->exportValues($this->_name));
}
/**
- * BeginPostProcess function run in both report mode and non-report mode (api)
+ * BeginPostProcess function run in both report mode and non-report mode (api).
*/
- public function beginPostProcessCommon() {
-
- }
+ public function beginPostProcessCommon() {}
/**
+ * Build the report query.
+ *
* @param bool $applyLimit
*
* @return string
return $sql;
}
+ /**
+ * Build group by clause.
+ */
public function groupBy() {
$groupBys = array();
if (!empty($this->_params['group_bys']) &&
}
}
+ /**
+ * Build order by clause.
+ */
public function orderBy() {
$this->_orderBy = "";
$this->_sections = array();
}
/**
+ * Extract order by fields and store as an array.
+ *
* In some cases other functions want to know which fields are selected for ordering by
* Separating this into a separate function allows it to be called separately from constructing
* the order by clause
}
/**
+ * Determine unselected columns.
+ *
* @return array
*/
public function unselectedSectionColumns() {
}
/**
- * @param $sql
- * @param $rows
+ * Build output rows.
+ *
+ * @param string $sql
+ * @param array $rows
*/
public function buildRows($sql, &$rows) {
$dao = CRM_Core_DAO::executeQuery($sql);
}
/**
+ * Calculate section totals.
+ *
* When "order by" fields are marked as sections, this assigns to the template
* an array of total counts for each section. This data is used by the Smarty
- * plugin {sectionTotal}
+ * plugin {sectionTotal}.
*/
public function sectionTotals() {
}
}
+ /**
+ * Modify column headers.
+ */
public function modifyColumnHeaders() {
// use this method to modify $this->_columnHeaders
}
/**
- * @param $rows
+ * Assign rows to the template.
+ *
+ * @param array $rows
*/
public function doTemplateAssignment(&$rows) {
$this->assign_by_ref('columnHeaders', $this->_columnHeaders);
}
/**
- * override this method to build your own statistics
- * @param $rows
+ * Build report statistics.
+ *
+ * Override this method to build your own statistics.
+ *
+ * @param array $rows
*
* @return array
*/
}
/**
- * @param $statistics
- * @param $count
+ * Add count statistics.
+ *
+ * @param array $statistics
+ * @param int $count
*/
public function countStat(&$statistics, $count) {
$statistics['counts']['rowCount'] = array(
}
/**
- * @param $statistics
+ * Add group by statistics.
+ *
+ * @param array $statistics
*/
public function groupByStat(&$statistics) {
if (!empty($this->_params['group_bys']) &&
}
/**
- * @param $statistics
+ * Filter statistics.
+ *
+ * @param array $statistics
*/
public function filterStat(&$statistics) {
foreach ($this->_columns as $tableName => $table) {
/**
* Compile the report content.
+ *
* Although this function is super-short it is useful to keep separate so it can be over-ridden by report classes.
*
* @return string
}
+ /**
+ * Post process function.
+ */
public function postProcess() {
// get ready with post process params
$this->beginPostProcess();
}
/**
+ * Set limit.
+ *
* @param int $rowCount
+ *
* @return array
*/
public function limit($rowCount = self::ROW_COUNT_LIMIT) {
}
/**
+ * Set pager.
+ *
* @param int $rowCount
*/
public function setPager($rowCount = self::ROW_COUNT_LIMIT) {
}
/**
- * @param $field
- * @param $value
- * @param $op
+ * Build where clause for groups.
+ *
+ * @param string $field
+ * @param mixed $value
+ * @param string $op
*
* @return string
*/
}
/**
- * @param $field
- * @param $value
- * @param $op
+ * Build where clause for tags.
+ *
+ * @param string $field
+ * @param mixed $value
+ * @param string $op
*
* @return string
*/
/**
* Generate Membership Type SQL Clause.
+ *
* @param mixed $value
* @param string $op
*
}
/**
+ * Build acl clauses.
+ *
* @param string $tableAlias
*/
public function buildACLClause($tableAlias = 'contact_a') {
}
/**
+ * Add custom data to the columns.
+ *
* @param bool $addFields
* @param array $permCustomGroupIds
*/
}
}
+ /**
+ * Build custom data from clause.
+ */
public function customDataFrom() {
if (empty($this->_customGroupExtends)) {
return;
}
/**
- * @param $prop
+ * Check if the field is selected.
+ *
+ * @param string $prop
*
* @return bool
*/
}
/**
- * Does table name have columns in SELECT clause?
+ * Check if table name has columns in SELECT clause.
*
* @param string $tableName
* Name of table (index of $this->_columns array).
/**
* Fetch array of DAO tables having columns included in SELECT or ORDER BY clause.
- * (building the array if it's unset)
+ *
+ * If the array is unset it will be built.
*
* @return array
* selectedTables
}
/**
+ * Add address fields.
+ *
* @deprecated - use getAddressColumns which is a more accurate description
* and also accepts an array of options rather than a long list
*
/**
* Do AlterDisplay processing on Address Fields.
*
- * @param $row
- * @param $rows
- * @param $rowNum
- * @param $baseUrl
- * @param $urltxt
+ * @param array $row
+ * @param array $rows
+ * @param int $rowNum
+ * @param string $baseUrl
+ * @param string $urltxt
*
* @return bool
*/
}
/**
+ * Add contact to group.
+ *
* @param int $groupID
*/
public function add2group($groupID) {
}
/**
- * function used for showing charts on print screen.
+ * Show charts on print screen.
*/
public static function uploadChartImage() {
// upload strictly for '.png' images
*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
class CRM_Report_Form_Contribute_Summary extends CRM_Report_Form {
protected $_addressField = FALSE;
public $_drilldownReport = array('contribute/detail' => 'Link to Detail Report');
/**
+<<<<<<< HEAD
* To what frequency group-by a date column
*
* @var array
);
/**
+=======
+ * Class constructor.
+>>>>>>> upstream/4.6
*/
public function __construct() {
parent::__construct();
}
- public function preProcess() {
- parent::preProcess();
- }
-
/**
- * @param bool $freeze
- *
- * @return array
+ * Set select clause.
*/
- public function setDefaultValues($freeze = TRUE) {
- return parent::setDefaultValues($freeze);
- }
-
public function select() {
$select = array();
$this->_columnHeaders = array();
}
/**
- * @param $fields
- * @param $files
- * @param $self
+ * Set form rules.
+ *
+ * @param array $fields
+ * @param array $files
+ * @param CRM_Report_Form_Contribute_Summary $self
*
* @return array
*/
public static function formRule($fields, $files, $self) {
- $errors = $grouping = array();
- //check for searching combination of dispaly columns and
- //grouping criteria
+ // Check for searching combination of display columns and
+ // grouping criteria
$ignoreFields = array('total_amount', 'sort_name');
$errors = $self->customDataFormRule($fields, $ignoreFields);
return $errors;
}
+ /**
+ * Set from clause.
+ *
+ * @param string $entity
+ */
public function from($entity = NULL) {
$softCreditJoinType = "LEFT";
if (!empty($this->_params['fields']['soft_amount']) &&
}
}
+ /**
+ * Set group by clause.
+ */
public function groupBy() {
$this->_groupBy = "";
$append = FALSE;
}
}
+ /**
+ * Store having clauses as an array.
+ */
public function storeWhereHavingClauseArray() {
parent::storeWhereHavingClauseArray();
if (empty($this->_params['fields']['soft_amount']) &&
}
/**
- * @param $rows
+ * Set statistics.
+ *
+ * @param array $rows
*
* @return array
*/
$statistics = parent::statistics($rows);
$softCredit = CRM_Utils_Array::value('soft_amount', $this->_params['fields']);
- $onlySoftCredit = $softCredit &&
- !CRM_Utils_Array::value('total_amount', $this->_params['fields']);
- $totalAmount = $average = $softTotalAmount = $softAverage = array();
+ $onlySoftCredit = $softCredit && !CRM_Utils_Array::value('total_amount', $this->_params['fields']);
$group = "\nGROUP BY {$this->_aliases['civicrm_contribution']}.currency";
$this->from('contribution');
- $contriQuery = "
+ $this->customDataFrom();
+
+ $contriQuery = "SELECT
COUNT({$this->_aliases['civicrm_contribution']}.total_amount ) as civicrm_contribution_total_amount_count,
SUM({$this->_aliases['civicrm_contribution']}.total_amount ) as civicrm_contribution_total_amount_sum,
ROUND(AVG({$this->_aliases['civicrm_contribution']}.total_amount), 2) as civicrm_contribution_total_amount_avg,
return $statistics;
}
+ /**
+ * Post process function.
+ */
public function postProcess() {
$this->buildACLClause($this->_aliases['civicrm_contact']);
parent::postProcess();
}
+ /**
+ * Build table rows for output.
+ *
+ * @param string $sql
+ * @param array $rows
+ */
public function buildRows($sql, &$rows) {
$dao = CRM_Core_DAO::executeQuery($sql);
if (!is_array($rows)) {
// use this method to modify $this->_columnHeaders
$this->modifyColumnHeaders();
-
+ $contriRows = array();
$unselectedSectionColumns = $this->unselectedSectionColumns();
//CRM-16338 if both soft-credit and contribution are enabled then process the contribution's
}
/**
- * @param $rows
+ * Build chart.
+ *
+ * @param array $rows
*/
public function buildChart(&$rows) {
$graphRows = array();
--- /dev/null
+{* file to handle db changes in 4.6.9 during upgrade *}
public function getTimeZoneOffset() {
$timezone = $this->getTimeZoneString();
if ($timezone) {
+ if ($timezone == 'UTC') {
+ // CRM-17072 Let's short-circuit all the zero handling & return it here!
+ return '+00:00';
+ }
$tzObj = new DateTimeZone($timezone);
$dateTime = new DateTime("now", $tzObj);
$tz = $tzObj->getOffset($dateTime);
entity: entity,
select: {
multiple: multiSelect,
- minimumInputLength: _.includes(OPEN_IMMEDIATELY, entity) ? 0 : 1
+ minimumInputLength: _.includes(OPEN_IMMEDIATELY, entity) ? 0 : 1,
+ // If user types a numeric id, allow it as a choice
+ createSearchChoice: function(input) {
+ var match = /[1-9][0-9]*/.exec(input);
+ if (match && match[0] === input) {
+ return {id: input, label: input};
+ }
+ }
}
});
}
CRM.$(function($) {
//do not copy & paste this - find a way to generalise it
'use strict';
- // NOTE: Might be safer to say $('[name=_qf_Email_upload]')
- $('.crm-form-submit').not('.cancel').on("click", function() {
- $('.crm-form-submit').not('.cancel').attr({value: ts('Processing')});
+ // NOTE: Target only fullscreen forms (using #crm-container as context) because popups already have this feature
+ $('.crm-form-submit', '#crm-container').not('.cancel').on("click", function() {
+ $('.crm-form-submit', '#crm-container').not('.cancel').attr({value: ts('Processing')});
// CRM-13449 : setting a 0 ms timeout is needed
// for some browsers like chrome. Used for purpose of
// submit the form and stop accidental multiple clicks
setTimeout(function(){
- $('.crm-form-submit').not('.cancel').prop({disabled: true});
+ $('.crm-form-submit', '#crm-container').not('.cancel').prop({disabled: true});
}, 0);
});
});
}
function buildRecurBlock( processorId ) {
-
if ( !processorId ) processorId = cj( "#payment_processor_id" ).val( );
var recurPaymentProIds = {/literal}'{$recurringPaymentProcessorIds}'{literal};
- var funName = 'hide';
- if ( recurPaymentProIds.indexOf( processorId ) != -1 ) funName = 'show';
+ var funName = ( cj.inArray(processorId, recurPaymentProIds.split(',')) > -1 ) ? 'show' : 'hide';
var priceSet = cj("#price_set_id");
if ( priceSet && priceSet.val( ) ) {
background-color: {/literal}{$form.color_main_bg.value}{literal};
} /* title */
.crm-contribute-widget .crm-amount-raised { color:#000; }
- .crm-contribute-widget .crm-amount-bar /* progress bar */
- background-color:{/literal}{$form.color_bar.value}{literal};
- border-color:#CECECE;
+ .crm-contribute-widget .crm-amount-fill {
+ background-color:{/literal}{$form.color_bar.value}{literal};
}
- .crm-contribute-widget .crm-amount-fill { background-color:#2786C2; }
.crm-contribute-widget a.crm-contribute-button { /* button color */
background-color:{/literal}{$form.color_button.value}{literal};
}
{foreach from=$eventSummary.tab key=k item=v}
{assign var="fld" value=$v.field}
{if NOT $values.$fld}{assign var="status" value="disabled"}{else}{assign var="status" value="enabled"}{/if}
- <li><a title="{$v.title}" class="action-item crm-hover-button no-popup {$status}"
- href="{crmURL p="`$v.url`" q="reset=1&action=update&id=`$id`"}">{$v.title}</a></li>
+ {* Schedule Reminders requires a different query string. *}
+ {if $v.url EQ 'civicrm/event/manage/reminder'}
+ <li><a title="{$v.title}" class="action-item crm-hover-button no-popup {$status}"
+ href="{crmURL p="`$v.url`" q="reset=1&action=browse&setTab=1&id=`$id`"}">{$v.title}</a></li>
+ {else}
+ <li><a title="{$v.title}" class="action-item crm-hover-button no-popup {$status}"
+ href="{crmURL p="`$v.url`" q="reset=1&action=update&id=`$id`"}">{$v.title}</a></li>
+ {/if}
{/foreach}
</ul>
</span>
$this->assertEquals(0, $result['count']);
}
+ /**
+ * Function tests that an empty where hook returns exactly 1 result with "view my contact".
+ *
+ * CRM-16512 caused contacts with Edit my contact to be able to view all records.
+ */
+ public function testContactGetOneResultHookWithViewMyContact() {
+ $this->createLoggedInUser();
+ $this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereHookNoResults'));
+ CRM_Core_Config::singleton()->userPermissionClass->permissions = array('access CiviCRM', 'view my contact');
+ $result = $this->callAPISuccess('contact', 'get', array(
+ 'check_permissions' => 1,
+ 'return' => 'display_name',
+ ));
+ $this->assertEquals(1, $result['count']);
+ }
+
+ /**
+ * Function tests that a user with "edit my contact" can edit themselves.
+ */
+ public function testContactEditHookWithEditMyContact() {
+ $this->markTestIncomplete('api acls only work with contact get so far');
+ $cid = $this->createLoggedInUser();
+ $this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereHookNoResults'));
+ CRM_Core_Config::singleton()->userPermissionClass->permissions = array('access CiviCRM', 'edit my contact');
+ $this->callAPISuccess('contact', 'create', array(
+ 'check_permissions' => 1,
+ 'id' => $cid,
+ ));
+ }
+
/**
* Function tests all results are returned.
*/
}
/**
- * Confirm that without check permissions we still get 2 contacts returned
+ * Confirm that without check permissions we still get 2 contacts returned.
*/
public function testContactGetHookLimitingHookDontCheck() {
$result = $this->callAPISuccess('contact', 'get', array(
/**
* @dataProvider entities
* Function tests that an empty where hook returns no results
- * @param $entity
+ * @param string $entity
* @throws \PHPUnit_Framework_IncompleteTestError
*/
public function testEntityGetNoResultsHook($entity) {