From 560412cb90a0b72f2b32d634e6ffbd069d0006e7 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 6 Apr 2009 16:28:02 +0000 Subject: [PATCH] plugged in mark-po-received action git-svn-id: svn://svn.open-ils.org/ILS/trunk@12800 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../web/js/ui/default/acq/common/li_table.js | 38 +++++++++++++++++-- .../templates/default/acq/common/li_table.tt2 | 6 ++- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/Open-ILS/web/js/ui/default/acq/common/li_table.js b/Open-ILS/web/js/ui/default/acq/common/li_table.js index 6145196cd7..e04faad6ca 100644 --- a/Open-ILS/web/js/ui/default/acq/common/li_table.js +++ b/Open-ILS/web/js/ui/default/acq/common/li_table.js @@ -447,19 +447,22 @@ function AcqLiTable() { case 'print_po': this.printPO(); break; + + case 'receive_po': + this.receivePO(); + break; } } this.printPO = function() { if(!this.isPO) return; - progressDialog.show(); - console.log("printing PO " + this.isPO); + progressDialogInd.show(); fieldmapper.standardRequest( ['open-ils.acq', 'open-ils.acq.purchase_order.format'], { async: true, params: [this.authtoken, this.isPO, 'html'], oncomplete: function(r) { - progressDialog.hide(); + progressDialogInd.hide(); var evt = openils.Util.readResponse(r); if(evt && evt.template_output()) { win = window.open('','', 'resizable,width=700,height=500,scrollbars=1'); @@ -470,6 +473,35 @@ function AcqLiTable() { ); } + + this.receivePO = function() { + if(!this.isPO) return; + progressDialog.show(); + var maximum = 1; + dojo.forEach(this.liCache, function(){maximum += 1; }); + dojo.forEach(this.copyCache, function(){maximum += 1; }); + fieldmapper.standardRequest( + ['open-ils.acq', 'open-ils.acq.purchase_order.receive'], + { async: true, + params: [this.authtoken, this.isPO], + onresponse : function(r) { + var stat = openils.Util.readResponse(r); + + // we don't know the total amount of items to be processed + // since we only have 1 page of data + if(stat.progress > maximum) maximum *= 2; + + progressDialog.update({maximum:maximum, progress:stat.progress}); + if(stat.complete) { + // XXX + location.href = location.href; + } + }, + } + ); + } + + this._createPO = function(fields) { this.show('acq-lit-create-po-progress'); var po = new fieldmapper.acqpo(); diff --git a/Open-ILS/web/templates/default/acq/common/li_table.tt2 b/Open-ILS/web/templates/default/acq/common/li_table.tt2 index f03a536cc6..5bad449686 100644 --- a/Open-ILS/web/templates/default/acq/common/li_table.tt2 +++ b/Open-ILS/web/templates/default/acq/common/li_table.tt2 @@ -19,6 +19,7 @@ +