Skip to content

Commit

Permalink
Merge pull request #15237 from civicrm/5.18
Browse files Browse the repository at this point in the history
5.18
  • Loading branch information
eileenmcnaughton authored Sep 7, 2019
2 parents 5e33479 + a2106c8 commit 8d6badf
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 8 deletions.
15 changes: 10 additions & 5 deletions CRM/Campaign/Form/Campaign.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public function setDefaultValues() {
}

public function buildQuickForm() {
$this->add('hidden', 'id', $this->_campaignId);
if ($this->_action & CRM_Core_Action::DELETE) {

$this->addButtons([
Expand All @@ -186,7 +187,6 @@ public function buildQuickForm() {
//lets assign custom data type and subtype.
$this->assign('customDataType', 'Campaign');
$this->assign('entityID', $this->_campaignId);
$this->assign('id', $this->_campaignId);
$this->assign('customDataSubType', CRM_Utils_Array::value('campaign_type_id', $this->_values));

$attributes = CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Campaign');
Expand Down Expand Up @@ -292,14 +292,18 @@ public function postProcess() {

$session = CRM_Core_Session::singleton();
$params = $this->controller->exportValues($this->_name);
if (isset($this->_campaignId)) {
// To properly save the DAO we need to ensure we don't have a blank id key passed through.
if (empty($params['id'])) {
unset($params['id']);
}
if (!empty($params['id'])) {
if ($this->_action & CRM_Core_Action::DELETE) {
CRM_Campaign_BAO_Campaign::del($this->_campaignId);
CRM_Campaign_BAO_Campaign::del($params['id']);
CRM_Core_Session::setStatus(ts('Campaign has been deleted.'), ts('Record Deleted'), 'success');
$session->replaceUserContext(CRM_Utils_System::url('civicrm/campaign', 'reset=1&subPage=campaign'));
return;
}
$params['id'] = $this->_campaignId;
$this->_campaignId = $params['id'];
}
else {
$params['created_id'] = $session->get('userID');
Expand Down Expand Up @@ -328,7 +332,7 @@ public function postProcess() {

public static function submit($params = [], $form) {
$groups = [];
if (is_array($params['includeGroups'])) {
if (!empty($params['includeGroups']) && is_array($params['includeGroups'])) {
foreach ($params['includeGroups'] as $key => $id) {
if ($id) {
$groups['include'][] = $id;
Expand All @@ -355,6 +359,7 @@ public static function submit($params = [], $form) {
$form->_campaignId,
'Campaign'
);

// dev/core#1067 Clean Money before passing onto BAO to do the create.
$params['goal_revenue'] = CRM_Utils_Rule::cleanMoney($params['goal_revenue']);
$result = civicrm_api3('Campaign', 'create', $params);
Expand Down
5 changes: 5 additions & 0 deletions CRM/Grant/Form/Grant.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ public function setDefaultValues() {
$defaults['amount_granted'] = CRM_Utils_Money::format($defaults['amount_granted'], NULL, '%a');
}
}
else {
if ($this->_contactID) {
$defaults['contact_id'] = $this->_contactID;
}
}

return $defaults;
}
Expand Down
4 changes: 2 additions & 2 deletions CRM/Import/ImportProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ public function getContactSubType(): string {
*
* @param string $contactSubType
*/
public function setContactSubType(string $contactSubType) {
$this->contactSubType = $contactSubType;
public function setContactSubType($contactSubType) {
$this->contactSubType = (string) $contactSubType;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions CRM/Utils/API/HTMLInputCoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ public function getSkipFields() {
'operator',
// CRM-20468
'content',
// CiviCampaign Goal Details
'goal_general',
];
$custom = CRM_Core_DAO::executeQuery('SELECT id FROM civicrm_custom_field WHERE html_type = "RichTextEditor"');
while ($custom->fetch()) {
Expand Down
1 change: 0 additions & 1 deletion tests/phpunit/CRM/Campaign/Form/CampaignTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public function testSubmit($thousandSeparator) {
'custom' => [],
'campaign_type_id' => 1,
], $form);
var_dump($form);
$campaign = $this->callAPISuccess('campaign', 'get', ['id' => $result['id']]);
$this->assertEquals('10000', $campaign['values'][$campaign['id']]['goal_revenue']);
}
Expand Down
9 changes: 9 additions & 0 deletions tests/phpunit/api/v3/SyntaxConformanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,15 @@ public static function toBeSkipped_getSqlOperators() {
//a bit of a pseudoapi - keys by domain
'Setting',
];

// The testSqlOperators fails sporadically on MySQL 5.5, which is deprecated anyway.
// Test data providers should be able to run in pre-boot environment, so we connect directly to SQL server.
require_once 'DB.php';
$db = DB::connect(CIVICRM_DSN);
if ($db->connection instanceof mysqli && $db->connection->server_version < 50600) {
$entitiesWithout[] = 'Dedupe';
}

return $entitiesWithout;
}

Expand Down

0 comments on commit 8d6badf

Please sign in to comment.