Bug 32745: Adjust context for invalid background jobs
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 24 Mar 2023 10:17:58 +0000 (11:17 +0100)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 5 May 2023 12:13:31 +0000 (09:13 -0300)
commit15e234e5963c9c426541c76d599e5b561fd542ad
tree04f936fe670bf99820b2f73d9fc1df1df8f7284c
parentf99bcfb6521835e6d21cad3c83973aefb0f16cf4
Bug 32745: Adjust context for invalid background jobs

We had some problems recently and it's possible to have
background_jobs.context=NULL
But the REST API specs is expecting an object.
We could either modify the specs, or adjust the incorrect entries in DB,
which is IMO better.

Test plan:
0. Don't apply the patch
1. Create some background jobs
2. Set context to NULL
UPDATE background_jobs SET context=NULL;
3. List the jobs and note the datatable error, and the error in Koha log
  OpenAPI >>> GET api/v1/jobs [{"message":"Expected object - got null.","path":"\/body\/0\/context"},{"message":"Expected object - got null.","path":"\/body\/1\/context"}]

4. Apply the patch
5. Run `updatedatabase`
6. Confirm that the list and detail view are not working correctly

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
installer/data/mysql/atomicupdate/bug_32745.pl [new file with mode: 0755]