Details
Description
"Pay later" event registration is not possible with "Pending from pay later" status class changed to class "Positive".
Consider the following case:
- Paid event
- No payment provider active, "pay later" option enabled
- "Pending from pay later" participant status class is changed from "Pending" (default) to "Positive" in civicrm/admin/participant_status?reset=1
Effect:
Database failure when registering a new participant, registration impossible. Obviously, status_id is 0 when creating new participant, but there is no such thing as a 0 status.
Can be reproduced on local and demo site.
Platform: Wordpress
Result after confirming registration:
Sorry but we are not able to provide this at the moment.
DB Error: constraint violation
Error Details
Additional Details:
Array
(
[callback] => Array
(
[0] => CRM_Core_Error
[1] => handle
)
[code] => -3
[message] => DB Error: constraint violation
[mode] => 16
[debug_info] => INSERT INTO civicrm_participant (contact_id , event_id , status_id , role_id , register_date , source , fee_level , is_test , is_pay_later , fee_amount , discount_id , fee_currency ) VALUES ( 10 , 2 , 0 , '1' , 20161205220741 , 'Online Event Registration: Akro 3' , 'Fee - 1' , 0 , 1 , 10.00 , NULL , 'USD' ) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`civicrm120301`.`civicrm_participant`, CONSTRAINT `FK_civicrm_participant_status_id` FOREIGN KEY (`status_id`) REFERENCES `civicrm_participant_status_type` (`id`))]
[type] => DB_Error
[user_info] => INSERT INTO civicrm_participant (contact_id , event_id , status_id , role_id , register_date , source , fee_level , is_test , is_pay_later , fee_amount , discount_id , fee_currency ) VALUES ( 10 , 2 , 0 , '1' , 20161205220741 , 'Online Event Registration: Akro 3' , 'Fee - 1' , 0 , 1 , 10.00 , NULL , 'USD' ) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`civicrm120301`.`civicrm_participant`, CONSTRAINT `FK_civicrm_participant_status_id` FOREIGN KEY (`status_id`) REFERENCES `civicrm_participant_status_type` (`id`))]
[to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_participant (contact_id , event_id , status_id , role_id , register_date , source , fee_level , is_test , is_pay_later , fee_amount , discount_id , fee_currency ) VALUES ( 10 , 2 , 0 , '1' , 20161205220741 , 'Online Event Registration: Akro 3' , 'Fee - 1' , 0 , 1 , 10.00 , NULL , 'USD' ) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`civicrm120301`.`civicrm_participant`, CONSTRAINT `FK_civicrm_participant_status_id` FOREIGN KEY (`status_id`) REFERENCES `civicrm_participant_status_type` (`id`))]"]
)
Backtrace:
#0 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(187): CRM_Core_Error::backtrace()
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(921): call_user_func((Array:2), Object(DB_Error))
#3 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/packages/DB.php(985): PEAR_Error->__construct("DB Error: constraint violation", -3, 16, (Array:2), "INSERT INTO civicrm_participant (contact_id , event_id , status_id , role_id ...")
#4 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(575): DB_Error->__construct(-3, 16, (Array:2), "INSERT INTO civicrm_participant (contact_id , event_id , status_id , role_id ...")
#5 [internal function](): PEAR->_raiseError(Object(DB_mysqli), NULL, -3, NULL, NULL, "INSERT INTO civicrm_participant (contact_id , event_id , status_id , role_id ...", "DB_Error", TRUE)
#6 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/packages/PEAR.php(224): call_user_func_array((Array:2), (Array:8))
#7 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1905): PEAR->__call("raiseError", (Array:7))
#8 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -3, NULL, NULL, "INSERT INTO civicrm_participant (contact_id , event_id , status_id , role_id ...", "DB_Error", TRUE)
#9 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/packages/DB/mysqli.php(933): DB_common->raiseError(-3, NULL, NULL, NULL, "1452 ** Cannot add or update a child row: a foreign key constraint fails (`ci...")
#10 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/packages/DB/mysqli.php(403): DB_mysqli->mysqliRaiseError()
#11 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/packages/DB/common.php(1216): DB_mysqli->simpleQuery("INSERT INTO civicrm_participant (contact_id , event_id , status_id , role_id ...")
#12 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(2438): DB_common->query("INSERT INTO civicrm_participant (contact_id , event_id , status_id , role_id ...")
#13 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(1060): DB_DataObject->_query("INSERT INTO civicrm_participant (contact_id , event_id , status_id , role_id ...")
#14 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(482): DB_DataObject->insert()
#15 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/CRM/Event/BAO/Participant.php(137): CRM_Core_DAO->save()
#16 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/CRM/Event/BAO/Participant.php(199): CRM_Event_BAO_Participant::add((Array:15))
#17 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/CRM/Event/Form/Registration.php(903): CRM_Event_BAO_Participant::create((Array:15))
#18 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/CRM/Event/Form/Registration.php(723): CRM_Event_Form_Registration::addParticipant(Object(CRM_Event_Form_Registration_Confirm), "10")
#19 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/CRM/Event/Form/Registration/Confirm.php(667): CRM_Event_Form_Registration->confirmPostProcess("10", Object(CRM_Contribute_BAO_Contribution), NULL)
#20 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(431): CRM_Event_Form_Registration_Confirm->postProcess()
#21 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/CRM/Core/StateMachine.php(160): CRM_Core_Form->mainProcess()
#22 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Next.php(61): CRM_Core_StateMachine->perform(Object(CRM_Event_Form_Registration_Confirm), "next", "Next")
#23 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Next->perform(Object(CRM_Event_Form_Registration_Confirm), "next")
#24 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Event_Form_Registration_Confirm), "next")
#25 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("next")
#26 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(312): CRM_Core_Controller->run((Array:3), NULL)
#27 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:15))
#28 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:3))
#29 /var/www/html/akro2016/wp-content/plugins/civicrm/civicrm.php(1227): CRM_Core_Invoke::invoke((Array:3))
#30 [internal function](): CiviCRM_For_WordPress->invoke("")
#31 /var/www/html/akro2016/wp-includes/plugin.php(524): call_user_func_array((Array:2), (Array:1))
#32 /var/www/html/akro2016/wp-admin/admin.php(222): do_action("toplevel_page_CiviCRM")
#33 {main}