Bug 35062: Add class plugin-blocks-submit in addbiblio

Adding this condition in Check() allows you to prevent form submittal
during e.g. an ajax call in a framework plugin.
The plugin adds and removes the class on the corresponding html
element during processing.

Test plan:
Since we do not have a plugin using this class yet, nothing changes now.
Verify that you can still click Save in addbiblio while using standard
plugins. In other words: no change in behavior.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Marcel de Rooy 2023-10-16 12:08:25 +02:00 committed by Katrin Fischer
parent 04624f4433
commit df2cad62b0
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 4 additions and 1 deletions

View File

@ -744,7 +744,10 @@ $(document).ready(function(){
function Check(){
var StrAlert = AreFieldsNotOk();
var StrWarning = AreFieldsNotOk( false );
if( !StrAlert && StrWarning ){
if ( $('.plugin-blocks-submit').length > 0 ) {
// This class can be set by framework plugins to block submittal temporarily (e.g. during ajax call)
return false;
} else if( !StrAlert && StrWarning ) {
// Check important fields
$("#check_errors").html( StrWarning );
$('html, body').animate({ scrollTop: 0 }, 'fast');