[open-ils-commits] r16321 - in trunk/Open-ILS: src/perlmods/OpenILS/Application/Acq 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/server/circ xul/staff_client/server/locale/en-US (senator)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Apr 27 12:57:43 EDT 2010


Author: senator
Date: 2010-04-27 12:57:39 -0400 (Tue, 27 Apr 2010)
New Revision: 16321

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm
   trunk/Open-ILS/web/js/ui/default/acq/po/view_po.js
   trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
   trunk/Open-ILS/web/templates/default/acq/po/view.tt2
   trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
   trunk/Open-ILS/xul/staff_client/server/circ/copy_status.js
   trunk/Open-ILS/xul/staff_client/server/circ/copy_status.xul
   trunk/Open-ILS/xul/staff_client/server/circ/copy_status_overlay.xul
   trunk/Open-ILS/xul/staff_client/server/circ/util.js
   trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties
Log:
Acq: Find PO from which copy originated

In the Item Status staff client interface there is now a new menu option that
will look for a PO from which a given item originated.


Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm	2010-04-27 16:53:33 UTC (rev 16320)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm	2010-04-27 16:57:39 UTC (rev 16321)
@@ -958,4 +958,44 @@
 }
 
 
+__PACKAGE__->register_method(
+    method => "retrieve_lineitem_by_copy_id",
+    api_name => "open-ils.acq.lineitem.retrieve.by_copy_id",
+    signature => {
+        desc => q/Manage lineitem notes/,
+        params => [
+            {desc => "Authentication token", type => "string"},
+            {desc => "Evergreen internal copy ID", type => "number"},
+            {desc => "Hash of options (see open-ils.acq.lineitem.retrieve",
+                type => "object"}
+        ],
+        return => {
+            desc => "Lineitem associated with given copy",
+            type => "object", class => "jub"
+        }
+    }
+);
+
+sub retrieve_lineitem_by_copy_id {
+    my ($self, $conn, $auth, $object_id, $options) = @_;
+
+    my $e = new_editor("authtoken" => $auth);
+    return $e->die_event unless $e->checkauth;
+
+    my $result = $e->json_query({
+        "select" => {"acqlid" => ["lineitem"]},
+        "from" => "acqlid",
+        "where" => {"eg_copy_id" => $object_id}
+    })->[0] or do {
+        $e->disconnect;
+        return new OpenILS::Event("ACQ_LINEITEM_NOT_FOUND");
+    };
+
+    my $li = retrieve_lineitem_impl($e, $result->{"lineitem"}, $options) or
+        return $e->die_event;
+
+    $e->disconnect;
+    return $li;
+}
+
 1;

Modified: trunk/Open-ILS/web/js/ui/default/acq/po/view_po.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/po/view_po.js	2010-04-27 16:53:33 UTC (rev 16320)
+++ trunk/Open-ILS/web/js/ui/default/acq/po/view_po.js	2010-04-27 16:57:39 UTC (rev 16321)
@@ -370,6 +370,7 @@
 
             oncomplete : function() {
                 dojo.byId("acq-po-view-total-estimated").innerHTML = totalEstimated.toFixed(2);
+                if (liFocus) liTable.drawCopies(liFocus);
             }
         }
     );

Modified: trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2010-04-27 16:53:33 UTC (rev 16320)
+++ trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2010-04-27 16:57:39 UTC (rev 16321)
@@ -2027,6 +2027,8 @@
 <!ENTITY staff.circ.copy_status_overlay.cmd_book_item_now.accesskey "N">
 <!ENTITY staff.circ.copy_status_overlay.cmd_create_brt.label "Make Item Bookable">
 <!ENTITY staff.circ.copy_status_overlay.cmd_create_brt.accesskey "K">
+<!ENTITY staff.circ.copy_status_overlay.cmd_find_acq_po.label "Find Originating Acquisition">
+<!ENTITY staff.circ.copy_status_overlay.cmd_find_acq_po.accesskey "F">
 <!ENTITY staff.circ.copy_status_overlay.sel_edit.label "Edit Item Attributes">
 <!ENTITY staff.circ.copy_status_overlay.sel_edit.accesskey "E">
 <!ENTITY staff.circ.copy_status_overlay.sel_mark_items_damaged.label "Mark Item Damaged">

