[open-ils-commits] r12460 - in trunk/Open-ILS/xul/staff_client: chrome/content/main server/cat server/locale/en-US (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Mar 6 18:42:12 EST 2009


Author: phasefx
Date: 2009-03-06 18:42:07 -0500 (Fri, 06 Mar 2009)
New Revision: 12460

Modified:
   trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
   trunk/Open-ILS/xul/staff_client/server/cat/util.js
   trunk/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties
Log:
option to checkin items before marking them damaged.  Need to make these prettier :)

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2009-03-06 22:18:29 UTC (rev 12459)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2009-03-06 23:42:07 UTC (rev 12460)
@@ -12,10 +12,10 @@
 
 const my_constants = {
 	'magical_statuses' : {
-		'1' : { 'disable_in_copy_editor' : true, 'block_mark_item_action' : true }, /* | Checked out    | t */
-		'3' : { 'disable_in_copy_editor' : true, 'block_mark_item_action' : true }, /* | Lost           | f */
-		'6' : { 'disable_in_copy_editor' : true, 'block_mark_item_action' : true }, /* | In transit     | t */
-		'8' : { 'disable_in_copy_editor' : true, 'block_mark_item_action' : false } /* | On holds shelf | t */
+		'1' : { 'disable_in_copy_editor' : true, 'block_mark_item_damaged' : false, 'block_mark_item_action' : true }, /* | Checked out    | t */
+		'3' : { 'disable_in_copy_editor' : true, 'block_mark_item_damaged' : false, 'block_mark_item_action' : true }, /* | Lost           | f */
+		'6' : { 'disable_in_copy_editor' : true, 'block_mark_item_damaged' : false, 'block_mark_item_action' : true }, /* | In transit     | t */
+		'8' : { 'disable_in_copy_editor' : true, 'block_mark_item_damaged' : false, 'block_mark_item_action' : false } /* | On holds shelf | t */
 	}
 }
 

Modified: trunk/Open-ILS/xul/staff_client/server/cat/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/util.js	2009-03-06 22:18:29 UTC (rev 12459)
+++ trunk/Open-ILS/xul/staff_client/server/cat/util.js	2009-03-06 23:42:07 UTC (rev 12460)
@@ -283,7 +283,7 @@
 		for (var i = 0; i < copies.length; i++) {
 			var status = copies[i].status(); if (typeof status == 'object') status = status.id();
 			if (typeof my_constants.magical_statuses[ status ] != 'undefined') 
-				if (my_constants.magical_statuses[ status ].block_mark_item_action) magic_status = true;
+				if (my_constants.magical_statuses[ status ].block_mark_item_damaged) magic_status = true;
 		}
 		if (magic_status) {
 		
@@ -304,6 +304,49 @@
 				var count = 0;
 				for (var i = 0; i < copies.length; i++) {
 					try {
+
+                        var my_circ = network.simple_request('FM_CIRC_RETRIEVE_VIA_COPY',[ses(),copies[i].id(),1]);
+                        if (typeof my_circ.ilsevent == 'undefined') { 
+                            JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
+                            my_circ = my_circ[0];
+                            if (typeof my_circ != 'undefined') {
+                                if (! my_circ.checkin_time() ) {
+                                    var due_date = my_circ.due_date() ? my_circ.due_date().substr(0,10) : null;
+                                    var auto_checkin = String( data.hash.aous['circ.auto_checkin_on_mark_damage'] ) == 'true';
+                                    JSAN.use('patron.util');
+                                    var patron_obj = patron.util.retrieve_fleshed_au_via_id( ses(), my_circ.usr() );
+                                    var patron_name = ( patron_obj.prefix() ? patron_obj.prefix() + ' ' : '') +
+                                        patron_obj.family_name() + ', ' +
+                                        patron_obj.first_given_name() + ' ' +
+                                        ( patron_obj.second_given_name() ? patron_obj.second_given_name() + ' ' : '' ) +
+                                        ( patron_obj.suffix() ? patron_obj.suffix() : '')
+                                        + ' : ' + patron_obj.card().barcode()
+                                    var msg = $("catStrings").getFormattedString('staff.cat.util.mark_item_damaged.item_circulating_to_patron', [ 
+                                        copies[i].barcode(),
+                                        patron_name,
+                                        my_circ.due_date().substr(0,10)]); // FIXME: need to replace date handling
+                                    JSAN.use('util.date'); var today = util.date.formatted_date(new Date(),'%F');
+                                    var r2 = auto_checkin ? 1 : error.yns_alert(
+                                        msg,
+                                        document.getElementById('catStrings').getString('staff.cat.util.mark_item_damaged.checkin.title'),
+                                        document.getElementById('catStrings').getString('staff.cat.util.mark_item_damaged.checkin.no_checkin'),
+                                        document.getElementById('catStrings').getString('staff.cat.util.mark_item_damaged.checkin.normal_checkin'),
+                                        due_date ? (today > due_date ? document.getElementById('catStrings').getString('staff.cat.util.mark_item_damaged.checkin.forgiving_checkin') : null) : null,
+                                        document.getElementById('catStrings').getString('staff.cat.util.mark_item_damaged.checkin.confirm_action')
+                                    );
+                                    JSAN.use('circ.util');
+                                    switch(r2) {
+                                        case 1:
+                                            circ.util.checkin_via_barcode( ses(), { 'barcode' : copies[i].barcode(), 'noop' : 1 } );
+                                        break;
+                                        case 2:
+                                            circ.util.checkin_via_barcode( ses(), { 'barcode' : copies[i].barcode(), 'noop' : 1 }, due_date );
+                                        break;
+                                    }
+                                }
+                            }
+                        }
+
 						var robj = network.simple_request('MARK_ITEM_DAMAGED',[ses(),copies[i].id()]);
 						if (typeof robj.ilsevent != 'undefined') {
                             switch(robj.textcode) {

Modified: trunk/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties	2009-03-06 22:18:29 UTC (rev 12459)
+++ trunk/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties	2009-03-06 23:42:07 UTC (rev 12460)
@@ -339,6 +339,12 @@
 staff.cat.util.mark_item_damaged.md_ok_label=OK
 staff.cat.util.mark_item_damaged.md_cancel_label=Cancel
 staff.cat.util.mark_item_damaged.md_confirm_action=Check here to confirm this action
+staff.cat.util.mark_item_damaged.checkin.title=Checkin Item Before Marking Damaged?
+staff.cat.util.mark_item_damaged.checkin.normal_checkin=Normal Checkin
+staff.cat.util.mark_item_damaged.checkin.no_checkin=Cancel
+staff.cat.util.mark_item_damaged.checkin.forgiving_checkin=Forgiving Checkin
+staff.cat.util.mark_item_damaged.checkin.confirm_action=Check here to confirm this action
+staff.cat.util.mark_item_damaged.item_circulating_to_patron=Item %1$s is checked out to patron, %2$s, and is due on %3$s. 
 staff.cat.util.mark_item_damaged.charge_patron_prompt.message=Item %1$s will be marked damaged.  Was returned on %3$s by %2$s.  Charge this patron $%4$s for the damage?
 staff.cat.util.mark_item_damaged.charge_patron_prompt.title=Charge Patron For Damaged Item?
 staff.cat.util.mark_item_damaged.charge_patron_prompt.ok_label=OK



More information about the open-ils-commits mailing list