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);
55 "oncomplete": function() {
57 openils.Util.show("li_create_holder");
64 new openils.BibTemplate({
66 org_unit : fieldmapper.aou.findOrgUnit(openils.User.user.ws_ou()).shortname()
69 new openils.PermaCrud().retrieve('bre', targetId, {
70 oncomplete : function(r) {
71 bibRecord = openils.Util.readResponse(r);
73 // perhaps we just pull these from the beating heart of bibtemplate
78 function createLi(oncomplete) {
80 progressDialog.show();
82 fieldmapper.standardRequest(
83 ["open-ils.acq", "open-ils.acq.biblio.create_by_id"], {
85 openils.User.authtoken, [bibRecord.id()], {
87 "flesh_cancel_reason": true,
92 "onresponse": function(r) {
93 var li = openils.Util.readResponse(r);
94 if (typeof(li) == "object") {
96 liTable.addLineitem(li);
98 "input[name='selectbox']", liTable._findLiRow(li)
102 "oncomplete": function() {
103 progressDialog.hide();
104 openils.Util.hide("li_create_holder");
112 function prepareButtons() {
113 addToPlButton.onClick = createLi(
114 function() { /* oncomplete */
115 liTable._loadPLSelect(paramPL);
116 acqLitSavePlDialog.show();
119 createPoButton.onClick = createLi(
120 function() { /* oncomplete */
121 liTable._loadPOSelect();
122 acqLitPoCreateDialog.show();
128 var cgi = new openils.CGI();
130 identTarget = cgi.param('target');
131 paramPL = cgi.param('pl');
132 // paramPO = cgi.param('po');
134 if (identTarget == 'bib') {
140 liTable = new AcqLiTable();
142 liTable._isRelatedViewer = true;
148 openils.Util.addOnLoad(load);