Modified: trunk/Open-ILS/web/templates/default/acq/po/view.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/po/view.tt2	2010-04-27 16:53:33 UTC (rev 16320)
+++ trunk/Open-ILS/web/templates/default/acq/po/view.tt2	2010-04-27 16:57:39 UTC (rev 16321)
@@ -78,7 +78,12 @@
         </div>
     </div>
     <script type="text/javascript">
-        var [poId, liFocus] = "[% ctx.page_args.0 %]".split(",");
+        var poId = "[% ctx.page_args.1 %]";
+        var liFocus = "[% ctx.page_args.0 %]";
+        if (liFocus && !poId) {
+            poId = liFocus;
+            liFocus = null;
+        }
     </script>
     [% INCLUDE 'default/acq/common/li_table.tt2' %]
     [% INCLUDE "default/acq/common/notes.tt2" which = "Po" %]

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2010-04-27 16:53:33 UTC (rev 16320)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/constants.js	2010-04-27 16:57:39 UTC (rev 16321)
@@ -416,5 +416,6 @@
     'CONIFY' : '/conify/' + LOCALE + '/global',
     'EG_WEB_BASE' : '/eg',
     'XUL_LOCAL_ADMIN_BASE' : '/xul/server/admin',
-    'XUL_REPORTS' : '/reports/oils_rpt.xhtml'
+    'XUL_REPORTS' : '/reports/oils_rpt.xhtml',
+    'EG_ACQ_PO_VIEW' : '/eg/acq/po/view'
 }

Modified: trunk/Open-ILS/xul/staff_client/server/circ/copy_status.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/copy_status.js	2010-04-27 16:53:33 UTC (rev 16320)
+++ trunk/Open-ILS/xul/staff_client/server/circ/copy_status.js	2010-04-27 16:57:39 UTC (rev 16321)
@@ -67,6 +67,7 @@
                             obj.controller.view.cmd_triggered_events.setAttribute('disabled','true');
                             obj.controller.view.cmd_create_brt.setAttribute('disabled','true');
                             obj.controller.view.cmd_book_item_now.setAttribute('disabled','true');
+                            obj.controller.view.cmd_find_acq_po.setAttribute('disabled','true');
                             obj.controller.view.sel_spine.setAttribute('disabled','true');
                             obj.controller.view.sel_transit_abort.setAttribute('disabled','true');
                             obj.controller.view.sel_clip.setAttribute('disabled','true');
@@ -98,6 +99,7 @@
                                 obj.controller.view.cmd_book_item_now.setAttribute('disabled','true');
                             }
                             obj.controller.view.cmd_create_brt.setAttribute('disabled','false');
+                            obj.controller.view.cmd_find_acq_po.setAttribute("disabled", obj.selection_list.length == 1 ? "false" : "true");
                             obj.controller.view.sel_spine.setAttribute('disabled','false');
                             obj.controller.view.sel_transit_abort.setAttribute('disabled','false');
                             obj.controller.view.sel_clip.setAttribute('disabled','false');
@@ -230,6 +232,15 @@
                             }
                         }
                     ],
