[open-ils-commits] r12800 - in trunk/Open-ILS/web: js/ui/default/acq/common templates/default/acq/common (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Apr 6 12:28:08 EDT 2009


Author: erickson
Date: 2009-04-06 12:28:02 -0400 (Mon, 06 Apr 2009)
New Revision: 12800

Modified:
   trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js
   trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2
Log:
plugged in mark-po-received action

Modified: trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js	2009-04-06 16:27:27 UTC (rev 12799)
+++ trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js	2009-04-06 16:28:02 UTC (rev 12800)
@@ -447,19 +447,22 @@
             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 @@
         );
     }
 
+
+    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();

Modified: trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2	2009-04-06 16:27:27 UTC (rev 12799)
+++ trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2	2009-04-06 16:28:02 UTC (rev 12800)
@@ -19,6 +19,7 @@
                                             <option value='order_ready'>Mark Ready for Order</option>
                                             <option value='create_order'>Create Purchase Order</option>
                                             <option value='print_po'>Print Purchase Order</option>
+                                            <option value='receive_po'>Mark Purchase Order as Received</option>
                                         </select>
                                     </span>
                                     <span id='acq-lit-generic-progress' class='hidden'>
@@ -252,7 +253,10 @@
         </table>
     </div>
 
-    <div class='hidden'><div dojoType='openils.widget.ProgressDialog' jsId='progressDialog' indeterminate='true'/></div>
+    <div class='hidden'>
+        <div dojoType='openils.widget.ProgressDialog' jsId='progressDialog'/>
+        <div dojoType='openils.widget.ProgressDialog' jsId='progressDialogInd' indeterminate='true'/>
+    </div>
 
 </div>
 



More information about the open-ils-commits mailing list