__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,
'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' },
'FM_OPEN_LI_RETRIEVE_BY_TCN',
[ ses(), xul_param('doc_id') ]
);
-
+
// Create the list of lineitems
g.lineitem_list = raw_lineitem_data[0][0];
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? */
}
}
+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];
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();
},
<vbox id="right_pane" flex="1"/>
</vbox>
</hbox>
+ <splitter><grippy /></splitter>
+ <hbox flex="1" style="overflow: scroll">
+ <grid flex="1">
+ <columns> <column/><column/><column/></columns>
+ <rows id="lineitem_rows">
+ <row><caption id="caption" label="Line Item Notes"/></row>
+ </rows>
+ </grid>
+ </hbox>
</groupbox>
</groupbox>
<hbox style="border-bottom: solid black thin">