Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.3.4
-
Fix Version/s: 4.3.6
-
Component/s: Accounting Integration
-
Labels:None
Description
If you don't have a default "Cost of Sales" and "Expenses" account, the incremental upgrade will fail with a constraint violation:
nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`civicrm`.`civicrm_entity_financial_account`, CONSTRAINT `FK_civicrm_entity_financial_account_financial_account_id` FOREIGN KEY (`financial_account_id`) REFERENCES `civicrm_financial_account` )
The reason is, that in this case 4.3.4.mysql.tpl#L76 (and 4.3.4.mysql.tpl#L88 respectively) don't return a valid financialAccountId.
To reproduce this issue, it should be enough to remove all default accounts on pre 3.4.4 and then try an upgrade.
Issue observed while upgrading from 4.3.1 to 4.3.5.