1 dojo.require("openils.acq.Lineitem");
2 dojo.require("openils.Util");
3 dojo.require("openils.XUL");
4 dojo.require("openils.CGI");
5 dojo.require("openils.PermaCrud");
6 dojo.require('openils.BibTemplate');
7 dojo.require('fieldmapper.OrgUtils');
16 fieldmapper.standardRequest(
17 ["open-ils.acq", "open-ils.acq.lineitem.retrieve"], {
19 "params": [openils.User.authtoken, targetId, {
21 "flesh_li_details": true,
22 "flesh_fund_debit": true,
23 "flesh_cancel_reason": true
25 "oncomplete": function(r) {
33 function fetchRelated() {
34 var method = 'open-ils.acq.lineitems_for_bib.by_lineitem_id';
35 if(identTarget == 'bib')
36 var method = 'open-ils.acq.lineitems_for_bib.by_bib_id';
39 fieldmapper.standardRequest(
40 ["open-ils.acq", method], {
42 "params": [openils.User.authtoken, targetId, {
45 "flesh_cancel_reason": true
47 "onresponse": function(r) {
48 var resp = openils.Util.readResponse(r);
52 liTable.addLineitem(resp);
60 new openils.BibTemplate({
62 org_unit : fieldmapper.aou.findOrgUnit(openils.User.user.ws_ou()).shortname()
65 new openils.PermaCrud().retrieve('bre', targetId, {
66 oncomplete : function(r) {
67 bibRecord = openils.Util.readResponse(r);
69 // perhaps we just pull these from the beating heart of bibtemplate
74 function createLi(oncomplete) {
76 progressDialog.show();
78 fieldmapper.standardRequest(
79 ["open-ils.acq", "open-ils.acq.biblio.create_by_id"], {
81 openils.User.authtoken, [bibRecord.id()], {
83 "flesh_cancel_reason": true,
88 "onresponse": function(r) {
89 var li = openils.Util.readResponse(r);
90 if (typeof(li) == "object") {
92 liTable.addLineitem(li);
94 "input[name='selectbox']", liTable._findLiRow(li)
98 "oncomplete": function() {
99 progressDialog.hide();
107 function prepareButtons() {
108 addToPlButton.onClick = createLi(
109 function() { /* oncomplete */
110 liTable._loadPLSelect(paramPL);
111 acqLitSavePlDialog.show();
114 createPoButton.onClick = createLi(
115 function() { /* oncomplete */
116 liTable._loadPOSelect();
117 acqLitPoCreateDialog.show();
123 var cgi = new openils.CGI();
125 identTarget = cgi.param('target');
126 paramPL = cgi.param('pl');
127 // paramPO = cgi.param('po');
129 if (identTarget == 'bib') {
135 liTable = new AcqLiTable();
137 liTable._isRelatedViewer = true;
143 openils.Util.addOnLoad(load);