[open-ils-commits] r17689 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq (atz)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Sep 15 01:25:10 EDT 2010
Author: atz
Date: 2010-09-15 01:25:06 -0400 (Wed, 15 Sep 2010)
New Revision: 17689
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/EDI.pm
trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm
Log:
Allow noauth option for retrieval method to support EDI
EDI scripts run from crontab, w/o an associated user to auth
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/EDI.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/EDI.pm 2010-09-15 05:25:05 UTC (rev 17688)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/EDI.pm 2010-09-15 05:25:06 UTC (rev 17689)
@@ -501,7 +501,7 @@
$detail->estimated_unit_price($price) if $price;
# $e->search_acq_edi_account([]);
my $touches = 0;
- my $eg_lids = $e->retrieve_acq_lineitem_detail({lineitem => $eg_line->id});
+ my $eg_lids = $e->retrieve_acq_lineitem_detail({lineitem => $eg_line->id}); # should be the same as $eg_line->lineitem_details
my $lidcount = scalar(@$eg_lids);
$lidcount == $eg_line->item_count or $logger->warn(
sprintf "EDI: LI %s itemcount (%d) mismatch, %d LIDs found", $eg_line->id, $eg_line->item_count, $lidcount
@@ -598,7 +598,7 @@
=head2 ->eg_li($lineitem_object, [$server, $editor])
-my $line_item = OpenILS::Application::Acq::EDI->eg_li($edi_line);
+my $line_item = OpenILS::Application::Acq::EDI->eg_li($edi_line, $server, $e);
$server is a RemoteAccount object
@@ -647,13 +647,13 @@
my $li = OpenILS::Application::Acq::Lineitem::retrieve_lineitem_impl($e, $id, {
flesh_li_details => 1,
clear_marc => 1,
- }); # Could send more {options}
+ }, 1); # Could send more {options}. The 1 is for no_auth.
if (! $li or ref($li) ne 'Fieldmapper::acq::lineitem') {
$logger->error("EDI failed to retrieve lineitem by id '$id' for server " . ($server->{remote_host} || $server->{host} || Dumper($server)));
return;
}
- unless ((! $server) or (! $server->provider)) {
+ unless ((! $server) or (! $server->provider)) { # but here we want $server to be acq.edi_account instead of RemoteAccount/
if ($server->provider != $li->provider) {
# links go both ways: acq.provider.edi_default and acq.edi_account.provider
$logger->info("EDI acct provider (" . $server->provider. ") doesn't match lineitem provider("
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm 2010-09-15 05:25:05 UTC (rev 17688)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Lineitem.pm 2010-09-15 05:25:06 UTC (rev 17689)
@@ -94,7 +94,7 @@
}
sub retrieve_lineitem_impl {
- my ($e, $li_id, $options) = @_;
+ my ($e, $li_id, $options, $no_auth) = @_; # no_auth needed for EDI scripts
$options ||= {};
my $flesh = {
@@ -151,12 +151,12 @@
return $e->event unless (
$li->purchase_order and
- $e->allowed(['VIEW_PURCHASE_ORDER', 'CREATE_PURCHASE_ORDER'],
- $li->purchase_order->ordering_agency, $li->purchase_order)
+ ($no_auth or $e->allowed(['VIEW_PURCHASE_ORDER', 'CREATE_PURCHASE_ORDER'],
+ $li->purchase_order->ordering_agency, $li->purchase_order))
) or (
$li->picklist and !$li->purchase_order and # user doesn't have view_po perms
- $e->allowed(['VIEW_PICKLIST', 'CREATE_PICKLIST'],
- $li->picklist->org_unit, $li->picklist)
+ ($no_auth or $e->allowed(['VIEW_PICKLIST', 'CREATE_PICKLIST'],
+ $li->picklist->org_unit, $li->picklist))
);
unless ($$options{flesh_po}) {
More information about the open-ils-commits
mailing list