}
__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
'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 },
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
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);