[open-ils-commits] [GIT] Evergreen ILS branch rel_2_3 updated. 12eda2e774b84f4a23dc5ce33f5a40ba3b2716f7
Evergreen Git
git at git.evergreen-ils.org
Wed Aug 22 15:24:09 EDT 2012
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, rel_2_3 has been updated
via 12eda2e774b84f4a23dc5ce33f5a40ba3b2716f7 (commit)
from 6b40207531b398243b419d64c787f95ebc76d5fa (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 12eda2e774b84f4a23dc5ce33f5a40ba3b2716f7
Author: Steven Chan <schan at sitka.bclibraries.ca>
Date: Wed Jul 25 16:12:19 2012 -0700
Fix LP949249, Edit, then Create button creates a new item in all cases
This fix also resolves the following:
* https://bugs.launchpad.net/evergreen/+bug/806585,
Item Attributes saved on Close
* https://bugs.launchpad.net/evergreen/+bug/644753,
check for duplicate barcode during a create session in copy/volume editor
1. The Copy Editor screen is launched from the Volume Copy Creator,
which is launched from the Holdings Maintenance screen. If the default
interface is set, CE is shown in a separate window; if the 'unified'
interface is set, CE is embedded in the same window as VCC. Upon the
user clicking Save or Close in the Copy Editor, the intent is to create
a new item record or not, respectively. However, it happens that a new
record is always created, because VCC instructs CE to let VCC update the
item, which will occur whether the user has clicked either button.
To fix 1, if the default interface is set, we reconfigure CE to update
the item or not, depending on the button clicked; otherwise, in the
unified interface, we allow VCC to update the item or not.
2. Upon updating the item, if the barcode is a duplicate, the ensuing
sequence of events is problematic: a database-level alert message is
shown, Copy Editor is closed, and Volume Copy Creator is closed, thus
forcing the user to re-formulate the request from Holdings Maintenance.
To fix 2, we show a higher-level alert message to the user. If the
default interface is set, we stay within CE, reconfigure the barcode to
be an input field, and focus the user on it; otherwise, in the unified
interface, we return the user to an area of the screen where the barcode
field is available. In either case, the user can re-enter a barcode
value and re-submit without losing any values previously entered into CE.
3. We also take the opportunity to enhance the coding performance of
Copy Editor, by delegating the handling of the button and key clicks to
the parent groupbox element. Previously, the event handler was attached
to several child elements, which is not performant.
Conflicts fix:
Open-ILS/xul/staff_client/server/cat/copy_editor.js
Signed-off-by: Ben Shum <bshum at biblio.org>
diff --git a/Open-ILS/xul/staff_client/server/cat/copy_editor.js b/Open-ILS/xul/staff_client/server/cat/copy_editor.js
index d289be8..e430b8e 100644
--- a/Open-ILS/xul/staff_client/server/cat/copy_editor.js
+++ b/Open-ILS/xul/staff_client/server/cat/copy_editor.js
@@ -3,6 +3,7 @@ var g = { 'disabled' : false };
g.map_acn = {};
function $(id) { return document.getElementById(id); }
+function $_(x) { return $('catStrings').getString(x); }
function my_init() {
try {
@@ -928,6 +929,13 @@ g.panes_and_field_names = {
$('catStrings').getString('staff.cat.copy_editor.field.barcode.label'),
{
render: 'fm.barcode();',
+ input:
+ 'c = function (v) {'
+ + 'g.apply("barcode", v);'
+ + 'if (typeof post_c === "function") post_c(v);'
+ + '};'
+ + 'x = document.createElement("textbox");',
+ attr: { 'class': 'disabled' },
}
],
[
@@ -1349,16 +1357,12 @@ g.render_input = function(node,blob) {
groupbox.setAttribute('style','');
}
- vbox.addEventListener('mouseover',on_mouseover,false);
- vbox.addEventListener('mouseout',on_mouseout,false);
groupbox.addEventListener('mouseover',on_mouseover,false);
groupbox.addEventListener('mouseout',on_mouseout,false);
- groupbox.firstChild.addEventListener('mouseover',on_mouseover,false);
- groupbox.firstChild.addEventListener('mouseout',on_mouseout,false);
function on_click(ev){
try {
- if (block || g.disabled || !g.edit) {
+ if (block || g.disabled || !g.edit || ev.currentTarget.classList.contains('disabled')) {
return;
}
block = true;
@@ -1425,10 +1429,8 @@ g.render_input = function(node,blob) {
g.error.standard_unexpected_error_alert('render_input',E);
}
}
- vbox.addEventListener('click',on_click, false);
- hbox.addEventListener('click',on_click, false);
- caption.addEventListener('click',on_click, false);
- caption.addEventListener('keypress',function(ev) {
+ groupbox.addEventListener('click',on_click, false);
+ groupbox.addEventListener('keypress',function(ev) {
if (ev.keyCode == 13 /* enter */ || ev.keyCode == 77 /* mac enter */) on_click();
}, false);
caption.setAttribute('style','-moz-user-focus: normal');
@@ -1444,17 +1446,24 @@ g.render_input = function(node,blob) {
/* store the copies in the global xpcom stash */
g.stash_and_close = function() {
+ var r = {textcode: ''};
try {
oils_unlock_page();
if (g.handle_update) {
try {
- var r = g.network.request(
+ r = g.network.request(
api.FM_ACP_FLESHED_BATCH_UPDATE.app,
api.FM_ACP_FLESHED_BATCH_UPDATE.method,
[ ses(), g.copies, true ]
);
- if (typeof r.ilsevent != 'undefined') {
+ if (r.textcode === 'ITEM_BARCODE_EXISTS') {
+ alert('error with item update: ' + r.desc);
+ var barcode = $($_('staff.cat.copy_editor.field.barcode.label'));
+ barcode.parentNode.classList.remove('disabled');
+ barcode.click();
+ }
+ else if (typeof r.ilsevent !== 'undefined') {
g.error.standard_unexpected_error_alert('copy update',r);
}
/* FIXME -- revisit the return value here */
@@ -1465,8 +1474,10 @@ g.stash_and_close = function() {
//g.data.temp_copies = js2JSON( g.copies );
//g.data.stash('temp_copies');
xulG.copies = g.copies;
- JSAN.use('util.widgets');
- util.widgets.dispatch('close',window);
+ if (r.textcode !== 'ITEM_BARCODE_EXISTS') {
+ JSAN.use('util.widgets');
+ util.widgets.dispatch('close',window);
+ }
} catch(E) {
alert('Error in copy_editor.js, g.stash_and_close(): '+E);
}
diff --git a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js
index 3f0fd0b..0b16308 100644
--- a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js
+++ b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js
@@ -1163,19 +1163,30 @@ g.stash_and_close = function(param) {
var label_editor_func;
if (copies.length > 0) {
- if (param == 'edit') {
+ if (param === 'edit') {
JSAN.use('cat.util');
- copies = cat.util.spawn_copy_editor( { 'edit' : true, 'docid' : g.doc_id, 'copies' : copies, 'caller_handles_update' : true });
+ copies = cat.util.spawn_copy_editor({
+ 'edit' : true
+ , 'docid' : g.doc_id
+ , 'copies' : copies
+ , 'caller_handles_update' : false
+ });
}
- if (typeof xul_param('update_copy') == 'function') {
- xul_param('update_copy')(copies);
- } else {
- var r = g.network.simple_request(
- 'FM_ACP_FLESHED_BATCH_UPDATE',
- [ ses(),copies, true ]
- );
- if (typeof r.ilsevent != 'undefined') {
- alert('error with copy update:' + js2JSON(r));
+ else {
+ if (typeof xul_param('update_copy') === 'function') {
+ xul_param('update_copy')(copies);
+ } else {
+ var r = g.network.simple_request(
+ 'FM_ACP_FLESHED_BATCH_UPDATE',
+ [ ses(),copies, true ]
+ );
+ if (r.textcode === 'ITEM_BARCODE_EXISTS') {
+ alert('error with item update: ' + r.desc);
+ dont_close = true;
+ }
+ else if (typeof r.ilsevent != 'undefined') {
+ alert('error with copy update:' + js2JSON(r));
+ }
}
}
try {
-----------------------------------------------------------------------
Summary of changes:
.../xul/staff_client/server/cat/copy_editor.js | 37 +++++++++++++-------
.../staff_client/server/cat/volume_copy_creator.js | 33 ++++++++++++------
2 files changed, 46 insertions(+), 24 deletions(-)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list