From: erickson Date: Tue, 31 Mar 2009 13:39:50 +0000 (+0000) Subject: test script for printing a purchase order X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=1fdabae1429de7b7312c50b85da2ac49f1641aa5;p=evergreen%2Ftadl.git test script for printing a purchase order git-svn-id: svn://svn.open-ils.org/ILS/trunk@12730 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/support-scripts/test-scripts/print_po.pl b/Open-ILS/src/support-scripts/test-scripts/print_po.pl new file mode 100755 index 0000000000..f63c5582ec --- /dev/null +++ b/Open-ILS/src/support-scripts/test-scripts/print_po.pl @@ -0,0 +1,48 @@ +#!/usr/bin/perl + +#---------------------------------------------------------------- +# Print PO +#---------------------------------------------------------------- + +require '../oils_header.pl'; +use strict; use warnings; +my $config = shift; +my $username = shift || 'admin'; +my $password = shift || 'open-ils'; +my $po_id = shift; + +osrf_connect($config); +oils_login($username, $password); +my $e = OpenILS::Utils::CStoreEditor->new; + +my $po = $e->retrieve_acq_purchase_order( + [ + $po_id, + { + flesh => 3, + flesh_fields => { + acqpo => [qw/lineitems ordering_agency provider/], + jub => [qw/attributes lineitem_details/], + acqlid => [qw/fund location/] + } + } + ] +); + +die "No PO with id $po_id\n" unless $po; + + +print 'PO ID: ' . $po->id . "\n"; +print 'Ordering Agency: ' . $po->ordering_agency->shortname . "\n"; +print 'Provider: ' . $po->provider->code . "\n"; +for my $li (@{$po->lineitems}) { + print " Lineitem:------------------\n"; + for my $li_attr (@{$li->attributes}) { + print " " . $li_attr->attr_name . ': ' . $li_attr->attr_value . "\n"; + } + for my $li_det (@{$li->lineitem_details}) { + print " Copy----------------------\n"; + print " Fund: " . $li_det->fund->code . "\n"; + print " Location: " . $li_det->location->name . "\n"; + } +}