[open-ils-commits] r11821 - in trunk/Open-ILS: src/perlmods/OpenILS/Application xul/staff_client/chrome/content/main xul/staff_client/server/locale/en-US xul/staff_client/server/patron

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Jan 13 19:37:24 EST 2009


Author: phasefx
Date: 2009-01-13 19:37:24 -0500 (Tue, 13 Jan 2009)
New Revision: 11821

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
   trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
   trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
   trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.js
Log:
update functionality for notes on user standing penalties

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm	2009-01-13 22:48:58 UTC (rev 11820)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm	2009-01-14 00:37:24 UTC (rev 11821)
@@ -2772,6 +2772,28 @@
 }
 
 __PACKAGE__->register_method(
+	method	=> "update_penalty_note",
+	api_name	=> "open-ils.actor.user.penalty.note.update");
+
+sub update_penalty_note {
+	my($self, $conn, $auth, $penalty_ids, $note) = @_;
+	my $e = new_editor(authtoken=>$auth, xact => 1);
+	return $e->die_event unless $e->checkauth;
+    for my $penalty_id (@$penalty_ids) {
+        my $penalty = $e->search_actor_user_standing_penalty( { id => $penalty_id } )->[0];
+        if (! $penalty ) { return $e->die_event; }
+        my $user = $e->retrieve_actor_user($penalty->usr) or return $e->die_event;
+        return $e->die_event unless $e->allowed('UPDATE_USER', $user->home_ou);
+
+        $penalty->note( $note ); $penalty->ischanged( 1 );
+
+        $e->update_actor_user_standing_penalty($penalty) or return $e->die_event;
+    }
+    $e->commit;
+    return 1;
+}
+
+__PACKAGE__->register_method(
 	method => "ranged_penalty_thresholds",
 	api_name => "open-ils.actor.grp_penalty_threshold.ranged.retrieve",
     stream => 1

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2009-01-13 22:48:58 UTC (rev 11820)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2009-01-14 00:37:24 UTC (rev 11821)
@@ -136,6 +136,7 @@
 	'FM_AUS_UPDATE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.patron.settings.update' },
 	'FM_AUSP_APPLY' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.penalty.apply' },
 	'FM_AUSP_REMOVE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.penalty.remove' },
+	'FM_AUSP_UPDATE_NOTE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.penalty.note.update' },
 	'FM_BRE_RETRIEVE_VIA_ID' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.metadata.retrieve', 'secure' : false },
 	'FM_BRE_RETRIEVE_VIA_ID.authoritative' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.biblio.record.metadata.retrieve.authoritative', 'secure' : false },
 	'FM_BRE_ID_SEARCH_VIA_BARCODE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.find_by_barcode', 'secure' : false },

Modified: trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties	2009-01-13 22:48:58 UTC (rev 11820)
+++ trunk/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties	2009-01-14 00:37:24 UTC (rev 11821)
@@ -246,6 +246,10 @@
 staff.patron.standing_penalty.note_title=Apply Penalty
 staff.patron.standing_penalty.apply_error=Error applying %1$s block/standing penalty.
 staff.patron.standing_penalty.remove_error=Error removing %1$s block/standing penalty.
+staff.patron.standing_penalty.update_error=Error updating block/standing penalty.
+staff.patron.standing_penalty.note_prompt.title=Edit Block/Standing Penalty Note
+staff.patron.standing_penalty.note_prompt.singular=Enter note for selected block/standing penalty:
+staff.patron.standing_penalty.note_prompt.plural=Enter note for selected blocks/standing penalties:
 staff.patron.ue.uEditInit.session_no_defined=User session is not defined
 staff.patron.ue.uEditSaveuser.error_creating_note=Error creating patron guardian or parent note
 staff.patron.ue.uEditShowSearch.search=Search would be:\n%1$s

Modified: trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.js	2009-01-13 22:48:58 UTC (rev 11820)
+++ trunk/Open-ILS/xul/staff_client/server/patron/standing_penalties.js	2009-01-14 00:37:24 UTC (rev 11821)
@@ -165,7 +165,46 @@
             false
         );
 
+        document.getElementById('cmd_edit_penalty').addEventListener(
+            'command',
+            function() {
+                var sel = list.retrieve_selection();
+                var ids = util.functional.map_list( sel, function(o) { return JSON2js( o.getAttribute('retrieve_id') ); } );
+                if (ids.length > 0) {
+                    var note = window.prompt(
+                        patronStrings.getString( 'staff.patron.standing_penalty.note_prompt.' + (ids.length == 1 ? 'singular' : 'plural') ),
+                        '',
+                        patronStrings.getString( 'staff.patron.standing_penalty.note_prompt.title' )
+                    );
+                    if (note == null) { return; } /* cancel */
+                    for (var i = 0; i < ids.length; i++) {
+                        var penalty = util.functional.find_list( xulG.patron.standing_penalties(), function(o) { return o.id() == ids[i]; } );
+                        penalty.note( note ); /* this is for rendering, and propogates by reference to the object associated with the row in the GUI */
+                    } 
+                    document.getElementById('progress').hidden = false;
+                    net.simple_request( 
+                        'FM_AUSP_UPDATE_NOTE', [ ses(), ids, note ],
+                        function(reqObj) {
+                            var req = reqObj.getResultObject();
+                            if (typeof req.ilsevent != 'undefined' || String(req) != '1') {
+                                error.standard_unexpected_error_alert(patronStrings.getString('staff.patron.standing_penalty.update_error'),req);
+                            } else {
+                                for (var i = 0; i < ids.length; i++) {
+                                    list.refresh_row( rows[ ids[i] ] );
+                                }
+                            }
+                            if (xulG && typeof xulG.refresh == 'function') {
+                                xulG.refresh();
+                            }
+                            document.getElementById('progress').hidden = true;
+                        }
+                    );
+                }
+            },
+            false
+        );
 
+
     } catch(E) {
         alert(E);
     }



More information about the open-ils-commits mailing list