Skip to content

Commit

Permalink
CRM-20184_Missing_{contact.email_greeting}_in_Workflow_Templates [&di…
Browse files Browse the repository at this point in the history
…splayname in subject]
  • Loading branch information
yashodha authored and magnolia61 committed Mar 20, 2018
1 parent 7713e22 commit da03cc4
Show file tree
Hide file tree
Showing 140 changed files with 4,593 additions and 148 deletions.
3 changes: 1 addition & 2 deletions CRM/Admin/Form/ScheduleReminders.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,10 @@ public function buildQuickForm() {
$this->add('number', 'start_action_offset', ts('When'), array('class' => 'six', 'min' => 0));
$this->addRule('start_action_offset', ts('Value should be a positive number'), 'positiveInteger');

$isActive = ts('Send email');
$isActive = ts('Scheduled Reminder Active');
$recordActivity = ts('Record activity for automated email');
if ($providersCount) {
$this->assign('sms', $providersCount);
$isActive = ts('Send email or SMS');
$recordActivity = ts('Record activity for automated email or SMS');
$options = CRM_Core_OptionGroup::values('msg_mode');
$this->add('select', 'mode', ts('Send as'), $options);
Expand Down
23 changes: 10 additions & 13 deletions CRM/Campaign/Form/Task/Interview.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@ public function preProcess() {

$orderClause = FALSE;
$buttonName = $this->controller->getButtonName();
$walkListActivityId = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'WalkList');
if ($buttonName == '_qf_Interview_submit_orderBy' && !empty($_POST['order_bys'])) {
$orderByParams = CRM_Utils_Array::value('order_bys', $_POST);
}
elseif (CRM_Core_OptionGroup::getValue('activity_type', 'WalkList') == $this->_surveyDetails['activity_type_id']) {
elseif ($walkListActivityId == $this->_surveyDetails['activity_type_id']) {
$orderByParams
= array(
1 => array(
Expand Down Expand Up @@ -170,8 +171,7 @@ public function preProcess() {
$this->_contactIds,
$this->_interviewerId
);
$activityStatus = CRM_Core_PseudoConstant::activityStatus('name');
$scheduledStatusId = array_search('Scheduled', $activityStatus);
$scheduledStatusId = CRM_Core_PseudoConstant::getKey('CRM_Activity_DAO_Activity', 'activity_status_id', 'Scheduled');

$activityIds = array();
foreach ($this->_contactIds as $key => $voterId) {
Expand Down Expand Up @@ -248,9 +248,9 @@ public function preProcess() {
}

//set the title.
$activityTypes = CRM_Core_PseudoConstant::activityType(FALSE, TRUE, FALSE, 'label', TRUE);
$this->_surveyTypeId = CRM_Utils_Array::value('activity_type_id', $this->_surveyValues);
CRM_Utils_System::setTitle(ts('Record %1 Responses', array(1 => $activityTypes[$this->_surveyTypeId])));
$surveyTypeLabel = CRM_Core_PseudoConstant::getLabel('CRM_Activity_BAO_Activity', 'activity_type_id', $this->_surveyTypeId);
CRM_Utils_System::setTitle(ts('Record %1 Responses', array(1 => $surveyTypeLabel)));
}

public function validateIds() {
Expand Down Expand Up @@ -387,7 +387,7 @@ public function setDefaultValues() {
foreach ($this->_surveyFields as $name => $field) {
$acceptable_types = CRM_Contact_BAO_ContactType::basicTypes();
$acceptable_types[] = 'Contact';
if (in_array($field['field_type'], $acceptable_types)) {
if (isset($field['field_type']) && (in_array($field['field_type'], $acceptable_types))) {
$contactFields[$name] = $field;
}
}
Expand All @@ -397,7 +397,8 @@ public function setDefaultValues() {
}
}

if (CRM_Core_OptionGroup::getValue('activity_type', 'WalkList') == $this->_surveyDetails['activity_type_id']) {
$walkListActivityId = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'WalkList');
if ($walkListActivityId == $this->_surveyDetails['activity_type_id']) {
$defaults['order_bys']
= array(
1 => array(
Expand Down Expand Up @@ -480,7 +481,7 @@ public static function registerInterview($params) {

static $statusId;
if (!$statusId) {
$statusId = array_search('Completed', CRM_Core_PseudoConstant::activityStatus('name'));
$statusId = CRM_Core_PseudoConstant::getKey('CRM_Activity_DAO_Activity', 'activity_status_id', 'Completed');
}

//format custom fields.
Expand Down Expand Up @@ -580,11 +581,7 @@ public function getVoterIds() {
$this->_contactIds = $this->get('contactIds');
if (!is_array($this->_contactIds)) {
//get the survey activities.
$activityStatus = CRM_Core_PseudoConstant::activityStatus('name');
$statusIds = array();
if ($statusId = array_search('Scheduled', $activityStatus)) {
$statusIds[] = $statusId;
}
$statusIds[] = CRM_Core_PseudoConstant::getKey('CRM_Activity_DAO_Activity', 'activity_status_id', 'Scheduled');
$surveyActivities = CRM_Campaign_BAO_Survey::getSurveyVoterInfo($this->_surveyId,
$this->_interviewerId,
$statusIds
Expand Down
1 change: 1 addition & 0 deletions CRM/Contribute/Form/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ public function preProcess() {
if (!empty($this->_id)) {
$this->assignPaymentInfoBlock();
$this->assign('contribID', $this->_id);
$this->assign('isUsePaymentBlock', TRUE);
}

$this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
Expand Down
14 changes: 7 additions & 7 deletions CRM/Contribute/Form/Task/PDFLetterCommon.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,17 @@ public static function isValidHTMLWithTableSeparator($tokens, $html) {
* Check that the token only appears in a table cell. The '</td><td>' separator cannot otherwise work
* Calculate the number of times it appears IN the cell & the number of times it appears - should be the same!
*
* @param $token
* @param $entity
* @param $textToSearch
* @param string $token
* @param string $entity
* @param string $textToSearch
*
* @return bool
*/
public static function isHtmlTokenInTableCell($token, $entity, $textToSearch) {
$tokenToMatch = $entity . '.' . $token;
$dontCare = array();
$within = preg_match_all("|<td.+?{" . $tokenToMatch . "}.+?</td|si", $textToSearch, $dontCare);
$total = preg_match_all("|{" . $tokenToMatch . "}|", $textToSearch, $dontCare);
$tokenToMatch = $entity . '\.' . $token;
$pattern = '|<td(?![\w-])((?!</td>).)*\{' . $tokenToMatch . '\}.*?</td>|si';
$within = preg_match_all($pattern, $textToSearch);
$total = preg_match_all("|{" . $tokenToMatch . "}|", $textToSearch);
return ($within == $total);
}

Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/BAO/CustomOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ static public function getOptionListSelector(&$params) {
$options[$dao->id]['is_default'] = '';
}
}

$options[$dao->id]['description'] = $dao->description;
$options[$dao->id]['class'] = $dao->id . ',' . $class;
$options[$dao->id]['is_active'] = empty($dao->is_active) ? ts('No') : ts('Yes');
$options[$dao->id]['links'] = CRM_Core_Action::formLink($links,
Expand Down
4 changes: 2 additions & 2 deletions CRM/Core/OptionGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public static function lookupValues(&$params, $names, $flip = FALSE) {
* @return null
*/
public static function getLabel($groupName, $value, $onlyActiveValue = TRUE) {
Civi::log()->warning('Deprecated function, use CRM_Core_PseudoConstant::getLabel', array('civi.tag' => 'deprecated'));
Civi::log()->warning('Deprecated function CRM_Core_OptionGroup::getLabel, use CRM_Core_PseudoConstant::getLabel', array('civi.tag' => 'deprecated'));
if (empty($groupName) ||
empty($value)
) {
Expand Down Expand Up @@ -396,7 +396,7 @@ public static function getValue(
return NULL;
}

Civi::log()->warning('Deprecated function, use CRM_Core_PseudoConstant::getKey', array('civi.tag' => 'deprecated'));
Civi::log()->warning('Deprecated function CRM_Core_OptionGroup::getValue, use CRM_Core_PseudoConstant::getKey', array('civi.tag' => 'deprecated'));

$query = "
SELECT v.label as label ,v.{$valueField} as value
Expand Down
2 changes: 2 additions & 0 deletions CRM/Custom/Form/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ public function buildQuickForm() {

$this->add('text', 'value', ts('Option Value'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'value'), TRUE);

$this->add('textarea', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'description'));
// weight
$this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'weight'), TRUE);
$this->addRule('weight', ts('is a numeric field'), 'numeric');
Expand Down Expand Up @@ -406,6 +407,7 @@ public function postProcess() {
$customOption->label = $params['label'];
$customOption->name = CRM_Utils_String::titleToVar($params['label']);
$customOption->weight = $params['weight'];
$customOption->description = $params['description'];
$customOption->value = $params['value'];
$customOption->is_active = CRM_Utils_Array::value('is_active', $params, FALSE);

Expand Down
1 change: 1 addition & 0 deletions CRM/Custom/Page/AJAX.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public static function getOptionList() {
$selectorElements = array(
'label',
'value',
'description',
'is_default',
'is_active',
'links',
Expand Down
12 changes: 10 additions & 2 deletions CRM/Logging/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -703,12 +703,20 @@ private function createLogTableFor($table) {
// - prepend the name with log_
// - drop AUTO_INCREMENT columns
// - drop non-column rows of the query (keys, constraints, etc.)
// - set the ENGINE to the specified engine (default is archive)
// - set the ENGINE to the specified engine (default is archive or if archive is disabled or nor installed INNODB)
// - add log-specific columns (at the end of the table)
$mysqlEngines = [];
$engines = CRM_Core_DAO::executeQuery("SHOW ENGINES");
while ($engines->fetch()) {
if ($engines->Support == 'YES' || $engines->Support == 'DEFAULT') {
$mysqlEngines[] = $engines->Engine;
}
}
$logEngine = in_array('ARCHIVE', $mysqlEngines) ? 'ARCHIVE' : 'INNODB';
$query = preg_replace("/^CREATE TABLE `$table`/i", "CREATE TABLE `{$this->db}`.log_$table", $query);
$query = preg_replace("/ AUTO_INCREMENT/i", '', $query);
$query = preg_replace("/^ [^`].*$/m", '', $query);
$engine = strtoupper(CRM_Utils_Array::value('engine', $this->logTableSpec[$table], 'ARCHIVE'));
$engine = strtoupper(CRM_Utils_Array::value('engine', $this->logTableSpec[$table], $logEngine));
$engine .= " " . CRM_Utils_Array::value('engine_config', $this->logTableSpec[$table]);
$query = preg_replace("/^\) ENGINE=[^ ]+ /im", ') ENGINE=' . $engine . ' ', $query);

Expand Down
2 changes: 1 addition & 1 deletion CRM/Report/Form/Contribute/Detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function __construct() {
'fields_defaults' => array('sort_name'),
'fields_excluded' => array('id'),
'fields_required' => array('id'),
'filters_defaults' => array('is_deleted' => FALSE),
'filters_defaults' => array('is_deleted' => 0),
'no_field_disambiguation' => TRUE,
)), array(
'civicrm_email' => array(
Expand Down
5 changes: 5 additions & 0 deletions CRM/Report/Form/Member/Detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ public function __construct() {
'title' => ts('Contact Name'),
'operator' => 'like',
),
'is_deleted' => array(
'title' => ts('Is Deleted'),
'default' => 0,
'type' => CRM_Utils_Type::T_BOOLEAN,
),
'id' => array('no_display' => TRUE),
),
'order_bys' => array(
Expand Down
16 changes: 16 additions & 0 deletions CRM/Upgrade/5.0.beta1.msg_template/civicrm_msg_template.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{php}
$dir = SMARTY_DIR . '/../../CRM/Upgrade/5.0.beta1.msg_template/message_templates';
$templates = array();
foreach (preg_grep('/\.tpl$/', scandir($dir)) as $filename) {
$parts = explode('_', basename($filename, '.tpl'));
$templates[] = array('type' => array_pop($parts), 'name' => implode('_', $parts), 'filename' => "$dir/$filename");
}
$this->assign('templates', $templates);
{/php}

{foreach from=$templates item=tpl}
{fetch assign=content file=$tpl.filename}
SELECT @workflow_id := MAX(id) FROM civicrm_option_value WHERE name = '{$tpl.name}';
SELECT @content := msg_{$tpl.type} FROM civicrm_msg_template WHERE workflow_id = @workflow_id AND is_reserved = 1 LIMIT 1;
UPDATE civicrm_msg_template SET msg_{$tpl.type} = '{$content|escape:"quotes"}' WHERE workflow_id = @workflow_id AND (is_reserved = 1 OR (is_default = 1 AND msg_{$tpl.type} = @content));
{/foreach}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{if $title}
{if $component}
{if $component == 'event'}
{ts 1=$title}Event Registration Invoice: %1{/ts}
{else}
{ts 1=$title}Contribution Invoice: %1{/ts}
{/if}
{/if}
{else}
{ts}Invoice{/ts}
{/if}
- {contact.display_name}
Loading

0 comments on commit da03cc4

Please sign in to comment.