N°4171 - Concurrent lock: Fix expiration modal being duplicated sometimes

This commit is contained in:
Molkobain
2021-07-16 16:32:39 +02:00
parent 82e3ddaacd
commit 68f3c53faa

View File

@@ -5342,6 +5342,20 @@ EOF
$sJSOk = json_encode(Dict::S('UI:Button:Ok'));
$oPage->add_ready_script(
<<<JS
// Prepare reusable modal
const oOwnershipLockModal = $('<div></div>').dialog({
title: $sJSTitle,
modal: true,
autoOpen: false,
minWidth: 600,
buttons:[{
text: $sJSOk,
class: 'ibo-is-alternative',
click: function() { $(this).dialog('close'); }
}],
close: function() { $(this).dialog('close'); }
});
// Start periodic handler
let hOwnershipLockHandlerInterval = window.setInterval(function() {
if (window.bInSubmit || window.bInCancel) return;
@@ -5351,18 +5365,8 @@ EOF
if ($('.lock_owned').length == 0)
{
$('.ui-layout-content').prepend('<div class="header_message message_error lock_owned">'+data.message+'</div>');
$('<div>'+data.popup_message+'</div>').dialog({
title: $sJSTitle,
modal: true,
autoOpen: true,
minWidth: 600,
buttons:[{
text: {$sJSOk},
class: 'ibo-is-alternative',
click: function() { $(this).dialog('close'); }
}],
close: function() { $(this).remove(); }
});
oOwnershipLockModal.text(data.popup_message);
oOwnershipLockModal.dialog('open');
}
$('.object-details form .ibo-toolbar .ibo-button:not([name="cancel"])').prop('disabled', true);
clearInterval(hOwnershipLockHandlerInterval);
@@ -5372,18 +5376,8 @@ EOF
if ($('.lock_owned').length == 0)
{
$('.ui-layout-content').prepend('<div class="header_message message_error lock_owned">'+data.message+'</div>');
$('<div>'+data.popup_message+'</div>').dialog({
title: $sJSTitle,
modal: true,
autoOpen: true,
minWidth: 600,
buttons:[{
text: $sJSOk,
class: 'ibo-is-alternative',
click: function() { $(this).dialog('close'); }
}],
close: function() { $(this).remove(); }
});
oOwnershipLockModal.text(data.popup_message);
oOwnershipLockModal.dialog('open');
}
$('.object-details form .ibo-toolbar .ibo-button:not([name="cancel"])').prop('disabled', true);
clearInterval(hOwnershipLockHandlerInterval);