KMAIN-1647 Auto-Inserting action notes on li cancel/receive.
authorkhuckins <khuckins@catalystdevworks.com>
Tue, 24 Nov 2015 22:34:16 +0000 (17:34 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
When a lineitem is marked as recieved, add a note to it
in the format of "REC: [username]"

When a lineitem is cancelled, add a note it it in the
format of "cancelled [username]"

Signed-off-by: khuckins <khuckins@catalystdevworks.com>
modified:   Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
modified:   Open-ILS/web/js/ui/kcls/acq/common/li_table.js

Modified by Bill:

* Support batch lineitem cancel note creation.
* Support all forms of lineitem receiving.
* Make note format consistent with (pending) printed and invoiced notes
* Removed dates from notes, since notes already show their creation date.
* Removed any changes to li_table.js (pending future Perl changes).

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm

index a89d122..d15b548 100644 (file)
@@ -647,6 +647,17 @@ sub receive_lineitem {
 
     $li->clear_cancel_reason; # un-cancel on receive
 
+    # KCLS ---
+    # Creates a note for each line item marked as received
+    my $e = $mgr->editor;
+    my $note = Fieldmapper::acq::lineitem_note->new;
+    $note->lineitem($li_id);
+    $note->creator($e->requestor->id);
+    $note->editor($e->requestor->id);
+    $note->value('received: ' . $e->requestor->usrname);
+    $e->create_acq_lineitem_note($note) or return $e->die_event;
+    # ---
+
     my $lid_ids = $mgr->editor->search_acq_lineitem_detail(
         {lineitem => $li_id, recv_time => undef}, {idlist => 1});
 
@@ -2350,6 +2361,7 @@ sub receive_lineitem_batch_api {
         );
 
         receive_lineitem($mgr, $li_id) or return $e->die_event;
+       
         $mgr->respond;
     }
 
@@ -3210,6 +3222,16 @@ sub cancel_lineitem {
     $li->state("cancelled");
     $li->cancel_reason($cancel_reason->id);
 
+    # KCLS add cancelation note ------
+    my $e = $mgr->editor;
+    my $note = Fieldmapper::acq::lineitem_note->new;
+    $note->lineitem($li->id);
+    $note->creator($e->requestor->id);
+    $note->editor($e->requestor->id);
+    $note->value('canceled: ' . $e->requestor->usrname);
+    $e->create_acq_lineitem_note($note) or return 0;
+    # ------------
+
     my $lids = $mgr->editor->search_acq_lineitem_detail([{
         "lineitem" => $li_id
     }, {