-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resource File Import failing #481
Comments
If $proceed is false (or undefined, same thing) then a logic flaw results in this error message. See lines 569-595 (indents squashed for clarity): 569 // Let's insert data If $proceed is set, $resource->save() is called and $resource->resourceID() becomes defined, so the call to $resourceAcquisition->save() succeeds. But if $proceed is not set, $resource->save() is not called and $resource->resourceID() remains undefined; but $resourceAcquisition->save() is still called, and fails due to the (perfectly sensible) NOT NULL constraint on the resourceID column in the ResourceAcquisition table. My guess is that lines 591-595 need to be moved into the if-block, i.e., between lines 587 and 588. However, there may be more to this than I realize. |
Here's a patch that makes it so that all $foo->save() calls occur only when $proceed is true. |
Sorry, that was wrong; some $foo->save calls will occur whether $proceed is true or not: (1) New ResourceType, AcquisitionType, ResourceFormat, and GeneralSubject objects are saved; (2) Some parent resource stuff is saved -- I don't understand this code. |
There is indeed a problem.
Start an import, until the preview page ("n resources will be imported" messages) but do not import.
|
The File Import in the Resource module is failing with the following error:
[Mon Sep 10 09:08:47.778171 2018] [:error] [pid 1540] PHP Fatal error: Uncaught exception 'Exception' with message 'There was a problem with the database: Field 'resourceID' doesn't have a default value' in /var/www/html/coral3/resources/admin/classes/common/DBService.php:52
Stack trace:
#0 /var/www/html/coral3/resources/admin/classes/common/DBService.php(91): DBService->checkForError()
1 /var/www/html/coral3/resources/admin/classes/common/DatabaseObject.php(245): DBService->processQuery('INSERT INTO `Re...')
2 /var/www/html/coral3/resources/import.php(595): DatabaseObject->save()
3 {main}
thrown in /var/www/html/coral3/resources/admin/classes/common/DBService.php on line 52, referer: /coral3/resources/import.php
I traced it back to line 575, "if (isset($proceed)) {" which was added in merge #244
If I set $proceed to true before this line, the import works as expected.
The text was updated successfully, but these errors were encountered: