my $li;
- if($$options{flesh_attrs}) {
- $li = $e->retrieve_acq_lineitem([
- $li_id, {flesh => 1, flesh_fields => {jub => ['attributes']}}])
- or return $e->event;
- } else {
- $li = $e->retrieve_acq_lineitem($li_id) or return $e->event;
+ my $flesh = {};
+ if($$options{flesh_attrs} or $$options{flesh_notes}) {
+ $flesh = {flesh => 1, flesh_fields => {jub => []}};
+ push(@{$flesh->{flesh_fields}->{jub}}, 'lineitem_notes') if $$options{flesh_notes};
+ push(@{$flesh->{flesh_fields}->{jub}}, 'attributes') if $$options{flesh_attrs};
}
+ $li = $e->retrieve_acq_lineitem([$li_id, $flesh]);
+
if($$options{flesh_li_details}) {
my $ops = {
flesh => 1,
"idlist", return a list of IDs instead of objects
"flesh_attrs", additionaly return the list of flattened attributes
"clear_marc", discards the raw MARC data to reduce data size
+ "flesh_notes", flesh lineitem notes
/,
type => 'hash'}
],
}
my $entry;
- my $flesh = ($$options{flesh_attrs}) ?
- {flesh => 1, flesh_fields => {jub => ['attributes']}} : {};
+ my $flesh = {};
+ if($$options{flesh_attrs} or $$options{flesh_notes}) {
+ $flesh = {flesh => 1, flesh_fields => {jub => []}};
+ push(@{$flesh->{flesh_fields}->{jub}}, 'lineitem_notes') if $$options{flesh_notes};
+ push(@{$flesh->{flesh_fields}->{jub}}, 'attributes') if $$options{flesh_attrs};
+ }
$entry = $e->retrieve_acq_lineitem([$id, $flesh]);
my $details = $e->search_acq_lineitem_detail({lineitem => $id}, {idlist=>1});
this.addLineitem = function(li) {
this.liCache[li.id()] = li;
+ if(!li.lineitem_notes()) li.lineitem_notes([]);
var liWrapper = new openils.acq.Lineitem({lineitem:li});
var row = self.rowTemplate.cloneNode(true);
row.setAttribute('li', li.id());
dojo.query('[attr=title]', row)[0].onclick = function() {self.drawInfo(li.id())};
dojo.query('[name=copieslink]', row)[0].onclick = function() {self.drawCopies(li.id())};
- dojo.query('[name=count]', row)[0].appendChild(document.createTextNode(li.item_count()));
+ dojo.query('[name=count]', row)[0].innerHTML = li.item_count();
+ dojo.query('[name=notes_count]', row)[0].innerHTML = li.lineitem_notes().length;
+ dojo.query('[name=noteslink]', row)[0].onclick = function() {self.drawLiNotes(li)};
var priceInput = dojo.query('[name=estimated_price]', row)[0];
var priceData = liWrapper.getPrice();
self.selectors.push(dojo.query('[name=selectbox]', row)[0]);
};
- self.updateLiPrice = function(input, li) {
+ this.drawLiNotes = function(li) {
+ }
+
+ this.updateLiPrice = function(input, li) {
var price = input.value;
var liWrapper = new openils.acq.Lineitem({lineitem:li});
['open-ils.acq', 'open-ils.acq.lineitem.picklist.retrieve'],
{ async: true,
params: [openils.User.authtoken, plId,
- {flesh_attrs:true, clear_marc:true, offset:plOffset, limit:plLimit}],
+ {flesh_notes:true, flesh_attrs:true, clear_marc:true, offset:plOffset, limit:plLimit}],
onresponse: function(r) {
liTable.show('list');
liTable.addLineitem(openils.Util.readResponse(r));
fieldmapper.standardRequest(
['open-ils.acq', 'open-ils.acq.lineitem.search'],
{ async: true,
- params: [openils.User.authtoken, {purchase_order:poId}, {flesh_attrs:true}],
+ params: [openils.User.authtoken, {purchase_order:poId}, {flesh_attrs:true, flesh_notes:true}],
onresponse: function(r) {
liTable.show('list');
liTable.addLineitem(openils.Util.readResponse(r));
<td><span><a id='acq-lit-select-toggle' href='javascript:void(0);'>✓</a></span></td>
<td>Line Items</td>
<td>Estimated Price</td>
- <td>Copies</td>
+ <td>Items</td>
+ <td>Notes</td>
</tr>
</tbody>
<tbody id='acq-lit-tbody'>
<input type='text' size='8' name='estimated_price'/>
</td>
<td>
- <a name='copieslink' href='javascript:void(0);'
- style='margin-right:20px;'>Copies(<span name='count'></span>)</a>
+ <a name='copieslink' href='javascript:void(0);'>Copies(<span name='count'>0</span>)</a>
+ </td>
+ <td>
+ <a name='noteslink' href='javascript:void(0);'
+ style='margin-right:15px;'>Notes(<span name='notes_count'>0</span>)</a>
</td>
</tr>
</tbody>