Bug 41307 - Automatically indicate when a harvest job is completed (successfully or with an error)
Summary: Automatically indicate when a harvest job is completed (successfully or with ...
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: ERM (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-11-25 19:07 UTC by Mathieu Saby
Modified: 2026-01-16 12:50 UTC (History)
8 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mathieu Saby 2025-11-25 19:07:23 UTC
In /erm/eusage/usage_data_providers when you run an import for a data source, the list of corresponding jobs is displayed above the table ("Job for report type DR has been queued. Check job progress.")

It would be nice if this information were automatically updated once the job is completed ("Job for report type DR is completed. Check job details.")

This may not be technically possible ?
Comment 1 Mathieu Saby 2025-11-26 09:52:45 UTC
I see this information will be added in the widget on the ERM home page https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39320

But it could be added too in erm/eusage/usage_data_providers page
Comment 2 Michaela Sieber 2026-01-16 12:50:36 UTC
As far as I can see the widget only displays if the job is still running or completed / cancelled.

What you would like to see is the error code and message. 


This is the SQL-Statement which gives you the option to find the background jobs type erm_sushi_harvester that ended with an error (for example if no data were available or if the request was queued, etc.) :

SELECT 
CONCAT('<a target="_blank" href=\"/cgi-bin/koha/admin/background_jobs.pl?op=view&id=',bj.id,'\">', bj.id, '</a>' ) AS "Job-ID",
bj.enqueued_on AS 'Date/time',
CONCAT('<a target="_blank" href=\"/cgi-bin/koha/erm/eusage/usage_data_providers/', JSON_VALUE(bj.data,'$.ud_provider_id'), '\">', JSON_VALUE(bj.data,'$.ud_provider_id'), '</a>' ) AS "Provider-ID",
JSON_VALUE(bj.data,'$.ud_provider_name') AS 'provider name',
JSON_VALUE(bj.data,'$.report_type') AS 'Report',
JSON_VALUE(bj.data,'$.begin_date') AS 'report begin_date',
JSON_VALUE(bj.data,'$.end_date') AS 'report end_date',
JSON_VALUE(bj.data,'$.messages[0].code') AS 'error code',
JSON_VALUE(bj.data,'$.messages[0].message') AS 'error message'
FROM background_jobs bj
WHERE type='erm_sushi_harvester'
AND JSON_VALUE(bj.data,'$.messages[0].type')='error' 
/* #All jobs with type error in data column,  e.g. No Usage Available for Requested Dates (3030) or Usage Not Ready for Requested Dates (3031) or Fatal - Service Not Available (1000) or      Error - Requestor Not Authorized to Access Service (2000) */
AND DATE(bj.enqueued_on) BETWEEN   <<from|date>>    AND  <<to|date>>  
ORDER BY bj.enqueued_on DESC