[open-ils-commits] r16778 - in trunk/Open-ILS: web/js/dojo/openils/widget web/js/ui/default/acq/po web/opac/locale/en-US web/templates/default/acq/po xul/staff_client/chrome/content/main xul/staff_client/chrome/locale/en-US (senator)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Jun 22 13:07:42 EDT 2010


Author: senator
Date: 2010-06-22 13:07:38 -0400 (Tue, 22 Jun 2010)
New Revision: 16778

Added:
   trunk/Open-ILS/web/js/ui/default/acq/po/create.js
   trunk/Open-ILS/web/templates/default/acq/po/create.tt2
Modified:
   trunk/Open-ILS/web/js/dojo/openils/widget/EditPane.js
   trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
   trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js
   trunk/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul
   trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
Log:
Acq: add a Create PO interface for workflows starting with new, blank POs


Modified: trunk/Open-ILS/web/js/dojo/openils/widget/EditPane.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/EditPane.js	2010-06-22 16:39:46 UTC (rev 16777)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/EditPane.js	2010-06-22 17:07:38 UTC (rev 16778)
@@ -204,7 +204,6 @@
             },
 
             performEditAction : function(opts) {
-                var pcrud = new openils.PermaCrud();
                 var fields = this.getFields();
                 if(this.mode == 'create')
                     this.fmObject = new fieldmapper[this.fmClass]();
@@ -212,7 +211,11 @@
                     this.fmObject[fields[idx]](this.getFieldValue(fields[idx]));
                 if(this.mode == 'create' && this.fmIDL.pkey_sequence)
                     this.fmObject[this.fmIDL.pkey](null);
-                pcrud[this.mode](this.fmObject, opts);
+                if (typeof(this.onSubmit) == "function") {
+                    this.onSubmit(this.fmObject);
+                } else {
+                    (new openils.PermaCrud())[this.mode](this.fmObject, opts);
+                }
             }
         }
     );

Added: trunk/Open-ILS/web/js/ui/default/acq/po/create.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/po/create.js	                        (rev 0)
+++ trunk/Open-ILS/web/js/ui/default/acq/po/create.js	2010-06-22 17:07:38 UTC (rev 16778)
@@ -0,0 +1,54 @@
+dojo.require("openils.widget.EditDialog");
+dojo.require("openils.widget.EditPane");
+
+var editDialog;
+
+function toPoListing() {
+    location.href = oilsBasePath + "/acq/search/unified?ca=po";
+}
+
+function toOnePo(id) {
+    location.href = oilsBasePath + "/acq/po/view/" + id;
+}
+
+openils.Util.addOnLoad(
+    function() {
+        editDialog = new openils.widget.EditDialog({
+            "editPane": new openils.widget.EditPane({
+                "fmObject": new acqpo(),
+                /* After realizing how many fields should be excluded from this
+                 * interface because users shouldn't set them arbitrarily,
+                 * it hardly seems like using these Edit widgets gives much
+                 * much advantage over a hardcoded interface. */
+                "suppressFields": [
+                    "create_time", "edit_time", "editor", "order_date",
+                    "owner", "cancel_reason", "creator", "state", "name"
+                ],
+                "fieldOrder": ["ordering_agency", "provider"],
+                "mode": "create",
+                "onSubmit": function(po) {
+                    fieldmapper.standardRequest(
+                        ["open-ils.acq", "open-ils.acq.purchase_order.create"],{
+                            "async": false,
+                            "params": [openils.User.authtoken, po],
+                            "onresponse": function(r) {
+                                toOnePo(
+                                    openils.Util.readResponse(r).
+                                    purchase_order.id()
+                                );
+                            }
+                        }
+                    );
+                },
+                "onCancel": function() {
+                    editDialog.hide();
+                    toPoListing();
+                    /* I'd rather do window.close() or xulG.close_tab(),
+                     * but neither of those seem to work here. */
+                }
+            })
+        });
+        editDialog.startup();
+        editDialog.show();
+    }
+);

Modified: trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2010-06-22 16:39:46 UTC (rev 16777)
+++ trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2010-06-22 17:07:38 UTC (rev 16778)
@@ -835,6 +835,8 @@
 <!ENTITY staff.main.menu.acq.upload.accesskey "M">
 <!ENTITY staff.main.menu.acq.view_local_po.label "Purchase Orders">
 <!ENTITY staff.main.menu.acq.view_local_po.accesskey "P">
