[open-ils-commits] r12730 - trunk/Open-ILS/src/support-scripts/test-scripts (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Mar 31 09:39:51 EDT 2009


Author: erickson
Date: 2009-03-31 09:39:50 -0400 (Tue, 31 Mar 2009)
New Revision: 12730

Added:
   trunk/Open-ILS/src/support-scripts/test-scripts/print_po.pl
Log:
test script for printing a purchase order

Added: trunk/Open-ILS/src/support-scripts/test-scripts/print_po.pl
===================================================================
--- trunk/Open-ILS/src/support-scripts/test-scripts/print_po.pl	                        (rev 0)
+++ trunk/Open-ILS/src/support-scripts/test-scripts/print_po.pl	2009-03-31 13:39:50 UTC (rev 12730)
@@ -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";
+    }
+}


Property changes on: trunk/Open-ILS/src/support-scripts/test-scripts/print_po.pl
___________________________________________________________________
Name: svn:executable
   + *



More information about the open-ils-commits mailing list