These default biblio_ids of 0 are harmless but incorrect. The default values should be removed.
Created attachment 147232 [details] [review] Bug 33053: Remove default value for tables item_groups and recalls These default biblio_ids of 0 are harmless but incorrect. The default values should be removed. Test Plan: 1) Apply this patch 2) prove t/db_dependent/Koha/Biblio.t 3) prove t/db_dependent/Koha/Recalls.t
Created attachment 149075 [details] [review] Bug 33053: Remove default value for tables item_groups and recalls These default biblio_ids of 0 are harmless but incorrect. The default values should be removed. Test Plan: 1) Apply this patch 2) prove t/db_dependent/Koha/Biblio.t 3) prove t/db_dependent/Koha/Recalls.t Signed-off-by: David Nind <david@davidnind.com>
Created attachment 150355 [details] [review] Bug 33053: Remove default value for tables item_groups and recalls These default biblio_ids of 0 are harmless but incorrect. The default values should be removed. Test Plan: 1) Apply this patch 2) prove t/db_dependent/Koha/Biblio.t 3) prove t/db_dependent/Koha/Recalls.t Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Created attachment 150356 [details] [review] Bug 33053: (QA follow-up) fix syntax error Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Pushed to master for 23.05. Nice work everyone, thanks!
This patchset highlighted an issue, see: I commented like this: $ git diff diff --git a/t/db_dependent/api/v1/item_groups.t b/t/db_dependent/api/v1/item_groups.t index 3506eae582d..8a823d121ec 100755 --- a/t/db_dependent/api/v1/item_groups.t +++ b/t/db_dependent/api/v1/item_groups.t @@ -112,11 +112,11 @@ subtest 'add() tests' => sub { # Invalid biblio id { # hide useless warnings - local *STDERR; - open STDERR, '>', '/dev/null'; + #local *STDERR; + #open STDERR, '>', '/dev/null'; $t->post_ok( "//$auth_userid:$password@/api/v1/biblios/XXX/item_groups" => json => $item_group ) ->status_is( 404 ); - close STDERR; + #close STDERR; } $schema->storage->txn_rollback; And then: $ prove t/db_dependent/api/v1/item_groups.t t/db_dependent/api/v1/item_groups.t .. 1/5 DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Column 'biblio_id' cannot be null at /kohadevbox/koha/Koha/Object.pm line 170 # Failed test '404 Not Found' # at t/db_dependent/api/v1/item_groups.t line 117. # got: '500' # expected: '404' # Looks like you failed 1 test of 6. # Failed test 'add() tests' # at t/db_dependent/api/v1/item_groups.t line 123. Please provide a fix!
Created attachment 151094 [details] [review] Bug 33053: Handle invalid biblio_id more robustly This patch addresses the fact the invalid FK error might differ under some circumstances. We could try to catch the exception adding another case, but I think this pattern is cleaner and the authors didn't provide a fix. We can discuss it later, as this controller class has several things to review. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Many hands makes light work, thankyou everyone! Pushed to 22.11.x for the next release
Patchset won't apply cleanly to 22.05.x, no backport.