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)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 11 May 2023 12:19:06 +0000 (13:19 +0100)
commit4634494df300592806ce37fafcb982c6e307a2d2
treeb360259bc38b89465b6052b8494bbfe36106af53
parent41557555a9ceff4bc70e4fa1a53d270d3acf7143
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>
(cherry picked from commit 15e234e5963c9c426541c76d599e5b561fd542ad)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
installer/data/mysql/atomicupdate/bug_32745.pl [new file with mode: 0755]