backport filepicker bug fix, and for Item Status interface, handle VOLUME_LABEL_EXIST...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 15 Aug 2007 21:54:28 +0000 (21:54 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 15 Aug 2007 21:54:28 +0000 (21:54 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_2@7686 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/main/main.js
Open-ILS/xul/staff_client/server/cat/copy_browser.js
Open-ILS/xul/staff_client/server/cat/copy_editor.js
Open-ILS/xul/staff_client/server/circ/copy_status.js
Open-ILS/xul/staff_client/server/circ/print_list_template_editor.js

index 384b863..cd9916b 100644 (file)
@@ -34,7 +34,8 @@ function pick_file(mode) {
                mode == 'open' ? nsIFilePicker.modeOpen : nsIFilePicker.modeSave
        );
        fp.appendFilters( nsIFilePicker.filterAll );
-       if ( fp.show( ) == nsIFilePicker.returnOK && fp.file ) {
+       var fp_result = fp.show();
+       if ( ( fp_result == nsIFilePicker.returnOK || fp_result == nsIFilePicker.returnReplace ) && fp.file ) {
                return fp.file;
        } else {
                return null;
index d3376ed..f4b86ea 100644 (file)
@@ -572,8 +572,16 @@ cat.copy_browser.prototype = {
                                                                                        api.FM_ACN_TREE_UPDATE.method,
                                                                                        [ ses(), volumes, true ]
                                                                                );
-                                                                               if (typeof r.ilsevent != 'undefined') throw(r);
-                                                                               alert('Volumes modified.');
+                                                                               if (typeof r.ilsevent != 'undefined') {
+                                            switch(r.ilsevent) {
+                                                case 1705 /* VOLUME_LABEL_EXISTS */ :
+                                                    alert("Edit failed:  You tried to change a volume's callnumber to one that is already in use for the given library.  You should transfer the items to the desired callnumber instead.");
+                                                    break;
+                                                default: throw(r);
+                                            }
+                                        } else {
+                                                                               alert('Volumes modified.');
+                                        }
                                                                        } catch(E) {
                                                                                obj.error.standard_unexpected_error_alert('volume update error: ',E);
                                                                        }
index f81fc2b..8963d04 100644 (file)
@@ -188,7 +188,8 @@ function pick_file(mode) {
                mode == 'open' ? nsIFilePicker.modeOpen : nsIFilePicker.modeSave
        );
        fp.appendFilters( nsIFilePicker.filterAll );
-       if ( fp.show( ) == nsIFilePicker.returnOK && fp.file ) {
+       var fp_result = fp.show();
+       if ( ( fp_result == nsIFilePicker.returnOK || fp_result == nsIFilePicker.returnReplace ) && fp.file ) {
                return fp.file;
        } else {
                return null;
index e2d0cca..b08c9f0 100644 (file)
@@ -298,7 +298,8 @@ circ.copy_status.prototype = {
                                                                        mode == 'open' ? nsIFilePicker.modeOpen : nsIFilePicker.modeSave
                                                                );
                                                                fp.appendFilters( nsIFilePicker.filterAll );
-                                                               if ( fp.show( ) == nsIFilePicker.returnOK && fp.file ) {
+                                                               var fp_result = fp.show();
+                                                               if ( ( fp_result == nsIFilePicker.returnOK || fp_result == nsIFilePicker.returnReplace ) && fp.file ) {
                                                                        return fp.file;
                                                                } else {
                                                                        return null;
@@ -720,8 +721,16 @@ circ.copy_status.prototype = {
                                                                                        api.FM_ACN_TREE_UPDATE.method,
                                                                                        [ ses(), volumes, false ]
                                                                                );
-                                                                               if (typeof r.ilsevent != 'undefined') throw(r);
-                                                                               alert('Volumes modified.');
+                                        if (typeof r.ilsevent != 'undefined') {
+                                            switch(r.ilsevent) {
+                                                case 1705 /* VOLUME_LABEL_EXISTS */ :
+                                                    alert("Edit failed:  You tried to change a volume's callnumber to one that is already in use for the given library.  You should transfer the items to the desired callnumber instead.");
+                                                    break;
+                                                default: throw(r);
+                                            }
+                                        } else {
+                                                                               alert('Volumes modified.');
+                                        }
                                                                        } catch(E) {
                                                                                obj.error.standard_unexpected_error_alert('volume update error: ',E);
                                                                        }
index 3ca8ce1..632f609 100644 (file)
@@ -366,7 +366,8 @@ circ.print_list_template_editor.prototype = {
                                mode == 'open' ? nsIFilePicker.modeOpen : nsIFilePicker.modeSave
                        );
                        fp.appendFilters( nsIFilePicker.filterAll );
-                       if ( fp.show( ) == nsIFilePicker.returnOK && fp.file ) {
+                       var fp_result = fp.show();
+                       if ( ( fp_result == nsIFilePicker.returnOK || fp_result == nsIFilePicker.returnReplace ) && fp.file ) {
                                return fp.file;
                        } else {
                                return null;