From 92258bb571364461bd008d4db99341a0714a453a Mon Sep 17 00:00:00 2001 From: khuckins Date: Tue, 24 Nov 2015 17:34:16 -0500 Subject: [PATCH] KMAIN-1647 Auto-Inserting action notes on li cancel/receive. 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 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 --- .../perlmods/lib/OpenILS/Application/Acq/Order.pm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm index a89d122361..d15b548dbc 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm @@ -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 }, { -- 2.11.0