From 914ebf18a229a6137f8aec341bbd6af04d85dd16 Mon Sep 17 00:00:00 2001 From: senator Date: Tue, 22 Jun 2010 17:07:38 +0000 Subject: [PATCH] Acq: add a Create PO interface for workflows starting with new, blank POs git-svn-id: svn://svn.open-ils.org/ILS/trunk@16778 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../web/js/dojo/openils/widget/EditPane.js | 7 ++- Open-ILS/web/js/ui/default/acq/po/create.js | 54 +++++++++++++++++++ Open-ILS/web/opac/locale/en-US/lang.dtd | 2 + .../web/templates/default/acq/po/create.tt2 | 8 +++ .../staff_client/chrome/content/main/menu.js | 4 ++ .../chrome/content/main/menu_frame_menus.xul | 2 + .../chrome/locale/en-US/offline.properties | 2 +- 7 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 Open-ILS/web/js/ui/default/acq/po/create.js create mode 100644 Open-ILS/web/templates/default/acq/po/create.tt2 diff --git a/Open-ILS/web/js/dojo/openils/widget/EditPane.js b/Open-ILS/web/js/dojo/openils/widget/EditPane.js index 69b005b383..800eb0b339 100644 --- a/Open-ILS/web/js/dojo/openils/widget/EditPane.js +++ b/Open-ILS/web/js/dojo/openils/widget/EditPane.js @@ -204,7 +204,6 @@ if(!dojo._hasResource['openils.widget.EditPane']) { }, 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 @@ if(!dojo._hasResource['openils.widget.EditPane']) { 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); + } } } ); diff --git a/Open-ILS/web/js/ui/default/acq/po/create.js b/Open-ILS/web/js/ui/default/acq/po/create.js new file mode 100644 index 0000000000..804ad0a241 --- /dev/null +++ b/Open-ILS/web/js/ui/default/acq/po/create.js @@ -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(); + } +); diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index de0946ffbd..365f92e4c4 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -835,6 +835,8 @@ + + diff --git a/Open-ILS/web/templates/default/acq/po/create.tt2 b/Open-ILS/web/templates/default/acq/po/create.tt2 new file mode 100644 index 0000000000..87d2b47233 --- /dev/null +++ b/Open-ILS/web/templates/default/acq/po/create.tt2 @@ -0,0 +1,8 @@ +[% WRAPPER "default/base.tt2" %] +[% ctx.page_title = "Create Purchase Order" %] + +

Create Purchase Order

+[% END %] diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js index b679c1cc23..ff628cea42 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js @@ -788,6 +788,10 @@ main.menu.prototype = { ['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'); } diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul index d81e384daa..8a737ec98c 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul @@ -78,6 +78,7 @@ + @@ -278,6 +279,7 @@ + diff --git a/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties b/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties index 7e84bc940c..54359824e2 100644 --- a/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties +++ b/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties @@ -230,7 +230,7 @@ menu.cmd_acq_from_bib.tab=Import Catalog Records 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 -- 2.43.2