From: Llewellyn Marshall Date: Wed, 8 Mar 2023 18:56:23 +0000 (-0500) Subject: gui for reset reason entries X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Flew%2Fretargeter-hold-notes-3-9-1;p=working%2FEvergreen.git gui for reset reason entries fixed perms on fm_idl for ahrrre and order by statement in hold.js added limit of 500 notes. --- diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 0f22734acd..bd3b786b97 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -6811,6 +6811,7 @@ SELECT usr, + @@ -6846,6 +6847,7 @@ SELECT usr, + @@ -15429,15 +15431,20 @@ SELECT usr, - + + + + + + - + @@ -15451,10 +15458,17 @@ SELECT usr, - - - + + + + + + + + + + diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm index e16f44e4e3..ad16c356e7 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm @@ -2245,7 +2245,7 @@ __PACKAGE__->register_method( sub create_reset_reason_entry { - my($self, $conn, $auth, $hold, $reset_reason, $note) = @_; + my($self, $conn, $auth, $hold, $reset_reason, $note, $previous_copy) = @_; my $e = new_editor(authtoken => $auth, xact => 1); #checkauth to set the requestor (if available) $e->checkauth; @@ -2259,7 +2259,13 @@ sub create_reset_reason_entry for my $holdid (@holds){ try{ my ($hold, $evt) = $U->fetch_hold($holdid); - _create_reset_reason_entry($e, $hold, $reset_reason, $note) unless $evt; + _create_reset_reason_entry( + $e, + $hold, + $reset_reason, + $note, + $previous_copy) + unless $evt; } catch Error with{ $logger->error("holds: create reset reason failed with ".shift()); @@ -2280,7 +2286,7 @@ sub _create_reset_reason_entry $entry->reset_reason($reset_reason); $entry->reset_time('now'); $entry->previous_copy($last_copy); - $entry->note($note); + $entry->note($note) if defined $note; $entry->requestor($e->requestor->id) if defined $e->requestor; $entry->requestor_workstation($e->requestor->wsid) if defined $e->requestor; $e->create_action_hold_request_reset_reason_entry($entry) or return $e->die_event; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/HoldTargeter.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/HoldTargeter.pm index 730501539c..ad7ed5b88c 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/HoldTargeter.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/HoldTargeter.pm @@ -109,8 +109,11 @@ sub hold_targeter { $single->editor()->authtoken, $hold_id, OILS_HOLD_TIMED_OUT, + undef, $single->{previous_copy_id} - ) unless defined $args->{hold}; + ) unless defined + $args->{hold} || + $single->{previous_copy_id} == $single->hold->current_copy; } catch Error with { $logger->error( "hold-targeter: create reset reason failed with ".shift() diff --git a/Open-ILS/src/sql/Pg/upgrade/xxxx.hold_reset_reasons.sql b/Open-ILS/src/sql/Pg/upgrade/xxxx.hold_reset_reasons.sql index 1de4750d59..0f8e2941d5 100644 --- a/Open-ILS/src/sql/Pg/upgrade/xxxx.hold_reset_reasons.sql +++ b/Open-ILS/src/sql/Pg/upgrade/xxxx.hold_reset_reasons.sql @@ -53,6 +53,8 @@ WITH ( OIDS=FALSE ); +CREATE INDEX ahrrre_hold ON action.hold_request_reset_reason_entry (hold); + INSERT INTO config.global_flag (name, label, enabled) VALUES ( 'circ.holds.retarget_previous_targets_interval', diff --git a/Open-ILS/src/templates/staff/circ/share/t_hold_details.tt2 b/Open-ILS/src/templates/staff/circ/share/t_hold_details.tt2 index ece4719944..76d540b5de 100644 --- a/Open-ILS/src/templates/staff/circ/share/t_hold_details.tt2 +++ b/Open-ILS/src/templates/staff/circ/share/t_hold_details.tt2 @@ -71,6 +71,11 @@ [% l('Staff Notifications') %] +
  • + + [% l('Reset Entries') %] + +
  • @@ -122,13 +127,44 @@
    +
    + + + + + + + + + +
    + ng-repeat="notify in filteredResets">
    {{notify.method()}}
    @@ -152,6 +188,76 @@
    + +
    +
    + + + + + + + + + + + + +
    +
    + [% l("Search In Progress") %] +
    +
    +
    +
    Time
    +
    Reason
    +
    Requestor
    +
    Note
    +
    Previous Copy
    +
    +
    +
    {{reset.reset_time() | date:$root.egDateAndTimeFormat}}
    +
    {{reset.reset_reason().name()}}
    +
    {{reset.requestor().usrname()}}
    +
    {{reset.note()}}
    + +
    +
    +
    +
    + [%- l('No reset entries found for this hold.') -%] +
    +
    +
    diff --git a/Open-ILS/web/js/ui/default/staff/circ/services/holds.js b/Open-ILS/web/js/ui/default/staff/circ/services/holds.js index 251ceb216e..3cfd3b1e1e 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/services/holds.js +++ b/Open-ILS/web/js/ui/default/staff/circ/services/holds.js @@ -815,7 +815,7 @@ function($window , $location , $timeout , egCore , egHolds , egCirc) { // if set, called whenever hold details are retrieved. The // argument is the hold blob returned from hold.details.retrieve holdRetrieved : '=', - showPatron : '=' + showPatron : '=', }, controller : [ '$scope','$uibModal','egCore','egHolds','egCirc', @@ -858,7 +858,85 @@ function($window , $location , $timeout , egCore , egHolds , egCirc) { }); } + + $scope.resetPage = 1; + $scope.resetsPerPage = 10; + $scope.maximumPages = 25; + $scope.resetsLoaded = false; + $scope.reverseResetOrder = false; + + $scope.show_resets_tab = function() { + $scope.detail_tab = 'resets'; + egCore.pcrud.search('ahrrre', + {hold : $scope.hold.id()}, + { + flesh : 1, + flesh_fields : {ahrrre : ['reset_reason','requestor','previous_copy']}, + limit : $scope.resetsPerPage * $scope.maximumPages + }, + {atomic : true} + ).then(function(ents) { + // sort the reset notes by date + ents.sort( + function(a,b){ + return Date.parse(a.reset_time()) - Date.parse(b.reset_time()); + } + ); + $scope.hold.reset_entries(ents); + $scope.filter_resets(); + $scope.resetsLoaded = true; + }); + } + + $scope.filter_resets = function(){ + if( + typeof($scope.hold) === 'undefined' || + typeof($scope.hold.reset_entries) === 'undefined' || + $scope.hold.reset_entries() === null + ) + return; + var begin = (($scope.resetPage - 1) * $scope.resetsPerPage), + end = begin + $scope.resetsPerPage; + $scope.filteredResets = $scope.hold + .reset_entries() + .slice(begin,end); + } + + $scope.reverse_reset_order = function(){ + $scope.hold.reset_entries().reverse() + $scope.reverseResetOrder = !$scope.reverseResetOrder; + $scope.first_rs_page(); + } + + $scope.on_first_rs_page = function(){ + return $scope.resetPage == 1; + } + + $scope.has_next_rs_page = function(){ + return $scope.resetPage < $scope.max_rs_pages(); + } + + $scope.max_rs_pages = function(){ + if(typeof($scope.hold.reset_entries) === 'undefined' || $scope.hold.reset_entries() === null) + return 0; + return $scope.hold.reset_entries().length/$scope.resetsPerPage; + } + + $scope.first_rs_page = function() { + $scope.resetPage = 1; + } + + $scope.increment_rs_page = function() { + $scope.resetPage++; + } + $scope.decrement_rs_page = function() { + $scope.resetPage--; + } + + $scope.$watch('resetPage',$scope.filter_resets); + $scope.$watch('reverseResetOrder',$scope.filter_resets); + $scope.show_notify_tab = function() { $scope.detail_tab = 'notify'; egCore.pcrud.search('ahn',