From: senator Date: Tue, 27 Apr 2010 16:57:39 +0000 (+0000) Subject: Acq: Find PO from which copy originated X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=e8b0abbb849e5c2628300da4b0330bcd72587b65;p=evergreen%2Fmasslnc.git 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. git-svn-id: svn://svn.open-ils.org/ILS/trunk@16321 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm index 5cde9d7174..691771acca 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm @@ -958,4 +958,44 @@ sub ranged_line_item_alert_text { } +__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; diff --git a/Open-ILS/web/js/ui/default/acq/po/view_po.js b/Open-ILS/web/js/ui/default/acq/po/view_po.js index dcbe8e9dac..8183cf7d82 100644 --- a/Open-ILS/web/js/ui/default/acq/po/view_po.js +++ b/Open-ILS/web/js/ui/default/acq/po/view_po.js @@ -370,6 +370,7 @@ params: [openils.User.authtoken, {purchase_order:poId}, {flesh_attrs:true, flesh oncomplete : function() { dojo.byId("acq-po-view-total-estimated").innerHTML = totalEstimated.toFixed(2); + if (liFocus) liTable.drawCopies(liFocus); } } ); diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index d2130abc21..19931560f6 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -2027,6 +2027,8 @@ + + diff --git a/Open-ILS/web/templates/default/acq/po/view.tt2 b/Open-ILS/web/templates/default/acq/po/view.tt2 index f253912537..24d3e50a91 100644 --- a/Open-ILS/web/templates/default/acq/po/view.tt2 +++ b/Open-ILS/web/templates/default/acq/po/view.tt2 @@ -78,7 +78,12 @@ [% INCLUDE 'default/acq/common/li_table.tt2' %] [% INCLUDE "default/acq/common/notes.tt2" which = "Po" %] diff --git a/Open-ILS/xul/staff_client/chrome/content/main/constants.js b/Open-ILS/xul/staff_client/chrome/content/main/constants.js index d11b02fa6a..0ac7b71045 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -416,5 +416,6 @@ var urls = { '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' } diff --git a/Open-ILS/xul/staff_client/server/circ/copy_status.js b/Open-ILS/xul/staff_client/server/circ/copy_status.js index ebf6180f93..1a7bf35fbc 100644 --- a/Open-ILS/xul/staff_client/server/circ/copy_status.js +++ b/Open-ILS/xul/staff_client/server/circ/copy_status.js @@ -67,6 +67,7 @@ circ.copy_status.prototype = { 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 @@ circ.copy_status.prototype = { 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 @@ circ.copy_status.prototype = { } } ], + "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() { diff --git a/Open-ILS/xul/staff_client/server/circ/copy_status.xul b/Open-ILS/xul/staff_client/server/circ/copy_status.xul index cd3402fda8..6cee443cc0 100644 --- a/Open-ILS/xul/staff_client/server/circ/copy_status.xul +++ b/Open-ILS/xul/staff_client/server/circ/copy_status.xul @@ -114,6 +114,7 @@ + diff --git a/Open-ILS/xul/staff_client/server/circ/copy_status_overlay.xul b/Open-ILS/xul/staff_client/server/circ/copy_status_overlay.xul index 8036a67ae5..00d7774ea6 100644 --- a/Open-ILS/xul/staff_client/server/circ/copy_status_overlay.xul +++ b/Open-ILS/xul/staff_client/server/circ/copy_status_overlay.xul @@ -21,6 +21,8 @@ + + @@ -160,6 +162,8 @@ + + diff --git a/Open-ILS/xul/staff_client/server/circ/util.js b/Open-ILS/xul/staff_client/server/circ/util.js index 4e8421d255..01162bb9e6 100644 --- a/Open-ILS/xul/staff_client/server/circ/util.js +++ b/Open-ILS/xul/staff_client/server/circ/util.js @@ -3150,4 +3150,33 @@ circ.util.batch_hold_update = function ( hold_ids, field_changes, params ) { } }; +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'); diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties b/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties index becfa55a26..b046070ffe 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/circ.properties @@ -379,6 +379,7 @@ staff.circ.utils.estimated_wait=Estimated Wait Time 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