From: Bill Erickson Date: Wed, 29 Oct 2014 21:10:11 +0000 (-0400) Subject: KMAIN-1317 Line Item Note Display X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=3b8f2c3ba04dcfc06ee709ffef3fe29d6a5169ae;p=working%2FEvergreen.git KMAIN-1317 Line Item Note Display Cross-port: edb4fe8 --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem.pm index af491b6c68..19ce965e90 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem.pm @@ -880,6 +880,34 @@ sub get_lineitem_attr_defs { __PACKAGE__->register_method( + method => 'get_lineitem_notes_by_id', + api_name => 'open-ils.acq.get_lineitem_notes_by_id', + signature => { + desc => 'Retrieve lineitem notes by id', + params => [ + { desc => 'Authentication token', type => 'string' }, + { desc => 'Id of lineitem to retrive notes for', type => 'number'}, + ], + return => + { desc => 'List of notes sorted by edit date' } + } +); + +sub get_lineitem_notes_by_id { + my($self, $conn, $auth, $lineitem_id) = @_; + + my $editor = new_editor(authtoken => $auth); + my $results = $editor->json_query({ + 'select' => { 'acqlin' => ['value', 'edit_time'] }, + 'from' => 'acqlin', + 'where' => { lineitem => $lineitem_id }, + 'order_by' => [{ 'class'=>'acqlin', 'field'=>'edit_time', 'direction'=>'desc' }] + }); + + return $results; +} + +__PACKAGE__->register_method( method => 'lineitem_note_CUD_batch', api_name => 'open-ils.acq.lineitem_note.cud.batch', stream => 1, diff --git a/Open-ILS/xul/staff_client/chrome/content/main/constants.js b/Open-ILS/xul/staff_client/chrome/content/main/constants.js index 96100b4238..8f0f14f089 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -87,6 +87,7 @@ var api = { 'FM_ACN_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.callnumber.fleshed.retrieve', 'secure' : false }, 'FM_ACN_RETRIEVE.authoritative' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.callnumber.fleshed.retrieve.authoritative', 'secure' : false }, 'FM_OPEN_LI_RETRIEVE_BY_TCN' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.lineitem.latest_by_tcn', 'secure' : false }, + 'FM_LI_NOTES_RETRIEVE_BY_ID' : { 'app' : 'open-ils.acq', 'method' : 'open-ils.acq.get_lineitem_notes_by_id', 'secure' : false }, 'FM_OPEN_LI_RETRIEVE_BY_ID' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.lineitem.lineitem_by_id', 'secure' : false }, 'FM_CUD_LI_NOTE' : { 'app' : 'open-ils.acq', 'method' : 'open-ils.acq.lineitem_note.cud.batch', 'secure' : false }, 'FM_ACN_TREE_UPDATE' : { 'app' : 'open-ils.cat', 'method' : 'open-ils.cat.asset.volume.fleshed.batch.update' }, diff --git a/Open-ILS/xul/staff_client/server/cat/update_items.js b/Open-ILS/xul/staff_client/server/cat/update_items.js index 9f102749f5..b2255ae663 100644 --- a/Open-ILS/xul/staff_client/server/cat/update_items.js +++ b/Open-ILS/xul/staff_client/server/cat/update_items.js @@ -57,7 +57,7 @@ function my_init() { 'FM_OPEN_LI_RETRIEVE_BY_TCN', [ ses(), xul_param('doc_id') ] ); - + // Create the list of lineitems g.lineitem_list = raw_lineitem_data[0][0]; @@ -76,6 +76,8 @@ function my_init() { g.render_batch_button(); g.render_lineitem_dropdown(); + + g.load_and_render_lineitem_notes(g.lineitem_list[g.current_lineitem_index][0]); /***********************************************************************************************************/ /* What record am I dealing with? */ @@ -201,6 +203,32 @@ function my_init() { } } +g.load_and_render_lineitem_notes = function(lineitem_id) { + // Fetch the notes from the DB + var line_item_notes = g.network.simple_request( + 'FM_LI_NOTES_RETRIEVE_BY_ID', + [ ses(), lineitem_id ] + ); + + var rows = document.getElementById('lineitem_rows'); + + // Remove existing notes + var row_list = rows.childNodes; + while(row_list.length > 1) { + rows.removeChild(row_list[1]); + } + + // Render the notes + for(var index = 0; index < line_item_notes.length; ++index) { + var r = document.createElement('row'); rows.appendChild( r ); + var x = document.createElement('label'); r.appendChild(x); + x.setAttribute('value', line_item_notes[index].edit_time.substring(0,10)); + x = document.createElement('spacer'); r.appendChild(x); + x = document.createElement('label'); r.appendChild(x); + x.setAttribute('value', line_item_notes[index].value); + } +} + g.load_lineitem = function(raw_lineitem_data){ var raw_data = raw_lineitem_data[0][1]; @@ -1496,6 +1524,7 @@ g.render_lineitem_dropdown = function() { g.current_lineitem_index = menulist.getIndexOfItem( menulist.selectedItem ); g.reset_lineitem(); + g.load_and_render_lineitem_notes(g.lineitem_list[g.current_lineitem_index][0]); g.summarize( g.existing_copies ); g.render_edit_items_panes(); }, diff --git a/Open-ILS/xul/staff_client/server/cat/update_items.xul b/Open-ILS/xul/staff_client/server/cat/update_items.xul index 9b83d17a95..600a892518 100644 --- a/Open-ILS/xul/staff_client/server/cat/update_items.xul +++ b/Open-ILS/xul/staff_client/server/cat/update_items.xul @@ -116,6 +116,15 @@ + + + + + + + + +