While trying to fix Bug 8645 I noticed that background-job-progressbar.js has error-handling code which tries to call the "humanMsg" function which is defined in the "HUMANIZED MESSAGES" plugin humanmsg.js. The plugin is currently loaded on the following pages: admin\preferences.tt cataloguing\editor.tt tools\stage-marc-import.tt Whereas background-job-progressbar.js is used on these pages: offline_circ\process_koc.tt tools\batch_record_modification.tt tools\batchMod-edit.tt tools\manage-marc-import.tt tools\stage-marc-import.tt tools\upload-images.tt The background job error handling doesn't do anything other than return the AJAX error message, so I don't think it's worth it to add the humanmsg plugin everywhere. Better, I think, to change it to an alert.
Created attachment 94027 [details] [review] Bug 23753: Background job JavaScript should not try to call humanMsg library This patch modifies the JavaScript file which handles background jobs so that it doesn't try to call the HumanMsg JavaScript library. It now will show errors in an alert. The patch also adds a couple of lines of JS to hide the progressbar and re-enable the submit button when an error is triggered. To test you'll need to introduce a problem with AJAX operations so that the error message will be triggered. After applying the patch you can modify js/background-job-progressbar.js to alter line 63 from: url: f.action, ...to: url: f.action + "foo", Perform the following tests and confirm that an error message is shown in an alert: Tools -> Batch record modification - Test the process of uploading a file of biblionumbers Tools -> Batch item modification - Test the process of uploading a file of barcodes Tools -> Stage MARC records for import - Test the process of staging an uploaded file for import Tools -> Staged MARC record management - Test the process of importing a staged file The background-jobs JS was not used on these pages and has been removed: Tools -> Upload local cover image - Test the process of uploading cover images Circulation -> Upload offline circulation data - Test the process of uploading a .koc file Don't forget to undo your change to background-job-progressbar.js before signing off.
I tested these and they worked as expected with the alert: Tools -> Batch record modification Tools -> Batch item modification Tools -> Stage MARC records for import Tools -> Staged MARC record management I did *not* get an alert for the following interfaces: Tools -> Upload local cover image Circulation -> Upload offline circulation data (but I wasn't giving it a real file... if it needs a real-ish file, can you provide a test one that I can manipulate?)
Created attachment 99786 [details] [review] Bug 23753: Add missing humanMsg library to pages using background job JavaScript The JavaScript used to process background uploads calls the humanMsg library under some circumstances. There are several templates which use background-job-progressbar.js which don't include the humanMsg assets. This patch corrects those templates. Note: upload-images.tt has been modified to remove the inclusion of background-job-progressbar.js because it was unused. To test, apply the patch and test the following processes which include background job processing: - Batch item modification -- the background job is triggered when you submit your changes - Batch record modification -- the background job is triggered when you submit your changes - Stage MARC for import -- the background job is triggered when you click the "Sage for import" button after uploading a file - Staged MARC management -- the background job is triggered when you click "Import this batch into the catalog" In each case the process should complete correctly. If you would like to test the error message handling provided by the humanMsg library you can deliberately introduce an error into the JavaScript. After applying the patch you can modify js/background-job-progressbar.js to alter line 63 from: url: f.action, ...to: url: f.action + "foo", Perform the same tests and confirm that you see an error message. Don't forget to undo your changes to background-job-progressbar.js before signing off.
I changed the title of this bug to reflect the new aim of the patch: To include the humanMsg library on pages which need it (rather than removing it as a dependency).
Created attachment 99790 [details] [review] Bug 23753: Add missing humanMsg library to pages using background job JavaScript The JavaScript used to process background uploads calls the humanMsg library under some circumstances. There are several templates which use background-job-progressbar.js which don't include the humanMsg assets. This patch corrects those templates. Note: upload-images.tt has been modified to remove the inclusion of background-job-progressbar.js because it was unused. To test, apply the patch and test the following processes which include background job processing: - Batch item modification -- the background job is triggered when you submit your changes - Batch record modification -- the background job is triggered when you submit your changes - Stage MARC for import -- the background job is triggered when you click the "Sage for import" button after uploading a file - Staged MARC management -- the background job is triggered when you click "Import this batch into the catalog" In each case the process should complete correctly. If you would like to test the error message handling provided by the humanMsg library you can deliberately introduce an error into the JavaScript. After applying the patch you can modify js/background-job-progressbar.js to alter line 63 from: url: f.action, ...to: url: f.action + "foo", Perform the same tests and confirm that you see an error message. Don't forget to undo your changes to background-job-progressbar.js before signing off. Signed-off-by: Maryse Simard <maryse.simard@inlibro.com>
Created attachment 99828 [details] [review] Bug 23753: Add missing humanMsg library to pages using background job JavaScript The JavaScript used to process background uploads calls the humanMsg library under some circumstances. There are several templates which use background-job-progressbar.js which don't include the humanMsg assets. This patch corrects those templates. Note: upload-images.tt has been modified to remove the inclusion of background-job-progressbar.js because it was unused. To test, apply the patch and test the following processes which include background job processing: - Batch item modification -- the background job is triggered when you submit your changes - Batch record modification -- the background job is triggered when you submit your changes - Stage MARC for import -- the background job is triggered when you click the "Sage for import" button after uploading a file - Staged MARC management -- the background job is triggered when you click "Import this batch into the catalog" In each case the process should complete correctly. If you would like to test the error message handling provided by the humanMsg library you can deliberately introduce an error into the JavaScript. After applying the patch you can modify js/background-job-progressbar.js to alter line 63 from: url: f.action, ...to: url: f.action + "foo", Perform the same tests and confirm that you see an error message. Don't forget to undo your changes to background-job-progressbar.js before signing off. Signed-off-by: Maryse Simard <maryse.simard@inlibro.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Nice work everyone! Pushed to master for 20.05
Backported to 19.11.x branch for 19.11.05
backported to 19.05.x for 19.05.10
Dependency not in 18.11., not backporting to 18.11.x series