From: Bill Erickson Date: Wed, 21 May 2014 21:36:25 +0000 (-0400) Subject: bill patron dialog cont; sorta working X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6544564d43cde16608cc7972a9e10ff851ebbd3e;p=working%2FEvergreen.git bill patron dialog cont; sorta working Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js b/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js index 8fabfa85df..8aefec43a6 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/bills.js @@ -56,6 +56,44 @@ function($q , egCore , patronSvc) { }); } + service.billPatron = function(args) { + var groc = new egCore.idl.mg(); + groc.billing_location(egCore.auth.user().ws_ou()); + groc.note(args.note); + groc.usr(patronSvc.current.id()); + + // create the xact + return egCore.net.request( + 'open-ils.circ', + 'open-ils.circ.money.grocery.create', + egCore.auth.token(), groc + + // create the billing on the new xact + ).then(function(xact_id) { + if (evt = egCore.evt.parse(xact_id)) + return alert(evt); + + var bill = new egCore.idl.mb(); + bill.xact(xact_id); + bill.amount(args.amount); + bill.btype(args.billingType); + bill.billing_type(egCore.env.cbt.map[args.billingType].name()); + bill.note(args.note); + + return egCore.net.request( + 'open-ils.circ', + 'open-ils.circ.money.billing.create', + egCore.auth.token(), bill + ); + + // check the billing response + }).then(function(bill_id) { + if (evt = egCore.evt.parse(bill_id)) + return alert(evt); + + }); + } + return service; }]) @@ -230,8 +268,12 @@ function($scope, $q , $routeParams, $locale , egCore , egGridDataProvider , bi } }).result.then( function(args) { - console.log('BILL: ' + JSON.stringify(args)); - //billSvc.billPatron(args); + // send the billing to the server using the arguments + // provided in the billing dialog, then refresh + billSvc.billPatron(args).then(function() { + $scope.payment_amount = 0; + $scope.gridRevision++; + }); } ); }