Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Blocker
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.5
-
Fix Version/s: 4.5
-
Component/s: CiviContribute, CiviMember
-
Labels:None
Description
Any attempt to renew a membership via front-end online contribution page results in a fatal error:
Database Error Code: Duplicate entry 'civicrm_membership-34-35-16' for key 'UI_line_item_value', 1062
Back-end renewals have the same issue (as long as both the signup and renewal are done via back-office (and hence the same quick config price field is used).
I don't see how we can retain the current UI_line_item_value unique index, since I think any membership renewal will break that rule. That index contains:
entity_table
entity_id
price_field_value_id
price_field_id
.... and for a membership renewal all those values will be the same.
I tested both flows with that index dropped, and that 'fixes' the problem. However I'm not sure if that's the correct fix ???
===== Full backtrace and error from front-end renewal ================
#0 /Users/dgg/git/crm_v4.5/CRM/Core/Error.php(191): CRM_Core_Error::backtrace()
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /Users/dgg/git/crm_v4.5/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 /Users/dgg/git/crm_v4.5/packages/DB.php(975): PEAR_Error->PEAR_Error("DB Error: already exists", -5, 16, (Array:2), "UPDATE civicrm_line_item li\n LEFT JOIN civicrm_price_field_value pv ON ...")
#4 /Users/dgg/git/crm_v4.5/packages/PEAR.php(564): DB_Error->DB_Error(-5, 16, (Array:2), "UPDATE civicrm_line_item li\n LEFT JOIN civicrm_price_field_value pv ON ...")
#5 /Users/dgg/git/crm_v4.5/packages/DB/common.php(1905): PEAR->raiseError(NULL, -5, NULL, NULL, "UPDATE civicrm_line_item li\n LEFT JOIN civicrm_price_field_value pv ON ...", "DB_Error", TRUE)
#6 /Users/dgg/git/crm_v4.5/packages/DB/mysql.php(899): DB_common->raiseError(-5, NULL, NULL, NULL, "1062 ** Duplicate entry 'civicrm_membership-34-35-16' for key 'UI_line_item_v...")
#7 /Users/dgg/git/crm_v4.5/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError()
#8 /Users/dgg/git/crm_v4.5/packages/DB/common.php(1216): DB_mysql->simpleQuery("UPDATE civicrm_line_item li\n LEFT JOIN civicrm_price_field_value pv ON ...")
#9 /Users/dgg/git/crm_v4.5/packages/DB/DataObject.php(2429): DB_common->query("UPDATE civicrm_line_item li\n LEFT JOIN civicrm_price_field_value pv ON ...")
#10 /Users/dgg/git/crm_v4.5/packages/DB/DataObject.php(1621): DB_DataObject->_query("UPDATE civicrm_line_item li\n LEFT JOIN civicrm_price_field_value pv ON ...")
#11 /Users/dgg/git/crm_v4.5/CRM/Core/DAO.php(169): DB_DataObject->query("UPDATE civicrm_line_item li\n LEFT JOIN civicrm_price_field_value pv ON ...")
#12 /Users/dgg/git/crm_v4.5/CRM/Core/DAO.php(960): CRM_Core_DAO->query("UPDATE civicrm_line_item li\n LEFT JOIN civicrm_price_field_value pv ON ...", TRUE)
#13 /Users/dgg/git/crm_v4.5/CRM/Member/BAO/MembershipPayment.php(77): CRM_Core_DAO::executeQuery("UPDATE civicrm_line_item li\n LEFT JOIN civicrm_price_field_value pv ON ...", (Array:3))
#14 /Users/dgg/git/crm_v4.5/CRM/Member/BAO/Membership.php(2174): CRM_Member_BAO_MembershipPayment::create((Array:2))
#15 /Users/dgg/git/crm_v4.5/CRM/Member/BAO/Membership.php(2204): CRM_Member_BAO_Membership::linkMembershipPayment(Object(CRM_Member_DAO_Membership), Object(CRM_Contribute_BAO_Contribution))
#16 /Users/dgg/git/crm_v4.5/CRM/Member/BAO/Membership.php(1315): CRM_Member_BAO_Membership::createOrRenewMembership((Array:53), "202", (Array:0), NULL, "1", FALSE, 1, Object(CRM_Contribute_BAO_Contribution), Object(CRM_Contribute_Form_Contribution_Confirm))
#17 /Users/dgg/git/crm_v4.5/CRM/Contribute/Form/Contribution/Confirm.php(1728): CRM_Member_BAO_Membership::postProcessMembership((Array:48), "202", Object(CRM_Contribute_Form_Contribution_Confirm), (Array:37), (Array:0), (Array:0), (Array:3), (Array:1), TRUE, NULL, FALSE, NULL)
#18 /Users/dgg/git/crm_v4.5/CRM/Contribute/Form/Contribution/Confirm.php(971): CRM_Contribute_Form_Contribution_Confirm->processMembership((Array:48), "202", (Array:0), (Array:0), (Array:37))
#19 /Users/dgg/git/crm_v4.5/CRM/Core/Form.php(303): CRM_Contribute_Form_Contribution_Confirm->postProcess()
#20 /Users/dgg/git/crm_v4.5/CRM/Core/StateMachine.php(162): CRM_Core_Form->mainProcess()
#21 /Users/dgg/git/crm_v4.5/CRM/Core/QuickForm/Action/Next.php(60): CRM_Core_StateMachine->perform(Object(CRM_Contribute_Form_Contribution_Confirm), "next", "Next")
#22 /Users/dgg/git/crm_v4.5/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Contribute_Form_Contribution_Confirm), "next")
#23 /Users/dgg/git/crm_v4.5/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contribute_Form_Contribution_Confirm), "next")
#24 /Users/dgg/git/crm_v4.5/CRM/Core/Controller.php(356): HTML_QuickForm_Page->handle("next")
#25 /Users/dgg/git/crm_v4.5/CRM/Core/Invoke.php(331): CRM_Core_Controller->run((Array:3), NULL)
#26 /Users/dgg/git/crm_v4.5/CRM/Core/Invoke.php(75): CRM_Core_Invoke::runItem((Array:15))
#27 /Users/dgg/git/crm_v4.5/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
#28 /Users/dgg/git/crm_v4.5/drupal/civicrm.module(456): CRM_Core_Invoke::invoke((Array:3))
#29 [internal function](): civicrm_invoke("contribute", "transact")
#30 /Users/dgg/htdocs/drupal7/includes/menu.inc(517): call_user_func_array("civicrm_invoke", (Array:2))
#31 /Users/dgg/htdocs/drupal7/index.php(21): menu_execute_active_handler()
#32
--------
Database Error Code: Duplicate entry 'civicrm_membership-34-35-16' for key 'UI_line_item_value', 1062
Additional Details:
Array
(
[callback] => Array
(
[0] => CRM_Core_Error
[1] => handle
)
[code] => -5
[message] => DB Error: already exists
[mode] => 16
[debug_info] => UPDATE civicrm_line_item li
LEFT JOIN civicrm_price_field_value pv ON pv.id = li.price_field_value_id
SET entity_table = 'civicrm_membership', entity_id = 34
WHERE pv.membership_type_id = 1
AND entity_table = 'civicrm_contribution' AND entity_id = contribution_id
AND contribution_id = 107 [nativecode=1062 ** Duplicate entry 'civicrm_membership-34-35-16' for key 'UI_line_item_value']
[type] => DB_Error
[user_info] => UPDATE civicrm_line_item li
LEFT JOIN civicrm_price_field_value pv ON pv.id = li.price_field_value_id
SET entity_table = 'civicrm_membership', entity_id = 34
WHERE pv.membership_type_id = 1
AND entity_table = 'civicrm_contribution' AND entity_id = contribution_id
AND contribution_id = 107 [nativecode=1062 ** Duplicate entry 'civicrm_membership-34-35-16' for key 'UI_line_item_value']
[to_string] => [db_error: message="DB Error: already exists" code=-5 mode=callback callback=CRM_Core_Error::handle prefix="" info="UPDATE civicrm_line_item li
LEFT JOIN civicrm_price_field_value pv ON pv.id = li.price_field_value_id
SET entity_table = 'civicrm_membership', entity_id = 34
WHERE pv.membership_type_id = 1
AND entity_table = 'civicrm_contribution' AND entity_id = contribution_id
AND contribution_id = 107 [nativecode=1062 ** Duplicate entry 'civicrm_membership-34-35-16' for key 'UI_line_item_value']"]
)
Attachments
Issue Links
- provides patch for
-
CRM-14197 Refactor to remove requirement for civicrm_membership_payment and civicrm_participant_payment
- Done/Fixed