Skip to content

Commit

Permalink
additional fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
monishdeb committed Jun 23, 2017
1 parent 916c863 commit b079c0c
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CRM/Contribute/DAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*
* Generated from xml/schema/CRM/Contribute/Contribution.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:ef92bd39734f5967f59e4cdb08fc0ba8)
* (GenCodeChecksum:45a20d00d01766a61687cbac5cef1482)
*/
require_once 'CRM/Core/DAO.php';
require_once 'CRM/Utils/Type.php';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{php}
$dir = SMARTY_DIR . '/../../CRM/Upgrade/4.7.21.msg_template/message_templates';
$dir = SMARTY_DIR . '/../../CRM/Upgrade/4.7.22.msg_template/message_templates';
$templates = array();
foreach (preg_grep('/\.tpl$/', scandir($dir)) as $filename) {
$parts = explode('_', basename($filename, '.tpl'));
Expand Down
4 changes: 2 additions & 2 deletions CRM/Upgrade/Incremental/php/FourSeven.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
$postUpgradeMessage .= '<p>civicrm_sms_provider ' . ts('has now had a domain id column added. As there is more than 1 domains in this install you need to manually set the domain id for the providers in this install') . '</p>';
}
}
if ($rev == '4.7.21') {
if ($rev == '4.7.22') {
$postUpgradeMessage .= '<br /><br />' . ts('Default version of the following System Workflow Message Templates have been modified: <ul><li>Contribution Invoice</li></ul> If you have modified these templates, please review the new default versions and implement updates as needed to your copies (Administer > Communications > Message Templates > System Workflow Messages).');
}
}
Expand Down Expand Up @@ -368,7 +368,7 @@ public function upgrade_4_7_20($rev) {
*
* @param string $rev
*/
public function upgrade_4_7_21($rev) {
public function upgrade_4_7_22($rev) {
$this->addTask('CRM-20387 - Add invoice_number column to civicrm_contribution', 'addColumn',
'civicrm_contribution', 'invoice_number', "varchar(255) COMMENT 'Human readable invoice number' DEFAULT NULL");
$this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev);
Expand Down
5 changes: 0 additions & 5 deletions CRM/Upgrade/Incremental/sql/4.7.21.mysql.tpl
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{* file to handle db changes in 4.7.21 during upgrade *}

{include file='../CRM/Upgrade/4.7.21.msg_template/civicrm_msg_template.tpl'}

-- CRM-20387
UPDATE `civicrm_contribution` SET `invoice_number` = `invoice_id` WHERE `invoice_id` LIKE CONCAT('%', `id`);

-- CRM-20606 (spelling mistake in Austrian provinces)
UPDATE civicrm_state_province
SET name = 'Niederösterreich'
Expand Down
5 changes: 5 additions & 0 deletions CRM/Upgrade/Incremental/sql/4.7.22.mysql.tpl
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
{* file to handle db changes in 4.7.22 during upgrade *}

{include file='../CRM/Upgrade/4.7.22.msg_template/civicrm_msg_template.tpl'}

-- CRM-20387
UPDATE `civicrm_contribution` SET `invoice_number` = `invoice_id` WHERE `invoice_id` LIKE CONCAT('%', `id`);
9 changes: 9 additions & 0 deletions tests/phpunit/api/v3/ContributionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,14 @@ public function testGetContributionReturnFunctionality() {
$params['campaign_id'] = $this->campaignCreate();

$contributionID = $this->contributionCreate($params);

// update contribution with invoice number
$params = array_merge($params, array(
'id' => $contributionID,
'invoice_number' => CRM_Utils_Array::value('invoice_prefix', Civi::settings()->get('contribution_invoice_settings')) . "" . $contributionID,
));
$contributionID = $this->contributionCreate($params);

$contribution = $this->callAPISuccessGetSingle('Contribution', array('id' => $contributionID));
$this->assertEquals('bouncer', $contribution['check_number']);
$this->assertEquals('bouncer', $contribution['contribution_check_number']);
Expand All @@ -272,6 +280,7 @@ public function testGetContributionReturnFunctionality() {
foreach ($fields as $fieldName => $fieldSpec) {
$contribution = $this->callAPISuccessGetSingle('Contribution', array('id' => $contributionID, 'return' => $fieldName));
$returnField = $fieldName;
//CRM_Core_Error::debug_var('contri', $contribution);
if ($returnField == 'contribution_contact_id') {
$returnField = 'contact_id';
}
Expand Down

0 comments on commit b079c0c

Please sign in to comment.