+                    "cmd_find_acq_po" : [
+                        ["command"],
+                        function() {
+                            JSAN.use("circ.util");
+                            circ.util.find_acq_po(
+                                ses(), obj.selection_list[0].copy_id
+                            );
+                        }
+                    ],
                     'sel_checkin' : [
                         ['command'],
                         function() {

Modified: trunk/Open-ILS/xul/staff_client/server/circ/copy_status.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/copy_status.xul	2010-04-27 16:53:33 UTC (rev 16320)
+++ trunk/Open-ILS/xul/staff_client/server/circ/copy_status.xul	2010-04-27 16:57:39 UTC (rev 16321)
@@ -114,6 +114,7 @@
         <command id="cmd_alt_view" />
         <command id="cmd_triggered_events" />
         <command id="save_columns" />
+        <command id="cmd_find_acq_po" disabled="true"/>
         <command id="cmd_create_brt" disabled="true"/>
         <command id="cmd_book_item_now" disabled="true"/>
         <command id="sel_copy_details" disabled="true"/>

Modified: trunk/Open-ILS/xul/staff_client/server/circ/copy_status_overlay.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/copy_status_overlay.xul	2010-04-27 16:53:33 UTC (rev 16320)
+++ trunk/Open-ILS/xul/staff_client/server/circ/copy_status_overlay.xul	2010-04-27 16:57:39 UTC (rev 16321)
@@ -21,6 +21,8 @@
         <menuitem command="cmd_create_brt" label="&staff.circ.copy_status_overlay.cmd_create_brt.label;" accesskey="&staff.circ.copy_status_overlay.cmd_create_brt.accesskey;"/>
         <menuitem command="cmd_book_item_now" label="&staff.circ.copy_status_overlay.cmd_book_item_now.label;" accesskey="&staff.circ.copy_status_overlay.cmd_book_item_now.accesskey;"/>
         <menuseparator/>
+        <menuitem command="cmd_find_acq_po" label="&staff.circ.copy_status_overlay.cmd_find_acq_po.label;" accesskey="&staff.circ.copy_status_overlay.cmd_find_acq_po.accesskey;"/>
+        <menuseparator/>
         <menuitem command="sel_edit" label="&staff.circ.copy_status_overlay.sel_edit.label;" accesskey="&staff.circ.copy_status_overlay.sel_edit.accesskey;" />
         <menuseparator/>
         <menuitem command="sel_mark_items_damaged" label="&staff.circ.copy_status_overlay.sel_mark_items_damaged.label;" accesskey="&staff.circ.copy_status_overlay.sel_mark_items_damaged.accesskey;"/>
@@ -160,6 +162,8 @@
             <menuitem command="cmd_create_brt" label="&staff.circ.copy_status_overlay.cmd_create_brt.label;" accesskey="&staff.circ.copy_status_overlay.cmd_create_brt.accesskey;"/>
             <menuitem command="cmd_book_item_now" label="&staff.circ.copy_status_overlay.cmd_book_item_now.label;" accesskey="&staff.circ.copy_status_overlay.cmd_book_item_now.accesskey;"/>
             <menuseparator />
+            <menuitem command="cmd_find_acq_po" label="&staff.circ.copy_status_overlay.cmd_find_acq_po.label;" accesskey="&staff.circ.copy_status_overlay.cmd_find_acq_po.accesskey;"/>
+            <menuseparator/>
             <menuitem command="sel_edit" label="&staff.circ.copy_status_overlay.sel_edit.label;" accesskey="&staff.circ.copy_status_overlay.sel_edit.accesskey;" />
             <menuseparator />
             <menuitem command="sel_mark_items_damaged" label="&staff.circ.copy_status_overlay.sel_mark_items_damaged.label;" accesskey="&staff.circ.copy_status_overlay.sel_mark_items_damaged.accesskey;"/>

Modified: trunk/Open-ILS/xul/staff_client/server/circ/util.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/circ/util.js	2010-04-27 16:53:33 UTC (rev 16320)
+++ trunk/Open-ILS/xul/staff_client/server/circ/util.js	2010-04-27 16:57:39 UTC (rev 16321)
@@ -3150,4 +3150,33 @@
     }
 };
 
+circ.util.find_acq_po = function(session, copy_id) {
+    dojo.require("openils.Util");
+    fieldmapper.standardRequest(
+        ["open-ils.acq", "open-ils.acq.lineitem.retrieve.by_copy_id"], {
+            "params": [session, copy_id, {"clear_marc": true}],
+            "onresponse": function(r) {
+                if (r = openils.Util.readResponse(r)) {
+                    if (r.purchase_order()) {
+                        /* XXX would prefer to use browser.xul to wrap this so
+                         * that we get back/forward/reload buttons, but that
+                         * doesn't work in this context. need to find out why.
+                         */
+                        xulG.new_tab(
+                            urls.EG_ACQ_PO_VIEW +
+                                "/" + r.purchase_order() + "/" + r.id(),
+                            {}, {}
+                        );
+                    } else {
+                        /* unlikely: got an LI with no PO */
+                        alert(dojo.byId("circStrings").getFormattedString(
+                            "staff.circ.utils.find_acq_po.no_po", [r.id()]
+                        ));
+                    }
+                }
+            }
+        }
+    );
+};
+
 dump('exiting circ/util.js\n');

Modified: trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties	2010-04-27 16:53:33 UTC (rev 16320)
+++ trunk/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties	2010-04-27 16:57:39 UTC (rev 16321)
@@ -379,6 +379,7 @@
 staff.circ.utils.potential_copies=Potential Copies 
 staff.circ.utils.queue_position=Queue Position
 staff.circ.utils.total_holds=Total Number of Holds
+staff.circ.utils.find_acq_po.no_po=Lineitem found (%1$s), but without purchase order
 staff.circ.work_log_column.message=Message
 staff.circ.work_log_column.when=When
 # 1 - Staff Username  2 - Patron Family  3 - Patron Barcode  4 - Item Barcode 



More information about the open-ils-commits mailing list