vanderbilt-redcap / auto-record-generation

Module that allows for a new record to be generated in another project (or the same project) on a flagging field being saved. Allows for data fields to be transferred to the new record as well.
MIT License
4 stars 3 forks source link

Error in External Module #8

Closed jmkurka83 closed 5 years ago

jmkurka83 commented 5 years ago

Hello, I also cannot get this module to work. Below is an email notification with information on the error. Please let me know if you need more information to help fix the bug. Thank you!

The 'vanderbilt_auto_record_generation' module threw the following exception when calling the hook method 'redcap_save_record': Exception: Error running External Module query: DB Error: Unknown column 'd.project_id' in 'where clause' SQL: DELETE FROM redcap_data WHERE d.project_id = 16 AND d.record = '19' AND d.field_name = 'record_id' LIMIT 1 in C:\redcap\redcap_v8.11.4\ExternalModules\classes\ExternalModules.php:1245 Stack trace:

0 C:\redcap\redcap_v8.11.4\ExternalModules\classes\AbstractExternalModule.php(868): ExternalModules\ExternalModules::query('DELETE FROM red...')

1 C:\redcap\modules\vanderbilt_auto_record_generation_v1.2\AutoRecordGenerationExternalModule.php(161): ExternalModules\AbstractExternalModule->query('DELETE FROM red...')

2 C:\redcap\modules\vanderbilt_auto_record_generation_v1.2\AutoRecordGenerationExternalModule.php(57): Vanderbilt\AutoRecordGenerationExternalModule\AutoRecordGenerationExternalModule->getAutoId('16', '63')

3 [internal function]: Vanderbilt\AutoRecordGenerationExternalModule\AutoRecordGenerationExternalModule->redcap_save_record('16', '84', 'redcap_user_acc...', '63', NULL, 'WJ8WFL37ET', '5971', 1)

4 C:\redcap\redcap_v8.11.4\ExternalModules\classes\ExternalModules.php(1351): call_user_func_array(Array, Array)

5 C:\redcap\redcap_v8.11.4\ExternalModules\classes\ExternalModules.php(1439): ExternalModules\ExternalModules::startHook('vanderbilt_auto...', 'v1.2', Array)

6 C:\redcap\redcap_v8.11.4\Classes\Hooks.php(37): ExternalModules\ExternalModules::callHook('save_record', Array)

7 C:\redcap\redcap_v8.11.4\Surveys\index.php(1302): Hooks::call('redcap_save_rec...', Array)

8 C:\redcap\surveys\index.php(11): include('C:\redcap\redca...')

9 {main}

moorejr5 commented 5 years ago

Thanks for reporting this error report. The new 1.5 release for this should contain fixes that will solve this issue. Let us know if you continue to have issues with this update.

jmkurka83 commented 5 years ago

Hi Ryan, I updated, but am now getting this error.

The 'hook_save_record' hook did not complete for the 'vanderbilt_auto_record_generation' module because of the following error:

Error Message: Uncaught Error: Call to a member function getSubSettings() on null in C:\redcap\modules\vanderbilt_auto_record_generation_v1.5\AutoRecordGenerationExternalModule.php:22 Stack trace:

0 C:\redcap\modules\vanderbilt_auto_record_generation_v1.5\AutoRecordGenerationExternalModule.php(18): Vanderbilt\AutoRecordGenerationExternalModule\AutoRecordGenerationExternalModule->copyValuesToDestinationProjects(87, '63')

1 [internal function]: Vanderbilt\AutoRecordGenerationExternalModule\AutoRecordGenerationExternalModule->redcap_save_record('16', 87, 'redcap_user_acc...', '63', NULL, 'WJ8WFL37ET', 6141, 1)

2 C:\redcap\redcap_v8.11.4\ExternalModules\classes\ExternalModules.php(1351): call_user_func_array(Array, Array)

3 C:\redcap\redcap_v8.11.4\ExternalModules\classes\ExternalModules.php(1439): ExternalModules\ExternalModules::startHook('vanderbilt_auto...', 'v1.5', Array)

4 C:\redcap\redcap_v8.11.4\Classes\Hooks.php(37): ExternalModules\ExternalModules::callHook('save_record', Array)

5 C:\redcap\redcap_v8.11.4\Survey

File: C:\redcap\modules\vanderbilt_auto_record_generation_v1.5\AutoRecordGenerationExternalModule.php Line: 22

mmcev106 commented 5 years ago

I apologize, I believe this is my fault for not including an appropriate REDCap minimum version. If you can upgrade to the latest REDCap version now, I would recommend that. If not, you can downgrade the module but it will likely corrupt all project settings. Make sure to backup your REDCap database first, or at least the redcap_external_module_settings table. I have removed v1.5 from the repo to make sure this doesn't happen to anyone else, and am working on a new release with the appropriate min version.

mmcev106 commented 5 years ago

Man, I'm afraid you may have to wait until this Friday's release of 9.0.2 for v1.5 to actually work. If you need this module to work in the meantime, I think the following might be your only options:

I'm sorry... This was a bad oversight on my part. I'm not sure I will have any better options for you, but please ask if you have any questions.

mmcev106 commented 5 years ago

I have released v1.6 with a minimum REDCap version of 9.0.3, which I believe should address this. I'll close this issue, but feel free to reopen it if you encounter further issues.