Skip to content
Snippets Groups Projects
Commit 1705e56b authored by Pradeep Nayak's avatar Pradeep Nayak
Browse files

-- CRM-13968, added upgrade code to handle errorneous data with incorrect values

for to_financial_account_id and status_id

----------------------------------------
* CRM-13968: Contributions with "In Progress" status can't be edited and saved
  http://issues.civicrm.org/jira/browse/CRM-13968
parent b81ee58c
No related branches found
No related tags found
No related merge requests found
......@@ -5,3 +5,21 @@ ALTER TABLE civicrm_report_instance MODIFY grouprole varchar(1024) COLLATE utf8_
{* CRM-14117 *}
UPDATE civicrm_navigation SET url = 'http://civicrm.org/what/whatiscivicrm' WHERE name = 'About';
-- CRM-13968
SELECT @inprogressstatus := value FROM civicrm_option_value cov
LEFT JOIN civicrm_option_group cg ON cov.option_group_id = cg.id
WHERE cg.name = 'contribution_status' AND cov.name = 'In Progress';
SELECT @financialstatus := value FROM civicrm_option_value cov
LEFT JOIN civicrm_option_group cg ON cov.option_group_id = cg.id
WHERE cg.name = 'financial_item_status' AND cov.name = 'Unpaid';
SELECT @accountrecievable := id FROM `civicrm_financial_account` WHERE `name` LIKE 'Accounts Receivable';
UPDATE civicrm_financial_trxn cft
LEFT JOIN civicrm_entity_financial_trxn ceft ON ceft.financial_trxn_id = cft.id
LEFT JOIN civicrm_entity_financial_trxn ceft_financial_item ON ceft_financial_item.financial_trxn_id = cft.id
LEFT JOIN civicrm_financial_item cfi ON cfi.id = ceft_financial_item.entity_id
SET to_financial_account_id = @accountrecievable, cfi.status_id = @financialstatus
WHERE ceft.entity_table = 'civicrm_contribution' AND ceft_financial_item.entity_table = 'civicrm_financial_item' AND cft.status_id = @inprogressstatus AND cfi.status_id IS NULL;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment