Add Checkin Alert to Copy Locations
authorThomas Berezansky <tsbere@mvlc.org>
Wed, 18 Jan 2012 16:28:13 +0000 (11:28 -0500)
committerBill Erickson <berick@esilibrary.com>
Fri, 20 Jan 2012 20:02:25 +0000 (15:02 -0500)
If enabled bring up a ROUTE TO prompt for the location at reshelving time.

Also, while at it, add Prefix/Suffix to the "new" section of the editor.

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/asset.pm
Open-ILS/src/sql/Pg/040.schema.asset.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.copy_location_alert.sql [new file with mode: 0644]
Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/server/admin/copy_locations.js
Open-ILS/xul/staff_client/server/admin/copy_locations.xhtml
Open-ILS/xul/staff_client/server/circ/util.js

index 8c481ec..4b63e64 100644 (file)
@@ -3772,6 +3772,7 @@ SELECT  usr,
                        <field reporter:label="Copies" name="copies" oils_persist:virtual="true" reporter:datatype="link"/>
                        <field reporter:label="Label Prefix" name="label_prefix"  reporter:datatype="text" oils_persist:i18n="true"/>
                        <field reporter:label="Label Suffix" name="label_suffix"  reporter:datatype="text" oils_persist:i18n="true"/>
+                       <field reporter:label="Checkin Alert" name="checkin_alert" reporter:datatype="bool" />
                </fields>
                <links>
                        <link field="owning_lib" reltype="has_a" key="id" map="" class="aou"/>
index 2b541cc..2c84f62 100644 (file)
@@ -10,7 +10,7 @@ use base qw/asset/;
 
 __PACKAGE__->table( 'asset_copy_location' );
 __PACKAGE__->columns( Primary => qw/id/ );
-__PACKAGE__->columns( Essential => qw/name owning_lib holdable hold_verify opac_visible circulate label_prefix label_suffix/ );
+__PACKAGE__->columns( Essential => qw/name owning_lib holdable hold_verify opac_visible circulate label_prefix label_suffix checkin_alert/ );
 
 #-------------------------------------------------------------------------------
 package asset::copy_location_order;
index 3beb24e..92fd81c 100644 (file)
@@ -31,6 +31,7 @@ CREATE TABLE asset.copy_location (
        circulate       BOOL    NOT NULL DEFAULT TRUE,
        label_prefix    TEXT,
        label_suffix    TEXT,
+       checkin_alert   BOOL    NOT NULL DEFAULT FALSE,
        CONSTRAINT acl_name_once_per_lib UNIQUE (name, owning_lib)
 );
 
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.copy_location_alert.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.copy_location_alert.sql
new file mode 100644 (file)
index 0000000..5c48390
--- /dev/null
@@ -0,0 +1,2 @@
+ALTER TABLE asset.copy_location
+    ADD COLUMN checkin_alert BOOL NOT NULL DEFAULT FALSE;
index 1af018f..a3a9e7d 100644 (file)
 <!ENTITY staff.server.admin.copy_locations.editor.delete.confirm "Are you sure you wish to delete the selected copy location?  Note: If copies are currently attached to this location, the delete operation will fail.">
 <!ENTITY staff.server.admin.copy_locations.editor.prefix "Label prefix">
 <!ENTITY staff.server.admin.copy_locations.editor.suffix "Label suffix">
+<!ENTITY staff.server.admin.copy_locations.editor.prefix.label "Label prefix: ">
+<!ENTITY staff.server.admin.copy_locations.editor.suffix.label "Label suffix: ">
 <!ENTITY staff.server.admin.copy_locations.editor.welcome "Welcome">
+<!ENTITY staff.server.admin.copy_locations.editor.checkin_alert.label "Checkin Alert: ">
+<!ENTITY staff.server.admin.copy_locations.editor.checkin_alert "Checkin Alert">
 <!ENTITY staff.server.admin.copy_locations.submit "Submit">
 <!ENTITY staff.server.admin.copy_locations.cancel "Cancel">
 <!ENTITY staff.server.admin.copy_locations.update_success "Update Succeeded">
index cd673cc..542a33d 100644 (file)
@@ -114,6 +114,9 @@ function clCreateNew() {
     cl.hold_verify( ($('cl_new_hold_verify_yes').checked) ? 1 : 0 );
     cl.opac_visible( ($('cl_new_vis_yes').checked) ? 1 : 0 );
     cl.circulate( ($('cl_new_circulate_yes').checked) ? 1 : 0 );
+    cl.checkin_alert( $('cl_new_checkin_alert_yes').checked ? 1 : 0 );
+    cl.label_prefix( $('cl_new_label_prefix').value );
+    cl.label_suffix( $('cl_new_label_suffix').value );
 
     var req = new Request(CREATE_CL, SESSION, cl);
     req.send(true);
@@ -160,6 +163,7 @@ function clBuildRow( tbody, row, cl ) {
     appendClear($n( row, 'cl_hold_verify'), (isTrue(cl.hold_verify())) ? _TRUE.cloneNode(true) : _FALSE.cloneNode(true) );
     appendClear($n( row, 'cl_visible'), (isTrue(cl.opac_visible())) ? _TRUE.cloneNode(true) : _FALSE.cloneNode(true) );
     appendClear($n( row, 'cl_circulate'), (isTrue(cl.circulate())) ? _TRUE.cloneNode(true) : _FALSE.cloneNode(true) );
+    appendClear($n( row, 'cl_checkin_alert'), (isTrue(cl.checkin_alert())) ? _TRUE.cloneNode(true) : _FALSE.cloneNode(true) );
     $n( row, 'cl_label_prefix').appendChild(text(cl.label_prefix() || ''));
     $n( row, 'cl_label_suffix').appendChild(text(cl.label_suffix() || ''));
 
@@ -202,6 +206,8 @@ function clEdit( cl, tbody, row ) {
     else arr[5].checked = true;
     if(isTrue(cl.hold_verify())) arr[6].checked = true;
     else arr[7].checked = true;
+    if(isTrue(cl.checkin_alert())) arr[8].checked = true;
+    else arr[9].checked = true;
 
     var label_prefix = $n(r, 'cl_edit_label_prefix');
     if (cl.label_prefix()) {
@@ -237,6 +243,8 @@ function _clOptions(r) {
     arr[5] = $n( $n(r,'cl_edit_circulate_no'), 'cl_edit_circulate');
     arr[6] = $n( $n(r,'cl_edit_hold_verify_yes'), 'cl_edit_hold_verify');
     arr[7] = $n( $n(r,'cl_edit_hold_verify_no'), 'cl_edit_hold_verify');
+    arr[8] = $n( $n(r,'cl_edit_checkin_alert_yes'), 'cl_edit_checkin_alert');
+    arr[9] = $n( $n(r,'cl_edit_checkin_alert_no'), 'cl_edit_checkin_alert');
     return arr;
 }
 
@@ -251,6 +259,8 @@ function clEditCommit( tbody, r, cl ) {
     else cl.circulate(0);
     if(arr[6].checked) cl.hold_verify(1);
     else cl.hold_verify(0);
+    if(arr[8].checked) cl.checkin_alert(1);
+    else cl.checkin_alert(0);
     cl.name($n(r, 'cl_edit_name').value);
     cl.label_prefix($n(r, 'cl_edit_label_prefix').value);
     cl.label_suffix($n(r, 'cl_edit_label_suffix').value);
index d42234b..66c5601 100644 (file)
                         </td>
                     </tr>
                     <tr>
+                        <td>&staff.server.admin.copy_locations.editor.checkin_alert.label;</td>
+                        <td>
+                            <span>&staff.server.admin.copy_locations.editor.yes;</span>
+                            <input type='radio' name='cl_new_checkin_alert' id='cl_new_checkin_alert_yes'/>
+                            <span>&staff.server.admin.copy_locations.editor.no;</span>
+                            <input type='radio' name='cl_new_checkin_alert'  
+                                id='cl_new_checkin_alert_no' checked='checked'> </input>
+                        </td>
+                        <td>&nbsp;</td>
+                        <td>&nbsp;</td>
+                    </tr>
+                    <tr>
+                        <td>&staff.server.admin.copy_locations.editor.prefix.label;</td>
+                        <td>
+                            <input id='cl_new_label_prefix' type='text' size='10'/>
+                        </td>
+                        <td>&staff.server.admin.copy_locations.editor.suffix.label;</td>
+                        <td>
+                            <input id='cl_new_label_suffix' type='text' size='10'/>
+                        </td>
+                    </tr>
+                    <tr>
                         <td colspan='4'><input id='sc_new_submit' type='submit' value='&staff.server.admin.copy_locations.editor.create;' disabled='disabled'/></td>
                     </tr>
                 </tbody>
                         <td width=''>&staff.server.admin.copy_locations.editor.hold_verify;</td>
                         <td width=''>&staff.server.admin.copy_locations.editor.opac_visible;</td>
                         <td width=''>&staff.server.admin.copy_locations.editor.circulate;</td>
+                        <td width=''>&staff.server.admin.copy_locations.editor.checkin_alert;</td>
                         <td width=''>&staff.server.admin.copy_locations.editor.prefix;</td>
                         <td width=''>&staff.server.admin.copy_locations.editor.suffix;</td>
                         <td width=''>&staff.server.admin.copy_locations.editor.edit;</td>
                         <td name='cl_hold_verify'> </td>
                         <td name='cl_visible'> </td>
                         <td name='cl_circulate'> </td>
+                        <td name='cl_checkin_alert'> </td>
                         <td name='cl_label_prefix'> </td>
                         <td name='cl_label_suffix'> </td>
                         <td><input type='submit' value='&staff.server.admin.copy_locations.editor.edit;' name='cl_edit' disabled='disabled'> </input></td>
                                 <input type='radio' name='cl_edit_circulate'/>
                             </span>
                         </td>
+                        <td>
+                            <span>&staff.server.admin.copy_locations.editor.yes;</span>
+                            <span name='cl_edit_checkin_alert_yes'>
+                                <input type='radio' name='cl_edit_checkin_alert'/>
+                            </span>
+                            <span>&staff.server.admin.copy_locations.editor.no;</span>
+                            <span name='cl_edit_checkin_alert_no'>
+                                <input type='radio' name='cl_edit_checkin_alert'/>
+                            </span>
+                        </td>
                         <td><input name='cl_edit_label_prefix' type='text'> </input></td>
                         <td><input name='cl_edit_label_suffix' type='text'> </input></td>
                         <td><input type='submit' name='cl_edit_commit' value='&staff.server.admin.copy_locations.submit;'/></td>
index c692edd..76ab082 100644 (file)
@@ -2791,10 +2791,15 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che
             msg += '\n\n';
         }
 
+        var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popups'];
+
         /* SUCCESS  /  NO_CHANGE  /  ITEM_NOT_CATALOGED */
         if (check.ilsevent == 0 || check.ilsevent == 3 || check.ilsevent == 1202) {
-            try { check.route_to = data.lookup('acpl', check.copy.location() ).name(); }
-            catch(E) {
+            try {
+                var acpl = data.lookup('acpl', check.copy.location()); 
+                check.route_to = acpl.name();
+                check.checkin_alert = isTrue(acpl.checkin_alert()) && !suppress_popups;
+            } catch(E) {
                 print_data.error_msg = document.getElementById('commonStrings').getString('common.error');
                 print_data.error_msg += '\nFIXME: ' + E + '\n';
                 msg += print_data.error_msg;
@@ -2832,7 +2837,7 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che
                 case 7: /* RESHELVING */
                     check.what_happened = 'success';
                     sound.special('checkin.success');
-                    if (msg) {
+                    if (msg || check.checkin_alert) {
                         print_data.route_to_msg = document.getElementById('circStrings').getFormattedString('staff.circ.utils.route_to.msg', [check.route_to]);
                         print_data.route_to = check.route_to;
                         msg += print_data.route_to_msg;
@@ -2994,7 +2999,6 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che
                         msg += '\n';
                     }
                     var rv = 0;
-                    var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popups'];
                     if (suppress_popups) {
                         rv = auto_print ? 0 : -1; auto_print = true; // skip dialog and PRINT or DO NOT PRINT based on Auto-Print checkbox
                     }
@@ -3088,7 +3092,6 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che
                     sound.special('checkin.cataloging');
                     check.route_to = 'CATALOGING';
                     print_data.route_to;
-                    var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popups'];
                     var x = document.getElementById('do_not_alert_on_precat');
                     var do_not_alert_on_precats = x ? ( x.getAttribute('checked') == 'true' ) : false;
                     if ( !suppress_popups && !do_not_alert_on_precats ) {
@@ -3401,7 +3404,6 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che
                 }
             }
             var rv = 0;
-            var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popups'];
             if (suppress_popups) {
                 rv = auto_print ? 0 : -1; auto_print = true; // skip dialog and PRINT or DO NOT PRINT based on Auto-Print checkbox
             }
@@ -3483,7 +3485,6 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che
             sound.special('checkin.not_found');
             check.route_to = 'CATALOGING';
             var mis_scan_msg = document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.status.copy_not_found', [params.barcode]);
-            var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popups'];
             if (!suppress_popups) {
                 error.yns_alert(
                     mis_scan_msg,
@@ -3515,7 +3516,6 @@ circ.util.checkin_via_barcode2 = function(session,params,backdate,auto_print,che
             sound.special('checkin.hold_capture_delayed');
             var rv = 0;
             msg += document.getElementById('circStrings').getString('staff.circ.utils.hold_capture_delayed.description');
-            var suppress_popups = data.hash.aous['ui.circ.suppress_checkin_popupst'];
             if (!suppress_popups) {
                 rv = error.yns_alert_formatted(
                     msg,