+<!ENTITY staff.main.menu.acq.create_po.label "Create Purchase Order">
+<!ENTITY staff.main.menu.acq.create_po.accesskey "O">
 <!ENTITY staff.main.menu.acq.claim_eligible.label "Claim-Ready Items">
 <!ENTITY staff.main.menu.acq.claim_eligible.accesskey "R">
 <!ENTITY staff.main.menu.acq.view_local_inv.label "Open Invoices">

Added: trunk/Open-ILS/web/templates/default/acq/po/create.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/po/create.tt2	                        (rev 0)
+++ trunk/Open-ILS/web/templates/default/acq/po/create.tt2	2010-06-22 17:07:38 UTC (rev 16778)
@@ -0,0 +1,8 @@
+[% WRAPPER "default/base.tt2" %]
+[% ctx.page_title = "Create Purchase Order" %]
+<script
+    type="text/javascript"
+    src="[% ctx.media_prefix %]/js/ui/default/acq/po/create.js">
+</script>
+<h1>Create Purchase Order</h1>
+[% END %]

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js	2010-06-22 16:39:46 UTC (rev 16777)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js	2010-06-22 17:07:38 UTC (rev 16778)
@@ -788,6 +788,10 @@
                 ['oncommand'],
                 function() { open_eg_web_page('acq/search/unified?ca=po', 'menu.cmd_acq_unified_search.tab'); }
             ],
+            'cmd_acq_create_po' : [
+                ['oncommand'],
+                function() { open_eg_web_page('acq/po/create', 'menu.cmd_acq_po.tab'); }
+            ],
             'cmd_acq_view_local_inv' : [
                 ['oncommand'],
                 function() { open_eg_web_page('acq/search/unified?ca=inv', 'menu.cmd_acq_unified_search.tab'); }

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul	2010-06-22 16:39:46 UTC (rev 16777)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul	2010-06-22 17:07:38 UTC (rev 16778)
@@ -78,6 +78,7 @@
     <command id="cmd_open_vandelay" />
     
     <command id="cmd_acq_create_invoice" />
+    <command id="cmd_acq_create_po" />
     <command id="cmd_acq_view_my_pl" />
     <command id="cmd_acq_view_local_po" />
     <command id="cmd_acq_view_local_inv" />
@@ -278,6 +279,7 @@
         <menuseparator />
         <menuitem label="&staff.main.menu.acq.upload.label;" accesskey="&staff.main.menu.acq.upload.accesskey;" command="cmd_acq_upload"/>
         <menuitem label="&staff.main.menu.acq.view_local_po.label;" accesskey="&staff.main.menu.acq.view_local_po.accesskey;" command="cmd_acq_view_local_po"/>
+        <menuitem label="&staff.main.menu.acq.create_po.label;" accesskey="&staff.main.menu.acq.create_po.accesskey;" command="cmd_acq_create_po"/>
         <menuseparator />
         <menuitem label="&staff.main.menu.acq.claim_eligible.label;" accesskey="&staff.main.menu.acq.claim_eligible.accesskey;" command="cmd_acq_claim_eligible" />
         <menuitem label="&staff.main.menu.acq.view_local_inv.label;" accesskey="&staff.main.menu.acq.view_local_inv.accesskey;" command="cmd_acq_view_local_inv"/>

Modified: trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties	2010-06-22 16:39:46 UTC (rev 16777)
+++ trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties	2010-06-22 17:07:38 UTC (rev 16778)
@@ -230,7 +230,7 @@
 menu.cmd_acq_unified_search.tab=Acquisitions Search
 menu.cmd_acq_upload.tab=Load Order Record
 menu.cmd_acq_new_brief_record.tab=New Brief Record
-menu.cmd_acq_view_po_events.tab=Purchase Order Events
+menu.cmd_acq_po.tab=Purchase Orders
 menu.cmd_acq_user_requests.tab=User Requests
 menu.cmd_acq_claim_eligible.tab=Claim-Eligible Items
 menu.cmd_booking_resource.tab=Resources



More information about the open-ils-commits mailing list