Tweak the Record In-House Use interface so that it has sound, a larger textbox for...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 27 Oct 2009 02:39:59 +0000 (02:39 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 27 Oct 2009 02:39:59 +0000 (02:39 +0000)
sets the value to the cap.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@14613 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/0056.data.org-setting-in-house-use.sql [new file with mode: 0644]
Open-ILS/xul/staff_client/server/circ/in_house_use.js
Open-ILS/xul/staff_client/server/circ/in_house_use.xul

index 805182a..2715e7a 100644 (file)
@@ -51,7 +51,7 @@ CREATE TABLE config.upgrade_log (
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0055'); -- phasefx
+INSERT INTO config.upgrade_log (version) VALUES ('0056'); -- phasefx
 
 
 CREATE TABLE config.bib_source (
index 9c52257..ed648f8 100644 (file)
@@ -1627,6 +1627,16 @@ INSERT into config.org_unit_setting_type
   'Set this if you would like patron displays in the staff client to be closed after a certain interval of inactivity.  Example ''5 minutes''',
   'interval' ),
 
+( 'ui.circ.in_house_use.entry_cap',
+  'GUI: Record In-House Use: Maximum # of uses allowed per entry.',
+  'The # of uses entry in the Record In-House Use interface may not exceed the value of this setting.',
+  'integer' ),
+
+( 'ui.circ.in_house_use.entry_warn',
+  'GUI: Record In-House Use: # of uses threshold for Are You Sure? dialog.',
+  'In the Record In-House Use interface, a submission attempt will warn if the # of uses field exceeds the value of this setting.',
+  'integer' ),
+
 ( 'acq.default_circ_modifier',
   'Default circulation modifier',
   null,
diff --git a/Open-ILS/src/sql/Pg/upgrade/0056.data.org-setting-in-house-use.sql b/Open-ILS/src/sql/Pg/upgrade/0056.data.org-setting-in-house-use.sql
new file mode 100644 (file)
index 0000000..2a0fe44
--- /dev/null
@@ -0,0 +1,21 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0056'); -- phasefx
+
+INSERT INTO config.org_unit_setting_type ( name, label, description, datatype )
+    VALUES (
+        'ui.circ.in_house_use.entry_cap',
+        'GUI: Record In-House Use: Maximum # of uses allowed per entry.',
+        'The # of uses entry in the Record In-House Use interface may not exceed the value of this setting.',
+        'integer'
+    );
+
+INSERT INTO config.org_unit_setting_type ( name, label, description, datatype )
+    VALUES (
+        'ui.circ.in_house_use.entry_warn',
+        'GUI: Record In-House Use: # of uses threshold for Are You Sure? dialog.',
+        'In the Record In-House Use interface, a submission attempt will warn if the # of uses field exceeds the value of this setting.',
+        'integer'
+    );
+
+COMMIT;
index 5f81732..d6d6355 100644 (file)
@@ -9,6 +9,7 @@ circ.in_house_use = function (params) {
     JSAN.use('util.barcode');
     JSAN.use('util.date');
     JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
+    JSAN.use('util.sound'); this.sound = new util.sound();
 }
 
 circ.in_house_use.prototype = {
@@ -17,6 +18,9 @@ circ.in_house_use.prototype = {
 
         var obj = this;
 
+        obj.entry_cap = Number( obj.data.hash.aous['ui.circ.in_house_use.entry_cap'] ) || 99;
+        obj.entry_warn = Number( obj.data.hash.aous['ui.circ.in_house_use.entry_warn'] ) || 20;
+
         JSAN.use('circ.util');
         var columns = circ.util.columns( 
             { 
@@ -135,13 +139,19 @@ circ.in_house_use.prototype = {
                                 try {
                                     var value = Number(ev.target.value);
                                     if (value > 0) {
-                                        if (value > 99) ev.target.value = 99;
+                                        if (value > obj.entry_cap) { throw(value); }
                                     } else {
-                                        ev.target.value = 1;
+                                        throw(value);
                                     }
                                 } catch(E) {
                                     dump('in_house_use:multiplier: ' + E + '\n');
-                                    ev.target.value = 1;
+                                    obj.sound.circ_bad();
+                                    setTimeout(
+                                        function() {
+                                            obj.controller.view.in_house_use_multiplier_textbox.focus();
+                                            obj.controller.view.in_house_use_multiplier_textbox.select();
+                                        }, 0
+                                    );
                                 }
                             }
                         }
@@ -230,13 +240,14 @@ circ.in_house_use.prototype = {
                 return; 
             }
 
-            if (multiplier == 0 || multiplier > 99) {
+            if (multiplier == 0 || multiplier > obj.entry_cap) {
                 obj.controller.view.in_house_use_multiplier_textbox.focus();
                 obj.controller.view.in_house_use_multiplier_textbox.select();
+                obj.sound.circ_bad();
                 return;
             }
 
-            if (multiplier > 20) {
+            if (multiplier > obj.entry_warn) {
                 var r = obj.error.yns_alert(
                     document.getElementById('circStrings').getFormattedString('staff.circ.in_house_use.confirm_multiple', [barcode, multiplier]),
                     document.getElementById('circStrings').getString('staff.circ.in_house_use.confirm_multiple.title'),
@@ -308,6 +319,7 @@ circ.in_house_use.prototype = {
                 //I could override map_row_to_column here
                 }
             );
+            obj.sound.circ_good();
 
             if (typeof obj.on_in_house_use == 'function') {
                 obj.on_in_house_use(result);
index ae1292c..a0d27d6 100644 (file)
@@ -91,7 +91,7 @@
 
     <hbox id="in_house_use_top_ui">
         <label id="in_house_use_multiplier_label" value="&staff.circ.in_house_use.multiplier.label;" control="in_house_use_multiplier_textbox" accesskey="&staff.circ.in_house_use.multiplier.accesskey;" hidden="false"/>
-        <textbox id="in_house_use_multiplier_textbox" value="1" hidden="false" size="2" cols="2" context="clipboard"/>
+        <textbox id="in_house_use_multiplier_textbox" value="1" hidden="false" size="6" cols="6" context="clipboard"/>
         <hbox id="in_house_use_menu_placeholder" flex="0"/>
         <textbox id="in_house_use_barcode_entry_textbox" context="clipboard"/>
         <button id="in_house_use_submit_barcode_button"