JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
data.stash_retrieve();
if (typeof data.unsaved_data == 'undefined') { data.unsaved_data = 0; }
- //we allow unsaved data to be incremented a single time from marc edit
+ //We allow unsaved data to be incremented only a single time from marc edit
if (tab.marc_edit_allow_multiple_locks || tab.in_marc_edit == false) {
data.unsaved_data++;
window.oils_lock++;
//because we might come back and edit it later, and the window.oils_lock
//prevents us from closing the window and losing data. If the marc
//data is not changed and we have a window lock, then we can decerment it
- if (tab.in_marc_edit == false || tab.marc_edit_changed == false) {
- window.oils_lock -= count;
- if (window.oils_lock < 0) { window.oils_lock = 0; }
- }
+ window.oils_lock -= count;
+ if (window.oils_lock < 0) { window.oils_lock = 0; }
JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
data.stash_retrieve();
if (typeof data.unsaved_data == 'undefined') { data.unsaved_data = 0; }
dump('decrementing data.unsaved_data by ' + count + '\n');
- if (tab.in_marc_edit == false || tab.marc_edit_changed == false) {
- data.unsaved_data -= count;
- }
+ data.unsaved_data -= count;
if (data.unsaved_data < 0) { data.unsaved_data = 0; }
data.stash('unsaved_data');
dump('\twindow.oils_lock == ' + window.oils_lock + '\n');
function record_action(action_function) {
if (safe_to_proceed()) {
var args = Array.prototype.slice.call(arguments, 1);
+ if (action_function.name == 'set_marc_edit') {
+ var tabs = window.parent.document.getElementById('main_tabs');
+ var idx = tabs.selectedIndex;
+ var tab = tabs.childNodes[idx];
+
+ if (tab.marc_edit_changed) {
+ xulG.lock_tab();
+ tab.marc_edit_allow_multiple_locks = false;
+ }
+ }
+
return action_function.apply(null, args);
}
}
if (typeof obj.tab_semaphores[id] != 'undefined') {
if (obj.tab_semaphores[id] > 0) {
+ //If confirmation has not been defined yet
+ //make sure we prompt for possible loss of data
if (typeof confirmation == undefined) {
confirmation = window.confirm(offlineStrings.getString('menu.replace_tab.unsaved_data_warning'));
}
obj.tab_semaphores[id] = 0;
}
- //If we are in marc edit, then unlock is only calld when saving
- //the edits. So, drop all locks in this case.
- //Otherwise leave the code as is because I am not sure how other parts
- if (tab.in_marc_edit) {
- obj.tab_semaphores[id] = 0;
- } else {
- obj.tab_semaphores[id]--;
- }
+ //If we are in marc edit, then unlock is only calld when saving
+ //the edits. So, drop all locks in this case.
+ //Otherwise leave the code as is because I am not sure how other parts
+ //of the staff client interact with the tab locking
+ if (tab.in_marc_edit) {
+ obj.tab_semaphores[id] = 0;
+ //allow multiple locks again, so if we
+ //return to marc edit we can put a lock on it again
+ tab.marc_edit_allow_multiple_locks = true;
+ } else {
+ obj.tab_semaphores[id]--;
+ }
if (obj.tab_semaphores[id] < 0) { obj.tab_semaphores[id] = 0; }
oils_unsaved_data_P();
return obj.tab_semaphores[id];