Note that some special characters can still cause it to spill over but that will affect other fields too & we
should consider a bigger fix if we need to.
Also fixed deprecation notices
$params = array('id' => $contributionSoft->pcp_id);
CRM_Core_DAO::commonRetrieve('CRM_PCP_DAO_PCP', $params, $pcpInfo);
$ownerNotifyID = CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCPBlock', $pcpInfo['pcp_block_id'], 'owner_notify_id');
+ $ownerNotifyOption = CRM_Core_PseudoConstant::getName('CRM_PCP_DAO_PCPBlock', 'owner_notify_id', $ownerNotifyID);
- if ($ownerNotifyID != CRM_Core_OptionGroup::getValue('pcp_owner_notify', 'no_notifications', 'name') &&
- (($ownerNotifyID == CRM_Core_OptionGroup::getValue('pcp_owner_notify', 'owner_chooses', 'name') &&
+ if ($ownerNotifyOption != 'no_notifications' &&
+ (($ownerNotifyOption == 'owner_chooses' &&
CRM_Core_DAO::getFieldValue('CRM_PCP_DAO_PCP', $contributionSoft->pcp_id, 'is_notify')) ||
- $ownerNotifyID == CRM_Core_OptionGroup::getValue('pcp_owner_notify', 'all_owners', 'name'))) {
+ $ownerNotifyOption == 'all_owners')) {
$pcpInfoURL = CRM_Utils_System::url('civicrm/pcp/info',
"reset=1&id={$contributionSoft->pcp_id}",
TRUE, NULL, FALSE, TRUE
$this->addGroup($elements, 'pcp_is_anonymous', NULL, ' ');
$this->add('text', 'pcp_roll_nickname', ts('Name'), array('maxlength' => 30));
- $this->add('textarea', 'pcp_personal_note', ts('Personal Note'), array('style' => 'height: 3em; width: 40em;'));
+ $this->addField('pcp_personal_note', array('entity' => 'ContributionSoft', 'context' => 'create', 'style' => 'height: 3em; width: 40em;'));
}
}
if (empty($this->_values['fee']) && empty($this->_ccid)) {
//Set default columns and rows for textarea.
$props['rows'] = isset($props['rows']) ? $props['rows'] : 4;
$props['cols'] = isset($props['cols']) ? $props['cols'] : 60;
+ if (!$props['maxlength'] && isset($fieldSpec['length'])) {
+ $props['maxlength'] = $fieldSpec['length'];
+ }
return $this->add('textarea', $name, $label, $props, $required);
case 'Select Date':
$page->_defaults['pcp_is_anonymous'] = 0;
$page->add('text', 'pcp_roll_nickname', ts('Name'), array('maxlength' => 30));
- $page->add('textarea', "pcp_personal_note", ts('Personal Note'), array('style' => 'height: 3em; width: 40em;'));
+ $page->addField('pcp_personal_note', array('entity' => 'ContributionSoft', 'context' => 'create', 'style' => 'height: 3em; width: 40em;'));
}
else {
$page->assign('is_honor_roll', FALSE);
return FALSE;
}
- $approvedId = CRM_Core_OptionGroup::getValue('pcp_status', 'Approved', 'name');
-
$pcpStatus = CRM_Core_OptionGroup::values("pcp_status");
$params = array('id' => $pcpId);
// define redirect url back to contrib page or event if needed
$url = CRM_Utils_System::url($urlBase, "reset=1&id={$pcpBlock['entity_id']}", FALSE, NULL, FALSE, TRUE);
+ $currentPCPStatus = CRM_Core_PseudoConstant::getName('CRM_PCP_BAO_PCP', 'status_id', $pcpInfo['status_id']);
if ($pcpBlock['target_entity_id'] != $entity['id']) {
$statusMessage = ts('This page is not related to the Personal Campaign Page you have just visited. However you can still make a contribution here.');
CRM_Core_Error::statusBounce($statusMessage, $url);
}
- elseif ($pcpInfo['status_id'] != $approvedId) {
+ elseif ($currentPCPStatus !== 'Approved') {
$statusMessage = ts('The Personal Campaign Page you have just visited is currently %1. However you can still support the campaign here.', array(1 => $pcpStatus[$pcpInfo['status_id']]));
CRM_Core_Error::statusBounce($statusMessage, $url);
}
else {
$owner_notification_option = CRM_PCP_BAO_PCP::getOwnerNotificationId($this->controller->get('component_page_id'), $this->_component ? $this->_component : 'contribute');
}
- if ($owner_notification_option == CRM_Core_OptionGroup::getValue('pcp_owner_notify', 'owner_chooses', 'name')) {
+ if ($owner_notification_option == CRM_Core_PseudoConstant::getKey('CRM_PCP_BAO_PCPBlock', 'owner_notify_id', 'owner_chooses')) {
$this->assign('owner_notification_option', TRUE);
$this->addElement('checkbox', 'is_notify', ts('Notify me via email when someone donates to my page'), NULL);
}
$this->assign('pcp', $pcpInfo);
$pcpStatus = CRM_Core_OptionGroup::values("pcp_status");
- $approvedId = CRM_Core_OptionGroup::getValue('pcp_status', 'Approved', 'name');
+ $approvedId = CRM_Core_PseudoConstant::getKey('CRM_PCP_BAO_PCP', 'status_id', 'Approved');
// check if PCP is created by anonymous user
$anonymousPCP = CRM_Utils_Request::retrieve('ap', 'Boolean', $this);