[open-ils-commits] [GIT] Evergreen ILS branch master updated. 14354b693ca19511e4d5465ca3e344308c85c235

Evergreen Git git at git.evergreen-ils.org
Fri Jun 14 15:00:51 EDT 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  14354b693ca19511e4d5465ca3e344308c85c235 (commit)
      from  db9a773aa5b515f9ad469407d3673240531f28ed (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 14354b693ca19511e4d5465ca3e344308c85c235
Author: Dan Wells <dbw2 at calvin.edu>
Date:   Fri Jun 14 14:21:10 2013 -0400

    Post-2.5-m1 whitespace fixup
    
    This is an attempt at an automated whitespace cleanup for the m1
    milestone of version 2.5.  It was created using the following
    commands (run from Open-ILS/src/perlmods/lib):
    
    find . -name "*.pm" \
    -exec sh -c 'sed "/<</s/\t/    /g" < {} \
    | expand -t 4 > {}.fixed ; \
    cp --no-preserve=mode,ownership {}.fixed {}; \
    rm {}.fixed' \;
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>
    Signed-off-by: Remington Steed <rjs7 at calvin.edu>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application.pm
index 2888c93..d750216 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application.pm
@@ -27,16 +27,16 @@ sub get_idl_file {
 }
 
 sub publish_fieldmapper {
-	my ($self,$client,$class) = @_;
+    my ($self,$client,$class) = @_;
 
-	return $Fieldmapper::fieldmap unless (defined $class);
-	return undef unless (exists($$Fieldmapper::fieldmap{$class}));
-	return {$class => $$Fieldmapper::fieldmap{$class}};
+    return $Fieldmapper::fieldmap unless (defined $class);
+    return undef unless (exists($$Fieldmapper::fieldmap{$class}));
+    return {$class => $$Fieldmapper::fieldmap{$class}};
 }
 __PACKAGE__->register_method(
-	api_name	=> 'opensrf.open-ils.system.fieldmapper',
-	api_level	=> 1,
-	method		=> 'publish_fieldmapper',
+    api_name    => 'opensrf.open-ils.system.fieldmapper',
+    api_level   => 1,
+    method      => 'publish_fieldmapper',
 );
 
 sub register_method {
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Claims.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Claims.pm
index dba843c..ae88faa 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Claims.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Claims.pm
@@ -11,10 +11,10 @@ my $U = 'OpenILS::Application::AppUtils';
 
 
 __PACKAGE__->register_method(
-	method => 'claim_ready_items',
-	api_name	=> 'open-ils.acq.claim.eligible.lineitem_detail',
+    method => 'claim_ready_items',
+    api_name    => 'open-ils.acq.claim.eligible.lineitem_detail',
     stream => 1,
-	signature => {
+    signature => {
         desc => q/Locates lineitem_details that are eligible for claiming/,
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -104,10 +104,10 @@ __PACKAGE__->register_method(
 );
 
 __PACKAGE__->register_method(
-	method => 'claim_item',
-	api_name	=> 'open-ils.acq.claim.lineitem_detail',
+    method => 'claim_item',
+    api_name    => 'open-ils.acq.claim.lineitem_detail',
     stream => 1,
-	signature => {
+    signature => {
         desc => q/Initiates a claim for an individual lineitem_detail/,
         params => [
             {desc => 'Authentication token', type => 'string'},
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm
index 924787a..be69689 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/EDI.pm
@@ -58,10 +58,10 @@ my $VENDOR_KLUDGE_MAP = {
 
 
 __PACKAGE__->register_method(
-	method    => 'retrieve',
-	api_name  => 'open-ils.acq.edi.retrieve',
+    method    => 'retrieve',
+    api_name  => 'open-ils.acq.edi.retrieve',
     authoritative => 1,
-	signature => {
+    signature => {
         desc   => 'Fetch incoming message(s) from EDI accounts.  ' .
                   'Optional arguments to restrict to one vendor and/or a max number of messages.  ' .
                   'Note that messages are not parsed or processed here, just fetched and translated.',
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Financials.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Financials.pm
index 217013a..7f20e38 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Financials.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Financials.pm
@@ -17,9 +17,9 @@ my $U = 'OpenILS::Application::AppUtils';
 # ----------------------------------------------------------------------------
 
 __PACKAGE__->register_method(
-	method => 'create_funding_source',
-	api_name	=> 'open-ils.acq.funding_source.create',
-	signature => {
+    method => 'create_funding_source',
+    api_name    => 'open-ils.acq.funding_source.create',
+    signature => {
         desc => 'Creates a new funding_source',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -41,9 +41,9 @@ sub create_funding_source {
 
 
 __PACKAGE__->register_method(
-	method => 'delete_funding_source',
-	api_name	=> 'open-ils.acq.funding_source.delete',
-	signature => {
+    method => 'delete_funding_source',
+    api_name    => 'open-ils.acq.funding_source.delete',
+    signature => {
         desc => 'Deletes a funding_source',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -65,10 +65,10 @@ sub delete_funding_source {
 }
 
 __PACKAGE__->register_method(
-	method => 'retrieve_funding_source',
-	api_name	=> 'open-ils.acq.funding_source.retrieve',
+    method => 'retrieve_funding_source',
+    api_name    => 'open-ils.acq.funding_source.retrieve',
     authoritative => 1,
-	signature => {
+    signature => {
         desc => 'Retrieves a new funding_source',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -100,10 +100,10 @@ sub retrieve_funding_source {
 }
 
 __PACKAGE__->register_method(
-	method => 'retrieve_org_funding_sources',
-	api_name	=> 'open-ils.acq.funding_source.org.retrieve',
+    method => 'retrieve_org_funding_sources',
+    api_name    => 'open-ils.acq.funding_source.org.retrieve',
     stream => 1,
-	signature => {
+    signature => {
         desc => 'Retrieves all the funding_sources associated with an org unit that the requestor has access to see',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -156,9 +156,9 @@ sub retrieve_funding_source_summary_impl {
 
 
 __PACKAGE__->register_method(
-	method => 'create_funding_source_credit',
-	api_name	=> 'open-ils.acq.funding_source_credit.create',
-	signature => {
+    method => 'create_funding_source_credit',
+    api_name    => 'open-ils.acq.funding_source_credit.create',
+    signature => {
         desc => 'Create a new funding source credit',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -188,9 +188,9 @@ sub create_funding_source_credit {
 # ---------------------------------------------------------------
 
 __PACKAGE__->register_method(
-	method => 'create_fund',
-	api_name	=> 'open-ils.acq.fund.create',
-	signature => {
+    method => 'create_fund',
+    api_name    => 'open-ils.acq.fund.create',
+    signature => {
         desc => 'Creates a new fund',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -212,9 +212,9 @@ sub create_fund {
 
 
 __PACKAGE__->register_method(
-	method => 'delete_fund',
-	api_name	=> 'open-ils.acq.fund.delete',
-	signature => {
+    method => 'delete_fund',
+    api_name    => 'open-ils.acq.fund.delete',
+    signature => {
         desc => 'Deletes a fund',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -236,10 +236,10 @@ sub delete_fund {
 }
 
 __PACKAGE__->register_method(
-	method => 'retrieve_fund',
-	api_name	=> 'open-ils.acq.fund.retrieve',
+    method => 'retrieve_fund',
+    api_name    => 'open-ils.acq.fund.retrieve',
     authoritative => 1,
-	signature => {
+    signature => {
         desc => 'Retrieves a new fund',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -272,10 +272,10 @@ sub retrieve_fund {
 }
 
 __PACKAGE__->register_method(
-	method => 'retrieve_org_funds',
-	api_name	=> 'open-ils.acq.fund.org.retrieve',
+    method => 'retrieve_org_funds',
+    api_name    => 'open-ils.acq.fund.org.retrieve',
     stream => 1,
-	signature => {
+    signature => {
         desc => 'Retrieves all the funds associated with an org unit',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -292,8 +292,8 @@ __PACKAGE__->register_method(
 );
 
 __PACKAGE__->register_method(
-	method => 'retrieve_org_funds',
-	api_name	=> 'open-ils.acq.fund.org.years.retrieve');
+    method => 'retrieve_org_funds',
+    api_name    => 'open-ils.acq.fund.org.years.retrieve');
 
 
 sub retrieve_org_funds {
@@ -345,10 +345,10 @@ sub retrieve_org_funds {
 }
 
 __PACKAGE__->register_method(
-	method => 'retrieve_fund_summary',
-	api_name	=> 'open-ils.acq.fund.summary.retrieve',
+    method => 'retrieve_fund_summary',
+    api_name    => 'open-ils.acq.fund.summary.retrieve',
     authoritative => 1,
-	signature => {
+    signature => {
         desc => 'Returns a summary of credits/debits/encumbrances for a fund',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -389,9 +389,9 @@ sub retrieve_fund_summary_impl {
 }
 
 __PACKAGE__->register_method(
-	method => 'transfer_money_between_funds',
-	api_name	=> 'open-ils.acq.funds.transfer_money',
-	signature => {
+    method => 'transfer_money_between_funds',
+    api_name    => 'open-ils.acq.funds.transfer_money',
+    signature => {
         desc => 'Method for transfering money between funds',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -455,9 +455,9 @@ sub transfer_money_between_funds {
 # ---------------------------------------------------------------
 
 __PACKAGE__->register_method(
-	method => 'create_fund_alloc',
-	api_name	=> 'open-ils.acq.fund_allocation.create',
-	signature => {
+    method => 'create_fund_alloc',
+    api_name    => 'open-ils.acq.fund_allocation.create',
+    signature => {
         desc => 'Creates a new fund_allocation',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -489,9 +489,9 @@ sub create_fund_alloc {
 
 
 __PACKAGE__->register_method(
-	method => 'delete_fund_alloc',
-	api_name	=> 'open-ils.acq.fund_allocation.delete',
-	signature => {
+    method => 'delete_fund_alloc',
+    api_name    => 'open-ils.acq.fund_allocation.delete',
+    signature => {
         desc => 'Deletes a fund_allocation',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -521,10 +521,10 @@ sub delete_fund_alloc {
 }
 
 __PACKAGE__->register_method(
-	method => 'retrieve_fund_alloc',
-	api_name	=> 'open-ils.acq.fund_allocation.retrieve',
+    method => 'retrieve_fund_alloc',
+    api_name    => 'open-ils.acq.fund_allocation.retrieve',
     authoritative => 1,
-	signature => {
+    signature => {
         desc => 'Retrieves a new fund_allocation',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -552,10 +552,10 @@ sub retrieve_fund_alloc {
 
 
 __PACKAGE__->register_method(
-	method => 'retrieve_funding_source_allocations',
-	api_name	=> 'open-ils.acq.funding_source.allocations.retrieve',
+    method => 'retrieve_funding_source_allocations',
+    api_name    => 'open-ils.acq.funding_source.allocations.retrieve',
     authoritative => 1,
-	signature => {
+    signature => {
         desc => 'Retrieves a new fund_allocation',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -586,10 +586,10 @@ sub retrieve_funding_source_allocations {
 # ----------------------------------------------------------------------------
 
 __PACKAGE__->register_method(
-	method => 'retrieve_all_currency_type',
-	api_name	=> 'open-ils.acq.currency_type.all.retrieve',
+    method => 'retrieve_all_currency_type',
+    api_name    => 'open-ils.acq.currency_type.all.retrieve',
     stream => 1,
-	signature => {
+    signature => {
         desc => 'Retrieves all currency_type objects',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -607,9 +607,9 @@ sub retrieve_all_currency_type {
 }
 
 __PACKAGE__->register_method(
-	method => 'create_lineitem_assets',
-	api_name	=> 'open-ils.acq.lineitem.assets.create',
-	signature => {
+    method => 'create_lineitem_assets',
+    api_name    => 'open-ils.acq.lineitem.assets.create',
+    signature => {
         desc => q/Creates the bibliographic data, volume, and copies associated with a lineitem./,
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -729,10 +729,10 @@ sub create_purchase_order_impl {
 
 
 __PACKAGE__->register_method(
-	method => 'retrieve_all_user_purchase_order',
-	api_name	=> 'open-ils.acq.purchase_order.user.all.retrieve',
+    method => 'retrieve_all_user_purchase_order',
+    api_name    => 'open-ils.acq.purchase_order.user.all.retrieve',
     stream => 1,
-	signature => {
+    signature => {
         desc => 'Retrieves a purchase order',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -762,7 +762,7 @@ sub retrieve_all_user_purchase_order {
 
     # grab purchase orders I have 
     my $perm_orgs = $U->user_has_work_perm_at($e, 'MANAGE_PROVIDER', {descendants =>1});
-	return OpenILS::Event->new('PERM_FAILURE', ilsperm => 'MANAGE_PROVIDER')
+    return OpenILS::Event->new('PERM_FAILURE', ilsperm => 'MANAGE_PROVIDER')
         unless @$perm_orgs;
     my $provider_ids = $e->search_acq_provider({owner => $perm_orgs}, {idlist=>1});
     my $po_ids = $e->search_acq_purchase_order({provider => $provider_ids}, {idlist=>1});
@@ -789,10 +789,10 @@ sub retrieve_all_user_purchase_order {
 
 
 __PACKAGE__->register_method(
-	method => 'search_purchase_order',
-	api_name	=> 'open-ils.acq.purchase_order.search',
+    method => 'search_purchase_order',
+    api_name    => 'open-ils.acq.purchase_order.search',
     stream => 1,
-	signature => {
+    signature => {
         desc => 'Search for a purchase order',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -981,8 +981,8 @@ sub retrieve_purchase_order_impl {
 
 
 __PACKAGE__->register_method(
-	method => 'format_po',
-	api_name	=> 'open-ils.acq.purchase_order.format'
+    method => 'format_po',
+    api_name    => 'open-ils.acq.purchase_order.format'
 );
 
 sub format_po {
@@ -998,8 +998,8 @@ sub format_po {
 }
 
 __PACKAGE__->register_method(
-	method => 'format_lineitem',
-	api_name	=> 'open-ils.acq.lineitem.format'
+    method => 'format_lineitem',
+    api_name    => 'open-ils.acq.lineitem.format'
 );
 
 sub format_lineitem {
@@ -1139,12 +1139,12 @@ sub po_events {
 }
 
 __PACKAGE__->register_method (
-	method		=> 'update_po_events',
+    method      => 'update_po_events',
     api_name    => 'open-ils.acq.purchase_order.event.cancel.batch',
     stream      => 1,
 );
 __PACKAGE__->register_method (
-	method		=> 'update_po_events',
+    method      => 'update_po_events',
     api_name    => 'open-ils.acq.purchase_order.event.reset.batch',
     stream      => 1,
 );
@@ -1191,10 +1191,10 @@ sub update_po_events {
 
 
 __PACKAGE__->register_method (
-	method		=> 'process_fiscal_rollover',
+    method      => 'process_fiscal_rollover',
     api_name    => 'open-ils.acq.fiscal_rollover.combined',
     stream      => 1,
-	signature => {
+    signature => {
         desc => q/
             Performs a combined fiscal fund rollover process.
 
@@ -1229,10 +1229,10 @@ __PACKAGE__->register_method (
 );
 
 __PACKAGE__->register_method (
-	method		=> 'process_fiscal_rollover',
+    method      => 'process_fiscal_rollover',
     api_name    => 'open-ils.acq.fiscal_rollover.combined.dry_run',
     stream      => 1,
-	signature => {
+    signature => {
         desc => q/
             @see open-ils.acq.fiscal_rollover.combined
             This is the dry-run version.  The action is performed,
@@ -1243,10 +1243,10 @@ __PACKAGE__->register_method (
 );
 
 __PACKAGE__->register_method (
-	method		=> 'process_fiscal_rollover',
+    method      => 'process_fiscal_rollover',
     api_name    => 'open-ils.acq.fiscal_rollover.propagate',
     stream      => 1,
-	signature => {
+    signature => {
         desc => q/
             @see open-ils.acq.fiscal_rollover.combined
             This version performs fund propagation only.  I.e, creation of
@@ -1257,10 +1257,10 @@ __PACKAGE__->register_method (
 );
 
 __PACKAGE__->register_method (
-	method		=> 'process_fiscal_rollover',
+    method      => 'process_fiscal_rollover',
     api_name    => 'open-ils.acq.fiscal_rollover.propagate.dry_run',
     stream      => 1,
-	signature => { desc => q/ 
+    signature => { desc => q/ 
         @see open-ils.acq.fiscal_rollover.propagate 
         This is the dry-run version.  The action is performed,
         new fund information is returned, then all changes are rolled back.
@@ -1348,9 +1348,9 @@ sub process_fiscal_rollover {
 }
 
 __PACKAGE__->register_method(
-	method => 'org_fiscal_year',
-	api_name	=> 'open-ils.acq.org_unit.current_fiscal_year',
-	signature => {
+    method => 'org_fiscal_year',
+    api_name    => 'open-ils.acq.org_unit.current_fiscal_year',
+    signature => {
         desc => q/
             Returns the current fiscal year for the given org unit.
             If no fiscal year is configured, the current calendar
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Invoice.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Invoice.pm
index 2bcce55..b14b9db 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Invoice.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Invoice.pm
@@ -29,9 +29,9 @@ sub _prepare_fund_debit_for_inv_item {
 }
 
 __PACKAGE__->register_method(
-	method => 'build_invoice_api',
-	api_name	=> 'open-ils.acq.invoice.update',
-	signature => {
+    method => 'build_invoice_api',
+    api_name    => 'open-ils.acq.invoice.update',
+    signature => {
         desc => q/Creates, updates, and deletes invoices, and related invoice entries, and invoice items/,
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -455,10 +455,10 @@ sub find_entry_debits {
 
 
 __PACKAGE__->register_method(
-	method => 'build_invoice_api',
-	api_name	=> 'open-ils.acq.invoice.retrieve',
+    method => 'build_invoice_api',
+    api_name    => 'open-ils.acq.invoice.retrieve',
     authoritative => 1,
-	signature => {
+    signature => {
         desc => q/Creates a new stub invoice/,
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -502,9 +502,9 @@ sub fetch_invoice_impl {
 }
 
 __PACKAGE__->register_method(
-	method => 'prorate_invoice',
-	api_name	=> 'open-ils.acq.invoice.apply_prorate',
-	signature => {
+    method => 'prorate_invoice',
+    api_name    => 'open-ils.acq.invoice.apply_prorate',
+    signature => {
         desc => q/
             For all invoice items that have the prorate flag set to true, this will create the necessary 
             additional invoice_item's to prorate the cost across all affected funds by percent spent for each fund.
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem.pm
index 35d4648..925fc85 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Lineitem.pm
@@ -319,10 +319,10 @@ sub update_lineitem_impl {
 }
 
 __PACKAGE__->register_method(
-	method => 'lineitem_search',
-	api_name => 'open-ils.acq.lineitem.search',
+    method => 'lineitem_search',
+    api_name => 'open-ils.acq.lineitem.search',
     stream => 1,
-	signature => {
+    signature => {
         desc => 'Searches lineitems',
         params => [
             {desc => 'Authentication token',       type => 'string'},
@@ -575,10 +575,10 @@ sub lineitem_search_by_attributes {
 
 
 __PACKAGE__->register_method(
-	method    => 'lineitem_search_ident',
-	api_name  => 'open-ils.acq.lineitem.search.ident',
+    method    => 'lineitem_search_ident',
+    api_name  => 'open-ils.acq.lineitem.search.ident',
     stream    => 1,
-	signature => {
+    signature => {
         desc => 'Performs a search against lineitem_attrs where ident is true',
         params => [
             {desc => 'Authentication token', type => 'string'},
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
index d8f7e8d..7313471 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
@@ -915,9 +915,9 @@ sub create_lineitem_detail_debit {
 
 
 __PACKAGE__->register_method(
-	"method" => "fund_exceeds_balance_percent_api",
-	"api_name" => "open-ils.acq.fund.check_balance_percentages",
-	"signature" => {
+    "method" => "fund_exceeds_balance_percent_api",
+    "api_name" => "open-ils.acq.fund.check_balance_percentages",
+    "signature" => {
         "desc" => q/Determine whether a given fund exceeds its defined
             "balance stop and warning percentages"/,
         "params" => [
@@ -1261,10 +1261,10 @@ sub create_copy {
 # ----------------------------------------------------------------------------
 
 __PACKAGE__->register_method(
-	method => 'zsearch',
-	api_name => 'open-ils.acq.picklist.search.z3950',
+    method => 'zsearch',
+    api_name => 'open-ils.acq.picklist.search.z3950',
     stream => 1,
-	signature => {
+    signature => {
         desc => 'Performs a z3950 federated search and creates a picklist and associated lineitems',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -1360,7 +1360,7 @@ sub upload_records {
     my($self, $conn, $auth, $key, $args) = @_;
     $args ||= {};
 
-	my $e = new_editor(authtoken => $auth, xact => 1);
+    my $e = new_editor(authtoken => $auth, xact => 1);
     return $e->die_event unless $e->checkauth;
     my $mgr = OpenILS::Application::Acq::BatchManager->new(editor => $e, conn => $conn);
 
@@ -1418,33 +1418,33 @@ sub upload_records {
 
     $logger->info("acq processing MARC file=$filename");
 
-	my $batch = new MARC::Batch ('USMARC', $filename);
-	$batch->strict_off;
+    my $batch = new MARC::Batch ('USMARC', $filename);
+    $batch->strict_off;
 
-	my $count = 0;
+    my $count = 0;
     my @li_list;
 
-	while(1) {
+    while(1) {
 
-	    my ($err, $xml, $r);
-		$count++;
+        my ($err, $xml, $r);
+        $count++;
 
-		try {
+        try {
             $r = $batch->next;
         } catch Error with {
             $err = shift;
-			$logger->warn("Proccessing of record $count in set $key failed with error $err.  Skipping this record");
+            $logger->warn("Proccessing of record $count in set $key failed with error $err.  Skipping this record");
         };
 
         next if $err;
         last unless $r;
 
-		try {
+        try {
             $xml = clean_marc($r);
-		} catch Error with {
-			$err = shift;
-			$logger->warn("Proccessing XML of record $count in set $key failed with error $err.  Skipping this record");
-		};
+        } catch Error with {
+            $err = shift;
+            $logger->warn("Proccessing XML of record $count in set $key failed with error $err.  Skipping this record");
+        };
 
         next if $err or not $xml;
 
@@ -1470,14 +1470,14 @@ sub upload_records {
 
         push(@li_list, $li->id);
         $mgr->respond;
-	}
+    }
 
     if ($po) {
         $evt = extract_po_name($mgr, $po, \@li_list);
         return $evt if $evt;
     }
 
-	$e->commit;
+    $e->commit;
     unlink($filename);
     $cache->delete_cache('vandelay_import_spool_' . $key);
 
@@ -1686,9 +1686,9 @@ sub extract_lineitem_detail_data {
 # ----------------------------------------------------------------------------
 
 __PACKAGE__->register_method(
-	method => 'create_po_assets',
-	api_name	=> 'open-ils.acq.purchase_order.assets.create',
-	signature => {
+    method => 'create_po_assets',
+    api_name    => 'open-ils.acq.purchase_order.assets.create',
+    signature => {
         desc => q/Creates assets for each lineitem in the purchase order/,
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -2054,9 +2054,9 @@ sub receive_po_api {
 # the same way the LIs and LIDs do.
 
 __PACKAGE__->register_method(
-	method => 'receive_lineitem_detail_api',
-	api_name	=> 'open-ils.acq.lineitem_detail.receive',
-	signature => {
+    method => 'receive_lineitem_detail_api',
+    api_name    => 'open-ils.acq.lineitem_detail.receive',
+    signature => {
         desc => 'Mark a lineitem_detail as received',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -2114,9 +2114,9 @@ sub receive_lineitem_detail_api {
 }
 
 __PACKAGE__->register_method(
-	method => 'receive_lineitem_api',
-	api_name	=> 'open-ils.acq.lineitem.receive',
-	signature => {
+    method => 'receive_lineitem_api',
+    api_name    => 'open-ils.acq.lineitem.receive',
+    signature => {
         desc => 'Mark a lineitem as received',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -2156,10 +2156,10 @@ sub receive_lineitem_api {
 
 
 __PACKAGE__->register_method(
-	method => 'receive_lineitem_batch_api',
-	api_name	=> 'open-ils.acq.lineitem.receive.batch',
+    method => 'receive_lineitem_batch_api',
+    api_name    => 'open-ils.acq.lineitem.receive.batch',
     stream => 1,
-	signature => {
+    signature => {
         desc => 'Mark lineitems as received',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -2790,9 +2790,9 @@ sub not_cancelable {
 }
 
 __PACKAGE__->register_method(
-	method => "cancel_purchase_order_api",
-	api_name	=> "open-ils.acq.purchase_order.cancel",
-	signature => {
+    method => "cancel_purchase_order_api",
+    api_name    => "open-ils.acq.purchase_order.cancel",
+    signature => {
         desc => q/Cancels an on-order purchase order/,
         params => [
             {desc => "Authentication token", type => "string"},
@@ -2899,9 +2899,9 @@ sub cancel_purchase_order {
 
 
 __PACKAGE__->register_method(
-	method => "cancel_lineitem_api",
-	api_name	=> "open-ils.acq.lineitem.cancel",
-	signature => {
+    method => "cancel_lineitem_api",
+    api_name    => "open-ils.acq.lineitem.cancel",
+    signature => {
         desc => q/Cancels an on-order lineitem/,
         params => [
             {desc => "Authentication token", type => "string"},
@@ -2914,9 +2914,9 @@ __PACKAGE__->register_method(
 );
 
 __PACKAGE__->register_method(
-	method => "cancel_lineitem_api",
-	api_name	=> "open-ils.acq.lineitem.cancel.batch",
-	signature => {
+    method => "cancel_lineitem_api",
+    api_name    => "open-ils.acq.lineitem.cancel.batch",
+    signature => {
         desc => q/Batched version of open-ils.acq.lineitem.cancel/,
         return => {desc => q/Object describing changed LIs and LIDs on success;
             Event on error./}
@@ -3127,9 +3127,9 @@ sub cancel_lineitem {
 
 
 __PACKAGE__->register_method(
-	method => "cancel_lineitem_detail_api",
-	api_name	=> "open-ils.acq.lineitem_detail.cancel",
-	signature => {
+    method => "cancel_lineitem_detail_api",
+    api_name    => "open-ils.acq.lineitem_detail.cancel",
+    signature => {
         desc => q/Cancels an on-order lineitem detail/,
         params => [
             {desc => "Authentication token", type => "string"},
@@ -3502,10 +3502,10 @@ sub create_user_request_events {
 
 
 __PACKAGE__->register_method(
-	method => "po_note_CUD_batch",
-	api_name => "open-ils.acq.po_note.cud.batch",
+    method => "po_note_CUD_batch",
+    api_name => "open-ils.acq.po_note.cud.batch",
     stream => 1,
-	signature => {
+    signature => {
         desc => q/Manage purchase order notes/,
         params => [
             {desc => "Authentication token", type => "string"},
@@ -3584,10 +3584,10 @@ sub fetch_and_check_li {
 
 
 __PACKAGE__->register_method(
-	method => "clone_distrib_form",
-	api_name => "open-ils.acq.distribution_formula.clone",
+    method => "clone_distrib_form",
+    api_name => "open-ils.acq.distribution_formula.clone",
     stream => 1,
-	signature => {
+    signature => {
         desc => q/Clone a distribution formula/,
         params => [
             {desc => "Authentication token", type => "string"},
@@ -3627,9 +3627,9 @@ sub clone_distrib_form {
 }
 
 __PACKAGE__->register_method(
-	method => 'add_li_to_po',
-	api_name	=> 'open-ils.acq.purchase_order.add_lineitem',
-	signature => {
+    method => 'add_li_to_po',
+    api_name    => 'open-ils.acq.purchase_order.add_lineitem',
+    signature => {
         desc => q/Adds a lineitem to an existing purchase order/,
         params => [
             {desc => 'Authentication token', type => 'string'},
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Picklist.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Picklist.pm
index eacdaaa..2e9381f 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Picklist.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Picklist.pm
@@ -23,9 +23,9 @@ my $U = 'OpenILS::Application::AppUtils';
 
 
 __PACKAGE__->register_method(
-	method => 'create_picklist',
-	api_name	=> 'open-ils.acq.picklist.create',
-	signature => {
+    method => 'create_picklist',
+    api_name    => 'open-ils.acq.picklist.create',
+    signature => {
         desc => 'Creates a new picklist',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -52,9 +52,9 @@ sub create_picklist {
 
 
 __PACKAGE__->register_method(
-	method => 'update_picklist',
-	api_name	=> 'open-ils.acq.picklist.update',
-	signature => {
+    method => 'update_picklist',
+    api_name    => 'open-ils.acq.picklist.update',
+    signature => {
         desc => 'Updates a new picklist',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -86,10 +86,10 @@ sub update_picklist {
 }
 
 __PACKAGE__->register_method(
-	method => 'retrieve_picklist',
-	api_name	=> 'open-ils.acq.picklist.retrieve',
+    method => 'retrieve_picklist',
+    api_name    => 'open-ils.acq.picklist.retrieve',
     authoritative => 1,
-	signature => {
+    signature => {
         desc => 'Retrieves a picklist',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -148,10 +148,10 @@ sub retrieve_lineitem_count {
 
 
 __PACKAGE__->register_method(
-	method => 'retrieve_picklist_name',
-	api_name	=> 'open-ils.acq.picklist.name.retrieve',
+    method => 'retrieve_picklist_name',
+    api_name    => 'open-ils.acq.picklist.name.retrieve',
     authoritative => 1,
-	signature => {
+    signature => {
         desc => 'Retrieves a picklist by name.  Owner is implied by the caller',
         params => [
             {desc => 'Authentication token',      type => 'string'},
@@ -177,10 +177,10 @@ sub retrieve_picklist_name {
 
 
 __PACKAGE__->register_method(
-	method => 'retrieve_user_picklist',
-	api_name	=> 'open-ils.acq.picklist.user.retrieve',
+    method => 'retrieve_user_picklist',
+    api_name    => 'open-ils.acq.picklist.user.retrieve',
     stream => 1,
-	signature => {
+    signature => {
         desc => 'Retrieves a  user\'s picklists',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -228,10 +228,10 @@ sub retrieve_user_picklist {
 
 
 __PACKAGE__->register_method(
-	method => 'retrieve_all_user_picklist',
-	api_name	=> 'open-ils.acq.picklist.user.all.retrieve',
+    method => 'retrieve_all_user_picklist',
+    api_name    => 'open-ils.acq.picklist.user.all.retrieve',
     stream => 1,
-	signature => {
+    signature => {
         desc => 'Retrieves all of the picklists a user is allowed to see',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -279,10 +279,10 @@ sub retrieve_all_user_picklist {
 }
 
 __PACKAGE__->register_method(
-	method => 'retrieve_pl_lineitem',
-	api_name	=> 'open-ils.acq.lineitem.picklist.retrieve',
+    method => 'retrieve_pl_lineitem',
+    api_name    => 'open-ils.acq.lineitem.picklist.retrieve',
     stream => 1,
-	signature => {
+    signature => {
         desc => 'Retrieves lineitem objects according to picklist',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -453,10 +453,10 @@ sub record_distribution_formula_application {
 
 
 __PACKAGE__->register_method(
-	method => 'ranged_distrib_formulas',
-	api_name	=> 'open-ils.acq.distribution_formula.ranged.retrieve',
+    method => 'ranged_distrib_formulas',
+    api_name    => 'open-ils.acq.distribution_formula.ranged.retrieve',
     stream => 1,
-	signature => {
+    signature => {
         desc => 'Ranged distribution formulas, fleshed with entries',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -505,10 +505,10 @@ sub ranged_distrib_formulas {
 }
 
 __PACKAGE__->register_method(
-	method => "ranged_distrib_formula_applications",
-	api_name => "open-ils.acq.distribution_formula_application.ranged.retrieve",
+    method => "ranged_distrib_formula_applications",
+    api_name => "open-ils.acq.distribution_formula_application.ranged.retrieve",
     stream => 1,
-	signature => {
+    signature => {
         desc => "Ranged distribution formulas applications, fleshed with formulas and users",
         params => [
             {desc => "Authentication token", type => "string"},
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Provider.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Provider.pm
index 10d96cb..b3a7f5c 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Provider.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Provider.pm
@@ -13,9 +13,9 @@ use OpenILS::Application::AppUtils;
 my $U = 'OpenILS::Application::AppUtils';
 
 __PACKAGE__->register_method(
-	method => 'create_provider',
-	api_name	=> 'open-ils.acq.provider.create',
-	signature => {
+    method => 'create_provider',
+    api_name    => 'open-ils.acq.provider.create',
+    signature => {
         desc => 'Creates a new provider',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -38,10 +38,10 @@ sub create_provider {
 
 
 __PACKAGE__->register_method(
-	method => 'retrieve_provider',
-	api_name	=> 'open-ils.acq.provider.retrieve',
+    method => 'retrieve_provider',
+    api_name    => 'open-ils.acq.provider.retrieve',
     authoritative => 1,
-	signature => {
+    signature => {
         desc => 'Retrieves a new provider',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -63,10 +63,10 @@ sub retrieve_provider {
 
 
 __PACKAGE__->register_method(
-	method => 'retrieve_org_providers',
-	api_name	=> 'open-ils.acq.provider.org.retrieve',
+    method => 'retrieve_org_providers',
+    api_name    => 'open-ils.acq.provider.org.retrieve',
     stream => 1,
-	signature => {
+    signature => {
         desc => 'Retrieves all the providers associated with an org unit that the requestor has access to see',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -105,10 +105,10 @@ sub retrieve_org_providers {
 }
 
 __PACKAGE__->register_method(
-	method => 'retrieve_provider_attr_def',
-	api_name	=> 'open-ils.acq.lineitem_provider_attr_definition.provider.retrieve',
+    method => 'retrieve_provider_attr_def',
+    api_name    => 'open-ils.acq.lineitem_provider_attr_definition.provider.retrieve',
     stream => 1,
-	signature => {
+    signature => {
         desc => 'Retrieves all of the lineitem_provider_attr_definition for a given provider',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -133,9 +133,9 @@ sub retrieve_provider_attr_def {
 }
 
 __PACKAGE__->register_method(
-	method => 'create_provider_attr_def',
-	api_name	=> 'open-ils.acq.lineitem_provider_attr_definition.create',
-	signature => {
+    method => 'create_provider_attr_def',
+    api_name    => 'open-ils.acq.lineitem_provider_attr_definition.create',
+    signature => {
         desc => 'Retrieves all of the lineitem_provider_attr_definition for a given provider',
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -159,9 +159,9 @@ sub create_provider_attr_def {
 }
 
 __PACKAGE__->register_method(
-	method => 'delete_provider_attr_def',
-	api_name	=> 'open-ils.acq.lineitem_provider_attr_definition.delete',
-	signature => {
+    method => 'delete_provider_attr_def',
+    api_name    => 'open-ils.acq.lineitem_provider_attr_definition.delete',
+    signature => {
         desc => 'Deletes a lineitem_provider_attr_definition',
         params => [
             {desc => 'Authentication token', type => 'string'},
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
index d818454..0c25c51 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm
@@ -40,9 +40,9 @@ use List::Util qw/max reduce/;
 use UUID::Tiny qw/:std/;
 
 sub initialize {
-	OpenILS::Application::Actor::Container->initialize();
-	OpenILS::Application::Actor::UserGroups->initialize();
-	OpenILS::Application::Actor::ClosedDates->initialize();
+    OpenILS::Application::Actor::Container->initialize();
+    OpenILS::Application::Actor::UserGroups->initialize();
+    OpenILS::Application::Actor::ClosedDates->initialize();
 }
 
 my $apputils = "OpenILS::Application::AppUtils";
@@ -56,8 +56,8 @@ my $set_ou_settings;
 
 
 #__PACKAGE__->register_method(
-#	method	=> "allowed_test",
-#	api_name	=> "open-ils.actor.allowed_test",
+#   method  => "allowed_test",
+#   api_name    => "open-ils.actor.allowed_test",
 #);
 #sub allowed_test {
 #    my($self, $conn, $auth, $orgid, $permcode) = @_;
@@ -72,11 +72,11 @@ my $set_ou_settings;
 #}
 
 __PACKAGE__->register_method(
-	method	=> "update_user_setting",
-	api_name	=> "open-ils.actor.patron.settings.update",
+    method  => "update_user_setting",
+    api_name    => "open-ils.actor.patron.settings.update",
 );
 sub update_user_setting {
-	my($self, $conn, $auth, $user_id, $settings) = @_;
+    my($self, $conn, $auth, $user_id, $settings) = @_;
     my $e = new_editor(xact => 1, authtoken => $auth);
     return $e->die_event unless $e->checkauth;
 
@@ -131,14 +131,14 @@ __PACKAGE__->register_method(
 );
 
 sub set_ou_settings {
-	my( $self, $client, $auth, $org_id, $settings ) = @_;
+    my( $self, $client, $auth, $org_id, $settings ) = @_;
 
     my $e = new_editor(authtoken => $auth, xact => 1);
     return $e->die_event unless $e->checkauth;
 
     my $all_allowed = $e->allowed("UPDATE_ORG_UNIT_SETTING_ALL", $org_id);
 
-	for my $name (keys %$settings) {
+    for my $name (keys %$settings) {
         my $val = $$settings{$name};
 
         my $type = $e->retrieve_config_org_unit_setting_type([
@@ -179,7 +179,7 @@ __PACKAGE__->register_method(
     api_name => "open-ils.actor.patron.settings.retrieve",
 );
 sub user_settings {
-	my( $self, $client, $auth, $user_id, $setting ) = @_;
+    my( $self, $client, $auth, $user_id, $setting ) = @_;
 
     my $e = new_editor(authtoken => $auth);
     return $e->event unless $e->checkauth;
@@ -207,7 +207,7 @@ sub user_settings {
         }
     } else {
         my $s = $e->search_actor_user_setting({usr => $user_id});
-	    return { map { ( $_->name => OpenSRF::Utils::JSON->JSON2perl($_->value) ) } @$s };
+        return { map { ( $_->name => OpenSRF::Utils::JSON->JSON2perl($_->value) ) } @$s };
     }
 }
 
@@ -226,9 +226,9 @@ __PACKAGE__->register_method(
     }
 );
 sub ranged_ou_settings {
-	my( $self, $client, $auth, $org_id ) = @_;
+    my( $self, $client, $auth, $org_id ) = @_;
 
-	my $e = new_editor(authtoken => $auth);
+    my $e = new_editor(authtoken => $auth);
     return $e->event unless $e->checkauth;
 
     my %ranged_settings;
@@ -259,7 +259,7 @@ sub ranged_ou_settings {
         }
     }
 
-	return \%ranged_settings;
+    return \%ranged_settings;
 }
 
 
@@ -339,34 +339,34 @@ __PACKAGE__->register_method(
 );
 
 sub update_patron {
-	my( $self, $client, $user_session, $patron ) = @_;
+    my( $self, $client, $user_session, $patron ) = @_;
 
-	my $session = $apputils->start_db_session();
+    my $session = $apputils->start_db_session();
 
-	$logger->info($patron->isnew ? "Creating new patron..." : "Updating Patron: " . $patron->id);
+    $logger->info($patron->isnew ? "Creating new patron..." : "Updating Patron: " . $patron->id);
 
-	my( $user_obj, $evt ) = $U->checkses($user_session);
-	return $evt if $evt;
+    my( $user_obj, $evt ) = $U->checkses($user_session);
+    return $evt if $evt;
 
-	$evt = check_group_perm($session, $user_obj, $patron);
-	return $evt if $evt;
+    $evt = check_group_perm($session, $user_obj, $patron);
+    return $evt if $evt;
 
-	$apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
+    $apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
 
-	# $new_patron is the patron in progress.  $patron is the original patron
-	# passed in with the method.  new_patron will change as the components
-	# of patron are added/updated.
+    # $new_patron is the patron in progress.  $patron is the original patron
+    # passed in with the method.  new_patron will change as the components
+    # of patron are added/updated.
 
-	my $new_patron;
+    my $new_patron;
 
-	# unflesh the real items on the patron
-	$patron->card( $patron->card->id ) if(ref($patron->card));
-	$patron->billing_address( $patron->billing_address->id ) 
-		if(ref($patron->billing_address));
-	$patron->mailing_address( $patron->mailing_address->id ) 
-		if(ref($patron->mailing_address));
+    # unflesh the real items on the patron
+    $patron->card( $patron->card->id ) if(ref($patron->card));
+    $patron->billing_address( $patron->billing_address->id ) 
+        if(ref($patron->billing_address));
+    $patron->mailing_address( $patron->mailing_address->id ) 
+        if(ref($patron->mailing_address));
 
-	# create/update the patron first so we can use his id
+    # create/update the patron first so we can use his id
 
     # $patron is the obj from the client (new data) and $new_patron is the
     # patron object properly built for db insertion, so we need a third variable
@@ -375,14 +375,14 @@ sub update_patron {
     my $old_patron;
     my $barred_hook = '';
 
-	if($patron->isnew()) {
-		( $new_patron, $evt ) = _add_patron($session, _clone_patron($patron), $user_obj);
-		return $evt if $evt;
-		if($U->is_true($patron->barred)) {
-			$evt = $U->check_perms($user_obj->id, $patron->home_ou, 'BAR_PATRON');
-			return $evt if $evt;
-		}
-	} else {
+    if($patron->isnew()) {
+        ( $new_patron, $evt ) = _add_patron($session, _clone_patron($patron), $user_obj);
+        return $evt if $evt;
+        if($U->is_true($patron->barred)) {
+            $evt = $U->check_perms($user_obj->id, $patron->home_ou, 'BAR_PATRON');
+            return $evt if $evt;
+        }
+    } else {
         $new_patron = $patron;
 
         # Did auth checking above already.
@@ -399,46 +399,46 @@ sub update_patron {
         }
     }
 
-	( $new_patron, $evt ) = _add_update_addresses($session, $patron, $new_patron, $user_obj);
-	return $evt if $evt;
+    ( $new_patron, $evt ) = _add_update_addresses($session, $patron, $new_patron, $user_obj);
+    return $evt if $evt;
 
-	( $new_patron, $evt ) = _add_update_cards($session, $patron, $new_patron, $user_obj);
-	return $evt if $evt;
+    ( $new_patron, $evt ) = _add_update_cards($session, $patron, $new_patron, $user_obj);
+    return $evt if $evt;
 
-	( $new_patron, $evt ) = _add_survey_responses($session, $patron, $new_patron, $user_obj);
-	return $evt if $evt;
+    ( $new_patron, $evt ) = _add_survey_responses($session, $patron, $new_patron, $user_obj);
+    return $evt if $evt;
 
-	# re-update the patron if anything has happened to him during this process
-	if($new_patron->ischanged()) {
-		( $new_patron, $evt ) = _update_patron($session, $new_patron, $user_obj);
-		return $evt if $evt;
-	}
+    # re-update the patron if anything has happened to him during this process
+    if($new_patron->ischanged()) {
+        ( $new_patron, $evt ) = _update_patron($session, $new_patron, $user_obj);
+        return $evt if $evt;
+    }
 
-	( $new_patron, $evt ) = _clear_badcontact_penalties($session, $old_patron, $new_patron, $user_obj);
-	return $evt if $evt;
+    ( $new_patron, $evt ) = _clear_badcontact_penalties($session, $old_patron, $new_patron, $user_obj);
+    return $evt if $evt;
 
-	($new_patron, $evt) = _create_stat_maps($session, $user_session, $patron, $new_patron, $user_obj);
-	return $evt if $evt;
+    ($new_patron, $evt) = _create_stat_maps($session, $user_session, $patron, $new_patron, $user_obj);
+    return $evt if $evt;
 
-	($new_patron, $evt) = _create_perm_maps($session, $user_session, $patron, $new_patron, $user_obj);
-	return $evt if $evt;
+    ($new_patron, $evt) = _create_perm_maps($session, $user_session, $patron, $new_patron, $user_obj);
+    return $evt if $evt;
 
-	$apputils->commit_db_session($session);
+    $apputils->commit_db_session($session);
 
     $evt = apply_invalid_addr_penalty($patron);
     return $evt if $evt;
 
     my $tses = OpenSRF::AppSession->create('open-ils.trigger');
-	if($patron->isnew) {
+    if($patron->isnew) {
         $tses->request('open-ils.trigger.event.autocreate', 'au.create', $new_patron, $new_patron->home_ou);
-	} else {
+    } else {
         $tses->request('open-ils.trigger.event.autocreate', 'au.update', $new_patron, $new_patron->home_ou);
 
         $tses->request('open-ils.trigger.event.autocreate', $barred_hook, 
             $new_patron, $new_patron->home_ou) if $barred_hook;
     }
 
-	return flesh_user($new_patron->id(), new_editor(requestor => $user_obj, xact => 1));
+    return flesh_user($new_patron->id(), new_editor(requestor => $user_obj, xact => 1));
 }
 
 sub apply_invalid_addr_penalty {
@@ -489,23 +489,23 @@ sub apply_invalid_addr_penalty {
 
 
 sub flesh_user {
-	my $id = shift;
+    my $id = shift;
     my $e = shift;
     my $home_ou = shift;
 
     my $fields = [
-		"cards",
-		"card",
-		"standing_penalties",
-		"addresses",
-		"billing_address",
-		"mailing_address",
-		"stat_cat_entries",
-		"settings",
-		"usr_activity"
+        "cards",
+        "card",
+        "standing_penalties",
+        "addresses",
+        "billing_address",
+        "mailing_address",
+        "stat_cat_entries",
+        "settings",
+        "usr_activity"
     ];
     push @$fields, "home_ou" if $home_ou;
-	return new_flesh_user($id, $fields, $e );
+    return new_flesh_user($id, $fields, $e );
 }
 
 
@@ -515,145 +515,145 @@ sub flesh_user {
 
 # clone and clear stuff that would break the database
 sub _clone_patron {
-	my $patron = shift;
-
-	my $new_patron = $patron->clone;
-	# clear these
-	$new_patron->clear_billing_address();
-	$new_patron->clear_mailing_address();
-	$new_patron->clear_addresses();
-	$new_patron->clear_card();
-	$new_patron->clear_cards();
-	$new_patron->clear_id();
-	$new_patron->clear_isnew();
-	$new_patron->clear_ischanged();
-	$new_patron->clear_isdeleted();
-	$new_patron->clear_stat_cat_entries();
-	$new_patron->clear_permissions();
-	$new_patron->clear_standing_penalties();
-
-	return $new_patron;
+    my $patron = shift;
+
+    my $new_patron = $patron->clone;
+    # clear these
+    $new_patron->clear_billing_address();
+    $new_patron->clear_mailing_address();
+    $new_patron->clear_addresses();
+    $new_patron->clear_card();
+    $new_patron->clear_cards();
+    $new_patron->clear_id();
+    $new_patron->clear_isnew();
+    $new_patron->clear_ischanged();
+    $new_patron->clear_isdeleted();
+    $new_patron->clear_stat_cat_entries();
+    $new_patron->clear_permissions();
+    $new_patron->clear_standing_penalties();
+
+    return $new_patron;
 }
 
 
 sub _add_patron {
 
-	my $session		= shift;
-	my $patron		= shift;
-	my $user_obj	= shift;
+    my $session     = shift;
+    my $patron      = shift;
+    my $user_obj    = shift;
 
-	my $evt = $U->check_perms($user_obj->id, $patron->home_ou, 'CREATE_USER');
-	return (undef, $evt) if $evt;
+    my $evt = $U->check_perms($user_obj->id, $patron->home_ou, 'CREATE_USER');
+    return (undef, $evt) if $evt;
 
-	my $ex = $session->request(
-		'open-ils.storage.direct.actor.user.search.usrname', $patron->usrname())->gather(1);
-	if( $ex and @$ex ) {
-		return (undef, OpenILS::Event->new('USERNAME_EXISTS'));
-	}
+    my $ex = $session->request(
+        'open-ils.storage.direct.actor.user.search.usrname', $patron->usrname())->gather(1);
+    if( $ex and @$ex ) {
+        return (undef, OpenILS::Event->new('USERNAME_EXISTS'));
+    }
 
-	$logger->info("Creating new user in the DB with username: ".$patron->usrname());
+    $logger->info("Creating new user in the DB with username: ".$patron->usrname());
 
-	my $id = $session->request(
-		"open-ils.storage.direct.actor.user.create", $patron)->gather(1);
-	return (undef, $U->DB_UPDATE_FAILED($patron)) unless $id;
+    my $id = $session->request(
+        "open-ils.storage.direct.actor.user.create", $patron)->gather(1);
+    return (undef, $U->DB_UPDATE_FAILED($patron)) unless $id;
 
-	$logger->info("Successfully created new user [$id] in DB");
+    $logger->info("Successfully created new user [$id] in DB");
 
-	return ( $session->request( 
-		"open-ils.storage.direct.actor.user.retrieve", $id)->gather(1), undef );
+    return ( $session->request( 
+        "open-ils.storage.direct.actor.user.retrieve", $id)->gather(1), undef );
 }
 
 
 sub check_group_perm {
-	my( $session, $requestor, $patron ) = @_;
-	my $evt;
-
-	# first let's see if the requestor has 
-	# priveleges to update this user in any way
-	if( ! $patron->isnew ) {
-		my $p = $session->request(
-			'open-ils.storage.direct.actor.user.retrieve', $patron->id )->gather(1);
-
-		# If we are the requestor (trying to update our own account)
-		# and we are not trying to change our profile, we're good
-		if( $p->id == $requestor->id and 
-				$p->profile == $patron->profile ) {
-			return undef;
-		}
-
-
-		$evt = group_perm_failed($session, $requestor, $p);
-		return $evt if $evt;
-	}
-
-	# They are allowed to edit this patron.. can they put the 
-	# patron into the group requested?
-	$evt = group_perm_failed($session, $requestor, $patron);
-	return $evt if $evt;
-	return undef;
+    my( $session, $requestor, $patron ) = @_;
+    my $evt;
+
+    # first let's see if the requestor has 
+    # priveleges to update this user in any way
+    if( ! $patron->isnew ) {
+        my $p = $session->request(
+            'open-ils.storage.direct.actor.user.retrieve', $patron->id )->gather(1);
+
+        # If we are the requestor (trying to update our own account)
+        # and we are not trying to change our profile, we're good
+        if( $p->id == $requestor->id and 
+                $p->profile == $patron->profile ) {
+            return undef;
+        }
+
+
+        $evt = group_perm_failed($session, $requestor, $p);
+        return $evt if $evt;
+    }
+
+    # They are allowed to edit this patron.. can they put the 
+    # patron into the group requested?
+    $evt = group_perm_failed($session, $requestor, $patron);
+    return $evt if $evt;
+    return undef;
 }
 
 
 sub group_perm_failed {
-	my( $session, $requestor, $patron ) = @_;
+    my( $session, $requestor, $patron ) = @_;
 
-	my $perm;
-	my $grp;
-	my $grpid = $patron->profile;
+    my $perm;
+    my $grp;
+    my $grpid = $patron->profile;
 
-	do {
+    do {
 
-		$logger->debug("user update looking for group perm for group $grpid");
-		$grp = $session->request(
-			'open-ils.storage.direct.permission.grp_tree.retrieve', $grpid )->gather(1);
-		return OpenILS::Event->new('PERMISSION_GRP_TREE_NOT_FOUND') unless $grp;
+        $logger->debug("user update looking for group perm for group $grpid");
+        $grp = $session->request(
+            'open-ils.storage.direct.permission.grp_tree.retrieve', $grpid )->gather(1);
+        return OpenILS::Event->new('PERMISSION_GRP_TREE_NOT_FOUND') unless $grp;
 
-	} while( !($perm = $grp->application_perm) and ($grpid = $grp->parent) );
+    } while( !($perm = $grp->application_perm) and ($grpid = $grp->parent) );
 
-	$logger->info("user update checking perm $perm on user ".
-		$requestor->id." for update/create on user username=".$patron->usrname);
+    $logger->info("user update checking perm $perm on user ".
+        $requestor->id." for update/create on user username=".$patron->usrname);
 
-	my $evt = $U->check_perms($requestor->id, $patron->home_ou, $perm);
-	return $evt if $evt;
-	return undef;
+    my $evt = $U->check_perms($requestor->id, $patron->home_ou, $perm);
+    return $evt if $evt;
+    return undef;
 }
 
 
 
 sub _update_patron {
-	my( $session, $patron, $user_obj, $noperm) = @_;
+    my( $session, $patron, $user_obj, $noperm) = @_;
 
-	$logger->info("Updating patron ".$patron->id." in DB");
+    $logger->info("Updating patron ".$patron->id." in DB");
 
-	my $evt;
+    my $evt;
 
-	if(!$noperm) {
-		$evt = $U->check_perms($user_obj->id, $patron->home_ou, 'UPDATE_USER');
-		return (undef, $evt) if $evt;
-	}
+    if(!$noperm) {
+        $evt = $U->check_perms($user_obj->id, $patron->home_ou, 'UPDATE_USER');
+        return (undef, $evt) if $evt;
+    }
 
-	# update the password by itself to avoid the password protection magic
-	if( $patron->passwd ) {
-		my $s = $session->request(
-			'open-ils.storage.direct.actor.user.remote_update',
-			{id => $patron->id}, {passwd => $patron->passwd})->gather(1);
-		return (undef, $U->DB_UPDATE_FAILED($patron)) unless defined($s);
-		$patron->clear_passwd;
-	}
+    # update the password by itself to avoid the password protection magic
+    if( $patron->passwd ) {
+        my $s = $session->request(
+            'open-ils.storage.direct.actor.user.remote_update',
+            {id => $patron->id}, {passwd => $patron->passwd})->gather(1);
+        return (undef, $U->DB_UPDATE_FAILED($patron)) unless defined($s);
+        $patron->clear_passwd;
+    }
 
-	if(!$patron->ident_type) {
-		$patron->clear_ident_type;
-		$patron->clear_ident_value;
-	}
+    if(!$patron->ident_type) {
+        $patron->clear_ident_type;
+        $patron->clear_ident_value;
+    }
 
     $evt = verify_last_xact($session, $patron);
     return (undef, $evt) if $evt;
 
-	my $stat = $session->request(
-		"open-ils.storage.direct.actor.user.update",$patron )->gather(1);
-	return (undef, $U->DB_UPDATE_FAILED($patron)) unless defined($stat);
+    my $stat = $session->request(
+        "open-ils.storage.direct.actor.user.update",$patron )->gather(1);
+    return (undef, $U->DB_UPDATE_FAILED($patron)) unless defined($stat);
 
-	return ($patron);
+    return ($patron);
 }
 
 sub verify_last_xact {
@@ -671,207 +671,207 @@ sub verify_last_xact {
 
 
 sub _check_dup_ident {
-	my( $session, $patron ) = @_;
+    my( $session, $patron ) = @_;
 
-	return undef unless $patron->ident_value;
+    return undef unless $patron->ident_value;
 
-	my $search = {
-		ident_type	=> $patron->ident_type, 
-		ident_value => $patron->ident_value,
-	};
+    my $search = {
+        ident_type  => $patron->ident_type, 
+        ident_value => $patron->ident_value,
+    };
 
-	$logger->debug("patron update searching for dup ident values: " . 
-		$patron->ident_type . ':' . $patron->ident_value);
+    $logger->debug("patron update searching for dup ident values: " . 
+        $patron->ident_type . ':' . $patron->ident_value);
 
-	$search->{id} = {'!=' => $patron->id} if $patron->id and $patron->id > 0;
+    $search->{id} = {'!=' => $patron->id} if $patron->id and $patron->id > 0;
 
-	my $dups = $session->request(
-		'open-ils.storage.direct.actor.user.search_where.atomic', $search )->gather(1);
+    my $dups = $session->request(
+        'open-ils.storage.direct.actor.user.search_where.atomic', $search )->gather(1);
 
 
-	return OpenILS::Event->new('PATRON_DUP_IDENT1', payload => $patron )
-		if $dups and @$dups;
+    return OpenILS::Event->new('PATRON_DUP_IDENT1', payload => $patron )
+        if $dups and @$dups;
 
-	return undef;
+    return undef;
 }
 
 
 sub _add_update_addresses {
 
-	my $session = shift;
-	my $patron = shift;
-	my $new_patron = shift;
+    my $session = shift;
+    my $patron = shift;
+    my $new_patron = shift;
 
-	my $evt;
+    my $evt;
 
-	my $current_id; # id of the address before creation
+    my $current_id; # id of the address before creation
 
-	my $addresses = $patron->addresses();
+    my $addresses = $patron->addresses();
 
-	for my $address (@$addresses) {
+    for my $address (@$addresses) {
 
-		next unless ref $address;
-		$current_id = $address->id();
+        next unless ref $address;
+        $current_id = $address->id();
 
-		if( $patron->billing_address() and
-			$patron->billing_address() == $current_id ) {
-			$logger->info("setting billing addr to $current_id");
-			$new_patron->billing_address($address->id());
-			$new_patron->ischanged(1);
-		}
-	
-		if( $patron->mailing_address() and
-			$patron->mailing_address() == $current_id ) {
-			$new_patron->mailing_address($address->id());
-			$logger->info("setting mailing addr to $current_id");
-			$new_patron->ischanged(1);
-		}
+        if( $patron->billing_address() and
+            $patron->billing_address() == $current_id ) {
+            $logger->info("setting billing addr to $current_id");
+            $new_patron->billing_address($address->id());
+            $new_patron->ischanged(1);
+        }
+    
+        if( $patron->mailing_address() and
+            $patron->mailing_address() == $current_id ) {
+            $new_patron->mailing_address($address->id());
+            $logger->info("setting mailing addr to $current_id");
+            $new_patron->ischanged(1);
+        }
 
 
-		if($address->isnew()) {
+        if($address->isnew()) {
 
-			$address->usr($new_patron->id());
+            $address->usr($new_patron->id());
 
-			($address, $evt) = _add_address($session,$address);
-			return (undef, $evt) if $evt;
+            ($address, $evt) = _add_address($session,$address);
+            return (undef, $evt) if $evt;
 
-			# we need to get the new id
-			if( $patron->billing_address() and 
-					$patron->billing_address() == $current_id ) {
-				$new_patron->billing_address($address->id());
-				$logger->info("setting billing addr to $current_id");
-				$new_patron->ischanged(1);
-			}
+            # we need to get the new id
+            if( $patron->billing_address() and 
+                    $patron->billing_address() == $current_id ) {
+                $new_patron->billing_address($address->id());
+                $logger->info("setting billing addr to $current_id");
+                $new_patron->ischanged(1);
+            }
 
-			if( $patron->mailing_address() and
-					$patron->mailing_address() == $current_id ) {
-				$new_patron->mailing_address($address->id());
-				$logger->info("setting mailing addr to $current_id");
-				$new_patron->ischanged(1);
-			}
+            if( $patron->mailing_address() and
+                    $patron->mailing_address() == $current_id ) {
+                $new_patron->mailing_address($address->id());
+                $logger->info("setting mailing addr to $current_id");
+                $new_patron->ischanged(1);
+            }
 
-		} elsif($address->ischanged() ) {
+        } elsif($address->ischanged() ) {
 
-			($address, $evt) = _update_address($session, $address);
-			return (undef, $evt) if $evt;
+            ($address, $evt) = _update_address($session, $address);
+            return (undef, $evt) if $evt;
 
-		} elsif($address->isdeleted() ) {
+        } elsif($address->isdeleted() ) {
 
-			if( $address->id() == $new_patron->mailing_address() ) {
-				$new_patron->clear_mailing_address();
-				($new_patron, $evt) = _update_patron($session, $new_patron);
-				return (undef, $evt) if $evt;
-			}
+            if( $address->id() == $new_patron->mailing_address() ) {
+                $new_patron->clear_mailing_address();
+                ($new_patron, $evt) = _update_patron($session, $new_patron);
+                return (undef, $evt) if $evt;
+            }
 
-			if( $address->id() == $new_patron->billing_address() ) {
-				$new_patron->clear_billing_address();
-				($new_patron, $evt) = _update_patron($session, $new_patron);
-				return (undef, $evt) if $evt;
-			}
+            if( $address->id() == $new_patron->billing_address() ) {
+                $new_patron->clear_billing_address();
+                ($new_patron, $evt) = _update_patron($session, $new_patron);
+                return (undef, $evt) if $evt;
+            }
 
-			$evt = _delete_address($session, $address);
-			return (undef, $evt) if $evt;
-		} 
-	}
+            $evt = _delete_address($session, $address);
+            return (undef, $evt) if $evt;
+        } 
+    }
 
-	return ( $new_patron, undef );
+    return ( $new_patron, undef );
 }
 
 
 # adds an address to the db and returns the address with new id
 sub _add_address {
-	my($session, $address) = @_;
-	$address->clear_id();
+    my($session, $address) = @_;
+    $address->clear_id();
 
-	$logger->info("Creating new address at street ".$address->street1);
+    $logger->info("Creating new address at street ".$address->street1);
 
-	# put the address into the database
-	my $id = $session->request(
-		"open-ils.storage.direct.actor.user_address.create", $address )->gather(1);
-	return (undef, $U->DB_UPDATE_FAILED($address)) unless $id;
+    # put the address into the database
+    my $id = $session->request(
+        "open-ils.storage.direct.actor.user_address.create", $address )->gather(1);
+    return (undef, $U->DB_UPDATE_FAILED($address)) unless $id;
 
-	$address->id( $id );
-	return ($address, undef);
+    $address->id( $id );
+    return ($address, undef);
 }
 
 
 sub _update_address {
-	my( $session, $address ) = @_;
+    my( $session, $address ) = @_;
 
-	$logger->info("Updating address ".$address->id." in the DB");
+    $logger->info("Updating address ".$address->id." in the DB");
 
-	my $stat = $session->request(
-		"open-ils.storage.direct.actor.user_address.update", $address )->gather(1);
+    my $stat = $session->request(
+        "open-ils.storage.direct.actor.user_address.update", $address )->gather(1);
 
-	return (undef, $U->DB_UPDATE_FAILED($address)) unless defined($stat);
-	return ($address, undef);
+    return (undef, $U->DB_UPDATE_FAILED($address)) unless defined($stat);
+    return ($address, undef);
 }
 
 
 
 sub _add_update_cards {
 
-	my $session = shift;
-	my $patron = shift;
-	my $new_patron = shift;
+    my $session = shift;
+    my $patron = shift;
+    my $new_patron = shift;
 
-	my $evt;
+    my $evt;
 
-	my $virtual_id; #id of the card before creation
+    my $virtual_id; #id of the card before creation
 
-	my $cards = $patron->cards();
-	for my $card (@$cards) {
+    my $cards = $patron->cards();
+    for my $card (@$cards) {
 
-		$card->usr($new_patron->id());
+        $card->usr($new_patron->id());
 
-		if(ref($card) and $card->isnew()) {
+        if(ref($card) and $card->isnew()) {
 
-			$virtual_id = $card->id();
-			( $card, $evt ) = _add_card($session,$card);
-			return (undef, $evt) if $evt;
+            $virtual_id = $card->id();
+            ( $card, $evt ) = _add_card($session,$card);
+            return (undef, $evt) if $evt;
 
-			#if(ref($patron->card)) { $patron->card($patron->card->id); }
-			if($patron->card() == $virtual_id) {
-				$new_patron->card($card->id());
-				$new_patron->ischanged(1);
-			}
+            #if(ref($patron->card)) { $patron->card($patron->card->id); }
+            if($patron->card() == $virtual_id) {
+                $new_patron->card($card->id());
+                $new_patron->ischanged(1);
+            }
 
-		} elsif( ref($card) and $card->ischanged() ) {
-			$evt = _update_card($session, $card);
-			return (undef, $evt) if $evt;
-		}
-	}
+        } elsif( ref($card) and $card->ischanged() ) {
+            $evt = _update_card($session, $card);
+            return (undef, $evt) if $evt;
+        }
+    }
 
-	return ( $new_patron, undef );
+    return ( $new_patron, undef );
 }
 
 
 # adds an card to the db and returns the card with new id
 sub _add_card {
-	my( $session, $card ) = @_;
-	$card->clear_id();
+    my( $session, $card ) = @_;
+    $card->clear_id();
 
-	$logger->info("Adding new patron card ".$card->barcode);
+    $logger->info("Adding new patron card ".$card->barcode);
 
-	my $id = $session->request(
-		"open-ils.storage.direct.actor.card.create", $card )->gather(1);
-	return (undef, $U->DB_UPDATE_FAILED($card)) unless $id;
-	$logger->info("Successfully created patron card $id");
+    my $id = $session->request(
+        "open-ils.storage.direct.actor.card.create", $card )->gather(1);
+    return (undef, $U->DB_UPDATE_FAILED($card)) unless $id;
+    $logger->info("Successfully created patron card $id");
 
-	$card->id($id);
-	return ( $card, undef );
+    $card->id($id);
+    return ( $card, undef );
 }
 
 
 # returns event on error.  returns undef otherwise
 sub _update_card {
-	my( $session, $card ) = @_;
-	$logger->info("Updating patron card ".$card->id);
+    my( $session, $card ) = @_;
+    $logger->info("Updating patron card ".$card->id);
 
-	my $stat = $session->request(
-		"open-ils.storage.direct.actor.card.update", $card )->gather(1);
-	return $U->DB_UPDATE_FAILED($card) unless defined($stat);
-	return undef;
+    my $stat = $session->request(
+        "open-ils.storage.direct.actor.card.update", $card )->gather(1);
+    return $U->DB_UPDATE_FAILED($card) unless defined($stat);
+    return undef;
 }
 
 
@@ -879,38 +879,38 @@ sub _update_card {
 
 # returns event on error.  returns undef otherwise
 sub _delete_address {
-	my( $session, $address ) = @_;
+    my( $session, $address ) = @_;
 
-	$logger->info("Deleting address ".$address->id." from DB");
+    $logger->info("Deleting address ".$address->id." from DB");
 
-	my $stat = $session->request(
-		"open-ils.storage.direct.actor.user_address.delete", $address )->gather(1);
+    my $stat = $session->request(
+        "open-ils.storage.direct.actor.user_address.delete", $address )->gather(1);
 
-	return $U->DB_UPDATE_FAILED($address) unless defined($stat);
-	return undef;
+    return $U->DB_UPDATE_FAILED($address) unless defined($stat);
+    return undef;
 }
 
 
 
 sub _add_survey_responses {
-	my ($session, $patron, $new_patron) = @_;
+    my ($session, $patron, $new_patron) = @_;
 
-	$logger->info( "Updating survey responses for patron ".$new_patron->id );
+    $logger->info( "Updating survey responses for patron ".$new_patron->id );
 
-	my $responses = $patron->survey_responses;
+    my $responses = $patron->survey_responses;
 
-	if($responses) {
+    if($responses) {
 
-		$_->usr($new_patron->id) for (@$responses);
+        $_->usr($new_patron->id) for (@$responses);
 
-		my $evt = $U->simplereq( "open-ils.circ", 
-			"open-ils.circ.survey.submit.user_id", $responses );
+        my $evt = $U->simplereq( "open-ils.circ", 
+            "open-ils.circ.survey.submit.user_id", $responses );
 
-		return (undef, $evt) if defined($U->event_code($evt));
+        return (undef, $evt) if defined($U->event_code($evt));
 
-	}
+    }
 
-	return ( $new_patron, undef );
+    return ( $new_patron, undef );
 }
 
 sub _clear_badcontact_penalties {
@@ -970,64 +970,64 @@ sub _clear_badcontact_penalties {
 
 sub _create_stat_maps {
 
-	my($session, $user_session, $patron, $new_patron) = @_;
+    my($session, $user_session, $patron, $new_patron) = @_;
 
-	my $maps = $patron->stat_cat_entries();
+    my $maps = $patron->stat_cat_entries();
 
-	for my $map (@$maps) {
+    for my $map (@$maps) {
 
-		my $method = "open-ils.storage.direct.actor.stat_cat_entry_user_map.update";
+        my $method = "open-ils.storage.direct.actor.stat_cat_entry_user_map.update";
 
-		if ($map->isdeleted()) {
-			$method = "open-ils.storage.direct.actor.stat_cat_entry_user_map.delete";
+        if ($map->isdeleted()) {
+            $method = "open-ils.storage.direct.actor.stat_cat_entry_user_map.delete";
 
-		} elsif ($map->isnew()) {
-			$method = "open-ils.storage.direct.actor.stat_cat_entry_user_map.create";
-			$map->clear_id;
-		}
+        } elsif ($map->isnew()) {
+            $method = "open-ils.storage.direct.actor.stat_cat_entry_user_map.create";
+            $map->clear_id;
+        }
 
 
-		$map->target_usr($new_patron->id);
+        $map->target_usr($new_patron->id);
 
-		#warn "
-		$logger->info("Updating stat entry with method $method and map $map");
+        #warn "
+        $logger->info("Updating stat entry with method $method and map $map");
 
-		my $stat = $session->request($method, $map)->gather(1);
-		return (undef, $U->DB_UPDATE_FAILED($map)) unless defined($stat);
+        my $stat = $session->request($method, $map)->gather(1);
+        return (undef, $U->DB_UPDATE_FAILED($map)) unless defined($stat);
 
-	}
+    }
 
-	return ($new_patron, undef);
+    return ($new_patron, undef);
 }
 
 sub _create_perm_maps {
 
-	my($session, $user_session, $patron, $new_patron) = @_;
+    my($session, $user_session, $patron, $new_patron) = @_;
 
-	my $maps = $patron->permissions;
+    my $maps = $patron->permissions;
 
-	for my $map (@$maps) {
+    for my $map (@$maps) {
 
-		my $method = "open-ils.storage.direct.permission.usr_perm_map.update";
-		if ($map->isdeleted()) {
-			$method = "open-ils.storage.direct.permission.usr_perm_map.delete";
-		} elsif ($map->isnew()) {
-			$method = "open-ils.storage.direct.permission.usr_perm_map.create";
-			$map->clear_id;
-		}
+        my $method = "open-ils.storage.direct.permission.usr_perm_map.update";
+        if ($map->isdeleted()) {
+            $method = "open-ils.storage.direct.permission.usr_perm_map.delete";
+        } elsif ($map->isnew()) {
+            $method = "open-ils.storage.direct.permission.usr_perm_map.create";
+            $map->clear_id;
+        }
 
 
-		$map->usr($new_patron->id);
+        $map->usr($new_patron->id);
 
-		#warn( "Updating permissions with method $method and session $user_session and map $map" );
-		$logger->info( "Updating permissions with method $method and map $map" );
+        #warn( "Updating permissions with method $method and session $user_session and map $map" );
+        $logger->info( "Updating permissions with method $method and map $map" );
 
-		my $stat = $session->request($method, $map)->gather(1);
-		return (undef, $U->DB_UPDATE_FAILED($map)) unless defined($stat);
+        my $stat = $session->request($method, $map)->gather(1);
+        return (undef, $U->DB_UPDATE_FAILED($map)) unless defined($stat);
 
-	}
+    }
 
-	return ($new_patron, undef);
+    return ($new_patron, undef);
 }
 
 
@@ -1042,33 +1042,33 @@ sub set_user_work_ous {
     my $ses    = shift;
     my $maps   = shift;
 
-	my( $requestor, $evt ) = $apputils->checksesperm( $ses, 'ASSIGN_WORK_ORG_UNIT' );
-	return $evt if $evt;
+    my( $requestor, $evt ) = $apputils->checksesperm( $ses, 'ASSIGN_WORK_ORG_UNIT' );
+    return $evt if $evt;
 
-	my $session = $apputils->start_db_session();
-	$apputils->set_audit_info($session, $ses, $requestor->id, $requestor->wsid);
+    my $session = $apputils->start_db_session();
+    $apputils->set_audit_info($session, $ses, $requestor->id, $requestor->wsid);
 
-	for my $map (@$maps) {
+    for my $map (@$maps) {
 
-		my $method = "open-ils.storage.direct.permission.usr_work_ou_map.update";
-		if ($map->isdeleted()) {
-			$method = "open-ils.storage.direct.permission.usr_work_ou_map.delete";
-		} elsif ($map->isnew()) {
-			$method = "open-ils.storage.direct.permission.usr_work_ou_map.create";
-			$map->clear_id;
-		}
+        my $method = "open-ils.storage.direct.permission.usr_work_ou_map.update";
+        if ($map->isdeleted()) {
+            $method = "open-ils.storage.direct.permission.usr_work_ou_map.delete";
+        } elsif ($map->isnew()) {
+            $method = "open-ils.storage.direct.permission.usr_work_ou_map.create";
+            $map->clear_id;
+        }
 
-		#warn( "Updating permissions with method $method and session $ses and map $map" );
-		$logger->info( "Updating work_ou map with method $method and map $map" );
+        #warn( "Updating permissions with method $method and session $ses and map $map" );
+        $logger->info( "Updating work_ou map with method $method and map $map" );
 
-		my $stat = $session->request($method, $map)->gather(1);
-		$logger->warn( "update failed: ".$U->DB_UPDATE_FAILED($map) ) unless defined($stat);
+        my $stat = $session->request($method, $map)->gather(1);
+        $logger->warn( "update failed: ".$U->DB_UPDATE_FAILED($map) ) unless defined($stat);
 
-	}
+    }
 
-	$apputils->commit_db_session($session);
+    $apputils->commit_db_session($session);
 
-	return scalar(@$maps);
+    return scalar(@$maps);
 }
 
 
@@ -1078,55 +1078,55 @@ __PACKAGE__->register_method(
 );
 
 sub set_user_perms {
-	my $self = shift;
-	my $client = shift;
-	my $ses = shift;
-	my $maps = shift;
+    my $self = shift;
+    my $client = shift;
+    my $ses = shift;
+    my $maps = shift;
 
-	my $session = $apputils->start_db_session();
+    my $session = $apputils->start_db_session();
 
-	my( $user_obj, $evt ) = $U->checkses($ses);
-	return $evt if $evt;
-	$apputils->set_audit_info($session, $ses, $user_obj->id, $user_obj->wsid);
+    my( $user_obj, $evt ) = $U->checkses($ses);
+    return $evt if $evt;
+    $apputils->set_audit_info($session, $ses, $user_obj->id, $user_obj->wsid);
 
-	my $perms = $session->request('open-ils.storage.permission.user_perms.atomic', $user_obj->id)->gather(1);
+    my $perms = $session->request('open-ils.storage.permission.user_perms.atomic', $user_obj->id)->gather(1);
 
-	my $all = undef;
-	$all = 1 if ($U->is_true($user_obj->super_user()));
+    my $all = undef;
+    $all = 1 if ($U->is_true($user_obj->super_user()));
     $all = 1 unless ($U->check_perms($user_obj->id, $user_obj->home_ou, 'EVERYTHING'));
 
-	for my $map (@$maps) {
+    for my $map (@$maps) {
 
-		my $method = "open-ils.storage.direct.permission.usr_perm_map.update";
-		if ($map->isdeleted()) {
-			$method = "open-ils.storage.direct.permission.usr_perm_map.delete";
-		} elsif ($map->isnew()) {
-			$method = "open-ils.storage.direct.permission.usr_perm_map.create";
-			$map->clear_id;
-		}
+        my $method = "open-ils.storage.direct.permission.usr_perm_map.update";
+        if ($map->isdeleted()) {
+            $method = "open-ils.storage.direct.permission.usr_perm_map.delete";
+        } elsif ($map->isnew()) {
+            $method = "open-ils.storage.direct.permission.usr_perm_map.create";
+            $map->clear_id;
+        }
 
-		next if (!$all and !grep { $_->perm eq $map->perm and $U->is_true($_->grantable) and $_->depth <= $map->depth } @$perms);
-		#warn( "Updating permissions with method $method and session $ses and map $map" );
-		$logger->info( "Updating permissions with method $method and map $map" );
+        next if (!$all and !grep { $_->perm eq $map->perm and $U->is_true($_->grantable) and $_->depth <= $map->depth } @$perms);
+        #warn( "Updating permissions with method $method and session $ses and map $map" );
+        $logger->info( "Updating permissions with method $method and map $map" );
 
-		my $stat = $session->request($method, $map)->gather(1);
-		$logger->warn( "update failed: ".$U->DB_UPDATE_FAILED($map) ) unless defined($stat);
+        my $stat = $session->request($method, $map)->gather(1);
+        $logger->warn( "update failed: ".$U->DB_UPDATE_FAILED($map) ) unless defined($stat);
 
-	}
+    }
 
-	$apputils->commit_db_session($session);
+    $apputils->commit_db_session($session);
 
-	return scalar(@$maps);
+    return scalar(@$maps);
 }
 
 
 __PACKAGE__->register_method(
-	method	=> "user_retrieve_by_barcode",
+    method  => "user_retrieve_by_barcode",
     authoritative => 1,
-	api_name	=> "open-ils.actor.user.fleshed.retrieve_by_barcode",);
+    api_name    => "open-ils.actor.user.fleshed.retrieve_by_barcode",);
 
 sub user_retrieve_by_barcode {
-	my($self, $client, $auth, $barcode, $flesh_home_ou) = @_;
+    my($self, $client, $auth, $barcode, $flesh_home_ou) = @_;
 
     my $e = new_editor(authtoken => $auth);
     return $e->event unless $e->checkauth;
@@ -1134,7 +1134,7 @@ sub user_retrieve_by_barcode {
     my $card = $e->search_actor_card({barcode => $barcode})->[0]
         or return $e->event;
 
-	my $user = flesh_user($card->usr, $e, $flesh_home_ou);
+    my $user = flesh_user($card->usr, $e, $flesh_home_ou);
     return $e->event unless $e->allowed(
         "VIEW_USER", $flesh_home_ou ? $user->home_ou->id : $user->home_ou
     );
@@ -1150,12 +1150,12 @@ __PACKAGE__->register_method(
 );
 
 sub get_user_by_id {
-	my ($self, $client, $auth, $id) = @_;
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	my $user = $e->retrieve_actor_user($id) or return $e->event;
-	return $e->event unless $e->allowed('VIEW_USER', $user->home_ou);	
-	return $user;
+    my ($self, $client, $auth, $id) = @_;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    my $user = $e->retrieve_actor_user($id) or return $e->event;
+    return $e->event unless $e->allowed('VIEW_USER', $user->home_ou);   
+    return $user;
 }
 
 
@@ -1174,9 +1174,9 @@ __PACKAGE__->register_method(
 );
 my $ident_types;
 sub get_user_ident_types {
-	return $ident_types if $ident_types;
-	return $ident_types = 
-		new_editor()->retrieve_all_config_identification_type();
+    return $ident_types if $ident_types;
+    return $ident_types = 
+        new_editor()->retrieve_all_config_identification_type();
 }
 
 
@@ -1186,15 +1186,15 @@ __PACKAGE__->register_method(
 );
 
 sub get_org_unit {
-	my( $self, $client, $user_session, $org_id ) = @_;
-	my $e = new_editor(authtoken => $user_session);
-	if(!$org_id) {
-		return $e->event unless $e->checkauth;
-		$org_id = $e->requestor->ws_ou;
-	}
-	my $o = $e->retrieve_actor_org_unit($org_id)
-		or return $e->event;
-	return $o;
+    my( $self, $client, $user_session, $org_id ) = @_;
+    my $e = new_editor(authtoken => $user_session);
+    if(!$org_id) {
+        return $e->event unless $e->checkauth;
+        $org_id = $e->requestor->ws_ou;
+    }
+    my $o = $e->retrieve_actor_org_unit($org_id)
+        or return $e->event;
+    return $o;
 }
 
 __PACKAGE__->register_method(
@@ -1204,94 +1204,94 @@ __PACKAGE__->register_method(
 
 sub search_org_unit {
 
-	my( $self, $client, $field, $value ) = @_;
+    my( $self, $client, $field, $value ) = @_;
 
-	my $list = OpenILS::Application::AppUtils->simple_scalar_request(
-		"open-ils.cstore",
-		"open-ils.cstore.direct.actor.org_unit.search.atomic", 
-		{ $field => $value } );
+    my $list = OpenILS::Application::AppUtils->simple_scalar_request(
+        "open-ils.cstore",
+        "open-ils.cstore.direct.actor.org_unit.search.atomic", 
+        { $field => $value } );
 
-	return $list;
+    return $list;
 }
 
 
 # build the org tree
 
 __PACKAGE__->register_method(
-	method	=> "get_org_tree",
-	api_name	=> "open-ils.actor.org_tree.retrieve",
-	argc		=> 0, 
-	note		=> "Returns the entire org tree structure",
+    method  => "get_org_tree",
+    api_name    => "open-ils.actor.org_tree.retrieve",
+    argc        => 0, 
+    note        => "Returns the entire org tree structure",
 );
 
 sub get_org_tree {
-	my $self = shift;
-	my $client = shift;
-	return $U->get_org_tree($client->session->session_locale);
+    my $self = shift;
+    my $client = shift;
+    return $U->get_org_tree($client->session->session_locale);
 }
 
 
 __PACKAGE__->register_method(
-	method	=> "get_org_descendants",
-	api_name	=> "open-ils.actor.org_tree.descendants.retrieve"
+    method  => "get_org_descendants",
+    api_name    => "open-ils.actor.org_tree.descendants.retrieve"
 );
 
 # depth is optional.  org_unit is the id
 sub get_org_descendants {
-	my( $self, $client, $org_unit, $depth ) = @_;
+    my( $self, $client, $org_unit, $depth ) = @_;
 
     if(ref $org_unit eq 'ARRAY') {
         $depth ||= [];
         my @trees;
         for my $i (0..scalar(@$org_unit)-1) {
             my $list = $U->simple_scalar_request(
-			    "open-ils.storage", 
-			    "open-ils.storage.actor.org_unit.descendants.atomic",
-			    $org_unit->[$i], $depth->[$i] );
+                "open-ils.storage", 
+                "open-ils.storage.actor.org_unit.descendants.atomic",
+                $org_unit->[$i], $depth->[$i] );
             push(@trees, $U->build_org_tree($list));
         }
         return \@trees;
 
     } else {
-	    my $orglist = $apputils->simple_scalar_request(
-			    "open-ils.storage", 
-			    "open-ils.storage.actor.org_unit.descendants.atomic",
-			    $org_unit, $depth );
-	    return $U->build_org_tree($orglist);
+        my $orglist = $apputils->simple_scalar_request(
+                "open-ils.storage", 
+                "open-ils.storage.actor.org_unit.descendants.atomic",
+                $org_unit, $depth );
+        return $U->build_org_tree($orglist);
     }
 }
 
 
 __PACKAGE__->register_method(
-	method	=> "get_org_ancestors",
-	api_name	=> "open-ils.actor.org_tree.ancestors.retrieve"
+    method  => "get_org_ancestors",
+    api_name    => "open-ils.actor.org_tree.ancestors.retrieve"
 );
 
 # depth is optional.  org_unit is the id
 sub get_org_ancestors {
-	my( $self, $client, $org_unit, $depth ) = @_;
-	my $orglist = $apputils->simple_scalar_request(
-			"open-ils.storage", 
-			"open-ils.storage.actor.org_unit.ancestors.atomic",
-			$org_unit, $depth );
-	return $U->build_org_tree($orglist);
+    my( $self, $client, $org_unit, $depth ) = @_;
+    my $orglist = $apputils->simple_scalar_request(
+            "open-ils.storage", 
+            "open-ils.storage.actor.org_unit.ancestors.atomic",
+            $org_unit, $depth );
+    return $U->build_org_tree($orglist);
 }
 
 
 __PACKAGE__->register_method(
-	method	=> "get_standings",
-	api_name	=> "open-ils.actor.standings.retrieve"
+    method  => "get_standings",
+    api_name    => "open-ils.actor.standings.retrieve"
 );
 
 my $user_standings;
 sub get_standings {
-	return $user_standings if $user_standings;
-	return $user_standings = 
-		$apputils->simple_scalar_request(
-			"open-ils.cstore",
-			"open-ils.cstore.direct.config.standing.search.atomic",
-			{ id => { "!=" => undef } }
-		);
+    return $user_standings if $user_standings;
+    return $user_standings = 
+        $apputils->simple_scalar_request(
+            "open-ils.cstore",
+            "open-ils.cstore.direct.config.standing.search.atomic",
+            { id => { "!=" => undef } }
+        );
 }
 
 
@@ -1301,15 +1301,15 @@ __PACKAGE__->register_method(
 );
 
 sub get_my_org_path {
-	my( $self, $client, $auth, $org_id ) = @_;
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	$org_id = $e->requestor->ws_ou unless defined $org_id;
-
-	return $apputils->simple_scalar_request(
-		"open-ils.storage",
-		"open-ils.storage.actor.org_unit.full_path.atomic",
-		$org_id );
+    my( $self, $client, $auth, $org_id ) = @_;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    $org_id = $e->requestor->ws_ou unless defined $org_id;
+
+    return $apputils->simple_scalar_request(
+        "open-ils.storage",
+        "open-ils.storage.actor.org_unit.full_path.atomic",
+        $org_id );
 }
 
 
@@ -1318,19 +1318,19 @@ __PACKAGE__->register_method(
     api_name => "open-ils.actor.patron.search.advanced"
 );
 sub patron_adv_search {
-	my( $self, $client, $auth, $search_hash, 
+    my( $self, $client, $auth, $search_hash, 
         $search_limit, $search_sort, $include_inactive, $search_ou ) = @_;
 
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed('VIEW_USER');
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    return $e->event unless $e->allowed('VIEW_USER');
 
-	# depth boundary outside of which patrons must opt-in, default to 0
-	my $opt_boundary = 0;
-	$opt_boundary = $U->ou_ancestor_setting_value($e->requestor->ws_ou,'org.patron_opt_boundary') if user_opt_in_enabled($self);
+    # depth boundary outside of which patrons must opt-in, default to 0
+    my $opt_boundary = 0;
+    $opt_boundary = $U->ou_ancestor_setting_value($e->requestor->ws_ou,'org.patron_opt_boundary') if user_opt_in_enabled($self);
 
-	return $U->storagereq(
-		"open-ils.storage.actor.user.crazy_search", $search_hash, 
+    return $U->storagereq(
+        "open-ils.storage.actor.user.crazy_search", $search_hash, 
             $search_limit, $search_sort, $include_inactive, $e->requestor->ws_ou, $search_ou, $opt_boundary);
 }
 
@@ -1430,106 +1430,106 @@ sub update_passwd {
 __PACKAGE__->register_method(
     method   => "check_user_perms",
     api_name => "open-ils.actor.user.perm.check",
-    notes    => <<"	NOTES");
-	Takes a login session, user id, an org id, and an array of perm type strings.  For each
-	perm type, if the user does *not* have the given permission it is added
-	to a list which is returned from the method.  If all permissions
-	are allowed, an empty list is returned
-	if the logged in user does not match 'user_id', then the logged in user must
-	have VIEW_PERMISSION priveleges.
-	NOTES
+    notes    => <<"    NOTES");
+    Takes a login session, user id, an org id, and an array of perm type strings.  For each
+    perm type, if the user does *not* have the given permission it is added
+    to a list which is returned from the method.  If all permissions
+    are allowed, an empty list is returned
+    if the logged in user does not match 'user_id', then the logged in user must
+    have VIEW_PERMISSION priveleges.
+    NOTES
 
 sub check_user_perms {
-	my( $self, $client, $login_session, $user_id, $org_id, $perm_types ) = @_;
-
-	my( $staff, $evt ) = $apputils->checkses($login_session);
-	return $evt if $evt;
-
-	if($staff->id ne $user_id) {
-		if( $evt = $apputils->check_perms(
-			$staff->id, $org_id, 'VIEW_PERMISSION') ) {
-			return $evt;
-		}
-	}
-
-	my @not_allowed;
-	for my $perm (@$perm_types) {
-		if($apputils->check_perms($user_id, $org_id, $perm)) {
-			push @not_allowed, $perm;
-		}
-	}
-
-	return \@not_allowed
+    my( $self, $client, $login_session, $user_id, $org_id, $perm_types ) = @_;
+
+    my( $staff, $evt ) = $apputils->checkses($login_session);
+    return $evt if $evt;
+
+    if($staff->id ne $user_id) {
+        if( $evt = $apputils->check_perms(
+            $staff->id, $org_id, 'VIEW_PERMISSION') ) {
+            return $evt;
+        }
+    }
+
+    my @not_allowed;
+    for my $perm (@$perm_types) {
+        if($apputils->check_perms($user_id, $org_id, $perm)) {
+            push @not_allowed, $perm;
+        }
+    }
+
+    return \@not_allowed
 }
 
 __PACKAGE__->register_method(
-	method	=> "check_user_perms2",
-	api_name	=> "open-ils.actor.user.perm.check.multi_org",
-	notes		=> q/
-		Checks the permissions on a list of perms and orgs for a user
-		@param authtoken The login session key
-		@param user_id The id of the user to check
-		@param orgs The array of org ids
-		@param perms The array of permission names
-		@return An array of  [ orgId, permissionName ] arrays that FAILED the check
-		if the logged in user does not match 'user_id', then the logged in user must
-		have VIEW_PERMISSION priveleges.
-	/);
+    method  => "check_user_perms2",
+    api_name    => "open-ils.actor.user.perm.check.multi_org",
+    notes       => q/
+        Checks the permissions on a list of perms and orgs for a user
+        @param authtoken The login session key
+        @param user_id The id of the user to check
+        @param orgs The array of org ids
+        @param perms The array of permission names
+        @return An array of  [ orgId, permissionName ] arrays that FAILED the check
+        if the logged in user does not match 'user_id', then the logged in user must
+        have VIEW_PERMISSION priveleges.
+    /);
 
 sub check_user_perms2 {
-	my( $self, $client, $authtoken, $user_id, $orgs, $perms ) = @_;
-
-	my( $staff, $target, $evt ) = $apputils->checkses_requestor(
-		$authtoken, $user_id, 'VIEW_PERMISSION' );
-	return $evt if $evt;
-
-	my @not_allowed;
-	for my $org (@$orgs) {
-		for my $perm (@$perms) {
-			if($apputils->check_perms($user_id, $org, $perm)) {
-				push @not_allowed, [ $org, $perm ];
-			}
-		}
-	}
-
-	return \@not_allowed
+    my( $self, $client, $authtoken, $user_id, $orgs, $perms ) = @_;
+
+    my( $staff, $target, $evt ) = $apputils->checkses_requestor(
+        $authtoken, $user_id, 'VIEW_PERMISSION' );
+    return $evt if $evt;
+
+    my @not_allowed;
+    for my $org (@$orgs) {
+        for my $perm (@$perms) {
+            if($apputils->check_perms($user_id, $org, $perm)) {
+                push @not_allowed, [ $org, $perm ];
+            }
+        }
+    }
+
+    return \@not_allowed
 }
 
 
 __PACKAGE__->register_method(
-	method => 'check_user_perms3',
-	api_name	=> 'open-ils.actor.user.perm.highest_org',
-	notes		=> q/
-		Returns the highest org unit id at which a user has a given permission
-		If the requestor does not match the target user, the requestor must have
-		'VIEW_PERMISSION' rights at the home org unit of the target user
-		@param authtoken The login session key
-		@param userid The id of the user in question
-		@param perm The permission to check
-		@return The org unit highest in the org tree within which the user has
-		the requested permission
-	/);
+    method => 'check_user_perms3',
+    api_name    => 'open-ils.actor.user.perm.highest_org',
+    notes       => q/
+        Returns the highest org unit id at which a user has a given permission
+        If the requestor does not match the target user, the requestor must have
+        'VIEW_PERMISSION' rights at the home org unit of the target user
+        @param authtoken The login session key
+        @param userid The id of the user in question
+        @param perm The permission to check
+        @return The org unit highest in the org tree within which the user has
+        the requested permission
+    /);
 
 sub check_user_perms3 {
-	my($self, $client, $authtoken, $user_id, $perm) = @_;
-	my $e = new_editor(authtoken=>$authtoken);
-	return $e->event unless $e->checkauth;
+    my($self, $client, $authtoken, $user_id, $perm) = @_;
+    my $e = new_editor(authtoken=>$authtoken);
+    return $e->event unless $e->checkauth;
 
-	my $tree = $U->get_org_tree();
+    my $tree = $U->get_org_tree();
 
     unless($e->requestor->id == $user_id) {
         my $user = $e->retrieve_actor_user($user_id)
             or return $e->event;
         return $e->event unless $e->allowed('VIEW_PERMISSION', $user->home_ou);
-	    return $U->find_highest_perm_org($perm, $user_id, $user->home_ou, $tree );
+        return $U->find_highest_perm_org($perm, $user_id, $user->home_ou, $tree );
     }
 
     return $U->find_highest_perm_org($perm, $user_id, $e->requestor->ws_ou, $tree);
 }
 
 __PACKAGE__->register_method(
-	method => 'user_has_work_perm_at',
-	api_name	=> 'open-ils.actor.user.has_work_perm_at',
+    method => 'user_has_work_perm_at',
+    api_name    => 'open-ils.actor.user.has_work_perm_at',
     authoritative => 1,
     signature => {
         desc => q/
@@ -1540,7 +1540,7 @@ __PACKAGE__->register_method(
             the requested action.  The user whose perms this method should
             check is implied by the authtoken. /,
         params => [
-		    {desc => 'authtoken', type => 'string'},
+            {desc => 'authtoken', type => 'string'},
             {desc => 'permission name', type => 'string'},
             {desc => q/user id, optional.  If present, check perms for 
                 this user instead of the logged in user/, type => 'number'},
@@ -1561,8 +1561,8 @@ sub user_has_work_perm_at {
 }
 
 __PACKAGE__->register_method(
-	method => 'user_has_work_perm_at_batch',
-	api_name	=> 'open-ils.actor.user.has_work_perm_at.batch',
+    method => 'user_has_work_perm_at_batch',
+    api_name    => 'open-ils.actor.user.has_work_perm_at.batch',
     authoritative => 1,
 );
 
@@ -1582,37 +1582,37 @@ sub user_has_work_perm_at_batch {
 
 
 __PACKAGE__->register_method(
-	method => 'check_user_perms4',
-	api_name	=> 'open-ils.actor.user.perm.highest_org.batch',
-	notes		=> q/
-		Returns the highest org unit id at which a user has a given permission
-		If the requestor does not match the target user, the requestor must have
-		'VIEW_PERMISSION' rights at the home org unit of the target user
-		@param authtoken The login session key
-		@param userid The id of the user in question
-		@param perms An array of perm names to check 
-		@return An array of orgId's  representing the org unit 
-		highest in the org tree within which the user has the requested permission
-		The arrah of orgId's has matches the order of the perms array
-	/);
+    method => 'check_user_perms4',
+    api_name    => 'open-ils.actor.user.perm.highest_org.batch',
+    notes       => q/
+        Returns the highest org unit id at which a user has a given permission
+        If the requestor does not match the target user, the requestor must have
+        'VIEW_PERMISSION' rights at the home org unit of the target user
+        @param authtoken The login session key
+        @param userid The id of the user in question
+        @param perms An array of perm names to check 
+        @return An array of orgId's  representing the org unit 
+        highest in the org tree within which the user has the requested permission
+        The arrah of orgId's has matches the order of the perms array
+    /);
 
 sub check_user_perms4 {
-	my( $self, $client, $authtoken, $userid, $perms ) = @_;
-	
-	my( $staff, $target, $org, $evt );
-
-	( $staff, $target, $evt ) = $apputils->checkses_requestor(
-		$authtoken, $userid, 'VIEW_PERMISSION' );
-	return $evt if $evt;
-
-	my @arr;
-	return [] unless ref($perms);
-	my $tree = $U->get_org_tree();
-
-	for my $p (@$perms) {
-		push( @arr, $U->find_highest_perm_org( $p, $userid, $target->home_ou, $tree ) );
-	}
-	return \@arr;
+    my( $self, $client, $authtoken, $userid, $perms ) = @_;
+    
+    my( $staff, $target, $org, $evt );
+
+    ( $staff, $target, $evt ) = $apputils->checkses_requestor(
+        $authtoken, $userid, 'VIEW_PERMISSION' );
+    return $evt if $evt;
+
+    my @arr;
+    return [] unless ref($perms);
+    my $tree = $U->get_org_tree();
+
+    for my $p (@$perms) {
+        push( @arr, $U->find_highest_perm_org( $p, $userid, $target->home_ou, $tree ) );
+    }
+    return \@arr;
 }
 
 
@@ -1634,16 +1634,16 @@ __PACKAGE__->register_method(
 );
 
 sub user_fines_summary {
-	my( $self, $client, $auth, $user_id ) = @_;
+    my( $self, $client, $auth, $user_id ) = @_;
 
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
 
-	if( $user_id ne $e->requestor->id ) {
-	    my $user = $e->retrieve_actor_user($user_id) or return $e->event;
-		return $e->event unless 
-			$e->allowed('VIEW_USER_FINES_SUMMARY', $user->home_ou);
-	}
+    if( $user_id ne $e->requestor->id ) {
+        my $user = $e->retrieve_actor_user($user_id) or return $e->event;
+        return $e->event unless 
+            $e->allowed('VIEW_USER_FINES_SUMMARY', $user->home_ou);
+    }
 
     return $e->search_money_open_user_summary({usr => $user_id})->[0];
 }
@@ -1669,10 +1669,10 @@ __PACKAGE__->register_method(
 );
 
 sub user_opac_vitals {
-	my( $self, $client, $auth, $user_id ) = @_;
+    my( $self, $client, $auth, $user_id ) = @_;
 
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
 
     $user_id ||= $e->requestor->id;
 
@@ -1791,7 +1791,7 @@ __PACKAGE__->register_method(
 
 
 sub user_transactions {
-	my( $self, $client, $auth, $user_id, $type, $options ) = @_;
+    my( $self, $client, $auth, $user_id, $type, $options ) = @_;
     $options ||= {};
 
     my $e = new_editor(authtoken => $auth);
@@ -1813,28 +1813,28 @@ sub user_transactions {
     $method = "$method.authoritative" if $api =~ /authoritative/;
     my ($trans) = $self->method_lookup($method)->run($auth, $user_id, $type, $filter, $options);
 
-	if($api =~ /total/o) { 
-		my $total = 0.0;
+    if($api =~ /total/o) { 
+        my $total = 0.0;
         $total += $_->balance_owed for @$trans;
-		return $total;
-	}
+        return $total;
+    }
 
     ($api =~ /count/o  ) and return scalar @$trans;
     ($api !~ /fleshed/o) and return $trans;
 
-	my @resp;
-	for my $t (@$trans) {
-			
-		if( $t->xact_type ne 'circulation' ) {
-			push @resp, {transaction => $t};
-			next;
-		}
+    my @resp;
+    for my $t (@$trans) {
+            
+        if( $t->xact_type ne 'circulation' ) {
+            push @resp, {transaction => $t};
+            next;
+        }
 
         my $circ_data = flesh_circ($e, $t->id);
-		push @resp, {transaction => $t, %$circ_data};
-	}
+        push @resp, {transaction => $t, %$circ_data};
+    }
 
-	return \@resp; 
+    return \@resp; 
 } 
 
 
@@ -1855,7 +1855,7 @@ __PACKAGE__->register_method(
 );
 
 sub user_transaction_retrieve {
-	my($self, $client, $auth, $bill_id) = @_;
+    my($self, $client, $auth, $bill_id) = @_;
 
     my $e = new_editor(authtoken => $auth);
     return $e->event unless $e->checkauth;
@@ -1872,7 +1872,7 @@ sub user_transaction_retrieve {
 
     my $circ_data = flesh_circ($e, $trans->id, 1);
 
-	return {transaction => $trans, %$circ_data};
+    return {transaction => $trans, %$circ_data};
 }
 
 sub flesh_circ {
@@ -1891,7 +1891,7 @@ sub flesh_circ {
         }
     ]);
 
-	my $mods;
+    my $mods;
     my $copy = $circ->target_copy;
 
     if($circ->target_copy->call_number->id == OILS_PRECAT_CALL_NUMBER) {
@@ -1908,7 +1908,7 @@ sub flesh_circ {
     $circ->target_copy($circ->target_copy->id);
     $copy->call_number($copy->call_number->id);
 
-	return {circ => $circ, record => $mods, copy => ($flesh_copy) ? $copy : undef };
+    return {circ => $circ, record => $mods, copy => ($flesh_copy) ? $copy : undef };
 }
 
 
@@ -1919,9 +1919,9 @@ __PACKAGE__->register_method(
     argc          => 1,
     notes         => 'Returns hold ready/total counts'
 );
-	
+    
 sub hold_request_count {
-	my( $self, $client, $authtoken, $user_id ) = @_;
+    my( $self, $client, $authtoken, $user_id ) = @_;
     my $e = new_editor(authtoken => $authtoken);
     return $e->event unless $e->checkauth;
 
@@ -1942,7 +1942,7 @@ sub hold_request_count {
         }
     });
 
-	return { 
+    return { 
         total => scalar(@$holds), 
         ready => scalar(
             grep { 
@@ -1958,7 +1958,7 @@ __PACKAGE__->register_method(
     api_name      => "open-ils.actor.user.checked_out",
     authoritative => 1,
     argc          => 2,
-	signature     => {
+    signature     => {
         desc => "For a given user, returns a structure of circulations objects sorted by out, overdue, lost, claims_returned, long_overdue. "
               . "A list of IDs are returned of each type.  Circs marked lost, long_overdue, and claims_returned will not be 'finished' "
               . "(i.e., outstanding balance or some other pending action on the circ). "
@@ -1983,28 +1983,28 @@ __PACKAGE__->register_method(
 );
 
 sub checked_out {
-	my( $self, $conn, $auth, $userid ) = @_;
+    my( $self, $conn, $auth, $userid ) = @_;
 
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
 
-	if( $userid ne $e->requestor->id ) {
+    if( $userid ne $e->requestor->id ) {
         my $user = $e->retrieve_actor_user($userid) or return $e->event;
-		unless($e->allowed('VIEW_CIRCULATIONS', $user->home_ou)) {
+        unless($e->allowed('VIEW_CIRCULATIONS', $user->home_ou)) {
 
             # see if there is a friend link allowing circ.view perms
             my $allowed = OpenILS::Application::Actor::Friends->friend_perm_allowed(
                 $e, $userid, $e->requestor->id, 'circ.view');
             return $e->event unless $allowed;
         }
-	}
+    }
 
-	my $count = $self->api_name =~ /count/;
-	return _checked_out( $count, $e, $userid );
+    my $count = $self->api_name =~ /count/;
+    return _checked_out( $count, $e, $userid );
 }
 
 sub _checked_out {
-	my( $iscount, $e, $userid ) = @_;
+    my( $iscount, $e, $userid ) = @_;
 
     my %result = (
         out => [],
@@ -2013,10 +2013,10 @@ sub _checked_out {
         claims_returned => [],
         long_overdue => []
     );
-	my $meth = 'retrieve_action_open_circ_';
+    my $meth = 'retrieve_action_open_circ_';
 
     if ($iscount) {
-	    $meth .= 'count';
+        $meth .= 'count';
         %result = (
             out => 0,
             overdue => 0,
@@ -2025,7 +2025,7 @@ sub _checked_out {
             long_overdue => 0
         );
     } else {
-	    $meth .= 'list';
+        $meth .= 'list';
     }
 
     my $data = $e->$meth($userid);
@@ -2055,37 +2055,37 @@ __PACKAGE__->register_method(
 );
 
 sub checked_in_with_fines {
-	my( $self, $conn, $auth, $userid ) = @_;
-
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-
-	if( $userid ne $e->requestor->id ) {
-		return $e->event unless $e->allowed('VIEW_CIRCULATIONS');
-	}
-
-	# money is owed on these items and they are checked in
-	my $open = $e->search_action_circulation(
-		{
-			usr				=> $userid, 
-			xact_finish		=> undef,
-			checkin_time	=> { "!=" => undef },
-		}
-	);
-
-
-	my( @lost, @cr, @lo );
-	for my $c (@$open) {
-		push( @lost, $c->id ) if $c->stop_fines eq 'LOST';
-		push( @cr, $c->id ) if $c->stop_fines eq 'CLAIMSRETURNED';
-		push( @lo, $c->id ) if $c->stop_fines eq 'LONGOVERDUE';
-	}
-
-	return {
-		lost		=> \@lost,
-		claims_returned	=> \@cr,
-		long_overdue		=> \@lo
-	};
+    my( $self, $conn, $auth, $userid ) = @_;
+
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+
+    if( $userid ne $e->requestor->id ) {
+        return $e->event unless $e->allowed('VIEW_CIRCULATIONS');
+    }
+
+    # money is owed on these items and they are checked in
+    my $open = $e->search_action_circulation(
+        {
+            usr             => $userid, 
+            xact_finish     => undef,
+            checkin_time    => { "!=" => undef },
+        }
+    );
+
+
+    my( @lost, @cr, @lo );
+    for my $c (@$open) {
+        push( @lost, $c->id ) if $c->stop_fines eq 'LOST';
+        push( @cr, $c->id ) if $c->stop_fines eq 'CLAIMSRETURNED';
+        push( @lo, $c->id ) if $c->stop_fines eq 'LONGOVERDUE';
+    }
+
+    return {
+        lost        => \@lost,
+        claims_returned => \@cr,
+        long_overdue        => \@lo
+    };
 }
 
 
@@ -2134,25 +2134,25 @@ foreach (keys %auth_hist_methods) {
 }
 
 sub user_transaction_history {
-	my( $self, $conn, $auth, $userid, $type, $filter, $options ) = @_;
+    my( $self, $conn, $auth, $userid, $type, $filter, $options ) = @_;
     $filter ||= {};
     $options ||= {};
 
-	my $e = new_editor(authtoken=>$auth);
-	return $e->die_event unless $e->checkauth;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->die_event unless $e->checkauth;
 
-	if ($e->requestor->id ne $userid) {
+    if ($e->requestor->id ne $userid) {
         return $e->die_event unless $e->allowed('VIEW_USER_TRANSACTIONS');
-	}
+    }
 
-	my $api = $self->api_name;
-	my @xact_finish  = (xact_finish => undef ) if ($api =~ /history\.still_open$/);     # What about history.still_open.ids?
+    my $api = $self->api_name;
+    my @xact_finish  = (xact_finish => undef ) if ($api =~ /history\.still_open$/);     # What about history.still_open.ids?
 
-	if(defined($type)) {
-		$filter->{'xact_type'} = $type;
-	}
+    if(defined($type)) {
+        $filter->{'xact_type'} = $type;
+    }
 
-	if($api =~ /have_bill_or_payment/o) {
+    if($api =~ /have_bill_or_payment/o) {
 
         # transactions that have a non-zero sum across all billings or at least 1 payment
         $filter->{'-or'} = {
@@ -2169,17 +2169,17 @@ sub user_transaction_history {
         # transactions that have a non-zero overall balance
         $filter->{'balance_owed'} = { '<>' => 0 };
 
-	} elsif( $api =~ /have_charge/o) {
+    } elsif( $api =~ /have_charge/o) {
 
         # transactions that have at least 1 billing, regardless of whether it was voided
         $filter->{'last_billing_ts'} = { '<>' => undef };
 
-	} elsif( $api =~ /have_bill/o) {    # needs to be an elsif, or we double-match have_bill_or_payment!
+    } elsif( $api =~ /have_bill/o) {    # needs to be an elsif, or we double-match have_bill_or_payment!
 
         # transactions that have non-zero sum across all billings.  This will exclude
         # xacts where all billings have been voided
         $filter->{'total_owed'} = { '<>' => 0 };
-	}
+    }
 
     my $options_clause = { order_by => { mbt => 'xact_start DESC' } };
     $options_clause->{'limit'} = $options->{'limit'} if $options->{'limit'}; 
@@ -2194,19 +2194,19 @@ sub user_transaction_history {
     return [map {$_->id} @$mbts] if $api =~ /\.ids/;
     return $mbts unless $api =~ /fleshed/;
 
-	my @resp;
-	for my $t (@$mbts) {
-			
-		if( $t->xact_type ne 'circulation' ) {
-			push @resp, {transaction => $t};
-			next;
-		}
+    my @resp;
+    for my $t (@$mbts) {
+            
+        if( $t->xact_type ne 'circulation' ) {
+            push @resp, {transaction => $t};
+            next;
+        }
 
         my $circ_data = flesh_circ($e, $t->id);
-		push @resp, {transaction => $t, %$circ_data};
-	}
+        push @resp, {transaction => $t, %$circ_data};
+    }
 
-	return \@resp; 
+    return \@resp; 
 }
 
 
@@ -2217,23 +2217,23 @@ __PACKAGE__->register_method(
     argc     => 1,
     notes    => "Returns a list of permissions"
 );
-	
+    
 sub user_perms {
-	my( $self, $client, $authtoken, $user ) = @_;
+    my( $self, $client, $authtoken, $user ) = @_;
 
-	my( $staff, $evt ) = $apputils->checkses($authtoken);
-	return $evt if $evt;
+    my( $staff, $evt ) = $apputils->checkses($authtoken);
+    return $evt if $evt;
 
-	$user ||= $staff->id;
+    $user ||= $staff->id;
 
-	if( $user != $staff->id and $evt = $apputils->check_perms( $staff->id, $staff->home_ou, 'VIEW_PERMISSION') ) {
-		return $evt;
-	}
+    if( $user != $staff->id and $evt = $apputils->check_perms( $staff->id, $staff->home_ou, 'VIEW_PERMISSION') ) {
+        return $evt;
+    }
 
-	return $apputils->simple_scalar_request(
-		"open-ils.storage",
-		"open-ils.storage.permission.user_perms.atomic",
-		$user);
+    return $apputils->simple_scalar_request(
+        "open-ils.storage",
+        "open-ils.storage.permission.user_perms.atomic",
+        $user);
 }
 
 __PACKAGE__->register_method(
@@ -2242,12 +2242,12 @@ __PACKAGE__->register_method(
     notes    => "Returns a list of permissions"
 );
 sub retrieve_perms {
-	my( $self, $client ) = @_;
-	return $apputils->simple_scalar_request(
-		"open-ils.cstore",
-		"open-ils.cstore.direct.permission.perm_list.search.atomic",
-		{ id => { '!=' => undef } }
-	);
+    my( $self, $client ) = @_;
+    return $apputils->simple_scalar_request(
+        "open-ils.cstore",
+        "open-ils.cstore.direct.permission.perm_list.search.atomic",
+        { id => { '!=' => undef } }
+    );
 }
 
 __PACKAGE__->register_method(
@@ -2256,24 +2256,24 @@ __PACKAGE__->register_method(
     notes    => "Returns a list of user groups"
 );
 sub retrieve_groups {
-	my( $self, $client ) = @_;
-	return new_editor()->retrieve_all_permission_grp_tree();
+    my( $self, $client ) = @_;
+    return new_editor()->retrieve_all_permission_grp_tree();
 }
 
 __PACKAGE__->register_method(
-	method	=> "retrieve_org_address",
-	api_name	=> "open-ils.actor.org_unit.address.retrieve",
-	notes		=> <<'	NOTES');
-	Returns an org_unit address by ID
-	@param An org_address ID
-	NOTES
+    method  => "retrieve_org_address",
+    api_name    => "open-ils.actor.org_unit.address.retrieve",
+    notes        => <<'    NOTES');
+    Returns an org_unit address by ID
+    @param An org_address ID
+    NOTES
 sub retrieve_org_address {
-	my( $self, $client, $id ) = @_;
-	return $apputils->simple_scalar_request(
-		"open-ils.cstore",
-		"open-ils.cstore.direct.actor.org_address.retrieve",
-		$id
-	);
+    my( $self, $client, $id ) = @_;
+    return $apputils->simple_scalar_request(
+        "open-ils.cstore",
+        "open-ils.cstore.direct.actor.org_address.retrieve",
+        $id
+    );
 }
 
 __PACKAGE__->register_method(
@@ -2281,19 +2281,19 @@ __PACKAGE__->register_method(
     api_name => "open-ils.actor.groups.tree.retrieve",
     notes    => "Returns a list of user groups"
 );
-	
+    
 sub retrieve_groups_tree {
-	my( $self, $client ) = @_;
-	return new_editor()->search_permission_grp_tree(
-		[
-			{ parent => undef},
-			{	
-				flesh				=> -1,
-				flesh_fields	=> { pgt => ["children"] }, 
-				order_by			=> { pgt => 'name'}
-			}
-		]
-	)->[0];
+    my( $self, $client ) = @_;
+    return new_editor()->search_permission_grp_tree(
+        [
+            { parent => undef},
+            {   
+                flesh               => -1,
+                flesh_fields    => { pgt => ["children"] }, 
+                order_by            => { pgt => 'name'}
+            }
+        ]
+    )->[0];
 }
 
 
@@ -2302,33 +2302,33 @@ __PACKAGE__->register_method(
     api_name => "open-ils.actor.user.set_groups",
     notes    => "Adds a user to one or more permission groups"
 );
-	
+    
 sub add_user_to_groups {
-	my( $self, $client, $authtoken, $userid, $groups ) = @_;
-
-	my( $requestor, $target, $evt ) = $apputils->checkses_requestor(
-		$authtoken, $userid, 'CREATE_USER_GROUP_LINK' );
-	return $evt if $evt;
-
-	( $requestor, $target, $evt ) = $apputils->checkses_requestor(
-		$authtoken, $userid, 'REMOVE_USER_GROUP_LINK' );
-	return $evt if $evt;
-
-	$apputils->simplereq(
-		'open-ils.storage',
-		'open-ils.storage.direct.permission.usr_grp_map.mass_delete', { usr => $userid } );
-		
-	for my $group (@$groups) {
-		my $link = Fieldmapper::permission::usr_grp_map->new;
-		$link->grp($group);
-		$link->usr($userid);
-
-		my $id = $apputils->simplereq(
-			'open-ils.storage',
-			'open-ils.storage.direct.permission.usr_grp_map.create', $link );
-	}
-
-	return 1;
+    my( $self, $client, $authtoken, $userid, $groups ) = @_;
+
+    my( $requestor, $target, $evt ) = $apputils->checkses_requestor(
+        $authtoken, $userid, 'CREATE_USER_GROUP_LINK' );
+    return $evt if $evt;
+
+    ( $requestor, $target, $evt ) = $apputils->checkses_requestor(
+        $authtoken, $userid, 'REMOVE_USER_GROUP_LINK' );
+    return $evt if $evt;
+
+    $apputils->simplereq(
+        'open-ils.storage',
+        'open-ils.storage.direct.permission.usr_grp_map.mass_delete', { usr => $userid } );
+        
+    for my $group (@$groups) {
+        my $link = Fieldmapper::permission::usr_grp_map->new;
+        $link->grp($group);
+        $link->usr($userid);
+
+        my $id = $apputils->simplereq(
+            'open-ils.storage',
+            'open-ils.storage.direct.permission.usr_grp_map.create', $link );
+    }
+
+    return 1;
 }
 
 __PACKAGE__->register_method(
@@ -2339,16 +2339,16 @@ __PACKAGE__->register_method(
 
 
 sub get_user_perm_groups {
-	my( $self, $client, $authtoken, $userid ) = @_;
+    my( $self, $client, $authtoken, $userid ) = @_;
 
-	my( $requestor, $target, $evt ) = $apputils->checkses_requestor(
-		$authtoken, $userid, 'VIEW_PERM_GROUPS' );
-	return $evt if $evt;
+    my( $requestor, $target, $evt ) = $apputils->checkses_requestor(
+        $authtoken, $userid, 'VIEW_PERM_GROUPS' );
+    return $evt if $evt;
 
-	return $apputils->simplereq(
-		'open-ils.cstore',
-		'open-ils.cstore.direct.permission.usr_grp_map.search.atomic', { usr => $userid } );
-}	
+    return $apputils->simplereq(
+        'open-ils.cstore',
+        'open-ils.cstore.direct.permission.usr_grp_map.search.atomic', { usr => $userid } );
+}   
 
 
 __PACKAGE__->register_method(
@@ -2364,7 +2364,7 @@ __PACKAGE__->register_method(
 );
 
 sub get_user_work_ous {
-	my( $self, $client, $auth, $userid ) = @_;
+    my( $self, $client, $auth, $userid ) = @_;
     my $e = new_editor(authtoken=>$auth);
     return $e->event unless $e->checkauth;
     $userid ||= $e->requestor->id;
@@ -2380,7 +2380,7 @@ sub get_user_work_ous {
 
     # client just wants a list of org IDs
     return $U->get_user_work_ou_ids($e, $userid);
-}	
+}   
 
 
 
@@ -2394,27 +2394,27 @@ __PACKAGE__->register_method(
     method    => 'register_workstation',
     api_name  => 'open-ils.actor.workstation.register',
     signature => q/
-		Registers a new workstion in the system
-		@param authtoken The login session key
-		@param name The name of the workstation id
-		@param owner The org unit that owns this workstation
-		@return The workstation id on success, WORKSTATION_NAME_EXISTS
-		if the name is already in use.
-	/
+        Registers a new workstion in the system
+        @param authtoken The login session key
+        @param name The name of the workstation id
+        @param owner The org unit that owns this workstation
+        @return The workstation id on success, WORKSTATION_NAME_EXISTS
+        if the name is already in use.
+    /
 );
 
 sub register_workstation {
-	my( $self, $conn, $authtoken, $name, $owner, $oargs ) = @_;
+    my( $self, $conn, $authtoken, $name, $owner, $oargs ) = @_;
 
-	my $e = new_editor(authtoken=>$authtoken, xact=>1);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('REGISTER_WORKSTATION', $owner);
-	my $existing = $e->search_actor_workstation({name => $name})->[0];
+    my $e = new_editor(authtoken=>$authtoken, xact=>1);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('REGISTER_WORKSTATION', $owner);
+    my $existing = $e->search_actor_workstation({name => $name})->[0];
     $oargs = { all => 1 } unless defined $oargs;
 
-	if( $existing ) {
+    if( $existing ) {
 
-		if( $self->api_name =~ /override/o && ($oargs->{all} || grep { $_ eq 'WORKSTATION_NAME_EXISTS' } @{$oargs->{events}}) ) {
+        if( $self->api_name =~ /override/o && ($oargs->{all} || grep { $_ eq 'WORKSTATION_NAME_EXISTS' } @{$oargs->{events}}) ) {
             # workstation with the given name exists.  
 
             if($owner ne $existing->owning_lib) {
@@ -2422,13 +2422,13 @@ sub register_workstation {
 
                 $logger->info("changing owning lib of workstation ".$existing->id.
                     " from ".$existing->owning_lib." to $owner");
-			    return $e->die_event unless 
+                return $e->die_event unless 
                     $e->allowed('UPDATE_WORKSTATION', $existing->owning_lib); 
 
-			    return $e->die_event unless $e->allowed('UPDATE_WORKSTATION', $owner); 
+                return $e->die_event unless $e->allowed('UPDATE_WORKSTATION', $owner); 
 
                 $existing->owning_lib($owner);
-			    return $e->die_event unless $e->update_actor_workstation($existing);
+                return $e->die_event unless $e->update_actor_workstation($existing);
 
                 $e->commit;
 
@@ -2439,38 +2439,38 @@ sub register_workstation {
 
             return $existing->id;
 
-		} else {
-			return OpenILS::Event->new('WORKSTATION_NAME_EXISTS')
-		}
-	}
-
-	my $ws = Fieldmapper::actor::workstation->new;
-	$ws->owning_lib($owner);
-	$ws->name($name);
-	$e->create_actor_workstation($ws) or return $e->die_event;
-	$e->commit;
-	return $ws->id; # note: editor sets the id on the new object for us
+        } else {
+            return OpenILS::Event->new('WORKSTATION_NAME_EXISTS')
+        }
+    }
+
+    my $ws = Fieldmapper::actor::workstation->new;
+    $ws->owning_lib($owner);
+    $ws->name($name);
+    $e->create_actor_workstation($ws) or return $e->die_event;
+    $e->commit;
+    return $ws->id; # note: editor sets the id on the new object for us
 }
 
 __PACKAGE__->register_method(
     method    => 'workstation_list',
     api_name  => 'open-ils.actor.workstation.list',
     signature => q/
-		Returns a list of workstations registered at the given location
-		@param authtoken The login session key
-		@param ids A list of org_unit.id's for the workstation owners
-	/
+        Returns a list of workstations registered at the given location
+        @param authtoken The login session key
+        @param ids A list of org_unit.id's for the workstation owners
+    /
 );
 
 sub workstation_list {
-	my( $self, $conn, $authtoken, @orgs ) = @_;
+    my( $self, $conn, $authtoken, @orgs ) = @_;
 
-	my $e = new_editor(authtoken=>$authtoken);
-	return $e->event unless $e->checkauth;
+    my $e = new_editor(authtoken=>$authtoken);
+    return $e->event unless $e->checkauth;
     my %results;
 
     for my $o (@orgs) {
-	    return $e->event 
+        return $e->event 
             unless $e->allowed('REGISTER_WORKSTATION', $o);
         $results{$o} = $e->search_actor_workstation({owning_lib=>$o});
     }
@@ -2483,67 +2483,67 @@ __PACKAGE__->register_method(
     api_name      => 'open-ils.actor.note.retrieve.all',
     authoritative => 1,
     signature     => q/
-		Returns a list of notes for a given user
-		Requestor must have VIEW_USER permission if pub==false and
-		@param authtoken The login session key
-		@param args Hash of params including
-			patronid : the patron's id
-			pub : true if retrieving only public notes
-	/
+        Returns a list of notes for a given user
+        Requestor must have VIEW_USER permission if pub==false and
+        @param authtoken The login session key
+        @param args Hash of params including
+            patronid : the patron's id
+            pub : true if retrieving only public notes
+    /
 );
 
 sub fetch_patron_note {
-	my( $self, $conn, $authtoken, $args ) = @_;
-	my $patronid = $$args{patronid};
-
-	my($reqr, $evt) = $U->checkses($authtoken);
-	return $evt if $evt;
-
-	my $patron;
-	($patron, $evt) = $U->fetch_user($patronid);
-	return $evt if $evt;
-
-	if($$args{pub}) {
-		if( $patronid ne $reqr->id ) {
-			$evt = $U->check_perms($reqr->id, $patron->home_ou, 'VIEW_USER');
-			return $evt if $evt;
-		}
-		return $U->cstorereq(
-			'open-ils.cstore.direct.actor.usr_note.search.atomic', 
-			{ usr => $patronid, pub => 't' } );
-	}
-
-	$evt = $U->check_perms($reqr->id, $patron->home_ou, 'VIEW_USER');
-	return $evt if $evt;
-
-	return $U->cstorereq(
-		'open-ils.cstore.direct.actor.usr_note.search.atomic', { usr => $patronid } );
+    my( $self, $conn, $authtoken, $args ) = @_;
+    my $patronid = $$args{patronid};
+
+    my($reqr, $evt) = $U->checkses($authtoken);
+    return $evt if $evt;
+
+    my $patron;
+    ($patron, $evt) = $U->fetch_user($patronid);
+    return $evt if $evt;
+
+    if($$args{pub}) {
+        if( $patronid ne $reqr->id ) {
+            $evt = $U->check_perms($reqr->id, $patron->home_ou, 'VIEW_USER');
+            return $evt if $evt;
+        }
+        return $U->cstorereq(
+            'open-ils.cstore.direct.actor.usr_note.search.atomic', 
+            { usr => $patronid, pub => 't' } );
+    }
+
+    $evt = $U->check_perms($reqr->id, $patron->home_ou, 'VIEW_USER');
+    return $evt if $evt;
+
+    return $U->cstorereq(
+        'open-ils.cstore.direct.actor.usr_note.search.atomic', { usr => $patronid } );
 }
 
 __PACKAGE__->register_method(
     method    => 'create_user_note',
     api_name  => 'open-ils.actor.note.create',
     signature => q/
-		Creates a new note for the given user
-		@param authtoken The login session key
-		@param note The note object
-	/
+        Creates a new note for the given user
+        @param authtoken The login session key
+        @param note The note object
+    /
 );
 sub create_user_note {
-	my( $self, $conn, $authtoken, $note ) = @_;
-	my $e = new_editor(xact=>1, authtoken=>$authtoken);
-	return $e->die_event unless $e->checkauth;
+    my( $self, $conn, $authtoken, $note ) = @_;
+    my $e = new_editor(xact=>1, authtoken=>$authtoken);
+    return $e->die_event unless $e->checkauth;
 
-	my $user = $e->retrieve_actor_user($note->usr)
-		or return $e->die_event;
+    my $user = $e->retrieve_actor_user($note->usr)
+        or return $e->die_event;
 
-	return $e->die_event unless 
-		$e->allowed('UPDATE_USER',$user->home_ou);
+    return $e->die_event unless 
+        $e->allowed('UPDATE_USER',$user->home_ou);
 
-	$note->creator($e->requestor->id);
-	$e->create_actor_usr_note($note) or return $e->die_event;
-	$e->commit;
-	return $note->id;
+    $note->creator($e->requestor->id);
+    $e->create_actor_usr_note($note) or return $e->die_event;
+    $e->commit;
+    return $note->id;
 }
 
 
@@ -2551,26 +2551,26 @@ __PACKAGE__->register_method(
     method    => 'delete_user_note',
     api_name  => 'open-ils.actor.note.delete',
     signature => q/
-		Deletes a note for the given user
-		@param authtoken The login session key
-		@param noteid The note id
-	/
+        Deletes a note for the given user
+        @param authtoken The login session key
+        @param noteid The note id
+    /
 );
 sub delete_user_note {
-	my( $self, $conn, $authtoken, $noteid ) = @_;
-
-	my $e = new_editor(xact=>1, authtoken=>$authtoken);
-	return $e->die_event unless $e->checkauth;
-	my $note = $e->retrieve_actor_usr_note($noteid)
-		or return $e->die_event;
-	my $user = $e->retrieve_actor_user($note->usr)
-		or return $e->die_event;
-	return $e->die_event unless 
-		$e->allowed('UPDATE_USER', $user->home_ou);
-	
-	$e->delete_actor_usr_note($note) or return $e->die_event;
-	$e->commit;
-	return 1;
+    my( $self, $conn, $authtoken, $noteid ) = @_;
+
+    my $e = new_editor(xact=>1, authtoken=>$authtoken);
+    return $e->die_event unless $e->checkauth;
+    my $note = $e->retrieve_actor_usr_note($noteid)
+        or return $e->die_event;
+    my $user = $e->retrieve_actor_user($note->usr)
+        or return $e->die_event;
+    return $e->die_event unless 
+        $e->allowed('UPDATE_USER', $user->home_ou);
+    
+    $e->delete_actor_usr_note($note) or return $e->die_event;
+    $e->commit;
+    return 1;
 }
 
 
@@ -2578,23 +2578,23 @@ __PACKAGE__->register_method(
     method    => 'update_user_note',
     api_name  => 'open-ils.actor.note.update',
     signature => q/
-		@param authtoken The login session key
-		@param note The note
-	/
+        @param authtoken The login session key
+        @param note The note
+    /
 );
 
 sub update_user_note {
-	my( $self, $conn, $auth, $note ) = @_;
-	my $e = new_editor(authtoken=>$auth, xact=>1);
-	return $e->die_event unless $e->checkauth;
-	my $patron = $e->retrieve_actor_user($note->usr)
-		or return $e->die_event;
-	return $e->die_event unless 
-		$e->allowed('UPDATE_USER', $patron->home_ou);
-	$e->update_actor_user_note($note)
-		or return $e->die_event;
-	$e->commit;
-	return 1;
+    my( $self, $conn, $auth, $note ) = @_;
+    my $e = new_editor(authtoken=>$auth, xact=>1);
+    return $e->die_event unless $e->checkauth;
+    my $patron = $e->retrieve_actor_user($note->usr)
+        or return $e->die_event;
+    return $e->die_event unless 
+        $e->allowed('UPDATE_USER', $patron->home_ou);
+    $e->update_actor_user_note($note)
+        or return $e->die_event;
+    $e->commit;
+    return 1;
 }
 
 
@@ -2603,26 +2603,26 @@ __PACKAGE__->register_method(
     method    => 'create_closed_date',
     api_name  => 'open-ils.actor.org_unit.closed_date.create',
     signature => q/
-		Creates a new closing entry for the given org_unit
-		@param authtoken The login session key
-		@param note The closed_date object
-	/
+        Creates a new closing entry for the given org_unit
+        @param authtoken The login session key
+        @param note The closed_date object
+    /
 );
 sub create_closed_date {
-	my( $self, $conn, $authtoken, $cd ) = @_;
+    my( $self, $conn, $authtoken, $cd ) = @_;
 
-	my( $user, $evt ) = $U->checkses($authtoken);
-	return $evt if $evt;
+    my( $user, $evt ) = $U->checkses($authtoken);
+    return $evt if $evt;
 
-	$evt = $U->check_perms($user->id, $cd->org_unit, 'CREATE_CLOSEING');
-	return $evt if $evt;
+    $evt = $U->check_perms($user->id, $cd->org_unit, 'CREATE_CLOSEING');
+    return $evt if $evt;
 
-	$logger->activity("user ".$user->id." creating library closing for ".$cd->org_unit);
+    $logger->activity("user ".$user->id." creating library closing for ".$cd->org_unit);
 
-	my $id = $U->storagereq(
-		'open-ils.storage.direct.actor.org_unit.closed_date.create', $cd );
-	return $U->DB_UPDATE_FAILED($cd) unless $id;
-	return $id;
+    my $id = $U->storagereq(
+        'open-ils.storage.direct.actor.org_unit.closed_date.create', $cd );
+    return $U->DB_UPDATE_FAILED($cd) unless $id;
+    return $id;
 }
 
 
@@ -2630,30 +2630,30 @@ __PACKAGE__->register_method(
     method    => 'delete_closed_date',
     api_name  => 'open-ils.actor.org_unit.closed_date.delete',
     signature => q/
-		Deletes a closing entry for the given org_unit
-		@param authtoken The login session key
-		@param noteid The close_date id
-	/
+        Deletes a closing entry for the given org_unit
+        @param authtoken The login session key
+        @param noteid The close_date id
+    /
 );
 sub delete_closed_date {
-	my( $self, $conn, $authtoken, $cd ) = @_;
+    my( $self, $conn, $authtoken, $cd ) = @_;
 
-	my( $user, $evt ) = $U->checkses($authtoken);
-	return $evt if $evt;
+    my( $user, $evt ) = $U->checkses($authtoken);
+    return $evt if $evt;
 
-	my $cd_obj;
-	($cd_obj, $evt) = fetch_closed_date($cd);
-	return $evt if $evt;
+    my $cd_obj;
+    ($cd_obj, $evt) = fetch_closed_date($cd);
+    return $evt if $evt;
 
-	$evt = $U->check_perms($user->id, $cd->org_unit, 'DELETE_CLOSEING');
-	return $evt if $evt;
+    $evt = $U->check_perms($user->id, $cd->org_unit, 'DELETE_CLOSEING');
+    return $evt if $evt;
 
-	$logger->activity("user ".$user->id." deleting library closing for ".$cd->org_unit);
+    $logger->activity("user ".$user->id." deleting library closing for ".$cd->org_unit);
 
-	my $stat = $U->storagereq(
-		'open-ils.storage.direct.actor.org_unit.closed_date.delete', $cd );
-	return $U->DB_UPDATE_FAILED($cd) unless $stat;
-	return $stat;
+    my $stat = $U->storagereq(
+        'open-ils.storage.direct.actor.org_unit.closed_date.delete', $cd );
+    return $U->DB_UPDATE_FAILED($cd) unless $stat;
+    return $stat;
 }
 
 
@@ -2673,12 +2673,12 @@ __PACKAGE__->register_method(
 );
 
 sub usrname_exists {
-	my( $self, $conn, $auth, $usrname ) = @_;
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	my $a = $e->search_actor_user({usrname => $usrname}, {idlist=>1});
-	return $$a[0] if $a and @$a;
-	return undef;
+    my( $self, $conn, $auth, $usrname ) = @_;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    my $a = $e->search_actor_user({usrname => $usrname}, {idlist=>1});
+    return $$a[0] if $a and @$a;
+    return undef;
 }
 
 __PACKAGE__->register_method(
@@ -2689,17 +2689,17 @@ __PACKAGE__->register_method(
 );
 
 sub barcode_exists {
-	my( $self, $conn, $auth, $barcode ) = @_;
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	my $card = $e->search_actor_card({barcode => $barcode});
-	if (@$card) {
-		return 1;
-	} else {
-		return 0;
-	}
-	#return undef unless @$card;
-	#return $card->[0]->usr;
+    my( $self, $conn, $auth, $barcode ) = @_;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    my $card = $e->search_actor_card({barcode => $barcode});
+    if (@$card) {
+        return 1;
+    } else {
+        return 0;
+    }
+    #return undef unless @$card;
+    #return $card->[0]->usr;
 }
 
 
@@ -2709,10 +2709,10 @@ __PACKAGE__->register_method(
 );
 
 sub retrieve_net_levels {
-	my( $self, $conn, $auth ) = @_;
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	return $e->retrieve_all_config_net_access_level();
+    my( $self, $conn, $auth ) = @_;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    return $e->retrieve_all_config_net_access_level();
 }
 
 # Retain the old typo API name just in case
@@ -2725,11 +2725,11 @@ __PACKAGE__->register_method(
     api_name => 'open-ils.actor.org_unit.retrieve_by_shortname',
 );
 sub fetch_org_by_shortname {
-	my( $self, $conn, $sname ) = @_;
-	my $e = new_editor();
-	my $org = $e->search_actor_org_unit({ shortname => uc($sname)})->[0];
-	return $e->event unless $org;
-	return $org;
+    my( $self, $conn, $sname ) = @_;
+    my $e = new_editor();
+    my $org = $e->search_actor_org_unit({ shortname => uc($sname)})->[0];
+    return $e->event unless $org;
+    return $org;
 }
 
 
@@ -2739,42 +2739,42 @@ __PACKAGE__->register_method(
 );
 
 sub session_home_lib {
-	my( $self, $conn, $auth ) = @_;
-	my $e = new_editor(authtoken=>$auth);
-	return undef unless $e->checkauth;
-	my $org = $e->retrieve_actor_org_unit($e->requestor->home_ou);
-	return $org->shortname;
+    my( $self, $conn, $auth ) = @_;
+    my $e = new_editor(authtoken=>$auth);
+    return undef unless $e->checkauth;
+    my $org = $e->retrieve_actor_org_unit($e->requestor->home_ou);
+    return $org->shortname;
 }
 
 __PACKAGE__->register_method(
     method    => 'session_safe_token',
     api_name  => 'open-ils.actor.session.safe_token',
     signature => q/
-		Returns a hashed session ID that is safe for export to the world.
-		This safe token will expire after 1 hour of non-use.
-		@param auth Active authentication token
-	/
+        Returns a hashed session ID that is safe for export to the world.
+        This safe token will expire after 1 hour of non-use.
+        @param auth Active authentication token
+    /
 );
 
 sub session_safe_token {
-	my( $self, $conn, $auth ) = @_;
-	my $e = new_editor(authtoken=>$auth);
-	return undef unless $e->checkauth;
+    my( $self, $conn, $auth ) = @_;
+    my $e = new_editor(authtoken=>$auth);
+    return undef unless $e->checkauth;
 
-	my $safe_token = md5_hex($auth);
+    my $safe_token = md5_hex($auth);
 
-	$cache ||= OpenSRF::Utils::Cache->new("global", 0);
+    $cache ||= OpenSRF::Utils::Cache->new("global", 0);
 
-	# Add more like the following if needed...
-	$cache->put_cache(
-		"safe-token-home_lib-shortname-$safe_token",
-		$e->retrieve_actor_org_unit(
-			$e->requestor->home_ou
-		)->shortname,
-		60 * 60
-	);
+    # Add more like the following if needed...
+    $cache->put_cache(
+        "safe-token-home_lib-shortname-$safe_token",
+        $e->retrieve_actor_org_unit(
+            $e->requestor->home_ou
+        )->shortname,
+        60 * 60
+    );
 
-	return $safe_token;
+    return $safe_token;
 }
 
 
@@ -2782,18 +2782,18 @@ __PACKAGE__->register_method(
     method    => 'safe_token_home_lib',
     api_name  => 'open-ils.actor.safe_token.home_lib.shortname',
     signature => q/
-		Returns the home library shortname from the session
-		asscociated with a safe token from generated by
-		open-ils.actor.session.safe_token.
-		@param safe_token Active safe token
-	/
+        Returns the home library shortname from the session
+        asscociated with a safe token from generated by
+        open-ils.actor.session.safe_token.
+        @param safe_token Active safe token
+    /
 );
 
 sub safe_token_home_lib {
-	my( $self, $conn, $safe_token ) = @_;
+    my( $self, $conn, $safe_token ) = @_;
 
-	$cache ||= OpenSRF::Utils::Cache->new("global", 0);
-	return $cache->get_cache( 'safe-token-home_lib-shortname-'. $safe_token );
+    $cache ||= OpenSRF::Utils::Cache->new("global", 0);
+    return $cache->get_cache( 'safe-token-home_lib-shortname-'. $safe_token );
 }
 
 
@@ -2803,9 +2803,9 @@ __PACKAGE__->register_method(
 );
 
 sub update_penalties {
-	my($self, $conn, $auth, $user_id) = @_;
-	my $e = new_editor(authtoken=>$auth, xact => 1);
-	return $e->die_event unless $e->checkauth;
+    my($self, $conn, $auth, $user_id) = @_;
+    my $e = new_editor(authtoken=>$auth, xact => 1);
+    return $e->die_event unless $e->checkauth;
     my $user = $e->retrieve_actor_user($user_id) or return $e->die_event;
     return $e->die_event unless $e->allowed('UPDATE_USER', $user->home_ou);
     my $evt = OpenILS::Utils::Penalty->calculate_penalties($e, $user_id, $e->requestor->ws_ou);
@@ -2821,10 +2821,10 @@ __PACKAGE__->register_method(
 );
 
 sub apply_penalty {
-	my($self, $conn, $auth, $penalty) = @_;
+    my($self, $conn, $auth, $penalty) = @_;
 
-	my $e = new_editor(authtoken=>$auth, xact => 1);
-	return $e->die_event unless $e->checkauth;
+    my $e = new_editor(authtoken=>$auth, xact => 1);
+    return $e->die_event unless $e->checkauth;
 
     my $user = $e->retrieve_actor_user($penalty->usr) or return $e->die_event;
     return $e->die_event unless $e->allowed('UPDATE_USER', $user->home_ou);
@@ -2850,9 +2850,9 @@ __PACKAGE__->register_method(
 );
 
 sub remove_penalty {
-	my($self, $conn, $auth, $penalty) = @_;
-	my $e = new_editor(authtoken=>$auth, xact => 1);
-	return $e->die_event unless $e->checkauth;
+    my($self, $conn, $auth, $penalty) = @_;
+    my $e = new_editor(authtoken=>$auth, xact => 1);
+    return $e->die_event unless $e->checkauth;
     my $user = $e->retrieve_actor_user($penalty->usr) or return $e->die_event;
     return $e->die_event unless $e->allowed('UPDATE_USER', $user->home_ou);
 
@@ -2867,9 +2867,9 @@ __PACKAGE__->register_method(
 );
 
 sub update_penalty_note {
-	my($self, $conn, $auth, $penalty_ids, $note) = @_;
-	my $e = new_editor(authtoken=>$auth, xact => 1);
-	return $e->die_event unless $e->checkauth;
+    my($self, $conn, $auth, $penalty_ids, $note) = @_;
+    my $e = new_editor(authtoken=>$auth, xact => 1);
+    return $e->die_event unless $e->checkauth;
     for my $penalty_id (@$penalty_ids) {
         my $penalty = $e->search_actor_user_standing_penalty( { id => $penalty_id } )->[0];
         if (! $penalty ) { return $e->die_event; }
@@ -2891,9 +2891,9 @@ __PACKAGE__->register_method(
 );
 
 sub ranged_penalty_thresholds {
-	my($self, $conn, $auth, $context_org) = @_;
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
+    my($self, $conn, $auth, $context_org) = @_;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
     return $e->event unless $e->allowed('VIEW_GROUP_PENALTY_THRESHOLD', $context_org);
     my $list = $e->search_permission_grp_penalty_threshold([
         {org_unit => $U->get_org_ancestors($context_org)},
@@ -2912,32 +2912,32 @@ __PACKAGE__->register_method(
 );
 
 sub user_retrieve_fleshed_by_id {
-	my( $self, $client, $auth, $user_id, $fields ) = @_;
-	my $e = new_editor(authtoken => $auth);
-	return $e->event unless $e->checkauth;
-
-	if( $e->requestor->id != $user_id ) {
-		return $e->event unless $e->allowed('VIEW_USER');
-	}
-
-	$fields ||= [
-		"cards",
-		"card",
-		"standing_penalties",
-		"addresses",
-		"billing_address",
-		"mailing_address",
-		"stat_cat_entries",
-		"usr_activity" ];
-	return new_flesh_user($user_id, $fields, $e);
+    my( $self, $client, $auth, $user_id, $fields ) = @_;
+    my $e = new_editor(authtoken => $auth);
+    return $e->event unless $e->checkauth;
+
+    if( $e->requestor->id != $user_id ) {
+        return $e->event unless $e->allowed('VIEW_USER');
+    }
+
+    $fields ||= [
+        "cards",
+        "card",
+        "standing_penalties",
+        "addresses",
+        "billing_address",
+        "mailing_address",
+        "stat_cat_entries",
+        "usr_activity" ];
+    return new_flesh_user($user_id, $fields, $e);
 }
 
 
 sub new_flesh_user {
 
-	my $id = shift;
-	my $fields = shift || [];
-	my $e = shift;
+    my $id = shift;
+    my $fields = shift || [];
+    my $e = shift;
 
     my $fetch_penalties = 0;
     if(grep {$_ eq 'standing_penalties'} @$fields) {
@@ -2951,35 +2951,35 @@ sub new_flesh_user {
         $fetch_usr_act = 1;
     }
 
-	my $user = $e->retrieve_actor_user(
-   	[
-      	$id,
-      	{
-         	"flesh" 			=> 1,
-         	"flesh_fields" =>  { "au" => $fields }
-      	}
-   	]
-	) or return $e->die_event;
+    my $user = $e->retrieve_actor_user(
+    [
+        $id,
+        {
+            "flesh"             => 1,
+            "flesh_fields" =>  { "au" => $fields }
+        }
+    ]
+    ) or return $e->die_event;
 
 
-	if( grep { $_ eq 'addresses' } @$fields ) {
+    if( grep { $_ eq 'addresses' } @$fields ) {
 
-		$user->addresses([]) unless @{$user->addresses};
+        $user->addresses([]) unless @{$user->addresses};
         # don't expose "replaced" addresses by default
         $user->addresses([grep {$_->id >= 0} @{$user->addresses}]);
-	
-		if( ref $user->billing_address ) {
-			unless( grep { $user->billing_address->id == $_->id } @{$user->addresses} ) {
-				push( @{$user->addresses}, $user->billing_address );
-			}
-		}
-	
-		if( ref $user->mailing_address ) {
-			unless( grep { $user->mailing_address->id == $_->id } @{$user->addresses} ) {
-				push( @{$user->addresses}, $user->mailing_address );
-			}
-		}
-	}
+    
+        if( ref $user->billing_address ) {
+            unless( grep { $user->billing_address->id == $_->id } @{$user->addresses} ) {
+                push( @{$user->addresses}, $user->billing_address );
+            }
+        }
+    
+        if( ref $user->mailing_address ) {
+            unless( grep { $user->mailing_address->id == $_->id } @{$user->addresses} ) {
+                push( @{$user->addresses}, $user->mailing_address );
+            }
+        }
+    }
 
     if($fetch_penalties) {
         # grab the user penalties ranged for this location
@@ -3024,9 +3024,9 @@ sub new_flesh_user {
         );
     }
 
-	$e->rollback;
-	$user->clear_passwd();
-	return $user;
+    $e->rollback;
+    $user->clear_passwd();
+    return $user;
 }
 
 
@@ -3038,17 +3038,17 @@ __PACKAGE__->register_method(
 );
 
 sub user_retrieve_parts {
-	my( $self, $client, $auth, $user_id, $fields ) = @_;
-	my $e = new_editor(authtoken => $auth);
-	return $e->event unless $e->checkauth;
+    my( $self, $client, $auth, $user_id, $fields ) = @_;
+    my $e = new_editor(authtoken => $auth);
+    return $e->event unless $e->checkauth;
     $user_id ||= $e->requestor->id;
-	if( $e->requestor->id != $user_id ) {
-		return $e->event unless $e->allowed('VIEW_USER');
-	}
-	my @resp;
-	my $user = $e->retrieve_actor_user($user_id) or return $e->event;
-	push(@resp, $user->$_()) for(@$fields);
-	return \@resp;
+    if( $e->requestor->id != $user_id ) {
+        return $e->event unless $e->allowed('VIEW_USER');
+    }
+    my @resp;
+    my $user = $e->retrieve_actor_user($user_id) or return $e->event;
+    push(@resp, $user->$_()) for(@$fields);
+    return \@resp;
 }
 
 
@@ -3082,11 +3082,11 @@ sub user_opt_in_at_org {
     # see if we even need to enforce the opt-in value
     return 1 unless user_opt_in_enabled($self);
 
-	my $e = new_editor(authtoken => $auth);
-	return $e->event unless $e->checkauth;
+    my $e = new_editor(authtoken => $auth);
+    return $e->event unless $e->checkauth;
 
     my $user = $e->retrieve_actor_user($user_id) or return $e->event;
-	return $e->event unless $e->allowed('VIEW_USER', $user->home_ou);
+    return $e->event unless $e->allowed('VIEW_USER', $user->home_ou);
 
     my $ws_org = $e->requestor->ws_ou;
     # user is automatically opted-in if they are from the local org
@@ -3119,8 +3119,8 @@ __PACKAGE__->register_method(
 sub create_user_opt_in_at_org {
     my($self, $conn, $auth, $user_id, $org_id) = @_;
 
-	my $e = new_editor(authtoken => $auth, xact=>1);
-	return $e->die_event unless $e->checkauth;
+    my $e = new_editor(authtoken => $auth, xact=>1);
+    return $e->die_event unless $e->checkauth;
    
     # if a specific org unit wasn't passed in, get one based on the defaults;
     if(!$org_id){
@@ -3138,7 +3138,7 @@ sub create_user_opt_in_at_org {
     }
 
     my $user = $e->retrieve_actor_user($user_id) or return $e->die_event;
-	return $e->die_event unless $e->allowed('UPDATE_USER', $user->home_ou);
+    return $e->die_event unless $e->allowed('UPDATE_USER', $user->home_ou);
 
     my $opt_in = Fieldmapper::actor::usr_org_unit_opt_in->new;
 
@@ -3158,37 +3158,37 @@ sub create_user_opt_in_at_org {
 
 
 __PACKAGE__->register_method (
-	method		=> 'retrieve_org_hours',
-	api_name	=> 'open-ils.actor.org_unit.hours_of_operation.retrieve',
-	signature	=> q/
+    method      => 'retrieve_org_hours',
+    api_name    => 'open-ils.actor.org_unit.hours_of_operation.retrieve',
+    signature   => q/
         Returns the hours of operation for a specified org unit
-		@param authtoken The login session key
-		@param org_id The org_unit ID
-	/
+        @param authtoken The login session key
+        @param org_id The org_unit ID
+    /
 );
 
 sub retrieve_org_hours {
     my($self, $conn, $auth, $org_id) = @_;
     my $e = new_editor(authtoken => $auth);
-	return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->checkauth;
     $org_id ||= $e->requestor->ws_ou;
     return $e->retrieve_actor_org_unit_hours_of_operation($org_id);
 }
 
 
 __PACKAGE__->register_method (
-	method		=> 'verify_user_password',
-	api_name	=> 'open-ils.actor.verify_user_password',
-	signature	=> q/
+    method      => 'verify_user_password',
+    api_name    => 'open-ils.actor.verify_user_password',
+    signature   => q/
         Given a barcode or username and the MD5 encoded password, 
         returns 1 if the password is correct.  Returns 0 otherwise.
-	/
+    /
 );
 
 sub verify_user_password {
     my($self, $conn, $auth, $barcode, $username, $password) = @_;
     my $e = new_editor(authtoken => $auth);
-	return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->checkauth;
     my $user;
     my $user_by_barcode;
     my $user_by_username;
@@ -3211,18 +3211,18 @@ sub verify_user_password {
 }
 
 __PACKAGE__->register_method (
-	method		=> 'retrieve_usr_id_via_barcode_or_usrname',
-	api_name	=> "open-ils.actor.user.retrieve_id_by_barcode_or_username",
-	signature	=> q/
+    method      => 'retrieve_usr_id_via_barcode_or_usrname',
+    api_name    => "open-ils.actor.user.retrieve_id_by_barcode_or_username",
+    signature   => q/
         Given a barcode or username returns the id for the user or
         a failure event.
-	/
+    /
 );
 
 sub retrieve_usr_id_via_barcode_or_usrname {
     my($self, $conn, $auth, $barcode, $username) = @_;
     my $e = new_editor(authtoken => $auth);
-	return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->checkauth;
     my $id_as_barcode= OpenSRF::Utils::SettingsClient->new->config_value(apps => 'open-ils.actor' => app_settings => 'id_as_barcode');
     my $user;
     my $user_by_barcode;
@@ -3252,17 +3252,17 @@ sub retrieve_usr_id_via_barcode_or_usrname {
 
         $user = $user_by_username;
     }
-	return OpenILS::Event->new( 'ACTOR_USER_NOT_FOUND' ) if (!$user);
-	return OpenILS::Event->new( 'ACTOR_USER_NOT_FOUND' ) if ($user_by_username && $user_by_barcode && $user_by_username->id != $user_by_barcode->id); 
+    return OpenILS::Event->new( 'ACTOR_USER_NOT_FOUND' ) if (!$user);
+    return OpenILS::Event->new( 'ACTOR_USER_NOT_FOUND' ) if ($user_by_username && $user_by_barcode && $user_by_username->id != $user_by_barcode->id); 
     return $e->event unless $e->allowed('VIEW_USER', $user->home_ou);
     return $user->id;
 }
 
 
 __PACKAGE__->register_method (
-	method		=> 'merge_users',
-	api_name	=> 'open-ils.actor.user.merge',
-	signature	=> {
+    method      => 'merge_users',
+    api_name    => 'open-ils.actor.user.merge',
+    signature   => {
         desc => q/
             Given a list of source users and destination user, transfer all data from the source
             to the dest user and delete the source user.  All user related data is 
@@ -3274,7 +3274,7 @@ __PACKAGE__->register_method (
 sub merge_users {
     my($self, $conn, $auth, $master_id, $user_ids, $options) = @_;
     my $e = new_editor(xact => 1, authtoken => $auth);
-	return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->checkauth;
 
     # disallow the merge if any subordinate accounts are in collections
     my $colls = $e->search_money_collections_tracker({usr => $user_ids}, {idlist => 1});
@@ -3313,9 +3313,9 @@ sub merge_users {
 
 
 __PACKAGE__->register_method (
-	method		=> 'approve_user_address',
-	api_name	=> 'open-ils.actor.user.pending_address.approve',
-	signature	=> {
+    method      => 'approve_user_address',
+    api_name    => 'open-ils.actor.user.pending_address.approve',
+    signature   => {
         desc => q/
         /
     }
@@ -3324,7 +3324,7 @@ __PACKAGE__->register_method (
 sub approve_user_address {
     my($self, $conn, $auth, $addr) = @_;
     my $e = new_editor(xact => 1, authtoken => $auth);
-	return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->checkauth;
     if(ref $addr) {
         # if the caller passes an address object, assume they want to 
         # update it first before approving it
@@ -3342,9 +3342,9 @@ sub approve_user_address {
 
 
 __PACKAGE__->register_method (
-	method		=> 'retrieve_friends',
-	api_name	=> 'open-ils.actor.friends.retrieve',
-	signature	=> {
+    method      => 'retrieve_friends',
+    api_name    => 'open-ils.actor.friends.retrieve',
+    signature   => {
         desc => q/
             returns { confirmed: [], pending_out: [], pending_in: []}
             pending_out are users I'm requesting friendship with
@@ -3371,9 +3371,9 @@ sub retrieve_friends {
 
 
 __PACKAGE__->register_method (
-	method		=> 'apply_friend_perms',
-	api_name	=> 'open-ils.actor.friends.perms.apply',
-	signature	=> {
+    method      => 'apply_friend_perms',
+    api_name    => 'open-ils.actor.friends.perms.apply',
+    signature   => {
         desc => q/
         /
     }
@@ -3401,8 +3401,8 @@ sub apply_friend_perms {
 
 
 __PACKAGE__->register_method (
-	method		=> 'update_user_pending_address',
-	api_name	=> 'open-ils.actor.user.address.pending.cud'
+    method      => 'update_user_pending_address',
+    api_name    => 'open-ils.actor.user.address.pending.cud'
 );
 
 sub update_user_pending_address {
@@ -3429,13 +3429,13 @@ sub update_user_pending_address {
 
 
 __PACKAGE__->register_method (
-	method		=> 'user_events',
-	api_name    => 'open-ils.actor.user.events.circ',
+    method      => 'user_events',
+    api_name    => 'open-ils.actor.user.events.circ',
     stream      => 1,
 );
 __PACKAGE__->register_method (
-	method		=> 'user_events',
-	api_name    => 'open-ils.actor.user.events.ahr',
+    method      => 'user_events',
+    api_name    => 'open-ils.actor.user.events.ahr',
     stream      => 1,
 );
 
@@ -3482,13 +3482,13 @@ sub user_events {
 }
 
 __PACKAGE__->register_method (
-	method		=> 'copy_events',
-	api_name    => 'open-ils.actor.copy.events.circ',
+    method      => 'copy_events',
+    api_name    => 'open-ils.actor.copy.events.circ',
     stream      => 1,
 );
 __PACKAGE__->register_method (
-	method		=> 'copy_events',
-	api_name    => 'open-ils.actor.copy.events.ahr',
+    method      => 'copy_events',
+    api_name    => 'open-ils.actor.copy.events.ahr',
     stream      => 1,
 );
 
@@ -3538,13 +3538,13 @@ sub copy_events {
 
 
 __PACKAGE__->register_method (
-	method		=> 'update_events',
-	api_name    => 'open-ils.actor.user.event.cancel.batch',
+    method      => 'update_events',
+    api_name    => 'open-ils.actor.user.event.cancel.batch',
     stream      => 1,
 );
 __PACKAGE__->register_method (
-	method		=> 'update_events',
-	api_name    => 'open-ils.actor.user.event.reset.batch',
+    method      => 'update_events',
+    api_name    => 'open-ils.actor.user.event.reset.batch',
     stream      => 1,
 );
 
@@ -3594,14 +3594,14 @@ sub update_events {
 
 
 __PACKAGE__->register_method (
-	method		=> 'really_delete_user',
-	api_name    => 'open-ils.actor.user.delete.override',
+    method      => 'really_delete_user',
+    api_name    => 'open-ils.actor.user.delete.override',
     signature   => q/@see open-ils.actor.user.delete/
 );
 
 __PACKAGE__->register_method (
-	method		=> 'really_delete_user',
-	api_name    => 'open-ils.actor.user.delete',
+    method      => 'really_delete_user',
+    api_name    => 'open-ils.actor.user.delete',
     signature   => q/
         It anonymizes all personally identifiable information in actor.usr. By calling actor.usr_purge_data() 
         it also purges related data from other tables, sometimes by transferring it to a designated destination user.
@@ -3650,8 +3650,8 @@ sub really_delete_user {
 
 
 __PACKAGE__->register_method (
-	method		=> 'user_payments',
-	api_name    => 'open-ils.actor.user.payments.retrieve',
+    method      => 'user_payments',
+    api_name    => 'open-ils.actor.user.payments.retrieve',
     stream => 1,
     signature   => q/
         Returns all payments for a given user.  Default order is newest payments first.
@@ -3747,8 +3747,8 @@ sub user_payments {
 
 
 __PACKAGE__->register_method (
-	method		=> 'negative_balance_users',
-	api_name    => 'open-ils.actor.users.negative_balance',
+    method      => 'negative_balance_users',
+    api_name    => 'open-ils.actor.users.negative_balance',
     stream => 1,
     signature   => q/
         Returns all users that have an overall negative balance
@@ -3807,9 +3807,9 @@ sub negative_balance_users {
 }
 
 __PACKAGE__->register_method(
-	method	=> "request_password_reset",
-	api_name	=> "open-ils.actor.patron.password_reset.request",
-	signature	=> {
+    method  => "request_password_reset",
+    api_name    => "open-ils.actor.patron.password_reset.request",
+    signature   => {
         desc => "Generates a UUID token usable with the open-ils.actor.patron.password_reset.commit " .
                 "method for changing a user's password.  The UUID token is distributed via A/T "      .
                 "templates (i.e. email to the user).",
@@ -3965,9 +3965,9 @@ sub _reset_password_request {
 }
 
 __PACKAGE__->register_method(
-	method	=> "commit_password_reset",
-	api_name	=> "open-ils.actor.patron.password_reset.commit",
-	signature	=> {
+    method  => "commit_password_reset",
+    api_name    => "open-ils.actor.patron.password_reset.commit",
+    signature   => {
         desc => "Checks a UUID token generated by the open-ils.actor.patron.password_reset.request method for " .
                 "validity, and if valid, uses it as authorization for changing the associated user's password " .
                 "with the supplied password.",
@@ -4444,8 +4444,8 @@ __PACKAGE__->register_method(
 );
 
 sub get_barcodes {
-	my( $self, $client, $auth, $org_id, $context, $barcode ) = @_;
-	my $e = new_editor(authtoken => $auth);
+    my( $self, $client, $auth, $org_id, $context, $barcode ) = @_;
+    my $e = new_editor(authtoken => $auth);
     return $e->event unless $e->checkauth;
     return $e->event unless $e->allowed('STAFF_LOGIN', $org_id);
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/ClosedDates.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/ClosedDates.pm
index e7601df..93167f3 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/ClosedDates.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/ClosedDates.pm
@@ -7,149 +7,149 @@ use OpenILS::Utils::Editor q/:funcs/;
 sub initialize { return 1; }
 
 __PACKAGE__->register_method( 
-	method => 'fetch_dates',
-	api_name	=> 'open-ils.actor.org_unit.closed.retrieve.all',
-	signature	=> q/
-		Retrieves a list of closed date object IDs
-	/
+    method => 'fetch_dates',
+    api_name    => 'open-ils.actor.org_unit.closed.retrieve.all',
+    signature   => q/
+        Retrieves a list of closed date object IDs
+    /
 );
 
 sub fetch_dates {
-	my( $self, $conn, $auth, $args ) = @_;
+    my( $self, $conn, $auth, $args ) = @_;
 
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
 
-	my $org = $$args{orgid} || $e->requestor->ws_ou;
-	my @date = localtime;
-	my $start = $$args{start_date} ||  #default to today 
-		($date[5] + 1900) .'-'. ($date[4] + 1) .'-'. $date[3];
-	my $end = $$args{end_date} || '3000-01-01'; # Y3K, here I come..
+    my $org = $$args{orgid} || $e->requestor->ws_ou;
+    my @date = localtime;
+    my $start = $$args{start_date} ||  #default to today 
+        ($date[5] + 1900) .'-'. ($date[4] + 1) .'-'. $date[3];
+    my $end = $$args{end_date} || '3000-01-01'; # Y3K, here I come..
 
-	my $dates = $e->search_actor_org_unit_closed_date( 
-		{ 
-			close_start => { ">=" => $start }, 
-			close_end	=> { "<=" => $end },
-			org_unit		=> $org,
-		}, { idlist		=> $$args{idlist} } ) or return $e->event;
+    my $dates = $e->search_actor_org_unit_closed_date( 
+        { 
+            close_start => { ">=" => $start }, 
+            close_end   => { "<=" => $end },
+            org_unit        => $org,
+        }, { idlist     => $$args{idlist} } ) or return $e->event;
 
-	if(!$$args{idlist} and @$dates) {
-		$dates = [ sort { $a->close_start cmp $b->close_start } @$dates ];
-	}
+    if(!$$args{idlist} and @$dates) {
+        $dates = [ sort { $a->close_start cmp $b->close_start } @$dates ];
+    }
 
-	return $dates;
+    return $dates;
 }
 
 __PACKAGE__->register_method( 
-	method => 'fetch_date',
-	api_name	=> 'open-ils.actor.org_unit.closed.retrieve',
-	signature	=> q/
-		Retrieves a single date object
-	/
+    method => 'fetch_date',
+    api_name    => 'open-ils.actor.org_unit.closed.retrieve',
+    signature   => q/
+        Retrieves a single date object
+    /
 );
 
 sub fetch_date {
-	my( $self, $conn, $auth, $id ) = @_;
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	my $date = $e->retrieve_actor_org_unit_closed_date($id) or return $e->event;
-	return $date;
+    my( $self, $conn, $auth, $id ) = @_;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    my $date = $e->retrieve_actor_org_unit_closed_date($id) or return $e->event;
+    return $date;
 }
 
 
 __PACKAGE__->register_method( 
-	method => 'delete_date',
-	api_name	=> 'open-ils.actor.org_unit.closed.delete',
-	signature	=> q/
-		Removes a single date object
-	/
+    method => 'delete_date',
+    api_name    => 'open-ils.actor.org_unit.closed.delete',
+    signature   => q/
+        Removes a single date object
+    /
 );
 
 sub delete_date {
-	my( $self, $conn, $auth, $id ) = @_;
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	my $date = $e->retrieve_actor_org_unit_closed_date($id) or return $e->event;
-	return $e->event unless $e->allowed( # rely on the editor perm eventually
-		'actor.org_unit.closed_date.delete', $date->org_unit);
-	$e->delete_actor_org_unit_closed_date($date) or return $e->event;
-	return 1;
+    my( $self, $conn, $auth, $id ) = @_;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    my $date = $e->retrieve_actor_org_unit_closed_date($id) or return $e->event;
+    return $e->event unless $e->allowed( # rely on the editor perm eventually
+        'actor.org_unit.closed_date.delete', $date->org_unit);
+    $e->delete_actor_org_unit_closed_date($date) or return $e->event;
+    return 1;
 }
 
 
 
 
 __PACKAGE__->register_method( 
-	method => 'create_date',
-	api_name	=> 'open-ils.actor.org_unit.closed.create',
-	signature	=> q/
-		Creates a new org closed data
-	/
+    method => 'create_date',
+    api_name    => 'open-ils.actor.org_unit.closed.create',
+    signature   => q/
+        Creates a new org closed data
+    /
 );
 
 sub create_date {
-	my( $self, $conn, $auth, $date ) = @_;
+    my( $self, $conn, $auth, $date ) = @_;
 
-	my $e = new_editor(authtoken=>$auth, xact =>1);
-	return $e->event unless $e->checkauth;
-	
-	return $e->event unless $e->allowed( # rely on the editor perm eventually
-		'actor.org_unit.closed_date.create', $date->org_unit);
+    my $e = new_editor(authtoken=>$auth, xact =>1);
+    return $e->event unless $e->checkauth;
+    
+    return $e->event unless $e->allowed( # rely on the editor perm eventually
+        'actor.org_unit.closed_date.create', $date->org_unit);
 
-	$e->create_actor_org_unit_closed_date($date) or return $e->event;
+    $e->create_actor_org_unit_closed_date($date) or return $e->event;
 
-	my $newobj = $e->retrieve_actor_org_unit_closed_date($date->id)
-		or return $e->event;
+    my $newobj = $e->retrieve_actor_org_unit_closed_date($date->id)
+        or return $e->event;
 
-	$e->commit;
-	return $newobj;
+    $e->commit;
+    return $newobj;
 }
 
 
 __PACKAGE__->register_method(
-	method => 'edit_date',
-	api_name	=> 'open-ils.actor.org_unit.closed.update',
-	signature	=> q/
-		Updates a closed date object
-	/
+    method => 'edit_date',
+    api_name    => 'open-ils.actor.org_unit.closed.update',
+    signature   => q/
+        Updates a closed date object
+    /
 );
 
 sub edit_date {
-	my( $self, $conn, $auth, $date ) = @_;
-	my $e = new_editor(authtoken=>$auth, xact =>1);
-	return $e->event unless $e->checkauth;
-	
-	# First make sure they have the right to update the selected date object
-	my $odate = $e->retrieve_actor_org_unit_closed_date($date->id) 
-		or return $e->event;
+    my( $self, $conn, $auth, $date ) = @_;
+    my $e = new_editor(authtoken=>$auth, xact =>1);
+    return $e->event unless $e->checkauth;
+    
+    # First make sure they have the right to update the selected date object
+    my $odate = $e->retrieve_actor_org_unit_closed_date($date->id) 
+        or return $e->event;
 
-	return $e->event unless $e->allowed( # rely on the editor perm eventually
-		'actor.org_unit.closed_date.update', $odate->org_unit);
+    return $e->event unless $e->allowed( # rely on the editor perm eventually
+        'actor.org_unit.closed_date.update', $odate->org_unit);
 
-	$e->update_actor_org_unit_closed_date($date) or return $e->event;
+    $e->update_actor_org_unit_closed_date($date) or return $e->event;
 
-	return 1;
+    return 1;
 }
 
 
 __PACKAGE__->register_method(
-	method	=> 'closed_dates_overlap',
-	api_name	=> 'open-ils.actor.org_unit.closed_date.overlap',
-	signature	=> q/
-		Returns an object with 'start' and 'end' fields 
-		start is the first day the org is open going backwards from 
-		'date'.  end is the next day the org is open going
-		forward from 'date'.
-		@param orgid The org unit in question
-		@param date The date to search
-	/
+    method  => 'closed_dates_overlap',
+    api_name    => 'open-ils.actor.org_unit.closed_date.overlap',
+    signature   => q/
+        Returns an object with 'start' and 'end' fields 
+        start is the first day the org is open going backwards from 
+        'date'.  end is the next day the org is open going
+        forward from 'date'.
+        @param orgid The org unit in question
+        @param date The date to search
+    /
 );
 sub closed_dates_overlap {
-	my( $self, $conn, $auth, $orgid, $date ) = @_;
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	return $e->request(
-		'open-ils.storage.actor.org_unit.closed_date.overlap', $orgid, $date );
+    my( $self, $conn, $auth, $orgid, $date ) = @_;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    return $e->request(
+        'open-ils.storage.actor.org_unit.closed_date.overlap', $orgid, $date );
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Container.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Container.pm
index 537f35f..9952024 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Container.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Container.pm
@@ -33,24 +33,24 @@ $ctypes{'user'} = "container_user_bucket";
 my $event;
 
 sub _sort_buckets {
-	my $buckets = shift;
-	return $buckets unless ($buckets && $buckets->[0]);
-	return [ sort { $a->name cmp $b->name } @$buckets ];
+    my $buckets = shift;
+    return $buckets unless ($buckets && $buckets->[0]);
+    return [ sort { $a->name cmp $b->name } @$buckets ];
 }
 
 __PACKAGE__->register_method(
-	method	=> "bucket_retrieve_all",
-	api_name	=> "open-ils.actor.container.all.retrieve_by_user",
+    method  => "bucket_retrieve_all",
+    api_name    => "open-ils.actor.container.all.retrieve_by_user",
     authoritative => 1,
-	notes		=> <<"	NOTES");
-		Retrieves all un-fleshed buckets assigned to given user 
-		PARAMS(authtoken, bucketOwnerId)
-		If requestor ID is different than bucketOwnerId, requestor must have
-		VIEW_CONTAINER permissions.
-	NOTES
+    notes        => <<"    NOTES");
+        Retrieves all un-fleshed buckets assigned to given user 
+        PARAMS(authtoken, bucketOwnerId)
+        If requestor ID is different than bucketOwnerId, requestor must have
+        VIEW_CONTAINER permissions.
+    NOTES
 
 sub bucket_retrieve_all {
-	my($self, $client, $auth, $user_id) = @_;
+    my($self, $client, $auth, $user_id) = @_;
     my $e = new_editor(authtoken => $auth);
     return $e->event unless $e->checkauth;
 
@@ -58,30 +58,30 @@ sub bucket_retrieve_all {
         return $e->event unless $e->allowed('VIEW_CONTAINER');
     }
     
-	my %buckets;
+    my %buckets;
     for my $type (keys %ctypes) {
         my $meth = "search_" . $ctypes{$type};
-	    $buckets{$type} = $e->$meth({owner => $user_id});
+        $buckets{$type} = $e->$meth({owner => $user_id});
     }
 
-	return \%buckets;
+    return \%buckets;
 }
 
 __PACKAGE__->register_method(
-	method	=> "bucket_flesh",
-	api_name	=> "open-ils.actor.container.flesh",
+    method  => "bucket_flesh",
+    api_name    => "open-ils.actor.container.flesh",
     authoritative => 1,
-	argc		=> 3, 
+    argc        => 3, 
 );
 
 __PACKAGE__->register_method(
-	method	=> "bucket_flesh_pub",
-	api_name	=> "open-ils.actor.container.public.flesh",
-	argc		=> 3, 
+    method  => "bucket_flesh_pub",
+    api_name    => "open-ils.actor.container.public.flesh",
+    argc        => 3, 
 );
 
 sub bucket_flesh {
-	my($self, $conn, $auth, $class, $bucket_id) = @_;
+    my($self, $conn, $auth, $class, $bucket_id) = @_;
     my $e = new_editor(authtoken => $auth);
     return $e->event unless $e->checkauth;
     return _bucket_flesh($self, $conn, $e, $class, $bucket_id);
@@ -94,22 +94,22 @@ sub bucket_flesh_pub {
 }
 
 sub _bucket_flesh {
-	my($self, $conn, $e, $class, $bucket_id) = @_;
-	my $meth = 'retrieve_' . $ctypes{$class};
+    my($self, $conn, $e, $class, $bucket_id) = @_;
+    my $meth = 'retrieve_' . $ctypes{$class};
     my $bkt = $e->$meth($bucket_id) or return $e->event;
 
-	unless($U->is_true($bkt->pub)) {
+    unless($U->is_true($bkt->pub)) {
         return undef if $self->api_name =~ /public/;
         unless($bkt->owner eq $e->requestor->id) {
             my $owner = $e->retrieve_actor_user($bkt->owner)
                 or return $e->die_event;
             return $e->event unless $e->allowed('VIEW_CONTAINER', $owner->home_ou);
         }
-	}
+    }
 
     my $fmclass = $bkt->class_name . "i";
     $meth = 'search_' . $ctypes{$class} . '_item';
-	$bkt->items(
+    $bkt->items(
         $e->$meth(
             {bucket => $bucket_id}, 
             {   order_by => {$fmclass => "pos"},
@@ -119,13 +119,13 @@ sub _bucket_flesh {
         )
     );
 
-	return $bkt;
+    return $bkt;
 }
 
 
 __PACKAGE__->register_method(
-	method	=> "item_note_cud",
-	api_name	=> "open-ils.actor.container.item_note.cud",
+    method  => "item_note_cud",
+    api_name    => "open-ils.actor.container.item_note.cud",
 );
 
 
@@ -184,118 +184,118 @@ sub item_note_cud {
 
 
 __PACKAGE__->register_method(
-	method	=> "bucket_retrieve_class",
-	api_name	=> "open-ils.actor.container.retrieve_by_class",
-	argc		=> 3, 
-	authoritative   => 1, 
-	notes		=> <<"	NOTES");
-		Retrieves all un-fleshed buckets by class assigned to given user 
-		PARAMS(authtoken, bucketOwnerId, class [, type])
-		class can be one of "biblio", "callnumber", "copy", "user"
-		The optional "type" parameter allows you to limit the search by 
-		bucket type.  
-		If bucketOwnerId is not defined, the authtoken is used as the
-		bucket owner.
-		If requestor ID is different than bucketOwnerId, requestor must have
-		VIEW_CONTAINER permissions.
-	NOTES
+    method  => "bucket_retrieve_class",
+    api_name    => "open-ils.actor.container.retrieve_by_class",
+    argc        => 3, 
+    authoritative   => 1, 
+    notes        => <<"    NOTES");
+        Retrieves all un-fleshed buckets by class assigned to given user 
+        PARAMS(authtoken, bucketOwnerId, class [, type])
+        class can be one of "biblio", "callnumber", "copy", "user"
+        The optional "type" parameter allows you to limit the search by 
+        bucket type.  
+        If bucketOwnerId is not defined, the authtoken is used as the
+        bucket owner.
+        If requestor ID is different than bucketOwnerId, requestor must have
+        VIEW_CONTAINER permissions.
+    NOTES
 
 sub bucket_retrieve_class {
-	my( $self, $client, $authtoken, $userid, $class, $type ) = @_;
+    my( $self, $client, $authtoken, $userid, $class, $type ) = @_;
 
-	my( $staff, $user, $evt ) = 
-		$apputils->checkses_requestor( $authtoken, $userid, 'VIEW_CONTAINER' );
-	return $evt if $evt;
+    my( $staff, $user, $evt ) = 
+        $apputils->checkses_requestor( $authtoken, $userid, 'VIEW_CONTAINER' );
+    return $evt if $evt;
 
-	$logger->debug("User " . $staff->id . 
-		" retrieving buckets for user $userid [class=$class, type=$type]");
+    $logger->debug("User " . $staff->id . 
+        " retrieving buckets for user $userid [class=$class, type=$type]");
 
-	my $meth = $types{$class} . ".search.atomic";
-	my $buckets;
+    my $meth = $types{$class} . ".search.atomic";
+    my $buckets;
 
-	if( $type ) {
-		$buckets = $apputils->simplereq( $svc, 
-			$meth, { owner => $userid, btype => $type } );
-	} else {
-		$logger->debug("Grabbing buckets by class $class: $svc : $meth :  {owner => $userid}");
-		$buckets = $apputils->simplereq( $svc, $meth, { owner => $userid } );
-	}
+    if( $type ) {
+        $buckets = $apputils->simplereq( $svc, 
+            $meth, { owner => $userid, btype => $type } );
+    } else {
+        $logger->debug("Grabbing buckets by class $class: $svc : $meth :  {owner => $userid}");
+        $buckets = $apputils->simplereq( $svc, $meth, { owner => $userid } );
+    }
 
-	return _sort_buckets($buckets);
+    return _sort_buckets($buckets);
 }
 
 __PACKAGE__->register_method(
-	method	=> "bucket_create",
-	api_name	=> "open-ils.actor.container.create",
-	notes		=> <<"	NOTES");
-		Creates a new bucket object.  If requestor is different from
-		bucketOwner, requestor needs CREATE_CONTAINER permissions
-		PARAMS(authtoken, bucketObject);
-		Returns the new bucket object
-	NOTES
+    method  => "bucket_create",
+    api_name    => "open-ils.actor.container.create",
+    notes        => <<"    NOTES");
+        Creates a new bucket object.  If requestor is different from
+        bucketOwner, requestor needs CREATE_CONTAINER permissions
+        PARAMS(authtoken, bucketObject);
+        Returns the new bucket object
+    NOTES
 
 sub bucket_create {
-	my( $self, $client, $authtoken, $class, $bucket ) = @_;
+    my( $self, $client, $authtoken, $class, $bucket ) = @_;
 
-	my $e = new_editor(xact=>1, authtoken=>$authtoken);
-	return $e->event unless $e->checkauth;
+    my $e = new_editor(xact=>1, authtoken=>$authtoken);
+    return $e->event unless $e->checkauth;
 
-	if( $bucket->owner ne $e->requestor->id ) {
-		return $e->event unless
-			$e->allowed('CREATE_CONTAINER');
+    if( $bucket->owner ne $e->requestor->id ) {
+        return $e->event unless
+            $e->allowed('CREATE_CONTAINER');
 
-	} else {
-		return $e->event unless
-			$e->allowed('CREATE_MY_CONTAINER');
-	}
-		
-	$bucket->clear_id;
+    } else {
+        return $e->event unless
+            $e->allowed('CREATE_MY_CONTAINER');
+    }
+        
+    $bucket->clear_id;
 
     my $evt = OpenILS::Event->new('CONTAINER_EXISTS', 
         payload => [$class, $bucket->owner, $bucket->btype, $bucket->name]);
     my $search = {name => $bucket->name, owner => $bucket->owner, btype => $bucket->btype};
 
-	my $obj;
-	if( $class eq 'copy' ) {
+    my $obj;
+    if( $class eq 'copy' ) {
         return $evt if $e->search_container_copy_bucket($search)->[0];
-		return $e->event unless
-			$obj = $e->create_container_copy_bucket($bucket);
-	}
+        return $e->event unless
+            $obj = $e->create_container_copy_bucket($bucket);
+    }
 
-	if( $class eq 'callnumber' ) {
+    if( $class eq 'callnumber' ) {
         return $evt if $e->search_container_call_number_bucket($search)->[0];
-		return $e->event unless
-			$obj = $e->create_container_call_number_bucket($bucket);
-	}
+        return $e->event unless
+            $obj = $e->create_container_call_number_bucket($bucket);
+    }
 
-	if( $class eq 'biblio' ) {
+    if( $class eq 'biblio' ) {
         return $evt if $e->search_container_biblio_record_entry_bucket($search)->[0];
-		return $e->event unless
-			$obj = $e->create_container_biblio_record_entry_bucket($bucket);
-	}
+        return $e->event unless
+            $obj = $e->create_container_biblio_record_entry_bucket($bucket);
+    }
 
-	if( $class eq 'user') {
+    if( $class eq 'user') {
         return $evt if $e->search_container_user_bucket($search)->[0];
-		return $e->event unless
-			$obj = $e->create_container_user_bucket($bucket);
-	}
+        return $e->event unless
+            $obj = $e->create_container_user_bucket($bucket);
+    }
 
-	$e->commit;
-	return $obj->id;
+    $e->commit;
+    return $obj->id;
 }
 
 
 __PACKAGE__->register_method(
-	method	=> "item_create",
-	api_name	=> "open-ils.actor.container.item.create",
+    method  => "item_create",
+    api_name    => "open-ils.actor.container.item.create",
     signature => {
         desc => q/
             Adds one or more items to an existing container
         /,
         params => [
-		    {desc => 'Authentication token', type => 'string'},
-		    {desc => 'Container class.  Can be "copy", "callnumber", "biblio", or "user"', type => 'string'},
-		    {desc => 'Item or items.  Can either be a single container item object, or an array of them', type => 'object'},
+            {desc => 'Authentication token', type => 'string'},
+            {desc => 'Container class.  Can be "copy", "callnumber", "biblio", or "user"', type => 'string'},
+            {desc => 'Item or items.  Can either be a single container item object, or an array of them', type => 'object'},
         ],
         return => {
             desc => 'The ID of the newly created item(s).  In batch context, an array of IDs is returned'
@@ -305,24 +305,24 @@ __PACKAGE__->register_method(
 
 
 sub item_create {
-	my( $self, $client, $authtoken, $class, $item ) = @_;
+    my( $self, $client, $authtoken, $class, $item ) = @_;
 
-	my $e = new_editor(xact=>1, authtoken=>$authtoken);
-	return $e->die_event unless $e->checkauth;
+    my $e = new_editor(xact=>1, authtoken=>$authtoken);
+    return $e->die_event unless $e->checkauth;
     my $items = (ref $item eq 'ARRAY') ? $item : [$item];
 
-	my ( $bucket, $evt ) = $apputils->fetch_container_e($e, $item->bucket, $class);
-	return $evt if $evt;
+    my ( $bucket, $evt ) = $apputils->fetch_container_e($e, $item->bucket, $class);
+    return $evt if $evt;
 
-	if( $bucket->owner ne $e->requestor->id ) {
-		return $e->die_event unless
-			$e->allowed('CREATE_CONTAINER_ITEM');
+    if( $bucket->owner ne $e->requestor->id ) {
+        return $e->die_event unless
+            $e->allowed('CREATE_CONTAINER_ITEM');
 
-	} else {
-#		return $e->event unless
-#			$e->allowed('CREATE_CONTAINER_ITEM'); # new perm here?
-	}
-		
+    } else {
+#       return $e->event unless
+#           $e->allowed('CREATE_CONTAINER_ITEM'); # new perm here?
+    }
+        
     for my $one_item (@$items) {
 
         $one_item->clear_id;
@@ -349,221 +349,221 @@ sub item_create {
         }
     }
 
-	$e->commit;
+    $e->commit;
 
     # CStoreEeditor inserts the id (pkey) on newly created objects
     return [ map { $_->id } @$items ] if ref $item eq 'ARRAY';
-	return $item->id; 
+    return $item->id; 
 }
 
 
 
 __PACKAGE__->register_method(
-	method	=> "item_delete",
-	api_name	=> "open-ils.actor.container.item.delete",
-	notes		=> <<"	NOTES");
-		PARAMS(authtoken, class, itemId)
-	NOTES
+    method  => "item_delete",
+    api_name    => "open-ils.actor.container.item.delete",
+    notes        => <<"    NOTES");
+        PARAMS(authtoken, class, itemId)
+    NOTES
 
 sub item_delete {
-	my( $self, $client, $authtoken, $class, $itemid ) = @_;
+    my( $self, $client, $authtoken, $class, $itemid ) = @_;
 
-	my $e = new_editor(xact=>1, authtoken=>$authtoken);
-	return $e->event unless $e->checkauth;
+    my $e = new_editor(xact=>1, authtoken=>$authtoken);
+    return $e->event unless $e->checkauth;
 
-	my $ret = __item_delete($e, $class, $itemid);
-	$e->commit unless $U->event_code($ret);
-	return $ret;
+    my $ret = __item_delete($e, $class, $itemid);
+    $e->commit unless $U->event_code($ret);
+    return $ret;
 }
 
 sub __item_delete {
-	my( $e, $class, $itemid ) = @_;
-	my( $bucket, $item, $evt);
+    my( $e, $class, $itemid ) = @_;
+    my( $bucket, $item, $evt);
 
-	( $item, $evt ) = $U->fetch_container_item_e( $e, $itemid, $class );
-	return $evt if $evt;
+    ( $item, $evt ) = $U->fetch_container_item_e( $e, $itemid, $class );
+    return $evt if $evt;
 
-	( $bucket, $evt ) = $U->fetch_container_e($e, $item->bucket, $class);
-	return $evt if $evt;
+    ( $bucket, $evt ) = $U->fetch_container_e($e, $item->bucket, $class);
+    return $evt if $evt;
 
-	if( $bucket->owner ne $e->requestor->id ) {
+    if( $bucket->owner ne $e->requestor->id ) {
       my $owner = $e->retrieve_actor_user($bucket->owner)
          or return $e->die_event;
-		return $e->event unless $e->allowed('DELETE_CONTAINER_ITEM', $owner->home_ou);
-	}
+        return $e->event unless $e->allowed('DELETE_CONTAINER_ITEM', $owner->home_ou);
+    }
 
-	my $stat;
-	if( $class eq 'copy' ) {
+    my $stat;
+    if( $class eq 'copy' ) {
         for my $note (@{$e->search_container_copy_bucket_item_note({item => $item->id})}) {
             return $e->event unless 
                 $e->delete_container_copy_bucket_item_note($note);
         }
-		return $e->event unless
-			$stat = $e->delete_container_copy_bucket_item($item);
-	}
+        return $e->event unless
+            $stat = $e->delete_container_copy_bucket_item($item);
+    }
 
-	if( $class eq 'callnumber' ) {
+    if( $class eq 'callnumber' ) {
         for my $note (@{$e->search_container_call_number_bucket_item_note({item => $item->id})}) {
             return $e->event unless 
                 $e->delete_container_call_number_bucket_item_note($note);
         }
-		return $e->event unless
-			$stat = $e->delete_container_call_number_bucket_item($item);
-	}
+        return $e->event unless
+            $stat = $e->delete_container_call_number_bucket_item($item);
+    }
 
-	if( $class eq 'biblio' ) {
+    if( $class eq 'biblio' ) {
         for my $note (@{$e->search_container_biblio_record_entry_bucket_item_note({item => $item->id})}) {
             return $e->event unless 
                 $e->delete_container_biblio_record_entry_bucket_item_note($note);
         }
-		return $e->event unless
-			$stat = $e->delete_container_biblio_record_entry_bucket_item($item);
-	}
+        return $e->event unless
+            $stat = $e->delete_container_biblio_record_entry_bucket_item($item);
+    }
 
-	if( $class eq 'user') {
+    if( $class eq 'user') {
         for my $note (@{$e->search_container_user_bucket_item_note({item => $item->id})}) {
             return $e->event unless 
                 $e->delete_container_user_bucket_item_note($note);
         }
-		return $e->event unless
-			$stat = $e->delete_container_user_bucket_item($item);
-	}
+        return $e->event unless
+            $stat = $e->delete_container_user_bucket_item($item);
+    }
 
-	return $stat;
+    return $stat;
 }
 
 
 __PACKAGE__->register_method(
-	method	=> 'full_delete',
-	api_name	=> 'open-ils.actor.container.full_delete',
-	notes		=> "Complety removes a container including all attached items",
-);	
+    method  => 'full_delete',
+    api_name    => 'open-ils.actor.container.full_delete',
+    notes       => "Complety removes a container including all attached items",
+);  
 
 sub full_delete {
-	my( $self, $client, $authtoken, $class, $containerId ) = @_;
-	my( $container, $evt);
+    my( $self, $client, $authtoken, $class, $containerId ) = @_;
+    my( $container, $evt);
 
-	my $e = new_editor(xact=>1, authtoken=>$authtoken);
-	return $e->event unless $e->checkauth;
+    my $e = new_editor(xact=>1, authtoken=>$authtoken);
+    return $e->event unless $e->checkauth;
 
-	( $container, $evt ) = $apputils->fetch_container_e($e, $containerId, $class);
-	return $evt if $evt;
+    ( $container, $evt ) = $apputils->fetch_container_e($e, $containerId, $class);
+    return $evt if $evt;
 
-	if( $container->owner ne $e->requestor->id ) {
+    if( $container->owner ne $e->requestor->id ) {
       my $owner = $e->retrieve_actor_user($container->owner)
          or return $e->die_event;
-		return $e->event unless $e->allowed('DELETE_CONTAINER', $owner->home_ou);
-	}
+        return $e->event unless $e->allowed('DELETE_CONTAINER', $owner->home_ou);
+    }
 
-	my $items; 
+    my $items; 
 
-	my @s = ({bucket => $containerId}, {idlist=>1});
+    my @s = ({bucket => $containerId}, {idlist=>1});
 
-	if( $class eq 'copy' ) {
-		$items = $e->search_container_copy_bucket_item(@s);
-	}
+    if( $class eq 'copy' ) {
+        $items = $e->search_container_copy_bucket_item(@s);
+    }
 
-	if( $class eq 'callnumber' ) {
-		$items = $e->search_container_call_number_bucket_item(@s);
-	}
+    if( $class eq 'callnumber' ) {
+        $items = $e->search_container_call_number_bucket_item(@s);
+    }
 
-	if( $class eq 'biblio' ) {
-		$items = $e->search_container_biblio_record_entry_bucket_item(@s);
-	}
+    if( $class eq 'biblio' ) {
+        $items = $e->search_container_biblio_record_entry_bucket_item(@s);
+    }
 
-	if( $class eq 'user') {
-		$items = $e->search_container_user_bucket_item(@s);
-	}
+    if( $class eq 'user') {
+        $items = $e->search_container_user_bucket_item(@s);
+    }
 
-	__item_delete($e, $class, $_) for @$items;
+    __item_delete($e, $class, $_) for @$items;
 
-	my $stat;
-	if( $class eq 'copy' ) {
-		return $e->event unless
-			$stat = $e->delete_container_copy_bucket($container);
-	}
+    my $stat;
+    if( $class eq 'copy' ) {
+        return $e->event unless
+            $stat = $e->delete_container_copy_bucket($container);
+    }
 
-	if( $class eq 'callnumber' ) {
-		return $e->event unless
-			$stat = $e->delete_container_call_number_bucket($container);
-	}
+    if( $class eq 'callnumber' ) {
+        return $e->event unless
+            $stat = $e->delete_container_call_number_bucket($container);
+    }
 
-	if( $class eq 'biblio' ) {
-		return $e->event unless
-			$stat = $e->delete_container_biblio_record_entry_bucket($container);
-	}
+    if( $class eq 'biblio' ) {
+        return $e->event unless
+            $stat = $e->delete_container_biblio_record_entry_bucket($container);
+    }
 
-	if( $class eq 'user') {
-		return $e->event unless
-			$stat = $e->delete_container_user_bucket($container);
-	}
+    if( $class eq 'user') {
+        return $e->event unless
+            $stat = $e->delete_container_user_bucket($container);
+    }
 
-	$e->commit;
-	return $stat;
+    $e->commit;
+    return $stat;
 }
 
 __PACKAGE__->register_method(
-	method		=> 'container_update',
-	api_name		=> 'open-ils.actor.container.update',
-	signature	=> q/
-		Updates the given container item.
-		@param authtoken The login session key
-		@param class The container class
-		@param container The container item
-		@return true on success, 0 on no update, Event on error
-		/
+    method      => 'container_update',
+    api_name        => 'open-ils.actor.container.update',
+    signature   => q/
+        Updates the given container item.
+        @param authtoken The login session key
+        @param class The container class
+        @param container The container item
+        @return true on success, 0 on no update, Event on error
+        /
 );
 
 sub container_update {
-	my( $self, $conn, $authtoken, $class, $container )  = @_;
+    my( $self, $conn, $authtoken, $class, $container )  = @_;
 
-	my $e = new_editor(xact=>1, authtoken=>$authtoken);
-	return $e->event unless $e->checkauth;
+    my $e = new_editor(xact=>1, authtoken=>$authtoken);
+    return $e->event unless $e->checkauth;
 
-	my ( $dbcontainer, $evt ) = $U->fetch_container_e($e, $container->id, $class);
-	return $evt if $evt;
+    my ( $dbcontainer, $evt ) = $U->fetch_container_e($e, $container->id, $class);
+    return $evt if $evt;
 
-	if( $e->requestor->id ne $container->owner ) {
-		return $e->event unless $e->allowed('UPDATE_CONTAINER');
-	}
+    if( $e->requestor->id ne $container->owner ) {
+        return $e->event unless $e->allowed('UPDATE_CONTAINER');
+    }
 
-	my $stat;
-	if( $class eq 'copy' ) {
-		return $e->event unless
-			$stat = $e->update_container_copy_bucket($container);
-	}
+    my $stat;
+    if( $class eq 'copy' ) {
+        return $e->event unless
+            $stat = $e->update_container_copy_bucket($container);
+    }
 
-	if( $class eq 'callnumber' ) {
-		return $e->event unless
-			$stat = $e->update_container_call_number_bucket($container);
-	}
+    if( $class eq 'callnumber' ) {
+        return $e->event unless
+            $stat = $e->update_container_call_number_bucket($container);
+    }
 
-	if( $class eq 'biblio' ) {
-		return $e->event unless
-			$stat = $e->update_container_biblio_record_entry_bucket($container);
-	}
+    if( $class eq 'biblio' ) {
+        return $e->event unless
+            $stat = $e->update_container_biblio_record_entry_bucket($container);
+    }
 
-	if( $class eq 'user') {
-		return $e->event unless
-			$stat = $e->update_container_user_bucket($container);
-	}
+    if( $class eq 'user') {
+        return $e->event unless
+            $stat = $e->update_container_user_bucket($container);
+    }
 
-	$e->commit;
-	return $stat;
+    $e->commit;
+    return $stat;
 }
 
 
 
 __PACKAGE__->register_method(
-	method	=> "anon_cache",
-	api_name	=> "open-ils.actor.anon_cache.set_value",
+    method  => "anon_cache",
+    api_name    => "open-ils.actor.anon_cache.set_value",
     signature => {
         desc => q/
             Sets a value in the anon web cache.  If the session key is
             undefined, one will be automatically generated.
         /,
         params => [
-		    {desc => 'Session key', type => 'string'},
+            {desc => 'Session key', type => 'string'},
             {
                 desc => q/Field name.  The name of the field in this cache session whose value to set/, 
                 type => 'string'
@@ -581,14 +581,14 @@ __PACKAGE__->register_method(
 );
 
 __PACKAGE__->register_method(
-	method	=> "anon_cache",
-	api_name	=> "open-ils.actor.anon_cache.get_value",
+    method  => "anon_cache",
+    api_name    => "open-ils.actor.anon_cache.get_value",
     signature => {
         desc => q/
             Returns the cached data at the specified field within the specified cache session.
         /,
         params => [
-		    {desc => 'Session key', type => 'string'},
+            {desc => 'Session key', type => 'string'},
             {
                 desc => q/Field name.  The name of the field in this cache session whose value to set/, 
                 type => 'string'
@@ -602,14 +602,14 @@ __PACKAGE__->register_method(
 );
 
 __PACKAGE__->register_method(
-	method	=> "anon_cache",
-	api_name	=> "open-ils.actor.anon_cache.delete_session",
+    method  => "anon_cache",
+    api_name    => "open-ils.actor.anon_cache.delete_session",
     signature => {
         desc => q/
             Deletes a cache session.
         /,
         params => [
-		    {desc => 'Session key', type => 'string'},
+            {desc => 'Session key', type => 'string'},
         ],
         return => {
             desc => 'Session key',
@@ -622,7 +622,7 @@ sub anon_cache {
     my($self, $conn, $ses_key, $field_key, $value) = @_;
 
     my $sc = OpenSRF::Utils::SettingsClient->new;
-	my $cache = OpenSRF::Utils::Cache->new('anon');
+    my $cache = OpenSRF::Utils::Cache->new('anon');
     my $cache_timeout = $sc->config_value(cache => anon => 'max_cache_time') || 1800; # 30 minutes
     my $cache_size = $sc->config_value(cache => anon => 'max_cache_size') || 102400; # 100k
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Stage.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Stage.pm
index 0e65c12..77bc685 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Stage.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/Stage.pm
@@ -9,18 +9,18 @@ my $U = "OpenILS::Application::AppUtils";
 
 
 __PACKAGE__->register_method (
-	method		=> 'create_user_stage',
-	api_name    => 'open-ils.actor.user.stage.create',
+    method      => 'create_user_stage',
+    api_name    => 'open-ils.actor.user.stage.create',
     signature => {
         desc => q/
             Creates a new pending user account including addresses and statcats.
             Users are added to staging tables pending staff review.
         /,
         params => [
-		    {desc => 'user', type => 'object', class => 'stgu'},
-		    {desc => 'Mailing address.  Optional', type => 'object', class => 'stgma'},
-		    {desc => 'Billing address.  Optional', type => 'object', class => 'stgba'},
-		    {desc => 'Statcats.  Optional.  This is an array of "stgsc" objects', type => 'array'},
+            {desc => 'user', type => 'object', class => 'stgu'},
+            {desc => 'Mailing address.  Optional', type => 'object', class => 'stgma'},
+            {desc => 'Billing address.  Optional', type => 'object', class => 'stgba'},
+            {desc => 'Statcats.  Optional.  This is an array of "stgsc" objects', type => 'array'},
         ],
         return => {
             desc => 'username on success, Event on error',
@@ -68,8 +68,8 @@ sub create_user_stage {
 }
 
 __PACKAGE__->register_method (
-	method		=> 'user_stage_by_org',
-	api_name    => 'open-ils.actor.user.stage.retrieve.by_org',
+    method      => 'user_stage_by_org',
+    api_name    => 'open-ils.actor.user.stage.retrieve.by_org',
     stream      => 1
 );
 
@@ -113,8 +113,8 @@ sub flesh_user_stage {
 
 
 __PACKAGE__->register_method (
-	method		=> 'user_stage_by_uname',
-	api_name    => 'open-ils.actor.user.stage.retrieve.by_username',
+    method      => 'user_stage_by_uname',
+    api_name    => 'open-ils.actor.user.stage.retrieve.by_username',
 );
 
 sub user_stage_by_uname {
@@ -136,8 +136,8 @@ sub user_stage_by_uname {
 
 
 __PACKAGE__->register_method (
-	method		=> 'delete_user_stage', 
-	api_name    => 'open-ils.actor.user.stage.delete',
+    method      => 'delete_user_stage', 
+    api_name    => 'open-ils.actor.user.stage.delete',
 );
 
 sub delete_user_stage {
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/UserGroups.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/UserGroups.pm
index 7691fe5..2f9914d 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/UserGroups.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor/UserGroups.pm
@@ -12,20 +12,20 @@ sub initialize { return 1; }
 
 
 __PACKAGE__->register_method(
-	method => 'group_money_summary',
-	api_name	=> 'open-ils.actor.usergroup.members.balance_owed',
+    method => 'group_money_summary',
+    api_name    => 'open-ils.actor.usergroup.members.balance_owed',
     authoritative => 1,
-	signature	=> q/
-	/
+    signature   => q/
+    /
 );
 
 sub group_money_summary {
-	my($self, $conn, $auth, $group_id) = @_;
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed('VIEW_USER');
+    my($self, $conn, $auth, $group_id) = @_;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    return $e->event unless $e->allowed('VIEW_USER');
 
-	my $users = $e->search_actor_user({usrgroup => $group_id}, {idlist => 1});
+    my $users = $e->search_actor_user({usrgroup => $group_id}, {idlist => 1});
     my @mous;
 
     for my $uid ( @$users ) {
@@ -43,107 +43,107 @@ sub group_money_summary {
 
 
 __PACKAGE__->register_method(
-	method => 'get_users_from_usergroup',
-	api_name	=> 'open-ils.actor.usergroup.members.retrieve',
+    method => 'get_users_from_usergroup',
+    api_name    => 'open-ils.actor.usergroup.members.retrieve',
     authoritative => 1,
-	signature	=> q/
-		Returns a list of ids for users that are in the given usergroup
-	/
+    signature   => q/
+        Returns a list of ids for users that are in the given usergroup
+    /
 );
 
 sub get_users_from_usergroup {
-	my( $self, $conn, $auth, $usergroup ) = @_;
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed('VIEW_USER'); # XXX reley on editor perm
-	return $e->search_actor_user({usrgroup => $usergroup}, {idlist => 1});
+    my( $self, $conn, $auth, $usergroup ) = @_;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    return $e->event unless $e->allowed('VIEW_USER'); # XXX reley on editor perm
+    return $e->search_actor_user({usrgroup => $usergroup}, {idlist => 1});
 }
 
 
 
 __PACKAGE__->register_method(
-	method => 'get_leaders_from_usergroup',
-	api_name	=> 'open-ils.actor.usergroup.leaders.retrieve',
-	signature	=> q/
-		Returns a list of ids for users that are leaders of the given usergroup
-	/
+    method => 'get_leaders_from_usergroup',
+    api_name    => 'open-ils.actor.usergroup.leaders.retrieve',
+    signature   => q/
+        Returns a list of ids for users that are leaders of the given usergroup
+    /
 );
 
 sub get_leaders_from_usergroup {
-	my( $self, $conn, $auth, $usergroup ) = @_;
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed('VIEW_USER'); # XXX reley on editor perm
-	my $users = $e->search_actor_user({usrgroup => $usergroup})
-		or return $e->event;
-
-	my @res;
-	for my $u (@$users) {
-		push( @res, $u->id ) if $u->master_account;
-	}
-
-	return \@res;
+    my( $self, $conn, $auth, $usergroup ) = @_;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    return $e->event unless $e->allowed('VIEW_USER'); # XXX reley on editor perm
+    my $users = $e->search_actor_user({usrgroup => $usergroup})
+        or return $e->event;
+
+    my @res;
+    for my $u (@$users) {
+        push( @res, $u->id ) if $u->master_account;
+    }
+
+    return \@res;
 }
 
 
 
 __PACKAGE__->register_method(
-	method => 'get_address_members',
-	api_name	=> 'open-ils.actor.address.members',
-	signature	=> q/
-		Returns a list of ids for users that link to the given address
-		@param auth
-		@param addrid The address id
-	/
+    method => 'get_address_members',
+    api_name    => 'open-ils.actor.address.members',
+    signature   => q/
+        Returns a list of ids for users that link to the given address
+        @param auth
+        @param addrid The address id
+    /
 );
 
 sub get_address_members {
-	my( $self, $conn, $auth, $addrid ) = @_;
+    my( $self, $conn, $auth, $addrid ) = @_;
 
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed('VIEW_USER'); # XXX reley on editor perm
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    return $e->event unless $e->allowed('VIEW_USER'); # XXX reley on editor perm
 
-	my $ad = $e->retrieve_actor_user_address($addrid) or return $e->event;
-	my $ma = $e->search_actor_user({mailing_address => $addrid}, {idlist => 1});
-	my $ba = $e->search_actor_user({billing_address => $addrid}, {idlist => 1});
+    my $ad = $e->retrieve_actor_user_address($addrid) or return $e->event;
+    my $ma = $e->search_actor_user({mailing_address => $addrid}, {idlist => 1});
+    my $ba = $e->search_actor_user({billing_address => $addrid}, {idlist => 1});
 
-	my @list = (@$ma, @$ba, $ad->usr);
-	my %dedup = map { $_ => 1 } @list;
-	return [ keys %dedup ];
+    my @list = (@$ma, @$ba, $ad->usr);
+    my %dedup = map { $_ => 1 } @list;
+    return [ keys %dedup ];
 }
 
 
 
 __PACKAGE__->register_method(
-	method	=> 'reset_group',
-	api_name	=> 'open-ils.actor.usergroup.new',
-	signature	=> q/
-		Gives the requested user a new empty usergroup.  
-		@param auth The auth token
-		@param userid The id of the user who needs the new usergroup
-		@param leader If true, this user will be marked as the group leader
-	/
+    method  => 'reset_group',
+    api_name    => 'open-ils.actor.usergroup.new',
+    signature   => q/
+        Gives the requested user a new empty usergroup.  
+        @param auth The auth token
+        @param userid The id of the user who needs the new usergroup
+        @param leader If true, this user will be marked as the group leader
+    /
 );
 
 sub reset_group {
-	my( $self, $conn, $auth, $userid, $leader ) = @_;
+    my( $self, $conn, $auth, $userid, $leader ) = @_;
 
-	my $e = new_editor(authtoken=>$auth, xact=>1);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('UPDATE_USER'); # XXX reley on editor perm
+    my $e = new_editor(authtoken=>$auth, xact=>1);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('UPDATE_USER'); # XXX reley on editor perm
 
-	my $user = $e->retrieve_actor_user($userid) or return $e->die_event;
+    my $user = $e->retrieve_actor_user($userid) or return $e->die_event;
 
-	# ask for a new group id
-	my $groupid = $U->storagereq('open-ils.storage.actor.user.group_id.new');
+    # ask for a new group id
+    my $groupid = $U->storagereq('open-ils.storage.actor.user.group_id.new');
 
-	$user->usrgroup($groupid);
-	$user->master_account('t') if $leader;
+    $user->usrgroup($groupid);
+    $user->master_account('t') if $leader;
 
-	$e->update_actor_user($user) or return $e->die_event;
-	$e->commit;
-	return $groupid;
+    $e->update_actor_user($user) or return $e->die_event;
+    $e->commit;
+    return $groupid;
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm
index 817cd7d..82644f9 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm
@@ -29,34 +29,34 @@ my $cache_client = "OpenSRF::Utils::Cache";
 # ---------------------------------------------------------------------------
 sub start_db_session {
 
-	my $self = shift;
-	my $session = OpenSRF::AppSession->connect( "open-ils.storage" );
-	my $trans_req = $session->request( "open-ils.storage.transaction.begin" );
-
-	my $trans_resp = $trans_req->recv();
-	if(ref($trans_resp) and UNIVERSAL::isa($trans_resp,"Error")) { throw $trans_resp; }
-	if( ! $trans_resp->content() ) {
-		throw OpenSRF::ERROR 
-			("Unable to Begin Transaction with database" );
-	}
-	$trans_req->finish();
+    my $self = shift;
+    my $session = OpenSRF::AppSession->connect( "open-ils.storage" );
+    my $trans_req = $session->request( "open-ils.storage.transaction.begin" );
+
+    my $trans_resp = $trans_req->recv();
+    if(ref($trans_resp) and UNIVERSAL::isa($trans_resp,"Error")) { throw $trans_resp; }
+    if( ! $trans_resp->content() ) {
+        throw OpenSRF::ERROR 
+            ("Unable to Begin Transaction with database" );
+    }
+    $trans_req->finish();
 
-	$logger->debug("Setting global storage session to ".
-		"session: " . $session->session_id . " : " . $session->app );
+    $logger->debug("Setting global storage session to ".
+        "session: " . $session->session_id . " : " . $session->app );
 
-	return $session;
+    return $session;
 }
 
 sub set_audit_info {
-	my $self = shift;
-	my $session = shift;
-	my $authtoken = shift;
-	my $user_id = shift;
-	my $ws_id = shift;
-	
-	my $audit_req = $session->request( "open-ils.storage.set_audit_info", $authtoken, $user_id, $ws_id );
-	my $audit_resp = $audit_req->recv();
-	$audit_req->finish();
+    my $self = shift;
+    my $session = shift;
+    my $authtoken = shift;
+    my $user_id = shift;
+    my $ws_id = shift;
+    
+    my $audit_req = $session->request( "open-ils.storage.set_audit_info", $authtoken, $user_id, $ws_id );
+    my $audit_resp = $audit_req->recv();
+    $audit_req->finish();
 }
 
 my $PERM_QUERY = {
@@ -76,23 +76,23 @@ my $PERM_QUERY = {
 # returns undef if user has all of the perms provided
 # returns the first failed perm on failure
 sub check_user_perms {
-	my($self, $user_id, $org_id, @perm_types ) = @_;
-	$logger->debug("Checking perms with user : $user_id , org: $org_id, @perm_types");
+    my($self, $user_id, $org_id, @perm_types ) = @_;
+    $logger->debug("Checking perms with user : $user_id , org: $org_id, @perm_types");
 
-	for my $type (@perm_types) {
-	    $PERM_QUERY->{select}->{au}->[0]->{params} = [$type, $org_id];
-		$PERM_QUERY->{where}->{id} = $user_id;
-		return $type unless $self->is_true(OpenILS::Utils::CStoreEditor->new->json_query($PERM_QUERY)->[0]->{has_perm});
-	}
-	return undef;
+    for my $type (@perm_types) {
+        $PERM_QUERY->{select}->{au}->[0]->{params} = [$type, $org_id];
+        $PERM_QUERY->{where}->{id} = $user_id;
+        return $type unless $self->is_true(OpenILS::Utils::CStoreEditor->new->json_query($PERM_QUERY)->[0]->{has_perm});
+    }
+    return undef;
 }
 
 # checks the list of user perms.  The first one that fails returns a new
 sub check_perms {
-	my( $self, $user_id, $org_id, @perm_types ) = @_;
-	my $t = $self->check_user_perms( $user_id, $org_id, @perm_types );
-	return OpenILS::Event->new('PERM_FAILURE', ilsperm => $t, ilspermloc => $org_id ) if $t;
-	return undef;
+    my( $self, $user_id, $org_id, @perm_types ) = @_;
+    my $t = $self->check_user_perms( $user_id, $org_id, @perm_types );
+    return OpenILS::Event->new('PERM_FAILURE', ilsperm => $t, ilspermloc => $org_id ) if $t;
+    return undef;
 }
 
 
@@ -101,59 +101,59 @@ sub check_perms {
 # commits and destroys the session
 # ---------------------------------------------------------------------------
 sub commit_db_session {
-	my( $self, $session ) = @_;
+    my( $self, $session ) = @_;
 
-	my $req = $session->request( "open-ils.storage.transaction.commit" );
-	my $resp = $req->recv();
+    my $req = $session->request( "open-ils.storage.transaction.commit" );
+    my $resp = $req->recv();
 
-	if(!$resp) {
-		throw OpenSRF::EX::ERROR ("Unable to commit db session");
-	}
+    if(!$resp) {
+        throw OpenSRF::EX::ERROR ("Unable to commit db session");
+    }
 
-	if(UNIVERSAL::isa($resp,"Error")) { 
-		throw $resp ($resp->stringify); 
-	}
+    if(UNIVERSAL::isa($resp,"Error")) { 
+        throw $resp ($resp->stringify); 
+    }
 
-	if(!$resp->content) {
-		throw OpenSRF::EX::ERROR ("Unable to commit db session");
-	}
+    if(!$resp->content) {
+        throw OpenSRF::EX::ERROR ("Unable to commit db session");
+    }
 
-	$session->finish();
-	$session->disconnect();
-	$session->kill_me();
+    $session->finish();
+    $session->disconnect();
+    $session->kill_me();
 }
 
 sub rollback_db_session {
-	my( $self, $session ) = @_;
+    my( $self, $session ) = @_;
 
-	my $req = $session->request("open-ils.storage.transaction.rollback");
-	my $resp = $req->recv();
-	if(UNIVERSAL::isa($resp,"Error")) { throw $resp;  }
+    my $req = $session->request("open-ils.storage.transaction.rollback");
+    my $resp = $req->recv();
+    if(UNIVERSAL::isa($resp,"Error")) { throw $resp;  }
 
-	$session->finish();
-	$session->disconnect();
-	$session->kill_me();
+    $session->finish();
+    $session->disconnect();
+    $session->kill_me();
 }
 
 
 # returns undef it the event is not an ILS event
 # returns the event code otherwise
 sub event_code {
-	my( $self, $evt ) = @_;
-	return $evt->{ilsevent} if $self->is_event($evt);
-	return undef;
+    my( $self, $evt ) = @_;
+    return $evt->{ilsevent} if $self->is_event($evt);
+    return undef;
 }
 
 # some events, in particular auto-generated events, don't have an 
 # ilsevent key.  treat hashes with a 'textcode' key as events.
 sub is_event {
-	my ($self, $evt) = @_;
-	return (
-		ref($evt) eq 'HASH' and (
-			defined $evt->{ilsevent} or
-			defined $evt->{textcode}
-		)
-	);
+    my ($self, $evt) = @_;
+    return (
+        ref($evt) eq 'HASH' and (
+            defined $evt->{ilsevent} or
+            defined $evt->{textcode}
+        )
+    );
 }
 
 # ---------------------------------------------------------------------------
@@ -161,111 +161,111 @@ sub is_event {
 # throws an exception on error.
 # ---------------------------------------------------------------------------
 sub check_user_session {
-	my( $self, $user_session ) = @_;
+    my( $self, $user_session ) = @_;
 
-	my $content = $self->simplereq( 
-		'open-ils.auth', 
-		'open-ils.auth.session.retrieve', $user_session);
+    my $content = $self->simplereq( 
+        'open-ils.auth', 
+        'open-ils.auth.session.retrieve', $user_session);
 
     return undef if (!$content) or $self->event_code($content);
-	return $content;
+    return $content;
 }
 
 # generic simple request returning a scalar value
 sub simplereq {
-	my($self, $service, $method, @params) = @_;
-	return $self->simple_scalar_request($service, $method, @params);
+    my($self, $service, $method, @params) = @_;
+    return $self->simple_scalar_request($service, $method, @params);
 }
 
 
 sub simple_scalar_request {
-	my($self, $service, $method, @params) = @_;
+    my($self, $service, $method, @params) = @_;
 
-	my $session = OpenSRF::AppSession->create( $service );
+    my $session = OpenSRF::AppSession->create( $service );
 
-	my $request = $session->request( $method, @params );
+    my $request = $session->request( $method, @params );
 
-	my $val;
-	my $err;
-	try  {
+    my $val;
+    my $err;
+    try  {
 
-		$val = $request->gather(1);	
+        $val = $request->gather(1); 
 
-	} catch Error with {
-		$err = shift;
-	};
+    } catch Error with {
+        $err = shift;
+    };
 
-	if( $err ) {
-		warn "received error : service=$service : method=$method : params=".Dumper(\@params) . "\n $err";
-		throw $err ("Call to $service for method $method \n failed with exception: $err : " );
-	}
+    if( $err ) {
+        warn "received error : service=$service : method=$method : params=".Dumper(\@params) . "\n $err";
+        throw $err ("Call to $service for method $method \n failed with exception: $err : " );
+    }
 
-	return $val;
+    return $val;
 }
 
 sub build_org_tree {
-	my( $self, $orglist ) = @_;
+    my( $self, $orglist ) = @_;
 
-	return $orglist unless ref $orglist; 
+    return $orglist unless ref $orglist; 
     return $$orglist[0] if @$orglist == 1;
 
-	my @list = sort { 
-		$a->ou_type <=> $b->ou_type ||
-		$a->name cmp $b->name } @$orglist;
+    my @list = sort { 
+        $a->ou_type <=> $b->ou_type ||
+        $a->name cmp $b->name } @$orglist;
 
-	for my $org (@list) {
+    for my $org (@list) {
 
-		next unless ($org);
+        next unless ($org);
         next if (!defined($org->parent_ou) || $org->parent_ou eq "");
 
-		my ($parent) = grep { $_->id == $org->parent_ou } @list;
-		next unless $parent;
-		$parent->children([]) unless defined($parent->children); 
-		push( @{$parent->children}, $org );
-	}
+        my ($parent) = grep { $_->id == $org->parent_ou } @list;
+        next unless $parent;
+        $parent->children([]) unless defined($parent->children); 
+        push( @{$parent->children}, $org );
+    }
 
-	return $list[0];
+    return $list[0];
 }
 
 sub fetch_closed_date {
-	my( $self, $cd ) = @_;
-	my $evt;
-	
-	$logger->debug("Fetching closed_date $cd from cstore");
+    my( $self, $cd ) = @_;
+    my $evt;
+    
+    $logger->debug("Fetching closed_date $cd from cstore");
 
-	my $cd_obj = $self->simplereq(
-		'open-ils.cstore',
-		'open-ils.cstore.direct.actor.org_unit.closed_date.retrieve', $cd );
+    my $cd_obj = $self->simplereq(
+        'open-ils.cstore',
+        'open-ils.cstore.direct.actor.org_unit.closed_date.retrieve', $cd );
 
-	if(!$cd_obj) {
-		$logger->info("closed_date $cd not found in the db");
-		$evt = OpenILS::Event->new('ACTOR_USER_NOT_FOUND');
-	}
+    if(!$cd_obj) {
+        $logger->info("closed_date $cd not found in the db");
+        $evt = OpenILS::Event->new('ACTOR_USER_NOT_FOUND');
+    }
 
-	return ($cd_obj, $evt);
+    return ($cd_obj, $evt);
 }
 
 sub fetch_user {
-	my( $self, $userid ) = @_;
-	my( $user, $evt );
-	
-	$logger->debug("Fetching user $userid from cstore");
+    my( $self, $userid ) = @_;
+    my( $user, $evt );
+    
+    $logger->debug("Fetching user $userid from cstore");
 
-	$user = $self->simplereq(
-		'open-ils.cstore',
-		'open-ils.cstore.direct.actor.user.retrieve', $userid );
+    $user = $self->simplereq(
+        'open-ils.cstore',
+        'open-ils.cstore.direct.actor.user.retrieve', $userid );
 
-	if(!$user) {
-		$logger->info("User $userid not found in the db");
-		$evt = OpenILS::Event->new('ACTOR_USER_NOT_FOUND');
-	}
+    if(!$user) {
+        $logger->info("User $userid not found in the db");
+        $evt = OpenILS::Event->new('ACTOR_USER_NOT_FOUND');
+    }
 
-	return ($user, $evt);
+    return ($user, $evt);
 }
 
 sub checkses {
-	my( $self, $session ) = @_;
-	my $user = $self->check_user_session($session) or 
+    my( $self, $session ) = @_;
+    my $user = $self->check_user_session($session) or 
         return (undef, OpenILS::Event->new('NO_SESSION'));
     return ($user);
 }
@@ -274,207 +274,207 @@ sub checkses {
 # verifiese the session and checks the permissions agains the
 # session user and the user's home_ou as the org id
 sub checksesperm {
-	my( $self, $session, @perms ) = @_;
-	my $user; my $evt; my $e; 
-	$logger->debug("Checking user session $session and perms @perms");
-	($user, $evt) = $self->checkses($session);
-	return (undef, $evt) if $evt;
-	$evt = $self->check_perms($user->id, $user->home_ou, @perms);
-	return ($user, $evt);
+    my( $self, $session, @perms ) = @_;
+    my $user; my $evt; my $e; 
+    $logger->debug("Checking user session $session and perms @perms");
+    ($user, $evt) = $self->checkses($session);
+    return (undef, $evt) if $evt;
+    $evt = $self->check_perms($user->id, $user->home_ou, @perms);
+    return ($user, $evt);
 }
 
 
 sub checkrequestor {
-	my( $self, $staffobj, $userid, @perms ) = @_;
-	my $user; my $evt;
-	$userid = $staffobj->id unless defined $userid;
+    my( $self, $staffobj, $userid, @perms ) = @_;
+    my $user; my $evt;
+    $userid = $staffobj->id unless defined $userid;
 
-	$logger->debug("checkrequestor(): requestor => " . $staffobj->id . ", target => $userid");
+    $logger->debug("checkrequestor(): requestor => " . $staffobj->id . ", target => $userid");
 
-	if( $userid ne $staffobj->id ) {
-		($user, $evt) = $self->fetch_user($userid);
-		return (undef, $evt) if $evt;
-		$evt = $self->check_perms( $staffobj->id, $user->home_ou, @perms );
+    if( $userid ne $staffobj->id ) {
+        ($user, $evt) = $self->fetch_user($userid);
+        return (undef, $evt) if $evt;
+        $evt = $self->check_perms( $staffobj->id, $user->home_ou, @perms );
 
-	} else {
-		$user = $staffobj;
-	}
+    } else {
+        $user = $staffobj;
+    }
 
-	return ($user, $evt);
+    return ($user, $evt);
 }
 
 sub checkses_requestor {
-	my( $self, $authtoken, $targetid, @perms ) = @_;
-	my( $requestor, $target, $evt );
+    my( $self, $authtoken, $targetid, @perms ) = @_;
+    my( $requestor, $target, $evt );
 
-	($requestor, $evt) = $self->checkses($authtoken);
-	return (undef, undef, $evt) if $evt;
+    ($requestor, $evt) = $self->checkses($authtoken);
+    return (undef, undef, $evt) if $evt;
 
-	($target, $evt) = $self->checkrequestor( $requestor, $targetid, @perms );
-	return( $requestor, $target, $evt);
+    ($target, $evt) = $self->checkrequestor( $requestor, $targetid, @perms );
+    return( $requestor, $target, $evt);
 }
 
 sub fetch_copy {
-	my( $self, $copyid ) = @_;
-	my( $copy, $evt );
+    my( $self, $copyid ) = @_;
+    my( $copy, $evt );
 
-	$logger->debug("Fetching copy $copyid from cstore");
+    $logger->debug("Fetching copy $copyid from cstore");
 
-	$copy = $self->simplereq(
-		'open-ils.cstore',
-		'open-ils.cstore.direct.asset.copy.retrieve', $copyid );
+    $copy = $self->simplereq(
+        'open-ils.cstore',
+        'open-ils.cstore.direct.asset.copy.retrieve', $copyid );
 
-	if(!$copy) { $evt = OpenILS::Event->new('ASSET_COPY_NOT_FOUND'); }
+    if(!$copy) { $evt = OpenILS::Event->new('ASSET_COPY_NOT_FOUND'); }
 
-	return( $copy, $evt );
+    return( $copy, $evt );
 }
 
 
 # retrieves a circ object by id
 sub fetch_circulation {
-	my( $self, $circid ) = @_;
-	my $circ; my $evt;
-	
-	$logger->debug("Fetching circ $circid from cstore");
+    my( $self, $circid ) = @_;
+    my $circ; my $evt;
+    
+    $logger->debug("Fetching circ $circid from cstore");
 
-	$circ = $self->simplereq(
-		'open-ils.cstore',
-		"open-ils.cstore.direct.action.circulation.retrieve", $circid );
+    $circ = $self->simplereq(
+        'open-ils.cstore',
+        "open-ils.cstore.direct.action.circulation.retrieve", $circid );
 
-	if(!$circ) {
-		$evt = OpenILS::Event->new('ACTION_CIRCULATION_NOT_FOUND', circid => $circid );
-	}
+    if(!$circ) {
+        $evt = OpenILS::Event->new('ACTION_CIRCULATION_NOT_FOUND', circid => $circid );
+    }
 
-	return ( $circ, $evt );
+    return ( $circ, $evt );
 }
 
 sub fetch_record_by_copy {
-	my( $self, $copyid ) = @_;
-	my( $record, $evt );
-
-	$logger->debug("Fetching record by copy $copyid from cstore");
-
-	$record = $self->simplereq(
-		'open-ils.cstore',
-		'open-ils.cstore.direct.asset.copy.retrieve', $copyid,
-		{ flesh => 3,
-		  flesh_fields => {	bre => [ 'fixed_fields' ],
-					acn => [ 'record' ],
-					acp => [ 'call_number' ],
-				  }
-		}
-	);
+    my( $self, $copyid ) = @_;
+    my( $record, $evt );
+
+    $logger->debug("Fetching record by copy $copyid from cstore");
+
+    $record = $self->simplereq(
+        'open-ils.cstore',
+        'open-ils.cstore.direct.asset.copy.retrieve', $copyid,
+        { flesh => 3,
+          flesh_fields => { bre => [ 'fixed_fields' ],
+                    acn => [ 'record' ],
+                    acp => [ 'call_number' ],
+                  }
+        }
+    );
 
-	if(!$record) {
-		$evt = OpenILS::Event->new('BIBLIO_RECORD_ENTRY_NOT_FOUND');
-	} else {
-		$record = $record->call_number->record;
-	}
+    if(!$record) {
+        $evt = OpenILS::Event->new('BIBLIO_RECORD_ENTRY_NOT_FOUND');
+    } else {
+        $record = $record->call_number->record;
+    }
 
-	return ($record, $evt);
+    return ($record, $evt);
 }
 
 # turns a record object into an mvr (mods) object
 sub record_to_mvr {
-	my( $self, $record ) = @_;
-	return undef unless $record and $record->marc;
-	my $u = OpenILS::Utils::ModsParser->new();
-	$u->start_mods_batch( $record->marc );
-	my $mods = $u->finish_mods_batch();
-	$mods->doc_id($record->id);
+    my( $self, $record ) = @_;
+    return undef unless $record and $record->marc;
+    my $u = OpenILS::Utils::ModsParser->new();
+    $u->start_mods_batch( $record->marc );
+    my $mods = $u->finish_mods_batch();
+    $mods->doc_id($record->id);
    $mods->tcn($record->tcn_value);
-	return $mods;
+    return $mods;
 }
 
 sub fetch_hold {
-	my( $self, $holdid ) = @_;
-	my( $hold, $evt );
+    my( $self, $holdid ) = @_;
+    my( $hold, $evt );
 
-	$logger->debug("Fetching hold $holdid from cstore");
+    $logger->debug("Fetching hold $holdid from cstore");
 
-	$hold = $self->simplereq(
-		'open-ils.cstore',
-		'open-ils.cstore.direct.action.hold_request.retrieve', $holdid);
+    $hold = $self->simplereq(
+        'open-ils.cstore',
+        'open-ils.cstore.direct.action.hold_request.retrieve', $holdid);
 
-	$evt = OpenILS::Event->new('ACTION_HOLD_REQUEST_NOT_FOUND', holdid => $holdid) unless $hold;
+    $evt = OpenILS::Event->new('ACTION_HOLD_REQUEST_NOT_FOUND', holdid => $holdid) unless $hold;
 
-	return ($hold, $evt);
+    return ($hold, $evt);
 }
 
 
 sub fetch_hold_transit_by_hold {
-	my( $self, $holdid ) = @_;
-	my( $transit, $evt );
+    my( $self, $holdid ) = @_;
+    my( $transit, $evt );
 
-	$logger->debug("Fetching transit by hold $holdid from cstore");
+    $logger->debug("Fetching transit by hold $holdid from cstore");
 
-	$transit = $self->simplereq(
-		'open-ils.cstore',
-		'open-ils.cstore.direct.action.hold_transit_copy.search', { hold => $holdid } );
+    $transit = $self->simplereq(
+        'open-ils.cstore',
+        'open-ils.cstore.direct.action.hold_transit_copy.search', { hold => $holdid } );
 
-	$evt = OpenILS::Event->new('ACTION_HOLD_TRANSIT_COPY_NOT_FOUND', holdid => $holdid) unless $transit;
+    $evt = OpenILS::Event->new('ACTION_HOLD_TRANSIT_COPY_NOT_FOUND', holdid => $holdid) unless $transit;
 
-	return ($transit, $evt );
+    return ($transit, $evt );
 }
 
 # fetches the captured, but not fulfilled hold attached to a given copy
 sub fetch_open_hold_by_copy {
-	my( $self, $copyid ) = @_;
-	$logger->debug("Searching for active hold for copy $copyid");
-	my( $hold, $evt );
+    my( $self, $copyid ) = @_;
+    $logger->debug("Searching for active hold for copy $copyid");
+    my( $hold, $evt );
 
-	$hold = $self->cstorereq(
-		'open-ils.cstore.direct.action.hold_request.search',
-		{ 
-			current_copy		=> $copyid , 
-			capture_time		=> { "!=" => undef }, 
-			fulfillment_time	=> undef,
-			cancel_time			=> undef,
-		} );
+    $hold = $self->cstorereq(
+        'open-ils.cstore.direct.action.hold_request.search',
+        { 
+            current_copy        => $copyid , 
+            capture_time        => { "!=" => undef }, 
+            fulfillment_time    => undef,
+            cancel_time         => undef,
+        } );
 
-	$evt = OpenILS::Event->new('ACTION_HOLD_REQUEST_NOT_FOUND', copyid => $copyid) unless $hold;
-	return ($hold, $evt);
+    $evt = OpenILS::Event->new('ACTION_HOLD_REQUEST_NOT_FOUND', copyid => $copyid) unless $hold;
+    return ($hold, $evt);
 }
 
 sub fetch_hold_transit {
-	my( $self, $transid ) = @_;
-	my( $htransit, $evt );
-	$logger->debug("Fetching hold transit with hold id $transid");
-	$htransit = $self->cstorereq(
-		'open-ils.cstore.direct.action.hold_transit_copy.retrieve', $transid );
-	$evt = OpenILS::Event->new('ACTION_HOLD_TRANSIT_COPY_NOT_FOUND', id => $transid) unless $htransit;
-	return ($htransit, $evt);
+    my( $self, $transid ) = @_;
+    my( $htransit, $evt );
+    $logger->debug("Fetching hold transit with hold id $transid");
+    $htransit = $self->cstorereq(
+        'open-ils.cstore.direct.action.hold_transit_copy.retrieve', $transid );
+    $evt = OpenILS::Event->new('ACTION_HOLD_TRANSIT_COPY_NOT_FOUND', id => $transid) unless $htransit;
+    return ($htransit, $evt);
 }
 
 sub fetch_copy_by_barcode {
-	my( $self, $barcode ) = @_;
-	my( $copy, $evt );
+    my( $self, $barcode ) = @_;
+    my( $copy, $evt );
 
-	$logger->debug("Fetching copy by barcode $barcode from cstore");
+    $logger->debug("Fetching copy by barcode $barcode from cstore");
 
-	$copy = $self->simplereq( 'open-ils.cstore',
-		'open-ils.cstore.direct.asset.copy.search', { barcode => $barcode, deleted => 'f'} );
-		#'open-ils.storage.direct.asset.copy.search.barcode', $barcode );
+    $copy = $self->simplereq( 'open-ils.cstore',
+        'open-ils.cstore.direct.asset.copy.search', { barcode => $barcode, deleted => 'f'} );
+        #'open-ils.storage.direct.asset.copy.search.barcode', $barcode );
 
-	$evt = OpenILS::Event->new('ASSET_COPY_NOT_FOUND', barcode => $barcode) unless $copy;
+    $evt = OpenILS::Event->new('ASSET_COPY_NOT_FOUND', barcode => $barcode) unless $copy;
 
-	return ($copy, $evt);
+    return ($copy, $evt);
 }
 
 sub fetch_open_billable_transaction {
-	my( $self, $transid ) = @_;
-	my( $transaction, $evt );
+    my( $self, $transid ) = @_;
+    my( $transaction, $evt );
 
-	$logger->debug("Fetching open billable transaction $transid from cstore");
+    $logger->debug("Fetching open billable transaction $transid from cstore");
 
-	$transaction = $self->simplereq(
-		'open-ils.cstore',
-		'open-ils.cstore.direct.money.open_billable_transaction_summary.retrieve',  $transid);
+    $transaction = $self->simplereq(
+        'open-ils.cstore',
+        'open-ils.cstore.direct.money.open_billable_transaction_summary.retrieve',  $transid);
 
-	$evt = OpenILS::Event->new(
-		'MONEY_OPEN_BILLABLE_TRANSACTION_SUMMARY_NOT_FOUND', transid => $transid ) unless $transaction;
+    $evt = OpenILS::Event->new(
+        'MONEY_OPEN_BILLABLE_TRANSACTION_SUMMARY_NOT_FOUND', transid => $transid ) unless $transaction;
 
-	return ($transaction, $evt);
+    return ($transaction, $evt);
 }
 
 
@@ -486,52 +486,52 @@ $buckets{'copy'} = 'copy_bucket';
 $buckets{'user'} = 'user_bucket';
 
 sub fetch_container {
-	my( $self, $id, $type ) = @_;
-	my( $bucket, $evt );
+    my( $self, $id, $type ) = @_;
+    my( $bucket, $evt );
 
-	$logger->debug("Fetching container $id with type $type");
+    $logger->debug("Fetching container $id with type $type");
 
-	my $e = 'CONTAINER_CALL_NUMBER_BUCKET_NOT_FOUND';
-	$e = 'CONTAINER_BIBLIO_RECORD_ENTRY_BUCKET_NOT_FOUND' if $type eq 'biblio';
-	$e = 'CONTAINER_USER_BUCKET_NOT_FOUND' if $type eq 'user';
-	$e = 'CONTAINER_COPY_BUCKET_NOT_FOUND' if $type eq 'copy';
+    my $e = 'CONTAINER_CALL_NUMBER_BUCKET_NOT_FOUND';
+    $e = 'CONTAINER_BIBLIO_RECORD_ENTRY_BUCKET_NOT_FOUND' if $type eq 'biblio';
+    $e = 'CONTAINER_USER_BUCKET_NOT_FOUND' if $type eq 'user';
+    $e = 'CONTAINER_COPY_BUCKET_NOT_FOUND' if $type eq 'copy';
 
-	my $meth = $buckets{$type};
-	$bucket = $self->simplereq(
-		'open-ils.cstore',
-		"open-ils.cstore.direct.container.$meth.retrieve", $id );
+    my $meth = $buckets{$type};
+    $bucket = $self->simplereq(
+        'open-ils.cstore',
+        "open-ils.cstore.direct.container.$meth.retrieve", $id );
 
-	$evt = OpenILS::Event->new(
-		$e, container => $id, container_type => $type ) unless $bucket;
+    $evt = OpenILS::Event->new(
+        $e, container => $id, container_type => $type ) unless $bucket;
 
-	return ($bucket, $evt);
+    return ($bucket, $evt);
 }
 
 
 sub fetch_container_e {
-	my( $self, $editor, $id, $type ) = @_;
+    my( $self, $editor, $id, $type ) = @_;
 
-	my( $bucket, $evt );
-	$bucket = $editor->retrieve_container_copy_bucket($id) if $type eq 'copy';
-	$bucket = $editor->retrieve_container_call_number_bucket($id) if $type eq 'callnumber';
-	$bucket = $editor->retrieve_container_biblio_record_entry_bucket($id) if $type eq 'biblio';
-	$bucket = $editor->retrieve_container_user_bucket($id) if $type eq 'user';
+    my( $bucket, $evt );
+    $bucket = $editor->retrieve_container_copy_bucket($id) if $type eq 'copy';
+    $bucket = $editor->retrieve_container_call_number_bucket($id) if $type eq 'callnumber';
+    $bucket = $editor->retrieve_container_biblio_record_entry_bucket($id) if $type eq 'biblio';
+    $bucket = $editor->retrieve_container_user_bucket($id) if $type eq 'user';
 
-	$evt = $editor->event unless $bucket;
-	return ($bucket, $evt);
+    $evt = $editor->event unless $bucket;
+    return ($bucket, $evt);
 }
 
 sub fetch_container_item_e {
-	my( $self, $editor, $id, $type ) = @_;
+    my( $self, $editor, $id, $type ) = @_;
 
-	my( $bucket, $evt );
-	$bucket = $editor->retrieve_container_copy_bucket_item($id) if $type eq 'copy';
-	$bucket = $editor->retrieve_container_call_number_bucket_item($id) if $type eq 'callnumber';
-	$bucket = $editor->retrieve_container_biblio_record_entry_bucket_item($id) if $type eq 'biblio';
-	$bucket = $editor->retrieve_container_user_bucket_item($id) if $type eq 'user';
+    my( $bucket, $evt );
+    $bucket = $editor->retrieve_container_copy_bucket_item($id) if $type eq 'copy';
+    $bucket = $editor->retrieve_container_call_number_bucket_item($id) if $type eq 'callnumber';
+    $bucket = $editor->retrieve_container_biblio_record_entry_bucket_item($id) if $type eq 'biblio';
+    $bucket = $editor->retrieve_container_user_bucket_item($id) if $type eq 'user';
 
-	$evt = $editor->event unless $bucket;
-	return ($bucket, $evt);
+    $evt = $editor->event unless $bucket;
+    return ($bucket, $evt);
 }
 
 
@@ -539,45 +539,45 @@ sub fetch_container_item_e {
 
 
 sub fetch_container_item {
-	my( $self, $id, $type ) = @_;
-	my( $bucket, $evt );
+    my( $self, $id, $type ) = @_;
+    my( $bucket, $evt );
 
-	$logger->debug("Fetching container item $id with type $type");
+    $logger->debug("Fetching container item $id with type $type");
 
-	my $meth = $buckets{$type} . "_item";
+    my $meth = $buckets{$type} . "_item";
 
-	$bucket = $self->simplereq(
-		'open-ils.cstore',
-		"open-ils.cstore.direct.container.$meth.retrieve", $id );
+    $bucket = $self->simplereq(
+        'open-ils.cstore',
+        "open-ils.cstore.direct.container.$meth.retrieve", $id );
 
 
-	my $e = 'CONTAINER_CALL_NUMBER_BUCKET_ITEM_NOT_FOUND';
-	$e = 'CONTAINER_BIBLIO_RECORD_ENTRY_BUCKET_ITEM_NOT_FOUND' if $type eq 'biblio';
-	$e = 'CONTAINER_USER_BUCKET_ITEM_NOT_FOUND' if $type eq 'user';
-	$e = 'CONTAINER_COPY_BUCKET_ITEM_NOT_FOUND' if $type eq 'copy';
+    my $e = 'CONTAINER_CALL_NUMBER_BUCKET_ITEM_NOT_FOUND';
+    $e = 'CONTAINER_BIBLIO_RECORD_ENTRY_BUCKET_ITEM_NOT_FOUND' if $type eq 'biblio';
+    $e = 'CONTAINER_USER_BUCKET_ITEM_NOT_FOUND' if $type eq 'user';
+    $e = 'CONTAINER_COPY_BUCKET_ITEM_NOT_FOUND' if $type eq 'copy';
 
-	$evt = OpenILS::Event->new(
-		$e, itemid => $id, container_type => $type ) unless $bucket;
+    $evt = OpenILS::Event->new(
+        $e, itemid => $id, container_type => $type ) unless $bucket;
 
-	return ($bucket, $evt);
+    return ($bucket, $evt);
 }
 
 
 sub fetch_patron_standings {
-	my $self = shift;
-	$logger->debug("Fetching patron standings");	
-	return $self->simplereq(
-		'open-ils.cstore', 
-		'open-ils.cstore.direct.config.standing.search.atomic', { id => { '!=' => undef } });
+    my $self = shift;
+    $logger->debug("Fetching patron standings");    
+    return $self->simplereq(
+        'open-ils.cstore', 
+        'open-ils.cstore.direct.config.standing.search.atomic', { id => { '!=' => undef } });
 }
 
 
 sub fetch_permission_group_tree {
-	my $self = shift;
-	$logger->debug("Fetching patron profiles");	
-	return $self->simplereq(
-		'open-ils.actor', 
-		'open-ils.actor.groups.tree.retrieve' );
+    my $self = shift;
+    $logger->debug("Fetching patron profiles"); 
+    return $self->simplereq(
+        'open-ils.actor', 
+        'open-ils.actor.groups.tree.retrieve' );
 }
 
 sub fetch_permission_group_descendants {
@@ -603,119 +603,119 @@ sub fetch_permission_group_descendants {
 }
 
 sub fetch_patron_circ_summary {
-	my( $self, $userid ) = @_;
-	$logger->debug("Fetching patron summary for $userid");
-	my $summary = $self->simplereq(
-		'open-ils.storage', 
-		"open-ils.storage.action.circulation.patron_summary", $userid );
-
-	if( $summary ) {
-		$summary->[0] ||= 0;
-		$summary->[1] ||= 0.0;
-		return $summary;
-	}
-	return undef;
+    my( $self, $userid ) = @_;
+    $logger->debug("Fetching patron summary for $userid");
+    my $summary = $self->simplereq(
+        'open-ils.storage', 
+        "open-ils.storage.action.circulation.patron_summary", $userid );
+
+    if( $summary ) {
+        $summary->[0] ||= 0;
+        $summary->[1] ||= 0.0;
+        return $summary;
+    }
+    return undef;
 }
 
 
 sub fetch_copy_statuses {
-	my( $self ) = @_;
-	$logger->debug("Fetching copy statuses");
-	return $self->simplereq(
-		'open-ils.cstore', 
-		'open-ils.cstore.direct.config.copy_status.search.atomic', { id => { '!=' => undef } });
+    my( $self ) = @_;
+    $logger->debug("Fetching copy statuses");
+    return $self->simplereq(
+        'open-ils.cstore', 
+        'open-ils.cstore.direct.config.copy_status.search.atomic', { id => { '!=' => undef } });
 }
 
 sub fetch_copy_location {
-	my( $self, $id ) = @_;
-	my $evt;
-	my $cl = $self->cstorereq(
-		'open-ils.cstore.direct.asset.copy_location.retrieve', $id );
-	$evt = OpenILS::Event->new('ASSET_COPY_LOCATION_NOT_FOUND') unless $cl;
-	return ($cl, $evt);
+    my( $self, $id ) = @_;
+    my $evt;
+    my $cl = $self->cstorereq(
+        'open-ils.cstore.direct.asset.copy_location.retrieve', $id );
+    $evt = OpenILS::Event->new('ASSET_COPY_LOCATION_NOT_FOUND') unless $cl;
+    return ($cl, $evt);
 }
 
 sub fetch_copy_locations {
-	my $self = shift; 
-	return $self->simplereq(
-		'open-ils.cstore', 
-		'open-ils.cstore.direct.asset.copy_location.search.atomic', { id => { '!=' => undef } });
+    my $self = shift; 
+    return $self->simplereq(
+        'open-ils.cstore', 
+        'open-ils.cstore.direct.asset.copy_location.search.atomic', { id => { '!=' => undef } });
 }
 
 sub fetch_copy_location_by_name {
-	my( $self, $name, $org ) = @_;
-	my $evt;
-	my $cl = $self->cstorereq(
-		'open-ils.cstore.direct.asset.copy_location.search',
-			{ name => $name, owning_lib => $org } );
-	$evt = OpenILS::Event->new('ASSET_COPY_LOCATION_NOT_FOUND') unless $cl;
-	return ($cl, $evt);
+    my( $self, $name, $org ) = @_;
+    my $evt;
+    my $cl = $self->cstorereq(
+        'open-ils.cstore.direct.asset.copy_location.search',
+            { name => $name, owning_lib => $org } );
+    $evt = OpenILS::Event->new('ASSET_COPY_LOCATION_NOT_FOUND') unless $cl;
+    return ($cl, $evt);
 }
 
 sub fetch_callnumber {
-	my( $self, $id, $flesh, $e ) = @_;
+    my( $self, $id, $flesh, $e ) = @_;
 
-	$e ||= OpenILS::Utils::CStoreEditor->new;
+    $e ||= OpenILS::Utils::CStoreEditor->new;
 
-	my $evt = OpenILS::Event->new( 'ASSET_CALL_NUMBER_NOT_FOUND', id => $id );
-	return( undef, $evt ) unless $id;
+    my $evt = OpenILS::Event->new( 'ASSET_CALL_NUMBER_NOT_FOUND', id => $id );
+    return( undef, $evt ) unless $id;
 
-	$logger->debug("Fetching callnumber $id");
+    $logger->debug("Fetching callnumber $id");
 
     my $cn = $e->retrieve_asset_call_number([
         $id,
         { flesh => $flesh, flesh_fields => { acn => [ 'prefix', 'suffix', 'label_class' ] } },
     ]);
 
-	return ( $cn, $e->event );
+    return ( $cn, $e->event );
 }
 
 my %ORG_CACHE; # - these rarely change, so cache them..
 sub fetch_org_unit {
-	my( $self, $id ) = @_;
-	return undef unless $id;
-	return $id if( ref($id) eq 'Fieldmapper::actor::org_unit' );
-	return $ORG_CACHE{$id} if $ORG_CACHE{$id};
-	$logger->debug("Fetching org unit $id");
-	my $evt = undef;
-
-	my $org = $self->simplereq(
-		'open-ils.cstore', 
-		'open-ils.cstore.direct.actor.org_unit.retrieve', $id );
-	$evt = OpenILS::Event->new( 'ACTOR_ORG_UNIT_NOT_FOUND', id => $id ) unless $org;
-	$ORG_CACHE{$id}  = $org;
+    my( $self, $id ) = @_;
+    return undef unless $id;
+    return $id if( ref($id) eq 'Fieldmapper::actor::org_unit' );
+    return $ORG_CACHE{$id} if $ORG_CACHE{$id};
+    $logger->debug("Fetching org unit $id");
+    my $evt = undef;
+
+    my $org = $self->simplereq(
+        'open-ils.cstore', 
+        'open-ils.cstore.direct.actor.org_unit.retrieve', $id );
+    $evt = OpenILS::Event->new( 'ACTOR_ORG_UNIT_NOT_FOUND', id => $id ) unless $org;
+    $ORG_CACHE{$id}  = $org;
 
-	return ($org, $evt);
+    return ($org, $evt);
 }
 
 sub fetch_stat_cat {
-	my( $self, $type, $id ) = @_;
-	my( $cat, $evt );
-	$logger->debug("Fetching $type stat cat: $id");
-	$cat = $self->simplereq(
-		'open-ils.cstore', 
-		"open-ils.cstore.direct.$type.stat_cat.retrieve", $id );
+    my( $self, $type, $id ) = @_;
+    my( $cat, $evt );
+    $logger->debug("Fetching $type stat cat: $id");
+    $cat = $self->simplereq(
+        'open-ils.cstore', 
+        "open-ils.cstore.direct.$type.stat_cat.retrieve", $id );
 
-	my $e = 'ASSET_STAT_CAT_NOT_FOUND';
-	$e = 'ACTOR_STAT_CAT_NOT_FOUND' if $type eq 'actor';
+    my $e = 'ASSET_STAT_CAT_NOT_FOUND';
+    $e = 'ACTOR_STAT_CAT_NOT_FOUND' if $type eq 'actor';
 
-	$evt = OpenILS::Event->new( $e, id => $id ) unless $cat;
-	return ( $cat, $evt );
+    $evt = OpenILS::Event->new( $e, id => $id ) unless $cat;
+    return ( $cat, $evt );
 }
 
 sub fetch_stat_cat_entry {
-	my( $self, $type, $id ) = @_;
-	my( $entry, $evt );
-	$logger->debug("Fetching $type stat cat entry: $id");
-	$entry = $self->simplereq(
-		'open-ils.cstore', 
-		"open-ils.cstore.direct.$type.stat_cat_entry.retrieve", $id );
+    my( $self, $type, $id ) = @_;
+    my( $entry, $evt );
+    $logger->debug("Fetching $type stat cat entry: $id");
+    $entry = $self->simplereq(
+        'open-ils.cstore', 
+        "open-ils.cstore.direct.$type.stat_cat_entry.retrieve", $id );
 
-	my $e = 'ASSET_STAT_CAT_ENTRY_NOT_FOUND';
-	$e = 'ACTOR_STAT_CAT_ENTRY_NOT_FOUND' if $type eq 'actor';
+    my $e = 'ASSET_STAT_CAT_ENTRY_NOT_FOUND';
+    $e = 'ACTOR_STAT_CAT_ENTRY_NOT_FOUND' if $type eq 'actor';
 
-	$evt = OpenILS::Event->new( $e, id => $id ) unless $entry;
-	return ( $entry, $evt );
+    $evt = OpenILS::Event->new( $e, id => $id ) unless $entry;
+    return ( $entry, $evt );
 }
 
 sub fetch_stat_cat_entry_default {
@@ -751,190 +751,190 @@ sub fetch_stat_cat_entry_default_by_stat_cat_and_org {
 }
 
 sub find_org {
-	my( $self, $org_tree, $orgid )  = @_;
+    my( $self, $org_tree, $orgid )  = @_;
     return undef unless $org_tree and defined $orgid;
-	return $org_tree if ( $org_tree->id eq $orgid );
-	return undef unless ref($org_tree->children);
-	for my $c (@{$org_tree->children}) {
-		my $o = $self->find_org($c, $orgid);
-		return $o if $o;
-	}
-	return undef;
+    return $org_tree if ( $org_tree->id eq $orgid );
+    return undef unless ref($org_tree->children);
+    for my $c (@{$org_tree->children}) {
+        my $o = $self->find_org($c, $orgid);
+        return $o if $o;
+    }
+    return undef;
 }
 
 sub fetch_non_cat_type_by_name_and_org {
-	my( $self, $name, $orgId ) = @_;
-	$logger->debug("Fetching non cat type $name at org $orgId");
-	my $types = $self->simplereq(
-		'open-ils.cstore',
-		'open-ils.cstore.direct.config.non_cataloged_type.search.atomic',
-		{ name => $name, owning_lib => $orgId } );
-	return ($types->[0], undef) if($types and @$types);
-	return (undef, OpenILS::Event->new('CONFIG_NON_CATALOGED_TYPE_NOT_FOUND') );
+    my( $self, $name, $orgId ) = @_;
+    $logger->debug("Fetching non cat type $name at org $orgId");
+    my $types = $self->simplereq(
+        'open-ils.cstore',
+        'open-ils.cstore.direct.config.non_cataloged_type.search.atomic',
+        { name => $name, owning_lib => $orgId } );
+    return ($types->[0], undef) if($types and @$types);
+    return (undef, OpenILS::Event->new('CONFIG_NON_CATALOGED_TYPE_NOT_FOUND') );
 }
 
 sub fetch_non_cat_type {
-	my( $self, $id ) = @_;
-	$logger->debug("Fetching non cat type $id");
-	my( $type, $evt );
-	$type = $self->simplereq(
-		'open-ils.cstore', 
-		'open-ils.cstore.direct.config.non_cataloged_type.retrieve', $id );
-	$evt = OpenILS::Event->new('CONFIG_NON_CATALOGED_TYPE_NOT_FOUND') unless $type;
-	return ($type, $evt);
+    my( $self, $id ) = @_;
+    $logger->debug("Fetching non cat type $id");
+    my( $type, $evt );
+    $type = $self->simplereq(
+        'open-ils.cstore', 
+        'open-ils.cstore.direct.config.non_cataloged_type.retrieve', $id );
+    $evt = OpenILS::Event->new('CONFIG_NON_CATALOGED_TYPE_NOT_FOUND') unless $type;
+    return ($type, $evt);
 }
 
 sub DB_UPDATE_FAILED { 
-	my( $self, $payload ) = @_;
-	return OpenILS::Event->new('DATABASE_UPDATE_FAILED', 
-		payload => ($payload) ? $payload : undef ); 
+    my( $self, $payload ) = @_;
+    return OpenILS::Event->new('DATABASE_UPDATE_FAILED', 
+        payload => ($payload) ? $payload : undef ); 
 }
 
 sub fetch_booking_reservation {
-	my( $self, $id ) = @_;
-	my( $res, $evt );
-
-	$res = $self->simplereq(
-		'open-ils.cstore', 
-		'open-ils.cstore.direct.booking.reservation.retrieve', $id
-	);
-
-	# simplereq doesn't know how to flesh so ...
-	if ($res) {
-		$res->usr(
-			$self->simplereq(
-				'open-ils.cstore', 
-				'open-ils.cstore.direct.actor.user.retrieve', $res->usr
-			)
-		);
-
-		$res->target_resource_type(
-			$self->simplereq(
-				'open-ils.cstore', 
-				'open-ils.cstore.direct.booking.resource_type.retrieve', $res->target_resource_type
-			)
-		);
-
-		if ($res->current_resource) {
-			$res->current_resource(
-				$self->simplereq(
-					'open-ils.cstore', 
-					'open-ils.cstore.direct.booking.resource.retrieve', $res->current_resource
-				)
-			);
-
-			if ($self->is_true( $res->target_resource_type->catalog_item )) {
-				$res->current_resource->catalog_item( $self->fetch_copy_by_barcode( $res->current_resource->barcode ) );
-			}
-		}
-
-		if ($res->target_resource) {
-			$res->target_resource(
-				$self->simplereq(
-					'open-ils.cstore', 
-					'open-ils.cstore.direct.booking.resource.retrieve', $res->target_resource
-				)
-			);
-
-			if ($self->is_true( $res->target_resource_type->catalog_item )) {
-				$res->target_resource->catalog_item( $self->fetch_copy_by_barcode( $res->target_resource->barcode ) );
-			}
-		}
-
-	} else {
-		$evt = OpenILS::Event->new('RESERVATION_NOT_FOUND');
-	}
-
-	return ($res, $evt);
+    my( $self, $id ) = @_;
+    my( $res, $evt );
+
+    $res = $self->simplereq(
+        'open-ils.cstore', 
+        'open-ils.cstore.direct.booking.reservation.retrieve', $id
+    );
+
+    # simplereq doesn't know how to flesh so ...
+    if ($res) {
+        $res->usr(
+            $self->simplereq(
+                'open-ils.cstore', 
+                'open-ils.cstore.direct.actor.user.retrieve', $res->usr
+            )
+        );
+
+        $res->target_resource_type(
+            $self->simplereq(
+                'open-ils.cstore', 
+                'open-ils.cstore.direct.booking.resource_type.retrieve', $res->target_resource_type
+            )
+        );
+
+        if ($res->current_resource) {
+            $res->current_resource(
+                $self->simplereq(
+                    'open-ils.cstore', 
+                    'open-ils.cstore.direct.booking.resource.retrieve', $res->current_resource
+                )
+            );
+
+            if ($self->is_true( $res->target_resource_type->catalog_item )) {
+                $res->current_resource->catalog_item( $self->fetch_copy_by_barcode( $res->current_resource->barcode ) );
+            }
+        }
+
+        if ($res->target_resource) {
+            $res->target_resource(
+                $self->simplereq(
+                    'open-ils.cstore', 
+                    'open-ils.cstore.direct.booking.resource.retrieve', $res->target_resource
+                )
+            );
+
+            if ($self->is_true( $res->target_resource_type->catalog_item )) {
+                $res->target_resource->catalog_item( $self->fetch_copy_by_barcode( $res->target_resource->barcode ) );
+            }
+        }
+
+    } else {
+        $evt = OpenILS::Event->new('RESERVATION_NOT_FOUND');
+    }
+
+    return ($res, $evt);
 }
 
 sub fetch_circ_duration_by_name {
-	my( $self, $name ) = @_;
-	my( $dur, $evt );
-	$dur = $self->simplereq(
-		'open-ils.cstore', 
-		'open-ils.cstore.direct.config.rules.circ_duration.search.atomic', { name => $name } );
-	$dur = $dur->[0];
-	$evt = OpenILS::Event->new('CONFIG_RULES_CIRC_DURATION_NOT_FOUND') unless $dur;
-	return ($dur, $evt);
+    my( $self, $name ) = @_;
+    my( $dur, $evt );
+    $dur = $self->simplereq(
+        'open-ils.cstore', 
+        'open-ils.cstore.direct.config.rules.circ_duration.search.atomic', { name => $name } );
+    $dur = $dur->[0];
+    $evt = OpenILS::Event->new('CONFIG_RULES_CIRC_DURATION_NOT_FOUND') unless $dur;
+    return ($dur, $evt);
 }
 
 sub fetch_recurring_fine_by_name {
-	my( $self, $name ) = @_;
-	my( $obj, $evt );
-	$obj = $self->simplereq(
-		'open-ils.cstore', 
-		'open-ils.cstore.direct.config.rules.recurring_fine.search.atomic', { name => $name } );
-	$obj = $obj->[0];
-	$evt = OpenILS::Event->new('CONFIG_RULES_RECURRING_FINE_NOT_FOUND') unless $obj;
-	return ($obj, $evt);
+    my( $self, $name ) = @_;
+    my( $obj, $evt );
+    $obj = $self->simplereq(
+        'open-ils.cstore', 
+        'open-ils.cstore.direct.config.rules.recurring_fine.search.atomic', { name => $name } );
+    $obj = $obj->[0];
+    $evt = OpenILS::Event->new('CONFIG_RULES_RECURRING_FINE_NOT_FOUND') unless $obj;
+    return ($obj, $evt);
 }
 
 sub fetch_max_fine_by_name {
-	my( $self, $name ) = @_;
-	my( $obj, $evt );
-	$obj = $self->simplereq(
-		'open-ils.cstore', 
-		'open-ils.cstore.direct.config.rules.max_fine.search.atomic', { name => $name } );
-	$obj = $obj->[0];
-	$evt = OpenILS::Event->new('CONFIG_RULES_MAX_FINE_NOT_FOUND') unless $obj;
-	return ($obj, $evt);
+    my( $self, $name ) = @_;
+    my( $obj, $evt );
+    $obj = $self->simplereq(
+        'open-ils.cstore', 
+        'open-ils.cstore.direct.config.rules.max_fine.search.atomic', { name => $name } );
+    $obj = $obj->[0];
+    $evt = OpenILS::Event->new('CONFIG_RULES_MAX_FINE_NOT_FOUND') unless $obj;
+    return ($obj, $evt);
 }
 
 sub fetch_hard_due_date_by_name {
-	my( $self, $name ) = @_;
-	my( $obj, $evt );
-	$obj = $self->simplereq(
-		'open-ils.cstore', 
-		'open-ils.cstore.direct.config.hard_due_date.search.atomic', { name => $name } );
-	$obj = $obj->[0];
-	$evt = OpenILS::Event->new('CONFIG_RULES_HARD_DUE_DATE_NOT_FOUND') unless $obj;
-	return ($obj, $evt);
+    my( $self, $name ) = @_;
+    my( $obj, $evt );
+    $obj = $self->simplereq(
+        'open-ils.cstore', 
+        'open-ils.cstore.direct.config.hard_due_date.search.atomic', { name => $name } );
+    $obj = $obj->[0];
+    $evt = OpenILS::Event->new('CONFIG_RULES_HARD_DUE_DATE_NOT_FOUND') unless $obj;
+    return ($obj, $evt);
 }
 
 sub storagereq {
-	my( $self, $method, @params ) = @_;
-	return $self->simplereq(
-		'open-ils.storage', $method, @params );
+    my( $self, $method, @params ) = @_;
+    return $self->simplereq(
+        'open-ils.storage', $method, @params );
 }
 
 sub storagereq_xact {
-	my($self, $method, @params) = @_;
-	my $ses = $self->start_db_session();
-	my $val = $ses->request($method, @params)->gather(1);
-	$self->rollback_db_session($ses);
+    my($self, $method, @params) = @_;
+    my $ses = $self->start_db_session();
+    my $val = $ses->request($method, @params)->gather(1);
+    $self->rollback_db_session($ses);
     return $val;
 }
 
 sub cstorereq {
-	my( $self, $method, @params ) = @_;
-	return $self->simplereq(
-		'open-ils.cstore', $method, @params );
+    my( $self, $method, @params ) = @_;
+    return $self->simplereq(
+        'open-ils.cstore', $method, @params );
 }
 
 sub event_equals {
-	my( $self, $e, $name ) =  @_;
-	if( $e and ref($e) eq 'HASH' and 
-		defined($e->{textcode}) and $e->{textcode} eq $name ) {
-		return 1 ;
-	}
-	return 0;
+    my( $self, $e, $name ) =  @_;
+    if( $e and ref($e) eq 'HASH' and 
+        defined($e->{textcode}) and $e->{textcode} eq $name ) {
+        return 1 ;
+    }
+    return 0;
 }
 
 sub logmark {
-	my( undef, $f, $l ) = caller(0);
-	my( undef, undef, undef, $s ) = caller(1);
-	$s =~ s/.*:://g;
-	$f =~ s/.*\///g;
-	$logger->debug("LOGMARK: $f:$l:$s");
+    my( undef, $f, $l ) = caller(0);
+    my( undef, undef, undef, $s ) = caller(1);
+    $s =~ s/.*:://g;
+    $f =~ s/.*\///g;
+    $logger->debug("LOGMARK: $f:$l:$s");
 }
 
 # takes a copy id 
 sub fetch_open_circulation {
-	my( $self, $cid ) = @_;
-	$self->logmark;
+    my( $self, $cid ) = @_;
+    $self->logmark;
 
-	my $e = OpenILS::Utils::CStoreEditor->new;
+    my $e = OpenILS::Utils::CStoreEditor->new;
     my $circ = $e->search_action_circulation({
         target_copy => $cid, 
         stop_fines_time => undef, 
@@ -946,221 +946,221 @@ sub fetch_open_circulation {
 
 my $copy_statuses;
 sub copy_status_from_name {
-	my( $self, $name ) = @_;
-	$copy_statuses = $self->fetch_copy_statuses unless $copy_statuses;
-	for my $status (@$copy_statuses) { 
-		return $status if( $status->name =~ /$name/i );
-	}
-	return undef;
+    my( $self, $name ) = @_;
+    $copy_statuses = $self->fetch_copy_statuses unless $copy_statuses;
+    for my $status (@$copy_statuses) { 
+        return $status if( $status->name =~ /$name/i );
+    }
+    return undef;
 }
 
 sub copy_status_to_name {
-	my( $self, $sid ) = @_;
-	$copy_statuses = $self->fetch_copy_statuses unless $copy_statuses;
-	for my $status (@$copy_statuses) { 
-		return $status->name if( $status->id == $sid );
-	}
-	return undef;
+    my( $self, $sid ) = @_;
+    $copy_statuses = $self->fetch_copy_statuses unless $copy_statuses;
+    for my $status (@$copy_statuses) { 
+        return $status->name if( $status->id == $sid );
+    }
+    return undef;
 }
 
 
 sub copy_status {
-	my( $self, $arg ) = @_;
-	return $arg if ref $arg;
-	$copy_statuses = $self->fetch_copy_statuses unless $copy_statuses;
-	my ($stat) = grep { $_->id == $arg } @$copy_statuses;
-	return $stat;
+    my( $self, $arg ) = @_;
+    return $arg if ref $arg;
+    $copy_statuses = $self->fetch_copy_statuses unless $copy_statuses;
+    my ($stat) = grep { $_->id == $arg } @$copy_statuses;
+    return $stat;
 }
 
 sub fetch_open_transit_by_copy {
-	my( $self, $copyid ) = @_;
-	my($transit, $evt);
-	$transit = $self->cstorereq(
-		'open-ils.cstore.direct.action.transit_copy.search',
-		{ target_copy => $copyid, dest_recv_time => undef });
-	$evt = OpenILS::Event->new('ACTION_TRANSIT_COPY_NOT_FOUND') unless $transit;
-	return ($transit, $evt);
+    my( $self, $copyid ) = @_;
+    my($transit, $evt);
+    $transit = $self->cstorereq(
+        'open-ils.cstore.direct.action.transit_copy.search',
+        { target_copy => $copyid, dest_recv_time => undef });
+    $evt = OpenILS::Event->new('ACTION_TRANSIT_COPY_NOT_FOUND') unless $transit;
+    return ($transit, $evt);
 }
 
 sub unflesh_copy {
-	my( $self, $copy ) = @_;
-	return undef unless $copy;
-	$copy->status( $copy->status->id ) if ref($copy->status);
-	$copy->location( $copy->location->id ) if ref($copy->location);
-	$copy->circ_lib( $copy->circ_lib->id ) if ref($copy->circ_lib);
-	return $copy;
+    my( $self, $copy ) = @_;
+    return undef unless $copy;
+    $copy->status( $copy->status->id ) if ref($copy->status);
+    $copy->location( $copy->location->id ) if ref($copy->location);
+    $copy->circ_lib( $copy->circ_lib->id ) if ref($copy->circ_lib);
+    return $copy;
 }
 
 sub unflesh_reservation {
-	my( $self, $reservation ) = @_;
-	return undef unless $reservation;
-	$reservation->usr( $reservation->usr->id ) if ref($reservation->usr);
-	$reservation->target_resource_type( $reservation->target_resource_type->id ) if ref($reservation->target_resource_type);
-	$reservation->target_resource( $reservation->target_resource->id ) if ref($reservation->target_resource);
-	$reservation->current_resource( $reservation->current_resource->id ) if ref($reservation->current_resource);
-	return $reservation;
+    my( $self, $reservation ) = @_;
+    return undef unless $reservation;
+    $reservation->usr( $reservation->usr->id ) if ref($reservation->usr);
+    $reservation->target_resource_type( $reservation->target_resource_type->id ) if ref($reservation->target_resource_type);
+    $reservation->target_resource( $reservation->target_resource->id ) if ref($reservation->target_resource);
+    $reservation->current_resource( $reservation->current_resource->id ) if ref($reservation->current_resource);
+    return $reservation;
 }
 
 # un-fleshes a copy and updates it in the DB
 # returns a DB_UPDATE_FAILED event on error
 # returns undef on success
 sub update_copy {
-	my( $self, %params ) = @_;
+    my( $self, %params ) = @_;
 
-	my $copy		= $params{copy}	|| die "update_copy(): copy required";
-	my $editor	= $params{editor} || die "update_copy(): copy editor required";
-	my $session = $params{session};
+    my $copy        = $params{copy} || die "update_copy(): copy required";
+    my $editor  = $params{editor} || die "update_copy(): copy editor required";
+    my $session = $params{session};
 
-	$logger->debug("Updating copy in the database: " . $copy->id);
+    $logger->debug("Updating copy in the database: " . $copy->id);
 
-	$self->unflesh_copy($copy);
-	$copy->editor( $editor );
-	$copy->edit_date( 'now' );
+    $self->unflesh_copy($copy);
+    $copy->editor( $editor );
+    $copy->edit_date( 'now' );
 
-	my $s;
-	my $meth = 'open-ils.storage.direct.asset.copy.update';
+    my $s;
+    my $meth = 'open-ils.storage.direct.asset.copy.update';
 
-	$s = $session->request( $meth, $copy )->gather(1) if $session;
-	$s = $self->storagereq( $meth, $copy ) unless $session;
+    $s = $session->request( $meth, $copy )->gather(1) if $session;
+    $s = $self->storagereq( $meth, $copy ) unless $session;
 
-	$logger->debug("Update of copy ".$copy->id." returned: $s");
+    $logger->debug("Update of copy ".$copy->id." returned: $s");
 
-	return $self->DB_UPDATE_FAILED($copy) unless $s;
-	return undef;
+    return $self->DB_UPDATE_FAILED($copy) unless $s;
+    return undef;
 }
 
 sub update_reservation {
-	my( $self, %params ) = @_;
+    my( $self, %params ) = @_;
 
-	my $reservation	= $params{reservation}	|| die "update_reservation(): reservation required";
-	my $editor		= $params{editor} || die "update_reservation(): copy editor required";
-	my $session		= $params{session};
+    my $reservation = $params{reservation}  || die "update_reservation(): reservation required";
+    my $editor      = $params{editor} || die "update_reservation(): copy editor required";
+    my $session     = $params{session};
 
-	$logger->debug("Updating copy in the database: " . $reservation->id);
+    $logger->debug("Updating copy in the database: " . $reservation->id);
 
-	$self->unflesh_reservation($reservation);
+    $self->unflesh_reservation($reservation);
 
-	my $s;
-	my $meth = 'open-ils.cstore.direct.booking.reservation.update';
+    my $s;
+    my $meth = 'open-ils.cstore.direct.booking.reservation.update';
 
-	$s = $session->request( $meth, $reservation )->gather(1) if $session;
-	$s = $self->cstorereq( $meth, $reservation ) unless $session;
+    $s = $session->request( $meth, $reservation )->gather(1) if $session;
+    $s = $self->cstorereq( $meth, $reservation ) unless $session;
 
-	$logger->debug("Update of copy ".$reservation->id." returned: $s");
+    $logger->debug("Update of copy ".$reservation->id." returned: $s");
 
-	return $self->DB_UPDATE_FAILED($reservation) unless $s;
-	return undef;
+    return $self->DB_UPDATE_FAILED($reservation) unless $s;
+    return undef;
 }
 
 sub fetch_billable_xact {
-	my( $self, $id ) = @_;
-	my($xact, $evt);
-	$logger->debug("Fetching billable transaction %id");
-	$xact = $self->cstorereq(
-		'open-ils.cstore.direct.money.billable_transaction.retrieve', $id );
-	$evt = OpenILS::Event->new('MONEY_BILLABLE_TRANSACTION_NOT_FOUND') unless $xact;
-	return ($xact, $evt);
+    my( $self, $id ) = @_;
+    my($xact, $evt);
+    $logger->debug("Fetching billable transaction %id");
+    $xact = $self->cstorereq(
+        'open-ils.cstore.direct.money.billable_transaction.retrieve', $id );
+    $evt = OpenILS::Event->new('MONEY_BILLABLE_TRANSACTION_NOT_FOUND') unless $xact;
+    return ($xact, $evt);
 }
 
 sub fetch_billable_xact_summary {
-	my( $self, $id ) = @_;
-	my($xact, $evt);
-	$logger->debug("Fetching billable transaction summary %id");
-	$xact = $self->cstorereq(
-		'open-ils.cstore.direct.money.billable_transaction_summary.retrieve', $id );
-	$evt = OpenILS::Event->new('MONEY_BILLABLE_TRANSACTION_NOT_FOUND') unless $xact;
-	return ($xact, $evt);
+    my( $self, $id ) = @_;
+    my($xact, $evt);
+    $logger->debug("Fetching billable transaction summary %id");
+    $xact = $self->cstorereq(
+        'open-ils.cstore.direct.money.billable_transaction_summary.retrieve', $id );
+    $evt = OpenILS::Event->new('MONEY_BILLABLE_TRANSACTION_NOT_FOUND') unless $xact;
+    return ($xact, $evt);
 }
 
 sub fetch_fleshed_copy {
-	my( $self, $id ) = @_;
-	my( $copy, $evt );
-	$logger->info("Fetching fleshed copy $id");
-	$copy = $self->cstorereq(
-		"open-ils.cstore.direct.asset.copy.retrieve", $id,
-		{ flesh => 1,
-		  flesh_fields => { acp => [ qw/ circ_lib location status stat_cat_entries / ] }
-		}
-	);
-	$evt = OpenILS::Event->new('ASSET_COPY_NOT_FOUND', id => $id) unless $copy;
-	return ($copy, $evt);
+    my( $self, $id ) = @_;
+    my( $copy, $evt );
+    $logger->info("Fetching fleshed copy $id");
+    $copy = $self->cstorereq(
+        "open-ils.cstore.direct.asset.copy.retrieve", $id,
+        { flesh => 1,
+          flesh_fields => { acp => [ qw/ circ_lib location status stat_cat_entries / ] }
+        }
+    );
+    $evt = OpenILS::Event->new('ASSET_COPY_NOT_FOUND', id => $id) unless $copy;
+    return ($copy, $evt);
 }
 
 
 # returns the org that owns the callnumber that the copy
 # is attached to
 sub fetch_copy_owner {
-	my( $self, $copyid ) = @_;
-	my( $copy, $cn, $evt );
-	$logger->debug("Fetching copy owner $copyid");
-	($copy, $evt) = $self->fetch_copy($copyid);
-	return (undef,$evt) if $evt;
-	($cn, $evt) = $self->fetch_callnumber($copy->call_number);
-	return (undef,$evt) if $evt;
-	return ($cn->owning_lib);
+    my( $self, $copyid ) = @_;
+    my( $copy, $cn, $evt );
+    $logger->debug("Fetching copy owner $copyid");
+    ($copy, $evt) = $self->fetch_copy($copyid);
+    return (undef,$evt) if $evt;
+    ($cn, $evt) = $self->fetch_callnumber($copy->call_number);
+    return (undef,$evt) if $evt;
+    return ($cn->owning_lib);
 }
 
 sub fetch_copy_note {
-	my( $self, $id ) = @_;
-	my( $note, $evt );
-	$logger->debug("Fetching copy note $id");
-	$note = $self->cstorereq(
-		'open-ils.cstore.direct.asset.copy_note.retrieve', $id );
-	$evt = OpenILS::Event->new('ASSET_COPY_NOTE_NOT_FOUND', id => $id ) unless $note;
-	return ($note, $evt);
+    my( $self, $id ) = @_;
+    my( $note, $evt );
+    $logger->debug("Fetching copy note $id");
+    $note = $self->cstorereq(
+        'open-ils.cstore.direct.asset.copy_note.retrieve', $id );
+    $evt = OpenILS::Event->new('ASSET_COPY_NOTE_NOT_FOUND', id => $id ) unless $note;
+    return ($note, $evt);
 }
 
 sub fetch_call_numbers_by_title {
-	my( $self, $titleid ) = @_;
-	$logger->info("Fetching call numbers by title $titleid");
-	return $self->cstorereq(
-		'open-ils.cstore.direct.asset.call_number.search.atomic', 
-		{ record => $titleid, deleted => 'f' });
-		#'open-ils.storage.direct.asset.call_number.search.record.atomic', $titleid);
+    my( $self, $titleid ) = @_;
+    $logger->info("Fetching call numbers by title $titleid");
+    return $self->cstorereq(
+        'open-ils.cstore.direct.asset.call_number.search.atomic', 
+        { record => $titleid, deleted => 'f' });
+        #'open-ils.storage.direct.asset.call_number.search.record.atomic', $titleid);
 }
 
 sub fetch_copies_by_call_number {
-	my( $self, $cnid ) = @_;
-	$logger->info("Fetching copies by call number $cnid");
-	return $self->cstorereq(
-		'open-ils.cstore.direct.asset.copy.search.atomic', { call_number => $cnid, deleted => 'f' } );
-		#'open-ils.storage.direct.asset.copy.search.call_number.atomic', $cnid );
+    my( $self, $cnid ) = @_;
+    $logger->info("Fetching copies by call number $cnid");
+    return $self->cstorereq(
+        'open-ils.cstore.direct.asset.copy.search.atomic', { call_number => $cnid, deleted => 'f' } );
+        #'open-ils.storage.direct.asset.copy.search.call_number.atomic', $cnid );
 }
 
 sub fetch_user_by_barcode {
-	my( $self, $bc ) = @_;
-	my $cardid = $self->cstorereq(
-		'open-ils.cstore.direct.actor.card.id_list', { barcode => $bc } );
-	return (undef, OpenILS::Event->new('ACTOR_CARD_NOT_FOUND', barcode => $bc)) unless $cardid;
-	my $user = $self->cstorereq(
-		'open-ils.cstore.direct.actor.user.search', { card => $cardid } );
-	return (undef, OpenILS::Event->new('ACTOR_USER_NOT_FOUND', card => $cardid)) unless $user;
-	return ($user);
-	
+    my( $self, $bc ) = @_;
+    my $cardid = $self->cstorereq(
+        'open-ils.cstore.direct.actor.card.id_list', { barcode => $bc } );
+    return (undef, OpenILS::Event->new('ACTOR_CARD_NOT_FOUND', barcode => $bc)) unless $cardid;
+    my $user = $self->cstorereq(
+        'open-ils.cstore.direct.actor.user.search', { card => $cardid } );
+    return (undef, OpenILS::Event->new('ACTOR_USER_NOT_FOUND', card => $cardid)) unless $user;
+    return ($user);
+    
 }
 
 sub fetch_bill {
-	my( $self, $billid ) = @_;
-	$logger->debug("Fetching billing $billid");
-	my $bill = $self->cstorereq(
-		'open-ils.cstore.direct.money.billing.retrieve', $billid );
-	my $evt = OpenILS::Event->new('MONEY_BILLING_NOT_FOUND') unless $bill;
-	return($bill, $evt);
+    my( $self, $billid ) = @_;
+    $logger->debug("Fetching billing $billid");
+    my $bill = $self->cstorereq(
+        'open-ils.cstore.direct.money.billing.retrieve', $billid );
+    my $evt = OpenILS::Event->new('MONEY_BILLING_NOT_FOUND') unless $bill;
+    return($bill, $evt);
 }
 
 sub walk_org_tree {
-	my( $self, $node, $callback ) = @_;
-	return unless $node;
-	$callback->($node);
-	if( $node->children ) {
-		$self->walk_org_tree($_, $callback) for @{$node->children};
-	}
+    my( $self, $node, $callback ) = @_;
+    return unless $node;
+    $callback->($node);
+    if( $node->children ) {
+        $self->walk_org_tree($_, $callback) for @{$node->children};
+    }
 }
 
 sub is_true {
-	my( $self, $item ) = @_;
-	return 1 if $item and $item !~ /^f$/i;
-	return 0;
+    my( $self, $item ) = @_;
+    return 1 if $item and $item !~ /^f$/i;
+    return 0;
 }
 
 
@@ -1195,37 +1195,37 @@ sub patientreq {
 
 # This logic now lives in storage
 sub __patron_money_owed {
-	my( $self, $patronid ) = @_;
-	my $ses = OpenSRF::AppSession->create('open-ils.storage');
-	my $req = $ses->request(
-		'open-ils.storage.money.billable_transaction.summary.search',
-		{ usr => $patronid, xact_finish => undef } );
-
-	my $total = 0;
-	my $data;
-	while( $data = $req->recv ) {
-		$data = $data->content;
-		$total += $data->balance_owed;
-	}
-	return $total;
+    my( $self, $patronid ) = @_;
+    my $ses = OpenSRF::AppSession->create('open-ils.storage');
+    my $req = $ses->request(
+        'open-ils.storage.money.billable_transaction.summary.search',
+        { usr => $patronid, xact_finish => undef } );
+
+    my $total = 0;
+    my $data;
+    while( $data = $req->recv ) {
+        $data = $data->content;
+        $total += $data->balance_owed;
+    }
+    return $total;
 }
 
 sub patron_money_owed {
-	my( $self, $userid ) = @_;
-	my $ses = $self->start_db_session();
-	my $val = $ses->request(
-		'open-ils.storage.actor.user.total_owed', $userid)->gather(1);
-	$self->rollback_db_session($ses);
-	return $val;
+    my( $self, $userid ) = @_;
+    my $ses = $self->start_db_session();
+    my $val = $ses->request(
+        'open-ils.storage.actor.user.total_owed', $userid)->gather(1);
+    $self->rollback_db_session($ses);
+    return $val;
 }
 
 sub patron_total_items_out {
-	my( $self, $userid ) = @_;
-	my $ses = $self->start_db_session();
-	my $val = $ses->request(
-		'open-ils.storage.actor.user.total_out', $userid)->gather(1);
-	$self->rollback_db_session($ses);
-	return $val;
+    my( $self, $userid ) = @_;
+    my $ses = $self->start_db_session();
+    my $val = $ses->request(
+        'open-ils.storage.actor.user.total_out', $userid)->gather(1);
+    $self->rollback_db_session($ses);
+    return $val;
 }
 
 
@@ -1235,13 +1235,13 @@ sub patron_total_items_out {
 # Returns  ($summary, $event) 
 #---------------------------------------------------------------------
 sub fetch_mbts {
-	my $self = shift;
-	my $id	= shift;
-	my $e = shift || OpenILS::Utils::CStoreEditor->new;
-	$id = $id->id if ref($id);
+    my $self = shift;
+    my $id  = shift;
+    my $e = shift || OpenILS::Utils::CStoreEditor->new;
+    $id = $id->id if ref($id);
     
     my $xact = $e->retrieve_money_billable_transaction_summary($id)
-	    or return (undef, $e->event);
+        or return (undef, $e->event);
 
     return ($xact);
 }
@@ -1252,14 +1252,14 @@ sub fetch_mbts {
 # transaction summary objects for each
 #--------------------------------------------------------------------
 sub make_mbts {
-	my $self = shift;
+    my $self = shift;
     my $e = shift;
-	my @xacts = @_;
-	return () if (!@xacts);
+    my @xacts = @_;
+    return () if (!@xacts);
     return @{$e->search_money_billable_transaction_summary({id => [ map { $_->id } @xacts ]})};
 }
-		
-		
+        
+        
 sub ou_ancestor_setting_value {
     my($self, $org_id, $name, $e) = @_;
     $e = $e || OpenILS::Utils::CStoreEditor->new;
@@ -1300,8 +1300,8 @@ sub ou_ancestor_setting {
     my $setting = $e->json_query($query)->[0];
     return undef unless $setting;
     return {org => $setting->{org_unit}, value => OpenSRF::Utils::JSON->JSON2perl($setting->{value})};
-}	
-		
+}   
+        
 
 # returns the ISO8601 string representation of the requested epoch in GMT
 sub epoch2ISO8601 {
@@ -1313,19 +1313,19 @@ sub epoch2ISO8601 {
         $year, $mon, $mday, $hour, $min, $sec);
     return $date;
 }
-			
+            
 sub find_highest_perm_org {
-	my ( $self, $perm, $userid, $start_org, $org_tree ) = @_;
-	my $org = $self->find_org($org_tree, $start_org );
-
-	my $lastid = -1;
-	while( $org ) {
-		last if ($self->check_perms( $userid, $org->id, $perm )); # perm failed
-		$lastid = $org->id;
-		$org = $self->find_org( $org_tree, $org->parent_ou() );
-	}
+    my ( $self, $perm, $userid, $start_org, $org_tree ) = @_;
+    my $org = $self->find_org($org_tree, $start_org );
+
+    my $lastid = -1;
+    while( $org ) {
+        last if ($self->check_perms( $userid, $org->id, $perm )); # perm failed
+        $lastid = $org->id;
+        $org = $self->find_org( $org_tree, $org->parent_ou() );
+    }
 
-	return $lastid;
+    return $lastid;
 }
 
 
@@ -1363,59 +1363,59 @@ sub get_user_work_ou_ids {
 
 my $org_types;
 sub get_org_types {
-	my($self, $client) = @_;
-	return $org_types if $org_types;
-	return $org_types = OpenILS::Utils::CStoreEditor->new->retrieve_all_actor_org_unit_type();
+    my($self, $client) = @_;
+    return $org_types if $org_types;
+    return $org_types = OpenILS::Utils::CStoreEditor->new->retrieve_all_actor_org_unit_type();
 }
 
 my %ORG_TREE;
 sub get_org_tree {
-	my $self = shift;
-	my $locale = shift || '';
-	my $cache = OpenSRF::Utils::Cache->new("global", 0);
-	my $tree = $ORG_TREE{$locale} || $cache->get_cache("orgtree.$locale");
-	return $tree if $tree;
-
-	my $ses = OpenILS::Utils::CStoreEditor->new;
-	$ses->session->session_locale($locale);
-	$tree = $ses->search_actor_org_unit( 
-		[
-			{"parent_ou" => undef },
-			{
-				flesh				=> -1,
-				flesh_fields	=> { aou =>  ['children'] },
-				order_by			=> { aou => 'name'}
-			}
-		]
-	)->[0];
+    my $self = shift;
+    my $locale = shift || '';
+    my $cache = OpenSRF::Utils::Cache->new("global", 0);
+    my $tree = $ORG_TREE{$locale} || $cache->get_cache("orgtree.$locale");
+    return $tree if $tree;
+
+    my $ses = OpenILS::Utils::CStoreEditor->new;
+    $ses->session->session_locale($locale);
+    $tree = $ses->search_actor_org_unit( 
+        [
+            {"parent_ou" => undef },
+            {
+                flesh               => -1,
+                flesh_fields    => { aou =>  ['children'] },
+                order_by            => { aou => 'name'}
+            }
+        ]
+    )->[0];
 
     $ORG_TREE{$locale} = $tree;
-	$cache->put_cache("orgtree.$locale", $tree);
-	return $tree;
+    $cache->put_cache("orgtree.$locale", $tree);
+    return $tree;
 }
 
 sub get_org_descendants {
-	my($self, $org_id, $depth) = @_;
+    my($self, $org_id, $depth) = @_;
 
-	my $select = {
-		transform => 'actor.org_unit_descendants',
-		column => 'id',
-		result_field => 'id',
-	};
-	$select->{params} = [$depth] if defined $depth;
+    my $select = {
+        transform => 'actor.org_unit_descendants',
+        column => 'id',
+        result_field => 'id',
+    };
+    $select->{params} = [$depth] if defined $depth;
 
-	my $org_list = OpenILS::Utils::CStoreEditor->new->json_query({
-		select => {aou => [$select]},
+    my $org_list = OpenILS::Utils::CStoreEditor->new->json_query({
+        select => {aou => [$select]},
         from => 'aou',
-		where => {id => $org_id}
-	});
-	my @orgs;
-	push(@orgs, $_->{id}) for @$org_list;
-	return \@orgs;
+        where => {id => $org_id}
+    });
+    my @orgs;
+    push(@orgs, $_->{id}) for @$org_list;
+    return \@orgs;
 }
 
 sub get_org_ancestors {
-	my($self, $org_id, $use_cache) = @_;
+    my($self, $org_id, $use_cache) = @_;
 
     my ($cache, $orgs);
 
@@ -1425,42 +1425,42 @@ sub get_org_ancestors {
         return $orgs if $orgs;
     }
 
-	my $org_list = OpenILS::Utils::CStoreEditor->new->json_query({
-		select => {
-			aou => [{
-				transform => 'actor.org_unit_ancestors',
-				column => 'id',
-				result_field => 'id',
-				params => []
-			}],
-		},
-		from => 'aou',
-		where => {id => $org_id}
-	});
-
-	$orgs = [ map { $_->{id} } @$org_list ];
+    my $org_list = OpenILS::Utils::CStoreEditor->new->json_query({
+        select => {
+            aou => [{
+                transform => 'actor.org_unit_ancestors',
+                column => 'id',
+                result_field => 'id',
+                params => []
+            }],
+        },
+        from => 'aou',
+        where => {id => $org_id}
+    });
+
+    $orgs = [ map { $_->{id} } @$org_list ];
 
     $cache->put_cache("org.ancestors.$org_id", $orgs) if $use_cache;
-	return $orgs;
+    return $orgs;
 }
 
 sub get_org_full_path {
-	my($self, $org_id, $depth) = @_;
+    my($self, $org_id, $depth) = @_;
 
     my $query = {
         select => {
-			aou => [{
-				transform => 'actor.org_unit_full_path',
-				column => 'id',
-				result_field => 'id',
-			}],
-		},
-		from => 'aou',
-		where => {id => $org_id}
-	};
+            aou => [{
+                transform => 'actor.org_unit_full_path',
+                column => 'id',
+                result_field => 'id',
+            }],
+        },
+        from => 'aou',
+        where => {id => $org_id}
+    };
 
     $query->{select}->{aou}->[0]->{params} = [$depth] if defined $depth;
-	my $org_list = OpenILS::Utils::CStoreEditor->new->json_query($query);
+    my $org_list = OpenILS::Utils::CStoreEditor->new->json_query($query);
     return [ map {$_->{id}} @$org_list ];
 }
 
@@ -1474,106 +1474,106 @@ sub org_unit_ancestor_at_depth {
 
 # returns the user's configured locale as a string.  Defaults to en-US if none is configured.
 sub get_user_locale {
-	my($self, $user_id, $e) = @_;
-	$e ||= OpenILS::Utils::CStoreEditor->new;
+    my($self, $user_id, $e) = @_;
+    $e ||= OpenILS::Utils::CStoreEditor->new;
 
-	# first, see if the user has an explicit locale set
-	my $setting = $e->search_actor_user_setting(
-		{usr => $user_id, name => 'global.locale'})->[0];
-	return OpenSRF::Utils::JSON->JSON2perl($setting->value) if $setting;
+    # first, see if the user has an explicit locale set
+    my $setting = $e->search_actor_user_setting(
+        {usr => $user_id, name => 'global.locale'})->[0];
+    return OpenSRF::Utils::JSON->JSON2perl($setting->value) if $setting;
 
-	my $user = $e->retrieve_actor_user($user_id) or return $e->event;
-	return $self->get_org_locale($user->home_ou, $e);
+    my $user = $e->retrieve_actor_user($user_id) or return $e->event;
+    return $self->get_org_locale($user->home_ou, $e);
 }
 
 # returns org locale setting
 sub get_org_locale {
-	my($self, $org_id, $e) = @_;
-	$e ||= OpenILS::Utils::CStoreEditor->new;
-
-	my $locale;
-	if(defined $org_id) {
-		$locale = $self->ou_ancestor_setting_value($org_id, 'global.default_locale', $e);
-		return $locale if $locale;
-	}
-
-	# system-wide default
-	my $sclient = OpenSRF::Utils::SettingsClient->new;
-	$locale = $sclient->config_value('default_locale');
+    my($self, $org_id, $e) = @_;
+    $e ||= OpenILS::Utils::CStoreEditor->new;
+
+    my $locale;
+    if(defined $org_id) {
+        $locale = $self->ou_ancestor_setting_value($org_id, 'global.default_locale', $e);
+        return $locale if $locale;
+    }
+
+    # system-wide default
+    my $sclient = OpenSRF::Utils::SettingsClient->new;
+    $locale = $sclient->config_value('default_locale');
     return $locale if $locale;
 
-	# if nothing else, fallback to locale=cowboy
-	return 'en-US';
+    # if nothing else, fallback to locale=cowboy
+    return 'en-US';
 }
 
 
 # xml-escape non-ascii characters
 sub entityize { 
     my($self, $string, $form) = @_;
-	$form ||= "";
+    $form ||= "";
 
-	# If we're going to convert non-ASCII characters to XML entities,
-	# we had better be dealing with a UTF8 string to begin with
-	$string = decode_utf8($string);
+    # If we're going to convert non-ASCII characters to XML entities,
+    # we had better be dealing with a UTF8 string to begin with
+    $string = decode_utf8($string);
 
-	if ($form eq 'D') {
-		$string = NFD($string);
-	} else {
-		$string = NFC($string);
-	}
+    if ($form eq 'D') {
+        $string = NFD($string);
+    } else {
+        $string = NFC($string);
+    }
 
-	# Convert raw ampersands to entities
-	$string =~ s/&(?!\S+;)/&amp;/gso;
+    # Convert raw ampersands to entities
+    $string =~ s/&(?!\S+;)/&amp;/gso;
 
-	# Convert Unicode characters to entities
-	$string =~ s/([\x{0080}-\x{fffd}])/sprintf('&#x%X;',ord($1))/sgoe;
+    # Convert Unicode characters to entities
+    $string =~ s/([\x{0080}-\x{fffd}])/sprintf('&#x%X;',ord($1))/sgoe;
 
-	return $string;
+    return $string;
 }
 
 # x0000-x0008 isn't legal in XML documents
 # XXX Perhaps this should just go into our standard entityize method
 sub strip_ctrl_chars {
-	my ($self, $string) = @_;
+    my ($self, $string) = @_;
 
-	$string =~ s/([\x{0000}-\x{0008}])//sgoe; 
-	return $string;
+    $string =~ s/([\x{0000}-\x{0008}])//sgoe; 
+    return $string;
 }
 
 sub get_copy_price {
-	my($self, $e, $copy, $volume) = @_;
+    my($self, $e, $copy, $volume) = @_;
 
-	$copy->price(0) if $copy->price and $copy->price < 0;
+    $copy->price(0) if $copy->price and $copy->price < 0;
 
-	return $copy->price if $copy->price and $copy->price > 0;
+    return $copy->price if $copy->price and $copy->price > 0;
 
 
-	my $owner;
-	if(ref $volume) {
-		if($volume->id == OILS_PRECAT_CALL_NUMBER) {
-			$owner = $copy->circ_lib;
-		} else {
-			$owner = $volume->owning_lib;
-		}
-	} else {
-		if($copy->call_number == OILS_PRECAT_CALL_NUMBER) {
-			$owner = $copy->circ_lib;
-		} else {
-			$owner = $e->retrieve_asset_call_number($copy->call_number)->owning_lib;
-		}
-	}
+    my $owner;
+    if(ref $volume) {
+        if($volume->id == OILS_PRECAT_CALL_NUMBER) {
+            $owner = $copy->circ_lib;
+        } else {
+            $owner = $volume->owning_lib;
+        }
+    } else {
+        if($copy->call_number == OILS_PRECAT_CALL_NUMBER) {
+            $owner = $copy->circ_lib;
+        } else {
+            $owner = $e->retrieve_asset_call_number($copy->call_number)->owning_lib;
+        }
+    }
 
-	my $default_price = $self->ou_ancestor_setting_value(
-		$owner, OILS_SETTING_DEF_ITEM_PRICE, $e) || 0;
+    my $default_price = $self->ou_ancestor_setting_value(
+        $owner, OILS_SETTING_DEF_ITEM_PRICE, $e) || 0;
 
-	return $default_price unless defined $copy->price;
+    return $default_price unless defined $copy->price;
 
-	# price is 0.  Use the default?
+    # price is 0.  Use the default?
     my $charge_on_0 = $self->ou_ancestor_setting_value(
         $owner, OILS_SETTING_CHARGE_LOST_ON_ZERO, $e) || 0;
 
-	return $default_price if $charge_on_0;
-	return 0;
+    return $default_price if $charge_on_0;
+    return 0;
 }
 
 # given a transaction ID, this returns the context org_unit for the transaction
@@ -2117,7 +2117,7 @@ sub strip_marc_fields {
         }
     }
 
-	return $class->entityize($marcdoc->documentElement->toString);
+    return $class->entityize($marcdoc->documentElement->toString);
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm
index c87eb28..0e67974 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AssetCommon.pm
@@ -20,58 +20,58 @@ my $U = 'OpenILS::Application::AppUtils';
 
 sub org_cannot_have_vols {
     my($class, $e, $org_id) = @_;
-	my $org = $e->retrieve_actor_org_unit([
+    my $org = $e->retrieve_actor_org_unit([
         $org_id,
         {   flesh => 1,
             flesh_fields => {aou => ['ou_type']}
         }]) or return $e->event;
 
-	return OpenILS::Event->new('ORG_CANNOT_HAVE_VOLS')
-		unless $U->is_true($org->ou_type->can_have_vols);
+    return OpenILS::Event->new('ORG_CANNOT_HAVE_VOLS')
+        unless $U->is_true($org->ou_type->can_have_vols);
 
-	return 0;
+    return 0;
 }
 
 sub fix_copy_price {
     my $class = shift;
-	my $copy = shift;
+    my $copy = shift;
 
     if(defined $copy->price) {
-	    my $p = $copy->price || 0;
-	    $p =~ s/\$//og;
-	    $copy->price($p);
+        my $p = $copy->price || 0;
+        $p =~ s/\$//og;
+        $copy->price($p);
     }
 
-	my $d = $copy->deposit_amount || 0;
-	$d =~ s/\$//og;
-	$copy->deposit_amount($d);
+    my $d = $copy->deposit_amount || 0;
+    $d =~ s/\$//og;
+    $copy->deposit_amount($d);
 }
 
 sub create_copy {
-	my($class, $editor, $vol, $copy) = @_;
+    my($class, $editor, $vol, $copy) = @_;
 
-	my $existing = $editor->search_asset_copy(
-		{ barcode => $copy->barcode, deleted => 'f' } );
-	
-	return OpenILS::Event->new('ITEM_BARCODE_EXISTS') if @$existing;
+    my $existing = $editor->search_asset_copy(
+        { barcode => $copy->barcode, deleted => 'f' } );
+    
+    return OpenILS::Event->new('ITEM_BARCODE_EXISTS') if @$existing;
 
    # see if the volume this copy references is marked as deleted
     return OpenILS::Event->new('VOLUME_DELETED', vol => $vol->id) 
         if $U->is_true($vol->deleted);
 
-	my $evt;
-	my $org = (ref $copy->circ_lib) ? $copy->circ_lib->id : $copy->circ_lib;
-	return $evt if ($evt = $class->org_cannot_have_vols($editor, $org));
+    my $evt;
+    my $org = (ref $copy->circ_lib) ? $copy->circ_lib->id : $copy->circ_lib;
+    return $evt if ($evt = $class->org_cannot_have_vols($editor, $org));
 
-	$copy->clear_id;
-	$copy->editor($editor->requestor->id);
-	$copy->creator($editor->requestor->id);
-	$copy->create_date('now');
+    $copy->clear_id;
+    $copy->editor($editor->requestor->id);
+    $copy->creator($editor->requestor->id);
+    $copy->create_date('now');
     $copy->call_number($vol->id);
-	$class->fix_copy_price($copy);
+    $class->fix_copy_price($copy);
 
-	$editor->create_asset_copy($copy) or return $editor->die_event;
-	return undef;
+    $editor->create_asset_copy($copy) or return $editor->die_event;
+    return undef;
 }
 
 
@@ -79,147 +79,147 @@ sub create_copy {
 # treated as the authoritative list for the copy. existing entries
 # that are not in said list will be deleted from the DB
 sub update_copy_stat_entries {
-	my($class, $editor, $copy, $delete_stats) = @_;
+    my($class, $editor, $copy, $delete_stats) = @_;
 
-	return undef if $copy->isdeleted;
-	return undef unless $copy->ischanged or $copy->isnew;
+    return undef if $copy->isdeleted;
+    return undef unless $copy->ischanged or $copy->isnew;
 
-	my $evt;
-	my $entries = $copy->stat_cat_entries;
+    my $evt;
+    my $entries = $copy->stat_cat_entries;
 
-	if( $delete_stats ) {
-		$entries = ($entries and @$entries) ? $entries : [];
-	} else {
-		return undef unless ($entries and @$entries);
-	}
+    if( $delete_stats ) {
+        $entries = ($entries and @$entries) ? $entries : [];
+    } else {
+        return undef unless ($entries and @$entries);
+    }
 
-	my $maps = $editor->search_asset_stat_cat_entry_copy_map({owning_copy=>$copy->id});
+    my $maps = $editor->search_asset_stat_cat_entry_copy_map({owning_copy=>$copy->id});
 
-	if(!$copy->isnew) {
-		# if there is no stat cat entry on the copy who's id matches the
-		# current map's id, remove the map from the database
-		for my $map (@$maps) {
-			if(! grep { $_->id == $map->stat_cat_entry } @$entries ) {
+    if(!$copy->isnew) {
+        # if there is no stat cat entry on the copy who's id matches the
+        # current map's id, remove the map from the database
+        for my $map (@$maps) {
+            if(! grep { $_->id == $map->stat_cat_entry } @$entries ) {
 
-				$logger->info("copy update found stale ".
-					"stat cat entry map ".$map->id. " on copy ".$copy->id);
+                $logger->info("copy update found stale ".
+                    "stat cat entry map ".$map->id. " on copy ".$copy->id);
 
-				$editor->delete_asset_stat_cat_entry_copy_map($map)
-					or return $editor->event;
-			}
-		}
-	}
+                $editor->delete_asset_stat_cat_entry_copy_map($map)
+                    or return $editor->event;
+            }
+        }
+    }
 
-	# go through the stat cat update/create process
-	for my $entry (@$entries) { 
-		next unless $entry;
+    # go through the stat cat update/create process
+    for my $entry (@$entries) { 
+        next unless $entry;
 
-		# if this link already exists in the DB, don't attempt to re-create it
-		next if( grep{$_->stat_cat_entry == $entry->id} @$maps );
-	
-		my $new_map = Fieldmapper::asset::stat_cat_entry_copy_map->new();
+        # if this link already exists in the DB, don't attempt to re-create it
+        next if( grep{$_->stat_cat_entry == $entry->id} @$maps );
+    
+        my $new_map = Fieldmapper::asset::stat_cat_entry_copy_map->new();
 
-		my $sc = ref($entry->stat_cat) ? $entry->stat_cat->id : $entry->stat_cat;
-		
-		$new_map->stat_cat( $sc );
-		$new_map->stat_cat_entry( $entry->id );
-		$new_map->owning_copy( $copy->id );
+        my $sc = ref($entry->stat_cat) ? $entry->stat_cat->id : $entry->stat_cat;
+        
+        $new_map->stat_cat( $sc );
+        $new_map->stat_cat_entry( $entry->id );
+        $new_map->owning_copy( $copy->id );
 
-		$editor->create_asset_stat_cat_entry_copy_map($new_map)
-			or return $editor->event;
+        $editor->create_asset_stat_cat_entry_copy_map($new_map)
+            or return $editor->event;
 
-		$logger->info("copy update created new stat cat entry map ".$editor->data);
-	}
+        $logger->info("copy update created new stat cat entry map ".$editor->data);
+    }
 
-	return undef;
+    return undef;
 }
 
 # if 'delete_maps' is true, the copy->parts data is  treated as the
 # authoritative list for the copy. existing part maps not targeting
 # these parts will be deleted from the DB
 sub update_copy_parts {
-	my($class, $editor, $copy, $delete_maps) = @_;
+    my($class, $editor, $copy, $delete_maps) = @_;
 
-	return undef if $copy->isdeleted;
-	return undef unless $copy->ischanged or $copy->isnew;
+    return undef if $copy->isdeleted;
+    return undef unless $copy->ischanged or $copy->isnew;
 
-	my $evt;
-	my $incoming_parts = $copy->parts;
+    my $evt;
+    my $incoming_parts = $copy->parts;
 
-	if( $delete_maps ) {
-		$incoming_parts = ($incoming_parts and @$incoming_parts) ? $incoming_parts : [];
-	} else {
-		return undef unless ($incoming_parts and @$incoming_parts);
-	}
+    if( $delete_maps ) {
+        $incoming_parts = ($incoming_parts and @$incoming_parts) ? $incoming_parts : [];
+    } else {
+        return undef unless ($incoming_parts and @$incoming_parts);
+    }
 
-	my $maps = $editor->search_asset_copy_part_map({target_copy=>$copy->id});
+    my $maps = $editor->search_asset_copy_part_map({target_copy=>$copy->id});
 
-	if(!$copy->isnew) {
-		# if there is no part map on the copy who's id matches the
-		# current map's id, remove the map from the database
-		for my $map (@$maps) {
-			if(! grep { $_->id == $map->part } @$incoming_parts ) {
+    if(!$copy->isnew) {
+        # if there is no part map on the copy who's id matches the
+        # current map's id, remove the map from the database
+        for my $map (@$maps) {
+            if(! grep { $_->id == $map->part } @$incoming_parts ) {
 
-				$logger->info("copy update found stale ".
-					"monographic part map ".$map->id. " on copy ".$copy->id);
+                $logger->info("copy update found stale ".
+                    "monographic part map ".$map->id. " on copy ".$copy->id);
 
-				$editor->delete_asset_copy_part_map($map)
-					or return $editor->event;
-			}
-		}
-	}
+                $editor->delete_asset_copy_part_map($map)
+                    or return $editor->event;
+            }
+        }
+    }
 
-	# go through the part map update/create process
-	for my $incoming_part (@$incoming_parts) { 
-		next unless $incoming_part;
+    # go through the part map update/create process
+    for my $incoming_part (@$incoming_parts) { 
+        next unless $incoming_part;
 
-		# if this link already exists in the DB, don't attempt to re-create it
-		next if( grep{$_->part == $incoming_part->id} @$maps );
-	
-		my $new_map = Fieldmapper::asset::copy_part_map->new();
+        # if this link already exists in the DB, don't attempt to re-create it
+        next if( grep{$_->part == $incoming_part->id} @$maps );
+    
+        my $new_map = Fieldmapper::asset::copy_part_map->new();
 
-		$new_map->part( $incoming_part->id );
-		$new_map->target_copy( $copy->id );
+        $new_map->part( $incoming_part->id );
+        $new_map->target_copy( $copy->id );
 
-		$editor->create_asset_copy_part_map($new_map)
-			or return $editor->event;
+        $editor->create_asset_copy_part_map($new_map)
+            or return $editor->event;
 
-		$logger->info("copy update created new monographic part copy map ".$editor->data);
-	}
+        $logger->info("copy update created new monographic part copy map ".$editor->data);
+    }
 
-	return undef;
+    return undef;
 }
 
 
 
 sub update_copy {
-	my($class, $editor, $override, $vol, $copy, $retarget_holds, $force_delete_empty_bib) = @_;
+    my($class, $editor, $override, $vol, $copy, $retarget_holds, $force_delete_empty_bib) = @_;
 
     $override = { all => 1 } if($override && !ref $override);
     $override = { all => 0 } if(!ref $override);
 
-	my $evt;
-	my $org = (ref $copy->circ_lib) ? $copy->circ_lib->id : $copy->circ_lib;
-	return $evt if ( $evt = $class->org_cannot_have_vols($editor, $org) );
+    my $evt;
+    my $org = (ref $copy->circ_lib) ? $copy->circ_lib->id : $copy->circ_lib;
+    return $evt if ( $evt = $class->org_cannot_have_vols($editor, $org) );
 
-	$logger->info("vol-update: updating copy ".$copy->id);
-	my $orig_copy = $editor->retrieve_asset_copy($copy->id);
+    $logger->info("vol-update: updating copy ".$copy->id);
+    my $orig_copy = $editor->retrieve_asset_copy($copy->id);
 
     # Call-number may have changed, find the original
     my $orig_vol_id = $editor->json_query({select => {acp => ['call_number']}, from => 'acp', where => {id => $copy->id}});
     my $orig_vol  = $editor->retrieve_asset_call_number($orig_vol_id->[0]->{call_number});
 
-	$copy->editor($editor->requestor->id);
-	$copy->edit_date('now');
+    $copy->editor($editor->requestor->id);
+    $copy->edit_date('now');
 
-	$copy->age_protect( $copy->age_protect->id )
-		if ref $copy->age_protect;
+    $copy->age_protect( $copy->age_protect->id )
+        if ref $copy->age_protect;
 
-	$class->fix_copy_price($copy);
+    $class->fix_copy_price($copy);
     $class->check_hold_retarget($editor, $copy, $orig_copy, $retarget_holds);
 
-	return $editor->event unless $editor->update_asset_copy($copy);
-	return $class->remove_empty_objects($editor, $override, $orig_vol, $force_delete_empty_bib);
+    return $editor->event unless $editor->update_asset_copy($copy);
+    return $class->remove_empty_objects($editor, $override, $orig_vol, $force_delete_empty_bib);
 }
 
 sub check_hold_retarget {
@@ -256,105 +256,105 @@ sub check_hold_retarget {
 
 # this does the actual work
 sub update_fleshed_copies {
-	my($class, $editor, $override, $vol, $copies, $delete_stats, $retarget_holds, $force_delete_empty_bib) = @_;
+    my($class, $editor, $override, $vol, $copies, $delete_stats, $retarget_holds, $force_delete_empty_bib) = @_;
 
     $override = { all => 1 } if($override && !ref $override);
     $override = { all => 0 } if(!ref $override);
 
-	my $evt;
-	my $fetchvol = ($vol) ? 0 : 1;
+    my $evt;
+    my $fetchvol = ($vol) ? 0 : 1;
 
-	my %cache;
-	$cache{$vol->id} = $vol if $vol;
+    my %cache;
+    $cache{$vol->id} = $vol if $vol;
 
-	for my $copy (@$copies) {
+    for my $copy (@$copies) {
 
-		my $copyid = $copy->id;
-		$logger->info("vol-update: inspecting copy $copyid");
+        my $copyid = $copy->id;
+        $logger->info("vol-update: inspecting copy $copyid");
 
-		if( !($vol = $cache{$copy->call_number}) ) {
-			$vol = $cache{$copy->call_number} = 
-				$editor->retrieve_asset_call_number($copy->call_number);
-			return $editor->event unless $vol;
-		}
+        if( !($vol = $cache{$copy->call_number}) ) {
+            $vol = $cache{$copy->call_number} = 
+                $editor->retrieve_asset_call_number($copy->call_number);
+            return $editor->event unless $vol;
+        }
 
-		return $editor->event unless 
-			$editor->allowed('UPDATE_COPY', $class->copy_perm_org($vol, $copy));
+        return $editor->event unless 
+            $editor->allowed('UPDATE_COPY', $class->copy_perm_org($vol, $copy));
 
-		$copy->editor($editor->requestor->id);
-		$copy->edit_date('now');
+        $copy->editor($editor->requestor->id);
+        $copy->edit_date('now');
 
-		$copy->status( $copy->status->id ) if ref($copy->status);
-		$copy->location( $copy->location->id ) if ref($copy->location);
-		$copy->circ_lib( $copy->circ_lib->id ) if ref($copy->circ_lib);
-		
-		my $sc_entries = $copy->stat_cat_entries;
-		$copy->clear_stat_cat_entries;
+        $copy->status( $copy->status->id ) if ref($copy->status);
+        $copy->location( $copy->location->id ) if ref($copy->location);
+        $copy->circ_lib( $copy->circ_lib->id ) if ref($copy->circ_lib);
+        
+        my $sc_entries = $copy->stat_cat_entries;
+        $copy->clear_stat_cat_entries;
 
         my $parts = $copy->parts;
-		$copy->clear_parts;
+        $copy->clear_parts;
 
-		if( $copy->isdeleted ) {
-			$evt = $class->delete_copy($editor, $override, $vol, $copy, $retarget_holds, $force_delete_empty_bib);
-			return $evt if $evt;
+        if( $copy->isdeleted ) {
+            $evt = $class->delete_copy($editor, $override, $vol, $copy, $retarget_holds, $force_delete_empty_bib);
+            return $evt if $evt;
 
-		} elsif( $copy->isnew ) {
-			$evt = $class->create_copy( $editor, $vol, $copy );
-			return $evt if $evt;
+        } elsif( $copy->isnew ) {
+            $evt = $class->create_copy( $editor, $vol, $copy );
+            return $evt if $evt;
 
-		} elsif( $copy->ischanged ) {
+        } elsif( $copy->ischanged ) {
 
-			$evt = $class->update_copy( $editor, $override, $vol, $copy, $retarget_holds, $force_delete_empty_bib);
-			return $evt if $evt;
-		}
+            $evt = $class->update_copy( $editor, $override, $vol, $copy, $retarget_holds, $force_delete_empty_bib);
+            return $evt if $evt;
+        }
 
-		$copy->stat_cat_entries( $sc_entries );
-		$evt = $class->update_copy_stat_entries($editor, $copy, $delete_stats);
-		$copy->parts( $parts );
-		# probably okay to use $delete_stats here for simplicity
-		$evt = $class->update_copy_parts($editor, $copy, $delete_stats);
-		return $evt if $evt;
-	}
+        $copy->stat_cat_entries( $sc_entries );
+        $evt = $class->update_copy_stat_entries($editor, $copy, $delete_stats);
+        $copy->parts( $parts );
+        # probably okay to use $delete_stats here for simplicity
+        $evt = $class->update_copy_parts($editor, $copy, $delete_stats);
+        return $evt if $evt;
+    }
 
-	$logger->debug("vol-update: done updating copy batch");
+    $logger->debug("vol-update: done updating copy batch");
 
-	return undef;
+    return undef;
 }
 
 
 sub delete_copy {
-	my($class, $editor, $override, $vol, $copy, $retarget_holds, $force_delete_empty_bib, $skip_empty_cleanup) = @_;
+    my($class, $editor, $override, $vol, $copy, $retarget_holds, $force_delete_empty_bib, $skip_empty_cleanup) = @_;
 
-	return $editor->event unless
-		$editor->allowed('DELETE_COPY', $class->copy_perm_org($vol, $copy));
+    return $editor->event unless
+        $editor->allowed('DELETE_COPY', $class->copy_perm_org($vol, $copy));
 
     $override = { all => 1 } if($override && !ref $override);
     $override = { all => 0 } if(!ref $override);
 
-	my $stat = $U->copy_status($copy->status);
-	if ($U->is_true($stat->restrict_copy_delete)) {
-		if ($override->{all} || grep { $_ eq 'COPY_DELETE_WARNING' } @{$override->{events}}) {
-			return $editor->event unless $editor->allowed('COPY_DELETE_WARNING.override', $class->copy_perm_org($vol, $copy))
-		} else {
-			return OpenILS::Event->new('COPY_DELETE_WARNING', payload => $copy->id )
-		}
-	}
+    my $stat = $U->copy_status($copy->status);
+    if ($U->is_true($stat->restrict_copy_delete)) {
+        if ($override->{all} || grep { $_ eq 'COPY_DELETE_WARNING' } @{$override->{events}}) {
+            return $editor->event unless $editor->allowed('COPY_DELETE_WARNING.override', $class->copy_perm_org($vol, $copy))
+        } else {
+            return OpenILS::Event->new('COPY_DELETE_WARNING', payload => $copy->id )
+        }
+    }
 
-	$logger->info("vol-update: deleting copy ".$copy->id);
-	$copy->deleted('t');
+    $logger->info("vol-update: deleting copy ".$copy->id);
+    $copy->deleted('t');
 
-	$copy->editor($editor->requestor->id);
-	$copy->edit_date('now');
-	$editor->update_asset_copy($copy) or return $editor->event;
+    $copy->editor($editor->requestor->id);
+    $copy->edit_date('now');
+    $editor->update_asset_copy($copy) or return $editor->event;
 
-	# Delete any open transits for this copy
-	my $transits = $editor->search_action_transit_copy(
-		{ target_copy=>$copy->id, dest_recv_time => undef } );
+    # Delete any open transits for this copy
+    my $transits = $editor->search_action_transit_copy(
+        { target_copy=>$copy->id, dest_recv_time => undef } );
 
-	for my $t (@$transits) {
-		$editor->delete_action_transit_copy($t)
-			or return $editor->event;
-	}
+    for my $t (@$transits) {
+        $editor->delete_action_transit_copy($t)
+            or return $editor->event;
+    }
 
     my $evt = $class->cancel_copy_holds($editor, $copy);
     return $evt if $evt;
@@ -363,7 +363,7 @@ sub delete_copy {
 
     return undef if $skip_empty_cleanup;
 
-	return $class->remove_empty_objects($editor, $override, $vol, $force_delete_empty_bib);
+    return $class->remove_empty_objects($editor, $override, $vol, $force_delete_empty_bib);
 }
 
 
@@ -425,10 +425,10 @@ sub cancel_hold_list {
 
 
 sub create_volume {
-	my($class, $override, $editor, $vol) = @_;
-	my $evt;
+    my($class, $override, $editor, $vol) = @_;
+    my $evt;
 
-	return $evt if ( $evt = $class->org_cannot_have_vols($editor, $vol->owning_lib) );
+    return $evt if ( $evt = $class->org_cannot_have_vols($editor, $vol->owning_lib) );
 
     $override = { all => 1 } if($override && !ref $override);
     $override = { all => 0 } if(!ref $override);
@@ -439,49 +439,49 @@ sub create_volume {
    return OpenILS::Event->new('BIB_RECORD_DELETED', rec => $rec->id) 
       if $U->is_true($rec->deleted);
 
-	# first lets see if there are any collisions
-	my $vols = $editor->search_asset_call_number( { 
-			owning_lib	=> $vol->owning_lib,
-			record		=> $vol->record,
-			label			=> $vol->label,
-			prefix			=> $vol->prefix,
-			suffix			=> $vol->suffix,
-			deleted		=> 'f'
-		}
-	);
-
-	my $label = undef;
-	if(@$vols) {
+    # first lets see if there are any collisions
+    my $vols = $editor->search_asset_call_number( { 
+            owning_lib  => $vol->owning_lib,
+            record      => $vol->record,
+            label           => $vol->label,
+            prefix          => $vol->prefix,
+            suffix          => $vol->suffix,
+            deleted     => 'f'
+        }
+    );
+
+    my $label = undef;
+    if(@$vols) {
       # we've found an exising volume
-		if($override->{all} || grep { $_ eq 'VOLUME_LABEL_EXISTS' } @{$override->{events}}) {
-			$label = $vol->label;
-		} else {
-			return OpenILS::Event->new(
-				'VOLUME_LABEL_EXISTS', payload => $vol->id);
-		}
-	}
-
-	# create a temp label so we can create the new volume, 
+        if($override->{all} || grep { $_ eq 'VOLUME_LABEL_EXISTS' } @{$override->{events}}) {
+            $label = $vol->label;
+        } else {
+            return OpenILS::Event->new(
+                'VOLUME_LABEL_EXISTS', payload => $vol->id);
+        }
+    }
+
+    # create a temp label so we can create the new volume, 
     # then de-dup it with the existing volume
-	$vol->label( "__SYSTEM_TMP_$$".time) if $label;
+    $vol->label( "__SYSTEM_TMP_$$".time) if $label;
 
-	$vol->creator($editor->requestor->id);
-	$vol->create_date('now');
-	$vol->editor($editor->requestor->id);
-	$vol->edit_date('now');
-	$vol->clear_id;
+    $vol->creator($editor->requestor->id);
+    $vol->create_date('now');
+    $vol->editor($editor->requestor->id);
+    $vol->edit_date('now');
+    $vol->clear_id;
 
-	$editor->create_asset_call_number($vol) or return $editor->die_event;
+    $editor->create_asset_call_number($vol) or return $editor->die_event;
 
-	if($label) {
-		# now restore the label and merge into the existing record
-		$vol->label($label);
-		(undef, $evt) = 
-			OpenILS::Application::Cat::Merge::merge_volumes($editor, [$vol], $$vols[0]);
-		return $evt if $evt;
-	}
+    if($label) {
+        # now restore the label and merge into the existing record
+        $vol->label($label);
+        (undef, $evt) = 
+            OpenILS::Application::Cat::Merge::merge_volumes($editor, [$vol], $$vols[0]);
+        return $evt if $evt;
+    }
 
-	return undef;
+    return undef;
 }
 
 # returns the volume if it exists
@@ -492,7 +492,7 @@ sub volume_exists {
 }
 
 sub find_or_create_volume {
-	my($class, $e, $label, $record_id, $org_id, $prefix, $suffix, $label_class) = @_;
+    my($class, $e, $label, $record_id, $org_id, $prefix, $suffix, $label_class) = @_;
 
     $prefix ||= '-1';
     $suffix ||= '-1';
@@ -507,26 +507,26 @@ sub find_or_create_volume {
         $vol = $class->volume_exists($e, $record_id, $label, $org_id, $prefix, $suffix);
     }
 
-	# If the volume exists, return the ID
+    # If the volume exists, return the ID
     return ($vol, undef, 1) if $vol;
 
-	# -----------------------------------------------------------------
-	# Otherwise, create a new volume with the given attributes
-	# -----------------------------------------------------------------
-	return (undef, $e->die_event) unless $e->allowed('UPDATE_VOLUME', $org_id);
+    # -----------------------------------------------------------------
+    # Otherwise, create a new volume with the given attributes
+    # -----------------------------------------------------------------
+    return (undef, $e->die_event) unless $e->allowed('UPDATE_VOLUME', $org_id);
 
-	$vol = Fieldmapper::asset::call_number->new;
-	$vol->owning_lib($org_id);
-	$vol->label_class($label_class) if ($label_class);
-	$vol->label($label);
-	$vol->prefix($prefix);
-	$vol->suffix($suffix);
-	$vol->record($record_id);
+    $vol = Fieldmapper::asset::call_number->new;
+    $vol->owning_lib($org_id);
+    $vol->label_class($label_class) if ($label_class);
+    $vol->label($label);
+    $vol->prefix($prefix);
+    $vol->suffix($suffix);
+    $vol->record($record_id);
 
     my $evt = $class->create_volume(0, $e, $vol);
     return (undef, $evt) if $evt;
 
-	return ($vol);
+    return ($vol);
 }
 
 
@@ -544,7 +544,7 @@ sub create_copy_note {
 
 
 sub remove_empty_objects {
-	my($class, $editor, $override, $vol, $force_delete_empty_bib) = @_; 
+    my($class, $editor, $override, $vol, $force_delete_empty_bib) = @_; 
 
     $override = { all => 1 } if($override && !ref $override);
     $override = { all => 0 } if(!ref $override);
@@ -554,7 +554,7 @@ sub remove_empty_objects {
     my $aoe =  $U->ou_ancestor_setting_value(
         $editor->requestor->ws_ou, 'cat.bib.alert_on_empty', $editor);
 
-	if( OpenILS::Application::Cat::BibCommon->title_is_empty($editor, $vol->record, $vol->id) ) {
+    if( OpenILS::Application::Cat::BibCommon->title_is_empty($editor, $vol->record, $vol->id) ) {
 
         # delete this volume if it's not already marked as deleted
         unless( $U->is_true($vol->deleted) || $vol->isdeleted ) {
@@ -571,7 +571,7 @@ sub remove_empty_objects {
             return $evt if $evt;
         }
 
-	} else {
+    } else {
 
         # this may be the last copy attached to the volume.  
 
@@ -592,7 +592,7 @@ sub remove_empty_objects {
         }
     }
 
-	return undef;
+    return undef;
 }
 
 # Deletes a volume.  Returns undef on success, event on error
@@ -626,18 +626,18 @@ sub delete_volume {
     return $evt if $evt;
 
     # handle the case where this is the last volume on the record
-	return $class->remove_empty_objects($editor, $override, $vol);
+    return $class->remove_empty_objects($editor, $override, $vol);
 }
 
 
 sub copy_perm_org {
-	my($class, $vol, $copy) = @_;
-	my $org = $vol->owning_lib;
-	if( $vol->id == OILS_PRECAT_CALL_NUMBER ) {
-		$org = ref($copy->circ_lib) ? $copy->circ_lib->id : $copy->circ_lib;
-	}
-	$logger->debug("using copy perm org $org");
-	return $org;
+    my($class, $vol, $copy) = @_;
+    my $org = $vol->owning_lib;
+    if( $vol->id == OILS_PRECAT_CALL_NUMBER ) {
+        $org = ref($copy->circ_lib) ? $copy->circ_lib->id : $copy->circ_lib;
+    }
+    $logger->debug("using copy perm org $org");
+    return $org;
 }
 
 
@@ -660,7 +660,7 @@ sub set_item_lost {
     $e->allowed('SET_CIRC_LOST', $circ->circ_lib) or return $e->die_event;
 
     return $e->die_event(OpenILS::Event->new('COPY_MARKED_LOST'))
-	    if $copy->status == OILS_COPY_STATUS_LOST;
+        if $copy->status == OILS_COPY_STATUS_LOST;
 
     # ---------------------------------------------------------------------
     # fetch the related org settings
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AuthCommon.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AuthCommon.pm
index a8ef1f0..5a2d79f 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AuthCommon.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/AuthCommon.pm
@@ -17,11 +17,11 @@ my $MARC_NAMESPACE = 'http://www.loc.gov/MARC21/slim';
 
 # generate a MARC XML document from a MARC XML string
 sub marc_xml_to_doc {
-	my $xml = shift;
-	my $marc_doc = XML::LibXML->new->parse_string($xml);
-	$marc_doc->documentElement->setNamespace($MARC_NAMESPACE, 'marc', 1);
-	$marc_doc->documentElement->setNamespace($MARC_NAMESPACE);
-	return $marc_doc;
+    my $xml = shift;
+    my $marc_doc = XML::LibXML->new->parse_string($xml);
+    $marc_doc->documentElement->setNamespace($MARC_NAMESPACE, 'marc', 1);
+    $marc_doc->documentElement->setNamespace($MARC_NAMESPACE);
+    return $marc_doc;
 }
 
 
@@ -30,11 +30,11 @@ sub import_authority_record {
     
     my $marc_doc = marc_xml_to_doc($marc_xml);
     my $rec = Fieldmapper::authority::record_entry->new;
-	$rec->creator($e->requestor->id);
-	$rec->editor($e->requestor->id);
-	$rec->create_date('now');
-	$rec->edit_date('now');
-	$rec->marc($U->entityize($marc_doc->documentElement->toString));
+    $rec->creator($e->requestor->id);
+    $rec->editor($e->requestor->id);
+    $rec->create_date('now');
+    $rec->edit_date('now');
+    $rec->marc($U->entityize($marc_doc->documentElement->toString));
 
     $rec = $e->create_authority_record_entry($rec) or return $e->die_event;
 
@@ -42,7 +42,7 @@ sub import_authority_record {
     #my $ses = OpenSRF::AppSession->create('open-ils.ingest');
     #$ses->request('open-ils.ingest.full.authority.record', $recid);
 
-	return $rec;
+    return $rec;
 }
 
 
@@ -51,9 +51,9 @@ sub overlay_authority_record {
     
     my $marc_doc = marc_xml_to_doc($marc_xml);
     my $rec = $e->retrieve_authority_record_entry($rec_id) or return $e->die_event;
-	$rec->editor($e->requestor->id);
-	$rec->edit_date('now');
-	$rec->marc($U->entityize($marc_doc->documentElement->toString));
+    $rec->editor($e->requestor->id);
+    $rec->edit_date('now');
+    $rec->marc($U->entityize($marc_doc->documentElement->toString));
 
     $rec = $e->update_authority_record_entry($rec) or return $e->die_event;
 
@@ -61,7 +61,7 @@ sub overlay_authority_record {
     #my $ses = OpenSRF::AppSession->create('open-ils.ingest');
     #$ses->request('open-ils.ingest.full.authority.record', $recid);
 
-	return $rec;
+    return $rec;
 }
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/Authority.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/Authority.pm
index 696a446..6d86b80 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/Authority.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/Authority.pm
@@ -14,24 +14,24 @@ my $MARC_NAMESPACE = 'http://www.loc.gov/MARC21/slim';
 
 # generate a MARC XML document from a MARC XML string
 sub marc_xml_to_doc {
-	my $xml = shift;
-	my $marc_doc = XML::LibXML->new->parse_string($xml);
-	$marc_doc->documentElement->setNamespace($MARC_NAMESPACE, 'marc', 1);
-	$marc_doc->documentElement->setNamespace($MARC_NAMESPACE);
-	return $marc_doc;
+    my $xml = shift;
+    my $marc_doc = XML::LibXML->new->parse_string($xml);
+    $marc_doc->documentElement->setNamespace($MARC_NAMESPACE, 'marc', 1);
+    $marc_doc->documentElement->setNamespace($MARC_NAMESPACE);
+    return $marc_doc;
 }
 
 
 __PACKAGE__->register_method(
-	method	=> 'import_authority_record',
-	api_name	=> 'open-ils.cat.authority.record.import',
+    method  => 'import_authority_record',
+    api_name    => 'open-ils.cat.authority.record.import',
 );
 
 sub import_authority_record {
     my($self, $conn, $auth, $marc_xml, $source) = @_;
-	my $e = new_editor(authtoken=>$auth, xact=>1);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('CREATE_AUTHORITY_RECORD');
+    my $e = new_editor(authtoken=>$auth, xact=>1);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('CREATE_AUTHORITY_RECORD');
     my $rec = OpenILS::Application::Cat::AuthCommon->import_authority_record($marc_xml, $source);
     $e->commit unless $U->event_code($rec);
     return $rec;
@@ -120,15 +120,15 @@ MARCXML
 }
 
 __PACKAGE__->register_method(
-	method	=> 'overlay_authority_record',
-	api_name	=> 'open-ils.cat.authority.record.overlay',
+    method  => 'overlay_authority_record',
+    api_name    => 'open-ils.cat.authority.record.overlay',
 );
 
 sub overlay_authority_record {
     my($self, $conn, $auth, $rec_id, $marc_xml, $source) = @_;
-	my $e = new_editor(authtoken=>$auth, xact=>1);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('UPDATE_AUTHORITY_RECORD');
+    my $e = new_editor(authtoken=>$auth, xact=>1);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('UPDATE_AUTHORITY_RECORD');
     my $rec = OpenILS::Application::Cat::AuthCommon->overlay_authority_record($rec_id, $marc_xml, $source);
     $e->commit unless $U->event_code($rec);
     return $rec;
@@ -136,8 +136,8 @@ sub overlay_authority_record {
 }
 
 __PACKAGE__->register_method(
-	method	=> 'retrieve_authority_record',
-	api_name	=> 'open-ils.cat.authority.record.retrieve',
+    method  => 'retrieve_authority_record',
+    api_name    => 'open-ils.cat.authority.record.retrieve',
     signature => {
         desc => q/Retrieve an authority record entry/,
         params => [
@@ -148,16 +148,16 @@ __PACKAGE__->register_method(
 );
 sub retrieve_authority_record {
     my($self, $conn, $auth, $rec_id, $options) = @_;
-	my $e = new_editor(authtoken=>$auth);
-	return $e->die_event unless $e->checkauth;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->die_event unless $e->checkauth;
     my $rec = $e->retrieve_authority_record($rec_id) or return $e->event;
     $rec->clear_marc if $$options{clear_marc};
     return $rec;
 }
 
 __PACKAGE__->register_method(
-	method	=> 'batch_retrieve_authority_record',
-	api_name	=> 'open-ils.cat.authority.record.batch.retrieve',
+    method  => 'batch_retrieve_authority_record',
+    api_name    => 'open-ils.cat.authority.record.batch.retrieve',
     stream => 1,
     signature => {
         desc => q/Retrieve a set of authority record entry objects/,
@@ -169,8 +169,8 @@ __PACKAGE__->register_method(
 );
 sub batch_retrieve_authority_record {
     my($self, $conn, $auth, $rec_id_list, $options) = @_;
-	my $e = new_editor(authtoken=>$auth);
-	return $e->die_event unless $e->checkauth;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->die_event unless $e->checkauth;
     for my $rec_id (@$rec_id_list) {
         my $rec = $e->retrieve_authority_record($rec_id) or return $e->event;
         $rec->clear_marc if $$options{clear_marc};
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/BibCommon.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/BibCommon.pm
index 7f7ade7..ff2c3ab 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/BibCommon.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/BibCommon.pm
@@ -17,49 +17,49 @@ my $MARC_NAMESPACE = 'http://www.loc.gov/MARC21/slim';
 
 my $__bib_sources;
 sub bib_source_from_name {
-	my $name = shift;
-	$logger->debug("searching for bib source: $name");
+    my $name = shift;
+    $logger->debug("searching for bib source: $name");
 
-	fetch_bib_sources();
+    fetch_bib_sources();
 
-	my ($s) = grep { lc($_->source) eq lc($name) } @$__bib_sources;
+    my ($s) = grep { lc($_->source) eq lc($name) } @$__bib_sources;
 
-	return $s->id if $s;
-	return undef;
+    return $s->id if $s;
+    return undef;
 }
 
 sub fetch_bib_sources {
-	$__bib_sources = new_editor()->retrieve_all_config_bib_source()
-		unless $__bib_sources;
-	return $__bib_sources;
+    $__bib_sources = new_editor()->retrieve_all_config_bib_source()
+        unless $__bib_sources;
+    return $__bib_sources;
 }
 
 
 sub biblio_record_replace_marc  {
-	my($class, $e, $recid, $newxml, $source, $fixtcn, $override, $strip_grps) = @_;
+    my($class, $e, $recid, $newxml, $source, $fixtcn, $override, $strip_grps) = @_;
 
     $override = { all => 1 } if($override && !ref $override);
     $override = { all => 0 } if(!ref $override);
 
-	my $rec = $e->retrieve_biblio_record_entry($recid)
-		or return $e->die_event;
+    my $rec = $e->retrieve_biblio_record_entry($recid)
+        or return $e->die_event;
 
     # See if there is a different record in the database that has our TCN value
     # If we're not updating the TCN, all we care about it the marcdoc
     # XXX should .update even bother with the tcn_info if it's not going to replace it?
     # there is the potential for returning a TCN_EXISTS event, even though no replacement happens
 
-	my( $tcn, $tsource, $marcdoc, $evt);
+    my( $tcn, $tsource, $marcdoc, $evt);
 
     if($fixtcn or $override->{all} or $override->{events}) {
 
-	    ($tcn, $tsource, $marcdoc, $evt) = 
-		    _find_tcn_info($e, $newxml, $override, $recid);
+        ($tcn, $tsource, $marcdoc, $evt) = 
+            _find_tcn_info($e, $newxml, $override, $recid);
 
-	    return $evt if $evt;
+        return $evt if $evt;
 
-		$rec->tcn_value($tcn) if ($tcn);
-		$rec->tcn_source($tsource);
+        $rec->tcn_value($tcn) if ($tcn);
+        $rec->tcn_source($tsource);
 
     } else {
 
@@ -68,52 +68,52 @@ sub biblio_record_replace_marc  {
 
     my $marc = $U->strip_marc_fields($e, $marcdoc, $strip_grps);
 
-	$rec->source(bib_source_from_name($source)) if $source;
-	$rec->editor($e->requestor->id);
-	$rec->edit_date('now');
-	$rec->marc($marc);
-	$e->update_biblio_record_entry($rec) or return $e->die_event;
+    $rec->source(bib_source_from_name($source)) if $source;
+    $rec->editor($e->requestor->id);
+    $rec->edit_date('now');
+    $rec->marc($marc);
+    $e->update_biblio_record_entry($rec) or return $e->die_event;
 
-	return $rec;
+    return $rec;
 }
 
 sub biblio_record_xml_import {
-	my($class, $e, $xml, $source, $auto_tcn, $override, $strip_grps) = @_;
+    my($class, $e, $xml, $source, $auto_tcn, $override, $strip_grps) = @_;
 
     $override = { all => 1 } if($override && !ref $override);
     $override = { all => 0 } if(!ref $override);
 
-	my( $evt, $tcn, $tcn_source, $marcdoc );
+    my( $evt, $tcn, $tcn_source, $marcdoc );
 
     my $use_id = $e->retrieve_config_global_flag('cat.bib.use_id_for_tcn');
     $use_id = ($use_id and $U->is_true($use_id->enabled));
 
-	if( $auto_tcn or $use_id ) {
-		# auto_tcn forces a blank TCN value so the DB will have to generate one for us
-		$marcdoc = __make_marc_doc($xml);
-	} else {
-		( $tcn, $tcn_source, $marcdoc, $evt ) = _find_tcn_info($e, $xml, $override);
-		return $evt if $evt;
-	}
+    if( $auto_tcn or $use_id ) {
+        # auto_tcn forces a blank TCN value so the DB will have to generate one for us
+        $marcdoc = __make_marc_doc($xml);
+    } else {
+        ( $tcn, $tcn_source, $marcdoc, $evt ) = _find_tcn_info($e, $xml, $override);
+        return $evt if $evt;
+    }
 
-	# Silence warnings when _find_tcn_info() fails
-	$tcn ||= '';
-	$tcn_source ||= '';
-	$logger->info("user ".$e->requestor->id.
-		" creating new biblio entry with tcn=$tcn and tcn_source $tcn_source");
+    # Silence warnings when _find_tcn_info() fails
+    $tcn ||= '';
+    $tcn_source ||= '';
+    $logger->info("user ".$e->requestor->id.
+        " creating new biblio entry with tcn=$tcn and tcn_source $tcn_source");
 
     my $marc = $U->strip_marc_fields($e, $marcdoc, $strip_grps);
 
-	my $record = Fieldmapper::biblio::record_entry->new;
+    my $record = Fieldmapper::biblio::record_entry->new;
 
-	$record->source(bib_source_from_name($source)) if $source;
-	$record->tcn_source($tcn_source);
-	$record->tcn_value($tcn) if ($tcn);
-	$record->creator($e->requestor->id);
-	$record->editor($e->requestor->id);
-	$record->create_date('now');
-	$record->edit_date('now');
-	$record->marc($marc);
+    $record->source(bib_source_from_name($source)) if $source;
+    $record->tcn_source($tcn_source);
+    $record->tcn_value($tcn) if ($tcn);
+    $record->creator($e->requestor->id);
+    $record->editor($e->requestor->id);
+    $record->create_date('now');
+    $record->edit_date('now');
+    $record->marc($marc);
 
     $record = $e->create_biblio_record_entry($record) or return $e->die_event;
 
@@ -136,199 +136,199 @@ sub biblio_record_xml_import {
         }
     }
 
-	$logger->info("marc create/import created new record ".$record->id);
-	return $record;
+    $logger->info("marc create/import created new record ".$record->id);
+    return $record;
 }
 
 sub __make_marc_doc {
-	my $xml = shift;
-	my $marcxml = XML::LibXML->new->parse_string($xml);
-	$marcxml->documentElement->setNamespace($MARC_NAMESPACE, "marc", 1 );
-	$marcxml->documentElement->setNamespace($MARC_NAMESPACE);
-	__remove_empty_marc_nodes($marcxml);
-	return $marcxml;
+    my $xml = shift;
+    my $marcxml = XML::LibXML->new->parse_string($xml);
+    $marcxml->documentElement->setNamespace($MARC_NAMESPACE, "marc", 1 );
+    $marcxml->documentElement->setNamespace($MARC_NAMESPACE);
+    __remove_empty_marc_nodes($marcxml);
+    return $marcxml;
 }
 
 # remove empty control fields, subfields, and variable data fields, which
 # can creep in via less-than-correct imported MARC records or issues
 # with templates
 sub __remove_empty_marc_nodes {
-	my $marcxml = shift;
+    my $marcxml = shift;
 
-	__remove_if_childless($_) foreach $marcxml->documentElement->getElementsByTagNameNS($MARC_NAMESPACE, 'controlfield');
-	__remove_if_childless($_) foreach $marcxml->documentElement->getElementsByTagNameNS($MARC_NAMESPACE, 'subfield');
-	__remove_if_childless($_) foreach $marcxml->documentElement->getElementsByTagNameNS($MARC_NAMESPACE, 'datafield');
+    __remove_if_childless($_) foreach $marcxml->documentElement->getElementsByTagNameNS($MARC_NAMESPACE, 'controlfield');
+    __remove_if_childless($_) foreach $marcxml->documentElement->getElementsByTagNameNS($MARC_NAMESPACE, 'subfield');
+    __remove_if_childless($_) foreach $marcxml->documentElement->getElementsByTagNameNS($MARC_NAMESPACE, 'datafield');
 }
 
 sub __remove_if_childless {
-	my $node = shift;
-	my @children = $node->childNodes();
-	my $has_nonblank_children = 0;
-	# can do this more concisely by requiring XML::LibXML >= 1.70 and using nonBlankChildNodes()
-	foreach my $node ($node->childNodes()) {
-		if ($node->nodeType != XML::LibXML::XML_TEXT_NODE || $node->nodeValue !~ /^\s*$/) {
-			$has_nonblank_children = 1;
-			last;
-		}
-	}
-	$node->parentNode->removeChild($node) unless $has_nonblank_children;
+    my $node = shift;
+    my @children = $node->childNodes();
+    my $has_nonblank_children = 0;
+    # can do this more concisely by requiring XML::LibXML >= 1.70 and using nonBlankChildNodes()
+    foreach my $node ($node->childNodes()) {
+        if ($node->nodeType != XML::LibXML::XML_TEXT_NODE || $node->nodeValue !~ /^\s*$/) {
+            $has_nonblank_children = 1;
+            last;
+        }
+    }
+    $node->parentNode->removeChild($node) unless $has_nonblank_children;
 }
 
 sub _find_tcn_info { 
-	my $editor		= shift;
-	my $xml			= shift;
-	my $override	= shift;
-	my $existing_rec	= shift || 0;
+    my $editor      = shift;
+    my $xml         = shift;
+    my $override    = shift;
+    my $existing_rec    = shift || 0;
 
     $override = { all => 1 } if($override && !ref $override);
     $override = { all => 0 } if(!ref $override);
 
-	# parse the XML
-	my $marcxml = __make_marc_doc($xml);
+    # parse the XML
+    my $marcxml = __make_marc_doc($xml);
 
-	my $xpath = '//marc:controlfield[@tag="001"]';
-	my $tcn = $marcxml->documentElement->findvalue($xpath);
-	$logger->info("biblio import located 001 (tcn) value of $tcn");
+    my $xpath = '//marc:controlfield[@tag="001"]';
+    my $tcn = $marcxml->documentElement->findvalue($xpath);
+    $logger->info("biblio import located 001 (tcn) value of $tcn");
 
-	$xpath = '//marc:controlfield[@tag="003"]';
-	my $tcn_source = $marcxml->documentElement->findvalue($xpath) || "System Local";
+    $xpath = '//marc:controlfield[@tag="003"]';
+    my $tcn_source = $marcxml->documentElement->findvalue($xpath) || "System Local";
 
-	if(my $rec = _tcn_exists($editor, $tcn, $tcn_source, $existing_rec) ) {
+    if(my $rec = _tcn_exists($editor, $tcn, $tcn_source, $existing_rec) ) {
 
-		my $origtcn = $tcn;
-		$tcn = find_free_tcn( $marcxml, $editor, $existing_rec );
+        my $origtcn = $tcn;
+        $tcn = find_free_tcn( $marcxml, $editor, $existing_rec );
 
-		# if we're overriding, try to find a different TCN to use
-		if( $override->{all} || grep { $_ eq 'TCN_EXISTS' } @{$override->{events}} ) {
+        # if we're overriding, try to find a different TCN to use
+        if( $override->{all} || grep { $_ eq 'TCN_EXISTS' } @{$override->{events}} ) {
 
          # XXX Create ALLOW_ALT_TCN permission check support 
 
-			$logger->info("tcn value $tcn already exists, attempting to override");
-
-			if(!$tcn) {
-				return ( 
-					undef, 
-					undef, 
-					undef,
-					OpenILS::Event->new(
-						'OPEN_TCN_NOT_FOUND', 
-							payload => $marcxml->toString())
-					);
-			}
-
-		} else {
-
-			$logger->warn("tcn value $origtcn already exists in import/create");
-
-			# otherwise, return event
-			return ( 
-				undef, 
-				undef, 
-				undef,
-				OpenILS::Event->new( 
-					'TCN_EXISTS', payload => { 
-						dup_record	=> $rec, 
-						tcn			=> $origtcn,
-						new_tcn		=> $tcn
-						}
-					)
-				);
-		}
-	}
-
-	return ($tcn, $tcn_source, $marcxml);
+            $logger->info("tcn value $tcn already exists, attempting to override");
+
+            if(!$tcn) {
+                return ( 
+                    undef, 
+                    undef, 
+                    undef,
+                    OpenILS::Event->new(
+                        'OPEN_TCN_NOT_FOUND', 
+                            payload => $marcxml->toString())
+                    );
+            }
+
+        } else {
+
+            $logger->warn("tcn value $origtcn already exists in import/create");
+
+            # otherwise, return event
+            return ( 
+                undef, 
+                undef, 
+                undef,
+                OpenILS::Event->new( 
+                    'TCN_EXISTS', payload => { 
+                        dup_record  => $rec, 
+                        tcn         => $origtcn,
+                        new_tcn     => $tcn
+                        }
+                    )
+                );
+        }
+    }
+
+    return ($tcn, $tcn_source, $marcxml);
 }
 
 sub find_free_tcn {
 
-	my $marcxml = shift;
-	my $editor = shift;
-	my $existing_rec = shift;
+    my $marcxml = shift;
+    my $editor = shift;
+    my $existing_rec = shift;
 
-	my $xpath = '//marc:datafield[@tag="901"]/marc:subfield[@code="a"]';
-	my ($tcn) = $marcxml->documentElement->findvalue($xpath) =~ /(\w+)\s*$/o;
+    my $xpath = '//marc:datafield[@tag="901"]/marc:subfield[@code="a"]';
+    my ($tcn) = $marcxml->documentElement->findvalue($xpath) =~ /(\w+)\s*$/o;
 
     if (!$tcn) {
-	    $xpath = '//marc:datafield[@tag="039"]/marc:subfield[@code="a"]';
-	    ($tcn) = $marcxml->documentElement->findvalue($xpath) =~ /(\w+)\s*$/o;
+        $xpath = '//marc:datafield[@tag="039"]/marc:subfield[@code="a"]';
+        ($tcn) = $marcxml->documentElement->findvalue($xpath) =~ /(\w+)\s*$/o;
     }
 
-	$xpath = '//marc:datafield[@tag="901"]/marc:subfield[@code="b"]';
-	my ($tcn_source) = $marcxml->documentElement->findvalue($xpath);
+    $xpath = '//marc:datafield[@tag="901"]/marc:subfield[@code="b"]';
+    my ($tcn_source) = $marcxml->documentElement->findvalue($xpath);
     if (!$tcn_source) {
-	    $xpath = '//marc:datafield[@tag="039"]/marc:subfield[@code="b"]';
-    	$tcn_source = $marcxml->documentElement->findvalue($xpath) || "System Local";
+        $xpath = '//marc:datafield[@tag="039"]/marc:subfield[@code="b"]';
+        $tcn_source = $marcxml->documentElement->findvalue($xpath) || "System Local";
     }
 
-	if(_tcn_exists($editor, $tcn, $tcn_source, $existing_rec)) {
-		$tcn = undef;
-	}
-
-
-	if(!$tcn) {
-		$xpath = '//marc:datafield[@tag="020"]/marc:subfield[@code="a"]';
-		($tcn) = $marcxml->documentElement->findvalue($xpath) =~ /(\w+)\s*$/o;
-		$tcn_source = "ISBN";
-		if(_tcn_exists($editor, $tcn, $tcn_source, $existing_rec)) {$tcn = undef;}
-	}
-
-	if(!$tcn) { 
-		$xpath = '//marc:datafield[@tag="022"]/marc:subfield[@code="a"]';
-		($tcn) = $marcxml->documentElement->findvalue($xpath) =~ /(\w+)\s*$/o;
-		$tcn_source = "ISSN";
-		if(_tcn_exists($editor, $tcn, $tcn_source, $existing_rec)) {$tcn = undef;}
-	}
-
-	if(!$tcn) {
-		$xpath = '//marc:datafield[@tag="010"]';
-		($tcn) = $marcxml->documentElement->findvalue($xpath) =~ /(\w+)\s*$/o;
-		$tcn_source = "LCCN";
-		if(_tcn_exists($editor, $tcn, $tcn_source, $existing_rec)) {$tcn = undef;}
-	}
-
-	if(!$tcn) {
-		$xpath = '//marc:datafield[@tag="035"]/marc:subfield[@code="a"]';
-		($tcn) = $marcxml->documentElement->findvalue($xpath) =~ /(\w+)\s*$/o;
-		$tcn_source = "System Legacy";
-		if(_tcn_exists($editor, $tcn, $tcn_source, $existing_rec)) {$tcn = undef;}
-
-		if($tcn) {
-			$marcxml->documentElement->removeChild(
-				$marcxml->documentElement->findnodes( '//marc:datafield[@tag="035"]' )
-			);
-		}
-	}
-
-	return undef unless $tcn;
-	return $tcn;
+    if(_tcn_exists($editor, $tcn, $tcn_source, $existing_rec)) {
+        $tcn = undef;
+    }
+
+
+    if(!$tcn) {
+        $xpath = '//marc:datafield[@tag="020"]/marc:subfield[@code="a"]';
+        ($tcn) = $marcxml->documentElement->findvalue($xpath) =~ /(\w+)\s*$/o;
+        $tcn_source = "ISBN";
+        if(_tcn_exists($editor, $tcn, $tcn_source, $existing_rec)) {$tcn = undef;}
+    }
+
+    if(!$tcn) { 
+        $xpath = '//marc:datafield[@tag="022"]/marc:subfield[@code="a"]';
+        ($tcn) = $marcxml->documentElement->findvalue($xpath) =~ /(\w+)\s*$/o;
+        $tcn_source = "ISSN";
+        if(_tcn_exists($editor, $tcn, $tcn_source, $existing_rec)) {$tcn = undef;}
+    }
+
+    if(!$tcn) {
+        $xpath = '//marc:datafield[@tag="010"]';
+        ($tcn) = $marcxml->documentElement->findvalue($xpath) =~ /(\w+)\s*$/o;
+        $tcn_source = "LCCN";
+        if(_tcn_exists($editor, $tcn, $tcn_source, $existing_rec)) {$tcn = undef;}
+    }
+
+    if(!$tcn) {
+        $xpath = '//marc:datafield[@tag="035"]/marc:subfield[@code="a"]';
+        ($tcn) = $marcxml->documentElement->findvalue($xpath) =~ /(\w+)\s*$/o;
+        $tcn_source = "System Legacy";
+        if(_tcn_exists($editor, $tcn, $tcn_source, $existing_rec)) {$tcn = undef;}
+
+        if($tcn) {
+            $marcxml->documentElement->removeChild(
+                $marcxml->documentElement->findnodes( '//marc:datafield[@tag="035"]' )
+            );
+        }
+    }
+
+    return undef unless $tcn;
+    return $tcn;
 }
 
 
 
 sub _tcn_exists {
-	my $editor = shift;
-	my $tcn = shift;
-	my $source = shift;
-	my $existing_rec = shift || 0;
+    my $editor = shift;
+    my $tcn = shift;
+    my $source = shift;
+    my $existing_rec = shift || 0;
 
-	if(!$tcn) {return 0;}
+    if(!$tcn) {return 0;}
 
-	$logger->debug("tcn_exists search for tcn $tcn and source $source and id $existing_rec");
+    $logger->debug("tcn_exists search for tcn $tcn and source $source and id $existing_rec");
 
-	# XXX why does the source matter?
-#	my $req = $session->request(      
-#		{ tcn_value => $tcn, tcn_source => $source, deleted => 'f' } );
+    # XXX why does the source matter?
+#   my $req = $session->request(      
+#       { tcn_value => $tcn, tcn_source => $source, deleted => 'f' } );
 
     my $recs = $editor->search_biblio_record_entry(
         {tcn_value => $tcn, deleted => 'f', id => {'!=' => $existing_rec}}, {idlist =>1});
 
-	if(@$recs) {
-		$logger->debug("_tcn_exists is true for tcn : $tcn ($source)");
-		return $recs->[0];
-	}
+    if(@$recs) {
+        $logger->debug("_tcn_exists is true for tcn : $tcn ($source)");
+        return $recs->[0];
+    }
 
-	$logger->debug("_tcn_exists is false for tcn : $tcn ($source)");
-	return 0;
+    $logger->debug("_tcn_exists is false for tcn : $tcn ($source)");
+    return 0;
 }
 
 
@@ -389,27 +389,27 @@ sub delete_rec {
 # remaining volume on the record.  
 # ---------------------------------------------------------------------------
 sub title_is_empty {
-	my($class, $editor, $rid, $vol_id) = @_;
+    my($class, $editor, $rid, $vol_id) = @_;
 
-	return 0 if $rid == OILS_PRECAT_RECORD;
+    return 0 if $rid == OILS_PRECAT_RECORD;
 
-	my $cnlist = $editor->search_asset_call_number(
-		{ record => $rid, deleted => 'f' }, { idlist => 1 } );
+    my $cnlist = $editor->search_asset_call_number(
+        { record => $rid, deleted => 'f' }, { idlist => 1 } );
 
-	return 1 unless @$cnlist; # no attached volumes
+    return 1 unless @$cnlist; # no attached volumes
     return 0 if @$cnlist > 1; # multiple attached volumes
     return 0 unless $$cnlist[0] == $vol_id; # attached volume is not the context vol.
 
     # see if the sole remaining context volume has any attached copies
-	for my $cn (@$cnlist) {
-		my $copylist = $editor->search_asset_copy(
-			[
-				{ call_number => $cn, deleted => 'f' }, 
-				{ limit => 1 },
-			], { idlist => 1 });
-		return 0 if @$copylist; # false if we find any copies
-	}
-
-	return 1;
+    for my $cn (@$cnlist) {
+        my $copylist = $editor->search_asset_copy(
+            [
+                { call_number => $cn, deleted => 'f' }, 
+                { limit => 1 },
+            ], { idlist => 1 });
+        return 0 if @$copylist; # false if we find any copies
+    }
+
+    return 1;
 }
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/Merge.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/Merge.pm
index b354df6..699af6a 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/Merge.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Cat/Merge.pm
@@ -35,122 +35,122 @@ sub rgrep {
 # takes a master record and a list of 
 # sub-records to merge into the master record
 sub merge_records {
-	my( $editor, $master, $records ) = @_;
+    my( $editor, $master, $records ) = @_;
 
     # bib records are global objects, so no org context required.
     return (undef, $editor->die_event) 
         unless $editor->allowed('MERGE_BIB_RECORDS');
 
-	my $vol;
-	my $evt;
-
-	my %r = map { $_ => 1 } ($master, @$records); # unique the ids
-	my @recs = keys %r;
-
-	my $reqr = $editor->requestor;
-	$logger->activity("merge: user ".$reqr->id." merging bib records: @recs with master = $master");
-
-	# -----------------------------------------------------------
-	# collect all of the volumes, merge any with duplicate 
-	# labels, then move all of the volumes to the master record
-	# -----------------------------------------------------------
-	my @volumes;
-	for (@recs) {
-		my $vs = $editor->search_asset_call_number({record => $_, deleted=>'f'});
-		push( @volumes, @$vs );
-	}
-
-	$logger->info("merge: merge recovered ".scalar(@volumes)." total volumes");
-
-	my @trimmed;
-	# de-duplicate any volumes with the same label and owning_lib
-
-	my %seen_vols;
-
-	for my $v (@volumes) {
-		my $l = $v->label;
-		my $o = $v->owning_lib;
-
-		if($seen_vols{$v->id}) {
-			$logger->debug("merge: skipping ".$v->id." since it's already been merged");
-			next;
-		}
-
-		$seen_vols{$v->id} = 1;
-
-		$logger->debug("merge: [".$v->id."] looking for dupes with label $l and owning_lib $o");
-
-		my @dups;
-		for my $vv (@volumes) {
-			if( $vv->label eq $v->label and $vv->owning_lib == $v->owning_lib ) {
-				$logger->debug("merge: pushing dupe volume ".$vv->id) if @dups;
-				push( @dups, $vv );
-				$seen_vols{$vv->id} = 1;
-			} 
-		}
-
-		if( @dups == 1 ) {
-			$logger->debug("merge: pushing unique volume into trimmed volume set: ".$v->id);
-			push( @trimmed, @dups );
-
-		} else {
-			my($vol, $e) = merge_volumes($editor, \@dups);
-			return $e if $e;
-			$logger->debug("merge: pushing vol-merged volume into trimmed volume set: ".$vol->id);
-			push(@trimmed, $vol);
-		}
-	}
-
-	my $s = 'merge: trimmed volume set contains the following vols: ';
-	$s .= 'id = '.$_->id .' : record = '.$_->record.' | ' for @trimmed;
-	$logger->debug($s);
-
-	# make all the volumes point to the master record
-	my $stat;
-	for $vol (@trimmed) {
-		if( $vol->record ne $master ) {
-
-			$logger->debug("merge: moving volume ".
-				$vol->id." from record ".$vol->record. " to $master");
-
-			$vol->editor( $editor->requestor->id );
-			$vol->edit_date('now');
-			$vol->record( $master );
-			$editor->update_asset_call_number($vol)
-				or return $editor->die_event;
-		}
-	}
-
-	# cycle through and delete the non-master records
-	for my $rec (@recs) {
-
-		my $record = $editor->retrieve_biblio_record_entry($rec)
+    my $vol;
+    my $evt;
+
+    my %r = map { $_ => 1 } ($master, @$records); # unique the ids
+    my @recs = keys %r;
+
+    my $reqr = $editor->requestor;
+    $logger->activity("merge: user ".$reqr->id." merging bib records: @recs with master = $master");
+
+    # -----------------------------------------------------------
+    # collect all of the volumes, merge any with duplicate 
+    # labels, then move all of the volumes to the master record
+    # -----------------------------------------------------------
+    my @volumes;
+    for (@recs) {
+        my $vs = $editor->search_asset_call_number({record => $_, deleted=>'f'});
+        push( @volumes, @$vs );
+    }
+
+    $logger->info("merge: merge recovered ".scalar(@volumes)." total volumes");
+
+    my @trimmed;
+    # de-duplicate any volumes with the same label and owning_lib
+
+    my %seen_vols;
+
+    for my $v (@volumes) {
+        my $l = $v->label;
+        my $o = $v->owning_lib;
+
+        if($seen_vols{$v->id}) {
+            $logger->debug("merge: skipping ".$v->id." since it's already been merged");
+            next;
+        }
+
+        $seen_vols{$v->id} = 1;
+
+        $logger->debug("merge: [".$v->id."] looking for dupes with label $l and owning_lib $o");
+
+        my @dups;
+        for my $vv (@volumes) {
+            if( $vv->label eq $v->label and $vv->owning_lib == $v->owning_lib ) {
+                $logger->debug("merge: pushing dupe volume ".$vv->id) if @dups;
+                push( @dups, $vv );
+                $seen_vols{$vv->id} = 1;
+            } 
+        }
+
+        if( @dups == 1 ) {
+            $logger->debug("merge: pushing unique volume into trimmed volume set: ".$v->id);
+            push( @trimmed, @dups );
+
+        } else {
+            my($vol, $e) = merge_volumes($editor, \@dups);
+            return $e if $e;
+            $logger->debug("merge: pushing vol-merged volume into trimmed volume set: ".$vol->id);
+            push(@trimmed, $vol);
+        }
+    }
+
+    my $s = 'merge: trimmed volume set contains the following vols: ';
+    $s .= 'id = '.$_->id .' : record = '.$_->record.' | ' for @trimmed;
+    $logger->debug($s);
+
+    # make all the volumes point to the master record
+    my $stat;
+    for $vol (@trimmed) {
+        if( $vol->record ne $master ) {
+
+            $logger->debug("merge: moving volume ".
+                $vol->id." from record ".$vol->record. " to $master");
+
+            $vol->editor( $editor->requestor->id );
+            $vol->edit_date('now');
+            $vol->record( $master );
+            $editor->update_asset_call_number($vol)
+                or return $editor->die_event;
+        }
+    }
+
+    # cycle through and delete the non-master records
+    for my $rec (@recs) {
+
+        my $record = $editor->retrieve_biblio_record_entry($rec)
             or return $editor->die_event;
 
-		$logger->debug("merge: seeing if record $rec needs to be deleted or un-deleted");
-
-		if( $rec == $master ) {
-			# make sure the master record is not deleted
-			if( $U->is_true($record->deleted) ) {
-				$logger->info("merge: master record is marked as deleted...un-deleting.");
-				$record->deleted('f');
-				$record->editor($reqr->id);
-				$record->edit_date('now');
-				$editor->update_biblio_record_entry($record)
-					or return $editor->die_event;
-			}
-
-		} else {
-			$logger->info("merge: deleting record $rec");
-			$record->deleted('t');
-			$record->editor($reqr->id);
-			$record->edit_date('now');
-			$editor->update_biblio_record_entry($record)
-				or return $editor->die_event;
-		}
-	}
-
-	return undef;
+        $logger->debug("merge: seeing if record $rec needs to be deleted or un-deleted");
+
+        if( $rec == $master ) {
+            # make sure the master record is not deleted
+            if( $U->is_true($record->deleted) ) {
+                $logger->info("merge: master record is marked as deleted...un-deleting.");
+                $record->deleted('f');
+                $record->editor($reqr->id);
+                $record->edit_date('now');
+                $editor->update_biblio_record_entry($record)
+                    or return $editor->die_event;
+            }
+
+        } else {
+            $logger->info("merge: deleting record $rec");
+            $record->deleted('t');
+            $record->editor($reqr->id);
+            $record->edit_date('now');
+            $editor->update_biblio_record_entry($record)
+                or return $editor->die_event;
+        }
+    }
+
+    return undef;
 }
 
 
@@ -159,73 +159,73 @@ sub merge_records {
 # copies and moves all copies attached to the other volumes
 # into said volume.  all other volumes are deleted
 sub merge_volumes {
-	my( $editor, $volumes, $master ) = @_;
-	my %copies;
-	my $evt;
-
-	return ($$volumes[0]) if !$master and @$volumes == 1;
-
-	return ($$volumes[0]) if 
-		$master and @$volumes == 1 
-		and $master->id == $$volumes[0]->id;
-
-	$logger->debug("merge: fetching copies for volume list of size ".scalar(@$volumes));
-
-	# collect all of the copies attached to the selected volumes
-	for( @$volumes ) {
-		$copies{$_->id} = $editor->search_asset_copy({call_number=>$_->id, deleted=>'f'});
-		$logger->debug("merge: found ".scalar(@{$copies{$_->id}})." copies for volume ".$_->id);
-	}
-	
-	my $bigcn;
-	if( $master ) {
-
-		# the caller has chosen the master record
-		$bigcn = $master->id;
-		push( @$volumes, $master );
-
-	} else {
-
-		# find the CN with the most copies and make it the master CN
-		my $big = 0;
-		for my $cn (keys %copies) {
-			my $count = scalar(@{$copies{$cn}});
-			if( $count > $big ) {
-				$big = $count;
-				$bigcn = $cn;
-			}
-		}
-	}
-
-	$bigcn = $$volumes[0]->id unless $bigcn;
-
-	$logger->info("merge: merge using volume $bigcn as the master");
-
-	# now move all of the copies to the new volume
-	for my $cn (keys %copies) {
-		next if $cn == $bigcn;
-		for my $copy (@{$copies{$cn}}) {
-			$logger->debug("merge: setting call_number to $bigcn for copy ".$copy->id);
-			$copy->call_number($bigcn);
-			$copy->editor($editor->requestor->id);
-			$copy->edit_date('now');
-			$editor->update_asset_copy($copy) or return (undef, $editor->die_event);
-		}
-	}
-
-	for( @$volumes ) {
-		next if $_->id == $bigcn;
-		$logger->debug("merge: marking call_number as deleted: ".$_->id);
-		$_->deleted('t');
-		$_->editor($editor->requestor->id);
-		$_->edit_date('now');
-		$editor->update_asset_call_number($_) or return (undef, $editor->die_event);
+    my( $editor, $volumes, $master ) = @_;
+    my %copies;
+    my $evt;
+
+    return ($$volumes[0]) if !$master and @$volumes == 1;
+
+    return ($$volumes[0]) if 
+        $master and @$volumes == 1 
+        and $master->id == $$volumes[0]->id;
+
+    $logger->debug("merge: fetching copies for volume list of size ".scalar(@$volumes));
+
+    # collect all of the copies attached to the selected volumes
+    for( @$volumes ) {
+        $copies{$_->id} = $editor->search_asset_copy({call_number=>$_->id, deleted=>'f'});
+        $logger->debug("merge: found ".scalar(@{$copies{$_->id}})." copies for volume ".$_->id);
+    }
+    
+    my $bigcn;
+    if( $master ) {
+
+        # the caller has chosen the master record
+        $bigcn = $master->id;
+        push( @$volumes, $master );
+
+    } else {
+
+        # find the CN with the most copies and make it the master CN
+        my $big = 0;
+        for my $cn (keys %copies) {
+            my $count = scalar(@{$copies{$cn}});
+            if( $count > $big ) {
+                $big = $count;
+                $bigcn = $cn;
+            }
+        }
+    }
+
+    $bigcn = $$volumes[0]->id unless $bigcn;
+
+    $logger->info("merge: merge using volume $bigcn as the master");
+
+    # now move all of the copies to the new volume
+    for my $cn (keys %copies) {
+        next if $cn == $bigcn;
+        for my $copy (@{$copies{$cn}}) {
+            $logger->debug("merge: setting call_number to $bigcn for copy ".$copy->id);
+            $copy->call_number($bigcn);
+            $copy->editor($editor->requestor->id);
+            $copy->edit_date('now');
+            $editor->update_asset_copy($copy) or return (undef, $editor->die_event);
+        }
+    }
+
+    for( @$volumes ) {
+        next if $_->id == $bigcn;
+        $logger->debug("merge: marking call_number as deleted: ".$_->id);
+        $_->deleted('t');
+        $_->editor($editor->requestor->id);
+        $_->edit_date('now');
+        $editor->update_asset_call_number($_) or return (undef, $editor->die_event);
         merge_volume_holds($editor, $bigcn, $_->id);
-	}
+    }
 
-	my ($mvol) = grep { $_->id == $bigcn } @$volumes;
-	$logger->debug("merge: returning master volume ".$mvol->id);
-	return ($mvol);
+    my ($mvol) = grep { $_->id == $bigcn } @$volumes;
+    $logger->debug("merge: returning master volume ".$mvol->id);
+    return ($mvol);
 }
 
 sub merge_volume_holds {
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm
index 5549fec..94dbaf8 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm
@@ -42,36 +42,36 @@ my $holdcode    = "OpenILS::Application::Circ::Holds";
 # ------------------------------------------------------------------------
 
 sub initialize {
-	my $self = shift;
-	OpenILS::Application::Circ::Circulate->initialize();
+    my $self = shift;
+    OpenILS::Application::Circ::Circulate->initialize();
 }
 
 
 __PACKAGE__->register_method(
-	method => 'retrieve_circ',
-	authoritative	=> 1,
-	api_name	=> 'open-ils.circ.retrieve',
-	signature => q/
-		Retrieve a circ object by id
-		@param authtoken Login session key
-		@pararm circid The id of the circ object
-	/
+    method => 'retrieve_circ',
+    authoritative   => 1,
+    api_name    => 'open-ils.circ.retrieve',
+    signature => q/
+        Retrieve a circ object by id
+        @param authtoken Login session key
+        @pararm circid The id of the circ object
+    /
 );
 sub retrieve_circ {
-	my( $s, $c, $a, $i ) = @_;
-	my $e = new_editor(authtoken => $a);
-	return $e->event unless $e->checkauth;
-	my $circ = $e->retrieve_action_circulation($i) or return $e->event;
-	if( $e->requestor->id ne $circ->usr ) {
-		return $e->event unless $e->allowed('VIEW_CIRCULATIONS');
-	}
-	return $circ;
+    my( $s, $c, $a, $i ) = @_;
+    my $e = new_editor(authtoken => $a);
+    return $e->event unless $e->checkauth;
+    my $circ = $e->retrieve_action_circulation($i) or return $e->event;
+    if( $e->requestor->id ne $circ->usr ) {
+        return $e->event unless $e->allowed('VIEW_CIRCULATIONS');
+    }
+    return $circ;
 }
 
 
 __PACKAGE__->register_method(
-	method => 'fetch_circ_mods',
-	api_name => 'open-ils.circ.circ_modifier.retrieve.all');
+    method => 'fetch_circ_mods',
+    api_name => 'open-ils.circ.circ_modifier.retrieve.all');
 sub fetch_circ_mods {
     my($self, $conn, $args) = @_;
     my $mods = new_editor()->retrieve_all_config_circ_modifier;
@@ -98,21 +98,21 @@ sub ranged_billing_types {
 # Returns an array of {circ, record} hashes checked out by the user.
 # ------------------------------------------------------------------------
 __PACKAGE__->register_method(
-	method	=> "checkouts_by_user",
-	api_name	=> "open-ils.circ.actor.user.checked_out",
+    method  => "checkouts_by_user",
+    api_name    => "open-ils.circ.actor.user.checked_out",
     stream => 1,
-	NOTES		=> <<"	NOTES");
-	Returns a list of open circulations as a pile of objects.  Each object
-	contains the relevant copy, circ, and record
-	NOTES
+    NOTES        => <<"    NOTES");
+    Returns a list of open circulations as a pile of objects.  Each object
+    contains the relevant copy, circ, and record
+    NOTES
 
 sub checkouts_by_user {
-	my($self, $client, $auth, $user_id) = @_;
+    my($self, $client, $auth, $user_id) = @_;
 
     my $e = new_editor(authtoken=>$auth);
     return $e->event unless $e->checkauth;
 
-	my $circ_ids = $e->search_action_circulation(
+    my $circ_ids = $e->search_action_circulation(
         {   usr => $user_id,
             checkin_time => undef,
             '-or' => [
@@ -159,102 +159,102 @@ sub checkouts_by_user {
 
 
 __PACKAGE__->register_method(
-	method	=> "checkouts_by_user_slim",
-	api_name	=> "open-ils.circ.actor.user.checked_out.slim",
-	NOTES		=> <<"	NOTES");
-	Returns a list of open circulation objects
-	NOTES
+    method  => "checkouts_by_user_slim",
+    api_name    => "open-ils.circ.actor.user.checked_out.slim",
+    NOTES        => <<"    NOTES");
+    Returns a list of open circulation objects
+    NOTES
 
 # DEPRECAT ME?? XXX
 sub checkouts_by_user_slim {
-	my( $self, $client, $user_session, $user_id ) = @_;
+    my( $self, $client, $user_session, $user_id ) = @_;
 
-	my( $requestor, $target, $copy, $record, $evt );
+    my( $requestor, $target, $copy, $record, $evt );
 
-	( $requestor, $target, $evt ) = 
-		$apputils->checkses_requestor( $user_session, $user_id, 'VIEW_CIRCULATIONS');
-	return $evt if $evt;
+    ( $requestor, $target, $evt ) = 
+        $apputils->checkses_requestor( $user_session, $user_id, 'VIEW_CIRCULATIONS');
+    return $evt if $evt;
 
-	$logger->debug( 'User ' . $requestor->id . 
-		" retrieving checked out items for user " . $target->id );
+    $logger->debug( 'User ' . $requestor->id . 
+        " retrieving checked out items for user " . $target->id );
 
-	# XXX Make the call correct..
-	return $apputils->simplereq(
-		'open-ils.cstore',
-		"open-ils.cstore.direct.action.open_circulation.search.atomic", 
-		{ usr => $target->id, checkin_time => undef } );
-#		{ usr => $target->id } );
+    # XXX Make the call correct..
+    return $apputils->simplereq(
+        'open-ils.cstore',
+        "open-ils.cstore.direct.action.open_circulation.search.atomic", 
+        { usr => $target->id, checkin_time => undef } );
+#       { usr => $target->id } );
 }
 
 
 __PACKAGE__->register_method(
-	method	=> "checkouts_by_user_opac",
-	api_name	=> "open-ils.circ.actor.user.checked_out.opac",);
+    method  => "checkouts_by_user_opac",
+    api_name    => "open-ils.circ.actor.user.checked_out.opac",);
 
 # XXX Deprecate Me
 sub checkouts_by_user_opac {
-	my( $self, $client, $auth, $user_id ) = @_;
+    my( $self, $client, $auth, $user_id ) = @_;
 
-	my $e = OpenILS::Utils::Editor->new( authtoken => $auth );
-	return $e->event unless $e->checkauth;
-	$user_id ||= $e->requestor->id;
-	return $e->event unless 
-		my $patron = $e->retrieve_actor_user($user_id);
+    my $e = OpenILS::Utils::Editor->new( authtoken => $auth );
+    return $e->event unless $e->checkauth;
+    $user_id ||= $e->requestor->id;
+    return $e->event unless 
+        my $patron = $e->retrieve_actor_user($user_id);
 
-	my $data;
-	my $search = {usr => $user_id, stop_fines => undef};
+    my $data;
+    my $search = {usr => $user_id, stop_fines => undef};
 
-	if( $user_id ne $e->requestor->id ) {
-		$data = $e->search_action_circulation(
-			$search, {checkperm=>1, permorg=>$patron->home_ou})
-			or return $e->event;
+    if( $user_id ne $e->requestor->id ) {
+        $data = $e->search_action_circulation(
+            $search, {checkperm=>1, permorg=>$patron->home_ou})
+            or return $e->event;
 
-	} else {
-		$data = $e->search_action_circulation($search);
-	}
+    } else {
+        $data = $e->search_action_circulation($search);
+    }
 
-	return $data;
+    return $data;
 }
 
 
 __PACKAGE__->register_method(
-	method	=> "title_from_transaction",
-	api_name	=> "open-ils.circ.circ_transaction.find_title",
-	NOTES		=> <<"	NOTES");
-	Returns a mods object for the title that is linked to from the 
-	copy from the hold that created the given transaction
-	NOTES
+    method  => "title_from_transaction",
+    api_name    => "open-ils.circ.circ_transaction.find_title",
+    NOTES        => <<"    NOTES");
+    Returns a mods object for the title that is linked to from the 
+    copy from the hold that created the given transaction
+    NOTES
 
 sub title_from_transaction {
-	my( $self, $client, $login_session, $transactionid ) = @_;
+    my( $self, $client, $login_session, $transactionid ) = @_;
 
-	my( $user, $circ, $title, $evt );
+    my( $user, $circ, $title, $evt );
 
-	( $user, $evt ) = $apputils->checkses( $login_session );
-	return $evt if $evt;
+    ( $user, $evt ) = $apputils->checkses( $login_session );
+    return $evt if $evt;
 
-	( $circ, $evt ) = $apputils->fetch_circulation($transactionid);
-	return $evt if $evt;
-	
-	($title, $evt) = $apputils->fetch_record_by_copy($circ->target_copy);
-	return $evt if $evt;
+    ( $circ, $evt ) = $apputils->fetch_circulation($transactionid);
+    return $evt if $evt;
+    
+    ($title, $evt) = $apputils->fetch_record_by_copy($circ->target_copy);
+    return $evt if $evt;
 
-	return $apputils->record_to_mvr($title);
+    return $apputils->record_to_mvr($title);
 }
 
 __PACKAGE__->register_method(
-	method	=> "staff_age_to_lost",
-	api_name	=> "open-ils.circ.circulation.age_to_lost",
+    method  => "staff_age_to_lost",
+    api_name    => "open-ils.circ.circulation.age_to_lost",
     stream => 1,
-	signature	=> q/
+    signature   => q/
         This fires a circ.staff_age_to_lost Action-Trigger event against all
         overdue circulations in scope of the specified context library and
         user profile, which effectively marks the associated items as Lost.
         This is likely to be done at the end of a semester in an academic
         library, etc.
-		@param auth
-		@param args : circ_lib, user_profile
-	/
+        @param auth
+        @param args : circ_lib, user_profile
+    /
 );
 
 sub staff_age_to_lost {
@@ -331,13 +331,13 @@ sub staff_age_to_lost {
 
 
 __PACKAGE__->register_method(
-	method	=> "new_set_circ_lost",
-	api_name	=> "open-ils.circ.circulation.set_lost",
-	signature	=> q/
+    method  => "new_set_circ_lost",
+    api_name    => "open-ils.circ.circulation.set_lost",
+    signature   => q/
         Sets the copy and related open circulation to lost
-		@param auth
-		@param args : barcode
-	/
+        @param auth
+        @param args : barcode
+    /
 );
 
 
@@ -363,9 +363,9 @@ sub new_set_circ_lost {
 
 
 __PACKAGE__->register_method(
-	method	=> "set_circ_claims_returned",
-	api_name	=> "open-ils.circ.circulation.set_claims_returned",
-	signature => {
+    method  => "set_circ_claims_returned",
+    api_name    => "open-ils.circ.circulation.set_claims_returned",
+    signature => {
         desc => q/Sets the circ for a given item as claims returned
                 If a backdate is provided, overdue fines will be voided
                 back to the backdate/,
@@ -380,9 +380,9 @@ __PACKAGE__->register_method(
 );
 
 __PACKAGE__->register_method(
-	method	=> "set_circ_claims_returned",
-	api_name	=> "open-ils.circ.circulation.set_claims_returned.override",
-	signature => {
+    method  => "set_circ_claims_returned",
+    api_name    => "open-ils.circ.circulation.set_claims_returned.override",
+    signature => {
         desc => q/This adds support for overrideing the configured max 
                 claims returned amount. 
                 @see open-ils.circ.circulation.set_claims_returned./,
@@ -445,7 +445,7 @@ sub set_circ_claims_returned {
         or return $e->die_event;
 
     $circ->stop_fines(OILS_STOP_FINES_CLAIMSRETURNED);
-	$circ->stop_fines_time('now') unless $circ->stop_fines_time;
+    $circ->stop_fines_time('now') unless $circ->stop_fines_time;
 
     if( $backdate ) {
         $backdate = cleanse_ISO8601($backdate);
@@ -467,10 +467,10 @@ sub set_circ_claims_returned {
 
     # see if there is a configured post-claims-return copy status
     if(my $stat = $U->ou_ancestor_setting_value($circ->circ_lib, 'circ.claim_return.copy_status')) {
-	    $copy->status($stat);
-	    $copy->edit_date('now');
-	    $copy->editor($e->requestor->id);
-	    $e->update_asset_copy($copy) or return $e->die_event;
+        $copy->status($stat);
+        $copy->edit_date('now');
+        $copy->editor($e->requestor->id);
+        $e->update_asset_copy($copy) or return $e->die_event;
     }
 
     $e->commit;
@@ -479,9 +479,9 @@ sub set_circ_claims_returned {
 
 
 __PACKAGE__->register_method(
-	method	=> "post_checkin_backdate_circ",
-	api_name	=> "open-ils.circ.post_checkin_backdate",
-	signature => {
+    method  => "post_checkin_backdate_circ",
+    api_name    => "open-ils.circ.post_checkin_backdate",
+    signature => {
         desc => q/Back-date an already checked in circulation/,
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -493,10 +493,10 @@ __PACKAGE__->register_method(
 );
 
 __PACKAGE__->register_method(
-	method	=> "post_checkin_backdate_circ",
-	api_name	=> "open-ils.circ.post_checkin_backdate.batch",
+    method  => "post_checkin_backdate_circ",
+    api_name    => "open-ils.circ.post_checkin_backdate.batch",
     stream => 1,
-	signature => {
+    signature => {
         desc => q/@see open-ils.circ.post_checkin_backdate.  Batch mode/,
         params => [
             {desc => 'Authentication token', type => 'string'},
@@ -560,18 +560,18 @@ sub post_checkin_backdate_circ_impl {
 
 
 __PACKAGE__->register_method (
-	method		=> 'set_circ_due_date',
-	api_name		=> 'open-ils.circ.circulation.due_date.update',
-	signature	=> q/
-		Updates the due_date on the given circ
-		@param authtoken
-		@param circid The id of the circ to update
-		@param date The timestamp of the new due date
-	/
+    method      => 'set_circ_due_date',
+    api_name        => 'open-ils.circ.circulation.due_date.update',
+    signature   => q/
+        Updates the due_date on the given circ
+        @param authtoken
+        @param circid The id of the circ to update
+        @param date The timestamp of the new due date
+    /
 );
 
 sub set_circ_due_date {
-	my( $self, $conn, $auth, $circ_id, $date ) = @_;
+    my( $self, $conn, $auth, $circ_id, $date ) = @_;
 
     my $e = new_editor(xact=>1, authtoken=>$auth);
     return $e->die_event unless $e->checkauth;
@@ -579,7 +579,7 @@ sub set_circ_due_date {
         or return $e->die_event;
 
     return $e->die_event unless $e->allowed('CIRC_OVERRIDE_DUE_DATE', $circ->circ_lib);
-	$date = cleanse_ISO8601($date);
+    $date = cleanse_ISO8601($date);
 
     if (!(interval_to_seconds($circ->duration) % 86400)) { # duration is divisible by days
         my $original_date = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($circ->due_date));
@@ -587,7 +587,7 @@ sub set_circ_due_date {
         $date = cleanse_ISO8601( $new_date->ymd . 'T' . $original_date->strftime('%T%z') );
     }
 
-	$circ->due_date($date);
+    $circ->due_date($date);
     $e->update_action_circulation($circ) or return $e->die_event;
     $e->commit;
 
@@ -596,86 +596,86 @@ sub set_circ_due_date {
 
 
 __PACKAGE__->register_method(
-	method		=> "create_in_house_use",
-	api_name		=> 'open-ils.circ.in_house_use.create',
-	signature	=>	q/
-		Creates an in-house use action.
-		@param $authtoken The login session key
-		@param params A hash of params including
-			'location' The org unit id where the in-house use occurs
-			'copyid' The copy in question
-			'count' The number of in-house uses to apply to this copy
-		@return An array of id's representing the id's of the newly created
-		in-house use objects or an event on an error
-	/);
+    method      => "create_in_house_use",
+    api_name        => 'open-ils.circ.in_house_use.create',
+    signature   =>  q/
+        Creates an in-house use action.
+        @param $authtoken The login session key
+        @param params A hash of params including
+            'location' The org unit id where the in-house use occurs
+            'copyid' The copy in question
+            'count' The number of in-house uses to apply to this copy
+        @return An array of id's representing the id's of the newly created
+        in-house use objects or an event on an error
+    /);
 
 __PACKAGE__->register_method(
-	method		=> "create_in_house_use",
-	api_name		=> 'open-ils.circ.non_cat_in_house_use.create',
+    method      => "create_in_house_use",
+    api_name        => 'open-ils.circ.non_cat_in_house_use.create',
 );
 
 
 sub create_in_house_use {
-	my( $self, $client, $auth, $params ) = @_;
-
-	my( $evt, $copy );
-	my $org			= $params->{location};
-	my $copyid		= $params->{copyid};
-	my $count		= $params->{count} || 1;
-	my $nc_type		= $params->{non_cat_type};
-	my $use_time	= $params->{use_time} || 'now';
-
-	my $e = new_editor(xact=>1,authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed('CREATE_IN_HOUSE_USE');
-
-	my $non_cat = 1 if $self->api_name =~ /non_cat/;
-
-	unless( $non_cat ) {
-		if( $copyid ) {
-			$copy = $e->retrieve_asset_copy($copyid) or return $e->event;
-		} else {
-			$copy = $e->search_asset_copy({barcode=>$params->{barcode}, deleted => 'f'})->[0]
-				or return $e->event;
-			$copyid = $copy->id;
-		}
-	}
-
-	if( $use_time ne 'now' ) {
-		$use_time = cleanse_ISO8601($use_time);
-		$logger->debug("in_house_use setting use time to $use_time");
-	}
-
-	my @ids;
-	for(1..$count) {
-
-		my $ihu;
-		my $method;
-		my $cmeth;
-
-		if($non_cat) {
-			$ihu = Fieldmapper::action::non_cat_in_house_use->new;
-			$ihu->item_type($nc_type);
-			$method = 'open-ils.storage.direct.action.non_cat_in_house_use.create';
-			$cmeth = "create_action_non_cat_in_house_use";
-
-		} else {
-			$ihu = Fieldmapper::action::in_house_use->new;
-			$ihu->item($copyid);
-			$method = 'open-ils.storage.direct.action.in_house_use.create';
-			$cmeth = "create_action_in_house_use";
-		}
-
-		$ihu->staff($e->requestor->id);
-		$ihu->org_unit($org);
-		$ihu->use_time($use_time);
-
-		$ihu = $e->$cmeth($ihu) or return $e->event;
-		push( @ids, $ihu->id );
-	}
-
-	$e->commit;
-	return \@ids;
+    my( $self, $client, $auth, $params ) = @_;
+
+    my( $evt, $copy );
+    my $org         = $params->{location};
+    my $copyid      = $params->{copyid};
+    my $count       = $params->{count} || 1;
+    my $nc_type     = $params->{non_cat_type};
+    my $use_time    = $params->{use_time} || 'now';
+
+    my $e = new_editor(xact=>1,authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    return $e->event unless $e->allowed('CREATE_IN_HOUSE_USE');
+
+    my $non_cat = 1 if $self->api_name =~ /non_cat/;
+
+    unless( $non_cat ) {
+        if( $copyid ) {
+            $copy = $e->retrieve_asset_copy($copyid) or return $e->event;
+        } else {
+            $copy = $e->search_asset_copy({barcode=>$params->{barcode}, deleted => 'f'})->[0]
+                or return $e->event;
+            $copyid = $copy->id;
+        }
+    }
+
+    if( $use_time ne 'now' ) {
+        $use_time = cleanse_ISO8601($use_time);
+        $logger->debug("in_house_use setting use time to $use_time");
+    }
+
+    my @ids;
+    for(1..$count) {
+
+        my $ihu;
+        my $method;
+        my $cmeth;
+
+        if($non_cat) {
+            $ihu = Fieldmapper::action::non_cat_in_house_use->new;
+            $ihu->item_type($nc_type);
+            $method = 'open-ils.storage.direct.action.non_cat_in_house_use.create';
+            $cmeth = "create_action_non_cat_in_house_use";
+
+        } else {
+            $ihu = Fieldmapper::action::in_house_use->new;
+            $ihu->item($copyid);
+            $method = 'open-ils.storage.direct.action.in_house_use.create';
+            $cmeth = "create_action_in_house_use";
+        }
+
+        $ihu->staff($e->requestor->id);
+        $ihu->org_unit($org);
+        $ihu->use_time($use_time);
+
+        $ihu = $e->$cmeth($ihu) or return $e->event;
+        push( @ids, $ihu->id );
+    }
+
+    $e->commit;
+    return \@ids;
 }
 
 
@@ -683,22 +683,22 @@ sub create_in_house_use {
 
 
 __PACKAGE__->register_method(
-	method	=> "view_circs",
-	api_name	=> "open-ils.circ.copy_checkout_history.retrieve",
-	notes		=> q/
-		Retrieves the last X circs for a given copy
-		@param authtoken The login session key
-		@param copyid The copy to check
-		@param count How far to go back in the item history
-		@return An array of circ ids
-	/);
+    method  => "view_circs",
+    api_name    => "open-ils.circ.copy_checkout_history.retrieve",
+    notes       => q/
+        Retrieves the last X circs for a given copy
+        @param authtoken The login session key
+        @param copyid The copy to check
+        @param count How far to go back in the item history
+        @return An array of circ ids
+    /);
 
 # ----------------------------------------------------------------------
 # Returns $count most recent circs.  If count exceeds the configured 
 # max, use the configured max instead
 # ----------------------------------------------------------------------
 sub view_circs {
-	my( $self, $client, $authtoken, $copyid, $count ) = @_; 
+    my( $self, $client, $authtoken, $copyid, $count ) = @_; 
 
     my $e = new_editor(authtoken => $authtoken);
     return $e->event unless $e->checkauth;
@@ -732,278 +732,278 @@ sub view_circs {
 
 
 __PACKAGE__->register_method(
-	method	=> "circ_count",
-	api_name	=> "open-ils.circ.circulation.count",
-	notes		=> q/
-		Returns the number of times the item has circulated
-		@param copyid The copy to check
-	/);
+    method  => "circ_count",
+    api_name    => "open-ils.circ.circulation.count",
+    notes       => q/
+        Returns the number of times the item has circulated
+        @param copyid The copy to check
+    /);
 
 sub circ_count {
-	my( $self, $client, $copyid, $range ) = @_; 
-	my $e = OpenILS::Utils::Editor->new;
-	return $e->request('open-ils.storage.asset.copy.circ_count', $copyid, $range);
+    my( $self, $client, $copyid, $range ) = @_; 
+    my $e = OpenILS::Utils::Editor->new;
+    return $e->request('open-ils.storage.asset.copy.circ_count', $copyid, $range);
 }
 
 
 
 __PACKAGE__->register_method(
-	method		=> 'fetch_notes',
-	authoritative	=> 1,
-	api_name		=> 'open-ils.circ.copy_note.retrieve.all',
-	signature	=> q/
-		Returns an array of copy note objects.  
-		@param args A named hash of parameters including:
-			authtoken	: Required if viewing non-public notes
-			itemid		: The id of the item whose notes we want to retrieve
-			pub			: True if all the caller wants are public notes
-		@return An array of note objects
-	/);
+    method      => 'fetch_notes',
+    authoritative   => 1,
+    api_name        => 'open-ils.circ.copy_note.retrieve.all',
+    signature   => q/
+        Returns an array of copy note objects.  
+        @param args A named hash of parameters including:
+            authtoken   : Required if viewing non-public notes
+            itemid      : The id of the item whose notes we want to retrieve
+            pub         : True if all the caller wants are public notes
+        @return An array of note objects
+    /);
 
 __PACKAGE__->register_method(
-	method		=> 'fetch_notes',
-	api_name		=> 'open-ils.circ.call_number_note.retrieve.all',
-	signature	=> q/@see open-ils.circ.copy_note.retrieve.all/);
+    method      => 'fetch_notes',
+    api_name        => 'open-ils.circ.call_number_note.retrieve.all',
+    signature   => q/@see open-ils.circ.copy_note.retrieve.all/);
 
 __PACKAGE__->register_method(
-	method		=> 'fetch_notes',
-	api_name		=> 'open-ils.circ.title_note.retrieve.all',
-	signature	=> q/@see open-ils.circ.copy_note.retrieve.all/);
+    method      => 'fetch_notes',
+    api_name        => 'open-ils.circ.title_note.retrieve.all',
+    signature   => q/@see open-ils.circ.copy_note.retrieve.all/);
 
 
 # NOTE: VIEW_COPY/VOLUME/TITLE_NOTES perms should always be global
 sub fetch_notes {
-	my( $self, $connection, $args ) = @_;
-
-	my $id = $$args{itemid};
-	my $authtoken = $$args{authtoken};
-	my( $r, $evt);
-
-	if( $self->api_name =~ /copy/ ) {
-		if( $$args{pub} ) {
-			return $U->cstorereq(
-				'open-ils.cstore.direct.asset.copy_note.search.atomic',
-				{ owning_copy => $id, pub => 't' } );
-		} else {
-			( $r, $evt ) = $U->checksesperm($authtoken, 'VIEW_COPY_NOTES');
-			return $evt if $evt;
-			return $U->cstorereq(
-				'open-ils.cstore.direct.asset.copy_note.search.atomic', {owning_copy => $id} );
-		}
-
-	} elsif( $self->api_name =~ /call_number/ ) {
-		if( $$args{pub} ) {
-			return $U->cstorereq(
-				'open-ils.cstore.direct.asset.call_number_note.search.atomic',
-				{ call_number => $id, pub => 't' } );
-		} else {
-			( $r, $evt ) = $U->checksesperm($authtoken, 'VIEW_VOLUME_NOTES');
-			return $evt if $evt;
-			return $U->cstorereq(
-				'open-ils.cstore.direct.asset.call_number_note.search.atomic', { call_number => $id } );
-		}
-
-	} elsif( $self->api_name =~ /title/ ) {
-		if( $$args{pub} ) {
-			return $U->cstorereq(
-				'open-ils.cstore.direct.bilbio.record_note.search.atomic',
-				{ record => $id, pub => 't' } );
-		} else {
-			( $r, $evt ) = $U->checksesperm($authtoken, 'VIEW_TITLE_NOTES');
-			return $evt if $evt;
-			return $U->cstorereq(
-				'open-ils.cstore.direct.biblio.record_note.search.atomic', { record => $id } );
-		}
-	}
-
-	return undef;
+    my( $self, $connection, $args ) = @_;
+
+    my $id = $$args{itemid};
+    my $authtoken = $$args{authtoken};
+    my( $r, $evt);
+
+    if( $self->api_name =~ /copy/ ) {
+        if( $$args{pub} ) {
+            return $U->cstorereq(
+                'open-ils.cstore.direct.asset.copy_note.search.atomic',
+                { owning_copy => $id, pub => 't' } );
+        } else {
+            ( $r, $evt ) = $U->checksesperm($authtoken, 'VIEW_COPY_NOTES');
+            return $evt if $evt;
+            return $U->cstorereq(
+                'open-ils.cstore.direct.asset.copy_note.search.atomic', {owning_copy => $id} );
+        }
+
+    } elsif( $self->api_name =~ /call_number/ ) {
+        if( $$args{pub} ) {
+            return $U->cstorereq(
+                'open-ils.cstore.direct.asset.call_number_note.search.atomic',
+                { call_number => $id, pub => 't' } );
+        } else {
+            ( $r, $evt ) = $U->checksesperm($authtoken, 'VIEW_VOLUME_NOTES');
+            return $evt if $evt;
+            return $U->cstorereq(
+                'open-ils.cstore.direct.asset.call_number_note.search.atomic', { call_number => $id } );
+        }
+
+    } elsif( $self->api_name =~ /title/ ) {
+        if( $$args{pub} ) {
+            return $U->cstorereq(
+                'open-ils.cstore.direct.bilbio.record_note.search.atomic',
+                { record => $id, pub => 't' } );
+        } else {
+            ( $r, $evt ) = $U->checksesperm($authtoken, 'VIEW_TITLE_NOTES');
+            return $evt if $evt;
+            return $U->cstorereq(
+                'open-ils.cstore.direct.biblio.record_note.search.atomic', { record => $id } );
+        }
+    }
+
+    return undef;
 }
 
 __PACKAGE__->register_method(
-	method	=> 'has_notes',
-	api_name	=> 'open-ils.circ.copy.has_notes');
+    method  => 'has_notes',
+    api_name    => 'open-ils.circ.copy.has_notes');
 __PACKAGE__->register_method(
-	method	=> 'has_notes',
-	api_name	=> 'open-ils.circ.call_number.has_notes');
+    method  => 'has_notes',
+    api_name    => 'open-ils.circ.call_number.has_notes');
 __PACKAGE__->register_method(
-	method	=> 'has_notes',
-	api_name	=> 'open-ils.circ.title.has_notes');
+    method  => 'has_notes',
+    api_name    => 'open-ils.circ.title.has_notes');
 
 
 sub has_notes {
-	my( $self, $conn, $authtoken, $id ) = @_;
-	my $editor = OpenILS::Utils::Editor->new(authtoken => $authtoken);
-	return $editor->event unless $editor->checkauth;
+    my( $self, $conn, $authtoken, $id ) = @_;
+    my $editor = OpenILS::Utils::Editor->new(authtoken => $authtoken);
+    return $editor->event unless $editor->checkauth;
 
-	my $n = $editor->search_asset_copy_note(
-		{owning_copy=>$id}, {idlist=>1}) if $self->api_name =~ /copy/;
+    my $n = $editor->search_asset_copy_note(
+        {owning_copy=>$id}, {idlist=>1}) if $self->api_name =~ /copy/;
 
-	$n = $editor->search_asset_call_number_note(
-		{call_number=>$id}, {idlist=>1}) if $self->api_name =~ /call_number/;
+    $n = $editor->search_asset_call_number_note(
+        {call_number=>$id}, {idlist=>1}) if $self->api_name =~ /call_number/;
 
-	$n = $editor->search_biblio_record_note(
-		{record=>$id}, {idlist=>1}) if $self->api_name =~ /title/;
+    $n = $editor->search_biblio_record_note(
+        {record=>$id}, {idlist=>1}) if $self->api_name =~ /title/;
 
-	return scalar @$n;
+    return scalar @$n;
 }
 
 
 
 __PACKAGE__->register_method(
-	method		=> 'create_copy_note',
-	api_name		=> 'open-ils.circ.copy_note.create',
-	signature	=> q/
-		Creates a new copy note
-		@param authtoken The login session key
-		@param note	The note object to create
-		@return The id of the new note object
-	/);
+    method      => 'create_copy_note',
+    api_name        => 'open-ils.circ.copy_note.create',
+    signature   => q/
+        Creates a new copy note
+        @param authtoken The login session key
+        @param note The note object to create
+        @return The id of the new note object
+    /);
 
 sub create_copy_note {
-	my( $self, $connection, $authtoken, $note ) = @_;
-
-	my $e = new_editor(xact=>1, authtoken=>$authtoken);
-	return $e->event unless $e->checkauth;
-	my $copy = $e->retrieve_asset_copy(
-		[
-			$note->owning_copy,
-			{	flesh => 1,
-				flesh_fields => { 'acp' => ['call_number'] }
-			}
-		]
-	);
-
-	return $e->event unless 
-		$e->allowed('CREATE_COPY_NOTE', $copy->call_number->owning_lib);
-
-	$note->create_date('now');
-	$note->creator($e->requestor->id);
-	$note->pub( ($U->is_true($note->pub)) ? 't' : 'f' );
-	$note->clear_id;
-
-	$e->create_asset_copy_note($note) or return $e->event;
-	$e->commit;
-	return $note->id;
+    my( $self, $connection, $authtoken, $note ) = @_;
+
+    my $e = new_editor(xact=>1, authtoken=>$authtoken);
+    return $e->event unless $e->checkauth;
+    my $copy = $e->retrieve_asset_copy(
+        [
+            $note->owning_copy,
+            {   flesh => 1,
+                flesh_fields => { 'acp' => ['call_number'] }
+            }
+        ]
+    );
+
+    return $e->event unless 
+        $e->allowed('CREATE_COPY_NOTE', $copy->call_number->owning_lib);
+
+    $note->create_date('now');
+    $note->creator($e->requestor->id);
+    $note->pub( ($U->is_true($note->pub)) ? 't' : 'f' );
+    $note->clear_id;
+
+    $e->create_asset_copy_note($note) or return $e->event;
+    $e->commit;
+    return $note->id;
 }
 
 
 __PACKAGE__->register_method(
-	method		=> 'delete_copy_note',
-	api_name		=>	'open-ils.circ.copy_note.delete',
-	signature	=> q/
-		Deletes an existing copy note
-		@param authtoken The login session key
-		@param noteid The id of the note to delete
-		@return 1 on success - Event otherwise.
-		/);
+    method      => 'delete_copy_note',
+    api_name        =>  'open-ils.circ.copy_note.delete',
+    signature   => q/
+        Deletes an existing copy note
+        @param authtoken The login session key
+        @param noteid The id of the note to delete
+        @return 1 on success - Event otherwise.
+        /);
 sub delete_copy_note {
-	my( $self, $conn, $authtoken, $noteid ) = @_;
-
-	my $e = new_editor(xact=>1, authtoken=>$authtoken);
-	return $e->die_event unless $e->checkauth;
-
-	my $note = $e->retrieve_asset_copy_note([
-		$noteid,
-		{ flesh => 2,
-			flesh_fields => {
-				'acpn' => [ 'owning_copy' ],
-				'acp' => [ 'call_number' ],
-			}
-		}
-	]) or return $e->die_event;
-
-	if( $note->creator ne $e->requestor->id ) {
-		return $e->die_event unless 
-			$e->allowed('DELETE_COPY_NOTE', $note->owning_copy->call_number->owning_lib);
-	}
-
-	$e->delete_asset_copy_note($note) or return $e->die_event;
-	$e->commit;
-	return 1;
+    my( $self, $conn, $authtoken, $noteid ) = @_;
+
+    my $e = new_editor(xact=>1, authtoken=>$authtoken);
+    return $e->die_event unless $e->checkauth;
+
+    my $note = $e->retrieve_asset_copy_note([
+        $noteid,
+        { flesh => 2,
+            flesh_fields => {
+                'acpn' => [ 'owning_copy' ],
+                'acp' => [ 'call_number' ],
+            }
+        }
+    ]) or return $e->die_event;
+
+    if( $note->creator ne $e->requestor->id ) {
+        return $e->die_event unless 
+            $e->allowed('DELETE_COPY_NOTE', $note->owning_copy->call_number->owning_lib);
+    }
+
+    $e->delete_asset_copy_note($note) or return $e->die_event;
+    $e->commit;
+    return 1;
 }
 
 
 __PACKAGE__->register_method(
-	method => 'age_hold_rules',
-	api_name	=>  'open-ils.circ.config.rules.age_hold_protect.retrieve.all',
+    method => 'age_hold_rules',
+    api_name    =>  'open-ils.circ.config.rules.age_hold_protect.retrieve.all',
 );
 
 sub age_hold_rules {
-	my( $self, $conn ) = @_;
-	return new_editor()->retrieve_all_config_rules_age_hold_protect();
+    my( $self, $conn ) = @_;
+    return new_editor()->retrieve_all_config_rules_age_hold_protect();
 }
 
 
 
 __PACKAGE__->register_method(
-	method => 'copy_details_barcode',
+    method => 'copy_details_barcode',
     authoritative => 1,
-	api_name => 'open-ils.circ.copy_details.retrieve.barcode');
+    api_name => 'open-ils.circ.copy_details.retrieve.barcode');
 sub copy_details_barcode {
-	my( $self, $conn, $auth, $barcode ) = @_;
+    my( $self, $conn, $auth, $barcode ) = @_;
     my $e = new_editor();
     my $cid = $e->search_asset_copy({barcode=>$barcode, deleted=>'f'}, {idlist=>1})->[0];
     return $e->event unless $cid;
-	return copy_details( $self, $conn, $auth, $cid );
+    return copy_details( $self, $conn, $auth, $cid );
 }
 
 
 __PACKAGE__->register_method(
-	method => 'copy_details',
-	api_name => 'open-ils.circ.copy_details.retrieve');
+    method => 'copy_details',
+    api_name => 'open-ils.circ.copy_details.retrieve');
 
 sub copy_details {
-	my( $self, $conn, $auth, $copy_id ) = @_;
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-
-	my $flesh = { flesh => 1 };
-
-	my $copy = $e->retrieve_asset_copy(
-		[
-			$copy_id,
-			{
-				flesh => 2,
-				flesh_fields => {
-					acp => ['call_number','parts','peer_record_maps'],
-					acn => ['record','prefix','suffix','label_class']
-				}
-			}
-		]) or return $e->event;
-
-
-	# De-flesh the copy for backwards compatibility
-	my $mvr;
-	my $vol = $copy->call_number;
-	if( ref $vol ) {
-		$copy->call_number($vol->id);
-		my $record = $vol->record;
-		if( ref $record ) {
-			$vol->record($record->id);
-			$mvr = $U->record_to_mvr($record);
-		}
-	}
-
-
-	my $hold = $e->search_action_hold_request(
-		{ 
-			current_copy		=> $copy_id, 
-			capture_time		=> { "!=" => undef },
-			fulfillment_time	=> undef,
-			cancel_time			=> undef,
-		}
-	)->[0];
-
-	OpenILS::Application::Circ::Holds::flesh_hold_transits([$hold]) if $hold;
-
-	my $transit = $e->search_action_transit_copy(
-		{ target_copy => $copy_id, dest_recv_time => undef } )->[0];
-
-	# find the latest circ, open or closed
-	my $circ = $e->search_action_circulation(
-		[
-			{ target_copy => $copy_id },
-			{ 
+    my( $self, $conn, $auth, $copy_id ) = @_;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+
+    my $flesh = { flesh => 1 };
+
+    my $copy = $e->retrieve_asset_copy(
+        [
+            $copy_id,
+            {
+                flesh => 2,
+                flesh_fields => {
+                    acp => ['call_number','parts','peer_record_maps'],
+                    acn => ['record','prefix','suffix','label_class']
+                }
+            }
+        ]) or return $e->event;
+
+
+    # De-flesh the copy for backwards compatibility
+    my $mvr;
+    my $vol = $copy->call_number;
+    if( ref $vol ) {
+        $copy->call_number($vol->id);
+        my $record = $vol->record;
+        if( ref $record ) {
+            $vol->record($record->id);
+            $mvr = $U->record_to_mvr($record);
+        }
+    }
+
+
+    my $hold = $e->search_action_hold_request(
+        { 
+            current_copy        => $copy_id, 
+            capture_time        => { "!=" => undef },
+            fulfillment_time    => undef,
+            cancel_time         => undef,
+        }
+    )->[0];
+
+    OpenILS::Application::Circ::Holds::flesh_hold_transits([$hold]) if $hold;
+
+    my $transit = $e->search_action_transit_copy(
+        { target_copy => $copy_id, dest_recv_time => undef } )->[0];
+
+    # find the latest circ, open or closed
+    my $circ = $e->search_action_circulation(
+        [
+            { target_copy => $copy_id },
+            { 
                 flesh => 1,
                 flesh_fields => {
                     circ => [
@@ -1017,108 +1017,108 @@ sub copy_details {
                 order_by => { circ => 'xact_start desc' }, 
                 limit => 1 
             }
-		]
-	)->[0];
-
-
-	return {
-		copy		=> $copy,
-		hold		=> $hold,
-		transit	=> $transit,
-		circ		=> $circ,
-		volume	=> $vol,
-		mvr		=> $mvr,
-	};
+        ]
+    )->[0];
+
+
+    return {
+        copy        => $copy,
+        hold        => $hold,
+        transit => $transit,
+        circ        => $circ,
+        volume  => $vol,
+        mvr     => $mvr,
+    };
 }
 
 
 
 
 __PACKAGE__->register_method(
-	method => 'mark_item',
-	api_name => 'open-ils.circ.mark_item_damaged',
-	signature	=> q/
-		Changes the status of a copy to "damaged". Requires MARK_ITEM_DAMAGED permission.
-		@param authtoken The login session key
-		@param copy_id The ID of the copy to mark as damaged
-		@return 1 on success - Event otherwise.
-		/
+    method => 'mark_item',
+    api_name => 'open-ils.circ.mark_item_damaged',
+    signature   => q/
+        Changes the status of a copy to "damaged". Requires MARK_ITEM_DAMAGED permission.
+        @param authtoken The login session key
+        @param copy_id The ID of the copy to mark as damaged
+        @return 1 on success - Event otherwise.
+        /
 );
 __PACKAGE__->register_method(
-	method => 'mark_item',
-	api_name => 'open-ils.circ.mark_item_missing',
-	signature	=> q/
-		Changes the status of a copy to "missing". Requires MARK_ITEM_MISSING permission.
-		@param authtoken The login session key
-		@param copy_id The ID of the copy to mark as missing 
-		@return 1 on success - Event otherwise.
-		/
+    method => 'mark_item',
+    api_name => 'open-ils.circ.mark_item_missing',
+    signature   => q/
+        Changes the status of a copy to "missing". Requires MARK_ITEM_MISSING permission.
+        @param authtoken The login session key
+        @param copy_id The ID of the copy to mark as missing 
+        @return 1 on success - Event otherwise.
+        /
 );
 __PACKAGE__->register_method(
-	method => 'mark_item',
-	api_name => 'open-ils.circ.mark_item_bindery',
-	signature	=> q/
-		Changes the status of a copy to "bindery". Requires MARK_ITEM_BINDERY permission.
-		@param authtoken The login session key
-		@param copy_id The ID of the copy to mark as bindery
-		@return 1 on success - Event otherwise.
-		/
+    method => 'mark_item',
+    api_name => 'open-ils.circ.mark_item_bindery',
+    signature   => q/
+        Changes the status of a copy to "bindery". Requires MARK_ITEM_BINDERY permission.
+        @param authtoken The login session key
+        @param copy_id The ID of the copy to mark as bindery
+        @return 1 on success - Event otherwise.
+        /
 );
 __PACKAGE__->register_method(
-	method => 'mark_item',
-	api_name => 'open-ils.circ.mark_item_on_order',
-	signature	=> q/
-		Changes the status of a copy to "on order". Requires MARK_ITEM_ON_ORDER permission.
-		@param authtoken The login session key
-		@param copy_id The ID of the copy to mark as on order 
-		@return 1 on success - Event otherwise.
-		/
+    method => 'mark_item',
+    api_name => 'open-ils.circ.mark_item_on_order',
+    signature   => q/
+        Changes the status of a copy to "on order". Requires MARK_ITEM_ON_ORDER permission.
+        @param authtoken The login session key
+        @param copy_id The ID of the copy to mark as on order 
+        @return 1 on success - Event otherwise.
+        /
 );
 __PACKAGE__->register_method(
-	method => 'mark_item',
-	api_name => 'open-ils.circ.mark_item_ill',
-	signature	=> q/
-		Changes the status of a copy to "inter-library loan". Requires MARK_ITEM_ILL permission.
-		@param authtoken The login session key
-		@param copy_id The ID of the copy to mark as inter-library loan
-		@return 1 on success - Event otherwise.
-		/
+    method => 'mark_item',
+    api_name => 'open-ils.circ.mark_item_ill',
+    signature   => q/
+        Changes the status of a copy to "inter-library loan". Requires MARK_ITEM_ILL permission.
+        @param authtoken The login session key
+        @param copy_id The ID of the copy to mark as inter-library loan
+        @return 1 on success - Event otherwise.
+        /
 );
 __PACKAGE__->register_method(
-	method => 'mark_item',
-	api_name => 'open-ils.circ.mark_item_cataloging',
-	signature	=> q/
-		Changes the status of a copy to "cataloging". Requires MARK_ITEM_CATALOGING permission.
-		@param authtoken The login session key
-		@param copy_id The ID of the copy to mark as cataloging 
-		@return 1 on success - Event otherwise.
-		/
+    method => 'mark_item',
+    api_name => 'open-ils.circ.mark_item_cataloging',
+    signature   => q/
+        Changes the status of a copy to "cataloging". Requires MARK_ITEM_CATALOGING permission.
+        @param authtoken The login session key
+        @param copy_id The ID of the copy to mark as cataloging 
+        @return 1 on success - Event otherwise.
+        /
 );
 __PACKAGE__->register_method(
-	method => 'mark_item',
-	api_name => 'open-ils.circ.mark_item_reserves',
-	signature	=> q/
-		Changes the status of a copy to "reserves". Requires MARK_ITEM_RESERVES permission.
-		@param authtoken The login session key
-		@param copy_id The ID of the copy to mark as reserves
-		@return 1 on success - Event otherwise.
-		/
+    method => 'mark_item',
+    api_name => 'open-ils.circ.mark_item_reserves',
+    signature   => q/
+        Changes the status of a copy to "reserves". Requires MARK_ITEM_RESERVES permission.
+        @param authtoken The login session key
+        @param copy_id The ID of the copy to mark as reserves
+        @return 1 on success - Event otherwise.
+        /
 );
 __PACKAGE__->register_method(
-	method => 'mark_item',
-	api_name => 'open-ils.circ.mark_item_discard',
-	signature	=> q/
-		Changes the status of a copy to "discard". Requires MARK_ITEM_DISCARD permission.
-		@param authtoken The login session key
-		@param copy_id The ID of the copy to mark as discard
-		@return 1 on success - Event otherwise.
-		/
+    method => 'mark_item',
+    api_name => 'open-ils.circ.mark_item_discard',
+    signature   => q/
+        Changes the status of a copy to "discard". Requires MARK_ITEM_DISCARD permission.
+        @param authtoken The login session key
+        @param copy_id The ID of the copy to mark as discard
+        @return 1 on success - Event otherwise.
+        /
 );
 
 sub mark_item {
-	my( $self, $conn, $auth, $copy_id, $args ) = @_;
-	my $e = new_editor(authtoken=>$auth, xact =>1);
-	return $e->die_event unless $e->checkauth;
+    my( $self, $conn, $auth, $copy_id, $args ) = @_;
+    my $e = new_editor(authtoken=>$auth, xact =>1);
+    return $e->die_event unless $e->checkauth;
     $args ||= {};
 
     my $copy = $e->retrieve_asset_copy([
@@ -1130,64 +1130,64 @@ sub mark_item {
         ($copy->call_number->id == OILS_PRECAT_CALL_NUMBER) ? 
             $copy->circ_lib : $copy->call_number->owning_lib;
 
-	my $perm = 'MARK_ITEM_MISSING';
-	my $stat = OILS_COPY_STATUS_MISSING;
+    my $perm = 'MARK_ITEM_MISSING';
+    my $stat = OILS_COPY_STATUS_MISSING;
 
-	if( $self->api_name =~ /damaged/ ) {
-		$perm = 'MARK_ITEM_DAMAGED';
-		$stat = OILS_COPY_STATUS_DAMAGED;
+    if( $self->api_name =~ /damaged/ ) {
+        $perm = 'MARK_ITEM_DAMAGED';
+        $stat = OILS_COPY_STATUS_DAMAGED;
         my $evt = handle_mark_damaged($e, $copy, $owning_lib, $args);
         return $evt if $evt;
 
-	} elsif ( $self->api_name =~ /bindery/ ) {
-		$perm = 'MARK_ITEM_BINDERY';
-		$stat = OILS_COPY_STATUS_BINDERY;
-	} elsif ( $self->api_name =~ /on_order/ ) {
-		$perm = 'MARK_ITEM_ON_ORDER';
-		$stat = OILS_COPY_STATUS_ON_ORDER;
-	} elsif ( $self->api_name =~ /ill/ ) {
-		$perm = 'MARK_ITEM_ILL';
-		$stat = OILS_COPY_STATUS_ILL;
-	} elsif ( $self->api_name =~ /cataloging/ ) {
-		$perm = 'MARK_ITEM_CATALOGING';
-		$stat = OILS_COPY_STATUS_CATALOGING;
-	} elsif ( $self->api_name =~ /reserves/ ) {
-		$perm = 'MARK_ITEM_RESERVES';
-		$stat = OILS_COPY_STATUS_RESERVES;
-	} elsif ( $self->api_name =~ /discard/ ) {
-		$perm = 'MARK_ITEM_DISCARD';
-		$stat = OILS_COPY_STATUS_DISCARD;
-	}
+    } elsif ( $self->api_name =~ /bindery/ ) {
+        $perm = 'MARK_ITEM_BINDERY';
+        $stat = OILS_COPY_STATUS_BINDERY;
+    } elsif ( $self->api_name =~ /on_order/ ) {
+        $perm = 'MARK_ITEM_ON_ORDER';
+        $stat = OILS_COPY_STATUS_ON_ORDER;
+    } elsif ( $self->api_name =~ /ill/ ) {
+        $perm = 'MARK_ITEM_ILL';
+        $stat = OILS_COPY_STATUS_ILL;
+    } elsif ( $self->api_name =~ /cataloging/ ) {
+        $perm = 'MARK_ITEM_CATALOGING';
+        $stat = OILS_COPY_STATUS_CATALOGING;
+    } elsif ( $self->api_name =~ /reserves/ ) {
+        $perm = 'MARK_ITEM_RESERVES';
+        $stat = OILS_COPY_STATUS_RESERVES;
+    } elsif ( $self->api_name =~ /discard/ ) {
+        $perm = 'MARK_ITEM_DISCARD';
+        $stat = OILS_COPY_STATUS_DISCARD;
+    }
 
     # caller may proceed if either perm is allowed
     return $e->die_event unless $e->allowed([$perm, 'UPDATE_COPY'], $owning_lib);
 
-	$copy->status($stat);
-	$copy->edit_date('now');
-	$copy->editor($e->requestor->id);
+    $copy->status($stat);
+    $copy->edit_date('now');
+    $copy->editor($e->requestor->id);
 
-	$e->update_asset_copy($copy) or return $e->die_event;
+    $e->update_asset_copy($copy) or return $e->die_event;
 
-	my $holds = $e->search_action_hold_request(
-		{ 
-			current_copy => $copy->id,
-			fulfillment_time => undef,
-			cancel_time => undef,
-		}
-	);
+    my $holds = $e->search_action_hold_request(
+        { 
+            current_copy => $copy->id,
+            fulfillment_time => undef,
+            cancel_time => undef,
+        }
+    );
 
-	$e->commit;
+    $e->commit;
 
-	if( $self->api_name =~ /damaged/ ) {
+    if( $self->api_name =~ /damaged/ ) {
         # now that we've committed the changes, create related A/T events
         my $ses = OpenSRF::AppSession->create('open-ils.trigger');
         $ses->request('open-ils.trigger.event.autocreate', 'damaged', $copy, $owning_lib);
     }
 
-	$logger->debug("resetting holds that target the marked copy");
-	OpenILS::Application::Circ::Holds->_reset_hold($e->requestor, $_) for @$holds;
+    $logger->debug("resetting holds that target the marked copy");
+    OpenILS::Application::Circ::Holds->_reset_hold($e->requestor, $_) for @$holds;
 
-	return 1;
+    return 1;
 }
 
 sub handle_mark_damaged {
@@ -1288,7 +1288,7 @@ sub handle_mark_damaged {
 __PACKAGE__->register_method(
     method => 'mark_item_missing_pieces',
     api_name => 'open-ils.circ.mark_item_missing_pieces',
-    signature	=> q/
+    signature   => q/
         Changes the status of a copy to "damaged" or to a custom status based on the 
         circ.missing_pieces.copy_status org unit setting. Requires MARK_ITEM_MISSING_PIECES
         permission.
@@ -1299,12 +1299,12 @@ __PACKAGE__->register_method(
 );
 
 sub mark_item_missing_pieces {
-	my( $self, $conn, $auth, $copy_id, $args ) = @_;
+    my( $self, $conn, $auth, $copy_id, $args ) = @_;
     ### FIXME: We're starting a transaction here, but we're doing a lot of things outside of the transaction
     ### FIXME: Even better, we're going to use two transactions, the first to affect pertinent holds before checkout can
 
-	my $e2 = new_editor(authtoken=>$auth, xact =>1);
-	return $e2->die_event unless $e2->checkauth;
+    my $e2 = new_editor(authtoken=>$auth, xact =>1);
+    return $e2->die_event unless $e2->checkauth;
     $args ||= {};
 
     my $copy = $e2->retrieve_asset_copy([
@@ -1332,24 +1332,24 @@ sub mark_item_missing_pieces {
         return OpenILS::Event->new('ACTION_CIRCULATION_NOT_FOUND',{'copy'=>$copy});
     }
 
-	my $holds = $e2->search_action_hold_request(
-		{ 
-			current_copy => $copy->id,
-			fulfillment_time => undef,
-			cancel_time => undef,
-		}
-	);
+    my $holds = $e2->search_action_hold_request(
+        { 
+            current_copy => $copy->id,
+            fulfillment_time => undef,
+            cancel_time => undef,
+        }
+    );
 
     $logger->debug("resetting holds that target the marked copy");
     OpenILS::Application::Circ::Holds->_reset_hold($e2->requestor, $_) for @$holds;
 
     
-	if (! $e2->commit) {
+    if (! $e2->commit) {
         return $e2->die_event;
     }
 
-	my $e = new_editor(authtoken=>$auth, xact =>1);
-	return $e->die_event unless $e->checkauth;
+    my $e = new_editor(authtoken=>$auth, xact =>1);
+    return $e->die_event unless $e->checkauth;
 
     if (! $circ->checkin_time) { # if circ active, attempt renew
         my ($res) = $self->method_lookup('open-ils.circ.renew')->run($e->authtoken,{'copy_id'=>$circ->target_copy});
@@ -1406,13 +1406,13 @@ sub mark_item_missing_pieces {
     my $ses = OpenSRF::AppSession->create('open-ils.trigger');
     $ses->request('open-ils.trigger.event.autocreate', 'missing_pieces', $copy, $owning_lib);
 
-	$copy->status($stat);
-	$copy->edit_date('now');
-	$copy->editor($e->requestor->id);
+    $copy->status($stat);
+    $copy->edit_date('now');
+    $copy->editor($e->requestor->id);
 
-	$e->update_asset_copy($copy) or return $e->die_event;
+    $e->update_asset_copy($copy) or return $e->die_event;
 
-	if ($e->commit) {
+    if ($e->commit) {
 
         my $ses = OpenSRF::AppSession->create('open-ils.trigger');
         $ses->request('open-ils.trigger.event.autocreate', 'circ.missing_pieces', $circ, $circ->circ_lib);
@@ -1437,92 +1437,92 @@ sub mark_item_missing_pieces {
 
 # ----------------------------------------------------------------------
 __PACKAGE__->register_method(
-	method => 'magic_fetch',
-	api_name => 'open-ils.agent.fetch'
+    method => 'magic_fetch',
+    api_name => 'open-ils.agent.fetch'
 );
 
 my @FETCH_ALLOWED = qw/ aou aout acp acn bre /;
 
 sub magic_fetch {
-	my( $self, $conn, $auth, $args ) = @_;
-	my $e = new_editor( authtoken => $auth );
-	return $e->event unless $e->checkauth;
+    my( $self, $conn, $auth, $args ) = @_;
+    my $e = new_editor( authtoken => $auth );
+    return $e->event unless $e->checkauth;
 
-	my $hint = $$args{hint};
-	my $id	= $$args{id};
+    my $hint = $$args{hint};
+    my $id  = $$args{id};
 
-	# Is the call allowed to fetch this type of object?
-	return undef unless grep { $_ eq $hint } @FETCH_ALLOWED;
+    # Is the call allowed to fetch this type of object?
+    return undef unless grep { $_ eq $hint } @FETCH_ALLOWED;
 
-	# Find the class the implements the given hint
-	my ($class) = grep { 
-		$Fieldmapper::fieldmap->{$_}{hint} eq $hint } Fieldmapper->classes;
+    # Find the class the implements the given hint
+    my ($class) = grep { 
+        $Fieldmapper::fieldmap->{$_}{hint} eq $hint } Fieldmapper->classes;
 
-	$class =~ s/Fieldmapper:://og;
-	$class =~ s/::/_/og;
-	my $method = "retrieve_$class";
+    $class =~ s/Fieldmapper:://og;
+    $class =~ s/::/_/og;
+    my $method = "retrieve_$class";
 
-	my $obj = $e->$method($id) or return $e->event;
-	return $obj;
+    my $obj = $e->$method($id) or return $e->event;
+    return $obj;
 }
 # ----------------------------------------------------------------------
 
 
 __PACKAGE__->register_method(
-	method	=> "fleshed_circ_retrieve",
+    method  => "fleshed_circ_retrieve",
     authoritative => 1,
-	api_name	=> "open-ils.circ.fleshed.retrieve",);
+    api_name    => "open-ils.circ.fleshed.retrieve",);
 
 sub fleshed_circ_retrieve {
-	my( $self, $client, $id ) = @_;
-	my $e = new_editor();
-	my $circ = $e->retrieve_action_circulation(
-		[
-			$id,
-			{ 
-				flesh				=> 4,
-				flesh_fields	=> { 
-					circ => [ qw/ target_copy / ],
-					acp => [ qw/ location status stat_cat_entry_copy_maps notes age_protect call_number parts / ],
-					ascecm => [ qw/ stat_cat stat_cat_entry / ],
-					acn => [ qw/ record / ],
-				}
-			}
-		]
-	) or return $e->event;
-	
-	my $copy = $circ->target_copy;
-	my $vol = $copy->call_number;
-	my $rec = $circ->target_copy->call_number->record;
-
-	$vol->record($rec->id);
-	$copy->call_number($vol->id);
-	$circ->target_copy($copy->id);
-
-	my $mvr;
-
-	if( $rec->id == OILS_PRECAT_RECORD ) {
-		$rec = undef;
-		$vol = undef;
-	} else { 
-		$mvr = $U->record_to_mvr($rec);
-		$rec->marc(''); # drop the bulky marc data
-	}
-
-	return {
-		circ => $circ,
-		copy => $copy,
-		volume => $vol,
-		record => $rec,
-		mvr => $mvr,
-	};
+    my( $self, $client, $id ) = @_;
+    my $e = new_editor();
+    my $circ = $e->retrieve_action_circulation(
+        [
+            $id,
+            { 
+                flesh               => 4,
+                flesh_fields    => { 
+                    circ => [ qw/ target_copy / ],
+                    acp => [ qw/ location status stat_cat_entry_copy_maps notes age_protect call_number parts / ],
+                    ascecm => [ qw/ stat_cat stat_cat_entry / ],
+                    acn => [ qw/ record / ],
+                }
+            }
+        ]
+    ) or return $e->event;
+    
+    my $copy = $circ->target_copy;
+    my $vol = $copy->call_number;
+    my $rec = $circ->target_copy->call_number->record;
+
+    $vol->record($rec->id);
+    $copy->call_number($vol->id);
+    $circ->target_copy($copy->id);
+
+    my $mvr;
+
+    if( $rec->id == OILS_PRECAT_RECORD ) {
+        $rec = undef;
+        $vol = undef;
+    } else { 
+        $mvr = $U->record_to_mvr($rec);
+        $rec->marc(''); # drop the bulky marc data
+    }
+
+    return {
+        circ => $circ,
+        copy => $copy,
+        volume => $vol,
+        record => $rec,
+        mvr => $mvr,
+    };
 }
 
 
 
 __PACKAGE__->register_method(
-	method	=> "test_batch_circ_events",
-	api_name	=> "open-ils.circ.trigger_event_by_def_and_barcode.fire"
+    method  => "test_batch_circ_events",
+    api_name    => "open-ils.circ.trigger_event_by_def_and_barcode.fire"
 );
 
 #  method for testing the behavior of a given event definition
@@ -1530,7 +1530,7 @@ sub test_batch_circ_events {
     my($self, $conn, $auth, $event_def, $barcode) = @_;
 
     my $e = new_editor(authtoken => $auth);
-	return $e->event unless $e->checkauth;
+    return $e->event unless $e->checkauth;
     return $e->event unless $e->allowed('VIEW_CIRCULATIONS');
 
     my $copy = $e->search_asset_copy({barcode => $barcode, deleted => 'f'})->[0]
@@ -1547,8 +1547,8 @@ sub test_batch_circ_events {
 
 
 __PACKAGE__->register_method(
-	method	=> "fire_circ_events", 
-	api_name	=> "open-ils.circ.fire_circ_trigger_events",
+    method  => "fire_circ_events", 
+    api_name    => "open-ils.circ.fire_circ_trigger_events",
     signature => q/
         General event def runner for circ objects.  If no event def ID
         is provided, the hook will be used to find the best event_def
@@ -1557,8 +1557,8 @@ __PACKAGE__->register_method(
 );
 
 __PACKAGE__->register_method(
-	method	=> "fire_circ_events", 
-	api_name	=> "open-ils.circ.fire_hold_trigger_events",
+    method  => "fire_circ_events", 
+    api_name    => "open-ils.circ.fire_hold_trigger_events",
     signature => q/
         General event def runner for hold objects.  If no event def ID
         is provided, the hook will be used to find the best event_def
@@ -1567,8 +1567,8 @@ __PACKAGE__->register_method(
 );
 
 __PACKAGE__->register_method(
-	method	=> "fire_circ_events", 
-	api_name	=> "open-ils.circ.fire_user_trigger_events",
+    method  => "fire_circ_events", 
+    api_name    => "open-ils.circ.fire_user_trigger_events",
     signature => q/
         General event def runner for user objects.  If no event def ID
         is provided, the hook will be used to find the best event_def
@@ -1581,7 +1581,7 @@ sub fire_circ_events {
     my($self, $conn, $auth, $org_id, $event_def, $hook, $granularity, $target_ids, $user_data) = @_;
 
     my $e = new_editor(authtoken => $auth, xact => 1);
-	return $e->event unless $e->checkauth;
+    return $e->event unless $e->checkauth;
 
     my $targets;
 
@@ -1605,10 +1605,10 @@ sub fire_circ_events {
 }
 
 __PACKAGE__->register_method(
-	method	=> "user_payments_list",
-	api_name	=> "open-ils.circ.user_payments.filtered.batch",
+    method  => "user_payments_list",
+    api_name    => "open-ils.circ.user_payments.filtered.batch",
     stream => 1,
-	signature => {
+    signature => {
         desc => q/Returns a fleshed, date-limited set of all payments a user
                 has made.  By default, ordered by payment date.  Optionally
                 ordered by other columns in the top-level "mp" object/,
@@ -1681,10 +1681,10 @@ sub user_payments_list {
 
 
 __PACKAGE__->register_method(
-	method	=> "retrieve_circ_chain",
-	api_name	=> "open-ils.circ.renewal_chain.retrieve_by_circ",
+    method  => "retrieve_circ_chain",
+    api_name    => "open-ils.circ.renewal_chain.retrieve_by_circ",
     stream => 1,
-	signature => {
+    signature => {
         desc => q/Given a circulation, this returns all circulation objects
                 that are part of the same chain of renewals./,
         params => [
@@ -1696,9 +1696,9 @@ __PACKAGE__->register_method(
 );
 
 __PACKAGE__->register_method(
-	method	=> "retrieve_circ_chain",
-	api_name	=> "open-ils.circ.renewal_chain.retrieve_by_circ.summary",
-	signature => {
+    method  => "retrieve_circ_chain",
+    api_name    => "open-ils.circ.renewal_chain.retrieve_by_circ.summary",
+    signature => {
         desc => q/Given a circulation, this returns a summary of the circulation objects
                 that are part of the same chain of renewals./,
         params => [
@@ -1714,7 +1714,7 @@ sub retrieve_circ_chain {
 
     my $e = new_editor(authtoken => $auth);
     return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed('VIEW_CIRCULATIONS');
+    return $e->event unless $e->allowed('VIEW_CIRCULATIONS');
 
     if($self->api_name =~ /summary/) {
         return $U->create_circ_chain_summary($e, $circ_id);
@@ -1734,10 +1734,10 @@ sub retrieve_circ_chain {
 }
 
 __PACKAGE__->register_method(
-	method	=> "retrieve_prev_circ_chain",
-	api_name	=> "open-ils.circ.prev_renewal_chain.retrieve_by_circ",
+    method  => "retrieve_prev_circ_chain",
+    api_name    => "open-ils.circ.prev_renewal_chain.retrieve_by_circ",
     stream => 1,
-	signature => {
+    signature => {
         desc => q/Given a circulation, this returns all circulation objects
                 that are part of the previous chain of renewals./,
         params => [
@@ -1749,9 +1749,9 @@ __PACKAGE__->register_method(
 );
 
 __PACKAGE__->register_method(
-	method	=> "retrieve_prev_circ_chain",
-	api_name	=> "open-ils.circ.prev_renewal_chain.retrieve_by_circ.summary",
-	signature => {
+    method  => "retrieve_prev_circ_chain",
+    api_name    => "open-ils.circ.prev_renewal_chain.retrieve_by_circ.summary",
+    signature => {
         desc => q/Given a circulation, this returns a summary of the circulation objects
                 that are part of the previous chain of renewals./,
         params => [
@@ -1767,7 +1767,7 @@ sub retrieve_prev_circ_chain {
 
     my $e = new_editor(authtoken => $auth);
     return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed('VIEW_CIRCULATIONS');
+    return $e->event unless $e->allowed('VIEW_CIRCULATIONS');
 
     if($self->api_name =~ /summary/) {
         my $first_circ = $e->json_query({from => ['action.circ_chain', $circ_id]})->[0];
@@ -1821,9 +1821,9 @@ sub retrieve_prev_circ_chain {
 
 
 __PACKAGE__->register_method(
-	method	=> "get_copy_due_date",
-	api_name	=> "open-ils.circ.copy.due_date.retrieve",
-	signature => {
+    method  => "get_copy_due_date",
+    api_name    => "open-ils.circ.copy.due_date.retrieve",
+    signature => {
         desc => q/
             Given a copy ID, returns the due date for the copy if it's 
             currently circulating.  Otherwise, returns null.  Note, this is a public 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm
index 79df59d..03dc4d5 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CircCommon.pm
@@ -69,7 +69,7 @@ sub void_overdues {
         $e->update_money_billing($bill) or return $e->die_event;
     }
 
-	return undef;
+    return undef;
 }
 
 
@@ -96,22 +96,22 @@ sub reopen_xact {
 
 
 sub create_bill {
-	my($class, $e, $amount, $btype, $type, $xactid, $note) = @_;
+    my($class, $e, $amount, $btype, $type, $xactid, $note) = @_;
 
-	$logger->info("The system is charging $amount [$type] on xact $xactid");
+    $logger->info("The system is charging $amount [$type] on xact $xactid");
     $note ||= 'SYSTEM GENERATED';
 
     # -----------------------------------------------------------------
     # now create the billing
-	my $bill = Fieldmapper::money::billing->new;
-	$bill->xact($xactid);
-	$bill->amount($amount);
-	$bill->billing_type($type); 
-	$bill->btype($btype); 
-	$bill->note($note);
+    my $bill = Fieldmapper::money::billing->new;
+    $bill->xact($xactid);
+    $bill->amount($amount);
+    $bill->billing_type($type); 
+    $bill->btype($btype); 
+    $bill->note($note);
     $e->create_money_billing($bill) or return $e->die_event;
 
-	return undef;
+    return undef;
 }
 
 sub extend_grace_period {
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
index ef2b361..d44727b 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
@@ -703,15 +703,15 @@ sub mk_env {
     # --------------------------------------------------------------------------
     unless($self->is_noncat) {
         my $copy;
-	    if($self->copy_id) {
-		    $copy = $e->retrieve_asset_copy(
-			    [$self->copy_id, $MK_ENV_FLESH ]) or return $e->event;
+        if($self->copy_id) {
+            $copy = $e->retrieve_asset_copy(
+                [$self->copy_id, $MK_ENV_FLESH ]) or return $e->event;
     
-	    } elsif( $self->copy_barcode ) {
+        } elsif( $self->copy_barcode ) {
     
-		    $copy = $e->search_asset_copy(
-			    [{barcode => $self->copy_barcode, deleted => 'f'}, $MK_ENV_FLESH ])->[0];
-	    } elsif( $self->reservation ) {
+            $copy = $e->search_asset_copy(
+                [{barcode => $self->copy_barcode, deleted => 'f'}, $MK_ENV_FLESH ])->[0];
+        } elsif( $self->reservation ) {
             my $res = $e->json_query(
                 {
                     "select" => {"acp" => ["id"]},
@@ -758,23 +758,23 @@ sub mk_env {
     # Grab the patron
     # --------------------------------------------------------------------------
     my $patron;
-	my $flesh = {
-		flesh => 1,
-		flesh_fields => {au => [ qw/ card / ]}
-	};
+    my $flesh = {
+        flesh => 1,
+        flesh_fields => {au => [ qw/ card / ]}
+    };
 
-	if( $self->patron_id ) {
-		$patron = $e->retrieve_actor_user([$self->patron_id, $flesh])
-			or return $self->bail_on_events(OpenILS::Event->new('ACTOR_USER_NOT_FOUND'));
+    if( $self->patron_id ) {
+        $patron = $e->retrieve_actor_user([$self->patron_id, $flesh])
+            or return $self->bail_on_events(OpenILS::Event->new('ACTOR_USER_NOT_FOUND'));
 
-	} elsif( $self->patron_barcode ) {
+    } elsif( $self->patron_barcode ) {
 
-		# note: throwing ACTOR_USER_NOT_FOUND instead of ACTOR_CARD_NOT_FOUND is intentional
-		my $card = $e->search_actor_card({barcode => $self->patron_barcode})->[0] 
-			or return $self->bail_on_events(OpenILS::Event->new('ACTOR_USER_NOT_FOUND'));
+        # note: throwing ACTOR_USER_NOT_FOUND instead of ACTOR_CARD_NOT_FOUND is intentional
+        my $card = $e->search_actor_card({barcode => $self->patron_barcode})->[0] 
+            or return $self->bail_on_events(OpenILS::Event->new('ACTOR_USER_NOT_FOUND'));
 
-		$patron = $e->retrieve_actor_user($card->usr)
-			or return $self->bail_on_events(OpenILS::Event->new('ACTOR_USER_NOT_FOUND'));
+        $patron = $e->retrieve_actor_user($card->usr)
+            or return $self->bail_on_events(OpenILS::Event->new('ACTOR_USER_NOT_FOUND'));
 
         # Use the card we looked up, not the patron's primary, for card active checks
         $patron->card($card);
@@ -805,16 +805,16 @@ sub mk_env {
         # Check for inactivity and patron reg. expiration
 
         $self->bail_on_events(OpenILS::Event->new('PATRON_INACTIVE'))
-			unless $U->is_true($patron->active);
-	
-		$self->bail_on_events(OpenILS::Event->new('PATRON_CARD_INACTIVE'))
-			unless $U->is_true($patron->card->active);
-	
-		my $expire = DateTime::Format::ISO8601->new->parse_datetime(
-			cleanse_ISO8601($patron->expire_date));
-	
-		$self->bail_on_events(OpenILS::Event->new('PATRON_ACCOUNT_EXPIRED'))
-			if( CORE::time > $expire->epoch ) ;
+            unless $U->is_true($patron->active);
+    
+        $self->bail_on_events(OpenILS::Event->new('PATRON_CARD_INACTIVE'))
+            unless $U->is_true($patron->card->active);
+    
+        my $expire = DateTime::Format::ISO8601->new->parse_datetime(
+            cleanse_ISO8601($patron->expire_date));
+    
+        $self->bail_on_events(OpenILS::Event->new('PATRON_ACCOUNT_EXPIRED'))
+            if( CORE::time > $expire->epoch ) ;
     }
 }
 
@@ -1588,7 +1588,7 @@ sub apply_deposit_fee {
     return if $self->is_deposit and $self->skip_deposit_fee;
     return if $self->is_rental and $self->skip_rental_fee;
 
-	my $bill = Fieldmapper::money::billing->new;
+    my $bill = Fieldmapper::money::billing->new;
     my $amount = $copy->deposit_amount;
     my $billing_type;
     my $btype;
@@ -1603,14 +1603,14 @@ sub apply_deposit_fee {
         $self->rental_billing($bill);
     }
 
-	$bill->xact($self->circ->id);
-	$bill->amount($amount);
-	$bill->note(OILS_BILLING_NOTE_SYSTEM);
-	$bill->billing_type($billing_type);
-	$bill->btype($btype);
+    $bill->xact($self->circ->id);
+    $bill->amount($amount);
+    $bill->note(OILS_BILLING_NOTE_SYSTEM);
+    $bill->billing_type($billing_type);
+    $bill->btype($btype);
     $self->editor->create_money_billing($bill) or $self->bail_on_events($self->editor->event);
 
-	$logger->info("circulator: charged $amount on checkout with billing type $billing_type");
+    $logger->info("circulator: charged $amount on checkout with billing type $billing_type");
 }
 
 sub update_copy {
@@ -1739,7 +1739,7 @@ sub handle_checkout_holds {
         $hold->clear_capture_time;
         $hold->clear_shelf_time;
         $hold->clear_shelf_expire_time;
-	    $hold->clear_current_shelf_lib;
+        $hold->clear_current_shelf_lib;
 
         return $self->bail_on_event($e->event)
             unless $e->update_action_hold_request($hold);
@@ -3767,8 +3767,8 @@ sub append_reading_list {
     my $e = new_editor(xact => 1, requestor => $self->editor->requestor);
 
     # verify the patron wants to retain the hisory
-	my $setting = $e->search_actor_user_setting(
-		{usr => $self->patron->id, name => 'circ.keep_checkout_history'})->[0];
+    my $setting = $e->search_actor_user_setting(
+        {usr => $self->patron->id, name => 'circ.keep_checkout_history'})->[0];
     
     unless($setting and $setting->value) {
         $e->rollback;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CopyLocations.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CopyLocations.pm
index bc4f2c1..a72e13c 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CopyLocations.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/CopyLocations.pm
@@ -12,25 +12,25 @@ my $U = "OpenILS::Application::AppUtils";
 
 
 __PACKAGE__->register_method(
-	api_name		=> "open-ils.circ.copy_location.retrieve.all",
-	method		=> 'cl_retrieve_all',
-	argc			=>	2,
-	signature	=> q/
-		Retrieves the ranged set of copy locations for the requested org.
-		If no org is provided, all copy locations are returned
-		@param orgId The org location id
-		@param noi18n No i18n in result
+    api_name        => "open-ils.circ.copy_location.retrieve.all",
+    method      => 'cl_retrieve_all',
+    argc            =>  2,
+    signature   => q/
+        Retrieves the ranged set of copy locations for the requested org.
+        If no org is provided, all copy locations are returned
+        @param orgId The org location id
+        @param noi18n No i18n in result
         @param flesh_owning_lib Flesh owning lib in results
-		@return An array of copy location objects
-		/);
+        @return An array of copy location objects
+        /);
 
 sub cl_retrieve_all {
-	my ($self, $client, $org_id, $no_i18n, $flesh_owning_lib) = @_;
+    my ($self, $client, $org_id, $no_i18n, $flesh_owning_lib) = @_;
 
-	if(!$org_id) {
-		my $otree = $U->get_org_tree();
-		$org_id = $otree->id;
-	}
+    if(!$org_id) {
+        my $otree = $U->get_org_tree();
+        $org_id = $otree->id;
+    }
 
     my $second_cstore_arg = {"no_i18n" => scalar($no_i18n)};
        $second_cstore_arg->{"order_by"} = {"acpl" => "name"};
@@ -69,16 +69,16 @@ sub cl_retrieve_distinct {
 }
 
 __PACKAGE__->register_method(
-	api_name		=> 'open-ils.circ.copy_location.create',
-	method		=> 'cl_create',
-	argc			=> 2,
-	signature	=> q/
-		Creates a new copy location.  Requestor must have the CREATE_COPY_LOCATION
-		permission at the location specified on the new location object
-		@param authtoken The login session key
-		@param copyLoc The new copy location object
-		@return The if of the new location object on success, event on error
-	/);
+    api_name        => 'open-ils.circ.copy_location.create',
+    method      => 'cl_create',
+    argc            => 2,
+    signature   => q/
+        Creates a new copy location.  Requestor must have the CREATE_COPY_LOCATION
+        permission at the location specified on the new location object
+        @param authtoken The login session key
+        @param copyLoc The new copy location object
+        @return The if of the new location object on success, event on error
+    /);
 
 
 sub cl_create {
@@ -102,16 +102,16 @@ sub cl_create {
 
 
 __PACKAGE__->register_method (
-	api_name		=> 'open-ils.circ.copy_location.delete',
-	method		=> 'cl_delete',
-	argc			=> 2,
-	signature	=> q/
-		Deletes a copy location. Requestor must have the 
-		DELETE_COPY_LOCATION permission.
-		@param authtoken The login session key
-		@param id The copy location object id
-		@return 1 on success, event on error
-	/);
+    api_name        => 'open-ils.circ.copy_location.delete',
+    method      => 'cl_delete',
+    argc            => 2,
+    signature   => q/
+        Deletes a copy location. Requestor must have the 
+        DELETE_COPY_LOCATION permission.
+        @param authtoken The login session key
+        @param id The copy location object id
+        @return 1 on success, event on error
+    /);
 
 
 sub cl_delete {
@@ -132,16 +132,16 @@ sub cl_delete {
 
 
 __PACKAGE__->register_method (
-	api_name		=> 'open-ils.circ.copy_location.update',
-	method		=> 'cl_update',
-	argc			=> 2,
-	signature	=> q/
-		Updates a copy location object.  Requestor must have 
-		the UPDATE_COPY_LOCATION permission
-		@param authtoken The login session key
-		@param copyLoc	The copy location object
-		@return 1 on success, event on error
-	/);
+    api_name        => 'open-ils.circ.copy_location.update',
+    method      => 'cl_update',
+    argc            => 2,
+    signature   => q/
+        Updates a copy location object.  Requestor must have 
+        the UPDATE_COPY_LOCATION permission
+        @param authtoken The login session key
+        @param copyLoc  The copy location object
+        @return 1 on success, event on error
+    /);
 
 
 sub cl_update {
@@ -170,23 +170,23 @@ sub cl_update {
 
 
 __PACKAGE__->register_method(
-	method => 'fetch_loc',
+    method => 'fetch_loc',
     authoritative => 1,
-	api_name => 'open-ils.circ.copy_location.retrieve',
+    api_name => 'open-ils.circ.copy_location.retrieve',
 );
 
 sub fetch_loc {
-	my( $self, $con, $id ) = @_;
-	my $e = new_editor();
-	my $cl = $e->retrieve_asset_copy_location($id)
-		or return $e->event;
-	return $cl;
+    my( $self, $con, $id ) = @_;
+    my $e = new_editor();
+    my $cl = $e->retrieve_asset_copy_location($id)
+        or return $e->event;
+    return $cl;
 }
 
 __PACKAGE__->register_method(
     api_name => "open-ils.circ.copy_location_order.update",
     method => 'update_clo',
-    argc =>	2,
+    argc => 2,
 );
 
 sub update_clo {
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/HoldNotify.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/HoldNotify.pm
index 6741316..a042452 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/HoldNotify.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/HoldNotify.pm
@@ -36,21 +36,21 @@ use open ':utf8';
 
 
 __PACKAGE__->register_method(
-	method => 'send_email_notify_pub',
-	api_name => 'open-ils.circ.send_hold_notify.email',
+    method => 'send_email_notify_pub',
+    api_name => 'open-ils.circ.send_hold_notify.email',
 );
 
 
 sub send_email_notify_pub {
-	my( $self, $conn, $auth, $hold_id ) = @_;
-	my $e = new_editor(authtoken => $auth);
-	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed('CREATE_HOLD_NOTIFICATION');
-	my $notifier = __PACKAGE__->new(requestor => $e->requestor, hold_id => $hold_id);
-	return $notifier->event if $notifier->event;
-	my $stat = $notifier->send_email_notify;
-#	$e->commit if $stat == '1';
-	return $stat;
+    my( $self, $conn, $auth, $hold_id ) = @_;
+    my $e = new_editor(authtoken => $auth);
+    return $e->event unless $e->checkauth;
+    return $e->event unless $e->allowed('CREATE_HOLD_NOTIFICATION');
+    my $notifier = __PACKAGE__->new(requestor => $e->requestor, hold_id => $hold_id);
+    return $notifier->event if $notifier->event;
+    my $stat = $notifier->send_email_notify;
+#   $e->commit if $stat == '1';
+    return $stat;
 }
 
 
@@ -62,150 +62,150 @@ sub send_email_notify_pub {
 # ---------------------------------------------------------------
 
 my @AUTOLOAD_FIELDS = qw/
-	hold
-	copy
-	volume
-	title
-	editor
-	patron
-	event
-	pickup_lib
-	smtp_server
-	settings_client
+    hold
+    copy
+    volume
+    title
+    editor
+    patron
+    event
+    pickup_lib
+    smtp_server
+    settings_client
 /;
 
 sub AUTOLOAD {
-	my $self = shift;
-	my $type = ref($self) or die "$self is not an object";
-	my $data = shift;
-	my $name = $AUTOLOAD;
-	$name =~ s/.*://o;   
-
-	unless (grep { $_ eq $name } @AUTOLOAD_FIELDS) {
-		$logger->error("hold_notify: $type: invalid autoload field: $name");
-		die "$type: invalid autoload field: $name\n" 
-	}
-
-	{
-		no strict 'refs';
-		*{"${type}::${name}"} = sub {
-			my $s = shift;
-			my $v = shift;
-			$s->{$name} = $v if defined $v;
-			return $s->{$name};
-		}
-	}
-	return $self->$name($data);
+    my $self = shift;
+    my $type = ref($self) or die "$self is not an object";
+    my $data = shift;
+    my $name = $AUTOLOAD;
+    $name =~ s/.*://o;   
+
+    unless (grep { $_ eq $name } @AUTOLOAD_FIELDS) {
+        $logger->error("hold_notify: $type: invalid autoload field: $name");
+        die "$type: invalid autoload field: $name\n" 
+    }
+
+    {
+        no strict 'refs';
+        *{"${type}::${name}"} = sub {
+            my $s = shift;
+            my $v = shift;
+            $s->{$name} = $v if defined $v;
+            return $s->{$name};
+        }
+    }
+    return $self->$name($data);
 }
 
 
 sub new {
-	my( $class, %args ) = @_;
-	$class = ref($class) || $class;
-	my $self = bless( {}, $class );
-	$self->editor( new_editor( xact => 1, requestor => $args{requestor} ));
-	$logger->debug("circulator: creating new hold-notifier with requestor ".
-		$self->editor->requestor->id);
-	$self->fetch_data($args{hold_id});
-	return $self;
+    my( $class, %args ) = @_;
+    $class = ref($class) || $class;
+    my $self = bless( {}, $class );
+    $self->editor( new_editor( xact => 1, requestor => $args{requestor} ));
+    $logger->debug("circulator: creating new hold-notifier with requestor ".
+        $self->editor->requestor->id);
+    $self->fetch_data($args{hold_id});
+    return $self;
 }
 
 sub send_email_notify {
-	my $self = shift;
+    my $self = shift;
 
-	my $sc = OpenSRF::Utils::SettingsClient->new;
-	my $setting = $sc->config_value(
-		qw/ apps open-ils.circ app_settings notify_hold email / );
+    my $sc = OpenSRF::Utils::SettingsClient->new;
+    my $setting = $sc->config_value(
+        qw/ apps open-ils.circ app_settings notify_hold email / );
 
-	$logger->debug("hold_notify: email enabled setting = $setting");
+    $logger->debug("hold_notify: email enabled setting = $setting");
 
-	if( !$setting or $setting ne 'true' ) {
+    if( !$setting or $setting ne 'true' ) {
       $self->editor->rollback;
-		$logger->info("hold_notify: not sending hold notify - email notifications disabled");
-		return 0;
-	}
+        $logger->info("hold_notify: not sending hold notify - email notifications disabled");
+        return 0;
+    }
 
-	unless ($U->is_true($self->hold->email_notify)) {
+    unless ($U->is_true($self->hold->email_notify)) {
       $self->editor->rollback;
-		$logger->info("hold_notify: not sending hold notification because email_notify is false");
-		return 0;
-	}
+        $logger->info("hold_notify: not sending hold notification because email_notify is false");
+        return 0;
+    }
 
-	unless( $self->patron->email and $self->patron->email =~ /.+\@.+/ ) { # see if it's remotely email-esque
+    unless( $self->patron->email and $self->patron->email =~ /.+\@.+/ ) { # see if it's remotely email-esque
       $self->editor->rollback;
-	   return OpenILS::Event->new('PATRON_NO_EMAIL_ADDRESS');
+       return OpenILS::Event->new('PATRON_NO_EMAIL_ADDRESS');
    }
 
-	$logger->info("hold_notify: attempting email notify on hold ".$self->hold->id);
+    $logger->info("hold_notify: attempting email notify on hold ".$self->hold->id);
 
-	my $sclient = OpenSRF::Utils::SettingsClient->new;
-	$self->settings_client($sclient);
-	my $template = $sclient->config_value('email_notify', 'template');
-	my $str = $self->flesh_template($self->load_template($template));
+    my $sclient = OpenSRF::Utils::SettingsClient->new;
+    $self->settings_client($sclient);
+    my $template = $sclient->config_value('email_notify', 'template');
+    my $str = $self->flesh_template($self->load_template($template));
 
-	unless( $str ) {
+    unless( $str ) {
       $self->editor->rollback;
-		$logger->error("hold_notify: No email notify template found - cannot notify");
-		return 0;
-	}
+        $logger->error("hold_notify: No email notify template found - cannot notify");
+        return 0;
+    }
 
    my $reqr = $self->editor->requestor;
    $self->editor->rollback; # we're done with this transaction
 
-	return 0 unless $self->send_email($str);
-
-	# ------------------------------------------------------------------
-	# If the hold email takes too long to send, the existing editor 
-	# transaction may have timed out.  Create a one-off editor to write 
-	# the notification to the DB.
-	# ------------------------------------------------------------------
-	my $we = new_editor(xact=>1, requestor=>$reqr);
-
-	my $notify = Fieldmapper::action::hold_notification->new;
-	$notify->hold($self->hold->id);
-	$notify->notify_staff($we->requestor->id);
-	$notify->notify_time('now');
-	$notify->method('email');
-	
-	$we->create_action_hold_notification($notify)
-		or return $we->die_event;
-	$we->commit;
-
-	return 1;
+    return 0 unless $self->send_email($str);
+
+    # ------------------------------------------------------------------
+    # If the hold email takes too long to send, the existing editor 
+    # transaction may have timed out.  Create a one-off editor to write 
+    # the notification to the DB.
+    # ------------------------------------------------------------------
+    my $we = new_editor(xact=>1, requestor=>$reqr);
+
+    my $notify = Fieldmapper::action::hold_notification->new;
+    $notify->hold($self->hold->id);
+    $notify->notify_staff($we->requestor->id);
+    $notify->notify_time('now');
+    $notify->method('email');
+    
+    $we->create_action_hold_notification($notify)
+        or return $we->die_event;
+    $we->commit;
+
+    return 1;
 }
 
 sub send_email {
-	my( $self, $text ) = @_;
+    my( $self, $text ) = @_;
 
    # !!! $self->editor xact has been rolled back before we get here
 
-	my $smtp = $self->settings_client->config_value('email_notify', 'smtp_server');
+    my $smtp = $self->settings_client->config_value('email_notify', 'smtp_server');
 
-	$logger->info("hold_notify: sending email notice to ".
-		$self->patron->email." with SMTP server $smtp");
+    $logger->info("hold_notify: sending email notice to ".
+        $self->patron->email." with SMTP server $smtp");
 
-	my $sender = Email::Send->new({mailer => 'SMTP'});
-	$sender->mailer_args([Host => $smtp]);
+    my $sender = Email::Send->new({mailer => 'SMTP'});
+    $sender->mailer_args([Host => $smtp]);
 
-	my $stat;
-	my $err;
+    my $stat;
+    my $err;
 
-	try {
-		$stat = $sender->send($text);
-	} catch Error with {
-		$err = $stat = shift;
-		$logger->error("hold_notify: Email notify failed with error: $err");
-	};
+    try {
+        $stat = $sender->send($text);
+    } catch Error with {
+        $err = $stat = shift;
+        $logger->error("hold_notify: Email notify failed with error: $err");
+    };
 
-	if( !$err and $stat and $stat->type eq 'success' ) {
-		$logger->info("hold_notify: successfully sent hold notification");
-		return 1;
-	} else {
-		$logger->warn("hold_notify: unable to send hold notification: ".Dumper($stat));
-		return 0;
-	}
+    if( !$err and $stat and $stat->type eq 'success' ) {
+        $logger->info("hold_notify: successfully sent hold notification");
+        return 1;
+    } else {
+        $logger->warn("hold_notify: unable to send hold notification: ".Dumper($stat));
+        return 0;
+    }
 
-	return undef;
+    return undef;
 }
 
 
@@ -213,138 +213,138 @@ sub send_email {
 # Fetches all of the hold-related data
 # -------------------------------------------------------------------------
 sub fetch_data {
-	my $self		= shift;
-	my $holdid	= shift;
-	my $e			= $self->editor;
-
-	$logger->debug("circulator: fetching hold notify data");
-
-	$self->hold($e->retrieve_action_hold_request($holdid)) or return $self->event($e->event);
-	$self->copy($e->retrieve_asset_copy($self->hold->current_copy)) or return $self->event($e->event);
-	$self->volume($e->retrieve_asset_call_number($self->copy->call_number)) or return $self->event($e->event);
-	$self->title($e->retrieve_biblio_record_entry($self->volume->record)) or return $self->event($e->event);
-	$self->patron($e->retrieve_actor_user($self->hold->usr)) or return $self->event($e->event);
-	$self->pickup_lib($e->retrieve_actor_org_unit($self->hold->pickup_lib)) or return $self->event($e->event);
+    my $self        = shift;
+    my $holdid  = shift;
+    my $e           = $self->editor;
+
+    $logger->debug("circulator: fetching hold notify data");
+
+    $self->hold($e->retrieve_action_hold_request($holdid)) or return $self->event($e->event);
+    $self->copy($e->retrieve_asset_copy($self->hold->current_copy)) or return $self->event($e->event);
+    $self->volume($e->retrieve_asset_call_number($self->copy->call_number)) or return $self->event($e->event);
+    $self->title($e->retrieve_biblio_record_entry($self->volume->record)) or return $self->event($e->event);
+    $self->patron($e->retrieve_actor_user($self->hold->usr)) or return $self->event($e->event);
+    $self->pickup_lib($e->retrieve_actor_org_unit($self->hold->pickup_lib)) or return $self->event($e->event);
 }
 
 
 sub extract_data {
-	my $self = shift;
-	my $e = $self->editor;
-
-	my $patron = $self->patron;
-	my $o_name = $self->pickup_lib->name;
-	my $p_name = $patron->first_given_name .' '.$patron->family_name;
-
-	# try to find a suitable address for the patron
-	my $p_addr;
-	my $p_addrs;
-	unless( $p_addr = 
-			$e->retrieve_actor_user_address($patron->billing_address)) {
-		unless( $p_addr = 
-				$e->retrieve_actor_user_address($patron->mailing_address)) {
-			$logger->warn("hold_notify: No address for user ".$patron->id);
-			$p_addrs = "";
-		}
-	}
-
-	unless( defined $p_addrs ) {
-		$p_addrs = 
-			$p_addr->street1." ".
-			$p_addr->street2." ".
-			$p_addr->city." ".
-			$p_addr->state." ".
-			$p_addr->post_code;
-	}
-
-	my $l_addr = $e->retrieve_actor_org_address($self->pickup_lib->holds_address);
-	my $l_addrs = (!$l_addr) ? "" : 
-			$l_addr->street1." ".
-			$l_addr->street2." ".
-			$l_addr->city." ".
-			$l_addr->state." ".
-			$l_addr->post_code;
-
-	my $title;	
-	my $author;
-
-	if( $self->title->id == OILS_PRECAT_RECORD ) {
-		$title = ($self->copy->dummy_title) ? 
-			$self->copy->dummy_title : "";
-		$author = ($self->copy->dummy_author) ? 
-			$self->copy->dummy_author : "";
-	} else {
-		my $mods	= $U->record_to_mvr($self->title);
-		$title	= ($mods->title) ? $mods->title : "";
-		$author	= ($mods->author) ? $mods->author : "";
-	}
-
-
-	return { 
-		patron_email => $self->patron->email,
-		pickup_lib_name => $o_name,
-		pickup_lib_addr => $l_addrs,
-		patron_name => $p_name, 
-		patron_addr => $p_addrs, 
-		title => $title, 
-		author => $author, 
-		call_number => $self->volume->label,
-		copy_barcode => $self->copy->barcode,
-		copy_number => $self->copy->copy_number,
-	};
+    my $self = shift;
+    my $e = $self->editor;
+
+    my $patron = $self->patron;
+    my $o_name = $self->pickup_lib->name;
+    my $p_name = $patron->first_given_name .' '.$patron->family_name;
+
+    # try to find a suitable address for the patron
+    my $p_addr;
+    my $p_addrs;
+    unless( $p_addr = 
+            $e->retrieve_actor_user_address($patron->billing_address)) {
+        unless( $p_addr = 
+                $e->retrieve_actor_user_address($patron->mailing_address)) {
+            $logger->warn("hold_notify: No address for user ".$patron->id);
+            $p_addrs = "";
+        }
+    }
+
+    unless( defined $p_addrs ) {
+        $p_addrs = 
+            $p_addr->street1." ".
+            $p_addr->street2." ".
+            $p_addr->city." ".
+            $p_addr->state." ".
+            $p_addr->post_code;
+    }
+
+    my $l_addr = $e->retrieve_actor_org_address($self->pickup_lib->holds_address);
+    my $l_addrs = (!$l_addr) ? "" : 
+            $l_addr->street1." ".
+            $l_addr->street2." ".
+            $l_addr->city." ".
+            $l_addr->state." ".
+            $l_addr->post_code;
+
+    my $title;  
+    my $author;
+
+    if( $self->title->id == OILS_PRECAT_RECORD ) {
+        $title = ($self->copy->dummy_title) ? 
+            $self->copy->dummy_title : "";
+        $author = ($self->copy->dummy_author) ? 
+            $self->copy->dummy_author : "";
+    } else {
+        my $mods    = $U->record_to_mvr($self->title);
+        $title  = ($mods->title) ? $mods->title : "";
+        $author = ($mods->author) ? $mods->author : "";
+    }
+
+
+    return { 
+        patron_email => $self->patron->email,
+        pickup_lib_name => $o_name,
+        pickup_lib_addr => $l_addrs,
+        patron_name => $p_name, 
+        patron_addr => $p_addrs, 
+        title => $title, 
+        author => $author, 
+        call_number => $self->volume->label,
+        copy_barcode => $self->copy->barcode,
+        copy_number => $self->copy->copy_number,
+    };
 }
 
 
 
 sub load_template {
-	my $self = shift;
-	my $template = shift;
-
-	unless( open(F, $template) ) {
-		$logger->error("hold_notify: Unable to open hold notification template file: $template");
-		return undef;
-	}
-
-	# load the template, strip comments
-	my @lines = <F>;
-	close(F);
-
-	my $str = '';
-	for(@lines) {
-   	chomp $_;
-   	next if $_ =~ /^\s*\#/o;
-   	$_ =~ s/\#.*//og;
-   	$str .= "$_\n";
-	}
-
-	return $str;
+    my $self = shift;
+    my $template = shift;
+
+    unless( open(F, $template) ) {
+        $logger->error("hold_notify: Unable to open hold notification template file: $template");
+        return undef;
+    }
+
+    # load the template, strip comments
+    my @lines = <F>;
+    close(F);
+
+    my $str = '';
+    for(@lines) {
+    chomp $_;
+    next if $_ =~ /^\s*\#/o;
+    $_ =~ s/\#.*//og;
+    $str .= "$_\n";
+    }
+
+    return $str;
 }
 
 sub flesh_template {
-	my( $self, $str ) = @_;
-	return undef unless $str;
-
-	my @time 	= CORE::localtime();
-	my $day 		= $time[3];
-	my $month 	= $time[4] + 1;
-	my $year 	= $time[5] + 1900;
-
-	my $data = $self->extract_data;
-
-	my $email		= $$data{patron_email};
-	my $p_name		= $$data{patron_name};
-	my $p_addr		= $$data{patron_addr};
-	my $o_name		= $$data{pickup_lib_name};
-	my $o_addr		= $$data{pickup_lib_addr};
-	my $title		= $$data{title};
-	my $author		= $$data{author};
-	my $cn			= $$data{call_number};
-	my $barcode		= $$data{copy_barcode};
-	my $copy_number = $$data{copy_number};
-
-	my $sender = $self->settings_client->config_value('email_notify', 'sender_address');
-	my $reply_to = $self->pickup_lib->email;
-	$reply_to ||= $sender; 
+    my( $self, $str ) = @_;
+    return undef unless $str;
+
+    my @time    = CORE::localtime();
+    my $day         = $time[3];
+    my $month   = $time[4] + 1;
+    my $year    = $time[5] + 1900;
+
+    my $data = $self->extract_data;
+
+    my $email       = $$data{patron_email};
+    my $p_name      = $$data{patron_name};
+    my $p_addr      = $$data{patron_addr};
+    my $o_name      = $$data{pickup_lib_name};
+    my $o_addr      = $$data{pickup_lib_addr};
+    my $title       = $$data{title};
+    my $author      = $$data{author};
+    my $cn          = $$data{call_number};
+    my $barcode     = $$data{copy_barcode};
+    my $copy_number = $$data{copy_number};
+
+    my $sender = $self->settings_client->config_value('email_notify', 'sender_address');
+    my $reply_to = $self->pickup_lib->email;
+    $reply_to ||= $sender; 
 
    # if they have an org setting for bounced emails, use that as the sender address
    if( my $set = $self->editor->search_actor_org_unit_setting(
@@ -372,7 +372,7 @@ sub flesh_template {
    $str =~ s/\${COPY_BARCODE}/$barcode/;
    $str =~ s/\${COPY_NUMBER}/$copy_number/;
 
-	return $str;
+    return $str;
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
index 1df7239..affbb2e 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
@@ -3046,10 +3046,10 @@ sub find_nearest_permitted_hold {
     $copy->call_number($editor->retrieve_asset_call_number($copy->call_number))
         unless ref $copy->call_number;
 
-	# search for what should be the best holds for this copy to fulfill
-	my $best_holds = $U->storagereq(
+    # search for what should be the best holds for this copy to fulfill
+    my $best_holds = $U->storagereq(
         "open-ils.storage.action.hold_request.nearest_hold.atomic", 
-		$user->ws_ou, $copy, 100, $hold_stall_interval, $fifo );
+        $user->ws_ou, $copy, 100, $hold_stall_interval, $fifo );
 
     # Add any pre-targeted holds to the list too? Unless they are already there, anyway.
     if ($old_holds) {
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/NonCat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/NonCat.pm
index fd35b19..8ec6852 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/NonCat.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/NonCat.pm
@@ -19,40 +19,40 @@ my $_dt_parser = DateTime::Format::ISO8601->new;
 
 # returns ( $newid, $evt ).  If $evt, then there was an error
 sub create_non_cat_circ {
-	my( $staffid, $patronid, $circ_lib, $noncat_type, $circ_time, $editor ) = @_;
+    my( $staffid, $patronid, $circ_lib, $noncat_type, $circ_time, $editor ) = @_;
 
-	my( $id, $nct, $evt );
-	$circ_time ||= 'now';
-	my $circ = Fieldmapper::action::non_cataloged_circulation->new;
+    my( $id, $nct, $evt );
+    $circ_time ||= 'now';
+    my $circ = Fieldmapper::action::non_cataloged_circulation->new;
 
-	$logger->activity("Creating non-cataloged circulation for ".
-		"staff $staffid, patron $patronid, location $circ_lib, and non-cat type $noncat_type");
+    $logger->activity("Creating non-cataloged circulation for ".
+        "staff $staffid, patron $patronid, location $circ_lib, and non-cat type $noncat_type");
 
-	$circ->patron($patronid);
-	$circ->staff($staffid);
-	$circ->circ_lib($circ_lib);
-	$circ->item_type($noncat_type);
-	$circ->circ_time($circ_time);
+    $circ->patron($patronid);
+    $circ->staff($staffid);
+    $circ->circ_lib($circ_lib);
+    $circ->item_type($noncat_type);
+    $circ->circ_time($circ_time);
 
-	if( $editor ) {
-		$evt = $editor->event unless
-			$circ = $editor->create_action_non_cataloged_circulation( $circ )
+    if( $editor ) {
+        $evt = $editor->event unless
+            $circ = $editor->create_action_non_cataloged_circulation( $circ )
 
 
-	} else {
-		$id = $U->simplereq(
-			'open-ils.storage',
-			'open-ils.storage.direct.action.non_cataloged_circulation.create', $circ );
-		$evt = $U->DB_UPDATE_FAILED($circ) unless $id;
-		$circ->id($id);
-	}
+    } else {
+        $id = $U->simplereq(
+            'open-ils.storage',
+            'open-ils.storage.direct.action.non_cataloged_circulation.create', $circ );
+        $evt = $U->DB_UPDATE_FAILED($circ) unless $id;
+        $circ->id($id);
+    }
 
     if($circ) {
         my $e = ($editor) ? $editor : new_editor();
         $circ = noncat_due_date($e, $circ);
     }
 
-	return( $circ, $evt );
+    return( $circ, $evt );
 }
 
 
@@ -60,41 +60,41 @@ __PACKAGE__->register_method(
     method   => "create_noncat_type",
     api_name => "open-ils.circ.non_cat_type.create",
     notes    => q/
-		Creates a new non cataloged item type
-		@param authtoken The login session key
-		@param name The name of the new type
-		@param orgId The location where the type will live
-		@return The type object on success and the corresponding
-		event on failure
-	/
+        Creates a new non cataloged item type
+        @param authtoken The login session key
+        @param name The name of the new type
+        @param orgId The location where the type will live
+        @return The type object on success and the corresponding
+        event on failure
+    /
 );
 
 sub create_noncat_type {
-	my( $self, $client, $authtoken, $name, $orgId, $interval, $inhouse ) = @_;
-
-	my $e = new_editor(authtoken=>$authtoken, xact=>1);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('CREATE_NON_CAT_TYPE', $orgId);
-
-	# grab all of "my" non-cat types and see if one with 
-	# the requested name already exists
-	my $types = retrieve_noncat_types_all($self, $client, $orgId);
-	for(@$types) {
-		if( $_->name eq $name ) {
-			$e->rollback;
-			return OpenILS::Event->new('NON_CAT_TYPE_EXISTS', payload => $name);
-		}
-	}
-
-	my $type = Fieldmapper::config::non_cataloged_type->new;
-	$type->name($name);
-	$type->owning_lib($orgId);
-	$type->circ_duration($interval);
-	$type->in_house( ($inhouse) ? 't' : 'f' );
-
-	$e->create_config_non_cataloged_type($type) or return $e->die_event;
-	$e->commit;
-	return $type;
+    my( $self, $client, $authtoken, $name, $orgId, $interval, $inhouse ) = @_;
+
+    my $e = new_editor(authtoken=>$authtoken, xact=>1);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('CREATE_NON_CAT_TYPE', $orgId);
+
+    # grab all of "my" non-cat types and see if one with 
+    # the requested name already exists
+    my $types = retrieve_noncat_types_all($self, $client, $orgId);
+    for(@$types) {
+        if( $_->name eq $name ) {
+            $e->rollback;
+            return OpenILS::Event->new('NON_CAT_TYPE_EXISTS', payload => $name);
+        }
+    }
+
+    my $type = Fieldmapper::config::non_cataloged_type->new;
+    $type->name($name);
+    $type->owning_lib($orgId);
+    $type->circ_duration($interval);
+    $type->in_house( ($inhouse) ? 't' : 'f' );
+
+    $e->create_config_non_cataloged_type($type) or return $e->die_event;
+    $e->commit;
+    return $type;
 }
 
 
@@ -102,30 +102,30 @@ __PACKAGE__->register_method(
     method   => "update_noncat_type",
     api_name => "open-ils.circ.non_cat_type.update",
     notes    => q/
-		Updates a non-cataloged type object
-		@param authtoken The login session key
-		@param type The updated type object
-		@return The result of the DB update call unless a preceeding event occurs, 
-			in which case the event will be returned
-	/
+        Updates a non-cataloged type object
+        @param authtoken The login session key
+        @param type The updated type object
+        @return The result of the DB update call unless a preceeding event occurs, 
+            in which case the event will be returned
+    /
 );
 
 sub update_noncat_type {
-	my( $self, $client, $authtoken, $type ) = @_;
-	my $e = new_editor(xact=>1, authtoken=>$authtoken);
-	return $e->die_event unless $e->checkauth;
+    my( $self, $client, $authtoken, $type ) = @_;
+    my $e = new_editor(xact=>1, authtoken=>$authtoken);
+    return $e->die_event unless $e->checkauth;
 
-	my $otype = $e->retrieve_config_non_cataloged_type($type->id) 
-		or return $e->die_event;
+    my $otype = $e->retrieve_config_non_cataloged_type($type->id) 
+        or return $e->die_event;
 
-	return $e->die_event unless 
-		$e->allowed('UPDATE_NON_CAT_TYPE', $otype->owning_lib);
+    return $e->die_event unless 
+        $e->allowed('UPDATE_NON_CAT_TYPE', $otype->owning_lib);
 
-	$type->owning_lib($otype->owning_lib); # do not allow them to "move" the object
+    $type->owning_lib($otype->owning_lib); # do not allow them to "move" the object
 
-	$e->update_config_non_cataloged_type($type) or return $e->die_event;
-	$e->commit;
-	return 1;
+    $e->update_config_non_cataloged_type($type) or return $e->die_event;
+    $e->commit;
+    return 1;
 }
 
 __PACKAGE__->register_method(
@@ -170,38 +170,38 @@ __PACKAGE__->register_method(
 );
 
 sub fetch_noncat {
-	my( $self, $conn, $auth, $circid ) = @_;
-	my $e = new_editor( authtoken => $auth );
-	return $e->event unless $e->checkauth;
-	my $c = $e->retrieve_action_non_cataloged_circulation($circid)
-		or return $e->event;
-	if( $c->patron ne $e->requestor->id ) {
-		return $e->event unless $e->allowed('VIEW_CIRCULATIONS'); # XXX rely on editor perm
-	}
+    my( $self, $conn, $auth, $circid ) = @_;
+    my $e = new_editor( authtoken => $auth );
+    return $e->event unless $e->checkauth;
+    my $c = $e->retrieve_action_non_cataloged_circulation($circid)
+        or return $e->event;
+    if( $c->patron ne $e->requestor->id ) {
+        return $e->event unless $e->allowed('VIEW_CIRCULATIONS'); # XXX rely on editor perm
+    }
     return noncat_due_date($e, $c);
 }
 
 sub noncat_due_date {
     my($e, $circ) = @_;
 
-	my $otype = $e->retrieve_config_non_cataloged_type($circ->item_type) 
-		or return $e->die_event;
+    my $otype = $e->retrieve_config_non_cataloged_type($circ->item_type) 
+        or return $e->die_event;
 
-	my $duedate = $_dt_parser->parse_datetime( cleanse_ISO8601($circ->circ_time) );
-	$duedate = $duedate
-		->add( seconds => interval_to_seconds($otype->circ_duration) )
-		->strftime('%FT%T%z');
+    my $duedate = $_dt_parser->parse_datetime( cleanse_ISO8601($circ->circ_time) );
+    $duedate = $duedate
+        ->add( seconds => interval_to_seconds($otype->circ_duration) )
+        ->strftime('%FT%T%z');
 
-	my $offset = $U->storagereq(
-		'open-ils.storage.actor.org_unit.closed_date.overlap',
-		$circ->circ_lib,
-		$duedate
-	);
+    my $offset = $U->storagereq(
+        'open-ils.storage.actor.org_unit.closed_date.overlap',
+        $circ->circ_lib,
+        $duedate
+    );
 
-	$duedate = $offset->{end} if ($offset);
-	$circ->duedate($duedate);
+    $duedate = $offset->{end} if ($offset);
+    $circ->duedate($duedate);
 
-	return $circ;
+    return $circ;
 }
 
 
@@ -212,12 +212,12 @@ __PACKAGE__->register_method(
     api_name      => 'open-ils.circ.open_non_cataloged_circulation.user',
     signature     => {
         desca   => 'For a given user, returns an id-list of non-cataloged circulations that are considered open as of now.  ' .
-		           'A circ is open if circ time + circ duration (based on type) is > than now.  If trying to view the circs ' .
+                   'A circ is open if circ time + circ duration (based on type) is > than now.  If trying to view the circs ' .
                    'of another user, the VIEW_CIRCULATIONS permission is required',
-		params => [
+        params => [
             { desc => 'Authentication token',                            type => 'string' },
             { desc => 'UserID (optional: defaults to the session user)', type => 'number' }
-		],
+        ],
         return => {
             desc => 'Array of non-cataloged circ IDs, event on error'
         },
@@ -225,15 +225,15 @@ __PACKAGE__->register_method(
 );
 
 sub fetch_open_noncats {
-	my( $self, $conn, $auth, $userid ) = @_;
-	my $e = OpenILS::Utils::Editor->new( authtoken => $auth );
-	return $e->event unless $e->checkauth;
-	$userid ||= $e->requestor->id;
-	if( $e->requestor->id ne $userid ) {
-		return $e->event unless $e->allowed('VIEW_CIRCULATIONS'); # XXX rely on editor perm
-	}
-	return $e->request(
-		'open-ils.storage.action.open_non_cataloged_circulation.user', $userid );
+    my( $self, $conn, $auth, $userid ) = @_;
+    my $e = OpenILS::Utils::Editor->new( authtoken => $auth );
+    return $e->event unless $e->checkauth;
+    $userid ||= $e->requestor->id;
+    if( $e->requestor->id ne $userid ) {
+        return $e->event unless $e->allowed('VIEW_CIRCULATIONS'); # XXX rely on editor perm
+    }
+    return $e->request(
+        'open-ils.storage.action.open_non_cataloged_circulation.user', $userid );
 }
 
 
@@ -242,21 +242,21 @@ __PACKAGE__->register_method(
     api_name => 'open-ils.circ.non_cataloged_type.delete',
 );
 sub delete_noncat {
-	my( $self, $conn, $auth, $typeid ) = @_;
-	my $e = new_editor(xact=>1, authtoken => $auth);
-	return $e->die_event unless $e->checkauth;
+    my( $self, $conn, $auth, $typeid ) = @_;
+    my $e = new_editor(xact=>1, authtoken => $auth);
+    return $e->die_event unless $e->checkauth;
 
-	my $nc = $e->retrieve_config_non_cataloged_type($typeid)
-		or return $e->die_event;
+    my $nc = $e->retrieve_config_non_cataloged_type($typeid)
+        or return $e->die_event;
 
-	$e->allowed('DELETE_NON_CAT_TYPE', $nc->owning_lib) # XXX rely on editor perm
-		or return $e->die_event;
+    $e->allowed('DELETE_NON_CAT_TYPE', $nc->owning_lib) # XXX rely on editor perm
+        or return $e->die_event;
 
-	#	XXX Add checks to see if this type is in use by a transaction
+    #   XXX Add checks to see if this type is in use by a transaction
 
-	$e->delete_config_non_cataloged_type($nc) or return $e->die_event;
-	$e->commit;
-	return 1;
+    $e->delete_config_non_cataloged_type($nc) or return $e->die_event;
+    $e->commit;
+    return 1;
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/ScriptBuilder.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/ScriptBuilder.pm
index f042665..1eebc7d 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/ScriptBuilder.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/ScriptBuilder.pm
@@ -37,352 +37,352 @@ my @OU_TYPES;
 #  script runner.  Use this to cover data not covered by this module
 # -----------------------------------------------------------------------
 sub build {
-	my( $class, $args ) = @_;
-
-	my $evt;
-	my @evts;
-
-	my $rollback;
-	my $editor = $$args{editor};
-
-	unless($editor) {
-		$editor = new_editor(xact => 1);
-		$rollback = 1;
-	}
-
-	$args->{_direct} = {} unless $args->{_direct};
-	#$args->{editor} = $editor;
-	
-	$evt = fetch_bib_data($editor, $args);
-	push(@evts, $evt) if $evt;
-	$evt = fetch_user_data($editor, $args);
-	push(@evts, $evt) if $evt;
-
-	if(@evts) {
-		my @e;
-		push( @e, $_->{textcode} ) for @evts;
-		$logger->info("script_builder: some events occurred: @e");
-		$logger->debug("script_builder: some events occurred: " . Dumper(\@evts));
-		$args->{_events} = \@evts;
-	}
-
-	my $r = build_runner($editor, $args);
-	$editor->rollback if $rollback;
-	return $r;
+    my( $class, $args ) = @_;
+
+    my $evt;
+    my @evts;
+
+    my $rollback;
+    my $editor = $$args{editor};
+
+    unless($editor) {
+        $editor = new_editor(xact => 1);
+        $rollback = 1;
+    }
+
+    $args->{_direct} = {} unless $args->{_direct};
+    #$args->{editor} = $editor;
+    
+    $evt = fetch_bib_data($editor, $args);
+    push(@evts, $evt) if $evt;
+    $evt = fetch_user_data($editor, $args);
+    push(@evts, $evt) if $evt;
+
+    if(@evts) {
+        my @e;
+        push( @e, $_->{textcode} ) for @evts;
+        $logger->info("script_builder: some events occurred: @e");
+        $logger->debug("script_builder: some events occurred: " . Dumper(\@evts));
+        $args->{_events} = \@evts;
+    }
+
+    my $r = build_runner($editor, $args);
+    $editor->rollback if $rollback;
+    return $r;
 }
 
 
 sub build_runner {
-	my $editor	= shift;
-	my $ctx		= shift;
+    my $editor  = shift;
+    my $ctx     = shift;
 
-	my $runner = OpenILS::Utils::ScriptRunner->new;
+    my $runner = OpenILS::Utils::ScriptRunner->new;
 
-	my $gt = $GROUP_TREE;
-	$runner->insert( "$evt.groupTree",	$gt, 1);
+    my $gt = $GROUP_TREE;
+    $runner->insert( "$evt.groupTree",  $gt, 1);
 
 
-	$runner->insert( "$evt.patron",		$ctx->{patron}, 1);
-	$runner->insert( "$evt.copy",			$ctx->{copy}, 1);
-	$runner->insert( "$evt.volume",		$ctx->{volume}, 1);
-	$runner->insert( "$evt.title",		$ctx->{title}, 1);
+    $runner->insert( "$evt.patron",     $ctx->{patron}, 1);
+    $runner->insert( "$evt.copy",           $ctx->{copy}, 1);
+    $runner->insert( "$evt.volume",     $ctx->{volume}, 1);
+    $runner->insert( "$evt.title",      $ctx->{title}, 1);
 
-	if( ref $ctx->{requestor} ) {
-		$runner->insert( "$evt.requestor",	$ctx->{requestor}, 1);
-		if($ctx->{requestor}->ws_ou) {
-			$runner->insert( "$evt.location",	
-				$editor->retrieve_actor_org_unit($ctx->{requestor}->ws_ou), 1);
-		}
-	}
+    if( ref $ctx->{requestor} ) {
+        $runner->insert( "$evt.requestor",  $ctx->{requestor}, 1);
+        if($ctx->{requestor}->ws_ou) {
+            $runner->insert( "$evt.location",   
+                $editor->retrieve_actor_org_unit($ctx->{requestor}->ws_ou), 1);
+        }
+    }
 
-	$runner->insert( "$evt.patronItemsOut", $ctx->{patronItemsOut}, 1 );
-	$runner->insert( "$evt.patronOverdueCount", $ctx->{patronOverdue}, 1 );
-	$runner->insert( "$evt.patronFines", $ctx->{patronFines}, 1 );
+    $runner->insert( "$evt.patronItemsOut", $ctx->{patronItemsOut}, 1 );
+    $runner->insert( "$evt.patronOverdueCount", $ctx->{patronOverdue}, 1 );
+    $runner->insert( "$evt.patronFines", $ctx->{patronFines}, 1 );
 
-	$runner->insert("$evt.$_", $ctx->{_direct}->{$_}, 1) for keys %{$ctx->{_direct}};
+    $runner->insert("$evt.$_", $ctx->{_direct}->{$_}, 1) for keys %{$ctx->{_direct}};
 
-	insert_org_methods( $editor, $runner );
-	insert_copy_methods( $editor, $ctx, $runner );
+    insert_org_methods( $editor, $runner );
+    insert_copy_methods( $editor, $ctx, $runner );
    insert_user_funcs( $editor, $ctx, $runner );
 
-	return $runner;
+    return $runner;
 }
 
 sub fetch_bib_data {
-	my $e = shift;
-	my $ctx = shift;
-
-	my $flesh = { 
-		flesh => 2, 
-		flesh_fields => { 
-			acp => [ 'location', 'status', 'circ_lib', 'age_protect', 'call_number' ],
-			acn => [ 'record' ]
-		} 
-	};
-
-	if( $ctx->{copy} ) {
-		$ctx->{copy_id} = $ctx->{copy}->id 
-			unless $ctx->{copy_id} or $ctx->{copy_barcode};
-	}
-
-	my $copy;
-
-	if($ctx->{copy_id}) {
-		$copy = $e->retrieve_asset_copy(
-			[$ctx->{copy_id}, $flesh ]) or return $e->event;
-
-	} elsif( $ctx->{copy_barcode} ) {
-
-		$copy = $e->search_asset_copy(
-			[{barcode => $ctx->{copy_barcode}, deleted => 'f'}, $flesh ])->[0]
-			or return $e->event;
-	}
-
-	return undef unless $copy;
-
-	my $vol = $copy->call_number;
-	my $rec = $vol->record;
-	$ctx->{copy} = $copy;
-	$ctx->{volume} = $vol;
-	$copy->call_number($vol->id);
-	$ctx->{title} = $rec;
-	$vol->record($rec->id);
-
-	return undef;
+    my $e = shift;
+    my $ctx = shift;
+
+    my $flesh = { 
+        flesh => 2, 
+        flesh_fields => { 
+            acp => [ 'location', 'status', 'circ_lib', 'age_protect', 'call_number' ],
+            acn => [ 'record' ]
+        } 
+    };
+
+    if( $ctx->{copy} ) {
+        $ctx->{copy_id} = $ctx->{copy}->id 
+            unless $ctx->{copy_id} or $ctx->{copy_barcode};
+    }
+
+    my $copy;
+
+    if($ctx->{copy_id}) {
+        $copy = $e->retrieve_asset_copy(
+            [$ctx->{copy_id}, $flesh ]) or return $e->event;
+
+    } elsif( $ctx->{copy_barcode} ) {
+
+        $copy = $e->search_asset_copy(
+            [{barcode => $ctx->{copy_barcode}, deleted => 'f'}, $flesh ])->[0]
+            or return $e->event;
+    }
+
+    return undef unless $copy;
+
+    my $vol = $copy->call_number;
+    my $rec = $vol->record;
+    $ctx->{copy} = $copy;
+    $ctx->{volume} = $vol;
+    $copy->call_number($vol->id);
+    $ctx->{title} = $rec;
+    $vol->record($rec->id);
+
+    return undef;
 }
 
 
 
 sub fetch_user_data {
-	my( $e, $ctx ) = @_;
+    my( $e, $ctx ) = @_;
 
-	my $flesh = {
-		flesh => 2,
-		flesh_fields => {
-			au => [ qw/ profile home_ou card / ],
-			aou => [ 'ou_type' ],
-		}
-	};
+    my $flesh = {
+        flesh => 2,
+        flesh_fields => {
+            au => [ qw/ profile home_ou card / ],
+            aou => [ 'ou_type' ],
+        }
+    };
 
-	if( $ctx->{patron} ) {
-		$ctx->{patron_id} = $ctx->{patron}->id unless $ctx->{patron_id};
-	}
+    if( $ctx->{patron} ) {
+        $ctx->{patron_id} = $ctx->{patron}->id unless $ctx->{patron_id};
+    }
 
-	my $patron;
-	
-	if( $ctx->{patron_id} ) {
-		$patron = $e->retrieve_actor_user([$ctx->{patron_id}, $flesh]);
+    my $patron;
+    
+    if( $ctx->{patron_id} ) {
+        $patron = $e->retrieve_actor_user([$ctx->{patron_id}, $flesh]);
 
-	} elsif( $ctx->{patron_barcode} ) {
+    } elsif( $ctx->{patron_barcode} ) {
 
-		my $card = $e->search_actor_card( 
-			{ barcode => $ctx->{patron_barcode} } )->[0] or return $e->event;
+        my $card = $e->search_actor_card( 
+            { barcode => $ctx->{patron_barcode} } )->[0] or return $e->event;
 
-		$patron = $e->search_actor_user( 
-			[{ card => $card->id }, $flesh ]
-			)->[0] or return $e->event;
+        $patron = $e->search_actor_user( 
+            [{ card => $card->id }, $flesh ]
+            )->[0] or return $e->event;
 
-	} elsif( $ctx->{fetch_patron_by_circ_copy} ) {
+    } elsif( $ctx->{fetch_patron_by_circ_copy} ) {
 
-		if( my $copy = $ctx->{copy} ) {
-			my $circs = $e->search_action_circulation(
-				{ target_copy => $copy->id, checkin_time => undef });
+        if( my $copy = $ctx->{copy} ) {
+            my $circs = $e->search_action_circulation(
+                { target_copy => $copy->id, checkin_time => undef });
 
-			if( my $circ = $circs->[0] ) {
-				$patron = $e->retrieve_actor_user([$circ->usr, $flesh])
-					or return $e->event;
-			}
-		}
-	}
+            if( my $circ = $circs->[0] ) {
+                $patron = $e->retrieve_actor_user([$circ->usr, $flesh])
+                    or return $e->event;
+            }
+        }
+    }
 
-	return undef unless $ctx->{patron} = $patron;
+    return undef unless $ctx->{patron} = $patron;
 
-	flatten_groups($e);
+    flatten_groups($e);
 
-	$ctx->{requestor} = $ctx->{requestor} || $e->requestor;
+    $ctx->{requestor} = $ctx->{requestor} || $e->requestor;
 
-	if( $ctx->{fetch_patron_circ_info} ) {
-		my $circ_counts = $U->storagereq('open-ils.storage.actor.user.checked_out.count', $patron->id);
+    if( $ctx->{fetch_patron_circ_info} ) {
+        my $circ_counts = $U->storagereq('open-ils.storage.actor.user.checked_out.count', $patron->id);
 
-		$ctx->{patronOverdue} = $circ_counts->{overdue}  + $circ_counts->{long_overdue};
-		my $out = $ctx->{patronOverdue} + $circ_counts->{out};
+        $ctx->{patronOverdue} = $circ_counts->{overdue}  + $circ_counts->{long_overdue};
+        my $out = $ctx->{patronOverdue} + $circ_counts->{out};
 
-		$ctx->{patronItemsOut} = $out 
-			unless( $ctx->{patronItemsOut} and $ctx->{patronItemsOut} > $out );
+        $ctx->{patronItemsOut} = $out 
+            unless( $ctx->{patronItemsOut} and $ctx->{patronItemsOut} > $out );
 
-		$logger->debug("script_builder: patron overdue count is " . $ctx->{patronOverdue});
-	}
+        $logger->debug("script_builder: patron overdue count is " . $ctx->{patronOverdue});
+    }
 
-	if( $ctx->{fetch_patron_money_info} ) {
-		$ctx->{patronFines} = $U->patron_money_owed($patron->id);
-		$logger->debug("script_builder: patron fines determined to be ".$ctx->{patronFines});
-	}
+    if( $ctx->{fetch_patron_money_info} ) {
+        $ctx->{patronFines} = $U->patron_money_owed($patron->id);
+        $logger->debug("script_builder: patron fines determined to be ".$ctx->{patronFines});
+    }
 
-	unless( $ctx->{ignore_user_status} ) {
-		return OpenILS::Event->new('PATRON_INACTIVE')
-			unless $U->is_true($patron->active);
-	
-		return OpenILS::Event->new('PATRON_CARD_INACTIVE')
-			unless $U->is_true($patron->card->active);
-	
-		my $expire = DateTime::Format::ISO8601->new->parse_datetime(
-			cleanse_ISO8601($patron->expire_date));
-	
-		return OpenILS::Event->new('PATRON_ACCOUNT_EXPIRED')
-			if( CORE::time > $expire->epoch ) ;
-	}
+    unless( $ctx->{ignore_user_status} ) {
+        return OpenILS::Event->new('PATRON_INACTIVE')
+            unless $U->is_true($patron->active);
+    
+        return OpenILS::Event->new('PATRON_CARD_INACTIVE')
+            unless $U->is_true($patron->card->active);
+    
+        my $expire = DateTime::Format::ISO8601->new->parse_datetime(
+            cleanse_ISO8601($patron->expire_date));
+    
+        return OpenILS::Event->new('PATRON_ACCOUNT_EXPIRED')
+            if( CORE::time > $expire->epoch ) ;
+    }
 
-	return undef;
+    return undef;
 }
 
 
 sub flatten_groups {
-	my $e = shift;
-	my $tree = shift;
-
-	if(!%GROUP_SET) {
-		$GROUP_TREE = $e->search_permission_grp_tree(
-			[
-				{ parent => undef }, 
-				{ 
-				flesh => 100,
-					flesh_fields => { pgt => ['children'] }
-				} 
-			]
-		)->[0];
-		$tree = $GROUP_TREE;
-	}
-
-	return undef unless $tree;
-	$GROUP_SET{$tree->id} = $tree;
-	if( $tree->children ) {
-		flatten_groups($e, $_) for @{$tree->children};
-	}
+    my $e = shift;
+    my $tree = shift;
+
+    if(!%GROUP_SET) {
+        $GROUP_TREE = $e->search_permission_grp_tree(
+            [
+                { parent => undef }, 
+                { 
+                flesh => 100,
+                    flesh_fields => { pgt => ['children'] }
+                } 
+            ]
+        )->[0];
+        $tree = $GROUP_TREE;
+    }
+
+    return undef unless $tree;
+    $GROUP_SET{$tree->id} = $tree;
+    if( $tree->children ) {
+        flatten_groups($e, $_) for @{$tree->children};
+    }
 }
 
 sub flatten_org_tree {
-	my $tree = shift;
-	return undef unless $tree;
-	push( @ORG_LIST, $tree );
-	if( $tree->children ) {
-		flatten_org_tree($_) for @{$tree->children};
-	}
+    my $tree = shift;
+    return undef unless $tree;
+    push( @ORG_LIST, $tree );
+    if( $tree->children ) {
+        flatten_org_tree($_) for @{$tree->children};
+    }
 }
 
 
 
 sub insert_org_methods {
-	my ( $editor, $runner ) = @_;
-
-	if(!$ORG_TREE) {
-		$ORG_TREE = $U->get_org_tree;
-		flatten_org_tree($ORG_TREE);
-	}
-
-	my $r = $runner;
-	weaken($r);
-
-	$r->insert(__OILS_FUNC_isOrgDescendent  => 
-		sub {
-			my( $write_key, $sname, $id ) = @_;
-			my ($parent)	= grep { $_->shortname eq $sname } @ORG_LIST;
-			my ($child)		= grep { $_->id == $id } @ORG_LIST;
-			my $val = is_org_descendent( $parent, $child );
-			$logger->debug("script_builder: is_org_desc $sname:$id returned val $val, writing to $write_key");
-			$r->insert($write_key, $val, 1) if $val;
-			return $val;
-		}
-	);
-
-	$r->insert(__OILS_FUNC_hasCommonAncestor  => 
-		sub {
-			my( $write_key, $orgid1, $orgid2, $depth ) = @_;
-			my $val = has_common_ancestor( $orgid1, $orgid2, $depth );
-			$logger->debug("script_builder: has_common_ancestor resturned $val");
-			$r->insert($write_key, $val, 1) if $val;
-			return $val;
-		}
-	);
+    my ( $editor, $runner ) = @_;
+
+    if(!$ORG_TREE) {
+        $ORG_TREE = $U->get_org_tree;
+        flatten_org_tree($ORG_TREE);
+    }
+
+    my $r = $runner;
+    weaken($r);
+
+    $r->insert(__OILS_FUNC_isOrgDescendent  => 
+        sub {
+            my( $write_key, $sname, $id ) = @_;
+            my ($parent)    = grep { $_->shortname eq $sname } @ORG_LIST;
+            my ($child)     = grep { $_->id == $id } @ORG_LIST;
+            my $val = is_org_descendent( $parent, $child );
+            $logger->debug("script_builder: is_org_desc $sname:$id returned val $val, writing to $write_key");
+            $r->insert($write_key, $val, 1) if $val;
+            return $val;
+        }
+    );
+
+    $r->insert(__OILS_FUNC_hasCommonAncestor  => 
+        sub {
+            my( $write_key, $orgid1, $orgid2, $depth ) = @_;
+            my $val = has_common_ancestor( $orgid1, $orgid2, $depth );
+            $logger->debug("script_builder: has_common_ancestor resturned $val");
+            $r->insert($write_key, $val, 1) if $val;
+            return $val;
+        }
+    );
 }
 
 
 sub is_org_descendent {
-	my( $parent, $child ) = @_;
-	return 0 unless $parent and $child;
-	$logger->debug("script_builder: is_org_desc checking parent=".$parent->id.", child=".$child->id);
-	do {
-		return 0 unless defined $child->parent_ou;
-		return 1 if $parent->id == $child->id;
-	} while( ($child) = grep { $_->id == $child->parent_ou } @ORG_LIST );
-	return 0;
+    my( $parent, $child ) = @_;
+    return 0 unless $parent and $child;
+    $logger->debug("script_builder: is_org_desc checking parent=".$parent->id.", child=".$child->id);
+    do {
+        return 0 unless defined $child->parent_ou;
+        return 1 if $parent->id == $child->id;
+    } while( ($child) = grep { $_->id == $child->parent_ou } @ORG_LIST );
+    return 0;
 }
 
 sub has_common_ancestor {
-	my( $org1, $org2, $depth ) = @_;
-	return 0 unless $org1 and $org2;
-	$logger->debug("script_builder: has_common_ancestor checking orgs $org1 : $org2");
+    my( $org1, $org2, $depth ) = @_;
+    return 0 unless $org1 and $org2;
+    $logger->debug("script_builder: has_common_ancestor checking orgs $org1 : $org2");
 
-	return 1 if $org1 == $org2;
-	($org1) = grep { $_->id == $org1 } @ORG_LIST;
-	($org2) = grep { $_->id == $org2 } @ORG_LIST;
+    return 1 if $org1 == $org2;
+    ($org1) = grep { $_->id == $org1 } @ORG_LIST;
+    ($org2) = grep { $_->id == $org2 } @ORG_LIST;
 
-	my $p1 = find_parent_at_depth($org1, $depth);
-	my $p2 = find_parent_at_depth($org2, $depth);
+    my $p1 = find_parent_at_depth($org1, $depth);
+    my $p2 = find_parent_at_depth($org2, $depth);
 
-	return 1 if $p1->id == $p2->id;
-	return 0;
+    return 1 if $p1->id == $p2->id;
+    return 0;
 }
 
 
 sub find_parent_at_depth {
-	my $org = shift;
-	my $depth = shift;
-	return undef unless $org and $depth;
-	fetch_ou_types();
-	do {
-		my ($t) = grep { $_->id == $org->ou_type } @OU_TYPES;
-		return $org if $t->depth == $depth;
-	} while( ($org) = grep { $_->id == $org->parent_ou } @ORG_LIST );
-	return undef;	
+    my $org = shift;
+    my $depth = shift;
+    return undef unless $org and $depth;
+    fetch_ou_types();
+    do {
+        my ($t) = grep { $_->id == $org->ou_type } @OU_TYPES;
+        return $org if $t->depth == $depth;
+    } while( ($org) = grep { $_->id == $org->parent_ou } @ORG_LIST );
+    return undef;   
 }
 
 
 sub fetch_ou_types {
-	return if @OU_TYPES;
-	@OU_TYPES = @{new_editor()->retrieve_all_actor_org_unit_type()};
+    return if @OU_TYPES;
+    @OU_TYPES = @{new_editor()->retrieve_all_actor_org_unit_type()};
 }
 
 sub insert_copy_methods {
-	my( $e, $ctx,  $runner ) = @_;
-	my $reqr = $ctx->{requestor} || $e->requestor;
-	if( my $copy = $ctx->{copy} ) {
-		$runner->insert_method( 'environment.copy', '__OILS_FUNC_fetch_best_hold', sub {
-				my $key = shift;
-				$logger->debug("script_builder: searching for permitted hold for copy ".$copy->barcode);
-				my ($hold) = $holdcode->find_nearest_permitted_hold( $e, $copy, $reqr, 1 );  # do we need a new editor here since the xact may be dead??
-				$runner->insert( $key, $hold, 1 );
-			}
-		);
-	}
+    my( $e, $ctx,  $runner ) = @_;
+    my $reqr = $ctx->{requestor} || $e->requestor;
+    if( my $copy = $ctx->{copy} ) {
+        $runner->insert_method( 'environment.copy', '__OILS_FUNC_fetch_best_hold', sub {
+                my $key = shift;
+                $logger->debug("script_builder: searching for permitted hold for copy ".$copy->barcode);
+                my ($hold) = $holdcode->find_nearest_permitted_hold( $e, $copy, $reqr, 1 );  # do we need a new editor here since the xact may be dead??
+                $runner->insert( $key, $hold, 1 );
+            }
+        );
+    }
 }
 
 sub insert_user_funcs {
    my( $e, $ctx, $runner ) = @_;
 
    # tells how many holds a user has
-	$runner->insert(__OILS_FUNC_userHoldCount  => 
-		sub {
-			my( $write_key, $userid ) = @_;
+    $runner->insert(__OILS_FUNC_userHoldCount  => 
+        sub {
+            my( $write_key, $userid ) = @_;
          my $val = $holdcode->__user_hold_count(new_editor(), $userid);
          $logger->info("script_runner: user hold count is $val");
-			$runner->insert($write_key, $val, 1) if $val;
-			return $val;
-		}
-	);
-
-	$runner->insert(__OILS_FUNC_userCircsByCircmod  => 
-		sub {
-			my( $write_key, $userid ) = @_;
+            $runner->insert($write_key, $val, 1) if $val;
+            return $val;
+        }
+    );
+
+    $runner->insert(__OILS_FUNC_userCircsByCircmod  => 
+        sub {
+            my( $write_key, $userid ) = @_;
             use OpenSRF::Utils::JSON;
 
             # this bug ugly thing generates a count of checkouts by circ_modifier
@@ -414,9 +414,9 @@ sub insert_user_funcs {
             $breakdown->{$_->{circ_modifier}} = $_->{count} for @$mods;
             $logger->info("script_runner: Loaded checkouts by circ_modifier breakdown:". 
                 OpenSRF::Utils::JSON->perl2JSON($breakdown));
-			$runner->insert($write_key, $breakdown, 1) if (keys %$breakdown);
-		}
-	);
+            $runner->insert($write_key, $breakdown, 1) if (keys %$breakdown);
+        }
+    );
 
 }
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/StatCat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/StatCat.pm
index cf52a34..2d6262a 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/StatCat.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/StatCat.pm
@@ -26,294 +26,294 @@ my $U = $apputils;
 
 
 __PACKAGE__->register_method(
-	method	=> "retrieve_stat_cat_list",
-	argc	=> 1,
-	api_name	=> "open-ils.circ.stat_cat.actor.retrieve.batch");
+    method  => "retrieve_stat_cat_list",
+    argc    => 1,
+    api_name    => "open-ils.circ.stat_cat.actor.retrieve.batch");
 
 __PACKAGE__->register_method(
-	method	=> "retrieve_stat_cat_list",
-	argc	=> 1,
-	api_name	=> "open-ils.circ.stat_cat.asset.retrieve.batch");
+    method  => "retrieve_stat_cat_list",
+    argc    => 1,
+    api_name    => "open-ils.circ.stat_cat.asset.retrieve.batch");
 
 # retrieves all of the stat cats for a given org unit
 # if no orgid, user_session->home_ou is used
 
 sub retrieve_stat_cat_list {
-	my( $self, $client, $user_session, @sc ) = @_;
+    my( $self, $client, $user_session, @sc ) = @_;
 
-	if (ref($sc[0])) {
-		@sc = @{$sc[0]};
-	}
+    if (ref($sc[0])) {
+        @sc = @{$sc[0]};
+    }
 
-	my $method = "open-ils.storage.fleshed.actor.stat_cat.retrieve.batch.atomic"; 
-	if( $self->api_name =~ /asset/ ) {
-		$method = "open-ils.storage.fleshed.asset.stat_cat.retrieve.batch.atomic"; 
-	}
+    my $method = "open-ils.storage.fleshed.actor.stat_cat.retrieve.batch.atomic"; 
+    if( $self->api_name =~ /asset/ ) {
+        $method = "open-ils.storage.fleshed.asset.stat_cat.retrieve.batch.atomic"; 
+    }
 
-	my($user_obj, $evt) = $apputils->checkses($user_session); 
+    my($user_obj, $evt) = $apputils->checkses($user_session); 
     return $evt if $evt;
 
-	my $cats = $apputils->simple_scalar_request(
-				"open-ils.storage", $method, @sc);
+    my $cats = $apputils->simple_scalar_request(
+                "open-ils.storage", $method, @sc);
 
-	return [ sort { $a->name cmp $b->name } @$cats ];
+    return [ sort { $a->name cmp $b->name } @$cats ];
 }
 
 __PACKAGE__->register_method(
-	method	=> "retrieve_stat_cats",
-	api_name	=> "open-ils.circ.stat_cat.actor.retrieve.all");
+    method  => "retrieve_stat_cats",
+    api_name    => "open-ils.circ.stat_cat.actor.retrieve.all");
 
 __PACKAGE__->register_method(
-	method	=> "retrieve_stat_cats",
-	api_name	=> "open-ils.circ.stat_cat.asset.retrieve.all");
+    method  => "retrieve_stat_cats",
+    api_name    => "open-ils.circ.stat_cat.asset.retrieve.all");
 
 # retrieves all of the stat cats for a given org unit
 # if no orgid, user_session->home_ou is used
 
 sub retrieve_stat_cats {
-	my( $self, $client, $user_session, $orgid ) = @_;
+    my( $self, $client, $user_session, $orgid ) = @_;
 
-	my $method = "open-ils.storage.ranged.fleshed.actor.stat_cat.all.atomic"; 
-	if( $self->api_name =~ /asset/ ) {
-		$method = "open-ils.storage.ranged.fleshed.asset.stat_cat.all.atomic"; 
-	}
+    my $method = "open-ils.storage.ranged.fleshed.actor.stat_cat.all.atomic"; 
+    if( $self->api_name =~ /asset/ ) {
+        $method = "open-ils.storage.ranged.fleshed.asset.stat_cat.all.atomic"; 
+    }
 
-	my($user_obj, $evt) = $apputils->checkses($user_session); 
+    my($user_obj, $evt) = $apputils->checkses($user_session); 
     return $evt if $evt;
 
-	if(!$orgid) { $orgid = $user_obj->home_ou; }
-	my $cats = $apputils->simple_scalar_request(
-				"open-ils.storage", $method, $orgid );
+    if(!$orgid) { $orgid = $user_obj->home_ou; }
+    my $cats = $apputils->simple_scalar_request(
+                "open-ils.storage", $method, $orgid );
 
-	return [ sort { $a->name cmp $b->name } @$cats ];
+    return [ sort { $a->name cmp $b->name } @$cats ];
 }
 
 
 __PACKAGE__->register_method(
-	method	=> "retrieve_ranged_intersect_stat_cats",
-	api_name	=> "open-ils.circ.stat_cat.asset.multirange.intersect.retrieve");
+    method  => "retrieve_ranged_intersect_stat_cats",
+    api_name    => "open-ils.circ.stat_cat.asset.multirange.intersect.retrieve");
 
 sub retrieve_ranged_intersect_stat_cats {
-	my( $self, $client, $user_session, $orglist ) = @_;
+    my( $self, $client, $user_session, $orglist ) = @_;
 
-	my($user_obj, $evt) = $apputils->checkses($user_session); 
+    my($user_obj, $evt) = $apputils->checkses($user_session); 
     return $evt if $evt;
 
-	if(!$orglist) { $orglist = [ $user_obj->home_ou ]; }
+    if(!$orglist) { $orglist = [ $user_obj->home_ou ]; }
 
-	# uniquify, yay!
-	my %hash = map { ($_ => 1) } @$orglist;
-	$orglist = [ keys %hash ];
+    # uniquify, yay!
+    my %hash = map { ($_ => 1) } @$orglist;
+    $orglist = [ keys %hash ];
 
-	warn "range: @$orglist\n";
+    warn "range: @$orglist\n";
 
-	my	$method = "open-ils.storage.multiranged.intersect.fleshed.asset.stat_cat.all.atomic";
-	return $apputils->simple_scalar_request(
-				"open-ils.storage", $method, $orglist );
+    my  $method = "open-ils.storage.multiranged.intersect.fleshed.asset.stat_cat.all.atomic";
+    return $apputils->simple_scalar_request(
+                "open-ils.storage", $method, $orglist );
 }
 
 
 __PACKAGE__->register_method(
-	method	=> "retrieve_ranged_union_stat_cats",
-	api_name	=> "open-ils.circ.stat_cat.asset.multirange.union.retrieve");
+    method  => "retrieve_ranged_union_stat_cats",
+    api_name    => "open-ils.circ.stat_cat.asset.multirange.union.retrieve");
 
 sub retrieve_ranged_union_stat_cats {
-	my( $self, $client, $user_session, $orglist ) = @_;
+    my( $self, $client, $user_session, $orglist ) = @_;
 
-	my	$method = "open-ils.storage.multiranged.union.fleshed.asset.stat_cat.all.atomic";
-	use Data::Dumper;
-	warn "Retrieving stat_cats with method $method and orgs " . Dumper($orglist) . "\n";
+    my  $method = "open-ils.storage.multiranged.union.fleshed.asset.stat_cat.all.atomic";
+    use Data::Dumper;
+    warn "Retrieving stat_cats with method $method and orgs " . Dumper($orglist) . "\n";
 
-	my($user_obj, $evt) = $apputils->checkses($user_session); 
+    my($user_obj, $evt) = $apputils->checkses($user_session); 
     return $evt if $evt;
 
-	if(!$orglist) { $orglist = [ $user_obj->home_ou ]; }
+    if(!$orglist) { $orglist = [ $user_obj->home_ou ]; }
 
-	# uniquify, yay!
-	my %hash = map { ($_ => 1) } @$orglist;
-	$orglist = [ keys %hash ];
+    # uniquify, yay!
+    my %hash = map { ($_ => 1) } @$orglist;
+    $orglist = [ keys %hash ];
 
-	warn "range: @$orglist\n";
+    warn "range: @$orglist\n";
 
-	return $apputils->simple_scalar_request(
-				"open-ils.storage", $method, $orglist );
+    return $apputils->simple_scalar_request(
+                "open-ils.storage", $method, $orglist );
 }
 
 
 
 __PACKAGE__->register_method(
-	method	=> "stat_cat_create",
-	api_name	=> "open-ils.circ.stat_cat.asset.create");
+    method  => "stat_cat_create",
+    api_name    => "open-ils.circ.stat_cat.asset.create");
 
 __PACKAGE__->register_method(
-	method	=> "stat_cat_create",
-	api_name	=> "open-ils.circ.stat_cat.actor.create");
+    method  => "stat_cat_create",
+    api_name    => "open-ils.circ.stat_cat.actor.create");
 
 sub stat_cat_create {
-	my( $self, $client, $user_session, $stat_cat ) = @_;
-
-	my $method = "open-ils.storage.direct.actor.stat_cat.create";
-	my $entry_create = "open-ils.storage.direct.actor.stat_cat_entry.create";
-	my $default_entry_create = "open-ils.storage.direct.actor.stat_cat_entry_default.create";
-	my $perm = 'CREATE_PATRON_STAT_CAT';
-	my $eperm = 'CREATE_PATRON_STAT_CAT_ENTRY';
-	my $edperm = 'CREATE_PATRON_STAT_CAT_ENTRY_DEFAULT';
-
-	if($self->api_name =~ /asset/) {
-		$method = "open-ils.storage.direct.asset.stat_cat.create";
-		$entry_create = "open-ils.storage.direct.asset.stat_cat_entry.create";
-		$perm = 'CREATE_COPY_STAT_CAT_ENTRY';
-	}
-
-	#my $user_obj = $apputils->check_user_session($user_session); 
-	#my $orgid = $user_obj->home_ou();
-	my( $user_obj, $evt ) = $apputils->checkses($user_session);
-	return $evt if $evt;
-	$evt = $apputils->check_perms($user_obj->id, $stat_cat->owner, $perm);
-	return $evt if $evt;
-
-	if($stat_cat->entries) {
-		$evt = $apputils->check_perms($user_obj->id, $stat_cat->owner, $eperm);
-		return $evt if $evt;
-	}
-
-
-	my $session = $apputils->start_db_session();
-	$apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
-	my $newid = _create_stat_cat($session, $stat_cat, $method);
-
-	if( ref($stat_cat->entries) ) {
-		for my $entry (@{$stat_cat->entries}) {
-			$entry->stat_cat($newid);
-			my $entry_id = _create_stat_entry($session, $entry, $entry_create);
-			if( $self->api_name =~ /actor/ && ref($entry->default_entries) ) {
-				$evt = $apputils->check_perms($user_obj->id, $stat_cat->owner, $edperm);
-				return $evt if $evt;
-
-				for my $default_entry (@{$entry->default_entries}) {
-					$default_entry->stat_cat_entry($entry_id);
-					_create_stat_entry_default($session, $default_entry, $default_entry_create);
-				}
-			}
-		}
-	}
-
-	$apputils->commit_db_session($session);
-
-	$logger->debug("Stat cat creation successful with id $newid");
-
-	my $orgid = $user_obj->home_ou;
-	if( $self->api_name =~ /asset/ ) {
-		return _flesh_asset_cat($newid, $orgid);
-	} else {
-		return _flesh_user_cat($newid, $orgid);
-	}
+    my( $self, $client, $user_session, $stat_cat ) = @_;
+
+    my $method = "open-ils.storage.direct.actor.stat_cat.create";
+    my $entry_create = "open-ils.storage.direct.actor.stat_cat_entry.create";
+    my $default_entry_create = "open-ils.storage.direct.actor.stat_cat_entry_default.create";
+    my $perm = 'CREATE_PATRON_STAT_CAT';
+    my $eperm = 'CREATE_PATRON_STAT_CAT_ENTRY';
+    my $edperm = 'CREATE_PATRON_STAT_CAT_ENTRY_DEFAULT';
+
+    if($self->api_name =~ /asset/) {
+        $method = "open-ils.storage.direct.asset.stat_cat.create";
+        $entry_create = "open-ils.storage.direct.asset.stat_cat_entry.create";
+        $perm = 'CREATE_COPY_STAT_CAT_ENTRY';
+    }
+
+    #my $user_obj = $apputils->check_user_session($user_session); 
+    #my $orgid = $user_obj->home_ou();
+    my( $user_obj, $evt ) = $apputils->checkses($user_session);
+    return $evt if $evt;
+    $evt = $apputils->check_perms($user_obj->id, $stat_cat->owner, $perm);
+    return $evt if $evt;
+
+    if($stat_cat->entries) {
+        $evt = $apputils->check_perms($user_obj->id, $stat_cat->owner, $eperm);
+        return $evt if $evt;
+    }
+
+
+    my $session = $apputils->start_db_session();
+    $apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
+    my $newid = _create_stat_cat($session, $stat_cat, $method);
+
+    if( ref($stat_cat->entries) ) {
+        for my $entry (@{$stat_cat->entries}) {
+            $entry->stat_cat($newid);
+            my $entry_id = _create_stat_entry($session, $entry, $entry_create);
+            if( $self->api_name =~ /actor/ && ref($entry->default_entries) ) {
+                $evt = $apputils->check_perms($user_obj->id, $stat_cat->owner, $edperm);
+                return $evt if $evt;
+
+                for my $default_entry (@{$entry->default_entries}) {
+                    $default_entry->stat_cat_entry($entry_id);
+                    _create_stat_entry_default($session, $default_entry, $default_entry_create);
+                }
+            }
+        }
+    }
+
+    $apputils->commit_db_session($session);
+
+    $logger->debug("Stat cat creation successful with id $newid");
+
+    my $orgid = $user_obj->home_ou;
+    if( $self->api_name =~ /asset/ ) {
+        return _flesh_asset_cat($newid, $orgid);
+    } else {
+        return _flesh_user_cat($newid, $orgid);
+    }
 }
 
 
 sub _flesh_user_cat {
-	my $id = shift;
-	my $orgid = shift;
+    my $id = shift;
+    my $orgid = shift;
 
-	my $session = OpenSRF::AppSession->create("open-ils.storage");
-	my $cat = $session->request(
-		"open-ils.storage.direct.actor.stat_cat.retrieve",
-		$id )->gather(1);
+    my $session = OpenSRF::AppSession->create("open-ils.storage");
+    my $cat = $session->request(
+        "open-ils.storage.direct.actor.stat_cat.retrieve",
+        $id )->gather(1);
 
-	$cat->entries( 
-		$session->request(
-			"open-ils.storage.ranged.actor.stat_cat_entry.search.stat_cat.atomic",
-			$orgid, $id )->gather(1) );
+    $cat->entries( 
+        $session->request(
+            "open-ils.storage.ranged.actor.stat_cat_entry.search.stat_cat.atomic",
+            $orgid, $id )->gather(1) );
 
-	return $cat;
+    return $cat;
 }
 
 
 sub _flesh_asset_cat {
-	my $id = shift;
-	my $orgid = shift;
+    my $id = shift;
+    my $orgid = shift;
 
-	my $session = OpenSRF::AppSession->create("open-ils.storage");
-	my $cat = $session->request(
-		"open-ils.storage.direct.asset.stat_cat.retrieve",
-		$id )->gather(1);
+    my $session = OpenSRF::AppSession->create("open-ils.storage");
+    my $cat = $session->request(
+        "open-ils.storage.direct.asset.stat_cat.retrieve",
+        $id )->gather(1);
 
-	$cat->entries( 
-		$session->request(
-			"open-ils.storage.ranged.asset.stat_cat_entry.search.stat_cat.atomic",
-			$orgid,  $id )->gather(1) );
+    $cat->entries( 
+        $session->request(
+            "open-ils.storage.ranged.asset.stat_cat_entry.search.stat_cat.atomic",
+            $orgid,  $id )->gather(1) );
 
-	return $cat;
+    return $cat;
 
 }
 
 
 sub _create_stat_cat {
-	my( $session, $stat_cat, $method) = @_;
-	warn "Creating new stat cat with name " . $stat_cat->name . "\n";
-	$stat_cat->clear_id();
-	my $req = $session->request( $method, $stat_cat );
-	my $id = $req->gather(1);
-	if(!$id) {
-		throw OpenSRF::EX::ERROR 
-		("Error creating new statistical category"); }
-
-	warn "Stat cat create returned id $id\n";
-	return $id;
+    my( $session, $stat_cat, $method) = @_;
+    warn "Creating new stat cat with name " . $stat_cat->name . "\n";
+    $stat_cat->clear_id();
+    my $req = $session->request( $method, $stat_cat );
+    my $id = $req->gather(1);
+    if(!$id) {
+        throw OpenSRF::EX::ERROR 
+        ("Error creating new statistical category"); }
+
+    warn "Stat cat create returned id $id\n";
+    return $id;
 }
 
 
 sub _create_stat_entry {
-	my( $session, $stat_entry, $method) = @_;
+    my( $session, $stat_entry, $method) = @_;
 
-	warn "Creating new stat entry with value " . $stat_entry->value . "\n";
-	$stat_entry->clear_id();
+    warn "Creating new stat entry with value " . $stat_entry->value . "\n";
+    $stat_entry->clear_id();
 
-	my $req = $session->request($method, $stat_entry);
-	my $id = $req->gather(1);
+    my $req = $session->request($method, $stat_entry);
+    my $id = $req->gather(1);
 
-	warn "Stat entry " . Dumper($stat_entry) . "\n";	
-	
-	if(!$id) {
-		throw OpenSRF::EX::ERROR 
-		("Error creating new stat cat entry"); }
+    warn "Stat entry " . Dumper($stat_entry) . "\n";    
+    
+    if(!$id) {
+        throw OpenSRF::EX::ERROR 
+        ("Error creating new stat cat entry"); }
 
-	warn "Stat cat entry create returned id $id\n";
-	return $id;
+    warn "Stat cat entry create returned id $id\n";
+    return $id;
 }
 
 
 __PACKAGE__->register_method(
-	method	=> "update_stat_entry",
-	api_name	=> "open-ils.circ.stat_cat.actor.entry.update");
+    method  => "update_stat_entry",
+    api_name    => "open-ils.circ.stat_cat.actor.entry.update");
 
 __PACKAGE__->register_method(
-	method	=> "update_stat_entry",
-	api_name	=> "open-ils.circ.stat_cat.asset.entry.update");
+    method  => "update_stat_entry",
+    api_name    => "open-ils.circ.stat_cat.asset.entry.update");
 
 sub update_stat_entry {
-	my( $self, $client, $user_session, $entry ) = @_;
-
-
-	my $method = "open-ils.storage.direct.actor.stat_cat_entry.update";
-	my $perm = 'UPDATE_PATRON_STAT_CAT_ENTRY';
-	if($self->api_name =~ /asset/) {
-		$method = "open-ils.storage.direct.asset.stat_cat_entry.update";
-		$perm = 'UPDATE_COPY_STAT_CAT_ENTRY';
-	}
-
-	my( $user_obj, $evt )  = $apputils->checkses($user_session); 
-	return $evt if $evt;
-	$evt = $apputils->check_perms( $user_obj->id, $entry->owner, $perm );
-	return $evt if $evt;
-
-	my $session = $apputils->start_db_session();
-	$apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
-	my $req = $session->request($method, $entry); 
-	my $status = $req->gather(1);
-	$apputils->commit_db_session($session);
-	warn "stat cat entry with value " . $entry->value . " updated with status $status\n";
-	return 1;
+    my( $self, $client, $user_session, $entry ) = @_;
+
+
+    my $method = "open-ils.storage.direct.actor.stat_cat_entry.update";
+    my $perm = 'UPDATE_PATRON_STAT_CAT_ENTRY';
+    if($self->api_name =~ /asset/) {
+        $method = "open-ils.storage.direct.asset.stat_cat_entry.update";
+        $perm = 'UPDATE_COPY_STAT_CAT_ENTRY';
+    }
+
+    my( $user_obj, $evt )  = $apputils->checkses($user_session); 
+    return $evt if $evt;
+    $evt = $apputils->check_perms( $user_obj->id, $entry->owner, $perm );
+    return $evt if $evt;
+
+    my $session = $apputils->start_db_session();
+    $apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
+    my $req = $session->request($method, $entry); 
+    my $status = $req->gather(1);
+    $apputils->commit_db_session($session);
+    warn "stat cat entry with value " . $entry->value . " updated with status $status\n";
+    return 1;
 }
 
 sub _update_stat_entry_default {
@@ -326,8 +326,8 @@ sub _update_stat_entry_default {
     my $req = $session->request($method, $default_entry);
     my $status = $req->gather(1);
 
-    warn "Default stat entry " . Dumper($default_entry) . "\n";	
-	
+    warn "Default stat entry " . Dumper($default_entry) . "\n"; 
+    
     if(!$status) {
         throw OpenSRF::EX::ERROR 
         ("Error updating default stat cat entry"); }
@@ -337,97 +337,97 @@ sub _update_stat_entry_default {
 }
 
 __PACKAGE__->register_method(
-	method	=> "update_stat",
-	api_name	=> "open-ils.circ.stat_cat.actor.update");
+    method  => "update_stat",
+    api_name    => "open-ils.circ.stat_cat.actor.update");
 
 __PACKAGE__->register_method(
-	method	=> "update_stat",
-	api_name	=> "open-ils.circ.stat_cat.asset.update");
+    method  => "update_stat",
+    api_name    => "open-ils.circ.stat_cat.asset.update");
 
 sub update_stat {
-	my( $self, $client, $user_session, $cat ) = @_;
-
-	my $method = "open-ils.storage.direct.actor.stat_cat.update";
-	my $perm = 'UPDATE_PATRON_STAT_CAT';
-	if($self->api_name =~ /asset/) {
-		$method = "open-ils.storage.direct.asset.stat_cat.update";
-		$perm = 'UPDATE_COPY_STAT_CAT';
-	}
-
-	my( $user_obj, $evt )  = $apputils->checkses($user_session); 
-	return $evt if $evt;
-	$evt = $apputils->check_perms( $user_obj->id, $cat->owner, $perm );
-	return $evt if $evt;
-
-	my $session = $apputils->start_db_session();
-	$apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
-	my $req = $session->request($method, $cat); 
-	my $status = $req->gather(1);
-	$apputils->commit_db_session($session);
-	warn "stat cat with id " . $cat->id . " updated with status $status\n";
-	return 1;
+    my( $self, $client, $user_session, $cat ) = @_;
+
+    my $method = "open-ils.storage.direct.actor.stat_cat.update";
+    my $perm = 'UPDATE_PATRON_STAT_CAT';
+    if($self->api_name =~ /asset/) {
+        $method = "open-ils.storage.direct.asset.stat_cat.update";
+        $perm = 'UPDATE_COPY_STAT_CAT';
+    }
+
+    my( $user_obj, $evt )  = $apputils->checkses($user_session); 
+    return $evt if $evt;
+    $evt = $apputils->check_perms( $user_obj->id, $cat->owner, $perm );
+    return $evt if $evt;
+
+    my $session = $apputils->start_db_session();
+    $apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
+    my $req = $session->request($method, $cat); 
+    my $status = $req->gather(1);
+    $apputils->commit_db_session($session);
+    warn "stat cat with id " . $cat->id . " updated with status $status\n";
+    return 1;
 }
 
 
 __PACKAGE__->register_method(
-	method	=> "create_stat_entry",
-	api_name	=> "open-ils.circ.stat_cat.actor.entry.create");
+    method  => "create_stat_entry",
+    api_name    => "open-ils.circ.stat_cat.actor.entry.create");
 
 __PACKAGE__->register_method(
-	method	=> "create_stat_entry",
-	api_name	=> "open-ils.circ.stat_cat.asset.entry.create");
+    method  => "create_stat_entry",
+    api_name    => "open-ils.circ.stat_cat.asset.entry.create");
 
 sub create_stat_entry {
-	my( $self, $client, $user_session, $entry ) = @_;
-
-	my $method = "open-ils.storage.direct.actor.stat_cat_entry.create";
-	my $default_entry_create = "open-ils.storage.direct.actor.stat_cat_entry_default.create";
-	my $default_entry_update = "open-ils.storage.direct.actor.stat_cat_entry_default.update";
-	my $perm = 'CREATE_PATRON_STAT_CAT_ENTRY';
-	my $edperm = 'CREATE_PATRON_STAT_CAT_ENTRY_DEFAULT';
-	my $edperm_update = 'UPDATE_PATRON_STAT_CAT_ENTRY_DEFAULT';
-	my $type = 'actor';
-	if($self->api_name =~ /asset/) {
-		$method = "open-ils.storage.direct.asset.stat_cat_entry.create";
-		$perm = 'CREATE_COPY_STAT_CAT_ENTRY';
-		$type = 'asset';
-	}
-
-	my( $user_obj, $evt )  = $apputils->checkses($user_session); 
-	return $evt if $evt;
-	$evt = $apputils->check_perms( $user_obj->id, $entry->owner, $perm );
-	return $evt if $evt;
-
-	my $session = $apputils->start_db_session();
-	$apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
-	my $newid = _create_stat_entry($session, $entry, $method);
-
-	if( $self->api_name =~ /actor/ && ref($entry->default_entries) ) {
-		$evt = $apputils->check_perms($user_obj->id, $entry->owner, $edperm);
-		return $evt if $evt;
-
-		for my $default_entry (@{$entry->default_entries}) {
-			$default_entry->stat_cat_entry($newid);
-			my $target;
-			($target, $evt) = $apputils->fetch_stat_cat_entry_default_by_stat_cat_and_org($type, 
-													$default_entry->stat_cat, 
-													$default_entry->owner);
-			if( $target ) {
-				$evt = $apputils->check_perms($user_obj->id, $default_entry->owner, $edperm_update);
-				return $evt if $evt;
-				$target->stat_cat_entry($newid);
-				_update_stat_entry_default($session, $target, $default_entry_update);
-			} else {
-				_create_stat_entry_default($session, $default_entry, $default_entry_create);
-			}
-		}
-	}
-
-	$apputils->commit_db_session($session);
-
-	$logger->info("created stat cat entry $newid");
-
-	return $newid;
+    my( $self, $client, $user_session, $entry ) = @_;
+
+    my $method = "open-ils.storage.direct.actor.stat_cat_entry.create";
+    my $default_entry_create = "open-ils.storage.direct.actor.stat_cat_entry_default.create";
+    my $default_entry_update = "open-ils.storage.direct.actor.stat_cat_entry_default.update";
+    my $perm = 'CREATE_PATRON_STAT_CAT_ENTRY';
+    my $edperm = 'CREATE_PATRON_STAT_CAT_ENTRY_DEFAULT';
+    my $edperm_update = 'UPDATE_PATRON_STAT_CAT_ENTRY_DEFAULT';
+    my $type = 'actor';
+    if($self->api_name =~ /asset/) {
+        $method = "open-ils.storage.direct.asset.stat_cat_entry.create";
+        $perm = 'CREATE_COPY_STAT_CAT_ENTRY';
+        $type = 'asset';
+    }
+
+    my( $user_obj, $evt )  = $apputils->checkses($user_session); 
+    return $evt if $evt;
+    $evt = $apputils->check_perms( $user_obj->id, $entry->owner, $perm );
+    return $evt if $evt;
+
+    my $session = $apputils->start_db_session();
+    $apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
+    my $newid = _create_stat_entry($session, $entry, $method);
+
+    if( $self->api_name =~ /actor/ && ref($entry->default_entries) ) {
+        $evt = $apputils->check_perms($user_obj->id, $entry->owner, $edperm);
+        return $evt if $evt;
+
+        for my $default_entry (@{$entry->default_entries}) {
+            $default_entry->stat_cat_entry($newid);
+            my $target;
+            ($target, $evt) = $apputils->fetch_stat_cat_entry_default_by_stat_cat_and_org($type, 
+                                                    $default_entry->stat_cat, 
+                                                    $default_entry->owner);
+            if( $target ) {
+                $evt = $apputils->check_perms($user_obj->id, $default_entry->owner, $edperm_update);
+                return $evt if $evt;
+                $target->stat_cat_entry($newid);
+                _update_stat_entry_default($session, $target, $default_entry_update);
+            } else {
+                _create_stat_entry_default($session, $default_entry, $default_entry_create);
+            }
+        }
+    }
+
+    $apputils->commit_db_session($session);
+
+    $logger->info("created stat cat entry $newid");
+
+    return $newid;
 }
 
 __PACKAGE__->register_method(
@@ -482,7 +482,7 @@ sub _create_stat_entry_default {
     my $req = $session->request($method, $stat_entry_default);
     my $id = $req->gather(1);
 
-    warn "Default stat entry " . Dumper($stat_entry_default) . "\n";	
+    warn "Default stat entry " . Dumper($stat_entry_default) . "\n";    
 
     if(!$id) {
         throw OpenSRF::EX::ERROR 
@@ -493,225 +493,225 @@ sub _create_stat_entry_default {
 }
 
 __PACKAGE__->register_method(
-	method	=> "create_stat_map",
-	api_name	=> "open-ils.circ.stat_cat.actor.user_map.create");
+    method  => "create_stat_map",
+    api_name    => "open-ils.circ.stat_cat.actor.user_map.create");
 
 __PACKAGE__->register_method(
-	method	=> "create_stat_map",
-	api_name	=> "open-ils.circ.stat_cat.asset.copy_map.create");
+    method  => "create_stat_map",
+    api_name    => "open-ils.circ.stat_cat.asset.copy_map.create");
 
 sub create_stat_map {
-	my( $self, $client, $user_session, $map ) = @_;
+    my( $self, $client, $user_session, $map ) = @_;
 
 
-	my ( $evt, $copy, $volume, $patron, $user_obj );
+    my ( $evt, $copy, $volume, $patron, $user_obj );
 
-	my $method = "open-ils.storage.direct.actor.stat_cat_entry_user_map.create";
-	my $ret = "open-ils.storage.direct.actor.stat_cat_entry_user_map.retrieve";
-	my $perm = 'CREATE_PATRON_STAT_CAT_ENTRY_MAP';
-	my $perm_org;
+    my $method = "open-ils.storage.direct.actor.stat_cat_entry_user_map.create";
+    my $ret = "open-ils.storage.direct.actor.stat_cat_entry_user_map.retrieve";
+    my $perm = 'CREATE_PATRON_STAT_CAT_ENTRY_MAP';
+    my $perm_org;
 
-	if($self->api_name =~ /asset/) {
-		$method = "open-ils.storage.direct.asset.stat_cat_entry_copy_map.create";
-		$ret = "open-ils.storage.direct.asset.stat_cat_entry_copy_map.retrieve";
-		$perm = 'CREATE_COPY_STAT_CAT_ENTRY_MAP';
-		( $copy, $evt ) = $apputils->fetch_copy($map->owning_copy);
-		return $evt if $evt;
-		( $volume, $evt ) = $apputils->fetch_callnumber($copy->call_number);
-		return $evt if $evt;
-		$perm_org = $volume->owning_lib;
+    if($self->api_name =~ /asset/) {
+        $method = "open-ils.storage.direct.asset.stat_cat_entry_copy_map.create";
+        $ret = "open-ils.storage.direct.asset.stat_cat_entry_copy_map.retrieve";
+        $perm = 'CREATE_COPY_STAT_CAT_ENTRY_MAP';
+        ( $copy, $evt ) = $apputils->fetch_copy($map->owning_copy);
+        return $evt if $evt;
+        ( $volume, $evt ) = $apputils->fetch_callnumber($copy->call_number);
+        return $evt if $evt;
+        $perm_org = $volume->owning_lib;
 
-	} else {
-		($patron, $evt) = $apputils->fetch_user($map->target_usr);
-		return $evt if $evt;
-		$perm_org = $patron->home_ou;
-	}
+    } else {
+        ($patron, $evt) = $apputils->fetch_user($map->target_usr);
+        return $evt if $evt;
+        $perm_org = $patron->home_ou;
+    }
 
-	( $user_obj, $evt )  = $apputils->checkses($user_session); 
-	return $evt if $evt;
-	$evt = $apputils->check_perms( $user_obj->id, $perm_org, $perm );
-	return $evt if $evt;
+    ( $user_obj, $evt )  = $apputils->checkses($user_session); 
+    return $evt if $evt;
+    $evt = $apputils->check_perms( $user_obj->id, $perm_org, $perm );
+    return $evt if $evt;
 
-	$logger->debug( $user_obj->id . " creating new stat cat map" );
+    $logger->debug( $user_obj->id . " creating new stat cat map" );
 
-	$map->clear_id();
+    $map->clear_id();
 
-	my $session = $apputils->start_db_session();
-	$apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
-	my $req = $session->request($method, $map); 
-	my $newid = $req->gather(1);
-	warn "Created new stat cat map with id $newid\n";
-	$apputils->commit_db_session($session);
+    my $session = $apputils->start_db_session();
+    $apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
+    my $req = $session->request($method, $map); 
+    my $newid = $req->gather(1);
+    warn "Created new stat cat map with id $newid\n";
+    $apputils->commit_db_session($session);
 
-	return $apputils->simple_scalar_request( "open-ils.storage", $ret, $newid );
+    return $apputils->simple_scalar_request( "open-ils.storage", $ret, $newid );
 
 }
 
 
 __PACKAGE__->register_method(
-	method	=> "update_stat_map",
-	api_name	=> "open-ils.circ.stat_cat.actor.user_map.update");
+    method  => "update_stat_map",
+    api_name    => "open-ils.circ.stat_cat.actor.user_map.update");
 
 __PACKAGE__->register_method(
-	method	=> "update_stat_map",
-	api_name	=> "open-ils.circ.stat_cat.asset.copy_map.update");
+    method  => "update_stat_map",
+    api_name    => "open-ils.circ.stat_cat.asset.copy_map.update");
 
 sub update_stat_map {
-	my( $self, $client, $user_session, $map ) = @_;
+    my( $self, $client, $user_session, $map ) = @_;
 
-	my ( $evt, $copy, $volume, $patron, $user_obj );
+    my ( $evt, $copy, $volume, $patron, $user_obj );
 
-	my $method = "open-ils.storage.direct.actor.stat_cat_entry_user_map.update";
-	my $perm = 'UPDATE_PATRON_STAT_ENTRY_MAP';
-	my $perm_org;
+    my $method = "open-ils.storage.direct.actor.stat_cat_entry_user_map.update";
+    my $perm = 'UPDATE_PATRON_STAT_ENTRY_MAP';
+    my $perm_org;
 
-	if($self->api_name =~ /asset/) {
-		$method = "open-ils.storage.direct.asset.stat_cat_entry_copy_map.update";
-		$perm = 'UPDATE_COPY_STAT_ENTRY_MAP';
-		( $copy, $evt ) = $apputils->fetch_copy($map->owning_copy);
-		return $evt if $evt;
-		( $volume, $evt ) = $apputils->fetch_callnumber($copy->call_number);
-		return $evt if $evt;
-		$perm_org = $volume->owning_lib;
+    if($self->api_name =~ /asset/) {
+        $method = "open-ils.storage.direct.asset.stat_cat_entry_copy_map.update";
+        $perm = 'UPDATE_COPY_STAT_ENTRY_MAP';
+        ( $copy, $evt ) = $apputils->fetch_copy($map->owning_copy);
+        return $evt if $evt;
+        ( $volume, $evt ) = $apputils->fetch_callnumber($copy->call_number);
+        return $evt if $evt;
+        $perm_org = $volume->owning_lib;
 
-	} else {
-		($patron, $evt) = $apputils->fetch_user($map->target_usr);
-		return $evt if $evt;
-		$perm_org = $patron->home_ou;
-	}
+    } else {
+        ($patron, $evt) = $apputils->fetch_user($map->target_usr);
+        return $evt if $evt;
+        $perm_org = $patron->home_ou;
+    }
 
 
-	( $user_obj, $evt )  = $apputils->checkses($user_session); 
-	return $evt if $evt;
-	$evt = $apputils->check_perms( $user_obj->id, $perm_org, $perm );
-	return $evt if $evt;
+    ( $user_obj, $evt )  = $apputils->checkses($user_session); 
+    return $evt if $evt;
+    $evt = $apputils->check_perms( $user_obj->id, $perm_org, $perm );
+    return $evt if $evt;
 
 
-	my $session = $apputils->start_db_session();
-	$apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
-	my $req = $session->request($method, $map); 
-	my $newid = $req->gather(1);
-	warn "Updated new stat cat map with id $newid\n";
-	$apputils->commit_db_session($session);
+    my $session = $apputils->start_db_session();
+    $apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
+    my $req = $session->request($method, $map); 
+    my $newid = $req->gather(1);
+    warn "Updated new stat cat map with id $newid\n";
+    $apputils->commit_db_session($session);
 
-	return $newid;
+    return $newid;
 }
 
 
 
 __PACKAGE__->register_method(
-	method	=> "retrieve_maps",
-	api_name	=> "open-ils.circ.stat_cat.actor.user_map.retrieve");
+    method  => "retrieve_maps",
+    api_name    => "open-ils.circ.stat_cat.actor.user_map.retrieve");
 
 __PACKAGE__->register_method(
-	method	=> "retrieve_maps",
-	api_name	=> "open-ils.circ.stat_cat.asset.copy_map.retrieve");
+    method  => "retrieve_maps",
+    api_name    => "open-ils.circ.stat_cat.asset.copy_map.retrieve");
 
 sub retrieve_maps {
-	my( $self, $client, $user_session, $target ) = @_;
+    my( $self, $client, $user_session, $target ) = @_;
 
 
-	my( $user_obj, $evt ) = $apputils->checkses($user_session); 
-	return $evt if $evt;
+    my( $user_obj, $evt ) = $apputils->checkses($user_session); 
+    return $evt if $evt;
 
-	my	$method = "open-ils.storage.direct.asset.stat_cat_entry_copy_map.search.owning_copy.atomic";
-	if($self->api_name =~ /actor/ ) {
-		if(!$target) { $target = $user_obj->id; }
-		$method = "open-ils.storage.direct.actor.stat_cat_entry_user_map.search.target_usr.atomic";
-	}
+    my  $method = "open-ils.storage.direct.asset.stat_cat_entry_copy_map.search.owning_copy.atomic";
+    if($self->api_name =~ /actor/ ) {
+        if(!$target) { $target = $user_obj->id; }
+        $method = "open-ils.storage.direct.actor.stat_cat_entry_user_map.search.target_usr.atomic";
+    }
 
-	return $apputils->simple_scalar_request("open-ils.storage", $method, $target);
+    return $apputils->simple_scalar_request("open-ils.storage", $method, $target);
 }
 
 
 
 
 __PACKAGE__->register_method(
-	method	=> "delete_stats",
-	api_name	=> "open-ils.circ.stat_cat.actor.delete");
+    method  => "delete_stats",
+    api_name    => "open-ils.circ.stat_cat.actor.delete");
 
 __PACKAGE__->register_method(
-	method	=> "delete_stats",
-	api_name	=> "open-ils.circ.stat_cat.asset.delete");
+    method  => "delete_stats",
+    api_name    => "open-ils.circ.stat_cat.asset.delete");
 
 sub delete_stats {
-	my( $self, $client, $user_session, $target ) = @_;
-	
-	my $cat;
+    my( $self, $client, $user_session, $target ) = @_;
+    
+    my $cat;
 
-	my $type = "actor";
-	my $perm = 'DELETE_PATRON_STAT_CAT';
-	if($self->api_name =~ /asset/) { 
-		$type = "asset"; 
-		$perm = 'DELETE_COPY_STAT_CAT';
-	}
+    my $type = "actor";
+    my $perm = 'DELETE_PATRON_STAT_CAT';
+    if($self->api_name =~ /asset/) { 
+        $type = "asset"; 
+        $perm = 'DELETE_COPY_STAT_CAT';
+    }
 
-	my( $user_obj, $evt )  = $apputils->checkses($user_session); 
-	return $evt if $evt;
+    my( $user_obj, $evt )  = $apputils->checkses($user_session); 
+    return $evt if $evt;
 
-	( $cat, $evt ) = $apputils->fetch_stat_cat( $type, $target );
-	return $evt if $evt;
+    ( $cat, $evt ) = $apputils->fetch_stat_cat( $type, $target );
+    return $evt if $evt;
 
-	$evt = $apputils->check_perms( $user_obj->id, $cat->owner, $perm );
-	return $evt if $evt;
+    $evt = $apputils->check_perms( $user_obj->id, $cat->owner, $perm );
+    return $evt if $evt;
 
-	my $session = OpenSRF::AppSession->create("open-ils.storage");
-	return _delete_stats($session, $target, $type);
+    my $session = OpenSRF::AppSession->create("open-ils.storage");
+    return _delete_stats($session, $target, $type);
 }
 
 sub _delete_stats {
-	my( $session, $stat, $type) = @_;
+    my( $session, $stat, $type) = @_;
 
-	my	$method = "open-ils.storage.direct.asset.stat_cat.delete";
-	if($type =~ /actor/ ) {
-		$method = "open-ils.storage.direct.actor.stat_cat.delete";
-	}
-	return $session->request($method, $stat)->gather(1);
+    my  $method = "open-ils.storage.direct.asset.stat_cat.delete";
+    if($type =~ /actor/ ) {
+        $method = "open-ils.storage.direct.actor.stat_cat.delete";
+    }
+    return $session->request($method, $stat)->gather(1);
 }
 
 
 
 __PACKAGE__->register_method(
-	method	=> "delete_entry",
-	api_name	=> "open-ils.circ.stat_cat.actor.entry.delete");
+    method  => "delete_entry",
+    api_name    => "open-ils.circ.stat_cat.actor.entry.delete");
 
 __PACKAGE__->register_method(
-	method	=> "delete_entry",
-	api_name	=> "open-ils.circ.stat_cat.asset.entry.delete");
+    method  => "delete_entry",
+    api_name    => "open-ils.circ.stat_cat.asset.entry.delete");
 
 sub delete_entry {
-	my( $self, $client, $user_session, $target ) = @_;
+    my( $self, $client, $user_session, $target ) = @_;
 
-	my $type = "actor";
-	my $perm = 'DELETE_PATRON_STAT_CAT_ENTRY';
-	if($self->api_name =~ /asset/) { 
-		$type = "asset"; 
-		$perm = 'DELETE_COPY_STAT_CAT_ENTRY';
-	}
+    my $type = "actor";
+    my $perm = 'DELETE_PATRON_STAT_CAT_ENTRY';
+    if($self->api_name =~ /asset/) { 
+        $type = "asset"; 
+        $perm = 'DELETE_COPY_STAT_CAT_ENTRY';
+    }
 
-	my $entry;
-	my( $user_obj, $evt )  = $apputils->checkses($user_session); 
-	return $evt if $evt;
+    my $entry;
+    my( $user_obj, $evt )  = $apputils->checkses($user_session); 
+    return $evt if $evt;
 
-	( $entry, $evt ) = $apputils->fetch_stat_cat_entry( $type, $target );
-	return $evt if $evt;
+    ( $entry, $evt ) = $apputils->fetch_stat_cat_entry( $type, $target );
+    return $evt if $evt;
 
-	$evt = $apputils->check_perms( $user_obj->id, $entry->owner, $perm );
-	return $evt if $evt;
+    $evt = $apputils->check_perms( $user_obj->id, $entry->owner, $perm );
+    return $evt if $evt;
 
-	my $session = OpenSRF::AppSession->create("open-ils.storage");
-	return _delete_entry($session, $target, $type);
+    my $session = OpenSRF::AppSession->create("open-ils.storage");
+    return _delete_entry($session, $target, $type);
 }
 
 sub _delete_entry {
-	my( $session, $stat_entry, $type) = @_;
+    my( $session, $stat_entry, $type) = @_;
 
-	my	$method = "open-ils.storage.direct.asset.stat_cat_entry.delete";
-	if($type =~ /actor/ ) {
-		$method = "open-ils.storage.direct.actor.stat_cat_entry.delete";
-	}
+    my  $method = "open-ils.storage.direct.asset.stat_cat_entry.delete";
+    if($type =~ /actor/ ) {
+        $method = "open-ils.storage.direct.actor.stat_cat_entry.delete";
+    }
 
-	return $session->request($method, $stat_entry)->gather(1);
+    return $session->request($method, $stat_entry)->gather(1);
 }
 
 
@@ -751,40 +751,40 @@ sub _delete_entry_default {
 }
 
 __PACKAGE__->register_method(
-	method => 'fetch_stats_by_copy',
-	api_name	=> 'open-ils.circ.asset.stat_cat_entries.fleshed.retrieve_by_copy',
+    method => 'fetch_stats_by_copy',
+    api_name    => 'open-ils.circ.asset.stat_cat_entries.fleshed.retrieve_by_copy',
 );
 
 
 sub fetch_stats_by_copy {
-	my( $self, $conn, $args ) = @_;
+    my( $self, $conn, $args ) = @_;
 
-	my @entries;
+    my @entries;
 
-	if( $$args{public} ) {
-		my $maps = $U->cstorereq(
-			'open-ils.cstore.direct.asset.stat_cat_entry_copy_map.search.atomic', { owning_copy => $$args{copyid} });
+    if( $$args{public} ) {
+        my $maps = $U->cstorereq(
+            'open-ils.cstore.direct.asset.stat_cat_entry_copy_map.search.atomic', { owning_copy => $$args{copyid} });
 
 
-		warn "here\n";
-		for my $map (@$maps) {
+        warn "here\n";
+        for my $map (@$maps) {
 
-			warn "map ".$map->id."\n";
-			warn "map ".$map->stat_cat_entry."\n";
+            warn "map ".$map->id."\n";
+            warn "map ".$map->stat_cat_entry."\n";
 
-			my $entry = $U->cstorereq(
-				'open-ils.cstore.direct.asset.stat_cat_entry.retrieve', $map->stat_cat_entry);
+            my $entry = $U->cstorereq(
+                'open-ils.cstore.direct.asset.stat_cat_entry.retrieve', $map->stat_cat_entry);
 
-			warn "Found entry ".$entry->id."\n";
+            warn "Found entry ".$entry->id."\n";
 
-			my $cat = $U->cstorereq(
-				'open-ils.cstore.direct.asset.stat_cat.retrieve', $entry->stat_cat );
-			$entry->stat_cat( $cat );
-			push( @entries, $entry );
-		}
-	}
+            my $cat = $U->cstorereq(
+                'open-ils.cstore.direct.asset.stat_cat.retrieve', $entry->stat_cat );
+            $entry->stat_cat( $cat );
+            push( @entries, $entry );
+        }
+    }
 
-	return \@entries;
+    return \@entries;
 }
 
 __PACKAGE__->register_method(
@@ -794,7 +794,7 @@ __PACKAGE__->register_method(
 
 sub retrieve_entry_default {
     my( $self, $client, $user_session, $orgid, $stat_cat ) = @_;
-	
+    
     my $method = "open-ils.storage.actor.stat_cat_entry_default.ancestor.retrieve.atomic";
 
     return $apputils->simple_scalar_request( "open-ils.storage", $method, $orgid, $stat_cat);
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Survey.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Survey.pm
index 9c4bfc6..3b83e36 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Survey.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Survey.pm
@@ -28,105 +28,105 @@ my $apputils = "OpenILS::Application::AppUtils";
 # - creates a new survey
 # expects a survey complete with questions and answers
 __PACKAGE__->register_method(
-	method	=> "add_survey",
-	api_name	=> "open-ils.circ.survey.create");
+    method  => "add_survey",
+    api_name    => "open-ils.circ.survey.create");
 
 sub add_survey {
-	my( $self, $client, $user_session, $survey ) = @_;
+    my( $self, $client, $user_session, $survey ) = @_;
 
-	my($user_obj, $evt) = $apputils->checkses($user_session); 
+    my($user_obj, $evt) = $apputils->checkses($user_session); 
     return $evt if $evt;
 
-	my $session = $apputils->start_db_session();
-	$apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
-	my $err = undef; my $id;
+    my $session = $apputils->start_db_session();
+    $apputils->set_audit_info($session, $user_session, $user_obj->id, $user_obj->wsid);
+    my $err = undef; my $id;
 
 
-	try {
+    try {
 
-		$survey = _add_survey($session, $survey);
-		_add_questions($session, $survey);
-		$apputils->commit_db_session($session);
+        $survey = _add_survey($session, $survey);
+        _add_questions($session, $survey);
+        $apputils->commit_db_session($session);
 
-	} catch Error with {
-		my $e = shift;
-		$err = "Error creating survey: $e\n";
-		$apputils->rollback_db_session($session);
-	};
+    } catch Error with {
+        my $e = shift;
+        $err = "Error creating survey: $e\n";
+        $apputils->rollback_db_session($session);
+    };
 
-	if($err) { throw OpenSRF::EX::ERROR ($err); }
+    if($err) { throw OpenSRF::EX::ERROR ($err); }
 
-	# re-retrieve the survey from the db and return it
-	return get_fleshed_survey($self, $client, $survey->id() );
+    # re-retrieve the survey from the db and return it
+    return get_fleshed_survey($self, $client, $survey->id() );
 }
 
 
 sub _add_survey {
-	my($session, $survey) = @_;
-	my $req = $session->request(
-		"open-ils.storage.direct.action.survey.create",
-		$survey );
+    my($session, $survey) = @_;
+    my $req = $session->request(
+        "open-ils.storage.direct.action.survey.create",
+        $survey );
 
-	my $id = $req->gather(1);
+    my $id = $req->gather(1);
 
-	if(!$id) { 
-		throw OpenSRF::EX::ERROR 
-			("Unable to create new survey " . $survey->name()); 
-	}
+    if(!$id) { 
+        throw OpenSRF::EX::ERROR 
+            ("Unable to create new survey " . $survey->name()); 
+    }
 
-	$survey->id($id);
-	return $survey;
+    $survey->id($id);
+    return $survey;
 }
 
 sub _update_survey {
-	my($session, $survey) = @_;
+    my($session, $survey) = @_;
 }
 
 sub _add_questions {
-	my($session, $survey) = @_;
-
-	# create new questions in the db
-	if( $survey->questions() ) {
-		for my $question (@{$survey->questions()}){
-	
-			$question->survey($survey->id());
-			my $virtual_id = $question->id();
-			$question->clear_id();
-
-	
-			my $req = $session->request(
-				'open-ils.storage.direct.action.survey_question.create',
-				$question );
-			my $new_id = $req->gather(1);
-	
-			if(!$new_id) {
-				throw OpenSRF::EX::ERROR
-					("Error creating new survey question " . $question->question() . "\n")
-			}
-	
-			# now update the responses to this question
-			if($question->answers()) {
-				for my $answer (@{$question->answers()}) {
-					$answer->question($new_id);
-					_add_answer($session,$answer);
-				}
-			}
-		}
-	}
+    my($session, $survey) = @_;
+
+    # create new questions in the db
+    if( $survey->questions() ) {
+        for my $question (@{$survey->questions()}){
+    
+            $question->survey($survey->id());
+            my $virtual_id = $question->id();
+            $question->clear_id();
+
+    
+            my $req = $session->request(
+                'open-ils.storage.direct.action.survey_question.create',
+                $question );
+            my $new_id = $req->gather(1);
+    
+            if(!$new_id) {
+                throw OpenSRF::EX::ERROR
+                    ("Error creating new survey question " . $question->question() . "\n")
+            }
+    
+            # now update the responses to this question
+            if($question->answers()) {
+                for my $answer (@{$question->answers()}) {
+                    $answer->question($new_id);
+                    _add_answer($session,$answer);
+                }
+            }
+        }
+    }
 }
 
 
 sub _add_answer {
-	my($session, $answer) = @_;
-	$answer->clear_id();
-	my $req = $session->request(
-		"open-ils.storage.direct.action.survey_answer.create",
-		$answer );
-	my $id = $req->gather(1);
-	if(!$id) {
-		throw OpenSRF::EX::ERROR
-			("Error creating survey answer " . $answer->answer() );
-	}
+    my($session, $answer) = @_;
+    $answer->clear_id();
+    my $req = $session->request(
+        "open-ils.storage.direct.action.survey_answer.create",
+        $answer );
+    my $id = $req->gather(1);
+    if(!$id) {
+        throw OpenSRF::EX::ERROR
+            ("Error creating survey answer " . $answer->answer() );
+    }
 
 }
 
@@ -134,253 +134,253 @@ sub _add_answer {
 
 # retrieve surveys for a specific org subtree.
 __PACKAGE__->register_method(
-	method	=> "get_required_surveys",
-	api_name	=> "open-ils.circ.survey.retrieve.required");
+    method  => "get_required_surveys",
+    api_name    => "open-ils.circ.survey.retrieve.required");
 
 sub get_required_surveys {
-	my( $self, $client, $user_session ) = @_;
-	
+    my( $self, $client, $user_session ) = @_;
+    
 
-	my ($user_obj, $evt) = $apputils->checkses($user_session); 
+    my ($user_obj, $evt) = $apputils->checkses($user_session); 
     return $evt if $evt;
 
-	my $orgid = $user_obj->ws_ou() ? $user_obj->ws_ou() : $user_obj->home_ou();
-	my $surveys = $apputils->simple_scalar_request(
-		"open-ils.storage",
-		"open-ils.storage.action.survey.required.atomic",
-		$orgid );
+    my $orgid = $user_obj->ws_ou() ? $user_obj->ws_ou() : $user_obj->home_ou();
+    my $surveys = $apputils->simple_scalar_request(
+        "open-ils.storage",
+        "open-ils.storage.action.survey.required.atomic",
+        $orgid );
 
-	my @fleshed;
-	for my $survey (@$surveys) {
-		push(@fleshed, get_fleshed_survey($self, $client, $survey));
-	}
-	return \@fleshed;
+    my @fleshed;
+    for my $survey (@$surveys) {
+        push(@fleshed, get_fleshed_survey($self, $client, $survey));
+    }
+    return \@fleshed;
 
 }
 
 __PACKAGE__->register_method(
-	method	=> "get_survey_responses",
-	api_name	=> "open-ils.circ.survey.response.retrieve");
+    method  => "get_survey_responses",
+    api_name    => "open-ils.circ.survey.response.retrieve");
 
 sub get_survey_responses {
-	my( $self, $client, $user_session, $survey_id, $user_id ) = @_;
-	
-	if(!$user_id) {
-	    my ($user_obj, $evt) = $apputils->checkses($user_session); 
+    my( $self, $client, $user_session, $survey_id, $user_id ) = @_;
+    
+    if(!$user_id) {
+        my ($user_obj, $evt) = $apputils->checkses($user_session); 
         return $evt if $evt;
-		$user_id = $user_obj->id;
-	}
+        $user_id = $user_obj->id;
+    }
 
-	my $res = $apputils->simple_scalar_request(
-		"open-ils.cstore",
-		"open-ils.cstore.direct.action.survey_response.search.atomic",
-		{ usr => $user_id, survey => $survey_id } );
+    my $res = $apputils->simple_scalar_request(
+        "open-ils.cstore",
+        "open-ils.cstore.direct.action.survey_response.search.atomic",
+        { usr => $user_id, survey => $survey_id } );
 
-	if( $res && ref($res) and $res->[0]) {
-		return [ sort { $a->id() <=> $b->id() } @$res ];
-	} 
+    if( $res && ref($res) and $res->[0]) {
+        return [ sort { $a->id() <=> $b->id() } @$res ];
+    } 
 
-	return [];
+    return [];
 }
 
 __PACKAGE__->register_method(
-	method	=> "get_all_surveys",
-	api_name	=> "open-ils.circ.survey.retrieve.all");
+    method  => "get_all_surveys",
+    api_name    => "open-ils.circ.survey.retrieve.all");
 
 sub get_all_surveys {
-	my( $self, $client, $user_session ) = @_;
-	
+    my( $self, $client, $user_session ) = @_;
+    
     my ($user_obj, $evt) = $apputils->checkses($user_session); 
     return $evt if $evt;
 
-	my $orgid = $user_obj->ws_ou() ? $user_obj->ws_ou() : $user_obj->home_ou();
-	my $surveys = $apputils->simple_scalar_request(
-		"open-ils.storage",
-		"open-ils.storage.action.survey.all.atomic",
-		$orgid );
-
-	my @fleshed;
-	for my $survey (@$surveys) {
-		push(@fleshed, get_fleshed_survey($self, $client, $survey));
-	}
-	return \@fleshed;
+    my $orgid = $user_obj->ws_ou() ? $user_obj->ws_ou() : $user_obj->home_ou();
+    my $surveys = $apputils->simple_scalar_request(
+        "open-ils.storage",
+        "open-ils.storage.action.survey.all.atomic",
+        $orgid );
+
+    my @fleshed;
+    for my $survey (@$surveys) {
+        push(@fleshed, get_fleshed_survey($self, $client, $survey));
+    }
+    return \@fleshed;
 }
 
 
 
 
 __PACKAGE__->register_method(
-	method	=> "get_fleshed_survey",
-	api_name	=> "open-ils.circ.survey.fleshed.retrieve");
+    method  => "get_fleshed_survey",
+    api_name    => "open-ils.circ.survey.fleshed.retrieve");
 
 sub get_fleshed_survey {
-	my( $self, $client, $survey_id ) = @_;
+    my( $self, $client, $survey_id ) = @_;
 
-	my $session = OpenSRF::AppSession->create("open-ils.storage");
+    my $session = OpenSRF::AppSession->create("open-ils.storage");
 
-	my $survey;
-	if( ref($survey_id) and 
-			(ref($survey_id) =~ /^Fieldmapper/)) {
-		$survey = $survey_id;
+    my $survey;
+    if( ref($survey_id) and 
+            (ref($survey_id) =~ /^Fieldmapper/)) {
+        $survey = $survey_id;
 
-	} else {
+    } else {
 
-		my $sreq = $session->request(
-			"open-ils.storage.direct.action.survey.retrieve",
-			$survey_id );
-		$survey = $sreq->gather(1);
-		if(! $survey) { return undef; }
-	}
+        my $sreq = $session->request(
+            "open-ils.storage.direct.action.survey.retrieve",
+            $survey_id );
+        $survey = $sreq->gather(1);
+        if(! $survey) { return undef; }
+    }
 
-	$survey->questions([]);
-	
+    $survey->questions([]);
+    
 
-	my $qreq = $session->request(
-		"open-ils.storage.direct.action.survey_question.search.survey.atomic", 
-		$survey->id() );
+    my $qreq = $session->request(
+        "open-ils.storage.direct.action.survey_question.search.survey.atomic", 
+        $survey->id() );
 
-	my $questions = $qreq->gather(1); 
+    my $questions = $qreq->gather(1); 
 
-	if($questions) {
+    if($questions) {
 
-		for my $question (@$questions) {
-			next unless defined $question;
-	
-			# add this question to the survey
-			push( @{$survey->questions()}, $question );
-	
+        for my $question (@$questions) {
+            next unless defined $question;
+    
+            # add this question to the survey
+            push( @{$survey->questions()}, $question );
+    
 
-			my $ans_req = $session->request(
-				"open-ils.storage.direct.action.survey_answer.search.question.atomic",
-				$question->id() );
-	
-			# add this array of answers to this question
-			$question->answers( $ans_req->gather(1) );
-	
-		}
-	}
+            my $ans_req = $session->request(
+                "open-ils.storage.direct.action.survey_answer.search.question.atomic",
+                $question->id() );
+    
+            # add this array of answers to this question
+            $question->answers( $ans_req->gather(1) );
+    
+        }
+    }
 
-	$session->disconnect();
-	return $survey;
+    $session->disconnect();
+    return $survey;
 
 }
 
 
 
 __PACKAGE__->register_method(
-	method	=> "submit_survey",
-	api_name	=> "open-ils.circ.survey.submit.session");
+    method  => "submit_survey",
+    api_name    => "open-ils.circ.survey.submit.session");
 
 __PACKAGE__->register_method(
-	method	=> "submit_survey",
-	api_name	=> "open-ils.circ.survey.submit.user_id");
+    method  => "submit_survey",
+    api_name    => "open-ils.circ.survey.submit.user_id");
 
 __PACKAGE__->register_method(
-	method	=> "submit_survey",
-	api_name	=> "open-ils.circ.survey.submit.anon");
+    method  => "submit_survey",
+    api_name    => "open-ils.circ.survey.submit.anon");
 
 
 sub submit_survey {
-	my( $self, $client, $responses ) = @_;
+    my( $self, $client, $responses ) = @_;
 
-	if(!$responses) {
-		throw OpenSRF::EX::ERROR 
-			("No survey object sent in update");
-	}
+    if(!$responses) {
+        throw OpenSRF::EX::ERROR 
+            ("No survey object sent in update");
+    }
 
 
-	if(!ref($responses)) { $responses = [$responses]; }
+    if(!ref($responses)) { $responses = [$responses]; }
 
-	my $session = $apputils->start_db_session();
+    my $session = $apputils->start_db_session();
 
-	my $group_id = $session->request(
-		"open-ils.storage.action.survey_response.next_group_id")->gather(1);
+    my $group_id = $session->request(
+        "open-ils.storage.action.survey_response.next_group_id")->gather(1);
 
-	my %already_seen;
-	for my $res (@$responses) {
+    my %already_seen;
+    for my $res (@$responses) {
 
-		my $id; 
+        my $id; 
 
-		if($self->api_name =~ /session/) {
-			if( ! ($id = $already_seen{$res->usr}) ) {
+        if($self->api_name =~ /session/) {
+            if( ! ($id = $already_seen{$res->usr}) ) {
                 my ($user_obj, $evt) = $apputils->checkses($res->usr);
                 return $evt if $evt;
-				$id = $user_obj->id;
-				$already_seen{$res->usr} = $id;
-			}
-			$res->usr($id);
-		} elsif( $self->api_name =~ /anon/ ) {
-			$res->clear_usr();
-		}
-		
-		$res->response_group_id($group_id);
-		my $req = $session->request(
-			"open-ils.storage.direct.action.survey_response.create",
-			$res );
-		my $newid = $req->gather(1);
-
-		if(!$newid) {
-			throw OpenSRF::EX::ERROR
-				("Error creating new survey response");
-		}
-	}
-
-	$apputils->commit_db_session($session);
-
-	return 1;
+                $id = $user_obj->id;
+                $already_seen{$res->usr} = $id;
+            }
+            $res->usr($id);
+        } elsif( $self->api_name =~ /anon/ ) {
+            $res->clear_usr();
+        }
+        
+        $res->response_group_id($group_id);
+        my $req = $session->request(
+            "open-ils.storage.direct.action.survey_response.create",
+            $res );
+        my $newid = $req->gather(1);
+
+        if(!$newid) {
+            throw OpenSRF::EX::ERROR
+                ("Error creating new survey response");
+        }
+    }
+
+    $apputils->commit_db_session($session);
+
+    return 1;
 }
 
 
 __PACKAGE__->register_method(
-	method	=> "get_random_survey",
-	api_name	=> "open-ils.circ.survey.retrieve.opac.random");
+    method  => "get_random_survey",
+    api_name    => "open-ils.circ.survey.retrieve.opac.random");
 
 sub get_random_survey {
-	my( $self, $client, $user_session ) = @_;
-	
+    my( $self, $client, $user_session ) = @_;
+    
     my ($user_obj, $evt) = $apputils->checkses($user_session); 
     return $evt if $evt;
 
-	my $surveys = $apputils->simple_scalar_request(
-		"open-ils.storage",
-		"open-ils.storage.action.survey.opac.atomic",
-		$user_obj->home_ou() );
+    my $surveys = $apputils->simple_scalar_request(
+        "open-ils.storage",
+        "open-ils.storage.action.survey.opac.atomic",
+        $user_obj->home_ou() );
 
-	my $random = int(rand(scalar(@$surveys)));
-	my $surv = $surveys->[$random];
+    my $random = int(rand(scalar(@$surveys)));
+    my $surv = $surveys->[$random];
 
-	return get_fleshed_survey($self, $client, $surv);
+    return get_fleshed_survey($self, $client, $surv);
 
 }
 
 __PACKAGE__->register_method(
-	method	=> "get_random_survey_global",
-	api_name	=> "open-ils.circ.survey.retrieve.opac.random.global");
+    method  => "get_random_survey_global",
+    api_name    => "open-ils.circ.survey.retrieve.opac.random.global");
 
 sub get_random_survey_global {
-	my( $self, $client ) = @_;
-	
-	my $surveys = $apputils->simple_scalar_request(
-		"open-ils.storage",
-		"open-ils.storage.direct.action.survey.search.atomic",
-		# XXX grab the org tree to get the root id...
-		{ owner => 1, opac => 't' } );
+    my( $self, $client ) = @_;
+    
+    my $surveys = $apputils->simple_scalar_request(
+        "open-ils.storage",
+        "open-ils.storage.direct.action.survey.search.atomic",
+        # XXX grab the org tree to get the root id...
+        { owner => 1, opac => 't' } );
 
-	my $random = int(rand(scalar(@$surveys)));
-	my $surv = $surveys->[$random];
+    my $random = int(rand(scalar(@$surveys)));
+    my $surv = $surveys->[$random];
 
-	return get_fleshed_survey($self, $client, $surv);
+    return get_fleshed_survey($self, $client, $surv);
 
 }
 
 
 __PACKAGE__->register_method (
-	method		=> 'delete_survey',
-	api_name	=> 'open-ils.circ.survey.delete.cascade'
+    method      => 'delete_survey',
+    api_name    => 'open-ils.circ.survey.delete.cascade'
 );
 __PACKAGE__->register_method (
-	method		=> 'delete_survey',
-	api_name	=> 'open-ils.circ.survey.delete.cascade.override'
+    method      => 'delete_survey',
+    api_name    => 'open-ils.circ.survey.delete.cascade.override'
 );
 
 sub delete_survey {
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Transit.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Transit.pm
index 31e2a95..e4e021b 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Transit.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Transit.pm
@@ -13,41 +13,41 @@ use OpenSRF::Utils::Logger qw(:logger);
 use OpenSRF::AppSession;
 use OpenILS::Const qw/:const/;
 
-my $U							= "OpenILS::Application::AppUtils";
-my $holdcode				= "OpenILS::Application::Circ::Holds";
-$Data::Dumper::Indent	= 0;
+my $U                           = "OpenILS::Application::AppUtils";
+my $holdcode                = "OpenILS::Application::Circ::Holds";
+$Data::Dumper::Indent   = 0;
 
 
 
 __PACKAGE__->register_method(
-	method	=> "copy_transit_receive",
-	api_name	=> "open-ils.circ.copy_transit.receive",
-	notes		=> q/
-		Closes out a copy transit
-		Requestor needs the COPY_TRANSIT_RECEIVE permission
-		@param authtoken The login session key
-		@param params An object of named params including
-			copyid - the id of the copy in quest
-			barcode - the barcode of the copy in question 
-				If copyid is not sent, this is used.
-		@return A ROUTE_ITEM if the copy is destined for a different location.
-			A SUCCESS event on success. Other events on error.
-	/);
+    method  => "copy_transit_receive",
+    api_name    => "open-ils.circ.copy_transit.receive",
+    notes       => q/
+        Closes out a copy transit
+        Requestor needs the COPY_TRANSIT_RECEIVE permission
+        @param authtoken The login session key
+        @param params An object of named params including
+            copyid - the id of the copy in quest
+            barcode - the barcode of the copy in question 
+                If copyid is not sent, this is used.
+        @return A ROUTE_ITEM if the copy is destined for a different location.
+            A SUCCESS event on success. Other events on error.
+    /);
 
 sub copy_transit_receive {
-	my( $self, $client, $authtoken, $params ) = @_;
-	my %params = %$params;
-	my( $evt, $copy, $requestor );
-	($requestor, $evt) = $U->checksesperm($authtoken, 'COPY_TRANSIT_RECEIVE');
-	return $evt if $evt;
-	($copy, $evt) = $U->fetch_copy($params{copyid});
-	($copy, $evt) = $U->fetch_copy_by_barcode($params{barcode}) unless $copy;
-	return $evt if $evt;
-	my $session = $U->start_db_session();
-	$U->set_audit_info($session, $authtoken, $requestor->id, $requestor->wsid);
-	$evt = transit_receive( $self, $copy, $requestor, $session );
-	$U->commit_db_session($session) if $U->event_equals($evt,'SUCCESS');
-	return $evt;
+    my( $self, $client, $authtoken, $params ) = @_;
+    my %params = %$params;
+    my( $evt, $copy, $requestor );
+    ($requestor, $evt) = $U->checksesperm($authtoken, 'COPY_TRANSIT_RECEIVE');
+    return $evt if $evt;
+    ($copy, $evt) = $U->fetch_copy($params{copyid});
+    ($copy, $evt) = $U->fetch_copy_by_barcode($params{barcode}) unless $copy;
+    return $evt if $evt;
+    my $session = $U->start_db_session();
+    $U->set_audit_info($session, $authtoken, $requestor->id, $requestor->wsid);
+    $evt = transit_receive( $self, $copy, $requestor, $session );
+    $U->commit_db_session($session) if $U->event_equals($evt,'SUCCESS');
+    return $evt;
 }
 
 # ------------------------------------------------------------------------------
@@ -56,47 +56,47 @@ sub copy_transit_receive {
 # If 
 # ------------------------------------------------------------------------------
 sub transit_receive {
-	my ( $class, $copy, $requestor, $session ) = @_;
-	$U->logmark;
-
-	my( $transit, $evt );
-	my $copyid = $copy->id;
-
-	my $status_name = $U->copy_status_to_name($copy->status);
-	$logger->debug("Attempting transit receive on copy $copyid. Copy status is $status_name");
-
-	# fetch the transit
-	($transit, $evt) = $U->fetch_open_transit_by_copy($copyid);
-	return $evt if $evt;
-
-	if( $transit->dest != $requestor->home_ou ) {
-		$logger->activity("Fowarding transit on copy which is destined ".
-			"for a different location. copy=$copyid,current ".
-			"location=".$requestor->home_ou.",destination location=".$transit->dest);
-
-		return OpenILS::Event->new('ROUTE_ITEM', org => $transit->dest );
-	}
-
-	# The transit is received, set the receive time
-	$transit->dest_recv_time('now');
-	my $r = $session->request(
-		'open-ils.storage.direct.action.transit_copy.update', $transit )->gather(1);
-	return $U->DB_UPDATE_FAILED($transit) unless $r;
-
-	my $ishold	= 0;
-	my ($ht)		= $U->fetch_hold_transit( $transit->id );
-	if($ht) {
-		$logger->info("Hold transit found in transit receive...");
-		$ishold	= 1;
-	}
-
-	$logger->info("Recovering original copy status in transit: ".$transit->copy_status);
-	$copy->status( $transit->copy_status );
-	return $evt if ( $evt = 
-		$U->update_copy( copy => $copy, editor => $requestor->id, session => $session ));
-
-	return OpenILS::Event->new('SUCCESS', ishold => $ishold, 
-		payload => { transit => $transit, holdtransit => $ht } );
+    my ( $class, $copy, $requestor, $session ) = @_;
+    $U->logmark;
+
+    my( $transit, $evt );
+    my $copyid = $copy->id;
+
+    my $status_name = $U->copy_status_to_name($copy->status);
+    $logger->debug("Attempting transit receive on copy $copyid. Copy status is $status_name");
+
+    # fetch the transit
+    ($transit, $evt) = $U->fetch_open_transit_by_copy($copyid);
+    return $evt if $evt;
+
+    if( $transit->dest != $requestor->home_ou ) {
+        $logger->activity("Fowarding transit on copy which is destined ".
+            "for a different location. copy=$copyid,current ".
+            "location=".$requestor->home_ou.",destination location=".$transit->dest);
+
+        return OpenILS::Event->new('ROUTE_ITEM', org => $transit->dest );
+    }
+
+    # The transit is received, set the receive time
+    $transit->dest_recv_time('now');
+    my $r = $session->request(
+        'open-ils.storage.direct.action.transit_copy.update', $transit )->gather(1);
+    return $U->DB_UPDATE_FAILED($transit) unless $r;
+
+    my $ishold  = 0;
+    my ($ht)        = $U->fetch_hold_transit( $transit->id );
+    if($ht) {
+        $logger->info("Hold transit found in transit receive...");
+        $ishold = 1;
+    }
+
+    $logger->info("Recovering original copy status in transit: ".$transit->copy_status);
+    $copy->status( $transit->copy_status );
+    return $evt if ( $evt = 
+        $U->update_copy( copy => $copy, editor => $requestor->id, session => $session ));
+
+    return OpenILS::Event->new('SUCCESS', ishold => $ishold, 
+        payload => { transit => $transit, holdtransit => $ht } );
 }
 
 
@@ -104,227 +104,227 @@ sub transit_receive {
 
 
 __PACKAGE__->register_method(
-	method	=> "copy_transit_create",
-	api_name	=> "open-ils.circ.copy_transit.create",
-	notes		=> q/
-		Creates a new copy transit.  Requestor must have the 
-		CREATE_COPY_TRANSIT permission.
-		@param authtoken The login session key
-		@param params A param object containing the following keys:
-			copyid		- the copy id
-			destination	- the id of the org destination.  If not defined,
-				defaults to the copy's circ_lib
-		@return SUCCESS event on success, other event on error
-	/);
+    method  => "copy_transit_create",
+    api_name    => "open-ils.circ.copy_transit.create",
+    notes       => q/
+        Creates a new copy transit.  Requestor must have the 
+        CREATE_COPY_TRANSIT permission.
+        @param authtoken The login session key
+        @param params A param object containing the following keys:
+            copyid      - the copy id
+            destination - the id of the org destination.  If not defined,
+                defaults to the copy's circ_lib
+        @return SUCCESS event on success, other event on error
+    /);
 
 sub copy_transit_create {
 
-	my( $self, $client, $authtoken, $params ) = @_;
-	my %params = %$params;
+    my( $self, $client, $authtoken, $params ) = @_;
+    my %params = %$params;
 
-	my( $requestor, $evt ) = 
-		$U->checksesperm( $authtoken, 'CREATE_COPY_TRANSIT' );
-	return $evt if $evt;
+    my( $requestor, $evt ) = 
+        $U->checksesperm( $authtoken, 'CREATE_COPY_TRANSIT' );
+    return $evt if $evt;
 
-	my $copy;
-	($copy,$evt) = $U->fetch_copy($params{copyid});
-	return $evt if $evt;
+    my $copy;
+    ($copy,$evt) = $U->fetch_copy($params{copyid});
+    return $evt if $evt;
 
-	my $session		= $params{session} || $U->start_db_session();
-	my $source		= $requestor->home_ou;
-	my $dest			= $params{destination} || $copy->circ_lib;
-	my $transit		= Fieldmapper::action::transit_copy->new;
-	$U->set_audit_info($session, $authtoken, $requestor->id, $requestor->wsid);
+    my $session     = $params{session} || $U->start_db_session();
+    my $source      = $requestor->home_ou;
+    my $dest            = $params{destination} || $copy->circ_lib;
+    my $transit     = Fieldmapper::action::transit_copy->new;
+    $U->set_audit_info($session, $authtoken, $requestor->id, $requestor->wsid);
 
-	$logger->activity("User ". $requestor->id ." creating a ".
-		" new copy transit for copy ".$copy->id." to org $dest");
+    $logger->activity("User ". $requestor->id ." creating a ".
+        " new copy transit for copy ".$copy->id." to org $dest");
 
-	$transit->source($source);
-	$transit->dest($dest);
-	$transit->target_copy($copy->id);
-	$transit->source_send_time("now");
-	$transit->copy_status($copy->status);
-	
-	$logger->debug("Creating new copy_transit in DB");
+    $transit->source($source);
+    $transit->dest($dest);
+    $transit->target_copy($copy->id);
+    $transit->source_send_time("now");
+    $transit->copy_status($copy->status);
+    
+    $logger->debug("Creating new copy_transit in DB");
 
-	my $s = $session->request(
-		"open-ils.storage.direct.action.transit_copy.create", $transit )->gather(1);
-	return $U->DB_UPDATE_FAILED($transit) unless $s;
-	
-	my $stat = $U->copy_status_from_name('in transit');
+    my $s = $session->request(
+        "open-ils.storage.direct.action.transit_copy.create", $transit )->gather(1);
+    return $U->DB_UPDATE_FAILED($transit) unless $s;
+    
+    my $stat = $U->copy_status_from_name('in transit');
 
-	$copy->status($stat->id); 
-	return $evt if ($evt = $U->update_copy(
-		copy => $copy, editor => $requestor->id, session => $session ));
+    $copy->status($stat->id); 
+    return $evt if ($evt = $U->update_copy(
+        copy => $copy, editor => $requestor->id, session => $session ));
 
-	$U->commit_db_session($session) unless $params{session};
+    $U->commit_db_session($session) unless $params{session};
 
-	return OpenILS::Event->new('SUCCESS', 
-		payload => { copy => $copy, transit => $transit } );
+    return OpenILS::Event->new('SUCCESS', 
+        payload => { copy => $copy, transit => $transit } );
 }
 
 
 __PACKAGE__->register_method(
-	method => 'abort_transit',
-	api_name	=> 'open-ils.circ.transit.abort',
-	signature	=> q/
-		Deletes a cleans up a transit
-	/
+    method => 'abort_transit',
+    api_name    => 'open-ils.circ.transit.abort',
+    signature   => q/
+        Deletes a cleans up a transit
+    /
 );
 
 sub abort_transit {
-	my( $self, $conn, $authtoken, $params ) = @_;
+    my( $self, $conn, $authtoken, $params ) = @_;
 
-	my $copyid		= $$params{copyid};
-	my $barcode		= $$params{barcode};
-	my $transitid	= $$params{transitid};
+    my $copyid      = $$params{copyid};
+    my $barcode     = $$params{barcode};
+    my $transitid   = $$params{transitid};
 
-	my $copy;
-	my $transit;
-	my $evt;
+    my $copy;
+    my $transit;
+    my $evt;
 
-	my $e = new_editor(xact => 1, authtoken => $authtoken);
-	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed('ABORT_TRANSIT');
+    my $e = new_editor(xact => 1, authtoken => $authtoken);
+    return $e->event unless $e->checkauth;
+    return $e->event unless $e->allowed('ABORT_TRANSIT');
 
-	# ---------------------------------------------------------------------
-	# Find the related copy and/or transit based on whatever data we have
-	if( $barcode ) {
-		$copy = $e->search_asset_copy({barcode=>$barcode, deleted => 'f'})->[0];
-		return $e->event unless $copy;
+    # ---------------------------------------------------------------------
+    # Find the related copy and/or transit based on whatever data we have
+    if( $barcode ) {
+        $copy = $e->search_asset_copy({barcode=>$barcode, deleted => 'f'})->[0];
+        return $e->event unless $copy;
 
-	} elsif( $copyid ) {
-		$copy = $e->retrieve_asset_copy($copyid) or return $e->event;
-	}
+    } elsif( $copyid ) {
+        $copy = $e->retrieve_asset_copy($copyid) or return $e->event;
+    }
 
-	if( $transitid ) {
-		$transit = $e->retrieve_action_transit_copy($transitid)
-			or return $e->event;
+    if( $transitid ) {
+        $transit = $e->retrieve_action_transit_copy($transitid)
+            or return $e->event;
 
-	} elsif( $copy ) {
+    } elsif( $copy ) {
 
-		$transit = $e->search_action_transit_copy(
-			{ target_copy => $copy->id, dest_recv_time => undef })->[0];
-		return $e->event unless $transit;
-	}
+        $transit = $e->search_action_transit_copy(
+            { target_copy => $copy->id, dest_recv_time => undef })->[0];
+        return $e->event unless $transit;
+    }
 
-	if($transit and !$copy) {
-		$copy = $e->retrieve_asset_copy($transit->target_copy)
-			or return $e->event;
-	}
-	# ---------------------------------------------------------------------
+    if($transit and !$copy) {
+        $copy = $e->retrieve_asset_copy($transit->target_copy)
+            or return $e->event;
+    }
+    # ---------------------------------------------------------------------
 
-	return __abort_transit( $e, $transit, $copy );
+    return __abort_transit( $e, $transit, $copy );
 }
 
 
 
 sub __abort_transit {
 
-	my( $e, $transit, $copy, $no_reset_hold, $no_commit ) = @_;
+    my( $e, $transit, $copy, $no_reset_hold, $no_commit ) = @_;
 
-	my $evt;
-	my $hold;
+    my $evt;
+    my $hold;
 
-	if( ($transit->copy_status == OILS_COPY_STATUS_LOST and !$e->allowed('ABORT_TRANSIT_ON_LOST')) or
-		($transit->copy_status == OILS_COPY_STATUS_MISSING and !$e->allowed('ABORT_TRANSIT_ON_MISSING')) ) {
-		$e->rollback;
-		return OpenILS::Event->new('TRANSIT_ABORT_NOT_ALLOWED', copy_status => $transit->copy_status);
-	}
+    if( ($transit->copy_status == OILS_COPY_STATUS_LOST and !$e->allowed('ABORT_TRANSIT_ON_LOST')) or
+        ($transit->copy_status == OILS_COPY_STATUS_MISSING and !$e->allowed('ABORT_TRANSIT_ON_MISSING')) ) {
+        $e->rollback;
+        return OpenILS::Event->new('TRANSIT_ABORT_NOT_ALLOWED', copy_status => $transit->copy_status);
+    }
 
 
-	if( $transit->dest != $e->requestor->ws_ou 
-		and $transit->source != $e->requestor->ws_ou ) {
-		return $e->die_event unless $e->allowed('ABORT_REMOTE_TRANSIT', $e->requestor->ws_ou);
-	}
+    if( $transit->dest != $e->requestor->ws_ou 
+        and $transit->source != $e->requestor->ws_ou ) {
+        return $e->die_event unless $e->allowed('ABORT_REMOTE_TRANSIT', $e->requestor->ws_ou);
+    }
 
-	# recover the copy status
-	$copy->status( $transit->copy_status );
-	$copy->editor( $e->requestor->id );
-	$copy->edit_date('now');
+    # recover the copy status
+    $copy->status( $transit->copy_status );
+    $copy->editor( $e->requestor->id );
+    $copy->edit_date('now');
 
-	my $holdtransit = $e->retrieve_action_hold_transit_copy($transit->id);
+    my $holdtransit = $e->retrieve_action_hold_transit_copy($transit->id);
 
-	if( $holdtransit ) {
-		$logger->info("setting copy to reshelving on hold transit abort");
-		$copy->status( OILS_COPY_STATUS_RESHELVING );
-	}
+    if( $holdtransit ) {
+        $logger->info("setting copy to reshelving on hold transit abort");
+        $copy->status( OILS_COPY_STATUS_RESHELVING );
+    }
 
-	return $e->die_event unless $e->delete_action_transit_copy($transit);
-	return $e->die_event unless $e->update_asset_copy($copy);
+    return $e->die_event unless $e->delete_action_transit_copy($transit);
+    return $e->die_event unless $e->update_asset_copy($copy);
 
-	$e->commit unless $no_commit;
+    $e->commit unless $no_commit;
 
-	# if this is a hold transit, un-capture/un-target the hold
-	if($holdtransit and !$no_reset_hold) {
-		$hold = $e->retrieve_action_hold_request($holdtransit->hold) 
+    # if this is a hold transit, un-capture/un-target the hold
+    if($holdtransit and !$no_reset_hold) {
+        $hold = $e->retrieve_action_hold_request($holdtransit->hold) 
             or return $e->die_event;
-		$evt = $holdcode->_reset_hold( $e->requestor, $hold );
-		return $evt if $evt;
-	}
+        $evt = $holdcode->_reset_hold( $e->requestor, $hold );
+        return $evt if $evt;
+    }
 
-	return 1;
+    return 1;
 }
 
 
 __PACKAGE__->register_method(
-	method		=> 'get_open_copy_transit',
-	api_name		=> 'open-ils.circ.open_copy_transit.retrieve',
-	signature	=> q/
-		Retrieves the open transit object for a given copy
-		@param auth The login session key
-		@param copyid The id of the copy
-		@return Transit object
+    method      => 'get_open_copy_transit',
+    api_name        => 'open-ils.circ.open_copy_transit.retrieve',
+    signature   => q/
+        Retrieves the open transit object for a given copy
+        @param auth The login session key
+        @param copyid The id of the copy
+        @return Transit object
  /
 );
 
 sub get_open_copy_transit {
-	my( $self, $conn, $auth, $copyid ) = @_;	
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed('VIEW_USER'); # XXX rely on editor perms
-	my $t = $e->search_action_transit_copy(
-		{ target_copy => $copyid, dest_recv_time => undef });
-	return $e->event unless @$t;
-	return $$t[0];
+    my( $self, $conn, $auth, $copyid ) = @_;    
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    return $e->event unless $e->allowed('VIEW_USER'); # XXX rely on editor perms
+    my $t = $e->search_action_transit_copy(
+        { target_copy => $copyid, dest_recv_time => undef });
+    return $e->event unless @$t;
+    return $$t[0];
 }
 
 
 
 __PACKAGE__->register_method(
-	method => 'fetch_transit_by_copy',
-	api_name => 'open-ils.circ.fetch_transit_by_copy',
+    method => 'fetch_transit_by_copy',
+    api_name => 'open-ils.circ.fetch_transit_by_copy',
 );
 
 sub fetch_transit_by_copy {
-	my( $self, $conn, $auth, $copyid ) = @_;
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	my $t = $e->search_action_transit_copy(
-		{
-			target_copy => $copyid,
-			dest_recv_time => undef
-		}
-	)->[0];
-	return $e->event unless $t;
-	my $ht = $e->retrieve_action_hold_transit_copy($t->id);
-	return { atc => $t, ahtc => $ht };
+    my( $self, $conn, $auth, $copyid ) = @_;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    my $t = $e->search_action_transit_copy(
+        {
+            target_copy => $copyid,
+            dest_recv_time => undef
+        }
+    )->[0];
+    return $e->event unless $t;
+    my $ht = $e->retrieve_action_hold_transit_copy($t->id);
+    return { atc => $t, ahtc => $ht };
 }
 
 
 
 __PACKAGE__->register_method(
-	method => 'transits_by_lib',
-	api_name => 'open-ils.circ.transit.retrieve_by_lib',
+    method => 'transits_by_lib',
+    api_name => 'open-ils.circ.transit.retrieve_by_lib',
 );
 
 
 # start_date and end_date are optional endpoints for the transit creation date
 sub transits_by_lib {
-	my( $self, $conn, $auth, $orgid, $start_date, $end_date ) = @_;
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed('VIEW_CIRCULATIONS'); # eh.. basically the same permission
+    my( $self, $conn, $auth, $orgid, $start_date, $end_date ) = @_;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    return $e->event unless $e->allowed('VIEW_CIRCULATIONS'); # eh.. basically the same permission
 
     my $order_by = {order_by => { atc => 'source_send_time' }};
     my $search = { dest_recv_time => undef };
@@ -341,37 +341,37 @@ sub transits_by_lib {
 
     $search->{dest} = $orgid;
 
-	my $tos = $e->search_action_transit_copy([ $search, $order_by ], {idlist=>1});
+    my $tos = $e->search_action_transit_copy([ $search, $order_by ], {idlist=>1});
 
     delete $$search{dest};
     $search->{source} = $orgid;
 
-	my $froms = $e->search_action_transit_copy([ $search, $order_by ], {idlist=>1});
+    my $froms = $e->search_action_transit_copy([ $search, $order_by ], {idlist=>1});
 
-	return { from => $froms, to => $tos };
+    return { from => $froms, to => $tos };
 }
 
 
 
 __PACKAGE__->register_method(
-	method => 'fetch_transit',
-	api_name => 'open-ils.circ.transit.retrieve',
+    method => 'fetch_transit',
+    api_name => 'open-ils.circ.transit.retrieve',
 );
 sub fetch_transit {
-	my( $self, $conn, $auth, $transid ) = @_;
-	my $e = new_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed('VIEW_CIRCULATIONS'); # eh.. basically the same permission
+    my( $self, $conn, $auth, $transid ) = @_;
+    my $e = new_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    return $e->event unless $e->allowed('VIEW_CIRCULATIONS'); # eh.. basically the same permission
 
-	my $ht = $e->retrieve_action_hold_transit_copy($transid);
-	return $ht if $ht;
+    my $ht = $e->retrieve_action_hold_transit_copy($transid);
+    return $ht if $ht;
 
-	my $t = $e->retrieve_action_transit_copy($transid)
-		or return $e->event;
-	return $t;
+    my $t = $e->retrieve_action_transit_copy($transid)
+        or return $e->event;
+    return $t;
 }
 
-	
+    
 
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Penalty.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Penalty.pm
index 48a893e..36fc8fc 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Penalty.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Penalty.pm
@@ -7,20 +7,20 @@ use OpenILS::Utils::CStoreEditor qw/:funcs/;
 use base 'OpenILS::Application';
 
 __PACKAGE__->register_method (
-	method	 => 'patron_penalty',
-	api_name	 => 'open-ils.penalty.patron_penalty.calculate',
-	signature => q/
-		Calculates the patron's standing penalties
-		@param args An object of named params including:
-			patronid The id of the patron
-			update True if this call should update the database
-			background True if this call should return immediately,
-				then go on to process the penalties.  This flag
-				works only in conjunction with the 'update' flag.
-		@return An object with keys 'fatal_penalties' and 
-		'info_penalties' who are themeselves arrays of 0 or 
-		more penalties.  Returns event on error.
-	/
+    method   => 'patron_penalty',
+    api_name     => 'open-ils.penalty.patron_penalty.calculate',
+    signature => q/
+        Calculates the patron's standing penalties
+        @param args An object of named params including:
+            patronid The id of the patron
+            update True if this call should update the database
+            background True if this call should return immediately,
+                then go on to process the penalties.  This flag
+                works only in conjunction with the 'update' flag.
+        @return An object with keys 'fatal_penalties' and 
+        'info_penalties' who are themeselves arrays of 0 or 
+        more penalties.  Returns event on error.
+    /
 );
 
 # --------------------------------------------------------------
@@ -28,8 +28,8 @@ __PACKAGE__->register_method (
 # to the caller, then finish the calculation
 # --------------------------------------------------------------
 sub patron_penalty {
-	my( $self, $conn, $args ) = @_;
-	$conn->respond_complete(1) if $$args{background};
+    my( $self, $conn, $args ) = @_;
+    $conn->respond_complete(1) if $$args{background};
     my $e = new_editor(xact => 1);
     OpenILS::Utils::Penalty->calculate_penalties($e, $args->{patronid}, $args->{context_org});
     my $p = OpenILS::Utils::Penalty->retrieve_penalties($e, $args->{patronid}, $args->{context_org});
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/PermaCrud.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/PermaCrud.pm
index 0d1e764..f2e90fc 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/PermaCrud.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/PermaCrud.pm
@@ -177,7 +177,7 @@ sub CRUD_action_object_permcheck {
         }
 
         if ((lc($all_perms) eq 'true' && @perms != $pok) or !$pok) {
-	        return OpenILS::Event->new('PERM_FAILURE', 
+            return OpenILS::Event->new('PERM_FAILURE', 
                 ilsperm => "", # XXX add logic to report which perm failed
                 ilspermloc => "",
                 payload => "Perm failure -- action: $self->{action}, object type: $self->{json_hint}",
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Proxy.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Proxy.pm
index c355c0e..22b5b9c 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Proxy.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Proxy.pm
@@ -6,48 +6,48 @@ use OpenSRF::EX qw(:try);
 
 
 __PACKAGE__->register_method(
-	method	=> "proxy",
-	api_name	=> "open-ils.proxy.proxy",
-	stream	=> 1,
+    method  => "proxy",
+    api_name    => "open-ils.proxy.proxy",
+    stream  => 1,
 );
 
 
 sub proxy {
-	my($self, $client, $user_session, 
-			$server, $method, @params) = @_;
+    my($self, $client, $user_session, 
+            $server, $method, @params) = @_;
 
-	warn "$user_session - $server - $method\n";
+    warn "$user_session - $server - $method\n";
 
-	throw OpenSRF::EX::ERROR ("Not enough args to proxy")
-		unless ($user_session and $server and $method);
+    throw OpenSRF::EX::ERROR ("Not enough args to proxy")
+        unless ($user_session and $server and $method);
 
 
-	my $session = OpenSRF::AppSession->create($server);
-	my $request = $session->request( $method, @params );
-	if(!$request) {
-		throw OpenSRF::EX::ERROR 
-			("No request built on call to session->request( $method, @params )");
-	}
-	
-	$request->wait_complete;
+    my $session = OpenSRF::AppSession->create($server);
+    my $request = $session->request( $method, @params );
+    if(!$request) {
+        throw OpenSRF::EX::ERROR 
+            ("No request built on call to session->request( $method, @params )");
+    }
+    
+    $request->wait_complete;
 
-	if( $request->failed() ) { 
+    if( $request->failed() ) { 
 
-		throw OpenSRF::EX::ERROR
-			($request->failed()->stringify());
+        throw OpenSRF::EX::ERROR
+            ($request->failed()->stringify());
 
-	} else {
+    } else {
 
-		while( my $response = $request->recv ) {
-			$client->respond( $response->content );
-		}
-	}
+        while( my $response = $request->recv ) {
+            $client->respond( $response->content );
+        }
+    }
 
-	$request->finish();
-	$session->finish();
-	$session->disconnect();
+    $request->finish();
+    $session->finish();
+    $session->disconnect();
 
-	return undef;
+    return undef;
 }
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm
index 44590f0..c0d754a 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Reporter.pm
@@ -10,26 +10,26 @@ my $U = "OpenILS::Application::AppUtils";
 
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.folder.create',
-	method => 'create_folder'
+    api_name => 'open-ils.reporter.folder.create',
+    method => 'create_folder'
 );
 
 sub create_folder {
-	my( $self, $conn, $auth, $type, $folder ) = @_;
+    my( $self, $conn, $auth, $type, $folder ) = @_;
 
-	my $e = new_rstore_editor(xact=>1, authtoken=>$auth);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('RUN_REPORTS');
-	return $e->die_event unless ($type ne 'template' || $e->allowed('CREATE_REPORT_TEMPLATE'));
+    my $e = new_rstore_editor(xact=>1, authtoken=>$auth);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('RUN_REPORTS');
+    return $e->die_event unless ($type ne 'template' || $e->allowed('CREATE_REPORT_TEMPLATE'));
 
-	return 0 if $folder->owner ne $e->requestor->id;
+    return 0 if $folder->owner ne $e->requestor->id;
 
-	$folder->owner($e->requestor->id);
-	my $meth = "create_reporter_${type}_folder";
-	$e->$meth($folder) or return $e->die_event;
-	$e->commit;
+    $folder->owner($e->requestor->id);
+    my $meth = "create_reporter_${type}_folder";
+    $e->$meth($folder) or return $e->die_event;
+    $e->commit;
 
-	return $folder->id;
+    return $folder->id;
 }
 
 
@@ -56,138 +56,138 @@ sub report_exists {
 
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.folder.visible.retrieve',
-	method => 'retrieve_visible_folders'
+    api_name => 'open-ils.reporter.folder.visible.retrieve',
+    method => 'retrieve_visible_folders'
 );
 
 sub retrieve_visible_folders {
-	my( $self, $conn, $auth, $type ) = @_;
-	my $e = new_rstore_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	if($type eq 'output') {
-		return $e->event unless $e->allowed(['RUN_REPORTS','VIEW_REPORT_OUTPUT']);
-	} else {
-		return $e->event unless $e->allowed('RUN_REPORTS');
-	}
-
-	my $class = 'rrf';
-	$class = 'rtf' if $type eq 'template';
-	$class = 'rof' if $type eq 'output';
-	my $flesh = {
-		flesh => 1,
-		flesh_fields => { $class => ['owner', 'share_with']},
-		order_by => { $class => 'name ASC'}
-	};
-
-	my $meth = "search_reporter_${type}_folder";
-	my $fs = $e->$meth( [{ owner => $e->requestor->id }, $flesh] );
-
-	my @orgs;
-	my $o = $U->storagereq(
-		'open-ils.storage.actor.org_unit.full_path.atomic', $e->requestor->ws_ou);
-	push( @orgs, $_->id ) for @$o;
-
-	my $fs2 = $e->$meth(
-		[
-			{
-				shared => 't',
-				share_with => \@orgs,
-				owner => { '!=' => $e->requestor->id }
-			},
-			$flesh
-		]
-	);
-	push( @$fs, @$fs2);
-	return $fs;
+    my( $self, $conn, $auth, $type ) = @_;
+    my $e = new_rstore_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    if($type eq 'output') {
+        return $e->event unless $e->allowed(['RUN_REPORTS','VIEW_REPORT_OUTPUT']);
+    } else {
+        return $e->event unless $e->allowed('RUN_REPORTS');
+    }
+
+    my $class = 'rrf';
+    $class = 'rtf' if $type eq 'template';
+    $class = 'rof' if $type eq 'output';
+    my $flesh = {
+        flesh => 1,
+        flesh_fields => { $class => ['owner', 'share_with']},
+        order_by => { $class => 'name ASC'}
+    };
+
+    my $meth = "search_reporter_${type}_folder";
+    my $fs = $e->$meth( [{ owner => $e->requestor->id }, $flesh] );
+
+    my @orgs;
+    my $o = $U->storagereq(
+        'open-ils.storage.actor.org_unit.full_path.atomic', $e->requestor->ws_ou);
+    push( @orgs, $_->id ) for @$o;
+
+    my $fs2 = $e->$meth(
+        [
+            {
+                shared => 't',
+                share_with => \@orgs,
+                owner => { '!=' => $e->requestor->id }
+            },
+            $flesh
+        ]
+    );
+    push( @$fs, @$fs2);
+    return $fs;
 }
 
 
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.folder_data.retrieve',
-	method => 'retrieve_folder_data'
+    api_name => 'open-ils.reporter.folder_data.retrieve',
+    method => 'retrieve_folder_data'
 );
 
 sub retrieve_folder_data {
-	my( $self, $conn, $auth, $type, $folderid, $limit ) = @_;
-	my $e = new_rstore_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	if($type eq 'output') {
-		return $e->event unless $e->allowed(['RUN_REPORTS','VIEW_REPORT_OUTPUT']);
-	} else {
-		return $e->event unless $e->allowed('RUN_REPORTS');
-	}
-	my $meth = "search_reporter_${type}";
-	my $class = 'rr';
-	$class = 'rt' if $type eq 'template';
-	my $flesh = {
-		flesh => 1,
-		flesh_fields => { $class => ['owner']},
-		order_by => { $class => 'create_time DESC'}
-	};
-	$flesh->{limit} = $limit if $limit;
-	return $e->$meth([{ folder => $folderid }, $flesh]);
+    my( $self, $conn, $auth, $type, $folderid, $limit ) = @_;
+    my $e = new_rstore_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    if($type eq 'output') {
+        return $e->event unless $e->allowed(['RUN_REPORTS','VIEW_REPORT_OUTPUT']);
+    } else {
+        return $e->event unless $e->allowed('RUN_REPORTS');
+    }
+    my $meth = "search_reporter_${type}";
+    my $class = 'rr';
+    $class = 'rt' if $type eq 'template';
+    my $flesh = {
+        flesh => 1,
+        flesh_fields => { $class => ['owner']},
+        order_by => { $class => 'create_time DESC'}
+    };
+    $flesh->{limit} = $limit if $limit;
+    return $e->$meth([{ folder => $folderid }, $flesh]);
 }
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.schedule.retrieve_by_folder',
-	method => 'retrieve_schedules');
+    api_name => 'open-ils.reporter.schedule.retrieve_by_folder',
+    method => 'retrieve_schedules');
 sub retrieve_schedules {
-	my( $self, $conn, $auth, $folderId, $limit, $complete ) = @_;
-	my $e = new_rstore_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed(['RUN_REPORTS','VIEW_REPORT_OUTPUT']);
-
-	my $search = { folder => $folderId };
-	my $query = [
-		{ folder => $folderId },
-		{
-			order_by => { rs => 'run_time DESC' } ,
-			flesh => 1,
-			flesh_fields => { rs => ['report'] }
-		}
-	];
-
-	$query->[1]->{limit} = $limit if $limit;
-	$query->[0]->{complete_time} = undef unless $complete;
-	$query->[0]->{complete_time} = { '!=' => undef } if $complete;
-
-	return $e->search_reporter_schedule($query);
+    my( $self, $conn, $auth, $folderId, $limit, $complete ) = @_;
+    my $e = new_rstore_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    return $e->event unless $e->allowed(['RUN_REPORTS','VIEW_REPORT_OUTPUT']);
+
+    my $search = { folder => $folderId };
+    my $query = [
+        { folder => $folderId },
+        {
+            order_by => { rs => 'run_time DESC' } ,
+            flesh => 1,
+            flesh_fields => { rs => ['report'] }
+        }
+    ];
+
+    $query->[1]->{limit} = $limit if $limit;
+    $query->[0]->{complete_time} = undef unless $complete;
+    $query->[0]->{complete_time} = { '!=' => undef } if $complete;
+
+    return $e->search_reporter_schedule($query);
 }
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.schedule.retrieve',
-	method => 'retrieve_schedules');
+    api_name => 'open-ils.reporter.schedule.retrieve',
+    method => 'retrieve_schedules');
 sub retrieve_schedule {
-	my( $self, $conn, $auth, $sched_id ) = @_;
-	my $e = new_rstore_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed(['RUN_REPORTS','VIEW_REPORT_OUTPUT']);
-	my $s = $e->retrieve_reporter_schedule($sched_id)
-		or return $e->event;
-	return $s;
+    my( $self, $conn, $auth, $sched_id ) = @_;
+    my $e = new_rstore_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    return $e->event unless $e->allowed(['RUN_REPORTS','VIEW_REPORT_OUTPUT']);
+    my $s = $e->retrieve_reporter_schedule($sched_id)
+        or return $e->event;
+    return $s;
 }
 
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.template.create',
-	method => 'create_template');
+    api_name => 'open-ils.reporter.template.create',
+    method => 'create_template');
 sub create_template {
-	my( $self, $conn, $auth, $template ) = @_;
-	my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('RUN_REPORTS');
-	return $e->die_event unless $e->allowed('CREATE_REPORT_TEMPLATE');
-	$template->owner($e->requestor->id);
-
-	my $existing = $e->search_reporter_template( {owner=>$template->owner,
-			folder=>$template->folder, name=>$template->name},{idlist=>1});
-	return OpenILS::Event->new('REPORT_TEMPLATE_EXISTS') if @$existing;
-
-	my $tmpl = $e->create_reporter_template($template)
-		or return $e->die_event;
-	$e->commit;
-	return $tmpl;
+    my( $self, $conn, $auth, $template ) = @_;
+    my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('RUN_REPORTS');
+    return $e->die_event unless $e->allowed('CREATE_REPORT_TEMPLATE');
+    $template->owner($e->requestor->id);
+
+    my $existing = $e->search_reporter_template( {owner=>$template->owner,
+            folder=>$template->folder, name=>$template->name},{idlist=>1});
+    return OpenILS::Event->new('REPORT_TEMPLATE_EXISTS') if @$existing;
+
+    my $tmpl = $e->create_reporter_template($template)
+        or return $e->die_event;
+    $e->commit;
+    return $tmpl;
 }
 
 
@@ -195,203 +195,203 @@ sub create_template {
 
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.report.create',
-	method => 'create_report');
+    api_name => 'open-ils.reporter.report.create',
+    method => 'create_report');
 sub create_report {
-	my( $self, $conn, $auth, $report, $schedule ) = @_;
-	my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('RUN_REPORTS');
-	$report->owner($e->requestor->id);
-
-	my $existing = $e->search_reporter_report( {owner=>$report->owner,
-			folder=>$report->folder, name=>$report->name},{idlist=>1});
-	return OpenILS::Event->new('REPORT_REPORT_EXISTS') if @$existing;
-
-	my $rpt = $e->create_reporter_report($report)
-		or return $e->die_event;
-	$schedule->report($rpt->id);
-	$schedule->runner($e->requestor->id);
-	$e->create_reporter_schedule($schedule) or return $e->die_event;
-	$e->commit;
-	return $rpt;
+    my( $self, $conn, $auth, $report, $schedule ) = @_;
+    my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('RUN_REPORTS');
+    $report->owner($e->requestor->id);
+
+    my $existing = $e->search_reporter_report( {owner=>$report->owner,
+            folder=>$report->folder, name=>$report->name},{idlist=>1});
+    return OpenILS::Event->new('REPORT_REPORT_EXISTS') if @$existing;
+
+    my $rpt = $e->create_reporter_report($report)
+        or return $e->die_event;
+    $schedule->report($rpt->id);
+    $schedule->runner($e->requestor->id);
+    $e->create_reporter_schedule($schedule) or return $e->die_event;
+    $e->commit;
+    return $rpt;
 }
 
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.schedule.create',
-	method => 'create_schedule');
+    api_name => 'open-ils.reporter.schedule.create',
+    method => 'create_schedule');
 sub create_schedule {
-	my( $self, $conn, $auth, $schedule ) = @_;
-	my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('RUN_REPORTS');
-	my $sched = $e->create_reporter_schedule($schedule)
-		or return $e->die_event;
-	$e->commit;
-	return $sched;
+    my( $self, $conn, $auth, $schedule ) = @_;
+    my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('RUN_REPORTS');
+    my $sched = $e->create_reporter_schedule($schedule)
+        or return $e->die_event;
+    $e->commit;
+    return $sched;
 }
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.template.retrieve',
-	method => 'retrieve_template');
+    api_name => 'open-ils.reporter.template.retrieve',
+    method => 'retrieve_template');
 sub retrieve_template {
-	my( $self, $conn, $auth, $id ) = @_;
-	my $e = new_rstore_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed(['RUN_REPORTS','VIEW_REPORT_OUTPUT']);
-	my $t = $e->retrieve_reporter_template($id)
-		or return $e->event;
-	return $t;
+    my( $self, $conn, $auth, $id ) = @_;
+    my $e = new_rstore_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    return $e->event unless $e->allowed(['RUN_REPORTS','VIEW_REPORT_OUTPUT']);
+    my $t = $e->retrieve_reporter_template($id)
+        or return $e->event;
+    return $t;
 }
 
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.report.retrieve',
-	method => 'retrieve_report');
+    api_name => 'open-ils.reporter.report.retrieve',
+    method => 'retrieve_report');
 sub retrieve_report {
-	my( $self, $conn, $auth, $id ) = @_;
-	my $e = new_rstore_editor(authtoken=>$auth);
-	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed(['RUN_REPORTS','VIEW_REPORT_OUTPUT']);
-	my $r = $e->retrieve_reporter_report($id)
-		or return $e->event;
-	return $r;
+    my( $self, $conn, $auth, $id ) = @_;
+    my $e = new_rstore_editor(authtoken=>$auth);
+    return $e->event unless $e->checkauth;
+    return $e->event unless $e->allowed(['RUN_REPORTS','VIEW_REPORT_OUTPUT']);
+    my $r = $e->retrieve_reporter_report($id)
+        or return $e->event;
+    return $r;
 }
 
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.template.update',
-	method => 'update_template');
+    api_name => 'open-ils.reporter.template.update',
+    method => 'update_template');
 sub update_template {
-	my( $self, $conn, $auth, $tmpl ) = @_;
-	my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('RUN_REPORTS');
-	return $e->die_event unless $e->allowed('CREATE_REPORT_TEMPLATE');
-	my $t = $e->retrieve_reporter_template($tmpl->id)
-		or return $e->die_event;
-	return 0 if $t->owner ne $e->requestor->id;
-	$e->update_reporter_template($tmpl)
-		or return $e->die_event;
-	$e->commit;
-	return 1;
+    my( $self, $conn, $auth, $tmpl ) = @_;
+    my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('RUN_REPORTS');
+    return $e->die_event unless $e->allowed('CREATE_REPORT_TEMPLATE');
+    my $t = $e->retrieve_reporter_template($tmpl->id)
+        or return $e->die_event;
+    return 0 if $t->owner ne $e->requestor->id;
+    $e->update_reporter_template($tmpl)
+        or return $e->die_event;
+    $e->commit;
+    return 1;
 }
 
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.report.update',
-	method => 'update_report');
+    api_name => 'open-ils.reporter.report.update',
+    method => 'update_report');
 sub update_report {
-	my( $self, $conn, $auth, $report ) = @_;
-	my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('RUN_REPORTS');
-	my $r = $e->retrieve_reporter_report($report->id)
-		or return $e->die_event;
-	if( $r->owner ne $e->requestor->id ) {
-		$e->rollback;
-		return 0;
-	}
-	$e->update_reporter_report($report)
-		or return $e->die_event;
-	$e->commit;
-	return 1;
+    my( $self, $conn, $auth, $report ) = @_;
+    my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('RUN_REPORTS');
+    my $r = $e->retrieve_reporter_report($report->id)
+        or return $e->die_event;
+    if( $r->owner ne $e->requestor->id ) {
+        $e->rollback;
+        return 0;
+    }
+    $e->update_reporter_report($report)
+        or return $e->die_event;
+    $e->commit;
+    return 1;
 }
 
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.schedule.update',
-	method => 'update_schedule');
+    api_name => 'open-ils.reporter.schedule.update',
+    method => 'update_schedule');
 sub update_schedule {
-	my( $self, $conn, $auth, $schedule ) = @_;
-	my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('RUN_REPORTS');
-	my $s = $e->retrieve_reporter_schedule($schedule->id)
-		or return $e->die_event;
-	my $r = $e->retrieve_reporter_report($s->report)
-		or return $e->die_event;
-	if( $r->owner ne $e->requestor->id ) {
-		$e->rollback;
-		return 0;
-	}
-	$e->update_reporter_schedule($schedule)
-		or return $e->die_event;
-	$e->commit;
-	return 1;
+    my( $self, $conn, $auth, $schedule ) = @_;
+    my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('RUN_REPORTS');
+    my $s = $e->retrieve_reporter_schedule($schedule->id)
+        or return $e->die_event;
+    my $r = $e->retrieve_reporter_report($s->report)
+        or return $e->die_event;
+    if( $r->owner ne $e->requestor->id ) {
+        $e->rollback;
+        return 0;
+    }
+    $e->update_reporter_schedule($schedule)
+        or return $e->die_event;
+    $e->commit;
+    return 1;
 }
 
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.folder.update',
-	method => 'update_folder');
+    api_name => 'open-ils.reporter.folder.update',
+    method => 'update_folder');
 sub update_folder {
-	my( $self, $conn, $auth, $type, $folder ) = @_;
-	my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('RUN_REPORTS');
-	my $meth = "retrieve_reporter_${type}_folder";
-	my $f = $e->$meth($folder->id) or return $e->die_event;
-	return 0 if $f->owner ne $e->requestor->id;
-	$meth = "update_reporter_${type}_folder";
-	$e->$meth($folder) or return $e->die_event;
-	$e->commit;
-	return 1;
+    my( $self, $conn, $auth, $type, $folder ) = @_;
+    my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('RUN_REPORTS');
+    my $meth = "retrieve_reporter_${type}_folder";
+    my $f = $e->$meth($folder->id) or return $e->die_event;
+    return 0 if $f->owner ne $e->requestor->id;
+    $meth = "update_reporter_${type}_folder";
+    $e->$meth($folder) or return $e->die_event;
+    $e->commit;
+    return 1;
 }
 
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.folder.delete',
-	method => 'delete_folder');
+    api_name => 'open-ils.reporter.folder.delete',
+    method => 'delete_folder');
 sub delete_folder {
-	my( $self, $conn, $auth, $type, $folderId ) = @_;
-	my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('RUN_REPORTS');
-	my $meth = "retrieve_reporter_${type}_folder";
-	my $f = $e->$meth($folderId) or return $e->die_event;
-	return 0 if $f->owner ne $e->requestor->id;
-	$meth = "delete_reporter_${type}_folder";
-	$e->$meth($f) or return $e->die_event;
-	$e->commit;
-	return 1;
+    my( $self, $conn, $auth, $type, $folderId ) = @_;
+    my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('RUN_REPORTS');
+    my $meth = "retrieve_reporter_${type}_folder";
+    my $f = $e->$meth($folderId) or return $e->die_event;
+    return 0 if $f->owner ne $e->requestor->id;
+    $meth = "delete_reporter_${type}_folder";
+    $e->$meth($f) or return $e->die_event;
+    $e->commit;
+    return 1;
 }
 
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.template.delete',
-	method => 'delete_template');
+    api_name => 'open-ils.reporter.template.delete',
+    method => 'delete_template');
 sub delete_template {
-	my( $self, $conn, $auth, $templateId ) = @_;
-	my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('RUN_REPORTS');
-
-	my $t = $e->retrieve_reporter_template($templateId)
-		or return $e->die_event;
-	return 0 if $t->owner ne $e->requestor->id;
-	$e->delete_reporter_template($t) or return $e->die_event;
-	$e->commit;
-	return 1;
+    my( $self, $conn, $auth, $templateId ) = @_;
+    my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('RUN_REPORTS');
+
+    my $t = $e->retrieve_reporter_template($templateId)
+        or return $e->die_event;
+    return 0 if $t->owner ne $e->requestor->id;
+    $e->delete_reporter_template($t) or return $e->die_event;
+    $e->commit;
+    return 1;
 }
 
 
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.template.delete.cascade',
-	method => 'cascade_delete_template');
+    api_name => 'open-ils.reporter.template.delete.cascade',
+    method => 'cascade_delete_template');
 
 #__PACKAGE__->register_method(
-#	api_name => 'open-ils.reporter.template.delete.cascade.force',
-#	method => 'cascade_delete_template');
+#   api_name => 'open-ils.reporter.template.delete.cascade.force',
+#   method => 'cascade_delete_template');
 
 sub cascade_delete_template {
-	my( $self, $conn, $auth, $templateId ) = @_;
+    my( $self, $conn, $auth, $templateId ) = @_;
 
-	my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('RUN_REPORTS');
+    my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('RUN_REPORTS');
 
     my $ret = cascade_delete_template_impl(
         $e, $e->requestor->id, $templateId, ($self->api_name =~ /force/o) );
@@ -404,19 +404,19 @@ sub cascade_delete_template {
 
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.report.delete.cascade',
-	method => 'cascade_delete_report');
+    api_name => 'open-ils.reporter.report.delete.cascade',
+    method => 'cascade_delete_report');
 
 #__PACKAGE__->register_method(
-#	api_name => 'open-ils.reporter.report.delete.cascade.force',
-#	method => 'cascade_delete_report');
+#   api_name => 'open-ils.reporter.report.delete.cascade.force',
+#   method => 'cascade_delete_report');
 
 sub cascade_delete_report {
-	my( $self, $conn, $auth, $reportId ) = @_;
+    my( $self, $conn, $auth, $reportId ) = @_;
 
-	my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('RUN_REPORTS');
+    my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('RUN_REPORTS');
 
     my $ret = cascade_delete_report_impl($e, $e->requestor->id, $reportId);
     return $ret if ref $ret; # some fatal event occurred
@@ -517,124 +517,124 @@ sub delete_schedule_impl {
 
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.report.delete',
-	method => 'delete_report');
+    api_name => 'open-ils.reporter.report.delete',
+    method => 'delete_report');
 sub delete_report {
-	my( $self, $conn, $auth, $reportId ) = @_;
-	my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('RUN_REPORTS');
-
-	my $t = $e->retrieve_reporter_report($reportId)
-		or return $e->die_event;
-	return 0 if $t->owner ne $e->requestor->id;
-	$e->delete_reporter_report($t) or return $e->die_event;
-	$e->commit;
-	return 1;
+    my( $self, $conn, $auth, $reportId ) = @_;
+    my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('RUN_REPORTS');
+
+    my $t = $e->retrieve_reporter_report($reportId)
+        or return $e->die_event;
+    return 0 if $t->owner ne $e->requestor->id;
+    $e->delete_reporter_report($t) or return $e->die_event;
+    $e->commit;
+    return 1;
 }
 
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.schedule.delete',
-	method => 'delete_schedule');
+    api_name => 'open-ils.reporter.schedule.delete',
+    method => 'delete_schedule');
 sub delete_schedule {
-	my( $self, $conn, $auth, $scheduleId ) = @_;
-	my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('RUN_REPORTS');
-
-	my $t = $e->retrieve_reporter_schedule($scheduleId)
-		or return $e->die_event;
-	return 0 if $t->runner ne $e->requestor->id;
-	$e->delete_reporter_schedule($t) or return $e->die_event;
-	$e->commit;
-	return 1;
+    my( $self, $conn, $auth, $scheduleId ) = @_;
+    my $e = new_rstore_editor(authtoken=>$auth, xact=>1);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('RUN_REPORTS');
+
+    my $t = $e->retrieve_reporter_schedule($scheduleId)
+        or return $e->die_event;
+    return 0 if $t->runner ne $e->requestor->id;
+    $e->delete_reporter_schedule($t) or return $e->die_event;
+    $e->commit;
+    return 1;
 }
 
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.template_has_reports',
-	method => 'has_reports');
+    api_name => 'open-ils.reporter.template_has_reports',
+    method => 'has_reports');
 sub has_reports {
-	my( $self, $conn, $auth, $templateId ) = @_;
-	my $e = new_rstore_editor(authtoken=>$auth);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('RUN_REPORTS');
-	my $rpts = $e->search_reporter_report({template=>$templateId},{idlist=>1});
-	return 1 if @$rpts;
-	return 0;
+    my( $self, $conn, $auth, $templateId ) = @_;
+    my $e = new_rstore_editor(authtoken=>$auth);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('RUN_REPORTS');
+    my $rpts = $e->search_reporter_report({template=>$templateId},{idlist=>1});
+    return 1 if @$rpts;
+    return 0;
 }
 
 __PACKAGE__->register_method(
-	api_name => 'open-ils.reporter.report_has_output',
-	method => 'has_output');
+    api_name => 'open-ils.reporter.report_has_output',
+    method => 'has_output');
 sub has_output {
-	my( $self, $conn, $auth, $reportId ) = @_;
-	my $e = new_rstore_editor(authtoken=>$auth);
-	return $e->die_event unless $e->checkauth;
-	return $e->die_event unless $e->allowed('RUN_REPORTS');
-	my $outs = $e->search_reporter_schedule({report=>$reportId},{idlist=>1});
-	return 1 if @$outs;
-	return 0;
+    my( $self, $conn, $auth, $reportId ) = @_;
+    my $e = new_rstore_editor(authtoken=>$auth);
+    return $e->die_event unless $e->checkauth;
+    return $e->die_event unless $e->allowed('RUN_REPORTS');
+    my $outs = $e->search_reporter_schedule({report=>$reportId},{idlist=>1});
+    return 1 if @$outs;
+    return 0;
 }
 
 
 
 __PACKAGE__->register_method(
-	method => 'org_full_path',
-	api_name => 'open-ils.reporter.org_unit.full_path');
+    method => 'org_full_path',
+    api_name => 'open-ils.reporter.org_unit.full_path');
 
 sub org_full_path {
-	my( $self, $conn, $orgid ) = @_;
-	return $U->storagereq(
-		'open-ils.storage.actor.org_unit.full_path.atomic', $orgid );
+    my( $self, $conn, $orgid ) = @_;
+    return $U->storagereq(
+        'open-ils.storage.actor.org_unit.full_path.atomic', $orgid );
 }
 
 
 
 
 __PACKAGE__->register_method(
-	method => 'magic_fetch_all',
-	api_name => 'open-ils.reporter.magic_fetch');
+    method => 'magic_fetch_all',
+    api_name => 'open-ils.reporter.magic_fetch');
 sub magic_fetch_all {
-	my( $self, $conn, $auth, $args ) = @_;
-	my $e = new_editor(authtoken => $auth);
-	return $e->event unless $e->checkauth;
-	return $e->event unless $e->allowed('RUN_REPORTS');
+    my( $self, $conn, $auth, $args ) = @_;
+    my $e = new_editor(authtoken => $auth);
+    return $e->event unless $e->checkauth;
+    return $e->event unless $e->allowed('RUN_REPORTS');
 
-	my $hint = $$args{hint};
-	my $org_col = $$args{org_column};
-	my $orgs = $$args{org};
+    my $hint = $$args{hint};
+    my $org_col = $$args{org_column};
+    my $orgs = $$args{org};
 
-#	if ($orgs && !$$args{no_fetch}) {
-#		($orgs) = $self
-#				->method_lookup( 'open-ils.reporter.org_unit.full_path' )
-#				->run( @$orgs );
-#		$orgs = [ map {$_->id} @$orgs ];
-#	}
+#   if ($orgs && !$$args{no_fetch}) {
+#       ($orgs) = $self
+#               ->method_lookup( 'open-ils.reporter.org_unit.full_path' )
+#               ->run( @$orgs );
+#       $orgs = [ map {$_->id} @$orgs ];
+#   }
 
-	# Find the class the iplements the given hint
-	my ($class) = grep {
-		$Fieldmapper::fieldmap->{$_}{hint} eq $hint } Fieldmapper->classes;
+    # Find the class the iplements the given hint
+    my ($class) = grep {
+        $Fieldmapper::fieldmap->{$_}{hint} eq $hint } Fieldmapper->classes;
 
-	return undef unless $class->Selector;
+    return undef unless $class->Selector;
 
-	$class =~ s/Fieldmapper:://og;
-	$class =~ s/::/_/og;
+    $class =~ s/Fieldmapper:://og;
+    $class =~ s/::/_/og;
 
-	my $method;
-	my $margs;
+    my $method;
+    my $margs;
 
-	if( $org_col ) {
-		$method = "search_$class";
-		$margs = { $org_col => $orgs };
-	} else {
-		$method = "retrieve_all_$class";
-	}
+    if( $org_col ) {
+        $method = "search_$class";
+        $margs = { $org_col => $orgs };
+    } else {
+        $method = "retrieve_all_$class";
+    }
 
-	$logger->info("reporter.magic_fetch => $method");
+    $logger->info("reporter.magic_fetch => $method");
 
-	return $e->$method($margs);
+    return $e->$method($margs);
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search.pm
index 7a2851d..df4841c 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search.pm
@@ -28,15 +28,15 @@ use Text::Aspell;
 # Houses generic search utilites 
 
 sub initialize {
-	OpenILS::Application::Search::Z3950->initialize();
-	OpenILS::Application::Search::Zips->initialize();
-	OpenILS::Application::Search::Biblio->initialize();
+    OpenILS::Application::Search::Z3950->initialize();
+    OpenILS::Application::Search::Zips->initialize();
+    OpenILS::Application::Search::Biblio->initialize();
 }
 
 sub child_init {
-	OpenILS::Application::Search::Z3950->child_init;
+    OpenILS::Application::Search::Z3950->child_init;
 }
-	
+    
 
 
 # ------------------------------------------------------------------
@@ -74,25 +74,25 @@ __PACKAGE__->register_method(
 my $speller = Text::Aspell->new();
 
 sub spellcheck {
-	my( $self, $client, $phrase, $class ) = @_;
+    my( $self, $client, $phrase, $class ) = @_;
 
     return [] unless $phrase;   # nothing to check, abort.
 
-	my $conf = OpenSRF::Utils::SettingsClient->new;
+    my $conf = OpenSRF::Utils::SettingsClient->new;
     $class ||= 'default';
 
     my @conf_path = (apps => 'open-ils.search' => app_settings => spelling_dictionary => $class);
 
-	if( my $dict = $conf->config_value(@conf_path) ) {
-		$speller->set_option('master', $dict);
-		$logger->debug("spelling dictionary set to $dict");
-	}
+    if( my $dict = $conf->config_value(@conf_path) ) {
+        $speller->set_option('master', $dict);
+        $logger->debug("spelling dictionary set to $dict");
+    }
 
-	$speller->set_option('ignore-case', 'true');
+    $speller->set_option('ignore-case', 'true');
 
-	my @resp;
+    my @resp;
 
-	for my $word (split(/\s+/,$phrase) ) {
+    for my $word (split(/\s+/,$phrase) ) {
 
         my @suggestions = $speller->suggest($word);
         my @trimmed;
@@ -108,15 +108,15 @@ sub spellcheck {
             push(@trimmed, $sug);
         }
 
-		push( @resp, 
-			{
-				word => $word, 
-				suggestions => (@trimmed) ? [@trimmed] : undef,
+        push( @resp, 
+            {
+                word => $word, 
+                suggestions => (@trimmed) ? [@trimmed] : undef,
                 found => $speller->check($word)
-			} 
-		); 
-	}
-	return \@resp;
+            } 
+        ); 
+    }
+    return \@resp;
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/AddedContent.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/AddedContent.pm
index 0538dea..375796f 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/AddedContent.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/AddedContent.pm
@@ -6,60 +6,60 @@ sub initialize { return 1; }
 
 
 __PACKAGE__->register_method(
-	method	=> "summary",
-	api_name	=> "open-ils.search.added_content.summary.retrieve",
-	notes		=> <<"	NOTE");
-		Returns an object like so:
-			{
-				Review		: true/false
-				Inventory	: true/false
-				Annotation	: true/false
-				Jacket		: true/false
-				TOC			: true/false
-				Product		: true/false
-			}
-		This object indicates the existance of each type of added content for the given ISBN
-		PARAMS( ISBN ),
-	NOTE
+    method  => "summary",
+    api_name    => "open-ils.search.added_content.summary.retrieve",
+    notes        => <<"    NOTE");
+        Returns an object like so:
+            {
+                Review      : true/false
+                Inventory   : true/false
+                Annotation  : true/false
+                Jacket      : true/false
+                TOC         : true/false
+                Product     : true/false
+            }
+        This object indicates the existance of each type of added content for the given ISBN
+        PARAMS( ISBN ),
+    NOTE
 
 sub summary {
-	return { 
-		Review		=> "false",
-		Inventory	=> "false",
-		Annotation	=> "false",
-		Jacket		=> "false",
-		TOC			=> "false",
-		Product		=> "false",
-	};
+    return { 
+        Review      => "false",
+        Inventory   => "false",
+        Annotation  => "false",
+        Jacket      => "false",
+        TOC         => "false",
+        Product     => "false",
+    };
 }
 
 
 __PACKAGE__->register_method(
-	method	=> "reviews",
-	api_name	=> "open-ils.search.added_content.review.retrieve.random",
-	notes		=> <<"	NOTE");
-		Returns a singe random review article object
-		PARAMS( ISBN ),
-	NOTE
+    method  => "reviews",
+    api_name    => "open-ils.search.added_content.review.retrieve.random",
+    notes        => <<"    NOTE");
+        Returns a singe random review article object
+        PARAMS( ISBN ),
+    NOTE
 
 __PACKAGE__->register_method(
-	method	=> "reviews",
-	api_name	=> "open-ils.search.added_content.review.retrieve.all",
-	notes		=> <<"	NOTE");
-		Returns an array review article objects
-		PARAMS( ISBN ),
-	NOTE
+    method  => "reviews",
+    api_name    => "open-ils.search.added_content.review.retrieve.all",
+    notes        => <<"    NOTE");
+        Returns an array review article objects
+        PARAMS( ISBN ),
+    NOTE
 
 sub reviews { return []; }
 
 
 __PACKAGE__->register_method(
-	method	=> "toc",
-	api_name	=> "open-ils.search.added_content.toc.retrieve",
-	notes		=> <<"	NOTE");
-		Returns the table of contents for the given ISBN
-		PARAMS( ISBN ),
-	NOTE
+    method  => "toc",
+    api_name    => "open-ils.search.added_content.toc.retrieve",
+    notes        => <<"    NOTE");
+        Returns the table of contents for the given ISBN
+        PARAMS( ISBN ),
+    NOTE
 
 sub toc { return ""; }
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Authority.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Authority.pm
index 3dc14d8..d0e52aa 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Authority.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Authority.pm
@@ -19,45 +19,45 @@ my $cache;
 
 
 sub validate_authority {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	my $session = OpenSRF::AppSession->create("open-ils.storage");
-	return $session->request( 'open-ils.storage.authority.validate.tag' => @_ )->gather(1);
+    my $session = OpenSRF::AppSession->create("open-ils.storage");
+    return $session->request( 'open-ils.storage.authority.validate.tag' => @_ )->gather(1);
 }
 __PACKAGE__->register_method(
-        method		=> "validate_authority",
-        api_name	=> "open-ils.search.authority.validate.tag",
-        argc		=> 4, 
-        note		=> "Validates authority data from existing controlled terms",
+        method      => "validate_authority",
+        api_name    => "open-ils.search.authority.validate.tag",
+        argc        => 4, 
+        note        => "Validates authority data from existing controlled terms",
 );              
 
 sub validate_authority_return_records_by_id {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	my $session = OpenSRF::AppSession->create("open-ils.storage");
-	return $session->request( 'open-ils.storage.authority.validate.tag.id_list' => @_ )->gather(1);
+    my $session = OpenSRF::AppSession->create("open-ils.storage");
+    return $session->request( 'open-ils.storage.authority.validate.tag.id_list' => @_ )->gather(1);
 }
 __PACKAGE__->register_method(
-        method		=> "validate_authority_return_records_by_id",
-        api_name	=> "open-ils.search.authority.validate.tag.id_list",
-        argc		=> 4, 
-        note		=> "Validates authority data from existing controlled terms",
+        method      => "validate_authority_return_records_by_id",
+        api_name    => "open-ils.search.authority.validate.tag.id_list",
+        argc        => 4, 
+        note        => "Validates authority data from existing controlled terms",
 );              
 
 sub search_authority {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	my $session = OpenSRF::AppSession->create("open-ils.storage");
-	return $session->request( 'open-ils.storage.authority.search.marc.atomic' => @_ )->gather(1);
+    my $session = OpenSRF::AppSession->create("open-ils.storage");
+    return $session->request( 'open-ils.storage.authority.search.marc.atomic' => @_ )->gather(1);
 }
 __PACKAGE__->register_method(
-        method		=> "search_authority",
-        api_name	=> "open-ils.search.authority.fts",
-        argc		=> 2, 
-        note		=> "Searches authority data for existing controlled terms and crossrefs",
+        method      => "search_authority",
+        api_name    => "open-ils.search.authority.fts",
+        argc        => 2, 
+        note        => "Searches authority data for existing controlled terms and crossrefs",
 );              
 
 sub search_authority_by_simple_normalize_heading {
@@ -83,11 +83,11 @@ sub search_authority_by_simple_normalize_heading {
     $client->respond_complete;
 }
 __PACKAGE__->register_method(
-        method		=> "search_authority_by_simple_normalize_heading",
-        api_name	=> "open-ils.search.authority.simple_heading.from_xml",
-        argc		=> 1, 
+        method      => "search_authority_by_simple_normalize_heading",
+        api_name    => "open-ils.search.authority.simple_heading.from_xml",
+        argc        => 1, 
         stream      => 1,
-        note		=> "Searches authority data by main entry using marcxml, returning 'are' ids; params are marcxml and optional control-set-id",
+        note        => "Searches authority data by main entry using marcxml, returning 'are' ids; params are marcxml and optional control-set-id",
 );
 
 sub search_authority_batch_by_simple_normalize_heading {
@@ -106,226 +106,226 @@ sub search_authority_batch_by_simple_normalize_heading {
     $client->respond_complete;
 }
 __PACKAGE__->register_method(
-        method		=> "search_authority_batch_by_simple_normalize_heading",
-        api_name	=> "open-ils.search.authority.simple_heading.from_xml.batch",
-        argc		=> 1, 
+        method      => "search_authority_batch_by_simple_normalize_heading",
+        api_name    => "open-ils.search.authority.simple_heading.from_xml.batch",
+        argc        => 1, 
         stream      => 1,
-        note		=> "Searches authority data by main entry using marcxml, in control-set batches, returning 'are' ids; params are hashes of { control-set-id => marcxml }",
+        note        => "Searches authority data by main entry using marcxml, in control-set batches, returning 'are' ids; params are hashes of { control-set-id => marcxml }",
 );
 
 
 sub crossref_authority {
-	my $self = shift;
-	my $client = shift;
-	my $class = shift;
-	my $term = shift;
-	my $limit = shift || 10;
+    my $self = shift;
+    my $client = shift;
+    my $class = shift;
+    my $term = shift;
+    my $limit = shift || 10;
 
-	my $session = OpenSRF::AppSession->create("open-ils.storage");
+    my $session = OpenSRF::AppSession->create("open-ils.storage");
 
-	# Avoid generating spurious errors for more granular indexes, like author|personal
-	$class =~ s/^(.*?)\|.*?$/$1/;
+    # Avoid generating spurious errors for more granular indexes, like author|personal
+    $class =~ s/^(.*?)\|.*?$/$1/;
 
-	$logger->info("authority xref search for $class=$term, limit=$limit");
-	my $fr = $session->request(
-		"open-ils.storage.authority.$class.see_from.controlled.atomic",$term, $limit)->gather(1);
-	my $al = $session->request(
-		"open-ils.storage.authority.$class.see_also_from.controlled.atomic",$term, $limit)->gather(1);
+    $logger->info("authority xref search for $class=$term, limit=$limit");
+    my $fr = $session->request(
+        "open-ils.storage.authority.$class.see_from.controlled.atomic",$term, $limit)->gather(1);
+    my $al = $session->request(
+        "open-ils.storage.authority.$class.see_also_from.controlled.atomic",$term, $limit)->gather(1);
 
-	my $data = _auth_flatten( $term, $fr, $al, 1 );
+    my $data = _auth_flatten( $term, $fr, $al, 1 );
 
-	return $data;
+    return $data;
 }
 
 sub _auth_flatten {
-	my $term = shift;
-	my $fr = shift;
-	my $al = shift;
-	my $limit = shift;
-
-	my %hash = ();
-	for my $x (@$fr) {
-		my $string = $$x[0];
-		for my $i (1..10) {
-			last unless ($$x[$i]);
-			if ($string =~ /\W$/o) {
-				$string .= ' '.$$x[$i];
-			} else {
-				$string .= ' -- '.$$x[$i];
-			}
-		}
-		next if (lc($string) eq lc($term));
-		$hash{$string}++;
-		$hash{$string}++ if (lc($$x[0]) eq lc($term));
-	}
-	my $from = [keys %hash]; #[ sort { $hash{$b} <=> $hash{$a} || $a cmp $b } keys %hash ];
-
-#	$from = [ @$from[0..4] ] if $limit;
-
-	%hash = ();
-	for my $x (@$al) {
-		my $string = $$x[0];
-		for my $i (1..10) {
-			last unless ($$x[$i]);
-			if ($string =~ /\W$/o) {
-				$string .= ' '.$$x[$i];
-			} else {
-				$string .= ' -- '.$$x[$i];
-			}
-		}
-		next if (lc($string) eq lc($term));
-		$hash{$string}++;
-		$hash{$string}++ if (lc($$x[0]) eq lc($term));
-	}
-	my $also = [keys %hash]; #[ sort { $hash{$b} <=> $hash{$a} || $a cmp $b } keys %hash ];
-
-#	$also = [ @$also[0..4] ] if $limit;
-
-	#warn Dumper( { from => $from, also => $also } );
-
-	return { from => $from, also => $also };
+    my $term = shift;
+    my $fr = shift;
+    my $al = shift;
+    my $limit = shift;
+
+    my %hash = ();
+    for my $x (@$fr) {
+        my $string = $$x[0];
+        for my $i (1..10) {
+            last unless ($$x[$i]);
+            if ($string =~ /\W$/o) {
+                $string .= ' '.$$x[$i];
+            } else {
+                $string .= ' -- '.$$x[$i];
+            }
+        }
+        next if (lc($string) eq lc($term));
+        $hash{$string}++;
+        $hash{$string}++ if (lc($$x[0]) eq lc($term));
+    }
+    my $from = [keys %hash]; #[ sort { $hash{$b} <=> $hash{$a} || $a cmp $b } keys %hash ];
+
+#   $from = [ @$from[0..4] ] if $limit;
+
+    %hash = ();
+    for my $x (@$al) {
+        my $string = $$x[0];
+        for my $i (1..10) {
+            last unless ($$x[$i]);
+            if ($string =~ /\W$/o) {
+                $string .= ' '.$$x[$i];
+            } else {
+                $string .= ' -- '.$$x[$i];
+            }
+        }
+        next if (lc($string) eq lc($term));
+        $hash{$string}++;
+        $hash{$string}++ if (lc($$x[0]) eq lc($term));
+    }
+    my $also = [keys %hash]; #[ sort { $hash{$b} <=> $hash{$a} || $a cmp $b } keys %hash ];
+
+#   $also = [ @$also[0..4] ] if $limit;
+
+    #warn Dumper( { from => $from, also => $also } );
+
+    return { from => $from, also => $also };
 }
 
 __PACKAGE__->register_method(
-        method		=> "crossref_authority",
-        api_name	=> "open-ils.search.authority.crossref",
-        argc		=> 2, 
-        note		=> "Searches authority data for existing controlled terms and crossrefs",
+        method      => "crossref_authority",
+        api_name    => "open-ils.search.authority.crossref",
+        argc        => 2, 
+        note        => "Searches authority data for existing controlled terms and crossrefs",
 );              
 
 __PACKAGE__->register_method(
-	#method		=> "new_crossref_authority_batch",
-	method		=> "crossref_authority_batch2",
-	api_name	=> "open-ils.search.authority.crossref.batch",
-	argc		=> 1, 
-	note		=> <<"	NOTE");
-	Takes an array of class,term pair sub-arrays and performs an authority lookup for each
-
-	PARAMS( [ ["subject", "earth"], ["author","shakespeare"] ] );
-
-	Returns an object like so:
-	{
-		"classname" : {
-			"term" : { "from" : [ ...], "also" : [...] }
-			"term2" : { "from" : [ ...], "also" : [...] }
-		}
-	}
-	NOTE
+    #method     => "new_crossref_authority_batch",
+    method      => "crossref_authority_batch2",
+    api_name    => "open-ils.search.authority.crossref.batch",
+    argc        => 1, 
+    note        => <<"    NOTE");
+    Takes an array of class,term pair sub-arrays and performs an authority lookup for each
+
+    PARAMS( [ ["subject", "earth"], ["author","shakespeare"] ] );
+
+    Returns an object like so:
+    {
+        "classname" : {
+            "term" : { "from" : [ ...], "also" : [...] }
+            "term2" : { "from" : [ ...], "also" : [...] }
+        }
+    }
+    NOTE
 
 sub new_crossref_authority_batch {
-	my( $self, $client, $reqs ) = @_;
+    my( $self, $client, $reqs ) = @_;
 
-	my $response = {};
-	my $lastr = [];
-	my $session = OpenSRF::AppSession->create("open-ils.storage");
+    my $response = {};
+    my $lastr = [];
+    my $session = OpenSRF::AppSession->create("open-ils.storage");
 
-	for my $req (@$reqs) {
+    for my $req (@$reqs) {
 
-		my $class = $req->[0];
-		my $term = $req->[1];
-		next unless $class and $term;
-		$logger->info("Sending authority request for $class : $term");
-		my $fr = $session->request("open-ils.storage.authority.$class.see_from.controlled.atomic",$term, 10)->gather(1);
-		my $al = $session->request("open-ils.storage.authority.$class.see_also_from.controlled.atomic",$term, 10)->gather(1);
+        my $class = $req->[0];
+        my $term = $req->[1];
+        next unless $class and $term;
+        $logger->info("Sending authority request for $class : $term");
+        my $fr = $session->request("open-ils.storage.authority.$class.see_from.controlled.atomic",$term, 10)->gather(1);
+        my $al = $session->request("open-ils.storage.authority.$class.see_also_from.controlled.atomic",$term, 10)->gather(1);
 
-		$response->{$class} = {} unless exists $response->{$class};
-		$response->{$class}->{$term} = _auth_flatten( $term, $fr, $al, 1 );
+        $response->{$class} = {} unless exists $response->{$class};
+        $response->{$class}->{$term} = _auth_flatten( $term, $fr, $al, 1 );
 
-	}
+    }
 
-	#warn Dumper( $response );
-	return $response;
+    #warn Dumper( $response );
+    return $response;
 }
 
 sub crossref_authority_batch {
-	my( $self, $client, $reqs ) = @_;
-
-	my $response = {};
-	my $lastr = [];
-	my $session = OpenSRF::AppSession->create("open-ils.storage");
-
-	for my $req (@$reqs) {
-
-		my $class = $req->[0];
-		my $term = $req->[1];
-		next unless $class and $term;
-		$logger->info("Sending authority request for $class : $term");
-		my $freq = $session->request("open-ils.storage.authority.$class.see_from.controlled.atomic",$term, 10);
-		my $areq = $session->request("open-ils.storage.authority.$class.see_also_from.controlled.atomic",$term, 10);
-
-		if( $lastr->[0] ) { #process old data while waiting on new data
-			my $cls = $lastr->[0];
-			my $trm = $lastr->[1];
-			my $fr	= $lastr->[2];
-			my $al	= $lastr->[3];
-			$response->{$cls} = {} unless exists $response->{$cls};
-			$response->{$cls}->{$trm} = _auth_flatten( $trm, $fr, $al, 1 );
-		}
-
-		$lastr->[0] = $class;
-		$lastr->[1] = $term; 
-		$lastr->[2] = $freq->gather(1);
-		$lastr->[3] = $areq->gather(1);
-	}
-
-	if( $lastr->[0] ) { #process old data while waiting on new data
-		my $cls = $lastr->[0];
-		my $trm = $lastr->[1];
-		my $fr	= $lastr->[2];
-		my $al	= $lastr->[3];
-		$response->{$cls} = {} unless exists $response->{$cls};
-		$response->{$cls}->{$trm} = _auth_flatten( $trm, $fr, $al, 1);
-	}
-
-	return $response;
+    my( $self, $client, $reqs ) = @_;
+
+    my $response = {};
+    my $lastr = [];
+    my $session = OpenSRF::AppSession->create("open-ils.storage");
+
+    for my $req (@$reqs) {
+
+        my $class = $req->[0];
+        my $term = $req->[1];
+        next unless $class and $term;
+        $logger->info("Sending authority request for $class : $term");
+        my $freq = $session->request("open-ils.storage.authority.$class.see_from.controlled.atomic",$term, 10);
+        my $areq = $session->request("open-ils.storage.authority.$class.see_also_from.controlled.atomic",$term, 10);
+
+        if( $lastr->[0] ) { #process old data while waiting on new data
+            my $cls = $lastr->[0];
+            my $trm = $lastr->[1];
+            my $fr  = $lastr->[2];
+            my $al  = $lastr->[3];
+            $response->{$cls} = {} unless exists $response->{$cls};
+            $response->{$cls}->{$trm} = _auth_flatten( $trm, $fr, $al, 1 );
+        }
+
+        $lastr->[0] = $class;
+        $lastr->[1] = $term; 
+        $lastr->[2] = $freq->gather(1);
+        $lastr->[3] = $areq->gather(1);
+    }
+
+    if( $lastr->[0] ) { #process old data while waiting on new data
+        my $cls = $lastr->[0];
+        my $trm = $lastr->[1];
+        my $fr  = $lastr->[2];
+        my $al  = $lastr->[3];
+        $response->{$cls} = {} unless exists $response->{$cls};
+        $response->{$cls}->{$trm} = _auth_flatten( $trm, $fr, $al, 1);
+    }
+
+    return $response;
 }
 
 
 
 
 sub crossref_authority_batch2 {
-	my( $self, $client, $reqs ) = @_;
-
-	my $response = {};
-	my $lastr = [];
-	my $session = OpenSRF::AppSession->create("open-ils.storage");
-
-	$cache = OpenSRF::Utils::Cache->new('global') unless $cache;
-
-	for my $req (@$reqs) {
-
-		my $class = $req->[0];
-		my $term = $req->[1];
-		next unless $class and $term;
-
-		my $t = $term;
-		$t =~ s/\s//og;
-		my $cdata = $cache->get_cache("oils_authority_${class}_$t");
-
-		if( $cdata ) {
-			$logger->debug("returning authority response from cache..");
-			$response->{$class} = {} unless exists $response->{$class};
-			$response->{$class}->{$term} = $cdata;
-			next;
-		}
-
-		$logger->debug("authority data not found in cache.. fetching from storage");
-
-		$logger->info("Sending authority request for $class : $term");
-		my $freq = $session->request("open-ils.storage.authority.$class.see_from.controlled.atomic",$term, 10);
-		my $areq = $session->request("open-ils.storage.authority.$class.see_also_from.controlled.atomic",$term, 10);
-		my $fr = $freq->gather(1);	
-		my $al = $areq->gather(1);
-		$response->{$class} = {} unless exists $response->{$class};
-		my $auth = _auth_flatten( $term, $fr, $al, 1 );
-
-		my $timeout = 7200; #two hours
-		$timeout = 300 if @{$auth->{from}} or @{$auth->{also}}; # 5 minutes
-		$response->{$class}->{$term} = $auth;
-		$logger->debug("adding authority lookup to cache with timeout $timeout");
-		$cache->put_cache("oils_authority_${class}_$t", $auth, $timeout);
-	}
-	return $response;
+    my( $self, $client, $reqs ) = @_;
+
+    my $response = {};
+    my $lastr = [];
+    my $session = OpenSRF::AppSession->create("open-ils.storage");
+
+    $cache = OpenSRF::Utils::Cache->new('global') unless $cache;
+
+    for my $req (@$reqs) {
+
+        my $class = $req->[0];
+        my $term = $req->[1];
+        next unless $class and $term;
+
+        my $t = $term;
+        $t =~ s/\s//og;
+        my $cdata = $cache->get_cache("oils_authority_${class}_$t");
+
+        if( $cdata ) {
+            $logger->debug("returning authority response from cache..");
+            $response->{$class} = {} unless exists $response->{$class};
+            $response->{$class}->{$term} = $cdata;
+            next;
+        }
+
+        $logger->debug("authority data not found in cache.. fetching from storage");
+
+        $logger->info("Sending authority request for $class : $term");
+        my $freq = $session->request("open-ils.storage.authority.$class.see_from.controlled.atomic",$term, 10);
+        my $areq = $session->request("open-ils.storage.authority.$class.see_also_from.controlled.atomic",$term, 10);
+        my $fr = $freq->gather(1);  
+        my $al = $areq->gather(1);
+        $response->{$class} = {} unless exists $response->{$class};
+        my $auth = _auth_flatten( $term, $fr, $al, 1 );
+
+        my $timeout = 7200; #two hours
+        $timeout = 300 if @{$auth->{from}} or @{$auth->{also}}; # 5 minutes
+        $response->{$class}->{$term} = $auth;
+        $logger->debug("adding authority lookup to cache with timeout $timeout");
+        $cache->put_cache("oils_authority_${class}_$t", $auth, $timeout);
+    }
+    return $response;
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
index 1b6a9ce..71a8563 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm
@@ -40,18 +40,18 @@ my $superpage_size;
 my $max_superpages;
 
 sub initialize {
-	$cache = OpenSRF::Utils::Cache->new('global');
-	my $sclient = OpenSRF::Utils::SettingsClient->new();
-	$cache_timeout = $sclient->config_value(
-			"apps", "open-ils.search", "app_settings", "cache_timeout" ) || 300;
+    $cache = OpenSRF::Utils::Cache->new('global');
+    my $sclient = OpenSRF::Utils::SettingsClient->new();
+    $cache_timeout = $sclient->config_value(
+            "apps", "open-ils.search", "app_settings", "cache_timeout" ) || 300;
 
-	$superpage_size = $sclient->config_value(
-			"apps", "open-ils.search", "app_settings", "superpage_size" ) || 500;
+    $superpage_size = $sclient->config_value(
+            "apps", "open-ils.search", "app_settings", "superpage_size" ) || 500;
 
-	$max_superpages = $sclient->config_value(
-			"apps", "open-ils.search", "app_settings", "max_superpages" ) || 20;
+    $max_superpages = $sclient->config_value(
+            "apps", "open-ils.search", "app_settings", "max_superpages" ) || 20;
 
-	$logger->info("Search cache timeout is $cache_timeout, ".
+    $logger->info("Search cache timeout is $cache_timeout, ".
         " superpage_size is $superpage_size, max_superpages is $max_superpages");
 }
 
@@ -62,28 +62,28 @@ sub initialize {
 # mods structures. Creates one MODS structure for each doc id.
 # ---------------------------------------------------------------------------
 sub _records_to_mods {
-	my @ids = @_;
-	
-	my @results;
-	my @marcxml_objs;
-
-	my $session = OpenSRF::AppSession->create("open-ils.cstore");
-	my $request = $session->request(
-			"open-ils.cstore.direct.biblio.record_entry.search", { id => \@ids } );
-
-	while( my $resp = $request->recv ) {
-		my $content = $resp->content;
-		next if $content->id == OILS_PRECAT_RECORD;
-		my $u = OpenILS::Utils::ModsParser->new();  # FIXME: we really need a new parser for each object?
-		$u->start_mods_batch( $content->marc );
-		my $mods = $u->finish_mods_batch();
-		$mods->doc_id($content->id());
-		$mods->tcn($content->tcn_value);
-		push @results, $mods;
-	}
+    my @ids = @_;
+    
+    my @results;
+    my @marcxml_objs;
+
+    my $session = OpenSRF::AppSession->create("open-ils.cstore");
+    my $request = $session->request(
+            "open-ils.cstore.direct.biblio.record_entry.search", { id => \@ids } );
+
+    while( my $resp = $request->recv ) {
+        my $content = $resp->content;
+        next if $content->id == OILS_PRECAT_RECORD;
+        my $u = OpenILS::Utils::ModsParser->new();  # FIXME: we really need a new parser for each object?
+        $u->start_mods_batch( $content->marc );
+        my $mods = $u->finish_mods_batch();
+        $mods->doc_id($content->id());
+        $mods->tcn($content->tcn_value);
+        push @results, $mods;
+    }
 
-	$session->disconnect();
-	return \@results;
+    $session->disconnect();
+    return \@results;
 }
 
 __PACKAGE__->register_method(
@@ -136,16 +136,16 @@ __PACKAGE__->register_method(
 
 # converts a record into a mods object with NO copy counts attached
 sub record_id_to_mods_slim {
-	my( $self, $client, $id ) = @_;
-	return undef unless defined $id;
+    my( $self, $client, $id ) = @_;
+    return undef unless defined $id;
 
-	if(ref($id) and ref($id) == 'ARRAY') {
-		return _records_to_mods( @$id );
-	}
-	my $mods_list = _records_to_mods( $id );
-	my $mods_obj  = $mods_list->[0];
-	return OpenILS::Event->new('BIBLIO_RECORD_ENTRY_NOT_FOUND') unless $mods_obj;
-	return $mods_obj;
+    if(ref($id) and ref($id) == 'ARRAY') {
+        return _records_to_mods( @$id );
+    }
+    my $mods_list = _records_to_mods( $id );
+    my $mods_obj  = $mods_list->[0];
+    return OpenILS::Event->new('BIBLIO_RECORD_ENTRY_NOT_FOUND') unless $mods_obj;
+    return $mods_obj;
 }
 
 
@@ -156,7 +156,7 @@ __PACKAGE__->register_method(
     stream   => 1
 );
 sub record_id_to_mods_slim_batch {
-	my($self, $conn, $id_list) = @_;
+    my($self, $conn, $id_list) = @_;
     $conn->respond(_records_to_mods($_)->[0]) for @$id_list;
     return undef;
 }
@@ -350,7 +350,7 @@ sub biblio_search_tcn {
     my $search = {tcn_value => $tcn};
     $search->{deleted} = 'f' unless $include_deleted;
     my $recs = $e->search_biblio_record_entry( $search, {idlist =>1} );
-	
+    
     return { count => scalar(@$recs), ids => $recs };
 }
 
@@ -362,10 +362,10 @@ __PACKAGE__->register_method(
     api_name => "open-ils.search.asset.copy.find_by_barcode",
 );
 sub biblio_barcode_to_copy { 
-	my( $self, $client, $barcode ) = @_;
-	my( $copy, $evt ) = $U->fetch_copy_by_barcode($barcode);
-	return $evt if $evt;
-	return $copy;
+    my( $self, $client, $barcode ) = @_;
+    my( $copy, $evt ) = $U->fetch_copy_by_barcode($barcode);
+    return $evt if $evt;
+    return $copy;
 }
 
 __PACKAGE__->register_method(
@@ -373,17 +373,17 @@ __PACKAGE__->register_method(
     api_name => "open-ils.search.asset.copy.batch.retrieve",
 );
 sub biblio_id_to_copy { 
-	my( $self, $client, $ids ) = @_;
-	$logger->info("Fetching copies @$ids");
-	return $U->cstorereq(
-		"open-ils.cstore.direct.asset.copy.search.atomic", { id => $ids } );
+    my( $self, $client, $ids ) = @_;
+    $logger->info("Fetching copies @$ids");
+    return $U->cstorereq(
+        "open-ils.cstore.direct.asset.copy.search.atomic", { id => $ids } );
 }
 
 
 __PACKAGE__->register_method(
-	method	=> "biblio_id_to_uris",
-	api_name=> "open-ils.search.asset.uri.retrieve_by_bib",
-	argc	=> 2, 
+    method  => "biblio_id_to_uris",
+    api_name=> "open-ils.search.asset.uri.retrieve_by_bib",
+    argc    => 2, 
     stream  => 1,
     signature => q#
         @param BibID Which bib record contains the URIs
@@ -394,14 +394,14 @@ __PACKAGE__->register_method(
 
 );
 sub biblio_id_to_uris { 
-	my( $self, $client, $bib, $org, $depth ) = @_;
+    my( $self, $client, $bib, $org, $depth ) = @_;
     die "Org ID required" unless defined($org);
     die "Bib ID required" unless defined($bib);
 
     my @params;
     push @params, $depth if (defined $depth);
 
-	my $ids = $U->cstorereq( "open-ils.cstore.json_query.atomic",
+    my $ids = $U->cstorereq( "open-ils.cstore.json_query.atomic",
         {   select  => { auri => [ 'id' ] },
             from    => {
                 acn => {
@@ -435,8 +435,8 @@ sub biblio_id_to_uris {
         }
     );
 
-	my $uris = $U->cstorereq(
-		"open-ils.cstore.direct.asset.uri.search.atomic",
+    my $uris = $U->cstorereq(
+        "open-ils.cstore.direct.asset.uri.search.atomic",
         { id => [ map { (values %$_) } @$ids ] }
     );
 
@@ -462,9 +462,9 @@ __PACKAGE__->register_method(
 );
 
 sub copy_retrieve {
-	my( $self, $client, $cid ) = @_;
-	my( $copy, $evt ) = $U->fetch_copy($cid);
-	return $evt || $copy;
+    my( $self, $client, $cid ) = @_;
+    my( $copy, $evt ) = $U->fetch_copy($cid);
+    return $evt || $copy;
 }
 
 __PACKAGE__->register_method(
@@ -472,10 +472,10 @@ __PACKAGE__->register_method(
     api_name => "open-ils.search.asset.call_number.retrieve"
 );
 sub volume_retrieve {
-	my( $self, $client, $vid ) = @_;
-	my $e = new_editor();
-	my $vol = $e->retrieve_asset_call_number($vid) or return $e->event;
-	return $vol;
+    my( $self, $client, $vid ) = @_;
+    my $e = new_editor();
+    my $vol = $e->retrieve_asset_call_number($vid) or return $e->event;
+    return $vol;
 }
 
 __PACKAGE__->register_method(
@@ -485,14 +485,14 @@ __PACKAGE__->register_method(
 );
 
 sub fleshed_copy_retrieve_batch { 
-	my( $self, $client, $ids ) = @_;
-	$logger->info("Fetching fleshed copies @$ids");
-	return $U->cstorereq(
-		"open-ils.cstore.direct.asset.copy.search.atomic",
-		{ id => $ids },
-		{ flesh => 1, 
-		  flesh_fields => { acp => [ qw/ circ_lib location status stat_cat_entries parts / ] }
-		});
+    my( $self, $client, $ids ) = @_;
+    $logger->info("Fetching fleshed copies @$ids");
+    return $U->cstorereq(
+        "open-ils.cstore.direct.asset.copy.search.atomic",
+        { id => $ids },
+        { flesh => 1, 
+          flesh_fields => { acp => [ qw/ circ_lib location status stat_cat_entries parts / ] }
+        });
 }
 
 
@@ -502,9 +502,9 @@ __PACKAGE__->register_method(
 );
 
 sub fleshed_copy_retrieve { 
-	my( $self, $client, $id ) = @_;
-	my( $c, $e) = $U->fetch_fleshed_copy($id);
-	return $e || $c;
+    my( $self, $client, $id ) = @_;
+    my( $c, $e) = $U->fetch_fleshed_copy($id);
+    return $e || $c;
 }
 
 
@@ -514,12 +514,12 @@ __PACKAGE__->register_method(
     authoritative => 1,
 );
 sub fleshed_by_barcode {
-	my( $self, $conn, $barcode ) = @_;
-	my $e = new_editor();
-	my $copyid = $e->search_asset_copy(
-		{barcode => $barcode, deleted => 'f'}, {idlist=>1})->[0]
-		or return $e->event;
-	return fleshed_copy_retrieve2( $self, $conn, $copyid);
+    my( $self, $conn, $barcode ) = @_;
+    my $e = new_editor();
+    my $copyid = $e->search_asset_copy(
+        {barcode => $barcode, deleted => 'f'}, {idlist=>1})->[0]
+        or return $e->event;
+    return fleshed_copy_retrieve2( $self, $conn, $copyid);
 }
 
 
@@ -530,11 +530,11 @@ __PACKAGE__->register_method(
 );
 
 sub fleshed_copy_retrieve2 { 
-	my( $self, $client, $id ) = @_;
-	my $e = new_editor();
-	my $copy = $e->retrieve_asset_copy(
-		[
-			$id,
+    my( $self, $client, $id ) = @_;
+    my $e = new_editor();
+    my $copy = $e->retrieve_asset_copy(
+        [
+            $id,
             {
                 flesh        => 2,
                 flesh_fields => {
@@ -544,27 +544,27 @@ sub fleshed_copy_retrieve2 {
                     ascecm => [qw/ stat_cat stat_cat_entry /],
                 }
             }
-		]
-	) or return $e->event;
+        ]
+    ) or return $e->event;
 
-	# For backwards compatibility
-	#$copy->stat_cat_entries($copy->stat_cat_entry_copy_maps);
+    # For backwards compatibility
+    #$copy->stat_cat_entries($copy->stat_cat_entry_copy_maps);
 
-	if( $copy->status->id == OILS_COPY_STATUS_CHECKED_OUT ) {
-		$copy->circulations(
-			$e->search_action_circulation( 
-				[	
-					{ target_copy => $copy->id },
-					{
-						order_by => { circ => 'xact_start desc' },
-						limit => 1
-					}
-				]
-			)
-		);
-	}
+    if( $copy->status->id == OILS_COPY_STATUS_CHECKED_OUT ) {
+        $copy->circulations(
+            $e->search_action_circulation( 
+                [   
+                    { target_copy => $copy->id },
+                    {
+                        order_by => { circ => 'xact_start desc' },
+                        limit => 1
+                    }
+                ]
+            )
+        );
+    }
 
-	return $copy;
+    return $copy;
 }
 
 
@@ -575,20 +575,20 @@ __PACKAGE__->register_method(
 );
 
 sub flesh_copy_custom {
-	my( $self, $conn, $copyid, $fields ) = @_;
-	my $e = new_editor();
-	my $copy = $e->retrieve_asset_copy(
-		[
-			$copyid,
-			{ 
-				flesh				=> 1,
-				flesh_fields	=> { 
-					acp => $fields,
-				}
-			}
-		]
-	) or return $e->event;
-	return $copy;
+    my( $self, $conn, $copyid, $fields ) = @_;
+    my $e = new_editor();
+    my $copy = $e->retrieve_asset_copy(
+        [
+            $copyid,
+            { 
+                flesh               => 1,
+                flesh_fields    => { 
+                    acp => $fields,
+                }
+            }
+        ]
+    ) or return $e->event;
+    return $copy;
 }
 
 
@@ -598,14 +598,14 @@ __PACKAGE__->register_method(
 );
 
 sub biblio_barcode_to_title {
-	my( $self, $client, $barcode ) = @_;
+    my( $self, $client, $barcode ) = @_;
 
-	my $title = $apputils->simple_scalar_request(
-		"open-ils.storage",
-		"open-ils.storage.biblio.record_entry.retrieve_by_barcode", $barcode );
+    my $title = $apputils->simple_scalar_request(
+        "open-ils.storage",
+        "open-ils.storage.biblio.record_entry.retrieve_by_barcode", $barcode );
 
-	return { ids => [ $title->id ], count => 1 } if $title;
-	return { count => 0 };
+    return { ids => [ $title->id ], count => 1 } if $title;
+    return { count => 0 };
 }
 
 __PACKAGE__->register_method(
@@ -704,7 +704,7 @@ __PACKAGE__->register_method(
 
 
 sub find_peer_bibs {
-	my( $self, $client, $doc_id ) = @_;
+    my( $self, $client, $doc_id ) = @_;
     my $e = new_editor();
 
     my $multi_home_list = $e->search_biblio_peer_bib_copy_map(
@@ -755,18 +755,18 @@ __PACKAGE__->register_method(
 
 # takes a copy object and returns it fleshed mods object
 sub biblio_copy_to_mods {
-	my( $self, $client, $copy ) = @_;
+    my( $self, $client, $copy ) = @_;
 
-	my $volume = $U->cstorereq( 
-		"open-ils.cstore.direct.asset.call_number.retrieve",
-		$copy->call_number() );
+    my $volume = $U->cstorereq( 
+        "open-ils.cstore.direct.asset.call_number.retrieve",
+        $copy->call_number() );
 
-	my $mods = _records_to_mods($volume->record());
-	$mods = shift @$mods;
-	$volume->copies([$copy]);
-	push @{$mods->call_numbers()}, $volume;
+    my $mods = _records_to_mods($volume->record());
+    $mods = shift @$mods;
+    $volume->copies([$copy]);
+    push @{$mods->call_numbers()}, $volume;
 
-	return $mods;
+    return $mods;
 }
 
 
@@ -939,7 +939,7 @@ sub multiclass_query {
     # capture the original limit because the search method alters the limit internally
     my $ol = $arghash->{limit};
 
-	my $sclient = OpenSRF::Utils::SettingsClient->new;
+    my $sclient = OpenSRF::Utils::SettingsClient->new;
 
     (my $method = $self->api_name) =~ s/\.query//o;
 
@@ -952,7 +952,7 @@ sub multiclass_query {
     #$arghash->{preferred_language} = $U->get_org_locale($arghash->{org_unit})
     #    unless $arghash->{preferred_language};
 
-	$method = $self->method_lookup($method);
+    $method = $self->method_lookup($method);
     my ($data) = $method->run($arghash, $docache);
 
     $arghash->{searches} = $search if (!$data->{complex_query});
@@ -981,57 +981,57 @@ __PACKAGE__->register_method(
 );
 
 sub cat_search_z_style_wrapper {
-	my $self = shift;
-	my $client = shift;
-	my $authtoken = shift;
-	my $args = shift;
-
-	my $cstore = OpenSRF::AppSession->connect('open-ils.cstore');
-
-	my $ou = $cstore->request(
-		'open-ils.cstore.direct.actor.org_unit.search',
-		{ parent_ou => undef }
-	)->gather(1);
-
-	my $result = { service => 'native-evergreen-catalog', records => [] };
-	my $searchhash = { limit => $$args{limit}, offset => $$args{offset}, org_unit => $ou->id };
-
-	$$searchhash{searches}{title}{term}   = $$args{search}{title}   if $$args{search}{title};
-	$$searchhash{searches}{author}{term}  = $$args{search}{author}  if $$args{search}{author};
-	$$searchhash{searches}{subject}{term} = $$args{search}{subject} if $$args{search}{subject};
-	$$searchhash{searches}{keyword}{term} = $$args{search}{keyword} if $$args{search}{keyword};
-	$$searchhash{searches}{'identifier|isbn'}{term} = $$args{search}{isbn} if $$args{search}{isbn};
-	$$searchhash{searches}{'identifier|issn'}{term} = $$args{search}{issn} if $$args{search}{issn};
-
-	$$searchhash{searches}{keyword}{term} .= join ' ', $$searchhash{searches}{keyword}{term}, $$args{search}{tcn}       if $$args{search}{tcn};
-	$$searchhash{searches}{keyword}{term} .= join ' ', $$searchhash{searches}{keyword}{term}, $$args{search}{publisher} if $$args{search}{publisher};
-	$$searchhash{searches}{keyword}{term} .= join ' ', $$searchhash{searches}{keyword}{term}, $$args{search}{pubdate}   if $$args{search}{pubdate};
-	$$searchhash{searches}{keyword}{term} .= join ' ', $$searchhash{searches}{keyword}{term}, $$args{search}{item_type} if $$args{search}{item_type};
-
-	my $list = the_quest_for_knowledge( $self, $client, $searchhash );
-
-	if ($list->{count} > 0 and @{$list->{ids}}) {
-		$result->{count} = $list->{count};
-
-		my $records = $cstore->request(
-			'open-ils.cstore.direct.biblio.record_entry.search.atomic',
-			{ id => [ map { ( $_->[0] ) } @{$list->{ids}} ] }
-		)->gather(1);
-
-		for my $rec ( @$records ) {
-			
-			my $u = OpenILS::Utils::ModsParser->new();
+    my $self = shift;
+    my $client = shift;
+    my $authtoken = shift;
+    my $args = shift;
+
+    my $cstore = OpenSRF::AppSession->connect('open-ils.cstore');
+
+    my $ou = $cstore->request(
+        'open-ils.cstore.direct.actor.org_unit.search',
+        { parent_ou => undef }
+    )->gather(1);
+
+    my $result = { service => 'native-evergreen-catalog', records => [] };
+    my $searchhash = { limit => $$args{limit}, offset => $$args{offset}, org_unit => $ou->id };
+
+    $$searchhash{searches}{title}{term}   = $$args{search}{title}   if $$args{search}{title};
+    $$searchhash{searches}{author}{term}  = $$args{search}{author}  if $$args{search}{author};
+    $$searchhash{searches}{subject}{term} = $$args{search}{subject} if $$args{search}{subject};
+    $$searchhash{searches}{keyword}{term} = $$args{search}{keyword} if $$args{search}{keyword};
+    $$searchhash{searches}{'identifier|isbn'}{term} = $$args{search}{isbn} if $$args{search}{isbn};
+    $$searchhash{searches}{'identifier|issn'}{term} = $$args{search}{issn} if $$args{search}{issn};
+
+    $$searchhash{searches}{keyword}{term} .= join ' ', $$searchhash{searches}{keyword}{term}, $$args{search}{tcn}       if $$args{search}{tcn};
+    $$searchhash{searches}{keyword}{term} .= join ' ', $$searchhash{searches}{keyword}{term}, $$args{search}{publisher} if $$args{search}{publisher};
+    $$searchhash{searches}{keyword}{term} .= join ' ', $$searchhash{searches}{keyword}{term}, $$args{search}{pubdate}   if $$args{search}{pubdate};
+    $$searchhash{searches}{keyword}{term} .= join ' ', $$searchhash{searches}{keyword}{term}, $$args{search}{item_type} if $$args{search}{item_type};
+
+    my $list = the_quest_for_knowledge( $self, $client, $searchhash );
+
+    if ($list->{count} > 0 and @{$list->{ids}}) {
+        $result->{count} = $list->{count};
+
+        my $records = $cstore->request(
+            'open-ils.cstore.direct.biblio.record_entry.search.atomic',
+            { id => [ map { ( $_->[0] ) } @{$list->{ids}} ] }
+        )->gather(1);
+
+        for my $rec ( @$records ) {
+            
+            my $u = OpenILS::Utils::ModsParser->new();
                         $u->start_mods_batch( $rec->marc );
                         my $mods = $u->finish_mods_batch();
 
-			push @{ $result->{records} }, { mvr => $mods, marcxml => $rec->marc, bibid => $rec->id };
+            push @{ $result->{records} }, { mvr => $mods, marcxml => $rec->marc, bibid => $rec->id };
 
-		}
+        }
 
-	}
+    }
 
     $cstore->disconnect();
-	return $result;
+    return $result;
 }
 
 # ----------------------------------------------------------------------------
@@ -1116,78 +1116,78 @@ __PACKAGE__->register_method(
 );
 
 sub the_quest_for_knowledge {
-	my( $self, $conn, $searchhash, $docache ) = @_;
+    my( $self, $conn, $searchhash, $docache ) = @_;
 
-	return { count => 0 } unless $searchhash and
-		ref $searchhash->{searches} eq 'HASH';
+    return { count => 0 } unless $searchhash and
+        ref $searchhash->{searches} eq 'HASH';
 
-	my $method = 'open-ils.storage.biblio.multiclass.search_fts';
-	my $ismeta = 0;
-	my @recs;
+    my $method = 'open-ils.storage.biblio.multiclass.search_fts';
+    my $ismeta = 0;
+    my @recs;
 
-	if($self->api_name =~ /metabib/) {
-		$ismeta = 1;
-		$method =~ s/biblio/metabib/o;
-	}
+    if($self->api_name =~ /metabib/) {
+        $ismeta = 1;
+        $method =~ s/biblio/metabib/o;
+    }
 
-	# do some simple sanity checking
-	if(!$searchhash->{searches} or
-		( !grep { /^(?:title|author|subject|series|keyword|identifier\|is[bs]n)/ } keys %{$searchhash->{searches}} ) ) {
-		return { count => 0 };
-	}
+    # do some simple sanity checking
+    if(!$searchhash->{searches} or
+        ( !grep { /^(?:title|author|subject|series|keyword|identifier\|is[bs]n)/ } keys %{$searchhash->{searches}} ) ) {
+        return { count => 0 };
+    }
 
     my $offset = $searchhash->{offset} ||  0;   # user value or default in local var now
     my $limit  = $searchhash->{limit}  || 10;   # user value or default in local var now
     my $end    = $offset + $limit - 1;
 
-	my $maxlimit = 5000;
+    my $maxlimit = 5000;
     $searchhash->{offset} = 0;                  # possible user value overwritten in hash
     $searchhash->{limit}  = $maxlimit;          # possible user value overwritten in hash
 
-	return { count => 0 } if $offset > $maxlimit;
+    return { count => 0 } if $offset > $maxlimit;
 
-	my @search;
-	push( @search, ($_ => $$searchhash{$_})) for (sort keys %$searchhash);
-	my $s = OpenSRF::Utils::JSON->perl2JSON(\@search);
-	my $ckey = $pfx . md5_hex($method . $s);
+    my @search;
+    push( @search, ($_ => $$searchhash{$_})) for (sort keys %$searchhash);
+    my $s = OpenSRF::Utils::JSON->perl2JSON(\@search);
+    my $ckey = $pfx . md5_hex($method . $s);
 
-	$logger->info("bib search for: $s");
+    $logger->info("bib search for: $s");
 
-	$searchhash->{limit} -= $offset;
+    $searchhash->{limit} -= $offset;
 
 
     my $trim = 0;
-	my $result = ($docache) ? search_cache($ckey, $offset, $limit) : undef;
-
-	if(!$result) {
-
-		$method .= ".staff" if($self->api_name =~ /staff/);
-		$method .= ".atomic";
-	
-		for (keys %$searchhash) { 
-			delete $$searchhash{$_} 
-				unless defined $$searchhash{$_}; 
-		}
-	
-		$result = $U->storagereq( $method, %$searchhash );
+    my $result = ($docache) ? search_cache($ckey, $offset, $limit) : undef;
+
+    if(!$result) {
+
+        $method .= ".staff" if($self->api_name =~ /staff/);
+        $method .= ".atomic";
+    
+        for (keys %$searchhash) { 
+            delete $$searchhash{$_} 
+                unless defined $$searchhash{$_}; 
+        }
+    
+        $result = $U->storagereq( $method, %$searchhash );
         $trim = 1;
 
-	} else { 
-		$docache = 0;   # results came FROM cache, so we don't write back
-	}
+    } else { 
+        $docache = 0;   # results came FROM cache, so we don't write back
+    }
 
-	return {count => 0} unless ($result && $$result[0]);
+    return {count => 0} unless ($result && $$result[0]);
 
-	@recs = @$result;
+    @recs = @$result;
 
-	my $count = ($ismeta) ? $result->[0]->[3] : $result->[0]->[2];
+    my $count = ($ismeta) ? $result->[0]->[3] : $result->[0]->[2];
 
-	if($docache) {
-		# If we didn't get this data from the cache, put it into the cache
-		# then return the correct offset of records
-		$logger->debug("putting search cache $ckey\n");
-		put_cache($ckey, $count, \@recs);
-	}
+    if($docache) {
+        # If we didn't get this data from the cache, put it into the cache
+        # then return the correct offset of records
+        $logger->debug("putting search cache $ckey\n");
+        put_cache($ckey, $count, \@recs);
+    }
 
     if($trim) {
         # if we have the full set of data, trim out 
@@ -1200,7 +1200,7 @@ sub the_quest_for_knowledge {
         @recs = @t;
     }
 
-	return { ids => \@recs, count => $count };
+    return { ids => \@recs, count => $count };
 }
 
 
@@ -1246,7 +1246,7 @@ __PACKAGE__->register_method(
 );
 
 sub staged_search {
-	my($self, $conn, $search_hash, $docache) = @_;
+    my($self, $conn, $search_hash, $docache) = @_;
 
     my $IAmMetabib = ($self->api_name =~ /metabib/) ? 1 : 0;
 
@@ -1281,12 +1281,12 @@ sub staged_search {
     $search_hash->{core_limit}  = $superpage_size * $max_superpages;
 
     # Set the configured estimation strategy, defaults to 'inclusion'.
-	my $estimation_strategy = OpenSRF::Utils::SettingsClient
+    my $estimation_strategy = OpenSRF::Utils::SettingsClient
         ->new
         ->config_value(
             apps => 'open-ils.search', app_settings => 'estimation_strategy'
         ) || 'inclusion';
-	$search_hash->{estimation_strategy} = $estimation_strategy;
+    $search_hash->{estimation_strategy} = $estimation_strategy;
 
     # pull any existing results from the cache
     my $key = search_cache_key($method, $search_hash);
@@ -1386,12 +1386,12 @@ sub staged_search {
         $logger->debug("staged search: located $current_count, with estimated hits=".
             $summary->{estimated_hit_count}." : visible=".$summary->{visible}.", checked=".$summary->{checked});
 
-		if (defined($summary->{estimated_hit_count})) {
+        if (defined($summary->{estimated_hit_count})) {
             foreach (qw/ checked visible excluded deleted /) {
                 $global_summary->{$_} += $summary->{$_};
             }
-			$global_summary->{total} = $summary->{total};
-		}
+            $global_summary->{total} = $summary->{total};
+        }
 
         # we've found all the possible hits
         last if $current_count == $summary->{visible}
@@ -1418,22 +1418,22 @@ sub staged_search {
 
     my @results = grep {defined $_} @$all_results[$user_offset..($user_offset + $user_limit - 1)];
 
-	# refine the estimate if we have more than one superpage
-	if ($page > 0 and not $is_real_hit_count) {
-		if ($global_summary->{checked} >= $global_summary->{total}) {
-			$est_hit_count = $global_summary->{visible};
-		} else {
-			my $updated_hit_count = $U->storagereq(
-				'open-ils.storage.fts_paging_estimate',
-				$global_summary->{checked},
-				$global_summary->{visible},
-				$global_summary->{excluded},
-				$global_summary->{deleted},
-				$global_summary->{total}
-			);
-			$est_hit_count = $updated_hit_count->{$estimation_strategy};
-		}
-	}
+    # refine the estimate if we have more than one superpage
+    if ($page > 0 and not $is_real_hit_count) {
+        if ($global_summary->{checked} >= $global_summary->{total}) {
+            $est_hit_count = $global_summary->{visible};
+        } else {
+            my $updated_hit_count = $U->storagereq(
+                'open-ils.storage.fts_paging_estimate',
+                $global_summary->{checked},
+                $global_summary->{visible},
+                $global_summary->{excluded},
+                $global_summary->{deleted},
+                $global_summary->{total}
+            );
+            $est_hit_count = $updated_hit_count->{$estimation_strategy};
+        }
+    }
 
     $conn->respond_complete(
         {
@@ -1488,15 +1488,15 @@ sub tag_circulated_records {
 sub search_cache_key {
     my $method = shift;
     my $search_hash = shift;
-	my @sorted;
+    my @sorted;
     for my $key (sort keys %$search_hash) {
-	    push(@sorted, ($key => $$search_hash{$key})) 
+        push(@sorted, ($key => $$search_hash{$key})) 
             unless $key eq 'limit'  or 
                    $key eq 'offset' or 
                    $key eq 'skip_check';
     }
-	my $s = OpenSRF::Utils::JSON->perl2JSON(\@sorted);
-	return $pfx . md5_hex($method . $s);
+    my $s = OpenSRF::Utils::JSON->perl2JSON(\@sorted);
+    return $pfx . md5_hex($method . $s);
 }
 
 sub retrieve_cached_facets {
@@ -1625,42 +1625,42 @@ sub cache_staged_search_page {
 
 sub search_cache {
 
-	my $key		= shift;
-	my $offset	= shift;
-	my $limit	= shift;
-	my $start	= $offset;
-	my $end		= $offset + $limit - 1;
+    my $key     = shift;
+    my $offset  = shift;
+    my $limit   = shift;
+    my $start   = $offset;
+    my $end     = $offset + $limit - 1;
 
-	$logger->debug("searching cache for $key : $start..$end\n");
+    $logger->debug("searching cache for $key : $start..$end\n");
 
-	return undef unless $cache;
-	my $data = $cache->get_cache($key);
+    return undef unless $cache;
+    my $data = $cache->get_cache($key);
 
-	return undef unless $data;
+    return undef unless $data;
 
-	my $count = $data->[0];
-	$data = $data->[1];
+    my $count = $data->[0];
+    $data = $data->[1];
 
-	return undef unless $offset < $count;
+    return undef unless $offset < $count;
 
-	my @result;
-	for( my $i = $offset; $i <= $end; $i++ ) {
-		last unless my $d = $$data[$i];
-		push( @result, $d );
-	}
+    my @result;
+    for( my $i = $offset; $i <= $end; $i++ ) {
+        last unless my $d = $$data[$i];
+        push( @result, $d );
+    }
 
-	$logger->debug("search_cache found ".scalar(@result)." items for count=$count, start=$start, end=$end");
+    $logger->debug("search_cache found ".scalar(@result)." items for count=$count, start=$start, end=$end");
 
-	return \@result;
+    return \@result;
 }
 
 
 sub put_cache {
-	my( $key, $count, $data ) = @_;
-	return undef unless $cache;
-	$logger->debug("search_cache putting ".
-		scalar(@$data)." items at key $key with timeout $cache_timeout");
-	$cache->put_cache($key, [ $count, $data ], $cache_timeout);
+    my( $key, $count, $data ) = @_;
+    return undef unless $cache;
+    $logger->debug("search_cache putting ".
+        scalar(@$data)." items at key $key with timeout $cache_timeout");
+    $cache->put_cache($key, [ $count, $data ], $cache_timeout);
 }
 
 
@@ -1670,16 +1670,16 @@ __PACKAGE__->register_method(
 );
 
 sub biblio_mrid_to_modsbatch_batch {
-	my( $self, $client, $mrids) = @_;
-	# warn "Performing mrid_to_modsbatch_batch..."; # unconditional warn
-	my @mods;
-	my $method = $self->method_lookup("open-ils.search.biblio.metarecord.mods_slim.retrieve");
-	for my $id (@$mrids) {
-		next unless defined $id;
-		my ($m) = $method->run($id);
-		push @mods, $m;
-	}
-	return \@mods;
+    my( $self, $client, $mrids) = @_;
+    # warn "Performing mrid_to_modsbatch_batch..."; # unconditional warn
+    my @mods;
+    my $method = $self->method_lookup("open-ils.search.biblio.metarecord.mods_slim.retrieve");
+    for my $id (@$mrids) {
+        next unless defined $id;
+        my ($m) = $method->run($id);
+        push @mods, $m;
+    }
+    return \@mods;
 }
 
 
@@ -1704,47 +1704,47 @@ foreach (qw /open-ils.search.biblio.metarecord.mods_slim.retrieve
 }
 
 sub biblio_mrid_to_modsbatch {
-	my( $self, $client, $mrid, $args) = @_;
+    my( $self, $client, $mrid, $args) = @_;
 
-	# warn "Grabbing mvr for $mrid\n";    # unconditional warn
+    # warn "Grabbing mvr for $mrid\n";    # unconditional warn
 
-	my ($mr, $evt) = _grab_metarecord($mrid);
-	return $evt unless $mr;
+    my ($mr, $evt) = _grab_metarecord($mrid);
+    return $evt unless $mr;
 
-	my $mvr = biblio_mrid_check_mvr($self, $client, $mr) ||
+    my $mvr = biblio_mrid_check_mvr($self, $client, $mr) ||
               biblio_mrid_make_modsbatch($self, $client, $mr);
 
-	return $mvr unless ref($args);	
+    return $mvr unless ref($args);  
 
-	# Here we find the lead record appropriate for the given filters 
-	# and use that for the title and author of the metarecord
+    # Here we find the lead record appropriate for the given filters 
+    # and use that for the title and author of the metarecord
     my $format = $$args{format};
     my $org    = $$args{org};
     my $depth  = $$args{depth};
 
-	return $mvr unless $format or $org or $depth;
+    return $mvr unless $format or $org or $depth;
 
-	my $method = "open-ils.storage.ordered.metabib.metarecord.records";
-	$method = "$method.staff" if $self->api_name =~ /staff/o; 
+    my $method = "open-ils.storage.ordered.metabib.metarecord.records";
+    $method = "$method.staff" if $self->api_name =~ /staff/o; 
 
-	my $rec = $U->storagereq($method, $format, $org, $depth, 1);
+    my $rec = $U->storagereq($method, $format, $org, $depth, 1);
 
-	if( my $mods = $U->record_to_mvr($rec) ) {
+    if( my $mods = $U->record_to_mvr($rec) ) {
 
         $mvr->title( $mods->title );
         $mvr->author($mods->author);
-		$logger->debug("mods_slim updating title and ".
-			"author in mvr with ".$mods->title." : ".$mods->author);
-	}
+        $logger->debug("mods_slim updating title and ".
+            "author in mvr with ".$mods->title." : ".$mods->author);
+    }
 
-	return $mvr;
+    return $mvr;
 }
 
 # converts a metarecord to an mvr
 sub _mr_to_mvr {
-	my $mr = shift;
-	my $perl = OpenSRF::Utils::JSON->JSON2perl($mr->mods());
-	return Fieldmapper::metabib::virtual_record->new($perl);
+    my $mr = shift;
+    my $perl = OpenSRF::Utils::JSON->JSON2perl($mr->mods());
+    return Fieldmapper::metabib::virtual_record->new($perl);
 }
 
 # checks to see if a metarecord has mods, if so returns true;
@@ -1757,26 +1757,26 @@ __PACKAGE__->register_method(
 );
 
 sub biblio_mrid_check_mvr {
-	my( $self, $client, $mrid ) = @_;
-	my $mr; 
+    my( $self, $client, $mrid ) = @_;
+    my $mr; 
 
-	my $evt;
-	if(ref($mrid)) { $mr = $mrid; } 
-	else { ($mr, $evt) = _grab_metarecord($mrid); }
-	return $evt if $evt;
+    my $evt;
+    if(ref($mrid)) { $mr = $mrid; } 
+    else { ($mr, $evt) = _grab_metarecord($mrid); }
+    return $evt if $evt;
 
-	# warn "Checking mvr for mr " . $mr->id . "\n";   # unconditional warn
+    # warn "Checking mvr for mr " . $mr->id . "\n";   # unconditional warn
 
-	return _mr_to_mvr($mr) if $mr->mods();
-	return undef;
+    return _mr_to_mvr($mr) if $mr->mods();
+    return undef;
 }
 
 sub _grab_metarecord {
-	my $mrid = shift;
-	#my $e = OpenILS::Utils::Editor->new;
-	my $e = new_editor();
-	my $mr = $e->retrieve_metabib_metarecord($mrid) or return ( undef, $e->event );
-	return ($mr);
+    my $mrid = shift;
+    #my $e = OpenILS::Utils::Editor->new;
+    my $e = new_editor();
+    my $mr = $e->retrieve_metabib_metarecord($mrid) or return ( undef, $e->event );
+    return ($mr);
 }
 
 
@@ -1789,69 +1789,69 @@ __PACKAGE__->register_method(
 );
 
 sub biblio_mrid_make_modsbatch {
-	my( $self, $client, $mrid ) = @_;
+    my( $self, $client, $mrid ) = @_;
 
-	#my $e = OpenILS::Utils::Editor->new;
-	my $e = new_editor();
+    #my $e = OpenILS::Utils::Editor->new;
+    my $e = new_editor();
 
-	my $mr;
-	if( ref($mrid) ) {
-		$mr = $mrid;
-		$mrid = $mr->id;
-	} else {
-		$mr = $e->retrieve_metabib_metarecord($mrid) 
-			or return $e->event;
-	}
+    my $mr;
+    if( ref($mrid) ) {
+        $mr = $mrid;
+        $mrid = $mr->id;
+    } else {
+        $mr = $e->retrieve_metabib_metarecord($mrid) 
+            or return $e->event;
+    }
 
-	my $masterid = $mr->master_record;
-	$logger->info("creating new mods batch for metarecord=$mrid, master record=$masterid");
+    my $masterid = $mr->master_record;
+    $logger->info("creating new mods batch for metarecord=$mrid, master record=$masterid");
 
-	my $ids = $U->storagereq(
-		'open-ils.storage.ordered.metabib.metarecord.records.staff.atomic', $mrid);
-	return undef unless @$ids;
+    my $ids = $U->storagereq(
+        'open-ils.storage.ordered.metabib.metarecord.records.staff.atomic', $mrid);
+    return undef unless @$ids;
 
-	my $master = $e->retrieve_biblio_record_entry($masterid)
-		or return $e->event;
+    my $master = $e->retrieve_biblio_record_entry($masterid)
+        or return $e->event;
 
-	# start the mods batch
-	my $u = OpenILS::Utils::ModsParser->new();
-	$u->start_mods_batch( $master->marc );
+    # start the mods batch
+    my $u = OpenILS::Utils::ModsParser->new();
+    $u->start_mods_batch( $master->marc );
 
-	# grab all of the sub-records and shove them into the batch
-	my @ids = grep { $_ ne $masterid } @$ids;
-	#my $subrecs = (@ids) ? $e->batch_retrieve_biblio_record_entry(\@ids) : [];
+    # grab all of the sub-records and shove them into the batch
+    my @ids = grep { $_ ne $masterid } @$ids;
+    #my $subrecs = (@ids) ? $e->batch_retrieve_biblio_record_entry(\@ids) : [];
 
-	my $subrecs = [];
-	if(@$ids) {
-		for my $i (@$ids) {
-			my $r = $e->retrieve_biblio_record_entry($i);
-			push( @$subrecs, $r ) if $r;
-		}
-	}
+    my $subrecs = [];
+    if(@$ids) {
+        for my $i (@$ids) {
+            my $r = $e->retrieve_biblio_record_entry($i);
+            push( @$subrecs, $r ) if $r;
+        }
+    }
 
-	for(@$subrecs) {
-		$logger->debug("adding record ".$_->id." to mods batch for metarecord=$mrid");
-		$u->push_mods_batch( $_->marc ) if $_->marc;
-	}
+    for(@$subrecs) {
+        $logger->debug("adding record ".$_->id." to mods batch for metarecord=$mrid");
+        $u->push_mods_batch( $_->marc ) if $_->marc;
+    }
 
 
-	# finish up and send to the client
-	my $mods = $u->finish_mods_batch();
-	$mods->doc_id($mrid);
-	$client->respond_complete($mods);
+    # finish up and send to the client
+    my $mods = $u->finish_mods_batch();
+    $mods->doc_id($mrid);
+    $client->respond_complete($mods);
 
 
-	# now update the mods string in the db
-	my $string = OpenSRF::Utils::JSON->perl2JSON($mods->decast);
-	$mr->mods($string);
+    # now update the mods string in the db
+    my $string = OpenSRF::Utils::JSON->perl2JSON($mods->decast);
+    $mr->mods($string);
 
-	#$e = OpenILS::Utils::Editor->new(xact => 1);
-	$e = new_editor(xact => 1);
-	$e->update_metabib_metarecord($mr) 
-		or $logger->error("Error setting mods text on metarecord $mrid : " . Dumper($e->event));
-	$e->finish;
+    #$e = OpenILS::Utils::Editor->new(xact => 1);
+    $e = new_editor(xact => 1);
+    $e->update_metabib_metarecord($mr) 
+        or $logger->error("Error setting mods text on metarecord $mrid : " . Dumper($e->event));
+    $e->finish;
 
-	return undef;
+    return undef;
 }
 
 
@@ -1880,17 +1880,17 @@ foreach (qw/open-ils.search.biblio.metarecord_to_records
 }
 
 sub biblio_mrid_to_record_ids {
-	my( $self, $client, $mrid, $args ) = @_;
+    my( $self, $client, $mrid, $args ) = @_;
 
     my $format = $$args{format};
     my $org    = $$args{org};
     my $depth  = $$args{depth};
 
-	my $method = "open-ils.storage.ordered.metabib.metarecord.records.atomic";
-	$method =~ s/atomic/staff\.atomic/o if $self->api_name =~ /staff/o; 
-	my $recs = $U->storagereq($method, $mrid, $format, $org, $depth);
+    my $method = "open-ils.storage.ordered.metabib.metarecord.records.atomic";
+    $method =~ s/atomic/staff\.atomic/o if $self->api_name =~ /staff/o; 
+    my $recs = $U->storagereq($method, $mrid, $format, $org, $depth);
 
-	return { count => scalar(@$recs), ids => $recs };
+    return { count => scalar(@$recs), ids => $recs };
 }
 
 
@@ -1912,18 +1912,18 @@ my $slim_marc_sheet;
 my $settings_client = OpenSRF::Utils::SettingsClient->new();
 
 sub biblio_record_to_marc_html {
-	my($self, $client, $recordid, $slim, $marcxml) = @_;
+    my($self, $client, $recordid, $slim, $marcxml) = @_;
 
     my $sheet;
-	my $dir = $settings_client->config_value("dirs", "xsl");
+    my $dir = $settings_client->config_value("dirs", "xsl");
 
     if($slim) {
         unless($slim_marc_sheet) {
-		    my $xsl = $settings_client->config_value(
-			    "apps", "open-ils.search", "app_settings", 'marc_html_xsl_slim');
+            my $xsl = $settings_client->config_value(
+                "apps", "open-ils.search", "app_settings", 'marc_html_xsl_slim');
             if($xsl) {
-		        $xsl = $parser->parse_file("$dir/$xsl");
-		        $slim_marc_sheet = $xslt->parse_stylesheet($xsl);
+                $xsl = $parser->parse_file("$dir/$xsl");
+                $slim_marc_sheet = $xslt->parse_stylesheet($xsl);
             }
         }
         $sheet = $slim_marc_sheet;
@@ -1932,10 +1932,10 @@ sub biblio_record_to_marc_html {
     unless($sheet) {
         unless($marc_sheet) {
             my $xsl_key = ($slim) ? 'marc_html_xsl_slim' : 'marc_html_xsl';
-		    my $xsl = $settings_client->config_value(
-			    "apps", "open-ils.search", "app_settings", 'marc_html_xsl');
-		    $xsl = $parser->parse_file("$dir/$xsl");
-		    $marc_sheet = $xslt->parse_stylesheet($xsl);
+            my $xsl = $settings_client->config_value(
+                "apps", "open-ils.search", "app_settings", 'marc_html_xsl');
+            $xsl = $parser->parse_file("$dir/$xsl");
+            $marc_sheet = $xslt->parse_stylesheet($xsl);
         }
         $sheet = $marc_sheet;
     }
@@ -1953,9 +1953,9 @@ sub biblio_record_to_marc_html {
         $marcxml = $record->marc;
     }
 
-	my $xmldoc = $parser->parse_string($marcxml);
-	my $html = $sheet->transform($xmldoc);
-	return $html->documentElement->toString();
+    my $xmldoc = $parser->parse_string($marcxml);
+    my $html = $sheet->transform($xmldoc);
+    return $html->documentElement->toString();
 }
 
 __PACKAGE__->register_method(
@@ -2056,8 +2056,8 @@ __PACKAGE__->register_method(
 );
 
 sub retrieve_all_copy_statuses {
-	my( $self, $client ) = @_;
-	return new_editor()->retrieve_all_config_copy_status();
+    my( $self, $client ) = @_;
+    return new_editor()->retrieve_all_config_copy_status();
 }
 
 
@@ -2072,18 +2072,18 @@ __PACKAGE__->register_method(
 );
 
 sub copy_counts_per_org {
-	my( $self, $client, $record_id ) = @_;
+    my( $self, $client, $record_id ) = @_;
 
-	warn "Retreiveing copy copy counts for record $record_id and method " . $self->api_name . "\n";
+    warn "Retreiveing copy copy counts for record $record_id and method " . $self->api_name . "\n";
 
-	my $method = "open-ils.storage.biblio.record_entry.global_copy_count.atomic";
-	if($self->api_name =~ /staff/) { $method =~ s/atomic/staff\.atomic/; }
+    my $method = "open-ils.storage.biblio.record_entry.global_copy_count.atomic";
+    if($self->api_name =~ /staff/) { $method =~ s/atomic/staff\.atomic/; }
 
-	my $counts = $apputils->simple_scalar_request(
-		"open-ils.storage", $method, $record_id );
+    my $counts = $apputils->simple_scalar_request(
+        "open-ils.storage", $method, $record_id );
 
-	$counts = [ sort {$a->[0] <=> $b->[0]} @$counts ];
-	return $counts;
+    $counts = [ sort {$a->[0] <=> $b->[0]} @$counts ];
+    return $counts;
 }
 
 
@@ -2094,14 +2094,14 @@ __PACKAGE__->register_method(
               . "[ org_id, callnumber_prefix, callnumber_label, callnumber_suffix, <status1_count>, <status2_count>,...] "
               . "where statusx is a copy status name.  The statuses are sorted by ID.",
 );
-		
+        
 
 sub copy_count_summary {
-	my( $self, $client, $rid, $org, $depth ) = @_;
+    my( $self, $client, $rid, $org, $depth ) = @_;
     $org   ||= 1;
     $depth ||= 0;
     my $data = $U->storagereq(
-		'open-ils.storage.biblio.record_entry.status_copy_count.atomic', $rid, $org, $depth );
+        'open-ils.storage.biblio.record_entry.status_copy_count.atomic', $rid, $org, $depth );
 
     return [ sort {
         (($a->[1] ? $a->[1] . ' ' : '') . $a->[2] . ($a->[3] ? ' ' . $a->[3] : ''))
@@ -2123,7 +2123,7 @@ sub copy_location_count_summary {
     $org   ||= 1;
     $depth ||= 0;
     my $data = $U->storagereq(
-		'open-ils.storage.biblio.record_entry.status_copy_location_count.atomic', $rid, $org, $depth );
+        'open-ils.storage.biblio.record_entry.status_copy_location_count.atomic', $rid, $org, $depth );
 
     return [ sort {
         (($a->[1] ? $a->[1] . ' ' : '') . $a->[2] . ($a->[3] ? ' ' . $a->[3] : ''))
@@ -2241,11 +2241,11 @@ Presently, search uses the cache unconditionally.
 # FIXME: that example above isn't actually tested.
 # TODO: docache option?
 sub marc_search {
-	my( $self, $conn, $args, $limit, $offset, $timeout ) = @_;
+    my( $self, $conn, $args, $limit, $offset, $timeout ) = @_;
 
-	my $method = 'open-ils.storage.biblio.full_rec.multi_search';
-	$method .= ".staff" if $self->api_name =~ /staff/;
-	$method .= ".atomic";
+    my $method = 'open-ils.storage.biblio.full_rec.multi_search';
+    $method .= ".staff" if $self->api_name =~ /staff/;
+    $method .= ".atomic";
 
     $limit  ||= 10;     # FIXME: what about $args->{limit} ?
     $offset ||=  0;     # FIXME: what about $args->{offset} ?
@@ -2255,33 +2255,33 @@ sub marc_search {
     # Default to 2 mins.  Arbitrarily cap at 5 mins.
     $timeout = 120 if !$timeout or $timeout > 300;
 
-	my @search;
-	push( @search, ($_ => $$args{$_}) ) for (sort keys %$args);
-	my $ckey = $pfx . md5_hex($method . OpenSRF::Utils::JSON->perl2JSON(\@search));
+    my @search;
+    push( @search, ($_ => $$args{$_}) ) for (sort keys %$args);
+    my $ckey = $pfx . md5_hex($method . OpenSRF::Utils::JSON->perl2JSON(\@search));
 
-	my $recs = search_cache($ckey, $offset, $limit);
+    my $recs = search_cache($ckey, $offset, $limit);
 
-	if(!$recs) {
+    if(!$recs) {
 
         my $ses = OpenSRF::AppSession->create('open-ils.storage');
         my $req = $ses->request($method, %$args);
         my $resp = $req->recv($timeout);
 
         if($resp and $recs = $resp->content) {
-			put_cache($ckey, scalar(@$recs), $recs);
-			$recs = [ @$recs[$offset..($offset + ($limit - 1))] ];
-		} else {
-			$recs = [];
-		}
+            put_cache($ckey, scalar(@$recs), $recs);
+            $recs = [ @$recs[$offset..($offset + ($limit - 1))] ];
+        } else {
+            $recs = [];
+        }
 
         $ses->kill_me;
-	}
+    }
 
-	my $count = 0;
-	$count = $recs->[0]->[2] if $recs->[0] and $recs->[0]->[2];
-	my @recs = map { $_->[0] } @$recs;
+    my $count = 0;
+    $count = $recs->[0]->[2] if $recs->[0] and $recs->[0]->[2];
+    my @recs = map { $_->[0] } @$recs;
 
-	return { ids => \@recs, count => $count };
+    return { ids => \@recs, count => $count };
 }
 
 
@@ -2306,25 +2306,25 @@ __PACKAGE__->register_method(
 }
 
 sub biblio_search_isbn { 
-	my( $self, $client, $isbn ) = @_;
-	$logger->debug("Searching ISBN $isbn");
-	# the previous implementation of this method was essentially unlimited,
-	# so we will set our limit very high and let multiclass.query provide any
-	# actual limit
-	# XXX: if making this unlimited is deemed important, we might consider
-	# reworking 'open-ils.storage.id_list.biblio.record_entry.search.isbn',
-	# which is functionally deprecated at this point, or a custom call to
-	# 'open-ils.storage.biblio.multiclass.search_fts'
+    my( $self, $client, $isbn ) = @_;
+    $logger->debug("Searching ISBN $isbn");
+    # the previous implementation of this method was essentially unlimited,
+    # so we will set our limit very high and let multiclass.query provide any
+    # actual limit
+    # XXX: if making this unlimited is deemed important, we might consider
+    # reworking 'open-ils.storage.id_list.biblio.record_entry.search.isbn',
+    # which is functionally deprecated at this point, or a custom call to
+    # 'open-ils.storage.biblio.multiclass.search_fts'
 
     my $isbn_method = 'open-ils.search.biblio.multiclass.query';
     if ($self->api_name =~ m/.staff$/) {
         $isbn_method .= '.staff';
     }
 
-	my $method = $self->method_lookup($isbn_method);
-	my ($search_result) = $method->run({'limit' => 1000000}, "identifier|isbn:$isbn");
-	my @recs = map { $_->[0] } @{$search_result->{'ids'}};
-	return { ids => \@recs, count => $search_result->{'count'} };
+    my $method = $self->method_lookup($isbn_method);
+    my ($search_result) = $method->run({'limit' => 1000000}, "identifier|isbn:$isbn");
+    my @recs = map { $_->[0] } @{$search_result->{'ids'}};
+    return { ids => \@recs, count => $search_result->{'count'} };
 }
 
 __PACKAGE__->register_method(
@@ -2334,21 +2334,21 @@ __PACKAGE__->register_method(
 
 # XXX: see biblio_search_isbn() for note concerning 'limit'
 sub biblio_search_isbn_batch { 
-	my( $self, $client, $isbn_list ) = @_;
-	$logger->debug("Searching ISBNs @$isbn_list");
-	my @recs = (); my %rec_set = ();
-	my $method = $self->method_lookup('open-ils.search.biblio.multiclass.query');
-	foreach my $isbn ( @$isbn_list ) {
-		my ($search_result) = $method->run({'limit' => 1000000}, "identifier|isbn:$isbn");
-		my @recs_subset = map { $_->[0] } @{$search_result->{'ids'}};
-		foreach my $rec (@recs_subset) {
-			if (! $rec_set{ $rec }) {
-				$rec_set{ $rec } = 1;
-				push @recs, $rec;
-			}
-		}
-	}
-	return { ids => \@recs, count => scalar(@recs) };
+    my( $self, $client, $isbn_list ) = @_;
+    $logger->debug("Searching ISBNs @$isbn_list");
+    my @recs = (); my %rec_set = ();
+    my $method = $self->method_lookup('open-ils.search.biblio.multiclass.query');
+    foreach my $isbn ( @$isbn_list ) {
+        my ($search_result) = $method->run({'limit' => 1000000}, "identifier|isbn:$isbn");
+        my @recs_subset = map { $_->[0] } @{$search_result->{'ids'}};
+        foreach my $rec (@recs_subset) {
+            if (! $rec_set{ $rec }) {
+                $rec_set{ $rec } = 1;
+                push @recs, $rec;
+            }
+        }
+    }
+    return { ids => \@recs, count => scalar(@recs) };
 }
 
 foreach my $issn_method (qw/
@@ -2372,25 +2372,25 @@ __PACKAGE__->register_method(
 }
 
 sub biblio_search_issn { 
-	my( $self, $client, $issn ) = @_;
-	$logger->debug("Searching ISSN $issn");
-	# the previous implementation of this method was essentially unlimited,
-	# so we will set our limit very high and let multiclass.query provide any
-	# actual limit
-	# XXX: if making this unlimited is deemed important, we might consider
-	# reworking 'open-ils.storage.id_list.biblio.record_entry.search.issn',
-	# which is functionally deprecated at this point, or a custom call to
-	# 'open-ils.storage.biblio.multiclass.search_fts'
+    my( $self, $client, $issn ) = @_;
+    $logger->debug("Searching ISSN $issn");
+    # the previous implementation of this method was essentially unlimited,
+    # so we will set our limit very high and let multiclass.query provide any
+    # actual limit
+    # XXX: if making this unlimited is deemed important, we might consider
+    # reworking 'open-ils.storage.id_list.biblio.record_entry.search.issn',
+    # which is functionally deprecated at this point, or a custom call to
+    # 'open-ils.storage.biblio.multiclass.search_fts'
 
     my $issn_method = 'open-ils.search.biblio.multiclass.query';
     if ($self->api_name =~ m/.staff$/) {
         $issn_method .= '.staff';
     }
 
-	my $method = $self->method_lookup($issn_method);
-	my ($search_result) = $method->run({'limit' => 1000000}, "identifier|issn:$issn");
-	my @recs = map { $_->[0] } @{$search_result->{'ids'}};
-	return { ids => \@recs, count => $search_result->{'count'} };
+    my $method = $self->method_lookup($issn_method);
+    my ($search_result) = $method->run({'limit' => 1000000}, "identifier|issn:$issn");
+    my @recs = map { $_->[0] } @{$search_result->{'ids'}};
+    return { ids => \@recs, count => $search_result->{'count'} };
 }
 
 
@@ -2410,11 +2410,11 @@ __PACKAGE__->register_method(
 );
 
 sub fetch_mods_by_copy {
-	my( $self, $client, $copyid ) = @_;
-	my ($record, $evt) = $apputils->fetch_record_by_copy( $copyid );
-	return $evt if $evt;
-	return OpenILS::Event->new('ITEM_NOT_CATALOGED') unless $record->marc;
-	return $apputils->record_to_mvr($record);
+    my( $self, $client, $copyid ) = @_;
+    my ($record, $evt) = $apputils->fetch_record_by_copy( $copyid );
+    return $evt if $evt;
+    return OpenILS::Event->new('ITEM_NOT_CATALOGED') unless $record->marc;
+    return $apputils->record_to_mvr($record);
 }
 
 
@@ -2441,17 +2441,17 @@ __PACKAGE__->register_method(
 
 # RETURNS array of arrays like so: label, owning_lib, record, id
 sub cn_browse {
-	my( $self, $client, @params ) = @_;
-	my $method;
+    my( $self, $client, @params ) = @_;
+    my $method;
 
-	$method = 'open-ils.storage.asset.call_number.browse.target.atomic' 
-		if( $self->api_name =~ /target/ );
-	$method = 'open-ils.storage.asset.call_number.browse.page_up.atomic'
-		if( $self->api_name =~ /page_up/ );
-	$method = 'open-ils.storage.asset.call_number.browse.page_down.atomic'
-		if( $self->api_name =~ /page_down/ );
+    $method = 'open-ils.storage.asset.call_number.browse.target.atomic' 
+        if( $self->api_name =~ /target/ );
+    $method = 'open-ils.storage.asset.call_number.browse.page_up.atomic'
+        if( $self->api_name =~ /page_up/ );
+    $method = 'open-ils.storage.asset.call_number.browse.page_down.atomic'
+        if( $self->api_name =~ /page_down/ );
 
-	return $apputils->simplereq( 'open-ils.storage', $method, @params );
+    return $apputils->simplereq( 'open-ils.storage', $method, @params );
 }
 # -------------------------------------------------------------------------------------
 
@@ -2463,12 +2463,12 @@ __PACKAGE__->register_method(
 );
 
 sub fetch_cn {
-	my( $self, $client, $id ) = @_;
+    my( $self, $client, $id ) = @_;
 
-	my $e = new_editor();
-	my( $cn, $evt ) = $apputils->fetch_callnumber( $id, 0, $e );
-	return $evt if $evt;
-	return $cn;
+    my $e = new_editor();
+    my( $cn, $evt ) = $apputils->fetch_callnumber( $id, 0, $e );
+    return $evt if $evt;
+    return $cn;
 }
 
 __PACKAGE__->register_method(
@@ -2479,12 +2479,12 @@ __PACKAGE__->register_method(
 );
 
 sub fetch_fleshed_cn {
-	my( $self, $client, $id ) = @_;
+    my( $self, $client, $id ) = @_;
 
-	my $e = new_editor();
-	my( $cn, $evt ) = $apputils->fetch_callnumber( $id, 1, $e );
-	return $evt if $evt;
-	return $cn;
+    my $e = new_editor();
+    my( $cn, $evt ) = $apputils->fetch_callnumber( $id, 1, $e );
+    return $evt if $evt;
+    return $cn;
 }
 
 
@@ -2492,36 +2492,36 @@ __PACKAGE__->register_method(
     method    => "fetch_copy_by_cn",
     api_name  => 'open-ils.search.copies_by_call_number.retrieve',
     signature => q/
-		Returns an array of copy ID's by callnumber ID
-		@param cnid The callnumber ID
-		@return An array of copy IDs
-	/
+        Returns an array of copy ID's by callnumber ID
+        @param cnid The callnumber ID
+        @return An array of copy IDs
+    /
 );
 
 sub fetch_copy_by_cn {
-	my( $self, $conn, $cnid ) = @_;
-	return $U->cstorereq(
-		'open-ils.cstore.direct.asset.copy.id_list.atomic', 
-		{ call_number => $cnid, deleted => 'f' } );
+    my( $self, $conn, $cnid ) = @_;
+    return $U->cstorereq(
+        'open-ils.cstore.direct.asset.copy.id_list.atomic', 
+        { call_number => $cnid, deleted => 'f' } );
 }
 
 __PACKAGE__->register_method(
     method    => 'fetch_cn_by_info',
     api_name  => 'open-ils.search.call_number.retrieve_by_info',
     signature => q/
-		@param label The callnumber label
-		@param record The record the cn is attached to
-		@param org The owning library of the cn
-		@return The callnumber object
-	/
+        @param label The callnumber label
+        @param record The record the cn is attached to
+        @param org The owning library of the cn
+        @return The callnumber object
+    /
 );
 
 
 sub fetch_cn_by_info {
-	my( $self, $conn, $label, $record, $org ) = @_;
-	return $U->cstorereq(
-		'open-ils.cstore.direct.asset.call_number.search',
-		{ label => $label, record => $record, owning_lib => $org, deleted => 'f' });
+    my( $self, $conn, $label, $record, $org ) = @_;
+    return $U->cstorereq(
+        'open-ils.cstore.direct.asset.call_number.search',
+        { label => $label, record => $record, owning_lib => $org, deleted => 'f' });
 }
 
 
@@ -2553,10 +2553,10 @@ __PACKAGE__->register_method(
 );
 
 sub bib_extras {
-	my $self = shift;
+    my $self = shift;
     $logger->warn("deprecation warning: " .$self->api_name);
 
-	my $e = new_editor();
+    my $e = new_editor();
 
     my $ctype = $self->{ctype};
     my $ccvms = $e->search_config_coded_value_map({ctype => $ctype});
@@ -2594,7 +2594,7 @@ sub fetch_slim_record {
 
 #my $editor = OpenILS::Utils::Editor->new;
     my $editor = new_editor();
-	my @res;
+    my @res;
     for( @$ids ) {
         return $editor->event unless
             my $r = $editor->retrieve_biblio_record_entry($_);
@@ -2609,11 +2609,11 @@ __PACKAGE__->register_method(
     api_name  => 'open-ils.search.biblio.record_hold_parts',
     signature => q/
        Returns a list of {label :foo, id : bar} objects for viable monograph parts for a given record
-	/
+    /
 );
 
 sub rec_hold_parts {
-	my( $self, $conn, $args ) = @_;
+    my( $self, $conn, $args ) = @_;
 
     my $rec        = $$args{record};
     my $mrec       = $$args{metarecord};
@@ -2657,16 +2657,16 @@ __PACKAGE__->register_method(
     method    => 'rec_to_mr_rec_descriptors',
     api_name  => 'open-ils.search.metabib.record_to_descriptors',
     signature => q/
-		specialized method...
-		Given a biblio record id or a metarecord id, 
-		this returns a list of metabib.record_descriptor
-		objects that live within the same metarecord
-		@param args Object of args including:
-	/
+        specialized method...
+        Given a biblio record id or a metarecord id, 
+        this returns a list of metabib.record_descriptor
+        objects that live within the same metarecord
+        @param args Object of args including:
+    /
 );
 
 sub rec_to_mr_rec_descriptors {
-	my( $self, $conn, $args ) = @_;
+    my( $self, $conn, $args ) = @_;
 
     my $rec        = $$args{record};
     my $mrec       = $$args{metarecord};
@@ -2677,69 +2677,69 @@ sub rec_to_mr_rec_descriptors {
 
     my $hard_boundary = $U->ou_ancestor_setting_value($pickup_lib, OILS_SETTING_HOLD_HARD_BOUNDARY) if (defined $pickup_lib);
 
-	my $e = new_editor();
-	my $recs;
-
-	if( !$mrec ) {
-		my $map = $e->search_metabib_metarecord_source_map({source => $rec});
-		return $e->event unless @$map;
-		$mrec = $$map[0]->metarecord;
-	}
-
-	$recs = $e->search_metabib_metarecord_source_map({metarecord => $mrec});
-	return $e->event unless @$recs;
-
-	my @recs = map { $_->source } @$recs;
-	my $search = { record => \@recs };
-	$search->{item_form} = $item_forms if $item_forms and @$item_forms;
-	$search->{item_type} = $item_types if $item_types and @$item_types;
-	$search->{item_lang} = $item_lang  if $item_lang;
-
-	my $desc = $e->search_metabib_record_descriptor($search);
-
-	my $query = {
-		distinct => 1,
-		select   => { 'bre' => ['id'] },
-		from	 => {
-			'bre' => {
-				'acn' => {
-					'join' => {
-						'acp' => {"join" => {"acpl" => {}, "ccs" => {}}}
-					  }
-				  }
-			 }
-		},
-		where => {
-			'+bre' => { id => \@recs },
-			'+acp' => {
-				holdable => 't',
-				deleted  => 'f'
-			},
-			"+ccs" => { holdable => 't' },
-			"+acpl" => { holdable => 't' }
-		}
-	};
-
-	if ($hard_boundary) { # 0 (or "top") is the same as no setting
-		my $orgs = $e->json_query(
-			{ from => [ 'actor.org_unit_descendants' => $pickup_lib, $hard_boundary ] }
-		) or return $e->die_event;
-
-		$query->{where}->{"+acp"}->{circ_lib} = [ map { $_->{id} } @$orgs ];
-	}
-
-	my $good_records = $e->json_query($query) or return $e->die_event;
-
-	my @keep;
-	for my $d (@$desc) {
-		if ( grep { $d->record == $_->{id} } @$good_records ) {
-			push @keep, $d;
-		}
-	}
-
-	$desc = \@keep;
-
-	return { metarecord => $mrec, descriptors => $desc };
+    my $e = new_editor();
+    my $recs;
+
+    if( !$mrec ) {
+        my $map = $e->search_metabib_metarecord_source_map({source => $rec});
+        return $e->event unless @$map;
+        $mrec = $$map[0]->metarecord;
+    }
+
+    $recs = $e->search_metabib_metarecord_source_map({metarecord => $mrec});
+    return $e->event unless @$recs;
+
+    my @recs = map { $_->source } @$recs;
+    my $search = { record => \@recs };
+    $search->{item_form} = $item_forms if $item_forms and @$item_forms;
+    $search->{item_type} = $item_types if $item_types and @$item_types;
+    $search->{item_lang} = $item_lang  if $item_lang;
+
+    my $desc = $e->search_metabib_record_descriptor($search);
+
+    my $query = {
+        distinct => 1,
+        select   => { 'bre' => ['id'] },
+        from     => {
+            'bre' => {
+                'acn' => {
+                    'join' => {
+                        'acp' => {"join" => {"acpl" => {}, "ccs" => {}}}
+                      }
+                  }
+             }
+        },
+        where => {
+            '+bre' => { id => \@recs },
+            '+acp' => {
+                holdable => 't',
+                deleted  => 'f'
+            },
+            "+ccs" => { holdable => 't' },
+            "+acpl" => { holdable => 't' }
+        }
+    };
+
+    if ($hard_boundary) { # 0 (or "top") is the same as no setting
+        my $orgs = $e->json_query(
+            { from => [ 'actor.org_unit_descendants' => $pickup_lib, $hard_boundary ] }
+        ) or return $e->die_event;
+
+        $query->{where}->{"+acp"}->{circ_lib} = [ map { $_->{id} } @$orgs ];
+    }
+
+    my $good_records = $e->json_query($query) or return $e->die_event;
+
+    my @keep;
+    for my $d (@$desc) {
+        if ( grep { $d->record == $_->{id} } @$good_records ) {
+            push @keep, $d;
+        }
+    }
+
+    $desc = \@keep;
+
+    return { metarecord => $mrec, descriptors => $desc };
 }
 
 
@@ -2749,7 +2749,7 @@ __PACKAGE__->register_method(
 );
 
 sub fetch_age_protect {
-	return new_editor()->retrieve_all_config_rule_age_hold_protect();
+    return new_editor()->retrieve_all_config_rule_age_hold_protect();
 }
 
 
@@ -2764,27 +2764,27 @@ __PACKAGE__->register_method(
 );
 
 sub copies_by_cn_label {
-	my( $self, $conn, $record, $cn_parts, $circ_lib ) = @_;
-	my $e = new_editor();
+    my( $self, $conn, $record, $cn_parts, $circ_lib ) = @_;
+    my $e = new_editor();
     my $cnp_id = $cn_parts->[0] eq '' ? -1 : $e->search_asset_call_number_prefix({label => $cn_parts->[0]}, {idlist=>1})->[0];
     my $cns_id = $cn_parts->[2] eq '' ? -1 : $e->search_asset_call_number_suffix({label => $cn_parts->[2]}, {idlist=>1})->[0];
-	my $cns = $e->search_asset_call_number({record => $record, prefix => $cnp_id, label => $cn_parts->[1], suffix => $cns_id, deleted => 'f'}, {idlist=>1});
-	return [] unless @$cns;
-
-	# show all non-deleted copies in the staff client ...
-	if ($self->api_name =~ /staff$/o) {
-		return $e->search_asset_copy({call_number => $cns, circ_lib => $circ_lib, deleted => 'f'}, {idlist=>1});
-	}
-
-	# ... otherwise, grab the copies ...
-	my $copies = $e->search_asset_copy(
-		[ {call_number => $cns, circ_lib => $circ_lib, deleted => 'f', opac_visible => 't'},
-		  {flesh => 1, flesh_fields => { acp => [ qw/location status/] } }
-		]
-	);
-
-	# ... and test for location and status visibility
-	return [ map { ($U->is_true($_->location->opac_visible) && $U->is_true($_->status->opac_visible)) ? ($_->id) : () } @$copies ];
+    my $cns = $e->search_asset_call_number({record => $record, prefix => $cnp_id, label => $cn_parts->[1], suffix => $cns_id, deleted => 'f'}, {idlist=>1});
+    return [] unless @$cns;
+
+    # show all non-deleted copies in the staff client ...
+    if ($self->api_name =~ /staff$/o) {
+        return $e->search_asset_copy({call_number => $cns, circ_lib => $circ_lib, deleted => 'f'}, {idlist=>1});
+    }
+
+    # ... otherwise, grab the copies ...
+    my $copies = $e->search_asset_copy(
+        [ {call_number => $cns, circ_lib => $circ_lib, deleted => 'f', opac_visible => 't'},
+          {flesh => 1, flesh_fields => { acp => [ qw/location status/] } }
+        ]
+    );
+
+    # ... and test for location and status visibility
+    return [ map { ($U->is_true($_->location->opac_visible) && $U->is_true($_->status->opac_visible)) ? ($_->id) : () } @$copies ];
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/CNBrowse.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/CNBrowse.pm
index 4e4d9c8..e6f77a3 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/CNBrowse.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/CNBrowse.pm
@@ -11,42 +11,42 @@ my $U = "OpenILS::Application::AppUtils";
 
 
 __PACKAGE__->register_method(
-	method	=> "cn_browse_start",
-	api_name	=> "open-ils.search.callnumber.browse.target",
-	notes		=> "Starts a callnumber browse"
-	);
+    method  => "cn_browse_start",
+    api_name    => "open-ils.search.callnumber.browse.target",
+    notes       => "Starts a callnumber browse"
+    );
 
 __PACKAGE__->register_method(
-	method	=> "cn_browse_up",
-	api_name	=> "open-ils.search.callnumber.browse.page_up",
-	notes		=> "Returns the previous page of callnumbers", 
-	);
+    method  => "cn_browse_up",
+    api_name    => "open-ils.search.callnumber.browse.page_up",
+    notes       => "Returns the previous page of callnumbers", 
+    );
 
 __PACKAGE__->register_method(
-	method	=> "cn_browse_down",
-	api_name	=> "open-ils.search.callnumber.browse.page_down",
-	notes		=> "Returns the next page of callnumbers", 
-	);
+    method  => "cn_browse_down",
+    api_name    => "open-ils.search.callnumber.browse.page_down",
+    notes       => "Returns the next page of callnumbers", 
+    );
 
 # XXX Deprecate me
 
 sub cn_browse_start {
-	my( $self, $client, @params ) = @_;
-	my $method;
-	$method = 'open-ils.storage.asset.call_number.browse.target.atomic' 
-		if( $self->api_name =~ /target/ );
-	$method = 'open-ils.storage.asset.call_number.browse.page_up'
-		if( $self->api_name =~ /page_up/ );
-	$method = 'open-ils.storage.asset.call_number.browse.page_down'
-		if( $self->api_name =~ /page_down/ );
-
-	return $U->simplereq( 'open-ils.storage', $method, @params );
+    my( $self, $client, @params ) = @_;
+    my $method;
+    $method = 'open-ils.storage.asset.call_number.browse.target.atomic' 
+        if( $self->api_name =~ /target/ );
+    $method = 'open-ils.storage.asset.call_number.browse.page_up'
+        if( $self->api_name =~ /page_up/ );
+    $method = 'open-ils.storage.asset.call_number.browse.page_down'
+        if( $self->api_name =~ /page_down/ );
+
+    return $U->simplereq( 'open-ils.storage', $method, @params );
 }
 
 
 __PACKAGE__->register_method(
-	method => "cn_browse",
-	api_name => "open-ils.search.callnumber.browse",
+    method => "cn_browse",
+    api_name => "open-ils.search.callnumber.browse",
     signature => {
         desc => q/Paged call number browse/,
         params => [
@@ -77,44 +77,44 @@ __PACKAGE__->register_method(
 );
 
 sub cn_browse {
-	my( $self, $conn, $cn, $orgid, $size, $offset, $copy_statuses, $copy_locations ) = @_;
-	my $ses = OpenSRF::AppSession->create('open-ils.supercat');
+    my( $self, $conn, $cn, $orgid, $size, $offset, $copy_statuses, $copy_locations ) = @_;
+    my $ses = OpenSRF::AppSession->create('open-ils.supercat');
 
-	my $tree = $U->get_org_tree;
-	my $name = _find_shortname($orgid, $tree);
+    my $tree = $U->get_org_tree;
+    my $name = _find_shortname($orgid, $tree);
 
-	$logger->debug("cn browse found or name $name");
+    $logger->debug("cn browse found or name $name");
 
-	my $data = $ses->request(
-		'open-ils.supercat.call_number.browse', 
-		$cn, $name, $size, $offset, $copy_statuses, $copy_locations )->gather(1);
+    my $data = $ses->request(
+        'open-ils.supercat.call_number.browse', 
+        $cn, $name, $size, $offset, $copy_statuses, $copy_locations )->gather(1);
 
-	return [] unless $data;
+    return [] unless $data;
 
-	my @res;
-	for my $d (@$data) {
-		my $mods = $U->record_to_mvr($d->record);
-		$d->owning_lib( $d->owning_lib->id );
-		$d->record($mods->doc_id);
-		push( @res, { cn	=> $d, mods	=> $mods });
-	}
+    my @res;
+    for my $d (@$data) {
+        my $mods = $U->record_to_mvr($d->record);
+        $d->owning_lib( $d->owning_lib->id );
+        $d->record($mods->doc_id);
+        push( @res, { cn    => $d, mods => $mods });
+    }
 
-	return \@res;
+    return \@res;
 }
 
 
 sub _find_shortname {
-	my $id = shift;
-	my $node = shift;
-	return undef unless $node;
-	return $node->shortname if $node->id == $id;
-	if( $node->children ) {
-		for my $c (@{$node->children()}) {
-			my $d = _find_shortname($id, $c);
-			return $d if $d;
-		}
-	}
-	return undef;
+    my $id = shift;
+    my $node = shift;
+    return undef unless $node;
+    return $node->shortname if $node->id == $id;
+    if( $node->children ) {
+        for my $c (@{$node->children()}) {
+            my $d = _find_shortname($id, $c);
+            return $d if $d;
+        }
+    }
+    return undef;
 }
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Serial.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Serial.pm
index d8e010a..933f031 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Serial.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Serial.pm
@@ -40,24 +40,24 @@ Takes an MFHD record ID and returns a hash of holdings statements
 =cut
 
 sub mfhd_to_hash {
-	my ($self, $client, $id) = @_;
-	
-	my $session = OpenSRF::AppSession->create("open-ils.cstore");
-	my $request = $session->request(
-			"open-ils.cstore.direct.serial.record_entry.retrieve", $id )->gather(1);
+    my ($self, $client, $id) = @_;
+    
+    my $session = OpenSRF::AppSession->create("open-ils.cstore");
+    my $request = $session->request(
+            "open-ils.cstore.direct.serial.record_entry.retrieve", $id )->gather(1);
 
-	my $u = OpenILS::Utils::MFHDParser->new();
-	my $mfhd_hash = $u->generate_svr( $request->id, $request->marc, $request->owning_lib );
+    my $u = OpenILS::Utils::MFHDParser->new();
+    my $mfhd_hash = $u->generate_svr( $request->id, $request->marc, $request->owning_lib );
 
-	$session->disconnect();
-	return $mfhd_hash;
+    $session->disconnect();
+    return $mfhd_hash;
 }
 
 __PACKAGE__->register_method(
-	method	=> "mfhd_to_hash",
-	api_name	=> "open-ils.search.serial.record.mfhd.retrieve",
-	argc		=> 1, 
-	note		=> "Given a serial record ID, return MFHD holdings"
+    method  => "mfhd_to_hash",
+    api_name    => "open-ils.search.serial.record.mfhd.retrieve",
+    argc        => 1, 
+    note        => "Given a serial record ID, return MFHD holdings"
 );
 
 =over
@@ -72,46 +72,46 @@ Given a bib record ID, returns a hash of holdings statements
 
 # DEFUNCT ?
 #sub bib_to_mfhd_hash {
-#	my ($self, $client, $bib) = @_;
-#	
-#	my $mfhd_hash;
+#   my ($self, $client, $bib) = @_;
+#   
+#   my $mfhd_hash;
 #
-#	# XXX perhaps this? --miker
-##	my $e = OpenILS::Utils::CStoreEditor->new();
-##	my $mfhd = $e->search_serial_record_entry({ record => $bib });
-##	return $u->generate_svr( $mfhd->[0] ) if (ref $mfhd);
-##	return undef;
+#   # XXX perhaps this? --miker
+##  my $e = OpenILS::Utils::CStoreEditor->new();
+##  my $mfhd = $e->search_serial_record_entry({ record => $bib });
+##  return $u->generate_svr( $mfhd->[0] ) if (ref $mfhd);
+##  return undef;
 #
-#	my @mfhd = $U->cstorereq( "open-ils.cstore.json_query.atomic", {
-#		select  => { sre => 'marc' },
-#		from    => 'sre',
-#		where   => { record => $bib, deleted => 'f' },
-#		distinct => 1
-#	});
-#	
-#	if (!@mfhd or scalar(@mfhd) == 0) {
-#		return undef;
-#	}
+#   my @mfhd = $U->cstorereq( "open-ils.cstore.json_query.atomic", {
+#       select  => { sre => 'marc' },
+#       from    => 'sre',
+#       where   => { record => $bib, deleted => 'f' },
+#       distinct => 1
+#   });
+#   
+#   if (!@mfhd or scalar(@mfhd) == 0) {
+#       return undef;
+#   }
 #
-#	my $u = OpenILS::Utils::MFHDParser->new();
-#	$mfhd_hash = $u->generate_svr( $mfhd[0][0]->{id}, $mfhd[0][0]->{marc}, $mfhd[0][0]->{owning_lib} );
+#   my $u = OpenILS::Utils::MFHDParser->new();
+#   $mfhd_hash = $u->generate_svr( $mfhd[0][0]->{id}, $mfhd[0][0]->{marc}, $mfhd[0][0]->{owning_lib} );
 #
-#	return $mfhd_hash;
+#   return $mfhd_hash;
 #}
 #
 #__PACKAGE__->register_method(
-#	method	=> "bib_to_mfhd_hash",
-#	api_name	=> "open-ils.search.serial.record.bib_to_mfhd.retrieve",
-#	argc		=> 1, 
-#	note		=> "Given a bibliographic record ID, return MFHD holdings"
+#   method  => "bib_to_mfhd_hash",
+#   api_name    => "open-ils.search.serial.record.bib_to_mfhd.retrieve",
+#   argc        => 1, 
+#   note        => "Given a bibliographic record ID, return MFHD holdings"
 #);
 
 sub bib_to_svr {
-	my ($self, $client, $bib, $ou, $ou_depth) = @_;
-	
-	my $svrs = [];
+    my ($self, $client, $bib, $ou, $ou_depth) = @_;
+    
+    my $svrs = [];
 
-	my $e = OpenILS::Utils::CStoreEditor->new();
+    my $e = OpenILS::Utils::CStoreEditor->new();
 
     if (!$ou) {
         # Get the root of the org_tree
@@ -138,7 +138,7 @@ sub bib_to_svr {
             "join" => {"ssub" => {}}
         }
     ]);
-	my $sres = $e->search_serial_record_entry([
+    my $sres = $e->search_serial_record_entry([
         {
             record => $bib,
             deleted => 'f',
@@ -149,12 +149,12 @@ sub bib_to_svr {
             "join" => { "sdist" => { 'type' => 'left' } } 
         }
     ]);
-	if (!ref $sres and !ref $sdists) {
-		return undef;
-	}
+    if (!ref $sres and !ref $sdists) {
+        return undef;
+    }
 
-	my $mfhd_parser = OpenILS::Utils::MFHDParser->new();
-	foreach (@$sdists) {
+    my $mfhd_parser = OpenILS::Utils::MFHDParser->new();
+    foreach (@$sdists) {
         my $svr;
         if ($_->summary_method ne 'use_sdist_only' and ref $_->record_entry and !$U->is_true($_->record_entry->deleted)) {
             my $skip_all_computable = 0;
@@ -208,21 +208,21 @@ sub bib_to_svr {
             }
         }
         push(@$svrs, $svr);
-	}
-	foreach (@$sres) {
-		push(@$svrs, $mfhd_parser->generate_svr($_->id, $_->marc, $_->owning_lib));
-	}
+    }
+    foreach (@$sres) {
+        push(@$svrs, $mfhd_parser->generate_svr($_->id, $_->marc, $_->owning_lib));
+    }
 
     # do a basic location sort for simple predictability
     @$svrs = sort { $a->location cmp $b->location } @$svrs;
 
-	return $svrs;
+    return $svrs;
 }
 
 __PACKAGE__->register_method(
-	method	=> "bib_to_svr",
-	api_name	=> "open-ils.search.serial.record.bib.retrieve",
-	argc		=> 1, 
+    method  => "bib_to_svr",
+    api_name    => "open-ils.search.serial.record.bib.retrieve",
+    argc        => 1, 
     signature => {
         desc   => 'Given a bibliographic record ID, return holdings in svr form',
         params => [
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Zips.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Zips.pm
index 0cccf46..a08a4dc 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Zips.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Zips.pm
@@ -18,54 +18,54 @@ my %zips;
 # -----------------------------------------------------------------
 
 sub initialize {
-	my $conf = OpenSRF::Utils::SettingsClient->new;
-	my $zfile = $conf->config_value(
-		"apps", "open-ils.search", "app_settings", "zips_file");
-	return 1 unless $zfile and -f $zfile;
+    my $conf = OpenSRF::Utils::SettingsClient->new;
+    my $zfile = $conf->config_value(
+        "apps", "open-ils.search", "app_settings", "zips_file");
+    return 1 unless $zfile and -f $zfile;
 
-	$logger->info("search loaded zips file $zfile");
-	open(F,$zfile);
-	my @data = <F>;
-	close(F);
+    $logger->info("search loaded zips file $zfile");
+    open(F,$zfile);
+    my @data = <F>;
+    close(F);
 
-	for(@data) {
-		chomp $_;
-		my @items = split(/\|/, "$_");
-		my $items = {
-			state		=> $items[1],
-			city		=> $items[2],
-			zip		=> $items[3],
-			stateid	=> $items[5],
-			county	=> $items[6],
-			areacode	=> $items[7],
+    for(@data) {
+        chomp $_;
+        my @items = split(/\|/, "$_");
+        my $items = {
+            state       => $items[1],
+            city        => $items[2],
+            zip     => $items[3],
+            stateid => $items[5],
+            county  => $items[6],
+            areacode    => $items[7],
             alert   => $items[8]
-		};
+        };
 
-		next unless $items[4] eq '1';
-		$zips{$$items{zip}} = $items;
-	}
+        next unless $items[4] eq '1';
+        $zips{$$items{zip}} = $items;
+    }
 }
 
 __PACKAGE__->register_method(
-	method => 'search_zip',
-	api_name	=> 'open-ils.search.zip',
-	signature	=> q/
-		Given a zip code, returns address info for the zip code
-		@param auth the login session key
-		@param zip The zip code to check
-		@return On success, returns an object of the form:
-		{ state=>, city=>, zip=>, stateid=>, county=>, areacode=>}
-		returns event on error
-	/
+    method => 'search_zip',
+    api_name    => 'open-ils.search.zip',
+    signature   => q/
+        Given a zip code, returns address info for the zip code
+        @param auth the login session key
+        @param zip The zip code to check
+        @return On success, returns an object of the form:
+        { state=>, city=>, zip=>, stateid=>, county=>, areacode=>}
+        returns event on error
+    /
 );
 sub search_zip {
-	#my( $self, $conn, $auth, $zip ) = @_;
-	#my $e = OpenILS::Utils::Editor->new(authtoken=>$auth);
-	#return $e->event unless $e->checkauth;
-	#return $e->event unless $e->allowed('VIEW_ZIP_DATA');
-	my( $self, $conn, $zip ) = @_;
-	$zip =~ s/(^\d{5}).*/$1/; # we don't care about the last 4 digits if they exist 
-	return $zips{$zip};
+    #my( $self, $conn, $auth, $zip ) = @_;
+    #my $e = OpenILS::Utils::Editor->new(authtoken=>$auth);
+    #return $e->event unless $e->checkauth;
+    #return $e->event unless $e->allowed('VIEW_ZIP_DATA');
+    my( $self, $conn, $zip ) = @_;
+    $zip =~ s/(^\d{5}).*/$1/; # we don't care about the last 4 digits if they exist 
+    return $zips{$zip};
 }
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Serial.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Serial.pm
index 6425257..d79c5c6 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Serial.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Serial.pm
@@ -783,18 +783,18 @@ sub _update_sunit {
 }
 
 __PACKAGE__->register_method(
-	method	=> "retrieve_unit_list",
+    method  => "retrieve_unit_list",
     authoritative => 1,
-	api_name	=> "open-ils.serial.unit_list.retrieve"
+    api_name    => "open-ils.serial.unit_list.retrieve"
 );
 
 sub retrieve_unit_list {
 
-	my( $self, $client, @sdist_ids ) = @_;
+    my( $self, $client, @sdist_ids ) = @_;
 
-	if(ref($sdist_ids[0])) { @sdist_ids = @{$sdist_ids[0]}; }
+    if(ref($sdist_ids[0])) { @sdist_ids = @{$sdist_ids[0]}; }
 
-	my $e = new_editor();
+    my $e = new_editor();
 
     my $query = {
         'select' => 
@@ -2271,89 +2271,89 @@ sub fleshed_serial_subscription_retrieve_batch {
 }
 
 __PACKAGE__->register_method(
-	method	=> "retrieve_sub_tree",
+    method  => "retrieve_sub_tree",
     authoritative => 1,
-	api_name	=> "open-ils.serial.subscription_tree.retrieve"
+    api_name    => "open-ils.serial.subscription_tree.retrieve"
 );
 
 __PACKAGE__->register_method(
-	method	=> "retrieve_sub_tree",
-	api_name	=> "open-ils.serial.subscription_tree.global.retrieve"
+    method  => "retrieve_sub_tree",
+    api_name    => "open-ils.serial.subscription_tree.global.retrieve"
 );
 
 sub retrieve_sub_tree {
 
-	my( $self, $client, $user_session, $docid, @org_ids ) = @_;
+    my( $self, $client, $user_session, $docid, @org_ids ) = @_;
 
-	if(ref($org_ids[0])) { @org_ids = @{$org_ids[0]}; }
+    if(ref($org_ids[0])) { @org_ids = @{$org_ids[0]}; }
 
-	$docid = "$docid";
+    $docid = "$docid";
 
-	# TODO: permission support
-	if(!@org_ids and $user_session) {
-		my $user_obj = 
-			OpenILS::Application::AppUtils->check_user_session( $user_session ); #throws EX on error
-			@org_ids = ($user_obj->home_ou);
-	}
+    # TODO: permission support
+    if(!@org_ids and $user_session) {
+        my $user_obj = 
+            OpenILS::Application::AppUtils->check_user_session( $user_session ); #throws EX on error
+            @org_ids = ($user_obj->home_ou);
+    }
 
-	if( $self->api_name =~ /global/ ) {
-		return _build_subs_list( { record_entry => $docid } ); # TODO: filter for !deleted, or active?
+    if( $self->api_name =~ /global/ ) {
+        return _build_subs_list( { record_entry => $docid } ); # TODO: filter for !deleted, or active?
 
-	} else {
+    } else {
 
-		my @all_subs;
-		for my $orgid (@org_ids) {
-			my $subs = _build_subs_list( 
-					{ record_entry => $docid, owning_lib => $orgid } );# TODO: filter for !deleted, or active?
-			push( @all_subs, @$subs );
-		}
-		
-		return \@all_subs;
-	}
+        my @all_subs;
+        for my $orgid (@org_ids) {
+            my $subs = _build_subs_list( 
+                    { record_entry => $docid, owning_lib => $orgid } );# TODO: filter for !deleted, or active?
+            push( @all_subs, @$subs );
+        }
+        
+        return \@all_subs;
+    }
 
-	return undef;
+    return undef;
 }
 
 sub _build_subs_list {
-	my $search_hash = shift;
+    my $search_hash = shift;
 
-	#$search_hash->{deleted} = 'f';
-	my $e = new_editor();
+    #$search_hash->{deleted} = 'f';
+    my $e = new_editor();
 
-	my $subs = $e->search_serial_subscription([$search_hash, { 'order_by' => {'ssub' => 'id'} }]);
+    my $subs = $e->search_serial_subscription([$search_hash, { 'order_by' => {'ssub' => 'id'} }]);
 
-	my @built_subs;
+    my @built_subs;
 
-	for my $sub (@$subs) {
+    for my $sub (@$subs) {
 
         # TODO: filter on !deleted?
-		my $dists = $e->search_serial_distribution(
+        my $dists = $e->search_serial_distribution(
             [{ subscription => $sub->id }, { 'order_by' => {'sdist' => 'label'} }]
             );
 
-		#$dists = [ sort { $a->label cmp $b->label } @$dists  ];
+        #$dists = [ sort { $a->label cmp $b->label } @$dists  ];
 
-		$sub->distributions($dists);
+        $sub->distributions($dists);
         
         # TODO: filter on !deleted?
-		my $issuances = $e->search_serial_issuance(
-			[{ subscription => $sub->id }, { 'order_by' => {'siss' => 'label'} }]
+        my $issuances = $e->search_serial_issuance(
+            [{ subscription => $sub->id }, { 'order_by' => {'siss' => 'label'} }]
             );
 
-		#$issuances = [ sort { $a->label cmp $b->label } @$issuances  ];
-		$sub->issuances($issuances);
+        #$issuances = [ sort { $a->label cmp $b->label } @$issuances  ];
+        $sub->issuances($issuances);
 
         # TODO: filter on !deleted?
-		my $scaps = $e->search_serial_caption_and_pattern(
-			[{ subscription => $sub->id }, { 'order_by' => {'scap' => 'id'} }]
+        my $scaps = $e->search_serial_caption_and_pattern(
+            [{ subscription => $sub->id }, { 'order_by' => {'scap' => 'id'} }]
             );
 
-		#$scaps = [ sort { $a->id cmp $b->id } @$scaps  ];
-		$sub->scaps($scaps);
-		push( @built_subs, $sub );
-	}
+        #$scaps = [ sort { $a->id cmp $b->id } @$scaps  ];
+        $sub->scaps($scaps);
+        push( @built_subs, $sub );
+    }
 
-	return \@built_subs;
+    return \@built_subs;
 
 }
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage.pm
index b57a718..7401846 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage.pm
@@ -21,180 +21,180 @@ sub DESTROY {};
 
 sub initialize {
 
-	my $conf = OpenSRF::Utils::SettingsClient->new;
+    my $conf = OpenSRF::Utils::SettingsClient->new;
 
-	$log->debug('Initializing ' . __PACKAGE__ . '...', DEBUG);
+    $log->debug('Initializing ' . __PACKAGE__ . '...', DEBUG);
 
-	my $db_driver = $conf->config_value( apps => 'open-ils.storage' => app_settings => databases => 'driver');
-	my $driver = "OpenILS::Application::Storage::Driver::$db_driver";
+    my $db_driver = $conf->config_value( apps => 'open-ils.storage' => app_settings => databases => 'driver');
+    my $driver = "OpenILS::Application::Storage::Driver::$db_driver";
 
-	$log->debug("Attempting to load $driver ...", DEBUG);
+    $log->debug("Attempting to load $driver ...", DEBUG);
 
-	$driver->use;
-	if ($@) {
-		$log->debug( "Can't load $driver!  :  $@", ERROR );
-		$log->error( "Can't load $driver!  :  $@");
-		throw OpenSRF::EX::PANIC ( "Can't load $driver!  :  $@" );
-	}
+    $driver->use;
+    if ($@) {
+        $log->debug( "Can't load $driver!  :  $@", ERROR );
+        $log->error( "Can't load $driver!  :  $@");
+        throw OpenSRF::EX::PANIC ( "Can't load $driver!  :  $@" );
+    }
 
-	$log->debug("$driver loaded successfully", DEBUG);
+    $log->debug("$driver loaded successfully", DEBUG);
 
-	# Suck in the method publishing modules
-	@OpenILS::Application::Storage::CDBI::ISA = ( $driver );
+    # Suck in the method publishing modules
+    @OpenILS::Application::Storage::CDBI::ISA = ( $driver );
 
-	OpenILS::Application::Storage::Publisher->use;
-	if ($@) {
-		$log->debug("FAILURE LOADING Publisher!  $@", ERROR);
-		throw OpenSRF::EX::PANIC ( "FAILURE LOADING Publisher!  :  $@" );
-	}
+    OpenILS::Application::Storage::Publisher->use;
+    if ($@) {
+        $log->debug("FAILURE LOADING Publisher!  $@", ERROR);
+        throw OpenSRF::EX::PANIC ( "FAILURE LOADING Publisher!  :  $@" );
+    }
 
-	$log->debug("We seem to be OK...",DEBUG);
+    $log->debug("We seem to be OK...",DEBUG);
 }
 
 sub child_init {
 
-	$log->debug('Running child_init for ' . __PACKAGE__ . '...', DEBUG);
+    $log->debug('Running child_init for ' . __PACKAGE__ . '...', DEBUG);
 
-	my $conf = OpenSRF::Utils::SettingsClient->new;
+    my $conf = OpenSRF::Utils::SettingsClient->new;
 
-	$log->debug('Calling the Driver child_init', DEBUG);
-	OpenILS::Application::Storage::CDBI->child_init(
-		$conf->config_value( apps => 'open-ils.storage' => app_settings => databases => 'database')
-	);
+    $log->debug('Calling the Driver child_init', DEBUG);
+    OpenILS::Application::Storage::CDBI->child_init(
+        $conf->config_value( apps => 'open-ils.storage' => app_settings => databases => 'database')
+    );
 
-	if (OpenILS::Application::Storage::CDBI->db_Main()) {
-		$log->debug("Success initializing driver!", DEBUG);
+    if (OpenILS::Application::Storage::CDBI->db_Main()) {
+        $log->debug("Success initializing driver!", DEBUG);
 
         my $db_driver = $conf->config_value( apps => 'open-ils.storage' => app_settings => databases => 'driver');
         $QParser = 'OpenILS::Application::Storage::Driver::'.$db_driver.'::QueryParser';
         $QParser->use;
 
         if($@) {
-    		$log->debug( "Can't load $QParser!  :  $@", ERROR );
-    		$log->error( "Can't load $QParser!  :  $@");
+            $log->debug( "Can't load $QParser!  :  $@", ERROR );
+            $log->error( "Can't load $QParser!  :  $@");
         } else {
-		    return 1;
+            return 1;
         }
-	}
+    }
 
-	$log->debug("FAILURE initializing driver!", ERROR);
-	return 0;
+    $log->debug("FAILURE initializing driver!", ERROR);
+    return 0;
 }
 
 sub begin_xaction {
-	my $self = shift;
-	my $client = shift;
-
-	local $WRITE = 1;
-
-	$log->debug(" XACT --> 'BEGIN'ing transaction for session ".$client->session->session_id,DEBUG);
-	try {
-		OpenILS::Application::Storage::CDBI->db_Main->begin_work;
-		$client->session->session_data( xact_id => $client->session->session_id );
-	} catch Error with {
-		throw OpenSRF::DomainObject::oilsException->new(
-			statusCode => 500,
-			status => "Could not BEGIN transaction!",
-		);
-	};
-	return 1;
+    my $self = shift;
+    my $client = shift;
+
+    local $WRITE = 1;
+
+    $log->debug(" XACT --> 'BEGIN'ing transaction for session ".$client->session->session_id,DEBUG);
+    try {
+        OpenILS::Application::Storage::CDBI->db_Main->begin_work;
+        $client->session->session_data( xact_id => $client->session->session_id );
+    } catch Error with {
+        throw OpenSRF::DomainObject::oilsException->new(
+            statusCode => 500,
+            status => "Could not BEGIN transaction!",
+        );
+    };
+    return 1;
 
 }
 __PACKAGE__->register_method(
-	method		=> 'begin_xaction',
-	api_name	=> 'open-ils.storage.transaction.begin',
-	api_level	=> 1,
-	argc		=> 0,
+    method      => 'begin_xaction',
+    api_name    => 'open-ils.storage.transaction.begin',
+    api_level   => 1,
+    argc        => 0,
 );
 
 sub savepoint_placeholder {
-	return 1;
+    return 1;
 }
 __PACKAGE__->register_method(
-	method		=> 'savepoint_placeholder',
-	api_name	=> 'open-ils.storage.savepoint.set',
-	api_level	=> 1,
-	argc		=> 1,
+    method      => 'savepoint_placeholder',
+    api_name    => 'open-ils.storage.savepoint.set',
+    api_level   => 1,
+    argc        => 1,
 );
 __PACKAGE__->register_method(
-	method		=> 'savepoint_placeholder',
-	api_name	=> 'open-ils.storage.savepoint.release',
-	api_level	=> 1,
-	argc		=> 1,
+    method      => 'savepoint_placeholder',
+    api_name    => 'open-ils.storage.savepoint.release',
+    api_level   => 1,
+    argc        => 1,
 );
 __PACKAGE__->register_method(
-	method		=> 'savepoint_placeholder',
-	api_name	=> 'open-ils.storage.savepoint.rollback',
-	api_level	=> 1,
-	argc		=> 1,
+    method      => 'savepoint_placeholder',
+    api_name    => 'open-ils.storage.savepoint.rollback',
+    api_level   => 1,
+    argc        => 1,
 );
 
 sub commit_xaction {
-	my $self = shift;
-	my $client = shift;
-
-	local $WRITE = 1;
-
-	try {
-		OpenILS::Application::Storage::CDBI->db_Main->commit;
-		$client->session->session_data( xact_id => '' );
-	} catch Error with {
-		throw OpenSRF::DomainObject::oilsException->new(
-			statusCode => 500,
-			status => "Could not COMMIT  transaction!",
-		);
-	};
-	return 1;
+    my $self = shift;
+    my $client = shift;
+
+    local $WRITE = 1;
+
+    try {
+        OpenILS::Application::Storage::CDBI->db_Main->commit;
+        $client->session->session_data( xact_id => '' );
+    } catch Error with {
+        throw OpenSRF::DomainObject::oilsException->new(
+            statusCode => 500,
+            status => "Could not COMMIT  transaction!",
+        );
+    };
+    return 1;
 }
 __PACKAGE__->register_method(
-	method		=> 'commit_xaction',
-	api_name	=> 'open-ils.storage.transaction.commit',
-	api_level	=> 1,
-	argc		=> 0,
+    method      => 'commit_xaction',
+    api_name    => 'open-ils.storage.transaction.commit',
+    api_level   => 1,
+    argc        => 0,
 );
 
 
 sub current_xact {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	return $client->session->session_data( 'xact_id' );
+    return $client->session->session_data( 'xact_id' );
 }
 __PACKAGE__->register_method(
-	method		=> 'current_xact',
-	api_name	=> 'open-ils.storage.transaction.current',
-	api_level	=> 1,
-	argc		=> 0,
+    method      => 'current_xact',
+    api_name    => 'open-ils.storage.transaction.current',
+    api_level   => 1,
+    argc        => 0,
 );
 
 sub rollback_xaction {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	local $WRITE = 1;
+    local $WRITE = 1;
 
-	$log->debug(" XACT --> 'ROLLBACK'ing transaction for session ".$client->session->session_id,DEBUG);
-	$client->session->session_data( xact_id => '' );
-	return OpenILS::Application::Storage::CDBI->db_Main->rollback;
+    $log->debug(" XACT --> 'ROLLBACK'ing transaction for session ".$client->session->session_id,DEBUG);
+    $client->session->session_data( xact_id => '' );
+    return OpenILS::Application::Storage::CDBI->db_Main->rollback;
 }
 __PACKAGE__->register_method(
-	method		=> 'rollback_xaction',
-	api_name	=> 'open-ils.storage.transaction.rollback',
-	api_level	=> 1,
-	argc		=> 0,
+    method      => 'rollback_xaction',
+    api_name    => 'open-ils.storage.transaction.rollback',
+    api_level   => 1,
+    argc        => 0,
 );
 
 
 sub _cdbi2Hash {
-	my $self = shift;
-	my $obj = shift;
-	return { map { ( $_ => $obj->$_ ) } ($obj->columns('All')) };
+    my $self = shift;
+    my $obj = shift;
+    return { map { ( $_ => $obj->$_ ) } ($obj->columns('All')) };
 }
 
 sub _cdbi_list2AoH {
-	my $self = shift;
-	my @objs = @_;
-	return [ map { $self->_cdbi2Hash($_) } @objs ];
+    my $self = shift;
+    my @objs = @_;
+    return [ map { $self->_cdbi2Hash($_) } @objs ];
 }
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI.pm
index 56f20aa..c3a0cf0 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI.pm
@@ -1,7 +1,7 @@
 package OpenILS::Application::Storage::CDBI;
 use UNIVERSAL::require; 
 BEGIN {                 
-	'Class::DBI::Frozen::301'->use or 'Class::DBI'->use or die $@;
+    'Class::DBI::Frozen::301'->use or 'Class::DBI'->use or die $@;
 }     
 use base qw/Class::DBI/;
 use Class::DBI::AbstractSearch;
@@ -32,775 +32,775 @@ if ($Class::DBI::VERSION gt '3.0.1') {
 }
 
 sub child_init {
-	my $self = shift;
-
-	$log->debug("Creating ImaDBI Querys", DEBUG);
-	__PACKAGE__->set_sql( 'OILSFastSearch', <<"	SQL", 'Main');
-		SELECT	%s
-		  FROM	%s
-		  WHERE	%s = ?
-	SQL
-
-	__PACKAGE__->set_sql( 'OILSFastOrderedSearchLike', <<"	SQL", 'Main');
-		SELECT	%s
-		  FROM	%s
-		  WHERE	%s LIKE ?
-		  ORDER BY %s
-	SQL
-
-	__PACKAGE__->set_sql( 'OILSFastOrderedSearch', <<"	SQL", 'Main');
-		SELECT	%s
-		  FROM	%s
-		  WHERE	%s = ?
-		  ORDER BY %s
-	SQL
-
-	$log->debug("Calling Driver child_init", DEBUG);
-	$self->SUPER::child_init(@_);
+    my $self = shift;
+
+    $log->debug("Creating ImaDBI Querys", DEBUG);
+    __PACKAGE__->set_sql( 'OILSFastSearch', <<"    SQL", 'Main');
+        SELECT  %s
+          FROM  %s
+          WHERE %s = ?
+    SQL
+
+    __PACKAGE__->set_sql( 'OILSFastOrderedSearchLike', <<"    SQL", 'Main');
+        SELECT  %s
+          FROM  %s
+          WHERE %s LIKE ?
+          ORDER BY %s
+    SQL
+
+    __PACKAGE__->set_sql( 'OILSFastOrderedSearch', <<"    SQL", 'Main');
+        SELECT  %s
+          FROM  %s
+          WHERE %s = ?
+          ORDER BY %s
+    SQL
+
+    $log->debug("Calling Driver child_init", DEBUG);
+    $self->SUPER::child_init(@_);
 
 }
 
 sub fast_flesh_sth {
-	my $class = shift;
-	$class = ref($class) || $class;
-
-	my $field = shift;
-	my $value = shift;
-	my $order = shift;
-	my $like = shift;
-
-
-	if (!(defined($order) and ref($order) and ref($order) eq 'HASH')) {
-		if (defined($value) and ref($value) and ref($value) eq 'HASH') {
-			$order = $value;
-			$value = undef;
-		} else {
-			$order = { order_by => $class->columns('Primary') }
-		}
-	}
-
-	unless (defined $value) {
-		$value = $field;
-		($field) = $class->columns('Primary');
-	}
-
-	unless (defined $field) {
-		($field) = $class->columns('Primary');
-	}
-
-	unless ($order->{order_by}) {
-		$order = { order_by => $class->columns('Primary') }
-	}
-
-	my $fm_class = 'Fieldmapper::'.$class;
-	my $field_list = join ',', $class->columns('Essential');
-	
-	my $sth;
-	if (!$like) {
-		$sth = $class->sql_OILSFastOrderedSearch( $field_list, $class->table, $field, $order->{order_by});
-	} else {
-		$sth = $class->sql_OILSFastOrderedSearchLike( $field_list, $class->table, $field, $order->{order_by});
-	}
-	$sth->execute($value);
-	return $sth;
+    my $class = shift;
+    $class = ref($class) || $class;
+
+    my $field = shift;
+    my $value = shift;
+    my $order = shift;
+    my $like = shift;
+
+
+    if (!(defined($order) and ref($order) and ref($order) eq 'HASH')) {
+        if (defined($value) and ref($value) and ref($value) eq 'HASH') {
+            $order = $value;
+            $value = undef;
+        } else {
+            $order = { order_by => $class->columns('Primary') }
+        }
+    }
+
+    unless (defined $value) {
+        $value = $field;
+        ($field) = $class->columns('Primary');
+    }
+
+    unless (defined $field) {
+        ($field) = $class->columns('Primary');
+    }
+
+    unless ($order->{order_by}) {
+        $order = { order_by => $class->columns('Primary') }
+    }
+
+    my $fm_class = 'Fieldmapper::'.$class;
+    my $field_list = join ',', $class->columns('Essential');
+    
+    my $sth;
+    if (!$like) {
+        $sth = $class->sql_OILSFastOrderedSearch( $field_list, $class->table, $field, $order->{order_by});
+    } else {
+        $sth = $class->sql_OILSFastOrderedSearchLike( $field_list, $class->table, $field, $order->{order_by});
+    }
+    $sth->execute($value);
+    return $sth;
 }
 
 sub fast_flesh {
-	my $self = shift;
-	return map $class->construct($_), $self->fast_flesh_sth(@_)->fetchall_hash;
+    my $self = shift;
+    return map $class->construct($_), $self->fast_flesh_sth(@_)->fetchall_hash;
 }
 
 sub fast_fieldmapper {
-	my $self = shift;
-	my $id = shift;
-	my $col = shift;
-	my $like = shift;
-	my $options = shift;
-	my $class = ref($self) || $self;
-	my $fm_class = 'Fieldmapper::'.$class;
-	my @fms;
-	$log->debug("fast_fieldmapper() ==> Retrieving $fm_class", INTERNAL);
-	if ($like < 2) {
-		for my $hash ($self->fast_flesh_sth( $col, "$id", { order_by => $col }, $like )->fetchall_hash) {
-			my $fm = $fm_class->new;
-			for my $field ( $fm_class->real_fields ) {
-				$fm->$field( $$hash{$field} );
-			}
-			push @fms, $fm;
-		}
-	} else {
-		my $search_type = 'search';
-		if ($like == 2) {
-			$search_type = 'search_fts'
-		} elsif ($like == 3) {
-			$search_type = 'search_regex'
-		}
-
-		for my $obj ($class->$search_type({ $col => $id}, $options)) {
-			push @fms, $obj->to_fieldmapper;
-		}
-	}
-	return @fms;
+    my $self = shift;
+    my $id = shift;
+    my $col = shift;
+    my $like = shift;
+    my $options = shift;
+    my $class = ref($self) || $self;
+    my $fm_class = 'Fieldmapper::'.$class;
+    my @fms;
+    $log->debug("fast_fieldmapper() ==> Retrieving $fm_class", INTERNAL);
+    if ($like < 2) {
+        for my $hash ($self->fast_flesh_sth( $col, "$id", { order_by => $col }, $like )->fetchall_hash) {
+            my $fm = $fm_class->new;
+            for my $field ( $fm_class->real_fields ) {
+                $fm->$field( $$hash{$field} );
+            }
+            push @fms, $fm;
+        }
+    } else {
+        my $search_type = 'search';
+        if ($like == 2) {
+            $search_type = 'search_fts'
+        } elsif ($like == 3) {
+            $search_type = 'search_regex'
+        }
+
+        for my $obj ($class->$search_type({ $col => $id}, $options)) {
+            push @fms, $obj->to_fieldmapper;
+        }
+    }
+    return @fms;
 }
 
 sub retrieve {
-	my $self = shift;
-	my $arg = shift;
-	if (ref($arg) &&
-		(UNIVERSAL::isa($arg => 'Fieldmapper') ||
-		 UNIVERSAL::isa($arg => 'Class::DBI')) ) {
-		my ($col) = $self->primary_column;
-		$log->debug("Using field $col as the primary key", INTERNAL);
-		$arg = $arg->$col;
-	} elsif (ref $arg) {
-		my ($col) = $self->primary_column;
-		$log->debug("Using field $col as the primary key", INTERNAL);
-		$arg = $arg->{$col};
-	}
-		
-	$log->debug("Retrieving $self with $arg", INTERNAL);
-	my $rec;
-	try {
-		$rec = $self->SUPER::retrieve("$arg");
-	} catch Error with {
-		$log->debug("Could not retrieve $self with $arg! -- ".shift(), DEBUG);
-		return undef;
-	};
-	return $rec;
+    my $self = shift;
+    my $arg = shift;
+    if (ref($arg) &&
+        (UNIVERSAL::isa($arg => 'Fieldmapper') ||
+         UNIVERSAL::isa($arg => 'Class::DBI')) ) {
+        my ($col) = $self->primary_column;
+        $log->debug("Using field $col as the primary key", INTERNAL);
+        $arg = $arg->$col;
+    } elsif (ref $arg) {
+        my ($col) = $self->primary_column;
+        $log->debug("Using field $col as the primary key", INTERNAL);
+        $arg = $arg->{$col};
+    }
+        
+    $log->debug("Retrieving $self with $arg", INTERNAL);
+    my $rec;
+    try {
+        $rec = $self->SUPER::retrieve("$arg");
+    } catch Error with {
+        $log->debug("Could not retrieve $self with $arg! -- ".shift(), DEBUG);
+        return undef;
+    };
+    return $rec;
 }
 
 sub to_fieldmapper {
-	my $obj = shift;
-	my $class = ref($obj) || $obj;
+    my $obj = shift;
+    my $class = ref($obj) || $obj;
 
-	my $fm_class = 'Fieldmapper::'.$class;
-	my $fm = $fm_class->new;
+    my $fm_class = 'Fieldmapper::'.$class;
+    my $fm = $fm_class->new;
 
-	if (ref($obj)) {
-		for my $field ( $fm->real_fields ) {
-			$fm->$field( ''.$obj->$field );
-		}
-	}
+    if (ref($obj)) {
+        for my $field ( $fm->real_fields ) {
+            $fm->$field( ''.$obj->$field );
+        }
+    }
 
-	return $fm;
+    return $fm;
 }
 
 sub merge {
-	my $self = shift;
-	my $search = shift;
-	my $arg = shift;
-
-	delete $$arg{$_} for (keys %$search);
-
-	$log->debug("CDBI->merge: \$search is $search (".ref($search)." : ".join(',',map{"$_ => $$search{$_}"}keys(%$search)).")",DEBUG);
-	$log->debug("CDBI->merge: \$arg is $arg (".ref($arg)." : ".join(',',map{"$_ => $$arg{$_}"}keys(%$arg)).")",DEBUG);
-
-	my @objs = ($self);
-	@objs = $self->search_where($search) unless (ref $self);
-
-	if (@objs == 1) {
-		$objs[0]->update($arg);
-		return $objs[0];
-	} elsif (@objs == 0) {
-		return $self->create({%$search,%$arg});
-	} else {
-		throw OpenSRF::EX::WARN ("Non-unique search key for merge.  Perhaps you meant to use remote_update?");
-	}
+    my $self = shift;
+    my $search = shift;
+    my $arg = shift;
+
+    delete $$arg{$_} for (keys %$search);
+
+    $log->debug("CDBI->merge: \$search is $search (".ref($search)." : ".join(',',map{"$_ => $$search{$_}"}keys(%$search)).")",DEBUG);
+    $log->debug("CDBI->merge: \$arg is $arg (".ref($arg)." : ".join(',',map{"$_ => $$arg{$_}"}keys(%$arg)).")",DEBUG);
+
+    my @objs = ($self);
+    @objs = $self->search_where($search) unless (ref $self);
+
+    if (@objs == 1) {
+        $objs[0]->update($arg);
+        return $objs[0];
+    } elsif (@objs == 0) {
+        return $self->create({%$search,%$arg});
+    } else {
+        throw OpenSRF::EX::WARN ("Non-unique search key for merge.  Perhaps you meant to use remote_update?");
+    }
 }
 
 sub remote_update {
-	my $self = shift;
-	my $search = shift;
-	my $arg = shift;
+    my $self = shift;
+    my $search = shift;
+    my $arg = shift;
 
-	delete $$arg{$_} for (keys %$search);
+    delete $$arg{$_} for (keys %$search);
 
-	$log->debug("CDBI->remote_update: \$search is $search (".ref($search)." : ".join(',',map{"$_ => $$search{$_}"}keys(%$search)).")",DEBUG);
-	$log->debug("CDBI->remote_update: \$arg is $arg (".ref($arg)." : ".join(',',map{"$_ => $$arg{$_}"}keys(%$arg)).")",DEBUG);
+    $log->debug("CDBI->remote_update: \$search is $search (".ref($search)." : ".join(',',map{"$_ => $$search{$_}"}keys(%$search)).")",DEBUG);
+    $log->debug("CDBI->remote_update: \$arg is $arg (".ref($arg)." : ".join(',',map{"$_ => $$arg{$_}"}keys(%$arg)).")",DEBUG);
 
-#	my @objs = $self->search_where($search);
-#	throw OpenSRF::EX::WARN ("No objects found for remote_update.  Perhaps you meant to use merge?")
-#		if (@objs == 0);
+#   my @objs = $self->search_where($search);
+#   throw OpenSRF::EX::WARN ("No objects found for remote_update.  Perhaps you meant to use merge?")
+#       if (@objs == 0);
 
-#	$_->update($arg) for (@objs);
-#	return scalar(@objs);
+#   $_->update($arg) for (@objs);
+#   return scalar(@objs);
 
-	my @finds = sort keys %$search;
-	my @sets = sort keys %$arg;
+    my @finds = sort keys %$search;
+    my @sets = sort keys %$arg;
 
-	my @find_vals = @$search{@finds};
-	my @set_vals = @$arg{@sets};
+    my @find_vals = @$search{@finds};
+    my @set_vals = @$arg{@sets};
 
-	my $sql = 'UPDATE %s SET %s WHERE %s';
+    my $sql = 'UPDATE %s SET %s WHERE %s';
 
-	my $table = $self->table;
-	my $set = join(', ', map { "$_=?" } @sets);
-	my $where = join(', ', map { "$_=?" } @finds);
+    my $table = $self->table;
+    my $set = join(', ', map { "$_=?" } @sets);
+    my $where = join(', ', map { "$_=?" } @finds);
 
-	my $sth = $self->db_Main->prepare(sprintf($sql, $table, $set, $where));
-	$sth->execute(@set_vals, at find_vals);
-	return $sth->rows;
+    my $sth = $self->db_Main->prepare(sprintf($sql, $table, $set, $where));
+    $sth->execute(@set_vals, at find_vals);
+    return $sth->rows;
 
 }
 
 sub create {
-	my $self = shift;
-	my $arg = shift;
+    my $self = shift;
+    my $arg = shift;
 
-	$log->debug("CDBI->create: \$arg is $arg (".ref($arg)." : ".OpenSRF::Utils::JSON->perl2JSON($arg).")",DEBUG);
+    $log->debug("CDBI->create: \$arg is $arg (".ref($arg)." : ".OpenSRF::Utils::JSON->perl2JSON($arg).")",DEBUG);
 
-	if (ref($arg) && UNIVERSAL::isa($arg => 'Fieldmapper')) {
-		return $self->create_from_fieldmapper($arg, at _);
-	}
+    if (ref($arg) && UNIVERSAL::isa($arg => 'Fieldmapper')) {
+        return $self->create_from_fieldmapper($arg, at _);
+    }
 
-	return $self->SUPER::create($arg, at _);
+    return $self->SUPER::create($arg, at _);
 }
 
 sub create_from_fieldmapper {
-	my $obj = shift;
-	my $fm = shift;
-	my @params = @_;
-
-	$log->debug("Creating node of type ".ref($fm), DEBUG);
-
-	my $class = ref($obj) || $obj;
-	my ($primary) = $class->columns('Primary');
-
-	if (ref($fm) &&UNIVERSAL::isa($fm => 'Fieldmapper')) {
-		my %hash = map { defined $fm->$_ ?
-					($_ => $fm->$_) :
-					()
-				} grep { $_ ne $primary } $class->columns('Essential');
-
-		if ($class->find_column( 'last_xact_id' )) {
-			if ($OpenILS::Application::Storage::IGNORE_XACT_ID_FAILURE) {
-				$hash{last_xact_id} = 'unknown.'.time.'.'.$$.'.'.rand($$);
-			} else {
-				my $xact_id = $class->current_xact_id;
-				throw Error unless ($xact_id);
-				$hash{last_xact_id} = $xact_id;
-			}
-		}
-
-		return $class->create( \%hash, @params );
-	} else {
-		return undef;
-	}
+    my $obj = shift;
+    my $fm = shift;
+    my @params = @_;
+
+    $log->debug("Creating node of type ".ref($fm), DEBUG);
+
+    my $class = ref($obj) || $obj;
+    my ($primary) = $class->columns('Primary');
+
+    if (ref($fm) &&UNIVERSAL::isa($fm => 'Fieldmapper')) {
+        my %hash = map { defined $fm->$_ ?
+                    ($_ => $fm->$_) :
+                    ()
+                } grep { $_ ne $primary } $class->columns('Essential');
+
+        if ($class->find_column( 'last_xact_id' )) {
+            if ($OpenILS::Application::Storage::IGNORE_XACT_ID_FAILURE) {
+                $hash{last_xact_id} = 'unknown.'.time.'.'.$$.'.'.rand($$);
+            } else {
+                my $xact_id = $class->current_xact_id;
+                throw Error unless ($xact_id);
+                $hash{last_xact_id} = $xact_id;
+            }
+        }
+
+        return $class->create( \%hash, @params );
+    } else {
+        return undef;
+    }
 }
 
 sub delete {
-	my $self = shift;
-	my $arg = shift;
-	my $orig = $self;
-
-	my $class = ref($self) || $self;
-
-	$self = $self->retrieve($arg) if (!ref($self));
-	unless (defined $self) {
-		$log->debug("ARG! Couldn't retrieve record ".$arg->id, DEBUG);
-		throw OpenSRF::EX::WARN ("ARG! Couldn't retrieve record ");
-	}
-
-	if ($class->find_column( 'last_xact_id' )) {
-		my $xact_id = $self->current_xact_id;
-		
-		throw Error ("Deleting from $class requires a transaction be established")
-			unless ($xact_id);
-		
-		throw Error ("The row you are attempting to delete has been changed since you read it")
-			unless ( $orig->last_xact_id eq $self->last_xact_id);
-
-		$self->last_xact_id( $class->current_xact_id );
-		$self->SUPER::update;
-	}
-
-	$self->SUPER::delete;
-
-	return 1;
+    my $self = shift;
+    my $arg = shift;
+    my $orig = $self;
+
+    my $class = ref($self) || $self;
+
+    $self = $self->retrieve($arg) if (!ref($self));
+    unless (defined $self) {
+        $log->debug("ARG! Couldn't retrieve record ".$arg->id, DEBUG);
+        throw OpenSRF::EX::WARN ("ARG! Couldn't retrieve record ");
+    }
+
+    if ($class->find_column( 'last_xact_id' )) {
+        my $xact_id = $self->current_xact_id;
+        
+        throw Error ("Deleting from $class requires a transaction be established")
+            unless ($xact_id);
+        
+        throw Error ("The row you are attempting to delete has been changed since you read it")
+            unless ( $orig->last_xact_id eq $self->last_xact_id);
+
+        $self->last_xact_id( $class->current_xact_id );
+        $self->SUPER::update;
+    }
+
+    $self->SUPER::delete;
+
+    return 1;
 }
 
 sub debug_object {
-	my $obj = shift;
-	my $string = '';
-
-	$string .= "Object type:\t".ref($obj)."\n";
-	$string .= "Object string:\t$obj\n";
-
-	if (ref($obj) && UNIVERSAL::isa($obj => 'Fieldmapper')) {
-		$string .= "Object fields:\n";
-		for my $col ($obj->real_fields()) {
-			$string .= "\t$col\t=> ".$obj->$col."\n";
-		}
-	} elsif (ref($obj) && UNIVERSAL::isa($obj => 'Class::DBI')) {
-		$string .= "Object cols:\n";
-		for my $col ($obj->columns('All')) {
-			$string .= "\t$col\t=> ".$obj->$col."\n";
-		}
-	} elsif (ref($obj) && UNIVERSAL::isa($obj => 'HASH')) {
-		$string .= "Object keys and vals:\n";
-		for my $col (keys %$obj) {
-			$string .= "\t$col\t=> $$obj{$col}\n";
-		}
-	}
-
-	$string .= "\n";
-	
-	$log->debug($string,DEBUG);
+    my $obj = shift;
+    my $string = '';
+
+    $string .= "Object type:\t".ref($obj)."\n";
+    $string .= "Object string:\t$obj\n";
+
+    if (ref($obj) && UNIVERSAL::isa($obj => 'Fieldmapper')) {
+        $string .= "Object fields:\n";
+        for my $col ($obj->real_fields()) {
+            $string .= "\t$col\t=> ".$obj->$col."\n";
+        }
+    } elsif (ref($obj) && UNIVERSAL::isa($obj => 'Class::DBI')) {
+        $string .= "Object cols:\n";
+        for my $col ($obj->columns('All')) {
+            $string .= "\t$col\t=> ".$obj->$col."\n";
+        }
+    } elsif (ref($obj) && UNIVERSAL::isa($obj => 'HASH')) {
+        $string .= "Object keys and vals:\n";
+        for my $col (keys %$obj) {
+            $string .= "\t$col\t=> $$obj{$col}\n";
+        }
+    }
+
+    $string .= "\n";
+    
+    $log->debug($string,DEBUG);
 }
 
 
 sub update {
-	my $self = shift;
-	my $arg = shift;
+    my $self = shift;
+    my $arg = shift;
 
-	$log->debug("Attempting to update using $arg", DEBUG) if ($arg);
+    $log->debug("Attempting to update using $arg", DEBUG) if ($arg);
 
-	if (ref($arg)) {
-		$self = $self->modify_from_fieldmapper($arg);
-		unless (defined $self) {
-			$log->debug("Modification of $arg seems to have failed....", DEBUG);
-			return undef;
-		}
-	}
+    if (ref($arg)) {
+        $self = $self->modify_from_fieldmapper($arg);
+        unless (defined $self) {
+            $log->debug("Modification of $arg seems to have failed....", DEBUG);
+            return undef;
+        }
+    }
 
-	$log->debug("Calling Class::DBI->update on modified object $self", DEBUG);
+    $log->debug("Calling Class::DBI->update on modified object $self", DEBUG);
 
-	#debug_object($self);
+    #debug_object($self);
 
-	return $self->SUPER::update if ($self->is_changed);
-	return 0;
+    return $self->SUPER::update if ($self->is_changed);
+    return 0;
 }
 
 sub modify_from_fieldmapper {
-	my $obj = shift;
-	my $fm = shift;
-	my $orig = $obj;
-
-	#debug_object($obj);
-	#debug_object($fm);
-
-	$log->debug("Modifying object using fieldmapper", DEBUG);
-
-	my $class = ref($obj) || $obj;
-	my ($primary) = $class->columns('Primary');
-
-
-	if (!ref($obj)) {
-		$obj = $class->retrieve($fm);
-		#debug_object($obj);
-		unless ($obj) {
-			$log->debug("Retrieve of $class using $fm (".$fm->id.") failed! -- ".shift(), ERROR);
-			throw OpenSRF::EX::WARN ("No $class with id of ".$fm->id."!!");
-		}
-	}
-
-	my %hash;
-	
-	if (ref($fm) and UNIVERSAL::isa($fm => 'Fieldmapper')) {
-		%hash = map { ($_ => $fm->$_) } grep { $_ ne $primary } $class->columns('Essential');
-		delete $hash{passwd} if ($fm->isa('Fieldmapper::actor::user'));
-	} else {
-		%hash = %{$fm};
-	}
-
-	my $au = $obj->autoupdate;
-	$obj->autoupdate(0);
-	
-	#debug_object($obj);
-
-	for my $field ( keys %hash ) {
-		$obj->$field( $hash{$field} ) if ($obj->$field ne $hash{$field});
-		$log->debug("Setting field $field on $obj to $hash{$field}",INTERNAL);
-	}
-
-	if ($class->find_column( 'last_xact_id' ) and $obj->is_changed) {
-		my ($xact_id) = OpenILS::Application::Storage->method_lookup('open-ils.storage.transaction.current')->run();
-		throw Error ("Updating $class requires a transaction be established")
-			unless ($xact_id);
-		throw Error ("The row you are attempting to delete has been changed since you read it")
-			unless ( $fm->last_xact_id eq $obj->last_xact_id);
-		$obj->last_xact_id( $xact_id );
-	} else {
-		$obj->autoupdate($au)
-	}
-
-	return $obj;
+    my $obj = shift;
+    my $fm = shift;
+    my $orig = $obj;
+
+    #debug_object($obj);
+    #debug_object($fm);
+
+    $log->debug("Modifying object using fieldmapper", DEBUG);
+
+    my $class = ref($obj) || $obj;
+    my ($primary) = $class->columns('Primary');
+
+
+    if (!ref($obj)) {
+        $obj = $class->retrieve($fm);
+        #debug_object($obj);
+        unless ($obj) {
+            $log->debug("Retrieve of $class using $fm (".$fm->id.") failed! -- ".shift(), ERROR);
+            throw OpenSRF::EX::WARN ("No $class with id of ".$fm->id."!!");
+        }
+    }
+
+    my %hash;
+    
+    if (ref($fm) and UNIVERSAL::isa($fm => 'Fieldmapper')) {
+        %hash = map { ($_ => $fm->$_) } grep { $_ ne $primary } $class->columns('Essential');
+        delete $hash{passwd} if ($fm->isa('Fieldmapper::actor::user'));
+    } else {
+        %hash = %{$fm};
+    }
+
+    my $au = $obj->autoupdate;
+    $obj->autoupdate(0);
+    
+    #debug_object($obj);
+
+    for my $field ( keys %hash ) {
+        $obj->$field( $hash{$field} ) if ($obj->$field ne $hash{$field});
+        $log->debug("Setting field $field on $obj to $hash{$field}",INTERNAL);
+    }
+
+    if ($class->find_column( 'last_xact_id' ) and $obj->is_changed) {
+        my ($xact_id) = OpenILS::Application::Storage->method_lookup('open-ils.storage.transaction.current')->run();
+        throw Error ("Updating $class requires a transaction be established")
+            unless ($xact_id);
+        throw Error ("The row you are attempting to delete has been changed since you read it")
+            unless ( $fm->last_xact_id eq $obj->last_xact_id);
+        $obj->last_xact_id( $xact_id );
+    } else {
+        $obj->autoupdate($au)
+    }
+
+    return $obj;
 }
 
 
 
-	#-------------------------------------------------------------------------------
-	actor::user->has_a( home_ou => 'actor::org_unit' );
-	actor::user->has_a( card => 'actor::card' );
-	actor::user->has_a( standing => 'config::standing' );
-	actor::user->has_a( profile => 'permission::grp_tree' );
-	actor::user->has_a( mailing_address => 'actor::user_address' );
-	actor::user->has_a( billing_address => 'actor::user_address' );
-	actor::user->has_a( ident_type => 'config::identification_type' );
-	actor::user->has_a( ident_type2 => 'config::identification_type' );
-	actor::user->has_a( net_access_level => 'config::net_access_level' );
-
-	actor::user_address->has_a( usr => 'actor::user' );
-	
-	actor::card->has_a( usr => 'actor::user' );
-	
-	actor::workstation->has_a( owning_lib => 'actor::org_unit' );
-	actor::org_unit::closed_date->has_a( org_unit => 'actor::org_unit' );
-	actor::org_unit_setting->has_a( org_unit => 'actor::org_unit' );
-
-	actor::usr_note->has_a( usr => 'actor::user' );
-	actor::user->has_many( notes => 'actor::usr_note' );
-
-	actor::user_standing_penalty->has_a( usr => 'actor::user' );
-	actor::user->has_many( standing_penalties => 'actor::user_standing_penalty' );
-
-	actor::org_unit->has_a( parent_ou => 'actor::org_unit' );
-	actor::org_unit->has_a( ou_type => 'actor::org_unit_type' );
-	actor::org_unit->has_a( ill_address => 'actor::org_address' );
-	actor::org_unit->has_a( holds_address => 'actor::org_address' );
-	actor::org_unit->has_a( mailing_address => 'actor::org_address' );
-	actor::org_unit->has_a( billing_address => 'actor::org_address' );
-	actor::org_unit->has_many( children => 'actor::org_unit' => 'parent_ou' );
-	actor::org_unit->has_many( workstations => 'actor::workstation' );
-	actor::org_unit->has_many( closed_dates => 'actor::org_unit::closed_date' );
-	actor::org_unit->has_many( settings => 'actor::org_unit_setting' );
-	#actor::org_unit->might_have( hours_of_operation => 'actor::org_unit::hours_of_operation' );
-
-	actor::org_unit_type->has_a( parent => 'actor::org_unit_type' );
-	actor::org_unit_type->has_many( children => 'actor::org_unit_type' => 'parent' );
-
-	actor::org_address->has_a( org_unit => 'actor::org_unit' );
-	actor::org_unit->has_many( addresses => 'actor::org_address' );
-
-	action::transit_copy->has_a( source => 'actor::org_unit' );
-	action::transit_copy->has_a( dest => 'actor::org_unit' );
-	action::transit_copy->has_a( copy_status => 'config::copy_status' );
-
-	action::hold_transit_copy->has_a( source => 'actor::org_unit' );
-	action::hold_transit_copy->has_a( dest => 'actor::org_unit' );
-	action::hold_transit_copy->has_a( copy_status => 'config::copy_status' );
-	action::hold_transit_copy->has_a( hold => 'action::hold_request' );
-
-	action::hold_request->has_many( transits => 'action::hold_transit_copy' );
-
-	actor::stat_cat_entry->has_a( stat_cat => 'actor::stat_cat' );
-	actor::stat_cat_entry->has_many( default_entries => 'actor::stat_cat_entry_default' );
-	actor::stat_cat_entry_default->has_a( stat_cat => 'actor::stat_cat' );
-	actor::stat_cat_entry_default->has_a( stat_cat_entry => 'actor::stat_cat_entry' );
-	actor::stat_cat->has_a( owner => 'actor::org_unit' );
-	actor::stat_cat->has_many( entries => 'actor::stat_cat_entry' );
-	actor::stat_cat->has_many( default_entries => 'actor::stat_cat_entry_default' );
-	actor::stat_cat_entry_user_map->has_a( stat_cat => 'actor::stat_cat' );
-	actor::stat_cat_entry_user_map->has_a( stat_cat_entry => 'actor::stat_cat_entry' );
-	actor::stat_cat_entry_user_map->has_a( target_usr => 'actor::user' );
-
-	asset::stat_cat_entry->has_a( stat_cat => 'asset::stat_cat' );
-	asset::stat_cat->has_a( owner => 'actor::org_unit' );
-	asset::stat_cat->has_many( entries => 'asset::stat_cat_entry' );
-	asset::stat_cat_entry_copy_map->has_a( stat_cat => 'asset::stat_cat' );
-	asset::stat_cat_entry_copy_map->has_a( stat_cat_entry => 'asset::stat_cat_entry' );
-	asset::stat_cat_entry_copy_map->has_a( owning_copy => 'asset::copy' );
-
-	action::survey_response->has_a( usr => 'actor::user' );
-	action::survey_response->has_a( survey => 'action::survey' );
-	action::survey_response->has_a( question => 'action::survey_question' );
-	action::survey_response->has_a( answer => 'action::survey_answer' );
-
-	action::survey_question->has_a( survey => 'action::survey' );
-
-	action::survey_answer->has_a( question => 'action::survey_question' );
-
-	biblio::peer_bib_copy_map->has_a( target_copy => 'asset::copy' );
-	biblio::peer_bib_copy_map->has_a( peer_record => 'biblio::record_entry' );
-	biblio::peer_bib_copy_map->has_a( peer_type => 'biblio::peer_type' );
-
-	asset::copy_part_map->has_a( target_copy => 'asset::copy' );
-	asset::copy_part_map->has_a( part => 'biblio::monograph_part' );
-
-	biblio::peer_type->has_many( records => 'biblio::record_entry' );
-
-	asset::copy_note->has_a( owning_copy => 'asset::copy' );
-	asset::copy_note->has_a( creator => 'actor::user' );
-
-	actor::user->has_many( stat_cat_entries => [ 'actor::stat_cat_entry_user_map' => 'stat_cat_entry' ] );
-	actor::user->has_many( stat_cat_entry_user_maps => 'actor::stat_cat_entry_user_map' );
-
-	asset::copy->has_many( stat_cat_entries => [ 'asset::stat_cat_entry_copy_map' => 'stat_cat_entry' ] );
-	asset::copy->has_many( stat_cat_entry_copy_maps => 'asset::stat_cat_entry_copy_map' );
-	asset::copy->has_many( peer_bib_copy_maps => 'biblio::peer_bib_copy_map' );
-
-	asset::copy->has_many( part_maps => 'asset::copy_part_map' );
-
-	asset::copy->has_a( call_number => 'asset::call_number' );
-	asset::copy->has_a( creator => 'actor::user' );
-	asset::copy->has_a( editor => 'actor::user' );
-	asset::copy->has_a( status => 'config::copy_status' );
-	asset::copy->has_a( location => 'asset::copy_location' );
-	asset::copy->has_a( circ_lib => 'actor::org_unit' );
-
-	serial::unit->has_a( call_number => 'asset::call_number' );
-	serial::unit->has_a( creator => 'actor::user' );
-	serial::unit->has_a( editor => 'actor::user' );
-	serial::unit->has_a( status => 'config::copy_status' );
-	serial::unit->has_a( location => 'asset::copy_location' );
-	serial::unit->has_a( circ_lib => 'actor::org_unit' );
-
-	serial::item->has_a( unit => 'serial::unit' );
-	serial::item->has_a( issuance => 'serial::issuance' );
-	serial::item->has_a( uri => 'asset::uri' );
-
-	serial::unit->has_many( items => 'serial::item' );
-
-	serial::issuance->has_a( subscription => 'serial::subscription' );
-	serial::issuance->has_many( items => 'serial::item' );
-
-	serial::subscription->has_a( record_entry => 'biblio::record_entry' );
-	serial::subscription->has_many( issuances => 'serial::issuance' );
-
-	asset::call_number_note->has_a( call_number => 'asset::call_number' );
-
-	asset::call_number->has_a( record => 'biblio::record_entry' );
-	asset::call_number->has_a( creator => 'actor::user' );
-	asset::call_number->has_a( editor => 'actor::user' );
-	asset::call_number->has_a( owning_lib => 'actor::org_unit' );
-
-	authority::record_note->has_a( record => 'authority::record_entry' );
-	biblio::record_note->has_a( record => 'biblio::record_entry' );
-	
-	authority::record_entry->has_a( creator => 'actor::user' );
-	authority::record_entry->has_a( editor => 'actor::user' );
-	biblio::record_entry->has_a( creator => 'actor::user' );
-	biblio::record_entry->has_a( editor => 'actor::user' );
-	
-	metabib::metarecord->has_a( master_record => 'biblio::record_entry' );
-	
-	authority::record_descriptor->has_a( record => 'authority::record_entry' );
-	metabib::record_descriptor->has_a( record => 'biblio::record_entry' );
-	
-	authority::full_rec->has_a( record => 'authority::record_entry' );
-	metabib::full_rec->has_a( record => 'biblio::record_entry' );
-	
-	metabib::title_field_entry->has_a( source => 'biblio::record_entry' );
-	metabib::title_field_entry->has_a( field => 'config::metabib_field' );
-
-	metabib::identifier_field_entry->has_a( source => 'biblio::record_entry' );
-	metabib::identifier_field_entry->has_a( field => 'config::metabib_field' );
-	
-	metabib::author_field_entry->has_a( source => 'biblio::record_entry' );
-	metabib::author_field_entry->has_a( field => 'config::metabib_field' );
-	
-	metabib::subject_field_entry->has_a( source => 'biblio::record_entry' );
-	metabib::subject_field_entry->has_a( field => 'config::metabib_field' );
-	
-	metabib::keyword_field_entry->has_a( source => 'biblio::record_entry' );
-	metabib::keyword_field_entry->has_a( field => 'config::metabib_field' );
-	
-	metabib::series_field_entry->has_a( source => 'biblio::record_entry' );
-	metabib::series_field_entry->has_a( field => 'config::metabib_field' );
-	
-	metabib::metarecord_source_map->has_a( metarecord => 'metabib::metarecord' );
-	metabib::metarecord_source_map->has_a( source => 'biblio::record_entry' );
-
-	action::circulation->has_a( usr => 'actor::user' );
-	actor::user->has_many( circulations => 'action::circulation' => 'usr' );
-
-	booking::resource_attr_map->has_a( resource => 'booking::resource' );
-
-	booking::resource->has_a( owner => 'actor::org_unit' );
-	booking::resource->has_a( type => 'booking::resource_type' );
-	booking::resource_type->has_a( owner => 'actor::org_unit' );
-
-	booking::reservation->has_a( usr => 'actor::user' );
-	actor::user->has_many( reservations => 'booking::reservation' => 'usr' );
-	
-	action::circulation->has_a( circ_staff => 'actor::user' );
-	actor::user->has_many( performed_circulations => 'action::circulation' => 'circ_staff' );
-
-	action::circulation->has_a( checkin_staff => 'actor::user' );
-	actor::user->has_many( checkins => 'action::circulation' => 'checkin_staff' );
-
-	action::circulation->has_a( target_copy => 'asset::copy' );
-	asset::copy->has_many( circulations => 'action::circulation' => 'target_copy' );
-	serial::unit->has_many( circulations => 'action::circulation' => 'target_copy' );
-
-	booking::reservation->has_a( pickup_lib => 'actor::org_unit' );
-
-	action::circulation->has_a( circ_lib => 'actor::org_unit' );
-	actor::org_unit->has_many( circulations => 'action::circulation' => 'circ_lib' );
-	
-	action::circulation->has_a( checkin_lib => 'actor::org_unit' );
-	actor::org_unit->has_many( checkins => 'action::circulation' => 'checkin_lib' );
-
-	money::billable_transaction->has_a( usr => 'actor::user' );
-	#money::billable_transaction->might_have( circulation => 'action::circulation' );
-	#money::billable_transaction->might_have( grocery => 'money::grocery' );
-	actor::user->has_many( billable_transactions => 'action::circulation' => 'usr' );
-	
-	
-	#-------------------------------------------------------------------------------
-	actor::user->has_many( survey_responses => 'action::survey_response' );
-	actor::user->has_many( addresses => 'actor::user_address' );
-	actor::user->has_many( cards => 'actor::card' );
-
-	actor::org_unit->has_many( users => 'actor::user' );
-
-	action::survey->has_many( questions => 'action::survey_question' );
-	action::survey->has_many( responses => 'action::survey_response' );
-	
-	action::survey_question->has_many( answers => 'action::survey_answer' );
-	action::survey_question->has_many( responses => 'action::survey_response' );
-
-	action::survey_answer->has_many( responses => 'action::survey_response' );
-
-	asset::copy->has_many( notes => 'asset::copy_note' );
-	asset::call_number->has_many( copies => 'asset::copy' );
-	asset::call_number->has_many( notes => 'asset::call_number_note' );
-
-	asset::call_number->has_a( prefix => 'asset::call_number_prefix' );
-	asset::call_number->has_a( suffix => 'asset::call_number_suffix' );
-
-	asset::call_number_prefix->has_a( owning_lib => 'actor::org_unit' );
-	asset::call_number_suffix->has_a( owning_lib => 'actor::org_unit' );
-
-	asset::call_number_prefix->has_many( call_numbers => 'asset::call_number' );
-	asset::call_number_suffix->has_many( call_numbers => 'asset::call_number' );
-
-	authority::record_entry->has_many( record_descriptor => 'authority::record_descriptor' );
-	authority::record_entry->has_many( notes => 'authority::record_note' );
-
-	biblio::record_entry->has_many( record_descriptor => 'metabib::record_descriptor' );
-	biblio::record_entry->has_many( notes => 'biblio::record_note' );
-	biblio::record_entry->has_many( call_numbers => 'asset::call_number' );
-	biblio::record_entry->has_many( full_record_entries => 'metabib::full_rec' );
-	biblio::record_entry->has_many( title_field_entries => 'metabib::title_field_entry' );
-	biblio::record_entry->has_many( identifier_field_entries => 'metabib::identifier_field_entry' );
-	biblio::record_entry->has_many( author_field_entries => 'metabib::author_field_entry' );
-	biblio::record_entry->has_many( subject_field_entries => 'metabib::subject_field_entry' );
-	biblio::record_entry->has_many( keyword_field_entries => 'metabib::keyword_field_entry' );
-	biblio::record_entry->has_many( series_field_entries => 'metabib::series_field_entry' );
-
-	metabib::metarecord->has_many( source_records => [ 'metabib::metarecord_source_map' => 'source'] );
-	biblio::record_entry->has_many( metarecords => [ 'metabib::metarecord_source_map' => 'metarecord'] );
-
-	money::billing->has_a( xact => 'money::billable_transaction' );
-	money::payment->has_a( xact => 'money::billable_transaction' );
-
-	money::billable_transaction->has_many( billings => 'money::billing' );
-	money::billable_transaction->has_many( payments => 'money::payment' );
-
-	action::circulation->has_many( billings => 'money::billing' => 'xact' );
-	action::circulation->has_many( payments => 'money::payment' => 'xact' );
-	#action::circulation->might_have( billable_transaction => 'money::billable_transaction' );
-	#action::open_circulation->might_have( circulation => 'action::circulation' );
-
-	booking::reservation->has_many( billings => 'money::billing' => 'xact' );
-	booking::reservation->has_many( payments => 'money::payment' => 'xact' );
-
-	action::in_house_use->has_a( org_unit => 'actor::org_unit' );
-	action::in_house_use->has_a( staff => 'actor::user' );
-	action::in_house_use->has_a( item => 'asset::copy' );
-
-	action::non_cataloged_circulation->has_a( circ_lib => 'actor::org_unit' );
-	action::non_cataloged_circulation->has_a( item_type => 'config::non_cataloged_type' );
-	action::non_cataloged_circulation->has_a( patron => 'actor::user' );
-	action::non_cataloged_circulation->has_a( staff => 'actor::user' );
-
-	money::grocery->has_many( billings => 'money::billing' => 'xact' );
-	money::grocery->has_many( payments => 'money::payment' => 'xact' );
-	#money::grocery->might_have( billable_transaction => 'money::billable_transaction' );
-
-	#money::payment->might_have( cash_payment => 'money::cash_payment' );
-	#money::payment->might_have( check_payment => 'money::check_payment' );
-	#money::payment->might_have( credit_card_payment => 'money::credit_card_payment' );
-	#money::payment->might_have( forgive_payment => 'money::forgive_payment' );
-	#money::payment->might_have( work_payment => 'money::work_payment' );
-	#money::payment->might_have( credit_payment => 'money::credit_payment' );
-
-	money::cash_payment->has_a( xact => 'money::billable_transaction' );
-	money::cash_payment->has_a( accepting_usr => 'actor::user' );
-	#money::cash_payment->might_have( payment => 'money::payment' );
-
-	money::check_payment->has_a( xact => 'money::billable_transaction' );
-	money::check_payment->has_a( accepting_usr => 'actor::user' );
-	#money::check_payment->might_have( payment => 'money::payment' );
-
-	money::credit_card_payment->has_a( xact => 'money::billable_transaction' );
-	money::credit_card_payment->has_a( accepting_usr => 'actor::user' );
-	#money::credit_card_payment->might_have( payment => 'money::payment' );
-
-	money::forgive_payment->has_a( xact => 'money::billable_transaction' );
-	money::forgive_payment->has_a( accepting_usr => 'actor::user' );
-	#money::forgive_payment->might_have( payment => 'money::payment' );
-
-	money::work_payment->has_a( xact => 'money::billable_transaction' );
-	money::work_payment->has_a( accepting_usr => 'actor::user' );
-	#money::work_payment->might_have( payment => 'money::payment' );
-
-	money::goods_payment->has_a( xact => 'money::billable_transaction' );
-	money::goods_payment->has_a( accepting_usr => 'actor::user' );
-	#money::goods_payment->might_have( payment => 'money::payment' );
-
-	money::credit_payment->has_a( xact => 'money::billable_transaction' );
-	money::credit_payment->has_a( accepting_usr => 'actor::user' );
-	#money::credit_payment->might_have( payment => 'money::payment' );
-
-	permission::grp_tree->has_a( parent => 'permission::grp_tree' );
-	permission::grp_tree->has_many( children => 'permission::grp_tree' => 'parent' );
-
-	permission::grp_perm_map->has_a( grp => 'permission::grp_tree' );
-	permission::grp_perm_map->has_a(  perm => 'permission::perm_list' );
-	permission::grp_perm_map->has_a(  depth => 'actor::org_unit_type' );
-	
-	permission::usr_perm_map->has_a( usr => 'actor::user' );
-	permission::usr_perm_map->has_a(  perm => 'permission::perm_list' );
-	permission::usr_perm_map->has_a(  depth => 'actor::org_unit_type' );
-	
-	permission::usr_grp_map->has_a(  usr => 'actor::user' );
-	permission::usr_grp_map->has_a(  grp => 'permission::grp_tree' );
-
-	action::hold_notification->has_a(  hold => 'action::hold_request' );
-	
-	action::hold_copy_map->has_a(  hold => 'action::hold_request' );
-	action::hold_copy_map->has_a(  target_copy => 'asset::copy' );
-
-	action::unfulfilled_hold_list->has_a(  current_copy => 'asset::copy' );
-	action::unfulfilled_hold_list->has_a(  hold => 'action::hold_request' );
-	action::unfulfilled_hold_list->has_a(  circ_lib => 'actor::org_unit' );
-
-	action::hold_request->has_a(  current_copy => 'asset::copy' );
-	action::hold_request->has_a(  requestor => 'actor::user' );
-	action::hold_request->has_a(  usr => 'actor::user' );
-	action::hold_request->has_a(  fulfillment_staff => 'actor::user' );
-	action::hold_request->has_a(  pickup_lib => 'actor::org_unit' );
-	action::hold_request->has_a(  request_lib => 'actor::org_unit' );
-	action::hold_request->has_a(  fulfillment_lib => 'actor::org_unit' );
-	action::hold_request->has_a(  selection_ou => 'actor::org_unit' );
-
-	action::hold_request->has_many(  notifications => 'action::hold_notification' );
-	action::hold_request->has_many(  eligible_copies => [ 'action::hold_copy_map' => 'target_copy' ] );
-
-	asset::copy->has_many(  holds => [ 'action::hold_copy_map' => 'hold' ] );
-	serial::unit->has_many(  holds => [ 'action::hold_copy_map' => 'hold' ] );
-
-	container::biblio_record_entry_bucket->has_a( owner => 'actor::user' );
-	container::biblio_record_entry_bucket_item->has_a( bucket => 'container::biblio_record_entry_bucket' );
-	container::biblio_record_entry_bucket_item->has_a( target_biblio_record_entry => 'biblio::record_entry' );
-	container::biblio_record_entry_bucket->has_many( items => 'container::biblio_record_entry_bucket_item' );
-
-	container::user_bucket->has_a( owner => 'actor::user' );
-	container::user_bucket_item->has_a( bucket => 'container::user_bucket' );
-	container::user_bucket_item->has_a( target_user => 'actor::user' );
-	container::user_bucket->has_many( items => 'container::user_bucket_item' );
-
-	container::call_number_bucket->has_a( owner => 'actor::user' );
-	container::call_number_bucket_item->has_a( bucket => 'container::call_number_bucket' );
-	container::call_number_bucket_item->has_a( target_call_number => 'asset::call_number' );
-	container::call_number_bucket->has_many( items => 'container::call_number_bucket_item' );
-
-	container::copy_bucket->has_a( owner => 'actor::user' );
-	container::copy_bucket_item->has_a( bucket => 'container::copy_bucket' );
-	container::copy_bucket_item->has_a( target_copy => 'asset::copy' );
-	container::copy_bucket->has_many( items => 'container::copy_bucket_item' );
+    #-------------------------------------------------------------------------------
+    actor::user->has_a( home_ou => 'actor::org_unit' );
+    actor::user->has_a( card => 'actor::card' );
+    actor::user->has_a( standing => 'config::standing' );
+    actor::user->has_a( profile => 'permission::grp_tree' );
+    actor::user->has_a( mailing_address => 'actor::user_address' );
+    actor::user->has_a( billing_address => 'actor::user_address' );
+    actor::user->has_a( ident_type => 'config::identification_type' );
+    actor::user->has_a( ident_type2 => 'config::identification_type' );
+    actor::user->has_a( net_access_level => 'config::net_access_level' );
+
+    actor::user_address->has_a( usr => 'actor::user' );
+    
+    actor::card->has_a( usr => 'actor::user' );
+    
+    actor::workstation->has_a( owning_lib => 'actor::org_unit' );
+    actor::org_unit::closed_date->has_a( org_unit => 'actor::org_unit' );
+    actor::org_unit_setting->has_a( org_unit => 'actor::org_unit' );
+
+    actor::usr_note->has_a( usr => 'actor::user' );
+    actor::user->has_many( notes => 'actor::usr_note' );
+
+    actor::user_standing_penalty->has_a( usr => 'actor::user' );
+    actor::user->has_many( standing_penalties => 'actor::user_standing_penalty' );
+
+    actor::org_unit->has_a( parent_ou => 'actor::org_unit' );
+    actor::org_unit->has_a( ou_type => 'actor::org_unit_type' );
+    actor::org_unit->has_a( ill_address => 'actor::org_address' );
+    actor::org_unit->has_a( holds_address => 'actor::org_address' );
+    actor::org_unit->has_a( mailing_address => 'actor::org_address' );
+    actor::org_unit->has_a( billing_address => 'actor::org_address' );
+    actor::org_unit->has_many( children => 'actor::org_unit' => 'parent_ou' );
+    actor::org_unit->has_many( workstations => 'actor::workstation' );
+    actor::org_unit->has_many( closed_dates => 'actor::org_unit::closed_date' );
+    actor::org_unit->has_many( settings => 'actor::org_unit_setting' );
+    #actor::org_unit->might_have( hours_of_operation => 'actor::org_unit::hours_of_operation' );
+
+    actor::org_unit_type->has_a( parent => 'actor::org_unit_type' );
+    actor::org_unit_type->has_many( children => 'actor::org_unit_type' => 'parent' );
+
+    actor::org_address->has_a( org_unit => 'actor::org_unit' );
+    actor::org_unit->has_many( addresses => 'actor::org_address' );
+
+    action::transit_copy->has_a( source => 'actor::org_unit' );
+    action::transit_copy->has_a( dest => 'actor::org_unit' );
+    action::transit_copy->has_a( copy_status => 'config::copy_status' );
+
+    action::hold_transit_copy->has_a( source => 'actor::org_unit' );
+    action::hold_transit_copy->has_a( dest => 'actor::org_unit' );
+    action::hold_transit_copy->has_a( copy_status => 'config::copy_status' );
+    action::hold_transit_copy->has_a( hold => 'action::hold_request' );
+
+    action::hold_request->has_many( transits => 'action::hold_transit_copy' );
+
+    actor::stat_cat_entry->has_a( stat_cat => 'actor::stat_cat' );
+    actor::stat_cat_entry->has_many( default_entries => 'actor::stat_cat_entry_default' );
+    actor::stat_cat_entry_default->has_a( stat_cat => 'actor::stat_cat' );
+    actor::stat_cat_entry_default->has_a( stat_cat_entry => 'actor::stat_cat_entry' );
+    actor::stat_cat->has_a( owner => 'actor::org_unit' );
+    actor::stat_cat->has_many( entries => 'actor::stat_cat_entry' );
+    actor::stat_cat->has_many( default_entries => 'actor::stat_cat_entry_default' );
+    actor::stat_cat_entry_user_map->has_a( stat_cat => 'actor::stat_cat' );
+    actor::stat_cat_entry_user_map->has_a( stat_cat_entry => 'actor::stat_cat_entry' );
+    actor::stat_cat_entry_user_map->has_a( target_usr => 'actor::user' );
+
+    asset::stat_cat_entry->has_a( stat_cat => 'asset::stat_cat' );
+    asset::stat_cat->has_a( owner => 'actor::org_unit' );
+    asset::stat_cat->has_many( entries => 'asset::stat_cat_entry' );
+    asset::stat_cat_entry_copy_map->has_a( stat_cat => 'asset::stat_cat' );
+    asset::stat_cat_entry_copy_map->has_a( stat_cat_entry => 'asset::stat_cat_entry' );
+    asset::stat_cat_entry_copy_map->has_a( owning_copy => 'asset::copy' );
+
+    action::survey_response->has_a( usr => 'actor::user' );
+    action::survey_response->has_a( survey => 'action::survey' );
+    action::survey_response->has_a( question => 'action::survey_question' );
+    action::survey_response->has_a( answer => 'action::survey_answer' );
+
+    action::survey_question->has_a( survey => 'action::survey' );
+
+    action::survey_answer->has_a( question => 'action::survey_question' );
+
+    biblio::peer_bib_copy_map->has_a( target_copy => 'asset::copy' );
+    biblio::peer_bib_copy_map->has_a( peer_record => 'biblio::record_entry' );
+    biblio::peer_bib_copy_map->has_a( peer_type => 'biblio::peer_type' );
+
+    asset::copy_part_map->has_a( target_copy => 'asset::copy' );
+    asset::copy_part_map->has_a( part => 'biblio::monograph_part' );
+
+    biblio::peer_type->has_many( records => 'biblio::record_entry' );
+
+    asset::copy_note->has_a( owning_copy => 'asset::copy' );
+    asset::copy_note->has_a( creator => 'actor::user' );
+
+    actor::user->has_many( stat_cat_entries => [ 'actor::stat_cat_entry_user_map' => 'stat_cat_entry' ] );
+    actor::user->has_many( stat_cat_entry_user_maps => 'actor::stat_cat_entry_user_map' );
+
+    asset::copy->has_many( stat_cat_entries => [ 'asset::stat_cat_entry_copy_map' => 'stat_cat_entry' ] );
+    asset::copy->has_many( stat_cat_entry_copy_maps => 'asset::stat_cat_entry_copy_map' );
+    asset::copy->has_many( peer_bib_copy_maps => 'biblio::peer_bib_copy_map' );
+
+    asset::copy->has_many( part_maps => 'asset::copy_part_map' );
+
+    asset::copy->has_a( call_number => 'asset::call_number' );
+    asset::copy->has_a( creator => 'actor::user' );
+    asset::copy->has_a( editor => 'actor::user' );
+    asset::copy->has_a( status => 'config::copy_status' );
+    asset::copy->has_a( location => 'asset::copy_location' );
+    asset::copy->has_a( circ_lib => 'actor::org_unit' );
+
+    serial::unit->has_a( call_number => 'asset::call_number' );
+    serial::unit->has_a( creator => 'actor::user' );
+    serial::unit->has_a( editor => 'actor::user' );
+    serial::unit->has_a( status => 'config::copy_status' );
+    serial::unit->has_a( location => 'asset::copy_location' );
+    serial::unit->has_a( circ_lib => 'actor::org_unit' );
+
+    serial::item->has_a( unit => 'serial::unit' );
+    serial::item->has_a( issuance => 'serial::issuance' );
+    serial::item->has_a( uri => 'asset::uri' );
+
+    serial::unit->has_many( items => 'serial::item' );
+
+    serial::issuance->has_a( subscription => 'serial::subscription' );
+    serial::issuance->has_many( items => 'serial::item' );
+
+    serial::subscription->has_a( record_entry => 'biblio::record_entry' );
+    serial::subscription->has_many( issuances => 'serial::issuance' );
+
+    asset::call_number_note->has_a( call_number => 'asset::call_number' );
+
+    asset::call_number->has_a( record => 'biblio::record_entry' );
+    asset::call_number->has_a( creator => 'actor::user' );
+    asset::call_number->has_a( editor => 'actor::user' );
+    asset::call_number->has_a( owning_lib => 'actor::org_unit' );
+
+    authority::record_note->has_a( record => 'authority::record_entry' );
+    biblio::record_note->has_a( record => 'biblio::record_entry' );
+    
+    authority::record_entry->has_a( creator => 'actor::user' );
+    authority::record_entry->has_a( editor => 'actor::user' );
+    biblio::record_entry->has_a( creator => 'actor::user' );
+    biblio::record_entry->has_a( editor => 'actor::user' );
+    
+    metabib::metarecord->has_a( master_record => 'biblio::record_entry' );
+    
+    authority::record_descriptor->has_a( record => 'authority::record_entry' );
+    metabib::record_descriptor->has_a( record => 'biblio::record_entry' );
+    
+    authority::full_rec->has_a( record => 'authority::record_entry' );
+    metabib::full_rec->has_a( record => 'biblio::record_entry' );
+    
+    metabib::title_field_entry->has_a( source => 'biblio::record_entry' );
+    metabib::title_field_entry->has_a( field => 'config::metabib_field' );
+
+    metabib::identifier_field_entry->has_a( source => 'biblio::record_entry' );
+    metabib::identifier_field_entry->has_a( field => 'config::metabib_field' );
+    
+    metabib::author_field_entry->has_a( source => 'biblio::record_entry' );
+    metabib::author_field_entry->has_a( field => 'config::metabib_field' );
+    
+    metabib::subject_field_entry->has_a( source => 'biblio::record_entry' );
+    metabib::subject_field_entry->has_a( field => 'config::metabib_field' );
+    
+    metabib::keyword_field_entry->has_a( source => 'biblio::record_entry' );
+    metabib::keyword_field_entry->has_a( field => 'config::metabib_field' );
+    
+    metabib::series_field_entry->has_a( source => 'biblio::record_entry' );
+    metabib::series_field_entry->has_a( field => 'config::metabib_field' );
+    
+    metabib::metarecord_source_map->has_a( metarecord => 'metabib::metarecord' );
+    metabib::metarecord_source_map->has_a( source => 'biblio::record_entry' );
+
+    action::circulation->has_a( usr => 'actor::user' );
+    actor::user->has_many( circulations => 'action::circulation' => 'usr' );
+
+    booking::resource_attr_map->has_a( resource => 'booking::resource' );
+
+    booking::resource->has_a( owner => 'actor::org_unit' );
+    booking::resource->has_a( type => 'booking::resource_type' );
+    booking::resource_type->has_a( owner => 'actor::org_unit' );
+
+    booking::reservation->has_a( usr => 'actor::user' );
+    actor::user->has_many( reservations => 'booking::reservation' => 'usr' );
+    
+    action::circulation->has_a( circ_staff => 'actor::user' );
+    actor::user->has_many( performed_circulations => 'action::circulation' => 'circ_staff' );
+
+    action::circulation->has_a( checkin_staff => 'actor::user' );
+    actor::user->has_many( checkins => 'action::circulation' => 'checkin_staff' );
+
+    action::circulation->has_a( target_copy => 'asset::copy' );
+    asset::copy->has_many( circulations => 'action::circulation' => 'target_copy' );
+    serial::unit->has_many( circulations => 'action::circulation' => 'target_copy' );
+
+    booking::reservation->has_a( pickup_lib => 'actor::org_unit' );
+
+    action::circulation->has_a( circ_lib => 'actor::org_unit' );
+    actor::org_unit->has_many( circulations => 'action::circulation' => 'circ_lib' );
+    
+    action::circulation->has_a( checkin_lib => 'actor::org_unit' );
+    actor::org_unit->has_many( checkins => 'action::circulation' => 'checkin_lib' );
+
+    money::billable_transaction->has_a( usr => 'actor::user' );
+    #money::billable_transaction->might_have( circulation => 'action::circulation' );
+    #money::billable_transaction->might_have( grocery => 'money::grocery' );
+    actor::user->has_many( billable_transactions => 'action::circulation' => 'usr' );
+    
+    
+    #-------------------------------------------------------------------------------
+    actor::user->has_many( survey_responses => 'action::survey_response' );
+    actor::user->has_many( addresses => 'actor::user_address' );
+    actor::user->has_many( cards => 'actor::card' );
+
+    actor::org_unit->has_many( users => 'actor::user' );
+
+    action::survey->has_many( questions => 'action::survey_question' );
+    action::survey->has_many( responses => 'action::survey_response' );
+    
+    action::survey_question->has_many( answers => 'action::survey_answer' );
+    action::survey_question->has_many( responses => 'action::survey_response' );
+
+    action::survey_answer->has_many( responses => 'action::survey_response' );
+
+    asset::copy->has_many( notes => 'asset::copy_note' );
+    asset::call_number->has_many( copies => 'asset::copy' );
+    asset::call_number->has_many( notes => 'asset::call_number_note' );
+
+    asset::call_number->has_a( prefix => 'asset::call_number_prefix' );
+    asset::call_number->has_a( suffix => 'asset::call_number_suffix' );
+
+    asset::call_number_prefix->has_a( owning_lib => 'actor::org_unit' );
+    asset::call_number_suffix->has_a( owning_lib => 'actor::org_unit' );
+
+    asset::call_number_prefix->has_many( call_numbers => 'asset::call_number' );
+    asset::call_number_suffix->has_many( call_numbers => 'asset::call_number' );
+
+    authority::record_entry->has_many( record_descriptor => 'authority::record_descriptor' );
+    authority::record_entry->has_many( notes => 'authority::record_note' );
+
+    biblio::record_entry->has_many( record_descriptor => 'metabib::record_descriptor' );
+    biblio::record_entry->has_many( notes => 'biblio::record_note' );
+    biblio::record_entry->has_many( call_numbers => 'asset::call_number' );
+    biblio::record_entry->has_many( full_record_entries => 'metabib::full_rec' );
+    biblio::record_entry->has_many( title_field_entries => 'metabib::title_field_entry' );
+    biblio::record_entry->has_many( identifier_field_entries => 'metabib::identifier_field_entry' );
+    biblio::record_entry->has_many( author_field_entries => 'metabib::author_field_entry' );
+    biblio::record_entry->has_many( subject_field_entries => 'metabib::subject_field_entry' );
+    biblio::record_entry->has_many( keyword_field_entries => 'metabib::keyword_field_entry' );
+    biblio::record_entry->has_many( series_field_entries => 'metabib::series_field_entry' );
+
+    metabib::metarecord->has_many( source_records => [ 'metabib::metarecord_source_map' => 'source'] );
+    biblio::record_entry->has_many( metarecords => [ 'metabib::metarecord_source_map' => 'metarecord'] );
+
+    money::billing->has_a( xact => 'money::billable_transaction' );
+    money::payment->has_a( xact => 'money::billable_transaction' );
+
+    money::billable_transaction->has_many( billings => 'money::billing' );
+    money::billable_transaction->has_many( payments => 'money::payment' );
+
+    action::circulation->has_many( billings => 'money::billing' => 'xact' );
+    action::circulation->has_many( payments => 'money::payment' => 'xact' );
+    #action::circulation->might_have( billable_transaction => 'money::billable_transaction' );
+    #action::open_circulation->might_have( circulation => 'action::circulation' );
+
+    booking::reservation->has_many( billings => 'money::billing' => 'xact' );
+    booking::reservation->has_many( payments => 'money::payment' => 'xact' );
+
+    action::in_house_use->has_a( org_unit => 'actor::org_unit' );
+    action::in_house_use->has_a( staff => 'actor::user' );
+    action::in_house_use->has_a( item => 'asset::copy' );
+
+    action::non_cataloged_circulation->has_a( circ_lib => 'actor::org_unit' );
+    action::non_cataloged_circulation->has_a( item_type => 'config::non_cataloged_type' );
+    action::non_cataloged_circulation->has_a( patron => 'actor::user' );
+    action::non_cataloged_circulation->has_a( staff => 'actor::user' );
+
+    money::grocery->has_many( billings => 'money::billing' => 'xact' );
+    money::grocery->has_many( payments => 'money::payment' => 'xact' );
+    #money::grocery->might_have( billable_transaction => 'money::billable_transaction' );
+
+    #money::payment->might_have( cash_payment => 'money::cash_payment' );
+    #money::payment->might_have( check_payment => 'money::check_payment' );
+    #money::payment->might_have( credit_card_payment => 'money::credit_card_payment' );
+    #money::payment->might_have( forgive_payment => 'money::forgive_payment' );
+    #money::payment->might_have( work_payment => 'money::work_payment' );
+    #money::payment->might_have( credit_payment => 'money::credit_payment' );
+
+    money::cash_payment->has_a( xact => 'money::billable_transaction' );
+    money::cash_payment->has_a( accepting_usr => 'actor::user' );
+    #money::cash_payment->might_have( payment => 'money::payment' );
+
+    money::check_payment->has_a( xact => 'money::billable_transaction' );
+    money::check_payment->has_a( accepting_usr => 'actor::user' );
+    #money::check_payment->might_have( payment => 'money::payment' );
+
+    money::credit_card_payment->has_a( xact => 'money::billable_transaction' );
+    money::credit_card_payment->has_a( accepting_usr => 'actor::user' );
+    #money::credit_card_payment->might_have( payment => 'money::payment' );
+
+    money::forgive_payment->has_a( xact => 'money::billable_transaction' );
+    money::forgive_payment->has_a( accepting_usr => 'actor::user' );
+    #money::forgive_payment->might_have( payment => 'money::payment' );
+
+    money::work_payment->has_a( xact => 'money::billable_transaction' );
+    money::work_payment->has_a( accepting_usr => 'actor::user' );
+    #money::work_payment->might_have( payment => 'money::payment' );
+
+    money::goods_payment->has_a( xact => 'money::billable_transaction' );
+    money::goods_payment->has_a( accepting_usr => 'actor::user' );
+    #money::goods_payment->might_have( payment => 'money::payment' );
+
+    money::credit_payment->has_a( xact => 'money::billable_transaction' );
+    money::credit_payment->has_a( accepting_usr => 'actor::user' );
+    #money::credit_payment->might_have( payment => 'money::payment' );
+
+    permission::grp_tree->has_a( parent => 'permission::grp_tree' );
+    permission::grp_tree->has_many( children => 'permission::grp_tree' => 'parent' );
+
+    permission::grp_perm_map->has_a( grp => 'permission::grp_tree' );
+    permission::grp_perm_map->has_a(  perm => 'permission::perm_list' );
+    permission::grp_perm_map->has_a(  depth => 'actor::org_unit_type' );
+    
+    permission::usr_perm_map->has_a( usr => 'actor::user' );
+    permission::usr_perm_map->has_a(  perm => 'permission::perm_list' );
+    permission::usr_perm_map->has_a(  depth => 'actor::org_unit_type' );
+    
+    permission::usr_grp_map->has_a(  usr => 'actor::user' );
+    permission::usr_grp_map->has_a(  grp => 'permission::grp_tree' );
+
+    action::hold_notification->has_a(  hold => 'action::hold_request' );
+    
+    action::hold_copy_map->has_a(  hold => 'action::hold_request' );
+    action::hold_copy_map->has_a(  target_copy => 'asset::copy' );
+
+    action::unfulfilled_hold_list->has_a(  current_copy => 'asset::copy' );
+    action::unfulfilled_hold_list->has_a(  hold => 'action::hold_request' );
+    action::unfulfilled_hold_list->has_a(  circ_lib => 'actor::org_unit' );
+
+    action::hold_request->has_a(  current_copy => 'asset::copy' );
+    action::hold_request->has_a(  requestor => 'actor::user' );
+    action::hold_request->has_a(  usr => 'actor::user' );
+    action::hold_request->has_a(  fulfillment_staff => 'actor::user' );
+    action::hold_request->has_a(  pickup_lib => 'actor::org_unit' );
+    action::hold_request->has_a(  request_lib => 'actor::org_unit' );
+    action::hold_request->has_a(  fulfillment_lib => 'actor::org_unit' );
+    action::hold_request->has_a(  selection_ou => 'actor::org_unit' );
+
+    action::hold_request->has_many(  notifications => 'action::hold_notification' );
+    action::hold_request->has_many(  eligible_copies => [ 'action::hold_copy_map' => 'target_copy' ] );
+
+    asset::copy->has_many(  holds => [ 'action::hold_copy_map' => 'hold' ] );
+    serial::unit->has_many(  holds => [ 'action::hold_copy_map' => 'hold' ] );
+
+    container::biblio_record_entry_bucket->has_a( owner => 'actor::user' );
+    container::biblio_record_entry_bucket_item->has_a( bucket => 'container::biblio_record_entry_bucket' );
+    container::biblio_record_entry_bucket_item->has_a( target_biblio_record_entry => 'biblio::record_entry' );
+    container::biblio_record_entry_bucket->has_many( items => 'container::biblio_record_entry_bucket_item' );
+
+    container::user_bucket->has_a( owner => 'actor::user' );
+    container::user_bucket_item->has_a( bucket => 'container::user_bucket' );
+    container::user_bucket_item->has_a( target_user => 'actor::user' );
+    container::user_bucket->has_many( items => 'container::user_bucket_item' );
+
+    container::call_number_bucket->has_a( owner => 'actor::user' );
+    container::call_number_bucket_item->has_a( bucket => 'container::call_number_bucket' );
+    container::call_number_bucket_item->has_a( target_call_number => 'asset::call_number' );
+    container::call_number_bucket->has_many( items => 'container::call_number_bucket_item' );
+
+    container::copy_bucket->has_a( owner => 'actor::user' );
+    container::copy_bucket_item->has_a( bucket => 'container::copy_bucket' );
+    container::copy_bucket_item->has_a( target_copy => 'asset::copy' );
+    container::copy_bucket->has_many( items => 'container::copy_bucket_item' );
 
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/action.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/action.pm
index c793710..e46b0fb 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/action.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/action.pm
@@ -32,7 +32,7 @@ use base qw/action/;
 __PACKAGE__->table('action_survey');
 __PACKAGE__->columns(Primary => 'id');
 __PACKAGE__->columns(Essential => qw/name description owner start_date
-				     end_date usr_summary opac poll required/);
+                     end_date usr_summary opac poll required/);
 #-------------------------------------------------------------------------------
 
 package action::survey_question;
@@ -55,7 +55,7 @@ use base qw/action/;
 __PACKAGE__->table('action_survey_response');
 __PACKAGE__->columns(Primary => 'id');
 __PACKAGE__->columns(Essential => qw/response_group_id usr survey question
-				     answer answer_date effective_date/);
+                     answer answer_date effective_date/);
 #-------------------------------------------------------------------------------
 
 package action::circulation;
@@ -63,13 +63,13 @@ use base qw/action/;
 __PACKAGE__->table('action_circulation');
 __PACKAGE__->columns(Primary => 'id');
 __PACKAGE__->columns(Essential => qw/xact_start usr target_copy circ_lib
-				     duration duration_rule renewal_remaining grace_period
-				     recurring_fine_rule recurring_fine stop_fines
-				     max_fine max_fine_rule fine_interval
-				     stop_fines xact_finish due_date opac_renewal
-				     checkin_staff circ_staff circ_lib checkin_lib
-				     stop_fines_time checkin_time desk_renewal
-				     phone_renewal create_time copy_location/);
+                     duration duration_rule renewal_remaining grace_period
+                     recurring_fine_rule recurring_fine stop_fines
+                     max_fine max_fine_rule fine_interval
+                     stop_fines xact_finish due_date opac_renewal
+                     checkin_staff circ_staff circ_lib checkin_lib
+                     stop_fines_time checkin_time desk_renewal
+                     phone_renewal create_time copy_location/);
 
 #-------------------------------------------------------------------------------
 
@@ -78,13 +78,13 @@ use base qw/action/;
 __PACKAGE__->table('action_open_circulation');
 __PACKAGE__->columns(Primary => 'id');
 __PACKAGE__->columns(Essential => qw/xact_start usr target_copy circ_lib
-				     duration duration_rule renewal_remaining grace_period
-				     recurring_fine_rule recurring_fine stop_fines
-				     max_fine max_fine_rule fine_interval
-				     stop_fines xact_finish due_date opac_renewal
-				     checkin_staff circ_staff circ_lib checkin_lib
-				     stop_fines_time checkin_time desk_renewal
-				     phone_renewal/);
+                     duration duration_rule renewal_remaining grace_period
+                     recurring_fine_rule recurring_fine stop_fines
+                     max_fine max_fine_rule fine_interval
+                     stop_fines xact_finish due_date opac_renewal
+                     checkin_staff circ_staff circ_lib checkin_lib
+                     stop_fines_time checkin_time desk_renewal
+                     phone_renewal/);
 
 #-------------------------------------------------------------------------------
 
@@ -93,12 +93,12 @@ use base qw/action/;
 __PACKAGE__->table('action_hold_request');
 __PACKAGE__->columns(Primary => 'id');
 __PACKAGE__->columns(Essential => qw/request_time capture_time fulfillment_time
-				     prev_check_time expire_time requestor usr cancel_cause
-				     hold_type holdable_formats target cancel_time shelf_time
-				     phone_notify email_notify sms_notify sms_carrier selection_depth cancel_note
-				     pickup_lib current_copy request_lib frozen thaw_date mint_condition
-				     fulfillment_staff fulfillment_lib selection_ou cut_in_line
-					 shelf_expire_time current_shelf_lib/);
+                     prev_check_time expire_time requestor usr cancel_cause
+                     hold_type holdable_formats target cancel_time shelf_time
+                     phone_notify email_notify sms_notify sms_carrier selection_depth cancel_note
+                     pickup_lib current_copy request_lib frozen thaw_date mint_condition
+                     fulfillment_staff fulfillment_lib selection_ou cut_in_line
+                     shelf_expire_time current_shelf_lib/);
 
 #-------------------------------------------------------------------------------
 
@@ -123,8 +123,8 @@ use base qw/action/;
 __PACKAGE__->table('action_hold_transit_copy');
 __PACKAGE__->columns(Primary => 'id');
 __PACKAGE__->columns(Essential => qw/source dest persistant_transfer target_copy
-				     source_send_time dest_recv_time prev_hop prev_dest
-				     copy_status hold/);
+                     source_send_time dest_recv_time prev_hop prev_dest
+                     copy_status hold/);
 
 #-------------------------------------------------------------------------------
 
@@ -133,8 +133,8 @@ use base qw/action/;
 __PACKAGE__->table('action_reservation_transit_copy');
 __PACKAGE__->columns(Primary => 'id');
 __PACKAGE__->columns(Essential => qw/source dest persistant_transfer target_copy
-				     source_send_time dest_recv_time prev_hop prev_dest
-				     copy_status reservation/);
+                     source_send_time dest_recv_time prev_hop prev_dest
+                     copy_status reservation/);
 
 #-------------------------------------------------------------------------------
 
@@ -143,8 +143,8 @@ use base qw/action/;
 __PACKAGE__->table('action_transit_copy');
 __PACKAGE__->columns(Primary => 'id');
 __PACKAGE__->columns(Essential => qw/source dest persistant_transfer target_copy
-				     source_send_time dest_recv_time prev_hop prev_dest
-				     copy_status/);
+                     source_send_time dest_recv_time prev_hop prev_dest
+                     copy_status/);
 
 #-------------------------------------------------------------------------------
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/actor.pm
index 57146c6..4572dcc 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/actor.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/actor.pm
@@ -11,15 +11,15 @@ use base qw/actor/;
 __PACKAGE__->table( 'actor_usr' );
 __PACKAGE__->columns( Primary => qw/id/ );
 __PACKAGE__->columns( Essential => qw/usrname email first_given_name
-				second_given_name family_name billing_address
-				claims_returned_count home_ou dob deleted juvenile
-				active master_account ident_type ident_value
-				ident_type2 ident_value2 net_access_level alias
-				photo_url create_date expire_date credit_forward_balance
-				super_user usrgroup passwd card last_xact_id
-				standing barred profile prefix suffix alert_message
-				day_phone evening_phone other_phone mailing_address
-				claims_never_checked_out_count last_update_time/ );
+                second_given_name family_name billing_address
+                claims_returned_count home_ou dob deleted juvenile
+                active master_account ident_type ident_value
+                ident_type2 ident_value2 net_access_level alias
+                photo_url create_date expire_date credit_forward_balance
+                super_user usrgroup passwd card last_xact_id
+                standing barred profile prefix suffix alert_message
+                day_phone evening_phone other_phone mailing_address
+                claims_never_checked_out_count last_update_time/ );
 
 #-------------------------------------------------------------------------------
 package actor::usr_org_unit_opt_in;
@@ -82,7 +82,7 @@ use base qw/actor/;
 __PACKAGE__->table( 'actor_org_unit' );
 __PACKAGE__->columns( Primary => qw/id/);
 __PACKAGE__->columns( Essential => qw/parent_ou ou_type mailing_address billing_address
-				ill_address holds_address shortname name email phone opac_visible fiscal_calendar/);
+                ill_address holds_address shortname name email phone opac_visible fiscal_calendar/);
 
 #-------------------------------------------------------------------------------
 package actor::org_unit::hours_of_operation;
@@ -91,8 +91,8 @@ use base qw/actor/;
 __PACKAGE__->table( 'actor_hours_of_operation' );
 __PACKAGE__->columns( Primary => qw/id/);
 __PACKAGE__->columns( Essential => qw/dow_0_open dow_0_close dow_1_open dow_1_close dow_2_open dow_2_close
-					dow_3_open dow_3_close dow_4_open dow_4_close dow_5_open dow_5_close
-					dow_6_open dow_6_close/);
+                    dow_3_open dow_3_close dow_4_open dow_4_close dow_5_open dow_5_close
+                    dow_6_open dow_6_close/);
 
 #-------------------------------------------------------------------------------
 package actor::org_unit::closed_date;
@@ -174,8 +174,8 @@ use base qw/actor/;
 __PACKAGE__->table( 'actor_usr_address' );
 __PACKAGE__->columns( Primary => qw/id/ );
 __PACKAGE__->columns( Essential => qw/valid address_type usr street1 street2
-				      city county state country post_code
-				      within_city_limits/ );
+                      city county state country post_code
+                      within_city_limits/ );
 
 #-------------------------------------------------------------------------------
 package actor::org_address;
@@ -184,7 +184,7 @@ use base qw/actor/;
 __PACKAGE__->table( 'actor_org_address' );
 __PACKAGE__->columns( Primary => qw/id/ );
 __PACKAGE__->columns( Essential => qw/valid address_type org_unit street1 street2
-				      city county state country post_code/ );
+                      city county state country post_code/ );
 
 #-------------------------------------------------------------------------------
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/asset.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/asset.pm
index 2c84f62..30109db 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/asset.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/asset.pm
@@ -51,7 +51,7 @@ use base qw/asset/;
 __PACKAGE__->table( 'asset_call_number' );
 __PACKAGE__->columns( Primary => qw/id/ );
 __PACKAGE__->columns( Essential => qw/record label creator create_date editor prefix suffix
-				   edit_date record label owning_lib deleted label_class label_sortkey/ );
+                   edit_date record label owning_lib deleted label_class label_sortkey/ );
 
 #-------------------------------------------------------------------------------
 package asset::call_number_note;
@@ -68,11 +68,11 @@ use base qw/asset/;
 __PACKAGE__->table( 'asset_copy' );
 __PACKAGE__->columns( Primary => qw/id/ );
 __PACKAGE__->columns( Essential => qw/call_number barcode creator create_date editor
-				   edit_date copy_number status loan_duration circ_lib dummy_isbn
-				   fine_level circulate deposit price ref opac_visible
-				   circ_as_type circ_modifier deposit_amount location mint_condition
-				   holdable dummy_title dummy_author deleted alert_message
-				   age_protect floating cost status_changed_time active_date/ );
+                   edit_date copy_number status loan_duration circ_lib dummy_isbn
+                   fine_level circulate deposit price ref opac_visible
+                   circ_as_type circ_modifier deposit_amount location mint_condition
+                   holdable dummy_title dummy_author deleted alert_message
+                   age_protect floating cost status_changed_time active_date/ );
 
 #-------------------------------------------------------------------------------
 package asset::copy_part_map;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/authority.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/authority.pm
index 64a0350..90aac6b 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/authority.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/authority.pm
@@ -11,8 +11,8 @@ use base qw/authority/;
 authority::record_entry->table( 'authority_record_entry' );
 authority::record_entry->columns( Primary => qw/id/ );
 authority::record_entry->columns( Essential => qw/creator editor
-				      create_date edit_date source active
-				      deleted marc last_xact_id/ );
+                      create_date edit_date source active
+                      deleted marc last_xact_id/ );
 
 #-------------------------------------------------------------------------------
 package authority::record_note;
@@ -21,7 +21,7 @@ use base qw/authority/;
 authority::record_note->table( 'authority_record_note' );
 authority::record_note->columns( Primary => qw/id/ );
 authority::record_note->columns( Essential => qw/record value creator
-					editor create_date edit_date/ );
+                    editor create_date edit_date/ );
 #-------------------------------------------------------------------------------
 package authority::full_rec;
 use base qw/authority/;
@@ -38,7 +38,7 @@ use base qw/authority/;
 authority::record_descriptor->table( 'authority_rec_descriptor' );
 authority::record_descriptor->columns( Primary => qw/id/ );
 authority::record_descriptor->columns( Essential => qw/record record_status
-						    char_encoding/ );
+                            char_encoding/ );
 
 #-------------------------------------------------------------------------------
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/biblio.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/biblio.pm
index 24e484c..732dd9a 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/biblio.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/biblio.pm
@@ -10,8 +10,8 @@ use base qw/biblio/;
 
 biblio::record_entry->table( 'biblio_record_entry' );
 biblio::record_entry->columns( Essential => qw/id tcn_source tcn_value creator editor
-				      create_date edit_date source active quality owner share_depth
-				      deleted marc last_xact_id fingerprint/ );
+                      create_date edit_date source active quality owner share_depth
+                      deleted marc last_xact_id fingerprint/ );
 
 #-------------------------------------------------------------------------------
 package biblio::record_note;
@@ -19,7 +19,7 @@ use base qw/biblio/;
 
 biblio::record_note->table( 'biblio_record_note' );
 biblio::record_note->columns( Essential => qw/id record value creator
-					editor create_date edit_date pub/ );
+                    editor create_date edit_date pub/ );
 #-------------------------------------------------------------------------------
 
 #-------------------------------------------------------------------------------
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/booking.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/booking.pm
index e2b60fa..6a05075 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/booking.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/booking.pm
@@ -29,8 +29,8 @@ use base qw/booking/;
 __PACKAGE__->table('booking_reservation');
 __PACKAGE__->columns(Primary => 'id');
 __PACKAGE__->columns(Essential => qw/xact_start usr current_resource
-				     fine_amount max_fine fine_interval xact_finish 
-				     capture_staff pickup_lib request_time start_time end_time
+                     fine_amount max_fine fine_interval xact_finish 
+                     capture_staff pickup_lib request_time start_time end_time
                      capture_time cancel_time pickup_time return_time
                      booking_interval target_resource_type target_resource
                      current_resource request_lib/);
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/metabib.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/metabib.pm
index 1316e93..989390c 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/metabib.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/metabib.pm
@@ -88,8 +88,8 @@ use base qw/metabib/;
 metabib::record_descriptor->table( 'metabib_rec_descriptor' );
 metabib::record_descriptor->columns( Primary => qw/id/ );
 metabib::record_descriptor->columns( Essential => qw/record item_type item_form bib_level
-					 control_type char_encoding enc_level lit_form vr_format
-					 cat_form pub_status item_lang audience type_mat date1 date2/ );
+                     control_type char_encoding enc_level lit_form vr_format
+                     cat_form pub_status item_lang audience type_mat date1 date2/ );
 
 #-------------------------------------------------------------------------------
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/money.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/money.pm
index ab21f84..ddf366e 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/money.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/money.pm
@@ -60,9 +60,9 @@ use base qw/money/;
 __PACKAGE__->table('money_open_billable_transaction_summary');
 __PACKAGE__->columns(Primary => 'id');
 __PACKAGE__->columns(Essential => qw/xact_start usr xact_finish total_paid
-				     last_payment_ts total_owed last_billing_ts
-				     balance_owed xact_type last_billing_note last_billing_type
-				     last_payment_note last_payment_type/);
+                     last_payment_ts total_owed last_billing_ts
+                     balance_owed xact_type last_billing_note last_billing_type
+                     last_payment_note last_payment_type/);
 #-------------------------------------------------------------------------------
 
 package money::billable_transaction_summary;
@@ -70,9 +70,9 @@ use base qw/money/;
 __PACKAGE__->table('money_billable_transaction_summary');
 __PACKAGE__->columns(Primary => 'id');
 __PACKAGE__->columns(Essential => qw/xact_start usr xact_finish total_paid
-				     last_payment_ts total_owed last_billing_ts
-				     balance_owed xact_type last_billing_note last_billing_type
-				     last_payment_note last_payment_type/);
+                     last_payment_ts total_owed last_billing_ts
+                     balance_owed xact_type last_billing_note last_billing_type
+                     last_payment_note last_payment_type/);
 #-------------------------------------------------------------------------------
 
 package money::billing;
@@ -116,9 +116,9 @@ use base qw/money/;
 __PACKAGE__->table('money_credit_card_payment');
 __PACKAGE__->columns(Primary => 'id');
 __PACKAGE__->columns(Essential => qw/xact amount payment_ts cash_drawer
-				     accepting_usr amount_collected cc_type
-				     cc_number expire_month expire_year
-				     approval_code note/);
+                     accepting_usr amount_collected cc_type
+                     cc_number expire_month expire_year
+                     approval_code note/);
 #-------------------------------------------------------------------------------
 
 package money::forgive_payment;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/permission.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/permission.pm
index f56e1e5..7c7cab6 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/permission.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/permission.pm
@@ -16,7 +16,7 @@ use base qw/permission/;
 __PACKAGE__->table('permission_grp_tree');
 __PACKAGE__->columns(Primary => qw/id/);
 __PACKAGE__->columns(Essential => qw/name parent description perm_interval
-				     application_perm usergroup hold_priority/);
+                     application_perm usergroup hold_priority/);
 #-------------------------------------------------------------------------------
 package permission::usr_grp_map;
 use base qw/permission/;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/serial.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/serial.pm
index 0264aa6..19dee60 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/serial.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/CDBI/serial.pm
@@ -11,7 +11,7 @@ use base qw/serial/;
 __PACKAGE__->table( 'serial_subscription' );
 __PACKAGE__->columns( Primary => qw/id/ );
 __PACKAGE__->columns( Essential => qw/record_entry start_date end_date
-				   expected_date_offset owning_lib/ );
+                   expected_date_offset owning_lib/ );
 
 #-------------------------------------------------------------------------------
 package serial::issuance;
@@ -41,11 +41,11 @@ use base qw/serial/;
 __PACKAGE__->table( 'serial_unit' );
 __PACKAGE__->columns( Primary => qw/id/ );
 __PACKAGE__->columns( Essential => qw/call_number barcode creator create_date editor
-				   edit_date copy_number status loan_duration circ_lib
-				   fine_level circulate deposit price ref opac_visible dummy_isbn
-				   circ_as_type circ_modifier deposit_amount location mint_condition
-				   holdable dummy_title dummy_author deleted alert_message
-				   age_protect floating summary_contents detailed_contents active_date/ );
+                   edit_date copy_number status loan_duration circ_lib
+                   fine_level circulate deposit price ref opac_visible dummy_isbn
+                   circ_as_type circ_modifier deposit_amount location mint_condition
+                   holdable dummy_title dummy_author deleted alert_message
+                   age_protect floating summary_contents detailed_contents active_date/ );
 
 #-------------------------------------------------------------------------------
 package serial::record_entry;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg.pm
index 95d9db4..a3e360b 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg.pm
@@ -9,212 +9,212 @@
   # The dirver MUST be a subclass of Class::DBI(::Replication) and
   # OpenILS::Application::Storage.
   #-------------------------------------------------------------------------------
-	package OpenILS::Application::Storage::Driver::Pg;
-	use OpenILS::Application::Storage::Driver::Pg::cdbi;
-	use OpenILS::Application::Storage::Driver::Pg::fts;
-	use OpenILS::Application::Storage::Driver::Pg::storage;
-	use OpenILS::Application::Storage::Driver::Pg::dbi;
-	use UNIVERSAL::require; 
-	BEGIN {                 
-		'Class::DBI::Frozen::301'->use or 'Class::DBI'->use or die $@;
-	}     
-	use base qw/Class::DBI OpenILS::Application::Storage/;
-	use DBI;
-	use OpenSRF::EX qw/:try/;
-	use OpenSRF::DomainObject::oilsResponse;
-	use OpenSRF::Utils::Logger qw/:level/;
-	my $log = 'OpenSRF::Utils::Logger';
-
-	__PACKAGE__->set_sql( retrieve_limited => 'SELECT * FROM __TABLE__ ORDER BY id LIMIT ?' );
-	__PACKAGE__->set_sql( copy_start => 'COPY %s (%s) FROM STDIN;' );
-	__PACKAGE__->set_sql( copy_end => '\.' );
-
-	my $master_db;
-	my @slave_dbs;
-	my $_db_params;
-
-	sub db_Handles {
-		return ($master_db, @slave_dbs);
-	}
-
-	sub child_init {
-		my $self = shift;
-		$_db_params = shift;
-
-		$log->debug("Running child_init inside ".__PACKAGE__, INTERNAL);
-
-		$_db_params = [ $_db_params ] unless (ref($_db_params) eq 'ARRAY');
-
-		my %attrs = (	%{$self->_default_attributes},
-				RootClass => 'DBIx::ContextualFetch',
-				ShowErrorStatement => 1,
-				RaiseError => 1,
-				AutoCommit => 1,
-				PrintError => 1,
-				Taint => 1,
-				#TraceLevel => "1|SQL",
-				pg_enable_utf8 => 1,
-				pg_server_prepare => 0,
-				FetchHashKeyName => 'NAME_lc',
-				ChopBlanks => 1,
-		);
-
-		my $master = shift @$_db_params;
-		$$master{port} ||= '5432';
-		$$master{host} ||= 'localhost';
-		$$master{db} ||= 'openils';
-
-		$log->debug("Attempting to connect to $$master{db} at $$master{host}", INFO);
-
-		try {
-			$master_db = DBI->connect(
-				"dbi:Pg:".
-					"host=$$master{host};".
-					"port=$$master{port};".
-					"dbname=$$master{db}",
-				$$master{user},
-				$$master{pw},
-				\%attrs)
-			|| do { sleep(1);
-				DBI->connect(
-					"dbi:Pg:".
-						"host=$$master{host};".
-						"port=$$master{port};".
-						"dbname=$$master{db}",
-					$$master{user},
-					$$master{pw},
-					\%attrs) }
-			|| throw OpenSRF::EX::ERROR
-				("Couldn't connect to $$master{db}".
-				 " on $$master{host}::$$master{port}".
-				 " as $$master{user}!!");
-		} catch Error with {
-			my $e = shift;
-			$log->debug("Error connecting to database:\n\t$e\n\t$DBI::errstr", ERROR);
-			throw $e;
-		};
-
-		$log->debug("Connected to MASTER db $$master{db} at $$master{host}", INFO);
-		
-		$master_db->do("SET NAMES '$$master{client_encoding}';") if ($$master{client_encoding});
-
-		for my $db (@$_db_params) {
-			try {
-				push @slave_dbs, DBI->connect("dbi:Pg:host=$$db{host};port=$$db{port};dbname=$$db{db}",$$db{user},$$db{pw}, \%attrs)
-					|| do { sleep(1); DBI->connect("dbi:Pg:host=$$db{host};port=$$db{port};dbname=$$db{db}",$$db{user},$$db{pw}, \%attrs) }
-					|| throw OpenSRF::EX::ERROR
-						("Couldn't connect to $$db{db}".
-				 		" on $$db{host}::$$db{port}".
-				 		" as $$db{user}!!");
-			} catch Error with {
-				my $e = shift;
-				$log->debug("Error connecting to database:\n\t$e\n\t$DBI::errstr", ERROR);
-				throw $e;
-			};
-
-			$slave_dbs[-1]->do("SET NAMES '$$db{client_encoding}';") if ($$master{client_encoding});
-
-			$log->debug("Connected to MASTER db '$$master{db} at $$master{host}", INFO);
-		}
-
-		$log->debug("All is well on the western front", INTERNAL);
-	}
-
-	sub db_Main {
-		my $self = shift;
-		return $master_db if ($self->current_xact_session || $OpenILS::Application::Storage::WRITE);
-		return $master_db unless (@slave_dbs);
-		return ($master_db, @slave_dbs)[rand(scalar(@slave_dbs))];
-	}
-
-	sub quote {
-		my $self = shift;
-		return $self->db_Main->quote(@_)
-	}
-
-#	sub tsearch2_trigger {
-#		my $self = shift;
-#		return unless ($self->value);
-#		$self->index_vector(
-#			$self->db_Slaves->selectrow_array(
-#				"SELECT to_tsvector('default',?);",
-#				{},
-#				$self->value
-#			)
-#		);
-#	}
-
-	my $_xact_session;
-	my $_audit_session;
-
-	sub current_xact_session {
-		my $self = shift;
-		if (defined($_xact_session)) {
-			return $_xact_session;
-		}
-		return undef;
-	}
-
-	sub current_audit_session {
-		my $self = shift;
-		if (defined($_audit_session)) {
-			return $_audit_session;
-		}
-		return undef;
-	}
-
-	sub current_xact_is_auto {
-		my $self = shift;
-		my $auto = shift;
-		if (defined($_xact_session) and ref($_xact_session)) {
-			if (defined $auto) {
-				$_xact_session->session_data(autocommit => $auto);
-			}
-			return $_xact_session->session_data('autocommit'); 
-		}
-	}
-
-	sub current_xact_id {
-		my $self = shift;
-		if (defined($_xact_session) and ref($_xact_session)) {
-			return $_xact_session->session_id;
-		}
-		return undef;
-	}
-
-	sub set_xact_session {
-		my $self = shift;
-		my $ses = shift;
-		if (!defined($ses)) {
-			return undef;
-		}
-		$_xact_session = $ses;
-		return $_xact_session;
-	}
-
-	sub set_audit_session {
-		my $self = shift;
-		my $ses = shift;
-		if (!defined($ses)) {
-			return undef;
-		}
-		$_audit_session = $ses;
-		return $_audit_session;
-	}
-
-	sub unset_xact_session {
-		my $self = shift;
-		my $ses = $_xact_session;
-		undef $_xact_session;
-		return $ses;
-	}
-
-	sub unset_audit_session {
-		my $self = shift;
-		my $ses = $_audit_session;
-		undef $_audit_session;
-		return $ses;
-	}
+    package OpenILS::Application::Storage::Driver::Pg;
+    use OpenILS::Application::Storage::Driver::Pg::cdbi;
+    use OpenILS::Application::Storage::Driver::Pg::fts;
+    use OpenILS::Application::Storage::Driver::Pg::storage;
+    use OpenILS::Application::Storage::Driver::Pg::dbi;
+    use UNIVERSAL::require; 
+    BEGIN {                 
+        'Class::DBI::Frozen::301'->use or 'Class::DBI'->use or die $@;
+    }     
+    use base qw/Class::DBI OpenILS::Application::Storage/;
+    use DBI;
+    use OpenSRF::EX qw/:try/;
+    use OpenSRF::DomainObject::oilsResponse;
+    use OpenSRF::Utils::Logger qw/:level/;
+    my $log = 'OpenSRF::Utils::Logger';
+
+    __PACKAGE__->set_sql( retrieve_limited => 'SELECT * FROM __TABLE__ ORDER BY id LIMIT ?' );
+    __PACKAGE__->set_sql( copy_start => 'COPY %s (%s) FROM STDIN;' );
+    __PACKAGE__->set_sql( copy_end => '\.' );
+
+    my $master_db;
+    my @slave_dbs;
+    my $_db_params;
+
+    sub db_Handles {
+        return ($master_db, @slave_dbs);
+    }
+
+    sub child_init {
+        my $self = shift;
+        $_db_params = shift;
+
+        $log->debug("Running child_init inside ".__PACKAGE__, INTERNAL);
+
+        $_db_params = [ $_db_params ] unless (ref($_db_params) eq 'ARRAY');
+
+        my %attrs = (   %{$self->_default_attributes},
+                RootClass => 'DBIx::ContextualFetch',
+                ShowErrorStatement => 1,
+                RaiseError => 1,
+                AutoCommit => 1,
+                PrintError => 1,
+                Taint => 1,
+                #TraceLevel => "1|SQL",
+                pg_enable_utf8 => 1,
+                pg_server_prepare => 0,
+                FetchHashKeyName => 'NAME_lc',
+                ChopBlanks => 1,
+        );
+
+        my $master = shift @$_db_params;
+        $$master{port} ||= '5432';
+        $$master{host} ||= 'localhost';
+        $$master{db} ||= 'openils';
+
+        $log->debug("Attempting to connect to $$master{db} at $$master{host}", INFO);
+
+        try {
+            $master_db = DBI->connect(
+                "dbi:Pg:".
+                    "host=$$master{host};".
+                    "port=$$master{port};".
+                    "dbname=$$master{db}",
+                $$master{user},
+                $$master{pw},
+                \%attrs)
+            || do { sleep(1);
+                DBI->connect(
+                    "dbi:Pg:".
+                        "host=$$master{host};".
+                        "port=$$master{port};".
+                        "dbname=$$master{db}",
+                    $$master{user},
+                    $$master{pw},
+                    \%attrs) }
+            || throw OpenSRF::EX::ERROR
+                ("Couldn't connect to $$master{db}".
+                 " on $$master{host}::$$master{port}".
+                 " as $$master{user}!!");
+        } catch Error with {
+            my $e = shift;
+            $log->debug("Error connecting to database:\n\t$e\n\t$DBI::errstr", ERROR);
+            throw $e;
+        };
+
+        $log->debug("Connected to MASTER db $$master{db} at $$master{host}", INFO);
+        
+        $master_db->do("SET NAMES '$$master{client_encoding}';") if ($$master{client_encoding});
+
+        for my $db (@$_db_params) {
+            try {
+                push @slave_dbs, DBI->connect("dbi:Pg:host=$$db{host};port=$$db{port};dbname=$$db{db}",$$db{user},$$db{pw}, \%attrs)
+                    || do { sleep(1); DBI->connect("dbi:Pg:host=$$db{host};port=$$db{port};dbname=$$db{db}",$$db{user},$$db{pw}, \%attrs) }
+                    || throw OpenSRF::EX::ERROR
+                        ("Couldn't connect to $$db{db}".
+                        " on $$db{host}::$$db{port}".
+                        " as $$db{user}!!");
+            } catch Error with {
+                my $e = shift;
+                $log->debug("Error connecting to database:\n\t$e\n\t$DBI::errstr", ERROR);
+                throw $e;
+            };
+
+            $slave_dbs[-1]->do("SET NAMES '$$db{client_encoding}';") if ($$master{client_encoding});
+
+            $log->debug("Connected to MASTER db '$$master{db} at $$master{host}", INFO);
+        }
+
+        $log->debug("All is well on the western front", INTERNAL);
+    }
+
+    sub db_Main {
+        my $self = shift;
+        return $master_db if ($self->current_xact_session || $OpenILS::Application::Storage::WRITE);
+        return $master_db unless (@slave_dbs);
+        return ($master_db, @slave_dbs)[rand(scalar(@slave_dbs))];
+    }
+
+    sub quote {
+        my $self = shift;
+        return $self->db_Main->quote(@_)
+    }
+
+#   sub tsearch2_trigger {
+#       my $self = shift;
+#       return unless ($self->value);
+#       $self->index_vector(
+#           $self->db_Slaves->selectrow_array(
+#               "SELECT to_tsvector('default',?);",
+#               {},
+#               $self->value
+#           )
+#       );
+#   }
+
+    my $_xact_session;
+    my $_audit_session;
+
+    sub current_xact_session {
+        my $self = shift;
+        if (defined($_xact_session)) {
+            return $_xact_session;
+        }
+        return undef;
+    }
+
+    sub current_audit_session {
+        my $self = shift;
+        if (defined($_audit_session)) {
+            return $_audit_session;
+        }
+        return undef;
+    }
+
+    sub current_xact_is_auto {
+        my $self = shift;
+        my $auto = shift;
+        if (defined($_xact_session) and ref($_xact_session)) {
+            if (defined $auto) {
+                $_xact_session->session_data(autocommit => $auto);
+            }
+            return $_xact_session->session_data('autocommit'); 
+        }
+    }
+
+    sub current_xact_id {
+        my $self = shift;
+        if (defined($_xact_session) and ref($_xact_session)) {
+            return $_xact_session->session_id;
+        }
+        return undef;
+    }
+
+    sub set_xact_session {
+        my $self = shift;
+        my $ses = shift;
+        if (!defined($ses)) {
+            return undef;
+        }
+        $_xact_session = $ses;
+        return $_xact_session;
+    }
+
+    sub set_audit_session {
+        my $self = shift;
+        my $ses = shift;
+        if (!defined($ses)) {
+            return undef;
+        }
+        $_audit_session = $ses;
+        return $_audit_session;
+    }
+
+    sub unset_xact_session {
+        my $self = shift;
+        my $ses = $_xact_session;
+        undef $_xact_session;
+        return $ses;
+    }
+
+    sub unset_audit_session {
+        my $self = shift;
+        my $ses = $_audit_session;
+        undef $_audit_session;
+        return $ses;
+    }
 
 }
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/cdbi.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/cdbi.pm
index 20d88c5..55b65bd 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/cdbi.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/cdbi.pm
@@ -1,36 +1,36 @@
 { # Based on the change to Class::DBI in OpenILS::Application::Storage.  This will
   # allow us to use TSearch2 via a simple cdbi "search" interface.
-	#-------------------------------------------------------------------------------
-	use UNIVERSAL::require; 
-	BEGIN {                 
-		'Class::DBI::Frozen::301'->use or 'Class::DBI'->use or die $@;
-	}     
-	package Class::DBI;
+    #-------------------------------------------------------------------------------
+    use UNIVERSAL::require; 
+    BEGIN {                 
+        'Class::DBI::Frozen::301'->use or 'Class::DBI'->use or die $@;
+    }     
+    package Class::DBI;
 
-	sub search_fts {
-		my $self = shift;
-		my @args = @_;
+    sub search_fts {
+        my $self = shift;
+        my @args = @_;
 
-		if (ref($args[-1]) eq 'HASH' && @args > 1) {
-			$args[-1]->{_placeholder} = "to_tsquery('default',?)";
-		} else {
-			push @args, {_placeholder => "to_tsquery('default',?)"};
-		}
-		
-		$self->_do_search("@@"  => @args);
-	}
+        if (ref($args[-1]) eq 'HASH' && @args > 1) {
+            $args[-1]->{_placeholder} = "to_tsquery('default',?)";
+        } else {
+            push @args, {_placeholder => "to_tsquery('default',?)"};
+        }
+        
+        $self->_do_search("@@"  => @args);
+    }
 
-	sub search_regex {
-		my $self = shift;
-		my @args = @_;
-		$self->_do_search("~*"  => @args);
-	}
+    sub search_regex {
+        my $self = shift;
+        my @args = @_;
+        $self->_do_search("~*"  => @args);
+    }
 
-	sub search_ilike {
-		my $self = shift;
-		my @args = @_;
-		$self->_do_search("ILIKE"  => @args);
-	}
+    sub search_ilike {
+        my $self = shift;
+        my @args = @_;
+        $self->_do_search("ILIKE"  => @args);
+    }
 
 }
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/dbi.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/dbi.pm
index 47d3e8d..59f72f5 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/dbi.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/dbi.pm
@@ -12,858 +12,858 @@
     biblio::monograph_part->table( 'biblio.monograph_part' );
     biblio::monograph_part->sequence( 'biblio.monograph_part_id_seq' );
 
-	#-------------------------------------------------------------------------------
-	package biblio::peer_bib_copy_map;
+    #-------------------------------------------------------------------------------
+    package biblio::peer_bib_copy_map;
 
-	biblio::peer_bib_copy_map->table( 'biblio.peer_bib_copy_map' );
-	biblio::peer_bib_copy_map->sequence( 'biblio.peer_bib_copy_map_id_seq' );
+    biblio::peer_bib_copy_map->table( 'biblio.peer_bib_copy_map' );
+    biblio::peer_bib_copy_map->sequence( 'biblio.peer_bib_copy_map_id_seq' );
 
-	#-------------------------------------------------------------------------------
-	package biblio::peer_type;
+    #-------------------------------------------------------------------------------
+    package biblio::peer_type;
 
-	biblio::peer_type->table( 'biblio.peer_type' );
-	biblio::peer_type->sequence( 'biblio.peer_type_id_seq' );
+    biblio::peer_type->table( 'biblio.peer_type' );
+    biblio::peer_type->sequence( 'biblio.peer_type_id_seq' );
 
-	#-------------------------------------------------------------------------------
-	package container::user_bucket;
+    #-------------------------------------------------------------------------------
+    package container::user_bucket;
 
-	container::user_bucket->table( 'container.user_bucket' );
-	container::user_bucket->sequence( 'container.user_bucket_id_seq' );
+    container::user_bucket->table( 'container.user_bucket' );
+    container::user_bucket->sequence( 'container.user_bucket_id_seq' );
 
-	#-------------------------------------------------------------------------------
-	package container::user_bucket_item;
+    #-------------------------------------------------------------------------------
+    package container::user_bucket_item;
 
-	container::user_bucket_item->table( 'container.user_bucket_item' );
-	container::user_bucket_item->sequence( 'container.user_bucket_item_id_seq' );
+    container::user_bucket_item->table( 'container.user_bucket_item' );
+    container::user_bucket_item->sequence( 'container.user_bucket_item_id_seq' );
 
-	#-------------------------------------------------------------------------------
-	package container::copy_bucket;
+    #-------------------------------------------------------------------------------
+    package container::copy_bucket;
 
-	container::copy_bucket->table( 'container.copy_bucket' );
-	container::copy_bucket->sequence( 'container.copy_bucket_id_seq' );
+    container::copy_bucket->table( 'container.copy_bucket' );
+    container::copy_bucket->sequence( 'container.copy_bucket_id_seq' );
 
-	#-------------------------------------------------------------------------------
-	package container::copy_bucket_item;
-
-	container::copy_bucket_item->table( 'container.copy_bucket_item' );
-	container::copy_bucket_item->sequence( 'container.copy_bucket_item_id_seq' );
-
-	#-------------------------------------------------------------------------------
-	package container::call_number_bucket;
-
-	container::call_number_bucket->table( 'container.call_number_bucket' );
-	container::call_number_bucket->sequence( 'container.call_number_bucket_id_seq' );
-
-	#-------------------------------------------------------------------------------
-	package container::call_number_bucket_item;
-
-	container::call_number_bucket_item->table( 'container.call_number_bucket_item' );
-	container::call_number_bucket_item->sequence( 'container.call_number_bucket_item_id_seq' );
-
-	#-------------------------------------------------------------------------------
-	package container::biblio_record_entry_bucket;
-
-	container::biblio_record_entry_bucket->table( 'container.biblio_record_entry_bucket' );
-	container::biblio_record_entry_bucket->sequence( 'container.biblio_record_entry_bucket_id_seq' );
-
-	#-------------------------------------------------------------------------------
-	package container::biblio_record_entry_bucket_item;
-
-	container::biblio_record_entry_bucket_item->table( 'container.biblio_record_entry_bucket_item' );
-	container::biblio_record_entry_bucket_item->sequence( 'container.biblio_record_entry_bucket_item_id_seq' );
-
-	#---------------------------------------------------------------------
-	package money::grocery;
-	
-	money::grocery->table( 'money.grocery' );
-	money::grocery->sequence( 'money.billable_xact_id_seq' );
-
-	#---------------------------------------------------------------------
-	package money::collections_tracker;
-	
-	money::collections_tracker->table( 'money.collections_tracker' );
-	money::collections_tracker->sequence( 'money.collections_tracker_id_seq' );
-
-	#---------------------------------------------------------------------
-	package money::billable_transaction;
-	
-	money::billable_transaction->table( 'money.billable_xact' );
-	money::billable_transaction->sequence( 'money.billable_xact_id_seq' );
-
-	#---------------------------------------------------------------------
-	package money::billing;
-	
-	money::billing->table( 'money.billing' );
-	money::billing->sequence( 'money.billing_id_seq' );
-
-	#---------------------------------------------------------------------
-	package money::desk_payment;
-	
-	money::desk_payment->table( 'money.desk_payment_view' );
-
-	#---------------------------------------------------------------------
-	package money::payment;
-	
-	money::payment->table( 'money.payment_view' );
-
-	#---------------------------------------------------------------------
-	package money::cash_payment;
-	
-	money::cash_payment->table( 'money.cash_payment' );
-	money::cash_payment->sequence( 'money.payment_id_seq' );
-
-	#---------------------------------------------------------------------
-	package money::check_payment;
-	
-	money::check_payment->table( 'money.check_payment' );
-	money::check_payment->sequence( 'money.payment_id_seq' );
-
-	#---------------------------------------------------------------------
-	package money::credit_payment;
-	
-	money::credit_payment->table( 'money.credit_payment' );
-	money::credit_payment->sequence( 'money.payment_id_seq' );
-
-	#---------------------------------------------------------------------
-	package money::credit_card_payment;
-	
-	money::credit_card_payment->table( 'money.credit_card_payment' );
-	money::credit_card_payment->sequence( 'money.payment_id_seq' );
-
-	#---------------------------------------------------------------------
-	package money::work_payment;
-	
-	money::work_payment->table( 'money.work_payment' );
-	money::work_payment->sequence( 'money.payment_id_seq' );
-
-	#---------------------------------------------------------------------
-	package money::goods_payment;
-	
-	money::goods_payment->table( 'money.goods_payment' );
-	money::goods_payment->sequence( 'money.payment_id_seq' );
-
-	#---------------------------------------------------------------------
-	package money::forgive_payment;
-	
-	money::forgive_payment->table( 'money.forgive_payment' );
-	money::forgive_payment->sequence( 'money.payment_id_seq' );
-
-	#---------------------------------------------------------------------
-	package money::open_billable_transaction_summary;
-	
-	money::open_billable_transaction_summary->table( 'money.open_billable_xact_summary' );
-
-	#---------------------------------------------------------------------
-	package money::billable_transaction_summary;
-	
-	money::billable_transaction_summary->table( 'money.billable_xact_summary' );
-
-	#---------------------------------------------------------------------
-	package money::open_user_summary;
-	
-	money::open_user_summary->table( 'money.open_usr_summary' );
-
-	#---------------------------------------------------------------------
-	package money::user_summary;
-	
-	money::user_summary->table( 'money.usr_summary' );
-
-	#---------------------------------------------------------------------
-	package money::open_user_circulation_summary;
-	
-	money::open_user_circulation_summary->table( 'money.open_usr_circulation_summary' );
-
-	#---------------------------------------------------------------------
-	package money::user_circulation_summary;
-	
-	money::user_circulation_summary->table( 'money.usr_circulation_summary' );
-
-	#---------------------------------------------------------------------
-	package action::circulation;
-	
-	action::circulation->table( 'action.circulation' );
-	action::circulation->sequence( 'money.billable_xact_id_seq' );
-
-	#---------------------------------------------------------------------
-	package booking::resource_type;
-	
-	booking::resource_type->table( 'booking.resource_type' );
-	booking::resource_type->sequence( 'booking.resource_type_id_seq' );
-
-	#---------------------------------------------------------------------
-	package booking::resource;
-	
-	booking::resource->table( 'booking.resource' );
-	booking::resource->sequence( 'booking.resource_id_seq' );
-
-	#---------------------------------------------------------------------
-	package booking::reservation;
-	
-	booking::reservation->table( 'booking.reservation' );
-	booking::reservation->sequence( 'money.billable_xact_id_seq' );
-
-	#---------------------------------------------------------------------
-	package booking::reservation_attr_value_map;
-	
-	booking::reservation_attr_value_map->table( 'booking.reservation_attr_value_map' );
-	booking::reservation_attr_value_map->sequence( 'booking.reservation_attr_value_map_id_seq' );
-
-	#---------------------------------------------------------------------
-	package booking::resource_attr_map;
-	
-	booking::resource_attr_map->table( 'booking.resource_attr_map' );
-	booking::resource_attr_map->sequence( 'booking.resource_attr_map_id_seq' );
-
-	#---------------------------------------------------------------------
-	package action::non_cat_in_house_use;
-	
-	action::non_cat_in_house_use->table( 'action.non_cat_in_house_use' );
-	action::non_cat_in_house_use->sequence( 'action.non_cat_in_house_use_id_seq' );
-
-	#---------------------------------------------------------------------
-	package action::in_house_use;
-	
-	action::in_house_use->table( 'action.in_house_use' );
-	action::in_house_use->sequence( 'action.in_house_use_id_seq' );
-
-	#---------------------------------------------------------------------
-	package action::non_cataloged_circulation;
-	
-	action::non_cataloged_circulation->table( 'action.non_cataloged_circulation' );
-	action::non_cataloged_circulation->sequence( 'action.non_cataloged_circulation_id_seq' );
-
-	#---------------------------------------------------------------------
-	package action::open_circulation;
-	
-	action::open_circulation->table( 'action.open_circulation' );
-
-	#---------------------------------------------------------------------
-	package action::survey;
-	
-	action::survey->table( 'action.survey' );
-	action::survey->sequence( 'action.survey_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package action::survey_question;
-	
-	action::survey_question->table( 'action.survey_question' );
-	action::survey_question->sequence( 'action.survey_question_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package action::survey_answer;
-	
-	action::survey_answer->table( 'action.survey_answer' );
-	action::survey_answer->sequence( 'action.survey_answer_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package action::survey_response;
-	
-	action::survey_response->table( 'action.survey_response' );
-	action::survey_response->sequence( 'action.survey_response_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package config::non_cataloged_type;
-	
-	config::non_cataloged_type->table( 'config.non_cataloged_type' );
-	config::non_cataloged_type->sequence( 'config.non_cataloged_type_id_seq' );
-
-	#---------------------------------------------------------------------
-	package config::copy_status;
-	
-	config::copy_status->table( 'config.copy_status' );
-	config::copy_status->sequence( 'config.copy_status_id_seq' );
-
-	#---------------------------------------------------------------------
-	package config::rules::circ_duration;
-	
-	config::rules::circ_duration->table( 'config.rule_circ_duration' );
-	config::rules::circ_duration->sequence( 'config.rule_circ_duration_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package config::rules::age_hold_protect;
-	
-	config::rules::age_hold_protect->table( 'config.rule_age_hold_protect' );
-	config::rules::age_hold_protect->sequence( 'config.rule_age_hold_protect_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package config::rules::max_fine;
-	
-	config::rules::max_fine->table( 'config.rule_max_fine' );
-	config::rules::max_fine->sequence( 'config.rule_max_fine_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package config::rules::recurring_fine;
-	
-	config::rules::recurring_fine->table( 'config.rule_recurring_fine' );
-	config::rules::recurring_fine->sequence( 'config.rule_recurring_fine_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package config::net_access_level;
-	
-	config::net_access_level->table( 'config.net_access_level' );
-	config::net_access_level->sequence( 'config.net_access_level_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package config::standing;
-	
-	config::standing->table( 'config.standing' );
-	config::standing->sequence( 'config.standing_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package config::metabib_field;
-	
-	config::metabib_field->table( 'config.metabib_field' );
-	config::metabib_field->sequence( 'config.metabib_field_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package config::bib_source;
-	
-	config::bib_source->table( 'config.bib_source' );
-	config::bib_source->sequence( 'config.bib_source_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package config::identification_type;
-	
-	config::identification_type->table( 'config.identification_type' );
-	config::identification_type->sequence( 'config.identification_type_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package asset::call_number_note;
-	
-	asset::call_number_note->table( 'asset.call_number_note' );
-	asset::call_number_note->sequence( 'asset.call_number_note_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package asset::copy_note;
-	
-	asset::copy_note->table( 'asset.copy_note' );
-	asset::copy_note->sequence( 'asset.copy_note_id_seq' );
-
-	#---------------------------------------------------------------------
-	package asset::call_number;
-	
-	asset::call_number->table( 'asset.call_number' );
-	asset::call_number->sequence( 'asset.call_number_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package asset::call_number_suffix;
-	
-	asset::call_number_suffix->table( 'asset.call_number_suffix' );
-	asset::call_number_suffix->sequence( 'asset.call_number_suffix_id_seq' );
-
-	#---------------------------------------------------------------------
-	package asset::call_number_prefix;
-	
-	asset::call_number_prefix->table( 'asset.call_number_prefix' );
-	asset::call_number_prefix->sequence( 'asset.call_number_prefix_id_seq' );
-
-	#---------------------------------------------------------------------
-	package asset::call_number_class;
-	
-	asset::call_number_class->table( 'asset.call_number_class' );
-	asset::call_number_class->sequence( 'asset.call_number_class_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package asset::copy_location_order;
-	
-	asset::copy_location_order->table( 'asset.copy_location_order' );
-	asset::copy_location_order->sequence( 'asset.copy_location_order_id_seq' );
-
-	#---------------------------------------------------------------------
-	package asset::copy_location;
-	
-	asset::copy_location->table( 'asset.copy_location' );
-	asset::copy_location->sequence( 'asset.copy_location_id_seq' );
-
-	#---------------------------------------------------------------------
-	package asset::copy;
-	
-	asset::copy->table( 'asset.copy' );
-	asset::copy->sequence( 'asset.copy_id_seq' );
-
-	#---------------------------------------------------------------------
-	package asset::stat_cat;
-	
-	asset::stat_cat->table( 'asset.stat_cat' );
-	asset::stat_cat->sequence( 'asset.stat_cat_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package asset::stat_cat_entry;
-	
-	asset::stat_cat_entry->table( 'asset.stat_cat_entry' );
-	asset::stat_cat_entry->sequence( 'asset.stat_cat_entry_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package asset::stat_cat_entry_copy_map;
-	
-	asset::stat_cat_entry_copy_map->table( 'asset.stat_cat_entry_copy_map' );
-	asset::stat_cat_entry_copy_map->sequence( 'asset.stat_cat_entry_copy_map_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package authority::record_entry;
-	
-	authority::record_entry->table( 'authority.record_entry' );
-	authority::record_entry->sequence( 'authority.record_entry_id_seq' );
-
-	#---------------------------------------------------------------------
-	package biblio::record_entry;
-	
-	biblio::record_entry->table( 'biblio.record_entry' );
-	biblio::record_entry->sequence( 'biblio.record_entry_id_seq' );
-
-	#---------------------------------------------------------------------
-	#package biblio::record_marc;
-	#
-	#biblio::record_marc->table( 'biblio.record_marc' );
-	#biblio::record_marc->sequence( 'biblio.record_marc_id_seq' );
-	#
-	#---------------------------------------------------------------------
-	package authority::record_note;
-	
-	authority::record_note->table( 'authority.record_note' );
-	authority::record_note->sequence( 'authority.record_note_id_seq' );
-
-	#---------------------------------------------------------------------
-	package biblio::record_note;
-	
-	biblio::record_note->table( 'biblio.record_note' );
-	biblio::record_note->sequence( 'biblio.record_note_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package actor::workstation;
-	
-	actor::workstation->table( 'actor.workstation' );
-	actor::workstation->sequence( 'actor.workstation_id_seq' );
-
-	#---------------------------------------------------------------------
-	package actor::user;
-	
-	actor::user->table( 'actor.usr' );
-	actor::user->sequence( 'actor.usr_id_seq' );
-
-	#---------------------------------------------------------------------
-	package actor::org_unit::closed_date;
-	
-	actor::org_unit::closed_date->table( 'actor.org_unit_closed' );
-	actor::org_unit::closed_date->sequence( 'actor.org_unit_closed_id_seq' );
-
-	#---------------------------------------------------------------------
-	package actor::org_unit_setting;
-	
-	actor::org_unit_setting->table( 'actor.org_unit_setting' );
-	actor::org_unit_setting->sequence( 'actor.org_unit_setting_id_seq' );
-
-	#---------------------------------------------------------------------
-	package actor::user_standing_penalty;
-	
-	actor::user_standing_penalty->table( 'actor.usr_standing_penalty' );
-	actor::user_standing_penalty->sequence( 'actor.usr_standing_penalty_id_seq' );
-
-	#---------------------------------------------------------------------
-	package actor::user_setting;
-	
-	actor::user_setting->table( 'actor.usr_setting' );
-	actor::user_setting->sequence( 'actor.usr_setting_id_seq' );
-
-	#---------------------------------------------------------------------
-	package actor::user_address;
-	
-	actor::user_address->table( 'actor.usr_address' );
-	actor::user_address->sequence( 'actor.usr_address_id_seq' );
-
-	#---------------------------------------------------------------------
-	package actor::org_address;
-	
-	actor::org_address->table( 'actor.org_address' );
-	actor::org_address->sequence( 'actor.org_address_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package actor::usr_org_unit_opt_in;
-	
-	actor::usr_org_unit_opt_in->table( 'actor.usr_org_unit_opt_in' );
-	actor::usr_org_unit_opt_in->sequence( 'actor.usr_org_unit_opt_in_id_seq' );
-
-	#---------------------------------------------------------------------
-	package actor::org_unit_proximity;
-	
-	actor::org_unit_proximity->table( 'actor.org_unit_proximity' );
-	actor::org_unit_proximity->sequence( 'actor.org_unit_proximity_id_seq' );
-
-	#---------------------------------------------------------------------
-	package actor::org_unit_type;
-	
-	actor::org_unit_type->table( 'actor.org_unit_type' );
-	actor::org_unit_type->sequence( 'actor.org_unit_type_id_seq' );
-
-	#---------------------------------------------------------------------
-	package actor::org_unit::hours_of_operation;
-	
-	actor::org_unit::hours_of_operation->table( 'actor.hours_of_operation' );
-
-	#---------------------------------------------------------------------
-	package actor::org_unit;
-	
-	actor::org_unit->table( 'actor.org_unit' );
-	actor::org_unit->sequence( 'actor.org_unit_id_seq' );
-
-	#---------------------------------------------------------------------
-	package actor::stat_cat;
-	
-	actor::stat_cat->table( 'actor.stat_cat' );
-	actor::stat_cat->sequence( 'actor.stat_cat_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package actor::stat_cat_entry;
-	
-	actor::stat_cat_entry->table( 'actor.stat_cat_entry' );
-	actor::stat_cat_entry->sequence( 'actor.stat_cat_entry_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package actor::stat_cat_entry_default;
-	
-	actor::stat_cat_entry_default->table( 'actor.stat_cat_entry_default' );
-	actor::stat_cat_entry_default->sequence( 'actor.stat_cat_entry_default_id_seq' );
-
-	#---------------------------------------------------------------------
-	package actor::stat_cat_entry_user_map;
-	
-	actor::stat_cat_entry_user_map->table( 'actor.stat_cat_entry_usr_map' );
-	actor::stat_cat_entry_user_map->sequence( 'actor.stat_cat_entry_usr_map_id_seq' );
-	
-	#---------------------------------------------------------------------
-	package actor::card;
-	
-	actor::card->table( 'actor.card' );
-	actor::card->sequence( 'actor.card_id_seq' );
-
-	#---------------------------------------------------------------------
-	package actor::usr_note;
-	
-	actor::usr_note->table( 'actor.usr_note' );
-	actor::usr_note->sequence( 'actor.usr_note_id_seq' );
-
-	#---------------------------------------------------------------------
-
-	#-------------------------------------------------------------------------------
-	package metabib::metarecord;
+    #-------------------------------------------------------------------------------
+    package container::copy_bucket_item;
 
-	metabib::metarecord->table( 'metabib.metarecord' );
-	metabib::metarecord->sequence( 'metabib.metarecord_id_seq' );
+    container::copy_bucket_item->table( 'container.copy_bucket_item' );
+    container::copy_bucket_item->sequence( 'container.copy_bucket_item_id_seq' );
 
+    #-------------------------------------------------------------------------------
+    package container::call_number_bucket;
 
-	#-------------------------------------------------------------------------------
+    container::call_number_bucket->table( 'container.call_number_bucket' );
+    container::call_number_bucket->sequence( 'container.call_number_bucket_id_seq' );
 
-	#-------------------------------------------------------------------------------
-	package metabib::identifier_field_entry;
+    #-------------------------------------------------------------------------------
+    package container::call_number_bucket_item;
 
-	metabib::identifier_field_entry->table( 'metabib.identifier_field_entry' );
-	metabib::identifier_field_entry->sequence( 'metabib.identifier_field_entry_id_seq' );
-	metabib::identifier_field_entry->columns( 'FTS' => 'index_vector' );
+    container::call_number_bucket_item->table( 'container.call_number_bucket_item' );
+    container::call_number_bucket_item->sequence( 'container.call_number_bucket_item_id_seq' );
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
+    package container::biblio_record_entry_bucket;
 
-	#-------------------------------------------------------------------------------
-	package metabib::title_field_entry;
+    container::biblio_record_entry_bucket->table( 'container.biblio_record_entry_bucket' );
+    container::biblio_record_entry_bucket->sequence( 'container.biblio_record_entry_bucket_id_seq' );
 
-	metabib::title_field_entry->table( 'metabib.title_field_entry' );
-	metabib::title_field_entry->sequence( 'metabib.title_field_entry_id_seq' );
-	metabib::title_field_entry->columns( 'FTS' => 'index_vector' );
+    #-------------------------------------------------------------------------------
+    package container::biblio_record_entry_bucket_item;
+
+    container::biblio_record_entry_bucket_item->table( 'container.biblio_record_entry_bucket_item' );
+    container::biblio_record_entry_bucket_item->sequence( 'container.biblio_record_entry_bucket_item_id_seq' );
+
+    #---------------------------------------------------------------------
+    package money::grocery;
+    
+    money::grocery->table( 'money.grocery' );
+    money::grocery->sequence( 'money.billable_xact_id_seq' );
+
+    #---------------------------------------------------------------------
+    package money::collections_tracker;
+    
+    money::collections_tracker->table( 'money.collections_tracker' );
+    money::collections_tracker->sequence( 'money.collections_tracker_id_seq' );
+
+    #---------------------------------------------------------------------
+    package money::billable_transaction;
+    
+    money::billable_transaction->table( 'money.billable_xact' );
+    money::billable_transaction->sequence( 'money.billable_xact_id_seq' );
+
+    #---------------------------------------------------------------------
+    package money::billing;
+    
+    money::billing->table( 'money.billing' );
+    money::billing->sequence( 'money.billing_id_seq' );
+
+    #---------------------------------------------------------------------
+    package money::desk_payment;
+    
+    money::desk_payment->table( 'money.desk_payment_view' );
+
+    #---------------------------------------------------------------------
+    package money::payment;
+    
+    money::payment->table( 'money.payment_view' );
+
+    #---------------------------------------------------------------------
+    package money::cash_payment;
+    
+    money::cash_payment->table( 'money.cash_payment' );
+    money::cash_payment->sequence( 'money.payment_id_seq' );
+
+    #---------------------------------------------------------------------
+    package money::check_payment;
+    
+    money::check_payment->table( 'money.check_payment' );
+    money::check_payment->sequence( 'money.payment_id_seq' );
+
+    #---------------------------------------------------------------------
+    package money::credit_payment;
+    
+    money::credit_payment->table( 'money.credit_payment' );
+    money::credit_payment->sequence( 'money.payment_id_seq' );
+
+    #---------------------------------------------------------------------
+    package money::credit_card_payment;
+    
+    money::credit_card_payment->table( 'money.credit_card_payment' );
+    money::credit_card_payment->sequence( 'money.payment_id_seq' );
+
+    #---------------------------------------------------------------------
+    package money::work_payment;
+    
+    money::work_payment->table( 'money.work_payment' );
+    money::work_payment->sequence( 'money.payment_id_seq' );
+
+    #---------------------------------------------------------------------
+    package money::goods_payment;
+    
+    money::goods_payment->table( 'money.goods_payment' );
+    money::goods_payment->sequence( 'money.payment_id_seq' );
+
+    #---------------------------------------------------------------------
+    package money::forgive_payment;
+    
+    money::forgive_payment->table( 'money.forgive_payment' );
+    money::forgive_payment->sequence( 'money.payment_id_seq' );
+
+    #---------------------------------------------------------------------
+    package money::open_billable_transaction_summary;
+    
+    money::open_billable_transaction_summary->table( 'money.open_billable_xact_summary' );
+
+    #---------------------------------------------------------------------
+    package money::billable_transaction_summary;
+    
+    money::billable_transaction_summary->table( 'money.billable_xact_summary' );
+
+    #---------------------------------------------------------------------
+    package money::open_user_summary;
+    
+    money::open_user_summary->table( 'money.open_usr_summary' );
+
+    #---------------------------------------------------------------------
+    package money::user_summary;
+    
+    money::user_summary->table( 'money.usr_summary' );
+
+    #---------------------------------------------------------------------
+    package money::open_user_circulation_summary;
+    
+    money::open_user_circulation_summary->table( 'money.open_usr_circulation_summary' );
+
+    #---------------------------------------------------------------------
+    package money::user_circulation_summary;
+    
+    money::user_circulation_summary->table( 'money.usr_circulation_summary' );
+
+    #---------------------------------------------------------------------
+    package action::circulation;
+    
+    action::circulation->table( 'action.circulation' );
+    action::circulation->sequence( 'money.billable_xact_id_seq' );
+
+    #---------------------------------------------------------------------
+    package booking::resource_type;
+    
+    booking::resource_type->table( 'booking.resource_type' );
+    booking::resource_type->sequence( 'booking.resource_type_id_seq' );
+
+    #---------------------------------------------------------------------
+    package booking::resource;
+    
+    booking::resource->table( 'booking.resource' );
+    booking::resource->sequence( 'booking.resource_id_seq' );
+
+    #---------------------------------------------------------------------
+    package booking::reservation;
+    
+    booking::reservation->table( 'booking.reservation' );
+    booking::reservation->sequence( 'money.billable_xact_id_seq' );
+
+    #---------------------------------------------------------------------
+    package booking::reservation_attr_value_map;
+    
+    booking::reservation_attr_value_map->table( 'booking.reservation_attr_value_map' );
+    booking::reservation_attr_value_map->sequence( 'booking.reservation_attr_value_map_id_seq' );
+
+    #---------------------------------------------------------------------
+    package booking::resource_attr_map;
+    
+    booking::resource_attr_map->table( 'booking.resource_attr_map' );
+    booking::resource_attr_map->sequence( 'booking.resource_attr_map_id_seq' );
+
+    #---------------------------------------------------------------------
+    package action::non_cat_in_house_use;
+    
+    action::non_cat_in_house_use->table( 'action.non_cat_in_house_use' );
+    action::non_cat_in_house_use->sequence( 'action.non_cat_in_house_use_id_seq' );
+
+    #---------------------------------------------------------------------
+    package action::in_house_use;
+    
+    action::in_house_use->table( 'action.in_house_use' );
+    action::in_house_use->sequence( 'action.in_house_use_id_seq' );
+
+    #---------------------------------------------------------------------
+    package action::non_cataloged_circulation;
+    
+    action::non_cataloged_circulation->table( 'action.non_cataloged_circulation' );
+    action::non_cataloged_circulation->sequence( 'action.non_cataloged_circulation_id_seq' );
+
+    #---------------------------------------------------------------------
+    package action::open_circulation;
+    
+    action::open_circulation->table( 'action.open_circulation' );
+
+    #---------------------------------------------------------------------
+    package action::survey;
+    
+    action::survey->table( 'action.survey' );
+    action::survey->sequence( 'action.survey_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package action::survey_question;
+    
+    action::survey_question->table( 'action.survey_question' );
+    action::survey_question->sequence( 'action.survey_question_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package action::survey_answer;
+    
+    action::survey_answer->table( 'action.survey_answer' );
+    action::survey_answer->sequence( 'action.survey_answer_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package action::survey_response;
+    
+    action::survey_response->table( 'action.survey_response' );
+    action::survey_response->sequence( 'action.survey_response_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package config::non_cataloged_type;
+    
+    config::non_cataloged_type->table( 'config.non_cataloged_type' );
+    config::non_cataloged_type->sequence( 'config.non_cataloged_type_id_seq' );
+
+    #---------------------------------------------------------------------
+    package config::copy_status;
+    
+    config::copy_status->table( 'config.copy_status' );
+    config::copy_status->sequence( 'config.copy_status_id_seq' );
+
+    #---------------------------------------------------------------------
+    package config::rules::circ_duration;
+    
+    config::rules::circ_duration->table( 'config.rule_circ_duration' );
+    config::rules::circ_duration->sequence( 'config.rule_circ_duration_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package config::rules::age_hold_protect;
+    
+    config::rules::age_hold_protect->table( 'config.rule_age_hold_protect' );
+    config::rules::age_hold_protect->sequence( 'config.rule_age_hold_protect_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package config::rules::max_fine;
+    
+    config::rules::max_fine->table( 'config.rule_max_fine' );
+    config::rules::max_fine->sequence( 'config.rule_max_fine_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package config::rules::recurring_fine;
+    
+    config::rules::recurring_fine->table( 'config.rule_recurring_fine' );
+    config::rules::recurring_fine->sequence( 'config.rule_recurring_fine_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package config::net_access_level;
+    
+    config::net_access_level->table( 'config.net_access_level' );
+    config::net_access_level->sequence( 'config.net_access_level_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package config::standing;
+    
+    config::standing->table( 'config.standing' );
+    config::standing->sequence( 'config.standing_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package config::metabib_field;
+    
+    config::metabib_field->table( 'config.metabib_field' );
+    config::metabib_field->sequence( 'config.metabib_field_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package config::bib_source;
+    
+    config::bib_source->table( 'config.bib_source' );
+    config::bib_source->sequence( 'config.bib_source_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package config::identification_type;
+    
+    config::identification_type->table( 'config.identification_type' );
+    config::identification_type->sequence( 'config.identification_type_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package asset::call_number_note;
+    
+    asset::call_number_note->table( 'asset.call_number_note' );
+    asset::call_number_note->sequence( 'asset.call_number_note_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package asset::copy_note;
+    
+    asset::copy_note->table( 'asset.copy_note' );
+    asset::copy_note->sequence( 'asset.copy_note_id_seq' );
+
+    #---------------------------------------------------------------------
+    package asset::call_number;
+    
+    asset::call_number->table( 'asset.call_number' );
+    asset::call_number->sequence( 'asset.call_number_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package asset::call_number_suffix;
+    
+    asset::call_number_suffix->table( 'asset.call_number_suffix' );
+    asset::call_number_suffix->sequence( 'asset.call_number_suffix_id_seq' );
+
+    #---------------------------------------------------------------------
+    package asset::call_number_prefix;
+    
+    asset::call_number_prefix->table( 'asset.call_number_prefix' );
+    asset::call_number_prefix->sequence( 'asset.call_number_prefix_id_seq' );
+
+    #---------------------------------------------------------------------
+    package asset::call_number_class;
+    
+    asset::call_number_class->table( 'asset.call_number_class' );
+    asset::call_number_class->sequence( 'asset.call_number_class_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package asset::copy_location_order;
+    
+    asset::copy_location_order->table( 'asset.copy_location_order' );
+    asset::copy_location_order->sequence( 'asset.copy_location_order_id_seq' );
+
+    #---------------------------------------------------------------------
+    package asset::copy_location;
+    
+    asset::copy_location->table( 'asset.copy_location' );
+    asset::copy_location->sequence( 'asset.copy_location_id_seq' );
+
+    #---------------------------------------------------------------------
+    package asset::copy;
+    
+    asset::copy->table( 'asset.copy' );
+    asset::copy->sequence( 'asset.copy_id_seq' );
+
+    #---------------------------------------------------------------------
+    package asset::stat_cat;
+    
+    asset::stat_cat->table( 'asset.stat_cat' );
+    asset::stat_cat->sequence( 'asset.stat_cat_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package asset::stat_cat_entry;
+    
+    asset::stat_cat_entry->table( 'asset.stat_cat_entry' );
+    asset::stat_cat_entry->sequence( 'asset.stat_cat_entry_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package asset::stat_cat_entry_copy_map;
+    
+    asset::stat_cat_entry_copy_map->table( 'asset.stat_cat_entry_copy_map' );
+    asset::stat_cat_entry_copy_map->sequence( 'asset.stat_cat_entry_copy_map_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package authority::record_entry;
+    
+    authority::record_entry->table( 'authority.record_entry' );
+    authority::record_entry->sequence( 'authority.record_entry_id_seq' );
+
+    #---------------------------------------------------------------------
+    package biblio::record_entry;
+    
+    biblio::record_entry->table( 'biblio.record_entry' );
+    biblio::record_entry->sequence( 'biblio.record_entry_id_seq' );
+
+    #---------------------------------------------------------------------
+    #package biblio::record_marc;
+    #
+    #biblio::record_marc->table( 'biblio.record_marc' );
+    #biblio::record_marc->sequence( 'biblio.record_marc_id_seq' );
+    #
+    #---------------------------------------------------------------------
+    package authority::record_note;
+    
+    authority::record_note->table( 'authority.record_note' );
+    authority::record_note->sequence( 'authority.record_note_id_seq' );
+
+    #---------------------------------------------------------------------
+    package biblio::record_note;
+    
+    biblio::record_note->table( 'biblio.record_note' );
+    biblio::record_note->sequence( 'biblio.record_note_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package actor::workstation;
+    
+    actor::workstation->table( 'actor.workstation' );
+    actor::workstation->sequence( 'actor.workstation_id_seq' );
+
+    #---------------------------------------------------------------------
+    package actor::user;
+    
+    actor::user->table( 'actor.usr' );
+    actor::user->sequence( 'actor.usr_id_seq' );
+
+    #---------------------------------------------------------------------
+    package actor::org_unit::closed_date;
+    
+    actor::org_unit::closed_date->table( 'actor.org_unit_closed' );
+    actor::org_unit::closed_date->sequence( 'actor.org_unit_closed_id_seq' );
+
+    #---------------------------------------------------------------------
+    package actor::org_unit_setting;
+    
+    actor::org_unit_setting->table( 'actor.org_unit_setting' );
+    actor::org_unit_setting->sequence( 'actor.org_unit_setting_id_seq' );
+
+    #---------------------------------------------------------------------
+    package actor::user_standing_penalty;
+    
+    actor::user_standing_penalty->table( 'actor.usr_standing_penalty' );
+    actor::user_standing_penalty->sequence( 'actor.usr_standing_penalty_id_seq' );
+
+    #---------------------------------------------------------------------
+    package actor::user_setting;
+    
+    actor::user_setting->table( 'actor.usr_setting' );
+    actor::user_setting->sequence( 'actor.usr_setting_id_seq' );
+
+    #---------------------------------------------------------------------
+    package actor::user_address;
+    
+    actor::user_address->table( 'actor.usr_address' );
+    actor::user_address->sequence( 'actor.usr_address_id_seq' );
+
+    #---------------------------------------------------------------------
+    package actor::org_address;
+    
+    actor::org_address->table( 'actor.org_address' );
+    actor::org_address->sequence( 'actor.org_address_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package actor::usr_org_unit_opt_in;
+    
+    actor::usr_org_unit_opt_in->table( 'actor.usr_org_unit_opt_in' );
+    actor::usr_org_unit_opt_in->sequence( 'actor.usr_org_unit_opt_in_id_seq' );
+
+    #---------------------------------------------------------------------
+    package actor::org_unit_proximity;
+    
+    actor::org_unit_proximity->table( 'actor.org_unit_proximity' );
+    actor::org_unit_proximity->sequence( 'actor.org_unit_proximity_id_seq' );
+
+    #---------------------------------------------------------------------
+    package actor::org_unit_type;
+    
+    actor::org_unit_type->table( 'actor.org_unit_type' );
+    actor::org_unit_type->sequence( 'actor.org_unit_type_id_seq' );
+
+    #---------------------------------------------------------------------
+    package actor::org_unit::hours_of_operation;
+    
+    actor::org_unit::hours_of_operation->table( 'actor.hours_of_operation' );
+
+    #---------------------------------------------------------------------
+    package actor::org_unit;
+    
+    actor::org_unit->table( 'actor.org_unit' );
+    actor::org_unit->sequence( 'actor.org_unit_id_seq' );
+
+    #---------------------------------------------------------------------
+    package actor::stat_cat;
+    
+    actor::stat_cat->table( 'actor.stat_cat' );
+    actor::stat_cat->sequence( 'actor.stat_cat_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package actor::stat_cat_entry;
+    
+    actor::stat_cat_entry->table( 'actor.stat_cat_entry' );
+    actor::stat_cat_entry->sequence( 'actor.stat_cat_entry_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package actor::stat_cat_entry_default;
+    
+    actor::stat_cat_entry_default->table( 'actor.stat_cat_entry_default' );
+    actor::stat_cat_entry_default->sequence( 'actor.stat_cat_entry_default_id_seq' );
+
+    #---------------------------------------------------------------------
+    package actor::stat_cat_entry_user_map;
+    
+    actor::stat_cat_entry_user_map->table( 'actor.stat_cat_entry_usr_map' );
+    actor::stat_cat_entry_user_map->sequence( 'actor.stat_cat_entry_usr_map_id_seq' );
+    
+    #---------------------------------------------------------------------
+    package actor::card;
+    
+    actor::card->table( 'actor.card' );
+    actor::card->sequence( 'actor.card_id_seq' );
+
+    #---------------------------------------------------------------------
+    package actor::usr_note;
+    
+    actor::usr_note->table( 'actor.usr_note' );
+    actor::usr_note->sequence( 'actor.usr_note_id_seq' );
+
+    #---------------------------------------------------------------------
 
-#	metabib::title_field_entry->add_trigger(
-#		before_create => \&OpenILS::Application::Storage::Driver::Pg::tsearch2_trigger
-#	);
-#	metabib::title_field_entry->add_trigger(
-#		before_update => \&OpenILS::Application::Storage::Driver::Pg::tsearch2_trigger
-#	);
+    #-------------------------------------------------------------------------------
+    package metabib::metarecord;
 
-	#-------------------------------------------------------------------------------
+    metabib::metarecord->table( 'metabib.metarecord' );
+    metabib::metarecord->sequence( 'metabib.metarecord_id_seq' );
 
-	#-------------------------------------------------------------------------------
-	package metabib::author_field_entry;
 
-	metabib::author_field_entry->table( 'metabib.author_field_entry' );
-	metabib::author_field_entry->sequence( 'metabib.author_field_entry_id_seq' );
-	metabib::author_field_entry->columns( 'FTS' => 'index_vector' );
+    #-------------------------------------------------------------------------------
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
+    package metabib::identifier_field_entry;
 
-	#-------------------------------------------------------------------------------
-	package metabib::subject_field_entry;
+    metabib::identifier_field_entry->table( 'metabib.identifier_field_entry' );
+    metabib::identifier_field_entry->sequence( 'metabib.identifier_field_entry_id_seq' );
+    metabib::identifier_field_entry->columns( 'FTS' => 'index_vector' );
 
-	metabib::subject_field_entry->table( 'metabib.subject_field_entry' );
-	metabib::subject_field_entry->sequence( 'metabib.subject_field_entry_id_seq' );
-	metabib::subject_field_entry->columns( 'FTS' => 'index_vector' );
+    #-------------------------------------------------------------------------------
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
+    package metabib::title_field_entry;
 
-	#-------------------------------------------------------------------------------
-	package metabib::keyword_field_entry;
+    metabib::title_field_entry->table( 'metabib.title_field_entry' );
+    metabib::title_field_entry->sequence( 'metabib.title_field_entry_id_seq' );
+    metabib::title_field_entry->columns( 'FTS' => 'index_vector' );
 
-	metabib::keyword_field_entry->table( 'metabib.keyword_field_entry' );
-	metabib::keyword_field_entry->sequence( 'metabib.keyword_field_entry_id_seq' );
-	metabib::keyword_field_entry->columns( 'FTS' => 'index_vector' );
+#   metabib::title_field_entry->add_trigger(
+#       before_create => \&OpenILS::Application::Storage::Driver::Pg::tsearch2_trigger
+#   );
+#   metabib::title_field_entry->add_trigger(
+#       before_update => \&OpenILS::Application::Storage::Driver::Pg::tsearch2_trigger
+#   );
 
-	#-------------------------------------------------------------------------------
-	package metabib::series_field_entry;
+    #-------------------------------------------------------------------------------
 
-	metabib::series_field_entry->table( 'metabib.series_field_entry' );
-	metabib::series_field_entry->sequence( 'metabib.series_field_entry_id_seq' );
-	metabib::series_field_entry->columns( 'FTS' => 'index_vector' );
+    #-------------------------------------------------------------------------------
+    package metabib::author_field_entry;
 
-	#-------------------------------------------------------------------------------
+    metabib::author_field_entry->table( 'metabib.author_field_entry' );
+    metabib::author_field_entry->sequence( 'metabib.author_field_entry_id_seq' );
+    metabib::author_field_entry->columns( 'FTS' => 'index_vector' );
 
-	#-------------------------------------------------------------------------------
-	#package metabib::title_field_entry_source_map;
+    #-------------------------------------------------------------------------------
 
-	#metabib::title_field_entry_source_map->table( 'metabib.title_field_entry_source_map' );
+    #-------------------------------------------------------------------------------
+    package metabib::subject_field_entry;
 
-	#-------------------------------------------------------------------------------
+    metabib::subject_field_entry->table( 'metabib.subject_field_entry' );
+    metabib::subject_field_entry->sequence( 'metabib.subject_field_entry_id_seq' );
+    metabib::subject_field_entry->columns( 'FTS' => 'index_vector' );
 
-	#-------------------------------------------------------------------------------
-	#package metabib::author_field_entry_source_map;
+    #-------------------------------------------------------------------------------
 
-	#metabib::author_field_entry_source_map->table( 'metabib.author_field_entry_source_map' );
+    #-------------------------------------------------------------------------------
+    package metabib::keyword_field_entry;
 
-	#-------------------------------------------------------------------------------
+    metabib::keyword_field_entry->table( 'metabib.keyword_field_entry' );
+    metabib::keyword_field_entry->sequence( 'metabib.keyword_field_entry_id_seq' );
+    metabib::keyword_field_entry->columns( 'FTS' => 'index_vector' );
 
-	#-------------------------------------------------------------------------------
-	#package metabib::subject_field_entry_source_map;
+    #-------------------------------------------------------------------------------
+    package metabib::series_field_entry;
 
-	#metabib::subject_field_entry_source_map->table( 'metabib.subject_field_entry_source_map' );
+    metabib::series_field_entry->table( 'metabib.series_field_entry' );
+    metabib::series_field_entry->sequence( 'metabib.series_field_entry_id_seq' );
+    metabib::series_field_entry->columns( 'FTS' => 'index_vector' );
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
 
-	#-------------------------------------------------------------------------------
-	#package metabib::keyword_field_entry_source_map;
+    #-------------------------------------------------------------------------------
+    #package metabib::title_field_entry_source_map;
 
-	#metabib::keyword_field_entry_source_map->table( 'metabib.keyword_field_entry_source_map' );
+    #metabib::title_field_entry_source_map->table( 'metabib.title_field_entry_source_map' );
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
 
-	#-------------------------------------------------------------------------------
-	package metabib::metarecord_source_map;
+    #-------------------------------------------------------------------------------
+    #package metabib::author_field_entry_source_map;
 
-	metabib::metarecord_source_map->table( 'metabib.metarecord_source_map' );
-	metabib::metarecord_source_map->sequence( 'metabib.metarecord_source_map_id_seq' );
+    #metabib::author_field_entry_source_map->table( 'metabib.author_field_entry_source_map' );
 
-	#-------------------------------------------------------------------------------
-	package authority::record_descriptor;
+    #-------------------------------------------------------------------------------
 
-	authority::record_descriptor->table( 'authority.rec_descriptor' );
-	authority::record_descriptor->sequence( 'authority.rec_descriptor_id_seq' );
+    #-------------------------------------------------------------------------------
+    #package metabib::subject_field_entry_source_map;
 
-	#-------------------------------------------------------------------------------
-	package metabib::record_descriptor;
+    #metabib::subject_field_entry_source_map->table( 'metabib.subject_field_entry_source_map' );
 
-	metabib::record_descriptor->table( 'metabib.rec_descriptor' );
-	metabib::record_descriptor->sequence( 'metabib.rec_descriptor_id_seq' );
+    #-------------------------------------------------------------------------------
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
+    #package metabib::keyword_field_entry_source_map;
 
+    #metabib::keyword_field_entry_source_map->table( 'metabib.keyword_field_entry_source_map' );
 
-	#-------------------------------------------------------------------------------
-	package authority::full_rec;
+    #-------------------------------------------------------------------------------
 
-	authority::full_rec->table( 'authority.full_rec' );
-	authority::full_rec->sequence( 'authority.full_rec_id_seq' );
-	authority::full_rec->columns( 'FTS' => 'index_vector' );
+    #-------------------------------------------------------------------------------
+    package metabib::metarecord_source_map;
 
-	#-------------------------------------------------------------------------------
-	package metabib::full_rec;
+    metabib::metarecord_source_map->table( 'metabib.metarecord_source_map' );
+    metabib::metarecord_source_map->sequence( 'metabib.metarecord_source_map_id_seq' );
 
-	metabib::full_rec->table( 'metabib.full_rec' );
-	metabib::full_rec->sequence( 'metabib.full_rec_id_seq' );
-	metabib::full_rec->columns( 'FTS' => 'index_vector' );
+    #-------------------------------------------------------------------------------
+    package authority::record_descriptor;
 
-	#-------------------------------------------------------------------------------
+    authority::record_descriptor->table( 'authority.rec_descriptor' );
+    authority::record_descriptor->sequence( 'authority.rec_descriptor_id_seq' );
 
-	package permission::perm_list;
+    #-------------------------------------------------------------------------------
+    package metabib::record_descriptor;
 
-	permission::perm_list->sequence( 'permission.perm_list_id_seq' );
-	permission::perm_list->table('permission.perm_list');
+    metabib::record_descriptor->table( 'metabib.rec_descriptor' );
+    metabib::record_descriptor->sequence( 'metabib.rec_descriptor_id_seq' );
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
 
-	package permission::grp_tree;
 
-	permission::grp_tree->sequence( 'permission.grp_tree_id_seq' );
-	permission::grp_tree->table('permission.grp_tree');
+    #-------------------------------------------------------------------------------
+    package authority::full_rec;
 
-	#-------------------------------------------------------------------------------
+    authority::full_rec->table( 'authority.full_rec' );
+    authority::full_rec->sequence( 'authority.full_rec_id_seq' );
+    authority::full_rec->columns( 'FTS' => 'index_vector' );
 
-	package permission::usr_grp_map;
+    #-------------------------------------------------------------------------------
+    package metabib::full_rec;
 
-	permission::usr_grp_map->sequence( 'permission.usr_grp_map_id_seq' );
-	permission::usr_grp_map->table('permission.usr_grp_map');
+    metabib::full_rec->table( 'metabib.full_rec' );
+    metabib::full_rec->sequence( 'metabib.full_rec_id_seq' );
+    metabib::full_rec->columns( 'FTS' => 'index_vector' );
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
 
-	package permission::usr_work_ou_map;
-	permission::usr_work_ou_map->sequence('permission.usr_work_ou_map_id_seq');
-	permission::usr_work_ou_map->table('permission.usr_work_ou_map');
+    package permission::perm_list;
 
-	#-------------------------------------------------------------------------------
+    permission::perm_list->sequence( 'permission.perm_list_id_seq' );
+    permission::perm_list->table('permission.perm_list');
 
-	package permission::usr_perm_map;
+    #-------------------------------------------------------------------------------
 
-	permission::usr_perm_map->sequence( 'permission.usr_perm_map_id_seq' );
-	permission::usr_perm_map->table('permission.usr_perm_map');
+    package permission::grp_tree;
 
-	#-------------------------------------------------------------------------------
+    permission::grp_tree->sequence( 'permission.grp_tree_id_seq' );
+    permission::grp_tree->table('permission.grp_tree');
 
-	package permission::grp_perm_map;
+    #-------------------------------------------------------------------------------
 
-	permission::grp_perm_map->sequence( 'permission.grp_perm_map_id_seq' );
-	permission::grp_perm_map->table('permission.grp_perm_map');
+    package permission::usr_grp_map;
 
-	#-------------------------------------------------------------------------------
+    permission::usr_grp_map->sequence( 'permission.usr_grp_map_id_seq' );
+    permission::usr_grp_map->table('permission.usr_grp_map');
 
-	package action::hold_request;
+    #-------------------------------------------------------------------------------
 
-	action::hold_request->sequence( 'action.hold_request_id_seq' );
-	action::hold_request->table('action.hold_request');
+    package permission::usr_work_ou_map;
+    permission::usr_work_ou_map->sequence('permission.usr_work_ou_map_id_seq');
+    permission::usr_work_ou_map->table('permission.usr_work_ou_map');
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
 
-	package action::hold_notification;
+    package permission::usr_perm_map;
 
-	action::hold_notification->sequence( 'action.hold_notification_id_seq' );
-	action::hold_notification->table('action.hold_notification');
+    permission::usr_perm_map->sequence( 'permission.usr_perm_map_id_seq' );
+    permission::usr_perm_map->table('permission.usr_perm_map');
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
 
-	package action::hold_copy_map;
+    package permission::grp_perm_map;
 
-	action::hold_copy_map->sequence( 'action.hold_copy_map_id_seq' );
-	action::hold_copy_map->table('action.hold_copy_map');
+    permission::grp_perm_map->sequence( 'permission.grp_perm_map_id_seq' );
+    permission::grp_perm_map->table('permission.grp_perm_map');
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
 
-	package action::hold_transit_copy;
+    package action::hold_request;
 
-	action::hold_transit_copy->sequence( 'action.transit_copy_id_seq' );
-	action::hold_transit_copy->table('action.hold_transit_copy');
+    action::hold_request->sequence( 'action.hold_request_id_seq' );
+    action::hold_request->table('action.hold_request');
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
 
-	package action::reservation_transit_copy;
+    package action::hold_notification;
 
-	action::reservation_transit_copy->sequence( 'action.transit_copy_id_seq' );
-	action::reservation_transit_copy->table('action.reservation_transit_copy');
+    action::hold_notification->sequence( 'action.hold_notification_id_seq' );
+    action::hold_notification->table('action.hold_notification');
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
 
-	package action::transit_copy;
+    package action::hold_copy_map;
 
-	action::transit_copy->sequence( 'action.transit_copy_id_seq' );
-	action::transit_copy->table('action.transit_copy');
+    action::hold_copy_map->sequence( 'action.hold_copy_map_id_seq' );
+    action::hold_copy_map->table('action.hold_copy_map');
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
 
-	package action::unfulfilled_hold_list;
+    package action::hold_transit_copy;
 
-	action::unfulfilled_hold_list->sequence( 'action.unfulfilled_hold_list_id_seq' );
-	action::unfulfilled_hold_list->table('action.unfulfilled_hold_list');
+    action::hold_transit_copy->sequence( 'action.transit_copy_id_seq' );
+    action::hold_transit_copy->table('action.hold_transit_copy');
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
 
-	package serial::subscription;
+    package action::reservation_transit_copy;
 
-	serial::subscription->sequence( 'serial.subscription_id_seq' );
-	serial::subscription->table('serial.subscription');
+    action::reservation_transit_copy->sequence( 'action.transit_copy_id_seq' );
+    action::reservation_transit_copy->table('action.reservation_transit_copy');
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
 
-	package serial::issuance;
+    package action::transit_copy;
 
-	serial::issuance->sequence( 'serial.issuance_id_seq' );
-	serial::issuance->table('serial.issuance');
+    action::transit_copy->sequence( 'action.transit_copy_id_seq' );
+    action::transit_copy->table('action.transit_copy');
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
 
-	package serial::item;
+    package action::unfulfilled_hold_list;
 
-	serial::item->sequence( 'serial.item_id_seq' );
-	serial::item->table('serial.item');
+    action::unfulfilled_hold_list->sequence( 'action.unfulfilled_hold_list_id_seq' );
+    action::unfulfilled_hold_list->table('action.unfulfilled_hold_list');
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
 
-	package serial::unit;
+    package serial::subscription;
 
-	serial::unit->sequence( 'asset.copy_id_seq' );
-	serial::unit->table('serial.unit');
+    serial::subscription->sequence( 'serial.subscription_id_seq' );
+    serial::subscription->table('serial.subscription');
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
 
-	package config::language_map;
-	config::language_map->table('config.language_map');
+    package serial::issuance;
 
-	#-------------------------------------------------------------------------------
+    serial::issuance->sequence( 'serial.issuance_id_seq' );
+    serial::issuance->table('serial.issuance');
 
-	package config::i18n_locale;
-	config::i18n_locale->table('config.i18n_locale');
+    #-------------------------------------------------------------------------------
 
-	#-------------------------------------------------------------------------------
+    package serial::item;
 
-	package config::i18n_core;
-	config::i18n_core->sequence( 'config.i18n_core_id_seq' );
-	config::i18n_core->table('config.i18n_core');
+    serial::item->sequence( 'serial.item_id_seq' );
+    serial::item->table('serial.item');
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
 
-	package config::item_form_map;
-	config::item_form_map->table('config.item_form_map');
+    package serial::unit;
 
-	#-------------------------------------------------------------------------------
+    serial::unit->sequence( 'asset.copy_id_seq' );
+    serial::unit->table('serial.unit');
 
-	package config::lit_form_map;
-	config::lit_form_map->table('config.lit_form_map');
+    #-------------------------------------------------------------------------------
+
+    package config::language_map;
+    config::language_map->table('config.language_map');
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
 
-	package config::item_type_map;
-	config::item_type_map->table('config.item_type_map');
+    package config::i18n_locale;
+    config::i18n_locale->table('config.i18n_locale');
+
+    #-------------------------------------------------------------------------------
 
-	#-------------------------------------------------------------------------------
-	package config::audience_map;
-	config::audience_map->table('config.audience_map');
+    package config::i18n_core;
+    config::i18n_core->sequence( 'config.i18n_core_id_seq' );
+    config::i18n_core->table('config.i18n_core');
 
-	#-------------------------------------------------------------------------------
+    #-------------------------------------------------------------------------------
+
+    package config::item_form_map;
+    config::item_form_map->table('config.item_form_map');
+
+    #-------------------------------------------------------------------------------
+
+    package config::lit_form_map;
+    config::lit_form_map->table('config.lit_form_map');
+
+    #-------------------------------------------------------------------------------
+
+    package config::item_type_map;
+    config::item_type_map->table('config.item_type_map');
+
+    #-------------------------------------------------------------------------------
+    package config::audience_map;
+    config::audience_map->table('config.audience_map');
+
+    #-------------------------------------------------------------------------------
 
 
 }
 
 for my $class ( qw/
-			biblio::record_entry
-			metabib::metarecord
-			metabib::title_field_entry
-			metabib::author_field_entry
-			metabib::subject_field_entry
-			metabib::keyword_field_entry
-			metabib::series_field_entry
-			metabib::metarecord_source_map
-			metabib::record_descriptor
-			metabib::full_rec
-			authority::record_descriptor
-			authority::full_rec
-		/ ) {
-
-	(my $method_class = $class) =~ s/::/./go;
-
-	for my $type ( qw/create create_start create_push create_finish/ ) {
-		my ($name,$part) = split('_', $type);
-
-		my $apiname = "open-ils.storage.direct.$method_class.batch.$name";
-		$apiname .= ".$part" if ($part);
-
-		OpenILS::Application::Storage->register_method(
-			api_name	=> $apiname,
-			method		=> "copy_$type",
-			api_level	=> 1,
-			'package'	=> 'OpenILS::Application::Storage',
-			cdbi		=> $class,
-		);
-	}
+            biblio::record_entry
+            metabib::metarecord
+            metabib::title_field_entry
+            metabib::author_field_entry
+            metabib::subject_field_entry
+            metabib::keyword_field_entry
+            metabib::series_field_entry
+            metabib::metarecord_source_map
+            metabib::record_descriptor
+            metabib::full_rec
+            authority::record_descriptor
+            authority::full_rec
+        / ) {
+
+    (my $method_class = $class) =~ s/::/./go;
+
+    for my $type ( qw/create create_start create_push create_finish/ ) {
+        my ($name,$part) = split('_', $type);
+
+        my $apiname = "open-ils.storage.direct.$method_class.batch.$name";
+        $apiname .= ".$part" if ($part);
+
+        OpenILS::Application::Storage->register_method(
+            api_name    => $apiname,
+            method      => "copy_$type",
+            api_level   => 1,
+            'package'   => 'OpenILS::Application::Storage',
+            cdbi        => $class,
+        );
+    }
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/fts.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/fts.pm
index 2857e2a..429f9d7 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/fts.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/fts.pm
@@ -1,88 +1,88 @@
 { # Every driver needs to provide a 'compile()' method to OpenILS::Application::Storage::FTS.
   # If that driver wants to support FTI, that is...
-	#-------------------------------------------------------------------------------
-	package OpenILS::Application::Storage::FTS;
-	use OpenSRF::Utils::Logger qw/:level/;
-	use Unicode::Normalize;
-	my $log = 'OpenSRF::Utils::Logger';
-
-	sub compile {
-		my $self = shift;
-		my $class = shift;
-		my $term = NFD(shift());
-
-		$log->debug("Raw term: $term",DEBUG);
-		$log->debug("Search class: $class",DEBUG);
-
-		$term =~ s/\&//go;
-		$term =~ s/\|//go;
-
-		$self = ref($self) || $self;
-		$self = bless {} => $self;
-		$self->{class} = $class;
-
-		$term =~ s/(\pM+)//gos;
-		$term =~ s/(\b\.\b)//gos;
-
-		# hack to normalize ratio-like strings
-		while ($term =~ /\b\d{1}:[, ]?\d+(?:[ ,]\d+[^:])+/o) {
-			$term = $` . join ('', split(/[, ]/, $&)) . $';
-		}
-
-		$self->decompose($term);
-
-		my $newterm = '';
-		$newterm = join('&', $self->words) if ($self->words);
-
-		if (@{$self->nots}) {
-			$newterm = '('.$newterm.')&' if ($newterm);
-			$newterm .= '!('. join('|', $self->nots) . ')';
-		}
-
-		$log->debug("Compiled term is [$newterm]", DEBUG);
-		$newterm = OpenILS::Application::Storage::Driver::Pg->quote($newterm);
-		$log->debug("Quoted term is [$newterm]", DEBUG);
-
-		$self->{fts_query} = ["to_tsquery('$$self{class}',$newterm)"];
-		$self->{fts_query_nots} = [];
-		$self->{fts_op} = '@@';
-		$self->{text_col} = shift;
-		$self->{fts_col} = shift;
-
-		return $self;
-	}
-
-	sub sql_where_clause {
-		my $self = shift;
-		my $column = $self->fts_col;
-		my @output;
-	
-		my @ranks;
-		for my $fts ( $self->fts_query ) {
-			push @output, join(' ', $self->fts_col, $self->{fts_op}, $fts);
-			push @ranks, "ts_rank($column, $fts)";
-		}
-		$self->{fts_rank} = \@ranks;
-	
-		my $phrase_match = $self->sql_exact_phrase_match();
-		return join(' AND ', @output) . $phrase_match;
-	}
-
-	sub sql_exact_phrase_match {
-		my $self = shift;
-		my $column = $self->text_col;
-		my $output = '';
-		for my $phrase ( $self->phrases ) {
-			$phrase =~ s/\*/\\*/go;
-			$phrase =~ s/\./\\./go;
-			$phrase =~ s/'/\\'/go;
-			$phrase =~ s/\s+/\\s+/go;
-			$log->debug("Adding phrase [$phrase] to the match list", DEBUG);
-			$output .= " AND $column ~* \$\$(^|\\W+)$phrase(\\W+|\$)\$\$";
-		}
-		$log->debug("Phrase list is [$output]", DEBUG);
-		return $output;
-	}
+    #-------------------------------------------------------------------------------
+    package OpenILS::Application::Storage::FTS;
+    use OpenSRF::Utils::Logger qw/:level/;
+    use Unicode::Normalize;
+    my $log = 'OpenSRF::Utils::Logger';
+
+    sub compile {
+        my $self = shift;
+        my $class = shift;
+        my $term = NFD(shift());
+
+        $log->debug("Raw term: $term",DEBUG);
+        $log->debug("Search class: $class",DEBUG);
+
+        $term =~ s/\&//go;
+        $term =~ s/\|//go;
+
+        $self = ref($self) || $self;
+        $self = bless {} => $self;
+        $self->{class} = $class;
+
+        $term =~ s/(\pM+)//gos;
+        $term =~ s/(\b\.\b)//gos;
+
+        # hack to normalize ratio-like strings
+        while ($term =~ /\b\d{1}:[, ]?\d+(?:[ ,]\d+[^:])+/o) {
+            $term = $` . join ('', split(/[, ]/, $&)) . $';
+        }
+
+        $self->decompose($term);
+
+        my $newterm = '';
+        $newterm = join('&', $self->words) if ($self->words);
+
+        if (@{$self->nots}) {
+            $newterm = '('.$newterm.')&' if ($newterm);
+            $newterm .= '!('. join('|', $self->nots) . ')';
+        }
+
+        $log->debug("Compiled term is [$newterm]", DEBUG);
+        $newterm = OpenILS::Application::Storage::Driver::Pg->quote($newterm);
+        $log->debug("Quoted term is [$newterm]", DEBUG);
+
+        $self->{fts_query} = ["to_tsquery('$$self{class}',$newterm)"];
+        $self->{fts_query_nots} = [];
+        $self->{fts_op} = '@@';
+        $self->{text_col} = shift;
+        $self->{fts_col} = shift;
+
+        return $self;
+    }
+
+    sub sql_where_clause {
+        my $self = shift;
+        my $column = $self->fts_col;
+        my @output;
+    
+        my @ranks;
+        for my $fts ( $self->fts_query ) {
+            push @output, join(' ', $self->fts_col, $self->{fts_op}, $fts);
+            push @ranks, "ts_rank($column, $fts)";
+        }
+        $self->{fts_rank} = \@ranks;
+    
+        my $phrase_match = $self->sql_exact_phrase_match();
+        return join(' AND ', @output) . $phrase_match;
+    }
+
+    sub sql_exact_phrase_match {
+        my $self = shift;
+        my $column = $self->text_col;
+        my $output = '';
+        for my $phrase ( $self->phrases ) {
+            $phrase =~ s/\*/\\*/go;
+            $phrase =~ s/\./\\./go;
+            $phrase =~ s/'/\\'/go;
+            $phrase =~ s/\s+/\\s+/go;
+            $log->debug("Adding phrase [$phrase] to the match list", DEBUG);
+            $output .= " AND $column ~* \$\$(^|\\W+)$phrase(\\W+|\$)\$\$";
+        }
+        $log->debug("Phrase list is [$output]", DEBUG);
+        return $output;
+    }
 
 }
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/storage.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/storage.pm
index 989d84c..c9fd303 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/storage.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/storage.pm
@@ -1,392 +1,392 @@
 
 {
-	package OpenILS::Application::Storage;
-	use OpenSRF::Utils::Logger;
-
-	our $NOPRIMARY = 0;
-	my $log = 'OpenSRF::Utils::Logger';
-	my $pg = 'OpenILS::Application::Storage::Driver::Pg';
-
-	sub child_exit {
-		$_->disconnect for $pg->db_Handles;
-	}
-
-	sub current_xact {
-		my $self = shift;
-		my $client = shift;
-		return $pg->current_xact_id;
-	}
-	__PACKAGE__->register_method(
-		method		=> 'current_xact',
-		api_name	=> 'open-ils.storage.transaction.current',
-		api_level	=> 1,
-		argc		=> 0,
-	);
-
-
-	sub pg_begin_xaction {
-		my $self = shift;
-		my $client = shift;
-
-		local $OpenILS::Application::Storage::WRITE = 1;
-
-		if (my $old_xact = $pg->current_xact_session) {
-			if ($pg->current_xact_is_auto) {
-				$log->debug("Commiting old autocommit transaction with Open-ILS XACT-ID [$old_xact]", INFO);
-				$self->method_lookup("open-ils.storage.transaction.commit")->run();
-			} else {
-				$log->debug("Rolling back old NON-autocommit transaction with Open-ILS XACT-ID [$old_xact]", INFO);
-				$self->method_lookup("open-ils.storage.transaction.rollback")->run();
-				throw OpenSRF::DomainObject::oilsException->new(
-						statusCode => 500,
-						status => "Previous transaction rolled back!",
-				);
-			}
-		}
-		
-		$pg->set_xact_session( $client->session );
-		my $xact_id = $pg->current_xact_id;
-
-		$log->debug("Beginning a new transaction with Open-ILS XACT-ID [$xact_id]", INFO);
-
-		my $dbh = OpenILS::Application::Storage::CDBI->db_Main;
-		
-		try {
-			$dbh->begin_work;
-
-		} catch Error with {
-			my $e = shift;
-			$log->debug("Failed to begin a new transaction with Open-ILS XACT-ID [$xact_id]: ".$e, INFO);
-			throw $e;
-		};
-
-
-		my $death_cb = $client->session->register_callback(
-			death => sub {
-				__PACKAGE__->pg_rollback_xaction;
-			}
-		);
-
-		$log->debug("Registered 'death' callback [$death_cb] for new transaction with Open-ILS XACT-ID [$xact_id]", DEBUG);
-
-		$client->session->session_data( death_cb => $death_cb );
-
-		if ($self->api_name =~ /autocommit$/o) {
-			$pg->current_xact_is_auto(1);
-			my $dc_cb = $client->session->register_callback(
-				disconnect => sub {
-					my $ses = shift;
-					$ses->unregister_callback(death => $death_cb);
-					__PACKAGE__->pg_commit_xaction;
-				}
-			);
-			$log->debug("Registered 'disconnect' callback [$dc_cb] for new transaction with Open-ILS XACT-ID [$xact_id]", DEBUG);
-			if ($client and $client->session) {
-				$client->session->session_data( disconnect_cb => $dc_cb );
-			}
-		}
-
-		return 1;
-
-	}
-	__PACKAGE__->register_method(
-		method		=> 'pg_begin_xaction',
-		api_name	=> 'open-ils.storage.transaction.begin',
-		api_level	=> 1,
-		argc		=> 0,
-	);
-	__PACKAGE__->register_method(
-		method		=> 'pg_begin_xaction',
-		api_name	=> 'open-ils.storage.transaction.begin.autocommit',
-		api_level	=> 1,
-		argc		=> 0,
-	);
-
-	sub pg_commit_xaction {
-		my $self = shift;
-
-		local $OpenILS::Application::Storage::WRITE = 1;
-
-		my $xact_id = $pg->current_xact_id;
-
-		my $success = 1;
-		try {
-			$log->debug("Committing transaction with Open-ILS XACT-ID [$xact_id]", INFO) if ($xact_id);
-			my $dbh = OpenILS::Application::Storage::CDBI->db_Main;
-			$dbh->commit;
-
-		} catch Error with {
-			my $e = shift;
-			$log->debug("Failed to commit transaction with Open-ILS XACT-ID [$xact_id]: ".$e, INFO);
-			$success = 0;
-		};
-		
-		$pg->current_xact_session->unregister_callback( death => 
-			$pg->current_xact_session->session_data( 'death_cb' )
-		) if ($pg->current_xact_session);
-
-		if ($pg->current_xact_is_auto) {
-			$pg->current_xact_session->unregister_callback( disconnect => 
-				$pg->current_xact_session->session_data( 'disconnect_cb' )
-			);
-		}
-
-		$pg->unset_xact_session;
-
-		return $success;
-		
-	}
-	__PACKAGE__->register_method(
-		method		=> 'pg_commit_xaction',
-		api_name	=> 'open-ils.storage.transaction.commit',
-		api_level	=> 1,
-		argc		=> 0,
-	);
-
-	sub pg_rollback_xaction {
-		my $self = shift;
-
-		local $OpenILS::Application::Storage::WRITE = 1;
-
-		my $xact_id = $pg->current_xact_id;
-
-		my $success = 1;
-		try {
-			my $dbh = OpenILS::Application::Storage::CDBI->db_Main;
-			$log->debug("Rolling back a transaction with Open-ILS XACT-ID [$xact_id]", INFO);
-			$dbh->rollback;
-
-		} catch Error with {
-			my $e = shift;
-			$log->debug("Failed to roll back transaction with Open-ILS XACT-ID [$xact_id]: ".$e, INFO);
-			$success = 0;
-		};
-	
-		$pg->current_xact_session->unregister_callback( death =>
-			$pg->current_xact_session->session_data( 'death_cb' )
-		) if ($pg->current_xact_session);
-
-		if ($pg->current_xact_is_auto) {
-			$pg->current_xact_session->unregister_callback( disconnect =>
-				$pg->current_xact_session->session_data( 'disconnect_cb' )
-			);
-		}
-
-		$pg->unset_xact_session;
-
-		return $success;
-	}
-	__PACKAGE__->register_method(
-		method		=> 'pg_rollback_xaction',
-		api_name	=> 'open-ils.storage.transaction.rollback',
-		api_level	=> 1,
-		argc		=> 0,
-	);
-
-	sub set_savepoint {
-		my $self = shift;
-		my $client = shift;
-		my $sp = shift || 'osrf_savepoint';
-		return OpenILS::Application::Storage::CDBI->db_Main->pg_savepoint($sp);
-	}
-	__PACKAGE__->register_method(
-        	method          => 'set_savepoint',
-	        api_name        => 'open-ils.storage.savepoint.set',
-        	api_level       => 1,
-	        argc            => 1,
-	);
-
-	sub release_savepoint {
-		my $self = shift;
-		my $client = shift;
-		my $sp = shift || 'osrf_savepoint';
-		return OpenILS::Application::Storage::CDBI->db_Main->pg_release($sp);
-	}
-	__PACKAGE__->register_method(
-        	method          => 'release_savepoint',
-	        api_name        => 'open-ils.storage.savepoint.release',
-        	api_level       => 1,
-	        argc            => 1,
-	);
-
-	sub rollback_to_savepoint {
-		my $self = shift;
-		my $client = shift;
-		my $sp = shift || 'osrf_savepoint';
-		return OpenILS::Application::Storage::CDBI->db_Main->pg_rollback_to($sp);
-	}
-	__PACKAGE__->register_method(
-        	method          => 'rollback_to_savepoint',
-	        api_name        => 'open-ils.storage.savepoint.rollback',
-        	api_level       => 1,
-	        argc            => 1,
-	);
-
-	sub pg_set_audit_info {
-		my $self = shift;
-		my $client = shift;
-		my $authtoken = shift;
-		my $user_id = shift;
-		my $ws_id = shift;
-
-		local $OpenILS::Application::Storage::WRITE = 1;
-
-		$log->debug("Setting auditor information", INFO);
-
-		if($pg->current_audit_session) {
-			$log->debug("Already sent audit data.", INFO);
-			return 1;
-		}
-
-		my $dbh = OpenILS::Application::Storage::CDBI->db_Main;
-		
-		try {
-			if(!$user_id) {
-				my $ses = OpenSRF::AppSession->create('open-ils.auth');
-				my $content = $ses->request('open-ils.auth.session.retrieve', $authtoken, 1)->gather(1);
-				if(!$content or !$content->{userObj}) {
-					return 0;
-				}
-				$user_id = $content->{userObj}->id;
-				$ws_id = $content->{userObj}->wsid;
-			}
-			$ws_id = 'NULL' unless $ws_id;
-			$dbh->do("SELECT auditor.set_audit_info($user_id, $ws_id);");
-		} catch Error with {
-			my $e = shift;
-			$log->debug("Failed to set auditor information: ".$e, INFO);
-			throw $e;
-		};
-
-		$pg->set_audit_session( $client->session );
-
-		my $death_cb = $client->session->register_callback(
-			death => sub {
-				__PACKAGE__->pg_clear_audit_info;
-			}
-		);
-
-		$log->debug("Registered 'death' callback [$death_cb] for clearing audit information", DEBUG);
-
-		$client->session->session_data( death_cb_ai => $death_cb );
-
-		return 1;
-
-	}
-	__PACKAGE__->register_method(
-		method		=> 'pg_set_audit_info',
-		api_name	=> 'open-ils.storage.set_audit_info',
-		api_level	=> 1,
-		argc		=> 3,
-	);
-
-	sub pg_clear_audit_info {
-		my $self = shift;
-
-		try {
-			my $dbh = OpenILS::Application::Storage::CDBI->db_Main;
-			$log->debug("Clearing Audit Information", INFO);
-			$dbh->do("SELECT auditor.clear_audit_info();");
-		} catch Error with {
-			my $e = shift;
-			$log->debug("Failed to clear audit information: ".$e, INFO);
-		};
-
-		$pg->current_audit_session->unregister_callback( death => 
-			$pg->current_audit_session->session_data( 'death_cb_ai' )
-		) if ($pg->current_audit_session);
-
-		$pg->unset_audit_session;
-	}
-
-
-
-	sub copy_create_start {
-		my $self = shift;
-		my $client = shift;
-
-		local $OpenILS::Application::Storage::WRITE = 1;
-
-		#return undef unless ($pg->current_xact_session);
-
-		my @cols = $self->{cdbi}->columns('Essential');
-		if ($NOPRIMARY) {
-			my ($p) = $self->{cdbi}->columns('Primary');
-			@cols = grep { $_ ne $p } @cols;
-		}
-
-		my $col_list = join ',', @cols;
+    package OpenILS::Application::Storage;
+    use OpenSRF::Utils::Logger;
+
+    our $NOPRIMARY = 0;
+    my $log = 'OpenSRF::Utils::Logger';
+    my $pg = 'OpenILS::Application::Storage::Driver::Pg';
+
+    sub child_exit {
+        $_->disconnect for $pg->db_Handles;
+    }
+
+    sub current_xact {
+        my $self = shift;
+        my $client = shift;
+        return $pg->current_xact_id;
+    }
+    __PACKAGE__->register_method(
+        method      => 'current_xact',
+        api_name    => 'open-ils.storage.transaction.current',
+        api_level   => 1,
+        argc        => 0,
+    );
+
+
+    sub pg_begin_xaction {
+        my $self = shift;
+        my $client = shift;
+
+        local $OpenILS::Application::Storage::WRITE = 1;
+
+        if (my $old_xact = $pg->current_xact_session) {
+            if ($pg->current_xact_is_auto) {
+                $log->debug("Commiting old autocommit transaction with Open-ILS XACT-ID [$old_xact]", INFO);
+                $self->method_lookup("open-ils.storage.transaction.commit")->run();
+            } else {
+                $log->debug("Rolling back old NON-autocommit transaction with Open-ILS XACT-ID [$old_xact]", INFO);
+                $self->method_lookup("open-ils.storage.transaction.rollback")->run();
+                throw OpenSRF::DomainObject::oilsException->new(
+                        statusCode => 500,
+                        status => "Previous transaction rolled back!",
+                );
+            }
+        }
+        
+        $pg->set_xact_session( $client->session );
+        my $xact_id = $pg->current_xact_id;
+
+        $log->debug("Beginning a new transaction with Open-ILS XACT-ID [$xact_id]", INFO);
+
+        my $dbh = OpenILS::Application::Storage::CDBI->db_Main;
+        
+        try {
+            $dbh->begin_work;
+
+        } catch Error with {
+            my $e = shift;
+            $log->debug("Failed to begin a new transaction with Open-ILS XACT-ID [$xact_id]: ".$e, INFO);
+            throw $e;
+        };
+
+
+        my $death_cb = $client->session->register_callback(
+            death => sub {
+                __PACKAGE__->pg_rollback_xaction;
+            }
+        );
+
+        $log->debug("Registered 'death' callback [$death_cb] for new transaction with Open-ILS XACT-ID [$xact_id]", DEBUG);
+
+        $client->session->session_data( death_cb => $death_cb );
+
+        if ($self->api_name =~ /autocommit$/o) {
+            $pg->current_xact_is_auto(1);
+            my $dc_cb = $client->session->register_callback(
+                disconnect => sub {
+                    my $ses = shift;
+                    $ses->unregister_callback(death => $death_cb);
+                    __PACKAGE__->pg_commit_xaction;
+                }
+            );
+            $log->debug("Registered 'disconnect' callback [$dc_cb] for new transaction with Open-ILS XACT-ID [$xact_id]", DEBUG);
+            if ($client and $client->session) {
+                $client->session->session_data( disconnect_cb => $dc_cb );
+            }
+        }
+
+        return 1;
+
+    }
+    __PACKAGE__->register_method(
+        method      => 'pg_begin_xaction',
+        api_name    => 'open-ils.storage.transaction.begin',
+        api_level   => 1,
+        argc        => 0,
+    );
+    __PACKAGE__->register_method(
+        method      => 'pg_begin_xaction',
+        api_name    => 'open-ils.storage.transaction.begin.autocommit',
+        api_level   => 1,
+        argc        => 0,
+    );
+
+    sub pg_commit_xaction {
+        my $self = shift;
+
+        local $OpenILS::Application::Storage::WRITE = 1;
+
+        my $xact_id = $pg->current_xact_id;
+
+        my $success = 1;
+        try {
+            $log->debug("Committing transaction with Open-ILS XACT-ID [$xact_id]", INFO) if ($xact_id);
+            my $dbh = OpenILS::Application::Storage::CDBI->db_Main;
+            $dbh->commit;
+
+        } catch Error with {
+            my $e = shift;
+            $log->debug("Failed to commit transaction with Open-ILS XACT-ID [$xact_id]: ".$e, INFO);
+            $success = 0;
+        };
+        
+        $pg->current_xact_session->unregister_callback( death => 
+            $pg->current_xact_session->session_data( 'death_cb' )
+        ) if ($pg->current_xact_session);
+
+        if ($pg->current_xact_is_auto) {
+            $pg->current_xact_session->unregister_callback( disconnect => 
+                $pg->current_xact_session->session_data( 'disconnect_cb' )
+            );
+        }
+
+        $pg->unset_xact_session;
+
+        return $success;
+        
+    }
+    __PACKAGE__->register_method(
+        method      => 'pg_commit_xaction',
+        api_name    => 'open-ils.storage.transaction.commit',
+        api_level   => 1,
+        argc        => 0,
+    );
+
+    sub pg_rollback_xaction {
+        my $self = shift;
+
+        local $OpenILS::Application::Storage::WRITE = 1;
+
+        my $xact_id = $pg->current_xact_id;
+
+        my $success = 1;
+        try {
+            my $dbh = OpenILS::Application::Storage::CDBI->db_Main;
+            $log->debug("Rolling back a transaction with Open-ILS XACT-ID [$xact_id]", INFO);
+            $dbh->rollback;
+
+        } catch Error with {
+            my $e = shift;
+            $log->debug("Failed to roll back transaction with Open-ILS XACT-ID [$xact_id]: ".$e, INFO);
+            $success = 0;
+        };
+    
+        $pg->current_xact_session->unregister_callback( death =>
+            $pg->current_xact_session->session_data( 'death_cb' )
+        ) if ($pg->current_xact_session);
+
+        if ($pg->current_xact_is_auto) {
+            $pg->current_xact_session->unregister_callback( disconnect =>
+                $pg->current_xact_session->session_data( 'disconnect_cb' )
+            );
+        }
+
+        $pg->unset_xact_session;
+
+        return $success;
+    }
+    __PACKAGE__->register_method(
+        method      => 'pg_rollback_xaction',
+        api_name    => 'open-ils.storage.transaction.rollback',
+        api_level   => 1,
+        argc        => 0,
+    );
+
+    sub set_savepoint {
+        my $self = shift;
+        my $client = shift;
+        my $sp = shift || 'osrf_savepoint';
+        return OpenILS::Application::Storage::CDBI->db_Main->pg_savepoint($sp);
+    }
+    __PACKAGE__->register_method(
+            method          => 'set_savepoint',
+            api_name        => 'open-ils.storage.savepoint.set',
+            api_level       => 1,
+            argc            => 1,
+    );
+
+    sub release_savepoint {
+        my $self = shift;
+        my $client = shift;
+        my $sp = shift || 'osrf_savepoint';
+        return OpenILS::Application::Storage::CDBI->db_Main->pg_release($sp);
+    }
+    __PACKAGE__->register_method(
+            method          => 'release_savepoint',
+            api_name        => 'open-ils.storage.savepoint.release',
+            api_level       => 1,
+            argc            => 1,
+    );
+
+    sub rollback_to_savepoint {
+        my $self = shift;
+        my $client = shift;
+        my $sp = shift || 'osrf_savepoint';
+        return OpenILS::Application::Storage::CDBI->db_Main->pg_rollback_to($sp);
+    }
+    __PACKAGE__->register_method(
+            method          => 'rollback_to_savepoint',
+            api_name        => 'open-ils.storage.savepoint.rollback',
+            api_level       => 1,
+            argc            => 1,
+    );
+
+    sub pg_set_audit_info {
+        my $self = shift;
+        my $client = shift;
+        my $authtoken = shift;
+        my $user_id = shift;
+        my $ws_id = shift;
+
+        local $OpenILS::Application::Storage::WRITE = 1;
+
+        $log->debug("Setting auditor information", INFO);
+
+        if($pg->current_audit_session) {
+            $log->debug("Already sent audit data.", INFO);
+            return 1;
+        }
+
+        my $dbh = OpenILS::Application::Storage::CDBI->db_Main;
+        
+        try {
+            if(!$user_id) {
+                my $ses = OpenSRF::AppSession->create('open-ils.auth');
+                my $content = $ses->request('open-ils.auth.session.retrieve', $authtoken, 1)->gather(1);
+                if(!$content or !$content->{userObj}) {
+                    return 0;
+                }
+                $user_id = $content->{userObj}->id;
+                $ws_id = $content->{userObj}->wsid;
+            }
+            $ws_id = 'NULL' unless $ws_id;
+            $dbh->do("SELECT auditor.set_audit_info($user_id, $ws_id);");
+        } catch Error with {
+            my $e = shift;
+            $log->debug("Failed to set auditor information: ".$e, INFO);
+            throw $e;
+        };
+
+        $pg->set_audit_session( $client->session );
+
+        my $death_cb = $client->session->register_callback(
+            death => sub {
+                __PACKAGE__->pg_clear_audit_info;
+            }
+        );
+
+        $log->debug("Registered 'death' callback [$death_cb] for clearing audit information", DEBUG);
+
+        $client->session->session_data( death_cb_ai => $death_cb );
+
+        return 1;
+
+    }
+    __PACKAGE__->register_method(
+        method      => 'pg_set_audit_info',
+        api_name    => 'open-ils.storage.set_audit_info',
+        api_level   => 1,
+        argc        => 3,
+    );
+
+    sub pg_clear_audit_info {
+        my $self = shift;
+
+        try {
+            my $dbh = OpenILS::Application::Storage::CDBI->db_Main;
+            $log->debug("Clearing Audit Information", INFO);
+            $dbh->do("SELECT auditor.clear_audit_info();");
+        } catch Error with {
+            my $e = shift;
+            $log->debug("Failed to clear audit information: ".$e, INFO);
+        };
+
+        $pg->current_audit_session->unregister_callback( death => 
+            $pg->current_audit_session->session_data( 'death_cb_ai' )
+        ) if ($pg->current_audit_session);
+
+        $pg->unset_audit_session;
+    }
+
+
+
+    sub copy_create_start {
+        my $self = shift;
+        my $client = shift;
+
+        local $OpenILS::Application::Storage::WRITE = 1;
+
+        #return undef unless ($pg->current_xact_session);
+
+        my @cols = $self->{cdbi}->columns('Essential');
+        if ($NOPRIMARY) {
+            my ($p) = $self->{cdbi}->columns('Primary');
+            @cols = grep { $_ ne $p } @cols;
+        }
+
+        my $col_list = join ',', @cols;
 
-		$log->debug('Starting COPY import for '.$self->{cdbi}->table." ($col_list)", DEBUG);
-		$self->{cdbi}->sql_copy_start($self->{cdbi}->table, $col_list)->execute;
+        $log->debug('Starting COPY import for '.$self->{cdbi}->table." ($col_list)", DEBUG);
+        $self->{cdbi}->sql_copy_start($self->{cdbi}->table, $col_list)->execute;
 
-		return 1;
-	}
+        return 1;
+    }
 
-	sub copy_create_push {
-		my $self = shift;
-		my $client = shift;
-		my @fm_nodes = @_;
+    sub copy_create_push {
+        my $self = shift;
+        my $client = shift;
+        my @fm_nodes = @_;
 
-		local $OpenILS::Application::Storage::WRITE = 1;
+        local $OpenILS::Application::Storage::WRITE = 1;
 
-		#return undef unless ($pg->current_xact_session);
+        #return undef unless ($pg->current_xact_session);
 
-		my @cols = $self->{cdbi}->columns('Essential');
-		if ($NOPRIMARY) {
-			my ($p) = $self->{cdbi}->columns('Primary');
-			@cols = grep { $_ ne $p } @cols;
-		}
+        my @cols = $self->{cdbi}->columns('Essential');
+        if ($NOPRIMARY) {
+            my ($p) = $self->{cdbi}->columns('Primary');
+            @cols = grep { $_ ne $p } @cols;
+        }
 
-		my $dbh = $self->{cdbi}->db_Main;
-		for my $node ( @fm_nodes ) {
-			next unless ($node);
-			my $line = join("\t", map { defined($node->$_()) ? $node->$_() : '\N' } @cols);
-			$log->debug("COPY line: [$line]",DEBUG);
-			$dbh->pg_putline($line."\n");
-		}
+        my $dbh = $self->{cdbi}->db_Main;
+        for my $node ( @fm_nodes ) {
+            next unless ($node);
+            my $line = join("\t", map { defined($node->$_()) ? $node->$_() : '\N' } @cols);
+            $log->debug("COPY line: [$line]",DEBUG);
+            $dbh->pg_putline($line."\n");
+        }
 
-		return scalar(@fm_nodes);
-	}
+        return scalar(@fm_nodes);
+    }
 
-	sub copy_create_finish {
-		my $self = shift;
-		my $client = shift;
-		my @fm_nodes = @_;
+    sub copy_create_finish {
+        my $self = shift;
+        my $client = shift;
+        my @fm_nodes = @_;
 
-		local $OpenILS::Application::Storage::WRITE = 1;
+        local $OpenILS::Application::Storage::WRITE = 1;
 
-		#return undef unless ($pg->current_xact_session);
+        #return undef unless ($pg->current_xact_session);
 
-		my $dbh = $self->{cdbi}->db_Main;
+        my $dbh = $self->{cdbi}->db_Main;
 
-		$dbh->pg_endcopy || $log->debug("Could not end COPY with pg_endcopy", WARN);
+        $dbh->pg_endcopy || $log->debug("Could not end COPY with pg_endcopy", WARN);
 
-		$log->debug('COPY import for '.$self->{cdbi}->table." ($col_list) complete", DEBUG);
+        $log->debug('COPY import for '.$self->{cdbi}->table." ($col_list) complete", DEBUG);
 
-		return 1;
-	}
+        return 1;
+    }
 
-	sub copy_create {
-		my $self = shift;
-		my $client = shift;
-		my @fm_nodes = @_;
+    sub copy_create {
+        my $self = shift;
+        my $client = shift;
+        my @fm_nodes = @_;
 
-		local $NOPRIMARY = 1;
+        local $NOPRIMARY = 1;
 
-		copy_create_start(  $self => $client );
-		copy_create_push(   $self => $client => @fm_nodes );
-		copy_create_finish( $self => $client );
+        copy_create_start(  $self => $client );
+        copy_create_push(   $self => $client => @fm_nodes );
+        copy_create_finish( $self => $client );
 
-		return scalar(@fm_nodes);
-	}
+        return scalar(@fm_nodes);
+    }
 
-	sub autoprimary {
-		my $class = shift;
-		my $val = shift;
-		$NOPRIMARY = $val if (defined $val);
-		return $NOPRIMARY;
-	}
+    sub autoprimary {
+        my $class = shift;
+        my $val = shift;
+        $NOPRIMARY = $val if (defined $val);
+        return $NOPRIMARY;
+    }
 
 }
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/FTS.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/FTS.pm
index 05c4dec..8c9e62e 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/FTS.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/FTS.pm
@@ -29,223 +29,223 @@ GRAMMAR
 
 sub compile {
 
-	$log->debug("You must override me somewhere, or I will make searching really slow!!!!",ERROR);;
+    $log->debug("You must override me somewhere, or I will make searching really slow!!!!",ERROR);;
 
-	my $self = shift;
-	my $class = shift;
-	my $term = shift;
+    my $self = shift;
+    my $class = shift;
+    my $term = shift;
 
-	$self = ref($self) || $self;
-	$self = bless {} => $self;
+    $self = ref($self) || $self;
+    $self = bless {} => $self;
 
-	$self->decompose($term);
+    $self->decompose($term);
 
-	for my $part ( $self->words, $self->phrases ) {
-		$part = OpenILS::Application::Storage::CDBI->quote($part);
-		push @{ $self->{ fts_query } },   "'\%$part\%'";
-	}
+    for my $part ( $self->words, $self->phrases ) {
+        $part = OpenILS::Application::Storage::CDBI->quote($part);
+        push @{ $self->{ fts_query } },   "'\%$part\%'";
+    }
 
-	for my $part ( $self->nots ) {
-		$part = OpenILS::Application::Storage::CDBI->quote($part);
-		push @{ $self->{ fts_query_not } },   "'\%$part\%'";
-	}
+    for my $part ( $self->nots ) {
+        $part = OpenILS::Application::Storage::CDBI->quote($part);
+        push @{ $self->{ fts_query_not } },   "'\%$part\%'";
+    }
 }
 
 sub decompose {
-	my $self = shift;
-	my $term = shift;
-	my $parser = shift || $_default_grammar_parser;
-
-	$term =~ s/:/ /go;
-	$term =~ s/\s+--\s+/ /go;
-	$term =~ s/(?:&[^;]+;)//go;
-	$term =~ s/\s+/ /go;
-	$term =~ s/(^|\s+)-(\w+)/$1!$2/go;
-	$term =~ s/\b(\+)(\w+)/$2/go;
-	$term =~ s/^\s*\b(.+)\b\s*$/$1/o;
-	$term =~ s/(\d{4})-(\d{4})/$1 $2/go;
-	#$term =~ s/^(?:an?|the)\b(.*)/$1/o;
-
-	$log->debug("Stripped search term string is [$term]",DEBUG);
-
-	my $parsetree = $parser->search_expression( $term );
-	my @words = $term =~ /\b((?<!!)\w+)\b/go;
-	my @nots = $term =~ /\b(?<=!)(\w+)\b/go;
-
-	$log->debug("Stripped words are[".join(', ', at words)."]",DEBUG);
-	$log->debug("Stripped nots are[".join(', ', at nots)."]",DEBUG);
-
-	my @parts;
-	while ($term =~ s/ ((?<!\\)"{1}) (.*?) ((?<!\\)"){1} //x) {
-		my $part = $2;
-		$part =~ s/^\s*//o;
-		$part =~ s/\s*$//o;
-		next unless $part;
-		push @parts, lc($part);
-	}
-
-	$self->{ fts_op } = 'ILIKE';
-	$self->{ fts_col } = $self->{ text_col } = 'value';
-	$self->{ raw } = $term;
-	$self->{ parsetree } = $parsetree;
-	$self->{ words } = \@words;
-	$self->{ nots } = \@nots;
-	$self->{ phrases } = \@parts;
-
-	return $self;
+    my $self = shift;
+    my $term = shift;
+    my $parser = shift || $_default_grammar_parser;
+
+    $term =~ s/:/ /go;
+    $term =~ s/\s+--\s+/ /go;
+    $term =~ s/(?:&[^;]+;)//go;
+    $term =~ s/\s+/ /go;
+    $term =~ s/(^|\s+)-(\w+)/$1!$2/go;
+    $term =~ s/\b(\+)(\w+)/$2/go;
+    $term =~ s/^\s*\b(.+)\b\s*$/$1/o;
+    $term =~ s/(\d{4})-(\d{4})/$1 $2/go;
+    #$term =~ s/^(?:an?|the)\b(.*)/$1/o;
+
+    $log->debug("Stripped search term string is [$term]",DEBUG);
+
+    my $parsetree = $parser->search_expression( $term );
+    my @words = $term =~ /\b((?<!!)\w+)\b/go;
+    my @nots = $term =~ /\b(?<=!)(\w+)\b/go;
+
+    $log->debug("Stripped words are[".join(', ', at words)."]",DEBUG);
+    $log->debug("Stripped nots are[".join(', ', at nots)."]",DEBUG);
+
+    my @parts;
+    while ($term =~ s/ ((?<!\\)"{1}) (.*?) ((?<!\\)"){1} //x) {
+        my $part = $2;
+        $part =~ s/^\s*//o;
+        $part =~ s/\s*$//o;
+        next unless $part;
+        push @parts, lc($part);
+    }
+
+    $self->{ fts_op } = 'ILIKE';
+    $self->{ fts_col } = $self->{ text_col } = 'value';
+    $self->{ raw } = $term;
+    $self->{ parsetree } = $parsetree;
+    $self->{ words } = \@words;
+    $self->{ nots } = \@nots;
+    $self->{ phrases } = \@parts;
+
+    return $self;
 }
 
 sub fts_query_not {
-	my $self = shift;
-	return wantarray ? @{ $self->{fts_query_not} } : $self->{fts_query_not};
+    my $self = shift;
+    return wantarray ? @{ $self->{fts_query_not} } : $self->{fts_query_not};
 }
 
 sub fts_rank {
-	my $self = shift;
-	return wantarray ? @{ $self->{fts_rank} } : $self->{fts_rank};
+    my $self = shift;
+    return wantarray ? @{ $self->{fts_rank} } : $self->{fts_rank};
 }
 
 sub fts_query {
-	my $self = shift;
-	return wantarray ? @{ $self->{fts_query} } : $self->{fts_query};
+    my $self = shift;
+    return wantarray ? @{ $self->{fts_query} } : $self->{fts_query};
 }
 
 sub raw {
-	my $self = shift;
-	return $self->{raw};
+    my $self = shift;
+    return $self->{raw};
 }
 
 sub parse_tree {
-	my $self = shift;
-	return $self->{parsetree};
+    my $self = shift;
+    return $self->{parsetree};
 }
 
 sub fts_col {
-	my $self = shift;
-	return $self->{fts_col};
+    my $self = shift;
+    return $self->{fts_col};
 }
 
 sub text_col {
-	my $self = shift;
-	return $self->{text_col};
+    my $self = shift;
+    return $self->{text_col};
 }
 
 sub phrases {
-	my $self = shift;
-	return wantarray ? @{ $self->{phrases} } : $self->{phrases};
+    my $self = shift;
+    return wantarray ? @{ $self->{phrases} } : $self->{phrases};
 }
 
 sub words {
-	my $self = shift;
-	return wantarray ? @{ $self->{words} } : $self->{words};
+    my $self = shift;
+    return wantarray ? @{ $self->{words} } : $self->{words};
 }
 
 sub nots {
-	my $self = shift;
-	return wantarray ? @{ $self->{nots} } : $self->{nots};
+    my $self = shift;
+    return wantarray ? @{ $self->{nots} } : $self->{nots};
 }
 
 sub sql_exact_phrase_match {
-	my $self = shift;
-	my $column = $self->text_col;
-	my $output = '';
-	for my $phrase ( $self->phrases ) {
-		$phrase =~ s/%/\\%/go;
-		$phrase =~ s/_/\\_/go;
-		$phrase =~ s/'/\\'/go;
-		$log->debug("Adding phrase [$phrase] to the match list", DEBUG);
-		$output .= " AND $column ILIKE '\%$phrase\%'";
-	}
-	$log->debug("Phrase list is [$output]", DEBUG);
-	return $output;
+    my $self = shift;
+    my $column = $self->text_col;
+    my $output = '';
+    for my $phrase ( $self->phrases ) {
+        $phrase =~ s/%/\\%/go;
+        $phrase =~ s/_/\\_/go;
+        $phrase =~ s/'/\\'/go;
+        $log->debug("Adding phrase [$phrase] to the match list", DEBUG);
+        $output .= " AND $column ILIKE '\%$phrase\%'";
+    }
+    $log->debug("Phrase list is [$output]", DEBUG);
+    return $output;
 }
 
 sub sql_exact_word_bump {
-	my $self = shift;
-	my $bump = shift || '0.1';
-
-	my $column = $self->text_col;
-	my $output = '';
-	for my $word ( $self->words ) {
-		$word =~ s/%/\\%/go;
-		$word =~ s/_/\\_/go;
-		$word =~ s/'/''/go;
-		$log->debug("Adding word [$word] to the relevancy bump list", DEBUG);
-		$output .= " + CASE WHEN $column ILIKE '\%$word\%' THEN $bump ELSE 0 END";
-	}
-	$log->debug("Word bump list is [$output]", DEBUG);
-	return $output;
+    my $self = shift;
+    my $bump = shift || '0.1';
+
+    my $column = $self->text_col;
+    my $output = '';
+    for my $word ( $self->words ) {
+        $word =~ s/%/\\%/go;
+        $word =~ s/_/\\_/go;
+        $word =~ s/'/''/go;
+        $log->debug("Adding word [$word] to the relevancy bump list", DEBUG);
+        $output .= " + CASE WHEN $column ILIKE '\%$word\%' THEN $bump ELSE 0 END";
+    }
+    $log->debug("Word bump list is [$output]", DEBUG);
+    return $output;
 }
 
 sub sql_where_clause {
-	my $self = shift;
-	my @output;
+    my $self = shift;
+    my @output;
 
-	for my $fts ( $self->fts_query ) {
-		push @output, join(' ', $self->fts_col, $self->{fts_op}, $fts);
-	}
+    for my $fts ( $self->fts_query ) {
+        push @output, join(' ', $self->fts_col, $self->{fts_op}, $fts);
+    }
 
-	for my $fts ( $self->fts_query_not ) {
-		push @output, 'NOT (' . join(' ', $self->fts_col, $self->{fts_op}, $fts) . ')';
-	}
+    for my $fts ( $self->fts_query_not ) {
+        push @output, 'NOT (' . join(' ', $self->fts_col, $self->{fts_op}, $fts) . ')';
+    }
 
-	my $phrase_match = $self->sql_exact_phrase_match();
-	return join(' AND ', @output); 
+    my $phrase_match = $self->sql_exact_phrase_match();
+    return join(' AND ', @output); 
 }
 
 #-------------------------------------------------------------------------------
 use UNIVERSAL::require; 
 BEGIN {                 
-	'Class::DBI::Frozen::301'->use or 'Class::DBI'->use or die $@;
+    'Class::DBI::Frozen::301'->use or 'Class::DBI'->use or die $@;
 }     
 
 package Class::DBI;
 
 {
-	no warnings;
-	no strict;
-	sub _do_search {
-		my ($proto, $search_type, @args) = @_;
-		my $class = ref $proto || $proto;
-		
-		my (@cols, @vals);
-		my $search_opts = (@args > 1 and ref($args[-1]) eq 'HASH') ? pop @args : {};
-
-		@args = %{ $args[0] } if ref $args[0] eq "HASH";
-
-		$search_opts->{offset} = int($search_opts->{page} - 1) * int($search_opts->{page_size})  if ($search_opts->{page_size});
-		$search_opts->{_placeholder} ||= '?';
-
-		my @frags;
-		while (my ($col, $val) = splice @args, 0, 2) {
-			my $column = $class->find_column($col)
-				|| (List::Util::first { $_->accessor eq $col } $class->columns)
-				|| $class->_croak("$col is not a column of $class");
-
-			if (!defined($val)) {
-				push @frags, "$col IS NULL";
-			} elsif (ref($val) and ref($val) eq 'ARRAY') {
-				push @frags, "$col IN (".join(',',map{'?'}@$val).")";
-				for my $v (@$val) {
-					push @vals, ''.$class->_deflated_column($column, $v);
-				}
-			} else {
-				push @frags, "$col $search_type $$search_opts{_placeholder}";
-				push @vals, $class->_deflated_column($column, $val);
-			}
-		}
-
-		my $frag = join " AND ", @frags;
-
-		$frag .= " ORDER BY $search_opts->{order_by}"
-			if $search_opts->{order_by};
-		$frag .= " LIMIT $search_opts->{limit}"
-			if $search_opts->{limit};
-		$frag .= " OFFSET $search_opts->{offset}"
-			if ($search_opts->{limit} && defined($search_opts->{offset}));
-
-		return $class->sth_to_objects($class->sql_Retrieve($frag), \@vals);
-	}
+    no warnings;
+    no strict;
+    sub _do_search {
+        my ($proto, $search_type, @args) = @_;
+        my $class = ref $proto || $proto;
+        
+        my (@cols, @vals);
+        my $search_opts = (@args > 1 and ref($args[-1]) eq 'HASH') ? pop @args : {};
+
+        @args = %{ $args[0] } if ref $args[0] eq "HASH";
+
+        $search_opts->{offset} = int($search_opts->{page} - 1) * int($search_opts->{page_size})  if ($search_opts->{page_size});
+        $search_opts->{_placeholder} ||= '?';
+
+        my @frags;
+        while (my ($col, $val) = splice @args, 0, 2) {
+            my $column = $class->find_column($col)
+                || (List::Util::first { $_->accessor eq $col } $class->columns)
+                || $class->_croak("$col is not a column of $class");
+
+            if (!defined($val)) {
+                push @frags, "$col IS NULL";
+            } elsif (ref($val) and ref($val) eq 'ARRAY') {
+                push @frags, "$col IN (".join(',',map{'?'}@$val).")";
+                for my $v (@$val) {
+                    push @vals, ''.$class->_deflated_column($column, $v);
+                }
+            } else {
+                push @frags, "$col $search_type $$search_opts{_placeholder}";
+                push @vals, $class->_deflated_column($column, $val);
+            }
+        }
+
+        my $frag = join " AND ", @frags;
+
+        $frag .= " ORDER BY $search_opts->{order_by}"
+            if $search_opts->{order_by};
+        $frag .= " LIMIT $search_opts->{limit}"
+            if $search_opts->{limit};
+        $frag .= " OFFSET $search_opts->{offset}"
+            if ($search_opts->{limit} && defined($search_opts->{offset}));
+
+        return $class->sth_to_objects($class->sql_Retrieve($frag), \@vals);
+    }
 }
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher.pm
index 658fa22..a10d1d3 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher.pm
@@ -12,406 +12,406 @@ my $log = 'OpenSRF::Utils::Logger';
 
 
 sub register_method {
-	my $class = shift;
-	my %args = @_;
-	my %dup_args = %args;
-
-	$class = ref($class) || $class;
-
-	$args{package} ||= $class;
-	__PACKAGE__->SUPER::register_method( %args );
-
-	if (exists($dup_args{cachable}) and $dup_args{cachable}) {
-		(my $name = $dup_args{api_name}) =~ s/^open-ils\.storage/open-ils.storage.cachable/o;
-		if ($name ne $dup_args{api_name}) {
-			$dup_args{real_api_name} = $dup_args{api_name};
-			$dup_args{method} = 'cachable_wrapper';
-			$dup_args{api_name} = $name;
-			$dup_args{package} = __PACKAGE__;
-			__PACKAGE__->SUPER::register_method( %dup_args );
-		}
-	}
-
-	if ($dup_args{real_api_name} =~ /^open-ils\.storage\.direct\..+\.search.+/o ||
-	    $dup_args{api_name} =~ /^open-ils\.storage\.direct\..+\.search.+/o) {
-		$dup_args{api_name} = $dup_args{real_api_name} if ($dup_args{real_api_name});
-
-		(my $name = $dup_args{api_name}) =~ s/\.direct\./.id_list./o;
-
-		$dup_args{notes} = $dup_args{real_api_name};
-		$dup_args{real_api_name} = $dup_args{api_name};
-		$dup_args{method} = 'search_ids';
-		$dup_args{api_name} = $name;
-		$dup_args{package} = __PACKAGE__;
-
-		__PACKAGE__->SUPER::register_method( %dup_args );
-	}
+    my $class = shift;
+    my %args = @_;
+    my %dup_args = %args;
+
+    $class = ref($class) || $class;
+
+    $args{package} ||= $class;
+    __PACKAGE__->SUPER::register_method( %args );
+
+    if (exists($dup_args{cachable}) and $dup_args{cachable}) {
+        (my $name = $dup_args{api_name}) =~ s/^open-ils\.storage/open-ils.storage.cachable/o;
+        if ($name ne $dup_args{api_name}) {
+            $dup_args{real_api_name} = $dup_args{api_name};
+            $dup_args{method} = 'cachable_wrapper';
+            $dup_args{api_name} = $name;
+            $dup_args{package} = __PACKAGE__;
+            __PACKAGE__->SUPER::register_method( %dup_args );
+        }
+    }
+
+    if ($dup_args{real_api_name} =~ /^open-ils\.storage\.direct\..+\.search.+/o ||
+        $dup_args{api_name} =~ /^open-ils\.storage\.direct\..+\.search.+/o) {
+        $dup_args{api_name} = $dup_args{real_api_name} if ($dup_args{real_api_name});
+
+        (my $name = $dup_args{api_name}) =~ s/\.direct\./.id_list./o;
+
+        $dup_args{notes} = $dup_args{real_api_name};
+        $dup_args{real_api_name} = $dup_args{api_name};
+        $dup_args{method} = 'search_ids';
+        $dup_args{api_name} = $name;
+        $dup_args{package} = __PACKAGE__;
+
+        __PACKAGE__->SUPER::register_method( %dup_args );
+    }
 }
 
 sub cachable_wrapper {
-	my $self = shift;
-	my $client = shift;
-	my @args = @_;
-
-	my %cache_args = (
-		limit		=> 100,
-		offset		=> 0,
-		timeout		=> 7200,
-		cache_page_size	=> 1000,
-	);
-
-	my @real_args;
-	my $key_string = $self->api_name;
-	for (my $ind = 0; $ind < scalar(@args); $ind++) {
-		if (	$args[$ind] eq 'limit' ||
-			$args[$ind] eq 'offset' ||
-			$args[$ind] eq 'cache_page_size' ||
-			$args[$ind] eq 'timeout' ) {
-
-			my $key_ind = $ind;
-			$ind++;
-			my $value_ind = $ind;
-			$cache_args{$args[$key_ind]} = $args[$value_ind];
-			$log->debug("Cache limiter value for $args[$key_ind] is $args[$value_ind]", INTERNAL);
-			next;
-		}
-		$key_string .= $args[$ind];
-		$log->debug("Partial cache key value is $args[$ind]", INTERNAL);
-		push @real_args, $args[$ind];
-	}
-
-	my $cache_page = int($cache_args{offset} / $cache_args{cache_page_size});
-	my $cache_key;
-	{	use bytes;
-		$cache_key = md5_hex($key_string.$cache_page);
-	}
-
-	$log->debug("Key string for cache lookup is $key_string -> $cache_key", DEBUG);
-	$log->debug("Cache page is $cache_page", DEBUG);
-
-	my $cached_res = OpenSRF::Utils::Cache->new->get_cache( $cache_key );
-	if (defined $cached_res) {
-		$log->debug("Found ".scalar(@$cached_res)." records in the cache", INFO);
-		$log->debug("Values from cache: ".join(', ', @$cached_res), INTERNAL);
-		my $start = int($cache_args{offset} - ($cache_page * $cache_args{cache_page_size}));
-		my $end = int($start + $cache_args{limit} - 1);
-		$log->debug("Responding with values from ".$start.' to '.$end,DEBUG);
-        	$client->respond( $_ ) for ( grep { defined } @$cached_res[ $start .. $end ]);
-		return undef;
-	}
-
-	my $method = $self->method_lookup($self->{real_api_name});
-	my @res = $method->run(@real_args);
+    my $self = shift;
+    my $client = shift;
+    my @args = @_;
+
+    my %cache_args = (
+        limit       => 100,
+        offset      => 0,
+        timeout     => 7200,
+        cache_page_size => 1000,
+    );
+
+    my @real_args;
+    my $key_string = $self->api_name;
+    for (my $ind = 0; $ind < scalar(@args); $ind++) {
+        if (    $args[$ind] eq 'limit' ||
+            $args[$ind] eq 'offset' ||
+            $args[$ind] eq 'cache_page_size' ||
+            $args[$ind] eq 'timeout' ) {
+
+            my $key_ind = $ind;
+            $ind++;
+            my $value_ind = $ind;
+            $cache_args{$args[$key_ind]} = $args[$value_ind];
+            $log->debug("Cache limiter value for $args[$key_ind] is $args[$value_ind]", INTERNAL);
+            next;
+        }
+        $key_string .= $args[$ind];
+        $log->debug("Partial cache key value is $args[$ind]", INTERNAL);
+        push @real_args, $args[$ind];
+    }
+
+    my $cache_page = int($cache_args{offset} / $cache_args{cache_page_size});
+    my $cache_key;
+    {   use bytes;
+        $cache_key = md5_hex($key_string.$cache_page);
+    }
+
+    $log->debug("Key string for cache lookup is $key_string -> $cache_key", DEBUG);
+    $log->debug("Cache page is $cache_page", DEBUG);
+
+    my $cached_res = OpenSRF::Utils::Cache->new->get_cache( $cache_key );
+    if (defined $cached_res) {
+        $log->debug("Found ".scalar(@$cached_res)." records in the cache", INFO);
+        $log->debug("Values from cache: ".join(', ', @$cached_res), INTERNAL);
+        my $start = int($cache_args{offset} - ($cache_page * $cache_args{cache_page_size}));
+        my $end = int($start + $cache_args{limit} - 1);
+        $log->debug("Responding with values from ".$start.' to '.$end,DEBUG);
+            $client->respond( $_ ) for ( grep { defined } @$cached_res[ $start .. $end ]);
+        return undef;
+    }
+
+    my $method = $self->method_lookup($self->{real_api_name});
+    my @res = $method->run(@real_args);
 
 
         $client->respond( $_ ) for ( grep { defined } @res[$cache_args{offset} .. int($cache_args{offset} + $cache_args{limit} - 1)] );
 
-	$log->debug("Saving values from ".int($cache_page * $cache_args{cache_page_size})." to ".
-		int(($cache_page + 1) * $cache_args{cache_page_size}). "to the cache", INTERNAL);
-	try {
-		OpenSRF::Utils::Cache->new->put_cache(
-			$cache_key =>
-			[@res[int($cache_page * $cache_args{cache_page_size}) .. int(($cache_page + 1) * $cache_args{cache_page_size}) ]] =>
-			OpenSRF::Utils->interval_to_seconds( $cache_args{timeout} )
-		);
-	} catch Error with {
-		my $e = shift;
-		$log->error("Cache seems to be down, $e");
-	};
-
-	return undef;
+    $log->debug("Saving values from ".int($cache_page * $cache_args{cache_page_size})." to ".
+        int(($cache_page + 1) * $cache_args{cache_page_size}). "to the cache", INTERNAL);
+    try {
+        OpenSRF::Utils::Cache->new->put_cache(
+            $cache_key =>
+            [@res[int($cache_page * $cache_args{cache_page_size}) .. int(($cache_page + 1) * $cache_args{cache_page_size}) ]] =>
+            OpenSRF::Utils->interval_to_seconds( $cache_args{timeout} )
+        );
+    } catch Error with {
+        my $e = shift;
+        $log->error("Cache seems to be down, $e");
+    };
+
+    return undef;
 }
 
 sub random_object {
-	my $self = shift;
-	my $client = shift;
-
-	my $cdbi = $self->{cdbi};
-	my $table = $cdbi->table;
-	my $sql = <<"	SQL";
-		SELECT	id
-		  FROM	$table
-		  WHERE	id IN (( SELECT	(RANDOM() * (SELECT MAX(id) FROM $table))::INT LIMIT 1 ));
-	SQL
-
-	my $trys = 100;
-	while ($trys--) {
-
-		my $id = $cdbi->db_Main->selectcol_arrayref($sql);
-		next unless (@$id);
-
-		return ($cdbi->fast_fieldmapper(@$id))[0];
-	}
-	return undef;
+    my $self = shift;
+    my $client = shift;
+
+    my $cdbi = $self->{cdbi};
+    my $table = $cdbi->table;
+    my $sql = <<"    SQL";
+        SELECT  id
+          FROM  $table
+          WHERE id IN (( SELECT (RANDOM() * (SELECT MAX(id) FROM $table))::INT LIMIT 1 ));
+    SQL
+
+    my $trys = 100;
+    while ($trys--) {
+
+        my $id = $cdbi->db_Main->selectcol_arrayref($sql);
+        next unless (@$id);
+
+        return ($cdbi->fast_fieldmapper(@$id))[0];
+    }
+    return undef;
 }
 
 sub retrieve_node {
-	my $self = shift;
-	my $client = shift;
-	my @ids = @_;
-
-	my $cdbi = $self->{cdbi};
-
-	for my $id ( @ids ) {
-		next unless ($id);
-
-		my ($rec) = $cdbi->fast_fieldmapper($id);
-		if ($self->api_name !~ /batch/o) {
-			return $rec if ($rec);
-		}
-		$client->respond($rec);
-	}
-	return undef;
+    my $self = shift;
+    my $client = shift;
+    my @ids = @_;
+
+    my $cdbi = $self->{cdbi};
+
+    for my $id ( @ids ) {
+        next unless ($id);
+
+        my ($rec) = $cdbi->fast_fieldmapper($id);
+        if ($self->api_name !~ /batch/o) {
+            return $rec if ($rec);
+        }
+        $client->respond($rec);
+    }
+    return undef;
 }
 
 sub search_ids {
-	my $self = shift;
-	my $client = shift;
-	my @args = @_;
+    my $self = shift;
+    my $client = shift;
+    my @args = @_;
 
-	my @res = $self->method_lookup($self->{real_api_name})->run(@args);
+    my @res = $self->method_lookup($self->{real_api_name})->run(@args);
 
-	if (ref($res[0]) eq 'ARRAY') {
-		return [ map { $_->id } @{ $res[0] } ];
-	}
+    if (ref($res[0]) eq 'ARRAY') {
+        return [ map { $_->id } @{ $res[0] } ];
+    }
 
-	$client->respond($_) for ( map { $_->id } @res );
-	return undef;
+    $client->respond($_) for ( map { $_->id } @res );
+    return undef;
 }
 
 sub search_where {
-	my $self = shift;
-	my $client = shift;
-	my @args = @_;
-
-	if (ref($args[0]) eq 'HASH') {
-		if ($args[1]) {
-			$args[1]{limit_dialect} = $self->{cdbi}->db_Main;
-		} else {
-			$args[1] = {limit_dialect => $self->{cdbi}->db_Main };
-		}
-	} else {
-		$args[0] = { @args };
-		$args[1] = {limit_dialect => $self->{cdbi} };
-	}
-
-	my $cdbi = $self->{cdbi};
-
-	for my $obj ($cdbi->search_where(@args)) {
-		next unless ref($obj);
-		$client->respond( $obj->to_fieldmapper );
-	}
-	return undef;
+    my $self = shift;
+    my $client = shift;
+    my @args = @_;
+
+    if (ref($args[0]) eq 'HASH') {
+        if ($args[1]) {
+            $args[1]{limit_dialect} = $self->{cdbi}->db_Main;
+        } else {
+            $args[1] = {limit_dialect => $self->{cdbi}->db_Main };
+        }
+    } else {
+        $args[0] = { @args };
+        $args[1] = {limit_dialect => $self->{cdbi} };
+    }
+
+    my $cdbi = $self->{cdbi};
+
+    for my $obj ($cdbi->search_where(@args)) {
+        next unless ref($obj);
+        $client->respond( $obj->to_fieldmapper );
+    }
+    return undef;
 }
 
 sub search {
-	my $self = shift;
-	my $client = shift;
-	my @args = @_;
+    my $self = shift;
+    my $client = shift;
+    my @args = @_;
 
-	my $cdbi = $self->{cdbi};
+    my $cdbi = $self->{cdbi};
 
-	(my $search_type = $self->api_name) =~ s/.*\.(search[^.]*).*/$1/o;
+    (my $search_type = $self->api_name) =~ s/.*\.(search[^.]*).*/$1/o;
 
-	for my $obj ($cdbi->$search_type(@args)) {
-		next unless ref($obj);
-		$client->respond( $obj->to_fieldmapper );
-	}
-	return undef;
+    for my $obj ($cdbi->$search_type(@args)) {
+        next unless ref($obj);
+        $client->respond( $obj->to_fieldmapper );
+    }
+    return undef;
 }
 
 sub search_one_field {
-	my $self = shift;
-	my $client = shift;
-	my @args = @_;
+    my $self = shift;
+    my $client = shift;
+    my @args = @_;
 
-	(my $field = $self->api_name) =~ s/.*\.([^\.]+)$/$1/o;
+    (my $field = $self->api_name) =~ s/.*\.([^\.]+)$/$1/o;
 
-	return search( $self, $client, $field, @args );
+    return search( $self, $client, $field, @args );
 }
 
 sub old_search_one_field {
-	my $self = shift;
-	my $client = shift;
-	my @terms = @_;
-
-	(my $search_type = $self->api_name) =~ s/.*\.(search[^.]*).*/$1/o;
-	(my $col = $self->api_name) =~ s/.*\.$search_type\.([^.]+).*/$1/;
-	my $cdbi = $self->{cdbi};
-
-	my $like = 0;
-	$like = 1 if ($search_type =~ /like$/o);
-	$like = 2 if ($search_type =~ /fts$/o);
-	$like = 3 if ($search_type =~ /regex$/o);
-
-	for my $term (@terms) {
-		$log->debug("Searching $cdbi for $col using type $search_type, value '$term'",DEBUG);
-		if (@terms == 1) {
-			return [ $cdbi->fast_fieldmapper($term,$col,$like) ];
-		}
-		$client->respond( [ $cdbi->fast_fieldmapper($term,$col,$like) ] );
-	}
-	return undef;
+    my $self = shift;
+    my $client = shift;
+    my @terms = @_;
+
+    (my $search_type = $self->api_name) =~ s/.*\.(search[^.]*).*/$1/o;
+    (my $col = $self->api_name) =~ s/.*\.$search_type\.([^.]+).*/$1/;
+    my $cdbi = $self->{cdbi};
+
+    my $like = 0;
+    $like = 1 if ($search_type =~ /like$/o);
+    $like = 2 if ($search_type =~ /fts$/o);
+    $like = 3 if ($search_type =~ /regex$/o);
+
+    for my $term (@terms) {
+        $log->debug("Searching $cdbi for $col using type $search_type, value '$term'",DEBUG);
+        if (@terms == 1) {
+            return [ $cdbi->fast_fieldmapper($term,$col,$like) ];
+        }
+        $client->respond( [ $cdbi->fast_fieldmapper($term,$col,$like) ] );
+    }
+    return undef;
 }
 
 
 sub create_node {
-	my $self = shift;
-	my $client = shift;
-	my $node = shift;
+    my $self = shift;
+    my $client = shift;
+    my $node = shift;
 
-	local $OpenILS::Application::Storage::WRITE = 1;
+    local $OpenILS::Application::Storage::WRITE = 1;
 
-	my $cdbi = $self->{cdbi};
+    my $cdbi = $self->{cdbi};
 
-	my $success;
-	try {
-		my $rec = $cdbi->create($node);
-		$success = $rec->id if ($rec);
-	} catch Error with {
-		$success = 0;
-	};
+    my $success;
+    try {
+        my $rec = $cdbi->create($node);
+        $success = $rec->id if ($rec);
+    } catch Error with {
+        $success = 0;
+    };
 
-	return $success;
+    return $success;
 }
 
 sub update_node {
-	my $self = shift;
-	my $client = shift;
-	my $node = shift;
+    my $self = shift;
+    my $client = shift;
+    my $node = shift;
 
-	local $OpenILS::Application::Storage::WRITE = 1;
+    local $OpenILS::Application::Storage::WRITE = 1;
 
-	my $cdbi = $self->{cdbi};
+    my $cdbi = $self->{cdbi};
 
-	return $cdbi->update($node);
+    return $cdbi->update($node);
 }
 
 sub mass_delete {
-	my $self = shift;
-	my $client = shift;
-	my $search = shift;
-
-	local $OpenILS::Application::Storage::WRITE = 1;
-
-	my $where = 'WHERE ';
-
-	my $cdbi = $self->{cdbi};
-	my $table = $cdbi->table;
-
-	my @keys = sort keys %$search;
-	
-	my @binds;
-	my @wheres;
-	for my $col ( @keys ) {
-		if (ref($$search{$col}) and ref($$search{$col}) =~ /ARRAY/o) {
-			push @wheres, "$col IN (" . join(',', map { '?' } @{ $$search{$col} }) . ')';
-			push @binds, map { "$_" } @{ $$search{$col} };
-		} else {
-			push @wheres, "$col = ?";
-			push @binds, $$search{$col};
-		}
-	}
-	$where .= join ' AND ', @wheres;
-
-	my $delete = "DELETE FROM $table $where";
-
-	$log->debug("Performing MASS deletion : $delete",DEBUG);
-
-	my $dbh = $cdbi->db_Main;
-	my $success = 1;
-	try {
-		my $sth = $dbh->prepare($delete);
-		$sth->execute( @binds );
-		$sth->finish;
-		$log->debug("MASS Delete succeeded",DEBUG);
-	} catch Error with {
-		$log->debug("MASS Delete FAILED : ".shift(),DEBUG);
-		$success = 0;
-	};
-	return $success;
+    my $self = shift;
+    my $client = shift;
+    my $search = shift;
+
+    local $OpenILS::Application::Storage::WRITE = 1;
+
+    my $where = 'WHERE ';
+
+    my $cdbi = $self->{cdbi};
+    my $table = $cdbi->table;
+
+    my @keys = sort keys %$search;
+    
+    my @binds;
+    my @wheres;
+    for my $col ( @keys ) {
+        if (ref($$search{$col}) and ref($$search{$col}) =~ /ARRAY/o) {
+            push @wheres, "$col IN (" . join(',', map { '?' } @{ $$search{$col} }) . ')';
+            push @binds, map { "$_" } @{ $$search{$col} };
+        } else {
+            push @wheres, "$col = ?";
+            push @binds, $$search{$col};
+        }
+    }
+    $where .= join ' AND ', @wheres;
+
+    my $delete = "DELETE FROM $table $where";
+
+    $log->debug("Performing MASS deletion : $delete",DEBUG);
+
+    my $dbh = $cdbi->db_Main;
+    my $success = 1;
+    try {
+        my $sth = $dbh->prepare($delete);
+        $sth->execute( @binds );
+        $sth->finish;
+        $log->debug("MASS Delete succeeded",DEBUG);
+    } catch Error with {
+        $log->debug("MASS Delete FAILED : ".shift(),DEBUG);
+        $success = 0;
+    };
+    return $success;
 }
 
 sub remote_update_node {
-	my $self = shift;
-	my $client = shift;
-	my $keys = shift;
-	my $vals = shift;
-
-	local $OpenILS::Application::Storage::WRITE = 1;
-
-	my $cdbi = $self->{cdbi};
-
-	my $success = 1;
-	try {
-		$success = $cdbi->remote_update($keys,$vals);
-	} catch Error with {
-		$success = 0;
-	};
-	return $success;
+    my $self = shift;
+    my $client = shift;
+    my $keys = shift;
+    my $vals = shift;
+
+    local $OpenILS::Application::Storage::WRITE = 1;
+
+    my $cdbi = $self->{cdbi};
+
+    my $success = 1;
+    try {
+        $success = $cdbi->remote_update($keys,$vals);
+    } catch Error with {
+        $success = 0;
+    };
+    return $success;
 }
 
 sub merge_node {
-	my $self = shift;
-	my $client = shift;
-	my $keys = shift;
-	my $vals = shift;
-
-	local $OpenILS::Application::Storage::WRITE = 1;
-
-	my $cdbi = $self->{cdbi};
-
-	my $success = 1;
-	try {
-		$success = $cdbi->merge($keys,$vals)->id;
-	} catch Error with {
-		$success = 0;
-	};
-	return $success;
+    my $self = shift;
+    my $client = shift;
+    my $keys = shift;
+    my $vals = shift;
+
+    local $OpenILS::Application::Storage::WRITE = 1;
+
+    my $cdbi = $self->{cdbi};
+
+    my $success = 1;
+    try {
+        $success = $cdbi->merge($keys,$vals)->id;
+    } catch Error with {
+        $success = 0;
+    };
+    return $success;
 }
 
 sub delete_node {
-	my $self = shift;
-	my $client = shift;
-	my $node = shift;
+    my $self = shift;
+    my $client = shift;
+    my $node = shift;
 
-	local $OpenILS::Application::Storage::WRITE = 1;
+    local $OpenILS::Application::Storage::WRITE = 1;
 
-	my $cdbi = $self->{cdbi};
+    my $cdbi = $self->{cdbi};
 
-	my $success = 1;
-	try {
-		$success = $cdbi->delete($node);
-	} catch Error with {
-		$success = 0;
-	};
-	return $success;
+    my $success = 1;
+    try {
+        $success = $cdbi->delete($node);
+    } catch Error with {
+        $success = 0;
+    };
+    return $success;
 }
 
 sub batch_call {
-	my $self = shift;
-	my $client = shift;
-	my @nodes = @_;
+    my $self = shift;
+    my $client = shift;
+    my @nodes = @_;
 
-	my $unwrap = $self->{unwrap};
+    my $unwrap = $self->{unwrap};
 
-	my $cdbi = $self->{cdbi};
-	my $api_name = $self->api_name;
-	(my $single_call_api_name = $api_name) =~ s/batch\.//o;
+    my $cdbi = $self->{cdbi};
+    my $api_name = $self->api_name;
+    (my $single_call_api_name = $api_name) =~ s/batch\.//o;
 
-	$log->debug("Default $api_name looking up $single_call_api_name...",INTERNAL);
-	my $method = $self->method_lookup($single_call_api_name);
+    $log->debug("Default $api_name looking up $single_call_api_name...",INTERNAL);
+    my $method = $self->method_lookup($single_call_api_name);
 
-	my @success;
-	while ( my $node = shift(@nodes) ) {
-		my ($res) = $method->run( ($unwrap ? (@$node) : ($node)) ); 
-		push(@success, 1) if ($res >= 0);
-	}
+    my @success;
+    while ( my $node = shift(@nodes) ) {
+        my ($res) = $method->run( ($unwrap ? (@$node) : ($node)) ); 
+        push(@success, 1) if ($res >= 0);
+    }
 
-	my $insert_total = 0;
-	$insert_total += $_ for (@success);
+    my $insert_total = 0;
+    $insert_total += $_ for (@success);
 
-	return $insert_total;
+    return $insert_total;
 }
 
 
@@ -419,339 +419,339 @@ sub batch_call {
 
 
 for my $pkg ( qw/actor action asset biblio config metabib authority money permission container/ ) {
-	"OpenILS::Application::Storage::Publisher::$pkg"->use;
-	if ($@) {
-		$log->debug("ARG! Couldn't load $pkg class Publisher: $@", ERROR);
-		throw OpenSRF::EX::ERROR ("ARG! Couldn't load $pkg class Publisher: $@");
-	}
+    "OpenILS::Application::Storage::Publisher::$pkg"->use;
+    if ($@) {
+        $log->debug("ARG! Couldn't load $pkg class Publisher: $@", ERROR);
+        throw OpenSRF::EX::ERROR ("ARG! Couldn't load $pkg class Publisher: $@");
+    }
 }
 
 for my $fmclass ( (Fieldmapper->classes) ) {
 
-	$log->debug("Generating methods for Fieldmapper class $fmclass", DEBUG);
-
-	next if ($fmclass->is_virtual);
-
-	(my $cdbi = $fmclass) =~ s/^Fieldmapper:://o;
-	(my $class = $cdbi) =~ s/::.*//o;
-	(my $api_class = $cdbi) =~ s/::/./go;
-	my $registration_class = __PACKAGE__ . "::$class";
-	my $api_prefix = 'open-ils.storage.direct.'.$api_class;
-
-	# Create the search methods
-	unless ( __PACKAGE__->is_registered( $api_prefix.'.search' ) ) {
-		__PACKAGE__->register_method(
-			api_name	=> $api_prefix.'.search',
-			method		=> 'search',
-			api_level	=> 1,
-			argc		=> 2,
-			stream		=> 1,
-			cdbi		=> $cdbi,
-			cachable	=> 1,
-		);
-	}
-
-	unless ( __PACKAGE__->is_registered( $api_prefix.'.search_where' ) ) {
-		__PACKAGE__->register_method(
-			api_name	=> $api_prefix.'.search_where',
-			method		=> 'search_where',
-			api_level	=> 1,
-			stream		=> 1,
-			argc		=> 1,
-			cdbi		=> $cdbi,
-			cachable	=> 1,
-		);
-	}
+    $log->debug("Generating methods for Fieldmapper class $fmclass", DEBUG);
+
+    next if ($fmclass->is_virtual);
+
+    (my $cdbi = $fmclass) =~ s/^Fieldmapper:://o;
+    (my $class = $cdbi) =~ s/::.*//o;
+    (my $api_class = $cdbi) =~ s/::/./go;
+    my $registration_class = __PACKAGE__ . "::$class";
+    my $api_prefix = 'open-ils.storage.direct.'.$api_class;
+
+    # Create the search methods
+    unless ( __PACKAGE__->is_registered( $api_prefix.'.search' ) ) {
+        __PACKAGE__->register_method(
+            api_name    => $api_prefix.'.search',
+            method      => 'search',
+            api_level   => 1,
+            argc        => 2,
+            stream      => 1,
+            cdbi        => $cdbi,
+            cachable    => 1,
+        );
+    }
+
+    unless ( __PACKAGE__->is_registered( $api_prefix.'.search_where' ) ) {
+        __PACKAGE__->register_method(
+            api_name    => $api_prefix.'.search_where',
+            method      => 'search_where',
+            api_level   => 1,
+            stream      => 1,
+            argc        => 1,
+            cdbi        => $cdbi,
+            cachable    => 1,
+        );
+    }
 
 =head1 comment
 
-	unless ( __PACKAGE__->is_registered( $api_prefix.'.search_like' ) ) {
-		__PACKAGE__->register_method(
-			api_name	=> $api_prefix.'.search_like',
-			method		=> 'search',
-			api_level	=> 1,
-			stream		=> 1,
-			cdbi		=> $cdbi,
-			cachable	=> 1,
-			argc		=> 2,
-		);
-	}
-
-	if (\&Class::DBI::search_fts and $cdbi->columns('FTS')) {
-		unless ( __PACKAGE__->is_registered( $api_prefix.'.search_fts' ) ) {
-			__PACKAGE__->register_method(
-				api_name	=> $api_prefix.'.search_fts',
-				method		=> 'search',
-				api_level	=> 1,
-				stream		=> 1,
-				cdbi		=> $cdbi,
-				cachable	=> 1,
-				argc		=> 2,
-			);
-		}
-	}
-
-	if (\&Class::DBI::search_regex) {
-		unless ( __PACKAGE__->is_registered( $api_prefix.'.search_regex' ) ) {
-			__PACKAGE__->register_method(
-				api_name	=> $api_prefix.'.search_regex',
-				method		=> 'search',
-				api_level	=> 1,
-				stream		=> 1,
-				cdbi		=> $cdbi,
-				cachable	=> 1,
-				argc		=> 2,
-			);
-		}
-	}
-
-	if (\&Class::DBI::search_ilike) {
-		unless ( __PACKAGE__->is_registered( $api_prefix.'.search_ilike' ) ) {
-			__PACKAGE__->register_method(
-				api_name	=> $api_prefix.'.search_ilike',
-				method		=> 'search',
-				api_level	=> 1,
-				stream		=> 1,
-				cdbi		=> $cdbi,
-				cachable	=> 1,
-				argc		=> 2,
-			);
-		}
-	}
+    unless ( __PACKAGE__->is_registered( $api_prefix.'.search_like' ) ) {
+        __PACKAGE__->register_method(
+            api_name    => $api_prefix.'.search_like',
+            method      => 'search',
+            api_level   => 1,
+            stream      => 1,
+            cdbi        => $cdbi,
+            cachable    => 1,
+            argc        => 2,
+        );
+    }
+
+    if (\&Class::DBI::search_fts and $cdbi->columns('FTS')) {
+        unless ( __PACKAGE__->is_registered( $api_prefix.'.search_fts' ) ) {
+            __PACKAGE__->register_method(
+                api_name    => $api_prefix.'.search_fts',
+                method      => 'search',
+                api_level   => 1,
+                stream      => 1,
+                cdbi        => $cdbi,
+                cachable    => 1,
+                argc        => 2,
+            );
+        }
+    }
+
+    if (\&Class::DBI::search_regex) {
+        unless ( __PACKAGE__->is_registered( $api_prefix.'.search_regex' ) ) {
+            __PACKAGE__->register_method(
+                api_name    => $api_prefix.'.search_regex',
+                method      => 'search',
+                api_level   => 1,
+                stream      => 1,
+                cdbi        => $cdbi,
+                cachable    => 1,
+                argc        => 2,
+            );
+        }
+    }
+
+    if (\&Class::DBI::search_ilike) {
+        unless ( __PACKAGE__->is_registered( $api_prefix.'.search_ilike' ) ) {
+            __PACKAGE__->register_method(
+                api_name    => $api_prefix.'.search_ilike',
+                method      => 'search',
+                api_level   => 1,
+                stream      => 1,
+                cdbi        => $cdbi,
+                cachable    => 1,
+                argc        => 2,
+            );
+        }
+    }
 
 =cut
 
-	# Create the random method
-	unless ( __PACKAGE__->is_registered( $api_prefix.'.random' ) ) {
-		__PACKAGE__->register_method(
-			api_name	=> $api_prefix.'.random',
-			method		=> 'random_object',
-			api_level	=> 1,
-			cdbi		=> $cdbi,
-			argc		=> 0,
-		);
-	}
-
-	# Create the retrieve method
-	unless ( __PACKAGE__->is_registered( $api_prefix.'.retrieve' ) ) {
-		__PACKAGE__->register_method(
-			api_name	=> $api_prefix.'.retrieve',
-			method		=> 'retrieve_node',
-			api_level	=> 1,
-			cdbi		=> $cdbi,
-			cachable	=> 1,
-			argc		=> 1,
-		);
-	}
-
-	# Create the batch retrieve method
-	unless ( __PACKAGE__->is_registered( $api_prefix.'.batch.retrieve' ) ) {
-		__PACKAGE__->register_method(
-			api_name	=> $api_prefix.'.batch.retrieve',
-			method		=> 'retrieve_node',
-			api_level	=> 1,
-			stream		=> 1,
-			cdbi		=> $cdbi,
-			cachable	=> 1,
-			argc		=> 1,
-		);
-	}
-
-	for my $field ($fmclass->real_fields) {
-		unless ( __PACKAGE__->is_registered( $api_prefix.'.search.'.$field ) ) {
-			__PACKAGE__->register_method(
-				api_name	=> $api_prefix.'.search.'.$field,
-				method		=> 'search_one_field',
-				api_level	=> 1,
-				cdbi		=> $cdbi,
-				cachable	=> 1,
-				stream		=> 1,
-				argc		=> 1,
-			);
-		}
+    # Create the random method
+    unless ( __PACKAGE__->is_registered( $api_prefix.'.random' ) ) {
+        __PACKAGE__->register_method(
+            api_name    => $api_prefix.'.random',
+            method      => 'random_object',
+            api_level   => 1,
+            cdbi        => $cdbi,
+            argc        => 0,
+        );
+    }
+
+    # Create the retrieve method
+    unless ( __PACKAGE__->is_registered( $api_prefix.'.retrieve' ) ) {
+        __PACKAGE__->register_method(
+            api_name    => $api_prefix.'.retrieve',
+            method      => 'retrieve_node',
+            api_level   => 1,
+            cdbi        => $cdbi,
+            cachable    => 1,
+            argc        => 1,
+        );
+    }
+
+    # Create the batch retrieve method
+    unless ( __PACKAGE__->is_registered( $api_prefix.'.batch.retrieve' ) ) {
+        __PACKAGE__->register_method(
+            api_name    => $api_prefix.'.batch.retrieve',
+            method      => 'retrieve_node',
+            api_level   => 1,
+            stream      => 1,
+            cdbi        => $cdbi,
+            cachable    => 1,
+            argc        => 1,
+        );
+    }
+
+    for my $field ($fmclass->real_fields) {
+        unless ( __PACKAGE__->is_registered( $api_prefix.'.search.'.$field ) ) {
+            __PACKAGE__->register_method(
+                api_name    => $api_prefix.'.search.'.$field,
+                method      => 'search_one_field',
+                api_level   => 1,
+                cdbi        => $cdbi,
+                cachable    => 1,
+                stream      => 1,
+                argc        => 1,
+            );
+        }
 
 =head1 comment
 
-		unless ( __PACKAGE__->is_registered( $api_prefix.'.search_like.'.$field ) ) {
-			__PACKAGE__->register_method(
-				api_name	=> $api_prefix.'.search_like.'.$field,
-				method		=> 'search_one_field',
-				api_level	=> 1,
-				cdbi		=> $cdbi,
-				cachable	=> 1,
-				stream		=> 1,
-				argc		=> 1,
-			);
-		}
-		if (\&Class::DBI::search_fts and grep { $field eq $_ } $cdbi->columns('FTS')) {
-			unless ( __PACKAGE__->is_registered( $api_prefix.'.search_fts.'.$field ) ) {
-				__PACKAGE__->register_method(
-					api_name	=> $api_prefix.'.search_fts.'.$field,
-					method		=> 'search_one_field',
-					api_level	=> 1,
-					cdbi		=> $cdbi,
-					cachable	=> 1,
-					stream		=> 1,
-					argc		=> 1,
-				);
-			}
-		}
-		if (\&Class::DBI::search_regex) {
-			unless ( __PACKAGE__->is_registered( $api_prefix.'.search_regex.'.$field ) ) {
-				__PACKAGE__->register_method(
-					api_name	=> $api_prefix.'.search_regex.'.$field,
-					method		=> 'search_one_field',
-					api_level	=> 1,
-					cdbi		=> $cdbi,
-					cachable	=> 1,
-					stream		=> 1,
-					argc		=> 1,
-				);
-			}
-		}
-		if (\&Class::DBI::search_ilike) {
-			unless ( __PACKAGE__->is_registered( $api_prefix.'.search_ilike.'.$field ) ) {
-				__PACKAGE__->register_method(
-					api_name	=> $api_prefix.'.search_ilike.'.$field,
-					method		=> 'search_one_field',
-					api_level	=> 1,
-					cdbi		=> $cdbi,
-					cachable	=> 1,
-					stream		=> 1,
-					argc		=> 1,
-				);
-			}
-		}
+        unless ( __PACKAGE__->is_registered( $api_prefix.'.search_like.'.$field ) ) {
+            __PACKAGE__->register_method(
+                api_name    => $api_prefix.'.search_like.'.$field,
+                method      => 'search_one_field',
+                api_level   => 1,
+                cdbi        => $cdbi,
+                cachable    => 1,
+                stream      => 1,
+                argc        => 1,
+            );
+        }
+        if (\&Class::DBI::search_fts and grep { $field eq $_ } $cdbi->columns('FTS')) {
+            unless ( __PACKAGE__->is_registered( $api_prefix.'.search_fts.'.$field ) ) {
+                __PACKAGE__->register_method(
+                    api_name    => $api_prefix.'.search_fts.'.$field,
+                    method      => 'search_one_field',
+                    api_level   => 1,
+                    cdbi        => $cdbi,
+                    cachable    => 1,
+                    stream      => 1,
+                    argc        => 1,
+                );
+            }
+        }
+        if (\&Class::DBI::search_regex) {
+            unless ( __PACKAGE__->is_registered( $api_prefix.'.search_regex.'.$field ) ) {
+                __PACKAGE__->register_method(
+                    api_name    => $api_prefix.'.search_regex.'.$field,
+                    method      => 'search_one_field',
+                    api_level   => 1,
+                    cdbi        => $cdbi,
+                    cachable    => 1,
+                    stream      => 1,
+                    argc        => 1,
+                );
+            }
+        }
+        if (\&Class::DBI::search_ilike) {
+            unless ( __PACKAGE__->is_registered( $api_prefix.'.search_ilike.'.$field ) ) {
+                __PACKAGE__->register_method(
+                    api_name    => $api_prefix.'.search_ilike.'.$field,
+                    method      => 'search_one_field',
+                    api_level   => 1,
+                    cdbi        => $cdbi,
+                    cachable    => 1,
+                    stream      => 1,
+                    argc        => 1,
+                );
+            }
+        }
 
 =cut
 
-	}
-
-
-	unless ($fmclass->is_readonly) {
-		# Create the create method
-		unless ( __PACKAGE__->is_registered( $api_prefix.'.create' ) ) {
-			__PACKAGE__->register_method(
-				api_name	=> $api_prefix.'.create',
-				method		=> 'create_node',
-				api_level	=> 1,
-				cdbi		=> $cdbi,
-				argc		=> 1,
-			);
-		}
-
-		# Create the batch create method
-		unless ( __PACKAGE__->is_registered( $api_prefix.'.batch.create' ) ) {
-			__PACKAGE__->register_method(
-				api_name	=> $api_prefix.'.batch.create',
-				method		=> 'batch_call',
-				api_level	=> 1,
-				cdbi		=> $cdbi,
-				argc		=> 1,
-			);
-		}
-
-		# Create the update method
-		unless ( __PACKAGE__->is_registered( $api_prefix.'.update' ) ) {
-			__PACKAGE__->register_method(
-				api_name	=> $api_prefix.'.update',
-				method		=> 'update_node',
-				api_level	=> 1,
-				cdbi		=> $cdbi,
-				argc		=> 1,
-			);
-		}
-
-		# Create the batch update method
-		unless ( __PACKAGE__->is_registered( $api_prefix.'.batch.update' ) ) {
-			__PACKAGE__->register_method(
-				api_name	=> $api_prefix.'.batch.update',
-				method		=> 'batch_call',
-				api_level	=> 1,
-				cdbi		=> $cdbi,
-				argc		=> 1,
-			);
-		}
-
-		# Create the delete method
-		unless ( __PACKAGE__->is_registered( $api_prefix.'.delete' ) ) {
-			__PACKAGE__->register_method(
-				api_name	=> $api_prefix.'.delete',
-				method		=> 'delete_node',
-				api_level	=> 1,
-				cdbi		=> $cdbi,
-				argc		=> 1,
-			);
-		}
-
-		# Create the batch delete method
-		unless ( __PACKAGE__->is_registered( $api_prefix.'.batch.delete' ) ) {
-			__PACKAGE__->register_method(
-				api_name	=> $api_prefix.'.batch.delete',
-				method		=> 'batch_call',
-				api_level	=> 1,
-				cdbi		=> $cdbi,
-				argc		=> 1,
-			);
-		}
-
-		# Create the merge method
-		unless ( __PACKAGE__->is_registered( $api_prefix.'.merge' ) ) {
-			__PACKAGE__->register_method(
-				api_name	=> $api_prefix.'.merge',
-				method		=> 'merge_node',
-				api_level	=> 1,
-				cdbi		=> $cdbi,
-				argc		=> 1,
-			);
-		}
-
-		# Create the batch merge method
-		unless ( __PACKAGE__->is_registered( $api_prefix.'.batch.merge' ) ) {
-			__PACKAGE__->register_method(
-				api_name	=> $api_prefix.'.batch.merge',
-				method		=> 'batch_call',
-				unwrap		=> 1,
-				api_level	=> 1,
-				cdbi		=> $cdbi,
-				argc		=> 1,
-			);
-		}
-
-		# Create the remote_update method
-		unless ( __PACKAGE__->is_registered( $api_prefix.'.remote_update' ) ) {
-			__PACKAGE__->register_method(
-				api_name	=> $api_prefix.'.remote_update',
-				method		=> 'remote_update_node',
-				api_level	=> 1,
-				cdbi		=> $cdbi,
-				argc		=> 1,
-			);
-		}
-
-		# Create the batch remote_update method
-		unless ( __PACKAGE__->is_registered( $api_prefix.'.batch.remote_update' ) ) {
-			__PACKAGE__->register_method(
-				api_name	=> $api_prefix.'.batch.remote_update',
-				method		=> 'batch_call',
-				api_level	=> 1,
-				unwrap		=> 1,
-				cdbi		=> $cdbi,
-				argc		=> 1,
-			);
-		}
-
-		# Create the search-based mass delete method
-		unless ( __PACKAGE__->is_registered( $api_prefix.'.mass_delete' ) ) {
-			__PACKAGE__->register_method(
-				api_name	=> $api_prefix.'.mass_delete',
-				method		=> 'mass_delete',
-				api_level	=> 1,
-				cdbi		=> $cdbi,
-				argc		=> 1,
-			);
-		}
-	}
+    }
+
+
+    unless ($fmclass->is_readonly) {
+        # Create the create method
+        unless ( __PACKAGE__->is_registered( $api_prefix.'.create' ) ) {
+            __PACKAGE__->register_method(
+                api_name    => $api_prefix.'.create',
+                method      => 'create_node',
+                api_level   => 1,
+                cdbi        => $cdbi,
+                argc        => 1,
+            );
+        }
+
+        # Create the batch create method
+        unless ( __PACKAGE__->is_registered( $api_prefix.'.batch.create' ) ) {
+            __PACKAGE__->register_method(
+                api_name    => $api_prefix.'.batch.create',
+                method      => 'batch_call',
+                api_level   => 1,
+                cdbi        => $cdbi,
+                argc        => 1,
+            );
+        }
+
+        # Create the update method
+        unless ( __PACKAGE__->is_registered( $api_prefix.'.update' ) ) {
+            __PACKAGE__->register_method(
+                api_name    => $api_prefix.'.update',
+                method      => 'update_node',
+                api_level   => 1,
+                cdbi        => $cdbi,
+                argc        => 1,
+            );
+        }
+
+        # Create the batch update method
+        unless ( __PACKAGE__->is_registered( $api_prefix.'.batch.update' ) ) {
+            __PACKAGE__->register_method(
+                api_name    => $api_prefix.'.batch.update',
+                method      => 'batch_call',
+                api_level   => 1,
+                cdbi        => $cdbi,
+                argc        => 1,
+            );
+        }
+
+        # Create the delete method
+        unless ( __PACKAGE__->is_registered( $api_prefix.'.delete' ) ) {
+            __PACKAGE__->register_method(
+                api_name    => $api_prefix.'.delete',
+                method      => 'delete_node',
+                api_level   => 1,
+                cdbi        => $cdbi,
+                argc        => 1,
+            );
+        }
+
+        # Create the batch delete method
+        unless ( __PACKAGE__->is_registered( $api_prefix.'.batch.delete' ) ) {
+            __PACKAGE__->register_method(
+                api_name    => $api_prefix.'.batch.delete',
+                method      => 'batch_call',
+                api_level   => 1,
+                cdbi        => $cdbi,
+                argc        => 1,
+            );
+        }
+
+        # Create the merge method
+        unless ( __PACKAGE__->is_registered( $api_prefix.'.merge' ) ) {
+            __PACKAGE__->register_method(
+                api_name    => $api_prefix.'.merge',
+                method      => 'merge_node',
+                api_level   => 1,
+                cdbi        => $cdbi,
+                argc        => 1,
+            );
+        }
+
+        # Create the batch merge method
+        unless ( __PACKAGE__->is_registered( $api_prefix.'.batch.merge' ) ) {
+            __PACKAGE__->register_method(
+                api_name    => $api_prefix.'.batch.merge',
+                method      => 'batch_call',
+                unwrap      => 1,
+                api_level   => 1,
+                cdbi        => $cdbi,
+                argc        => 1,
+            );
+        }
+
+        # Create the remote_update method
+        unless ( __PACKAGE__->is_registered( $api_prefix.'.remote_update' ) ) {
+            __PACKAGE__->register_method(
+                api_name    => $api_prefix.'.remote_update',
+                method      => 'remote_update_node',
+                api_level   => 1,
+                cdbi        => $cdbi,
+                argc        => 1,
+            );
+        }
+
+        # Create the batch remote_update method
+        unless ( __PACKAGE__->is_registered( $api_prefix.'.batch.remote_update' ) ) {
+            __PACKAGE__->register_method(
+                api_name    => $api_prefix.'.batch.remote_update',
+                method      => 'batch_call',
+                api_level   => 1,
+                unwrap      => 1,
+                cdbi        => $cdbi,
+                argc        => 1,
+            );
+        }
+
+        # Create the search-based mass delete method
+        unless ( __PACKAGE__->is_registered( $api_prefix.'.mass_delete' ) ) {
+            __PACKAGE__->register_method(
+                api_name    => $api_prefix.'.mass_delete',
+                method      => 'mass_delete',
+                api_level   => 1,
+                cdbi        => $cdbi,
+                argc        => 1,
+            );
+        }
+    }
 }
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
index 16e698f..42e5e84 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm
@@ -49,51 +49,51 @@ my %HOLD_SORT_ORDER_BY = (
 
 
 sub isTrue {
-	my $v = shift;
-	return 1 if ($v == 1);
-	return 1 if ($v =~ /^t/io);
-	return 1 if ($v =~ /^y/io);
-	return 0;
+    my $v = shift;
+    return 1 if ($v == 1);
+    return 1 if ($v =~ /^t/io);
+    return 1 if ($v =~ /^y/io);
+    return 0;
 }
 
 sub ou_ancestor_setting_value_or_cache {
-	# cache should be specific to setting
-	my ($actor, $org_id, $setting, $cache) = @_;
-
-	if (not exists $cache->{$org_id}) {
-		my $r = $actor->request(
-			'open-ils.actor.ou_setting.ancestor_default', $org_id, $setting
-		)->gather(1);
-
-		if ($r) {
-			$cache->{$org_id} = $r->{value};
-		} else {
-			$cache->{$org_id} = undef;
-		}
-	}
-	return $cache->{$org_id};
+    # cache should be specific to setting
+    my ($actor, $org_id, $setting, $cache) = @_;
+
+    if (not exists $cache->{$org_id}) {
+        my $r = $actor->request(
+            'open-ils.actor.ou_setting.ancestor_default', $org_id, $setting
+        )->gather(1);
+
+        if ($r) {
+            $cache->{$org_id} = $r->{value};
+        } else {
+            $cache->{$org_id} = undef;
+        }
+    }
+    return $cache->{$org_id};
 }
 
 my $parser = DateTime::Format::ISO8601->new;
 my $log = 'OpenSRF::Utils::Logger';
 
 sub open_noncat_circs {
-	my $self = shift;
-	my $client = shift;
-	my $user = shift;
-
-	my $a = action::non_cataloged_circulation->table;
-	my $c = config::non_cataloged_type->table;
-
-	my $sql = <<"	SQL";
-		SELECT	a.id
-		  FROM	$a a
-			JOIN $c c ON (a.item_type = c.id)
-		  WHERE	a.circ_time + c.circ_duration > current_timestamp
-			AND a.patron = ?
-	SQL
-
-	return action::non_cataloged_circulation->db_Main->selectcol_arrayref($sql, {}, $user);
+    my $self = shift;
+    my $client = shift;
+    my $user = shift;
+
+    my $a = action::non_cataloged_circulation->table;
+    my $c = config::non_cataloged_type->table;
+
+    my $sql = <<"    SQL";
+        SELECT  a.id
+          FROM  $a a
+            JOIN $c c ON (a.item_type = c.id)
+          WHERE a.circ_time + c.circ_duration > current_timestamp
+            AND a.patron = ?
+    SQL
+
+    return action::non_cataloged_circulation->db_Main->selectcol_arrayref($sql, {}, $user);
 }
 __PACKAGE__->register_method(
     api_name  => 'open-ils.storage.action.open_non_cataloged_circulation.user',
@@ -104,80 +104,80 @@ __PACKAGE__->register_method(
 
 
 sub ou_hold_requests {
-	my $self = shift;
-	my $client = shift;
-	my $ou = shift;
-
-	my $h_table = action::hold_request->table;
-	my $c_table = asset::copy->table;
-	my $o_table = actor::org_unit->table;
-
-	my $SQL = <<"	SQL";
-		SELECT 	h.id
-		  FROM	$h_table h
-		  	JOIN $c_table cp ON (cp.id = h.current_copy)
-			JOIN $o_table ou ON (ou.id = cp.circ_lib)
-		  WHERE	ou.id = ?
-		  	AND h.capture_time IS NULL
-		  	AND h.cancel_time IS NULL
-		  	AND (h.expire_time IS NULL OR h.expire_time > NOW())
-		  ORDER BY h.request_time
-	SQL
-
-	my $sth = action::hold_request->db_Main->prepare_cached($SQL);
-	$sth->execute($ou);
-
-	$client->respond($_) for (
-		map {
-			$self
-				->method_lookup('open-ils.storage.direct.action.hold_request.retrieve')
-				->run($_)
-		} map {
-			$_->[0]
-		} @{ $sth->fetchall_arrayref }
-	);
-	return undef;
+    my $self = shift;
+    my $client = shift;
+    my $ou = shift;
+
+    my $h_table = action::hold_request->table;
+    my $c_table = asset::copy->table;
+    my $o_table = actor::org_unit->table;
+
+    my $SQL = <<"    SQL";
+        SELECT  h.id
+          FROM  $h_table h
+            JOIN $c_table cp ON (cp.id = h.current_copy)
+            JOIN $o_table ou ON (ou.id = cp.circ_lib)
+          WHERE ou.id = ?
+            AND h.capture_time IS NULL
+            AND h.cancel_time IS NULL
+            AND (h.expire_time IS NULL OR h.expire_time > NOW())
+          ORDER BY h.request_time
+    SQL
+
+    my $sth = action::hold_request->db_Main->prepare_cached($SQL);
+    $sth->execute($ou);
+
+    $client->respond($_) for (
+        map {
+            $self
+                ->method_lookup('open-ils.storage.direct.action.hold_request.retrieve')
+                ->run($_)
+        } map {
+            $_->[0]
+        } @{ $sth->fetchall_arrayref }
+    );
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.action.targeted_hold_request.org_unit',
-	api_level       => 1,
-	argc		=> 1,
-	stream		=> 1,
-	method          => 'ou_hold_requests',
+    api_name        => 'open-ils.storage.action.targeted_hold_request.org_unit',
+    api_level       => 1,
+    argc        => 1,
+    stream      => 1,
+    method          => 'ou_hold_requests',
 );
 
 
 sub overdue_circs {
     my $upper_interval = shift || '1 millennium';
-	my $idlist = shift;
+    my $idlist = shift;
 
-	my $c_t = action::circulation->table;
+    my $c_t = action::circulation->table;
 
-	my $sql = <<"	SQL";
-		SELECT	*
-		  FROM	$c_t
-		  WHERE	stop_fines IS NULL
-		  	AND due_date < ( CURRENT_TIMESTAMP - grace_period )
+    my $sql = <<"    SQL";
+        SELECT  *
+          FROM  $c_t
+          WHERE stop_fines IS NULL
+            AND due_date < ( CURRENT_TIMESTAMP - grace_period )
             AND fine_interval < ?::INTERVAL
-	SQL
+    SQL
 
-	my $sth = action::circulation->db_Main->prepare_cached($sql);
-	$sth->execute($upper_interval);
+    my $sth = action::circulation->db_Main->prepare_cached($sql);
+    $sth->execute($upper_interval);
 
-	my @circs = map { $idlist ? $_->{id} : action::circulation->construct($_) } $sth->fetchall_hash;
+    my @circs = map { $idlist ? $_->{id} : action::circulation->construct($_) } $sth->fetchall_hash;
 
-	$c_t = booking::reservation->table;
-	$sql = <<"	SQL";
-		SELECT	*
-		  FROM	$c_t
-		  WHERE	return_time IS NULL
-		  	AND end_time < ( CURRENT_TIMESTAMP )
+    $c_t = booking::reservation->table;
+    $sql = <<"    SQL";
+        SELECT  *
+          FROM  $c_t
+          WHERE return_time IS NULL
+            AND end_time < ( CURRENT_TIMESTAMP )
             AND fine_interval IS NOT NULL
             AND cancel_time IS NULL
-	SQL
+    SQL
 
-	$sth = action::circulation->db_Main->prepare_cached($sql);
-	$sth->execute();
+    $sth = action::circulation->db_Main->prepare_cached($sql);
+    $sth->execute();
 
     push @circs, map { $idlist ? $_->{id} : booking::reservation->construct($_) } $sth->fetchall_hash;
 
@@ -185,131 +185,131 @@ sub overdue_circs {
 }
 
 sub complete_reshelving {
-	my $self = shift;
-	my $client = shift;
-	my $window = shift;
+    my $self = shift;
+    my $client = shift;
+    my $window = shift;
 
-	local $OpenILS::Application::Storage::WRITE = 1;
+    local $OpenILS::Application::Storage::WRITE = 1;
 
-	throw OpenSRF::EX::InvalidArg ("I need an interval of more than 0 seconds!")
-		unless (interval_to_seconds( $window ));
+    throw OpenSRF::EX::InvalidArg ("I need an interval of more than 0 seconds!")
+        unless (interval_to_seconds( $window ));
 
-	my $cp = asset::copy->table;
+    my $cp = asset::copy->table;
 
-	my $sql = <<"	SQL";
-		UPDATE	$cp
-		  SET	status = 0
-		  WHERE	id IN (
+    my $sql = <<"    SQL";
+        UPDATE  $cp
+          SET   status = 0
+          WHERE id IN (
             SELECT cp.id 
             FROM  $cp cp
             WHERE cp.status = 7
                 AND cp.status_changed_time < NOW() - CAST( COALESCE( BTRIM( (SELECT value FROM actor.org_unit_ancestor_setting('circ.reshelving_complete.interval', cp.circ_lib)),'"' ), ? )  AS INTERVAL)
-		  )
-	SQL
-	my $sth = action::circulation->db_Main->prepare_cached($sql);
-	$sth->execute($window);
+          )
+    SQL
+    my $sth = action::circulation->db_Main->prepare_cached($sql);
+    $sth->execute($window);
 
-	return $sth->rows;
+    return $sth->rows;
 
 }
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.action.circulation.reshelving.complete',
-	api_level       => 1,
-	argc		=> 1,
-	method          => 'complete_reshelving',
+    api_name        => 'open-ils.storage.action.circulation.reshelving.complete',
+    api_level       => 1,
+    argc        => 1,
+    method          => 'complete_reshelving',
 );
 
 sub mark_longoverdue {
-	my $self = shift;
-	my $client = shift;
-	my $window = shift;
+    my $self = shift;
+    my $client = shift;
+    my $window = shift;
 
-	local $OpenILS::Application::Storage::WRITE = 1;
+    local $OpenILS::Application::Storage::WRITE = 1;
 
-	throw OpenSRF::EX::InvalidArg ("I need an interval of more than 0 seconds!")
-		unless (interval_to_seconds( $window ));
+    throw OpenSRF::EX::InvalidArg ("I need an interval of more than 0 seconds!")
+        unless (interval_to_seconds( $window ));
 
-	my $setting = actor::org_unit_setting->table;
-	my $circ = action::circulation->table;
+    my $setting = actor::org_unit_setting->table;
+    my $circ = action::circulation->table;
 
-	my $sql = <<"	SQL";
-		UPDATE	$circ
-		  SET	stop_fines = 'LONGOVERDUE',
-			stop_fines_time = now()
-		  WHERE	id IN (
-		    SELECT  circ.id
+    my $sql = <<"    SQL";
+        UPDATE  $circ
+          SET   stop_fines = 'LONGOVERDUE',
+            stop_fines_time = now()
+          WHERE id IN (
+            SELECT  circ.id
                       FROM  $circ circ
                             LEFT JOIN $setting setting
                                 ON (circ.circ_lib = setting.org_unit AND setting.name = 'circ.long_overdue.interval')
                       WHERE circ.checkin_time IS NULL AND (stop_fines IS NULL OR stop_fines NOT IN ('LOST','LONGOVERDUE'))
                             AND AGE(circ.due_date) > CAST( COALESCE( BTRIM( setting.value,'"' ), ? )  AS INTERVAL)
                   )
-	SQL
+    SQL
 
-	my $sth = action::circulation->db_Main->prepare_cached($sql);
-	$sth->execute($window);
+    my $sth = action::circulation->db_Main->prepare_cached($sql);
+    $sth->execute($window);
 
-	return $sth->rows;
+    return $sth->rows;
 
 }
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.action.circulation.long_overdue',
-	api_level       => 1,
-	argc		=> 1,
-	method          => 'mark_longoverdue',
+    api_name        => 'open-ils.storage.action.circulation.long_overdue',
+    api_level       => 1,
+    argc        => 1,
+    method          => 'mark_longoverdue',
 );
 
 sub auto_thaw_frozen_holds {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	local $OpenILS::Application::Storage::WRITE = 1;
+    local $OpenILS::Application::Storage::WRITE = 1;
 
-	my $holds = action::hold_request->table;
+    my $holds = action::hold_request->table;
 
-	my $sql = "UPDATE $holds SET frozen = FALSE WHERE frozen IS TRUE AND thaw_date < NOW();";
+    my $sql = "UPDATE $holds SET frozen = FALSE WHERE frozen IS TRUE AND thaw_date < NOW();";
 
-	my $sth = action::hold_request->db_Main->prepare_cached($sql);
-	$sth->execute();
+    my $sth = action::hold_request->db_Main->prepare_cached($sql);
+    $sth->execute();
 
-	return $sth->rows;
+    return $sth->rows;
 
 }
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.action.hold_request.thaw_expired_frozen',
-	api_level       => 1,
-	stream		=> 0,
-	argc		=> 0,
-	method          => 'auto_thaw_frozen_holds',
+    api_name        => 'open-ils.storage.action.hold_request.thaw_expired_frozen',
+    api_level       => 1,
+    stream      => 0,
+    argc        => 0,
+    method          => 'auto_thaw_frozen_holds',
 );
 
 sub grab_overdue {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	my $idlist = $self->api_name =~/id_list/o ? 1 : 0;
+    my $idlist = $self->api_name =~/id_list/o ? 1 : 0;
     
-	$client->respond( $idlist ? $_ : $_->to_fieldmapper ) for ( overdue_circs('', $idlist) );
+    $client->respond( $idlist ? $_ : $_->to_fieldmapper ) for ( overdue_circs('', $idlist) );
 
-	return undef;
+    return undef;
 
 }
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.action.circulation.overdue',
-	api_level       => 1,
-	stream		    => 1,
-	method          => 'grab_overdue',
-	signature       => q/
-		Return list of overdue circulations and reservations to be used for fine generation.
-		Despite the name, this is not a generic method for retrieving all overdue loans,
-		as it excludes loans that have already hit the maximum fine limit.
+    api_name        => 'open-ils.storage.action.circulation.overdue',
+    api_level       => 1,
+    stream          => 1,
+    method          => 'grab_overdue',
+    signature       => q/
+        Return list of overdue circulations and reservations to be used for fine generation.
+        Despite the name, this is not a generic method for retrieving all overdue loans,
+        as it excludes loans that have already hit the maximum fine limit.
 /,
 );
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.action.circulation.overdue.id_list',
-	api_level       => 1,
-	stream		=> 1,
-	method          => 'grab_overdue',
+    api_name        => 'open-ils.storage.action.circulation.overdue.id_list',
+    api_level       => 1,
+    stream      => 1,
+    method          => 'grab_overdue',
 );
 
 sub get_hold_sort_order {
@@ -495,23 +495,23 @@ sub build_hold_sort_clause {
 }
 
 sub nearest_hold {
-	my $self = shift;
-	my $client = shift;
-	my $here = shift;   # just the ID
-	my $cp = shift;     # now an object with call_number fleshed,
+    my $self = shift;
+    my $client = shift;
+    my $here = shift;   # just the ID
+    my $cp = shift;     # now an object with call_number fleshed,
                         # formerly just copy ID
-	my $limit = int(shift()) || 10;
-	my $age = shift() || '0 seconds';
-	my $fifo = shift();
+    my $limit = int(shift()) || 10;
+    my $age = shift() || '0 seconds';
+    my $fifo = shift();
 
     $log->info("deprecated 'fifo' param true, but ignored") if isTrue $fifo;
 
     my ($holdsort, $addl_cte, $addl_join) =
         build_hold_sort_clause(get_hold_sort_order($here), $cp, $here);
 
-	local $OpenILS::Application::Storage::WRITE = 1;
+    local $OpenILS::Application::Storage::WRITE = 1;
 
-	my $ids = action::hold_request->db_Main->selectcol_arrayref(<<"	SQL", {}, $cp->circ_lib, $here, $cp->id, $age);
+    my $ids = action::hold_request->db_Main->selectcol_arrayref(<<"    SQL", {}, $cp->circ_lib, $here, $cp->id, $age);
         WITH go_home_interval AS (
             SELECT OILS_JSON_TO_TEXT(
                 (SELECT value FROM actor.org_unit_ancestor_setting(
@@ -520,36 +520,36 @@ sub nearest_hold {
             ))::INTERVAL AS value
         )
         $addl_cte
-		SELECT	h.id
-		  FROM	action.hold_request h
-			JOIN actor.org_unit_proximity p ON (p.from_org = ? AND p.to_org = h.pickup_lib)
-		  	JOIN action.hold_copy_map hm ON (hm.hold = h.id)
-		  	JOIN actor.usr au ON (au.id = h.usr)
-		  	JOIN permission.grp_tree pgt ON (au.profile = pgt.id)
-		  	LEFT JOIN actor.usr_standing_penalty ausp
-				ON ( au.id = ausp.usr AND ( ausp.stop_date IS NULL OR ausp.stop_date > NOW() ) )
-		  	LEFT JOIN config.standing_penalty csp
-				ON ( csp.id = ausp.standing_penalty AND csp.block_list LIKE '%CAPTURE%' )
+        SELECT  h.id
+          FROM  action.hold_request h
+            JOIN actor.org_unit_proximity p ON (p.from_org = ? AND p.to_org = h.pickup_lib)
+            JOIN action.hold_copy_map hm ON (hm.hold = h.id)
+            JOIN actor.usr au ON (au.id = h.usr)
+            JOIN permission.grp_tree pgt ON (au.profile = pgt.id)
+            LEFT JOIN actor.usr_standing_penalty ausp
+                ON ( au.id = ausp.usr AND ( ausp.stop_date IS NULL OR ausp.stop_date > NOW() ) )
+            LEFT JOIN config.standing_penalty csp
+                ON ( csp.id = ausp.standing_penalty AND csp.block_list LIKE '%CAPTURE%' )
             $addl_join
-		  WHERE hm.target_copy = ?
-		  	AND (AGE(NOW(),h.request_time) >= CAST(? AS INTERVAL) OR p.prox = 0)
-			AND h.capture_time IS NULL
-		  	AND h.cancel_time IS NULL
-		  	AND (h.expire_time IS NULL OR h.expire_time > NOW())
-			AND h.frozen IS FALSE
-		  	AND csp.id IS NULL
-		ORDER BY CASE WHEN h.hold_type IN ('R','F') THEN 0 ELSE 1 END, $holdsort
-		LIMIT $limit
-	SQL
-	
-	$client->respond( $_ ) for ( @$ids );
-	return undef;
+          WHERE hm.target_copy = ?
+            AND (AGE(NOW(),h.request_time) >= CAST(? AS INTERVAL) OR p.prox = 0)
+            AND h.capture_time IS NULL
+            AND h.cancel_time IS NULL
+            AND (h.expire_time IS NULL OR h.expire_time > NOW())
+            AND h.frozen IS FALSE
+            AND csp.id IS NULL
+        ORDER BY CASE WHEN h.hold_type IN ('R','F') THEN 0 ELSE 1 END, $holdsort
+        LIMIT $limit
+    SQL
+    
+    $client->respond( $_ ) for ( @$ids );
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.action.hold_request.nearest_hold',
-	api_level	=> 1,
-	stream		=> 1,
-	method		=> 'nearest_hold',
+    api_name    => 'open-ils.storage.action.hold_request.nearest_hold',
+    api_level   => 1,
+    stream      => 1,
+    method      => 'nearest_hold',
 );
 
 sub targetable_holds {
@@ -597,151 +597,151 @@ __PACKAGE__->register_method(
 );
 
 sub next_resp_group_id {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	# XXX This is not replication safe!!!
+    # XXX This is not replication safe!!!
 
-	my ($id) = action::survey->db_Main->selectrow_array(<<"	SQL");
-		SELECT NEXTVAL('action.survey_response_group_id_seq'::TEXT)
-	SQL
-	return $id;
+    my ($id) = action::survey->db_Main->selectrow_array(<<"    SQL");
+        SELECT NEXTVAL('action.survey_response_group_id_seq'::TEXT)
+    SQL
+    return $id;
 }
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.action.survey_response.next_group_id',
-	api_level       => 1,
-	method          => 'next_resp_group_id',
+    api_name        => 'open-ils.storage.action.survey_response.next_group_id',
+    api_level       => 1,
+    method          => 'next_resp_group_id',
 );
 
 sub patron_circ_summary {
-	my $self = shift;
-	my $client = shift;
-	my $id = ''.shift();
-
-	return undef unless ($id);
-	my $c_table = action::circulation->table;
-	my $b_table = money::billing->table;
-
-	$log->debug("Retrieving patron summary for id $id", DEBUG);
-
-	my $select = <<"	SQL";
-		SELECT	COUNT(DISTINCT c.id), SUM( COALESCE(b.amount,0) )
-		  FROM	$c_table c
-		  	LEFT OUTER JOIN $b_table b ON (c.id = b.xact AND b.voided = FALSE)
-		  WHERE	c.usr = ?
-		  	AND c.xact_finish IS NULL
-			AND (
-				c.stop_fines NOT IN ('CLAIMSRETURNED','LOST')
-				OR c.stop_fines IS NULL
-			)
-	SQL
-
-	return action::survey->db_Main->selectrow_arrayref($select, {}, $id);
+    my $self = shift;
+    my $client = shift;
+    my $id = ''.shift();
+
+    return undef unless ($id);
+    my $c_table = action::circulation->table;
+    my $b_table = money::billing->table;
+
+    $log->debug("Retrieving patron summary for id $id", DEBUG);
+
+    my $select = <<"    SQL";
+        SELECT  COUNT(DISTINCT c.id), SUM( COALESCE(b.amount,0) )
+          FROM  $c_table c
+            LEFT OUTER JOIN $b_table b ON (c.id = b.xact AND b.voided = FALSE)
+          WHERE c.usr = ?
+            AND c.xact_finish IS NULL
+            AND (
+                c.stop_fines NOT IN ('CLAIMSRETURNED','LOST')
+                OR c.stop_fines IS NULL
+            )
+    SQL
+
+    return action::survey->db_Main->selectrow_arrayref($select, {}, $id);
 }
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.action.circulation.patron_summary',
-	api_level       => 1,
-	method          => 'patron_circ_summary',
+    api_name        => 'open-ils.storage.action.circulation.patron_summary',
+    api_level       => 1,
+    method          => 'patron_circ_summary',
 );
 
 #XXX Fix stored proc calls
 sub find_local_surveys {
-	my $self = shift;
-	my $client = shift;
-	my $ou = ''.shift();
+    my $self = shift;
+    my $client = shift;
+    my $ou = ''.shift();
 
-	return undef unless ($ou);
-	my $s_table = action::survey->table;
+    return undef unless ($ou);
+    my $s_table = action::survey->table;
 
-	my $select = <<"	SQL";
-		SELECT	s.*
-		  FROM	$s_table s
-		  	JOIN actor.org_unit_full_path(?) p ON (p.id = s.owner)
-		  WHERE	CURRENT_TIMESTAMP BETWEEN s.start_date AND s.end_date
-	SQL
+    my $select = <<"    SQL";
+        SELECT  s.*
+          FROM  $s_table s
+            JOIN actor.org_unit_full_path(?) p ON (p.id = s.owner)
+          WHERE CURRENT_TIMESTAMP BETWEEN s.start_date AND s.end_date
+    SQL
 
-	my $sth = action::survey->db_Main->prepare_cached($select);
-	$sth->execute($ou);
+    my $sth = action::survey->db_Main->prepare_cached($select);
+    $sth->execute($ou);
 
-	$client->respond( $_->to_fieldmapper ) for ( map { action::survey->construct($_) } $sth->fetchall_hash );
+    $client->respond( $_->to_fieldmapper ) for ( map { action::survey->construct($_) } $sth->fetchall_hash );
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.action.survey.all',
-	api_level       => 1,
-	stream          => 1,
-	method          => 'find_local_surveys',
+    api_name        => 'open-ils.storage.action.survey.all',
+    api_level       => 1,
+    stream          => 1,
+    method          => 'find_local_surveys',
 );
 
 #XXX Fix stored proc calls
 sub find_opac_surveys {
-	my $self = shift;
-	my $client = shift;
-	my $ou = ''.shift();
+    my $self = shift;
+    my $client = shift;
+    my $ou = ''.shift();
 
-	return undef unless ($ou);
-	my $s_table = action::survey->table;
+    return undef unless ($ou);
+    my $s_table = action::survey->table;
 
-	my $select = <<"	SQL";
-		SELECT	s.*
-		  FROM	$s_table s
-		  	JOIN actor.org_unit_full_path(?) p ON (p.id = s.owner)
-		  WHERE	CURRENT_TIMESTAMP BETWEEN s.start_date AND s.end_date
-		  	AND s.opac IS TRUE;
-	SQL
+    my $select = <<"    SQL";
+        SELECT  s.*
+          FROM  $s_table s
+            JOIN actor.org_unit_full_path(?) p ON (p.id = s.owner)
+          WHERE CURRENT_TIMESTAMP BETWEEN s.start_date AND s.end_date
+            AND s.opac IS TRUE;
+    SQL
 
-	my $sth = action::survey->db_Main->prepare_cached($select);
-	$sth->execute($ou);
+    my $sth = action::survey->db_Main->prepare_cached($select);
+    $sth->execute($ou);
 
-	$client->respond( $_->to_fieldmapper ) for ( map { action::survey->construct($_) } $sth->fetchall_hash );
+    $client->respond( $_->to_fieldmapper ) for ( map { action::survey->construct($_) } $sth->fetchall_hash );
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.action.survey.opac',
-	api_level       => 1,
-	stream          => 1,
-	method          => 'find_opac_surveys',
+    api_name        => 'open-ils.storage.action.survey.opac',
+    api_level       => 1,
+    stream          => 1,
+    method          => 'find_opac_surveys',
 );
 
 sub hold_pull_list {
-	my $self = shift;
-	my $client = shift;
-	my $ou = shift;
-	my $limit = shift || 10;
-	my $offset = shift || 0;
-
-	return undef unless ($ou);
-	my $h_table = action::hold_request->table;
-	my $a_table = asset::copy->table;
-	my $ord_table = asset::copy_location_order->table;
-
-	my $idlist = 1 if ($self->api_name =~/id_list/o);
-	my $count = 1 if ($self->api_name =~/count$/o);
-
-	my $status_filter = '';
-	$status_filter = 'AND a.status IN (0,7)' if ($self->api_name =~/status_filtered/o);
-
-	my $select = <<"	SQL";
-		SELECT	h.*
-		  FROM	$h_table h
-		  	JOIN $a_table a ON (h.current_copy = a.id)
-		  	LEFT JOIN $ord_table ord ON (a.location = ord.location AND a.circ_lib = ord.org)
-			LEFT JOIN actor.usr_standing_penalty ausp 
-				ON ( h.usr = ausp.usr AND ( ausp.stop_date IS NULL OR ausp.stop_date > NOW() ) )
-			LEFT JOIN config.standing_penalty csp
-				ON ( csp.id = ausp.standing_penalty AND csp.block_list LIKE '%CAPTURE%' )
-		  WHERE	a.circ_lib = ?
-		  	AND h.capture_time IS NULL
-		  	AND h.cancel_time IS NULL
-		  	AND (h.expire_time IS NULL OR h.expire_time > NOW())
-			AND csp.id IS NULL
-			$status_filter
-		  ORDER BY CASE WHEN ord.position IS NOT NULL THEN ord.position ELSE 999 END, h.request_time
-		  LIMIT $limit
-		  OFFSET $offset
-	SQL
+    my $self = shift;
+    my $client = shift;
+    my $ou = shift;
+    my $limit = shift || 10;
+    my $offset = shift || 0;
+
+    return undef unless ($ou);
+    my $h_table = action::hold_request->table;
+    my $a_table = asset::copy->table;
+    my $ord_table = asset::copy_location_order->table;
+
+    my $idlist = 1 if ($self->api_name =~/id_list/o);
+    my $count = 1 if ($self->api_name =~/count$/o);
+
+    my $status_filter = '';
+    $status_filter = 'AND a.status IN (0,7)' if ($self->api_name =~/status_filtered/o);
+
+    my $select = <<"    SQL";
+        SELECT  h.*
+          FROM  $h_table h
+            JOIN $a_table a ON (h.current_copy = a.id)
+            LEFT JOIN $ord_table ord ON (a.location = ord.location AND a.circ_lib = ord.org)
+            LEFT JOIN actor.usr_standing_penalty ausp 
+                ON ( h.usr = ausp.usr AND ( ausp.stop_date IS NULL OR ausp.stop_date > NOW() ) )
+            LEFT JOIN config.standing_penalty csp
+                ON ( csp.id = ausp.standing_penalty AND csp.block_list LIKE '%CAPTURE%' )
+          WHERE a.circ_lib = ?
+            AND h.capture_time IS NULL
+            AND h.cancel_time IS NULL
+            AND (h.expire_time IS NULL OR h.expire_time > NOW())
+            AND csp.id IS NULL
+            $status_filter
+          ORDER BY CASE WHEN ord.position IS NOT NULL THEN ord.position ELSE 999 END, h.request_time
+          LIMIT $limit
+          OFFSET $offset
+    SQL
 
     if ($count) {
         $select = <<"        SQL";
@@ -761,281 +761,281 @@ sub hold_pull_list {
         SQL
     }
 
-	my $sth = action::survey->db_Main->prepare_cached($select);
-	$sth->execute($ou);
+    my $sth = action::survey->db_Main->prepare_cached($select);
+    $sth->execute($ou);
 
-	if ($count) {
-		$client->respond( $sth->fetchall_arrayref()->[0][0] );
-	} elsif ($idlist) {
-		$client->respond( $_->{id} ) for ( $sth->fetchall_hash );
-	} else {
-		$client->respond( $_->to_fieldmapper ) for ( map { action::hold_request->construct($_) } $sth->fetchall_hash );
-	}
+    if ($count) {
+        $client->respond( $sth->fetchall_arrayref()->[0][0] );
+    } elsif ($idlist) {
+        $client->respond( $_->{id} ) for ( $sth->fetchall_hash );
+    } else {
+        $client->respond( $_->to_fieldmapper ) for ( map { action::hold_request->construct($_) } $sth->fetchall_hash );
+    }
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.direct.action.hold_request.pull_list.current_copy_circ_lib.count',
-	api_level       => 1,
-	stream          => 1,
-	signature	=> [
-		"Returns a count of holds for a specific library's pull list.",
- 		[ [org_unit => "The library's org id", "number"] ],
-		['A count of holds for the stated library to pull ', 'number']
-	],
-	method          => 'hold_pull_list',
+    api_name        => 'open-ils.storage.direct.action.hold_request.pull_list.current_copy_circ_lib.count',
+    api_level       => 1,
+    stream          => 1,
+    signature   => [
+        "Returns a count of holds for a specific library's pull list.",
+        [ [org_unit => "The library's org id", "number"] ],
+        ['A count of holds for the stated library to pull ', 'number']
+    ],
+    method          => 'hold_pull_list',
 );
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.direct.action.hold_request.pull_list.current_copy_circ_lib.status_filtered.count',
-	api_level       => 1,
-	stream          => 1,
-	signature	=> [
-		"Returns a status filtered count of holds for a specific library's pull list.",
- 		[ [org_unit => "The library's org id", "number"] ],
-		['A status filtered count of holds for the stated library to pull ', 'number']
-	],
-	method          => 'hold_pull_list',
+    api_name        => 'open-ils.storage.direct.action.hold_request.pull_list.current_copy_circ_lib.status_filtered.count',
+    api_level       => 1,
+    stream          => 1,
+    signature   => [
+        "Returns a status filtered count of holds for a specific library's pull list.",
+        [ [org_unit => "The library's org id", "number"] ],
+        ['A status filtered count of holds for the stated library to pull ', 'number']
+    ],
+    method          => 'hold_pull_list',
 );
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.direct.action.hold_request.pull_list.id_list.current_copy_circ_lib',
-	api_level       => 1,
-	stream          => 1,
-	signature	=> [
-		"Returns the hold ids for a specific library's pull list.",
- 		[ [org_unit => "The library's org id", "number"],
-		  [limit => 'An optional page size, defaults to 10', 'number'],
-		  [offset => 'Offset for paging, defaults to 0, 0 based', 'number'],
-		],
-		['A list of holds for the stated library to pull for', 'array']
-	],
-	method          => 'hold_pull_list',
+    api_name        => 'open-ils.storage.direct.action.hold_request.pull_list.id_list.current_copy_circ_lib',
+    api_level       => 1,
+    stream          => 1,
+    signature   => [
+        "Returns the hold ids for a specific library's pull list.",
+        [ [org_unit => "The library's org id", "number"],
+          [limit => 'An optional page size, defaults to 10', 'number'],
+          [offset => 'Offset for paging, defaults to 0, 0 based', 'number'],
+        ],
+        ['A list of holds for the stated library to pull for', 'array']
+    ],
+    method          => 'hold_pull_list',
 );
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.direct.action.hold_request.pull_list.search.current_copy_circ_lib',
-	api_level       => 1,
-	stream          => 1,
-	signature	=> [
-		"Returns the holds for a specific library's pull list.",
- 		[ [org_unit => "The library's org id", "number"],
-		  [limit => 'An optional page size, defaults to 10', 'number'],
-		  [offset => 'Offset for paging, defaults to 0, 0 based', 'number'],
-		],
-		['A list of holds for the stated library to pull for', 'array']
-	],
-	method          => 'hold_pull_list',
+    api_name        => 'open-ils.storage.direct.action.hold_request.pull_list.search.current_copy_circ_lib',
+    api_level       => 1,
+    stream          => 1,
+    signature   => [
+        "Returns the holds for a specific library's pull list.",
+        [ [org_unit => "The library's org id", "number"],
+          [limit => 'An optional page size, defaults to 10', 'number'],
+          [offset => 'Offset for paging, defaults to 0, 0 based', 'number'],
+        ],
+        ['A list of holds for the stated library to pull for', 'array']
+    ],
+    method          => 'hold_pull_list',
 );
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.direct.action.hold_request.pull_list.id_list.current_copy_circ_lib.status_filtered',
-	api_level       => 1,
-	stream          => 1,
-	signature	=> [
-		"Returns the hold ids for a specific library's pull list that are definitely in that library, based on status.",
- 		[ [org_unit => "The library's org id", "number"],
-		  [limit => 'An optional page size, defaults to 10', 'number'],
-		  [offset => 'Offset for paging, defaults to 0, 0 based', 'number'],
-		],
-		['A list of holds for the stated library to pull for', 'array']
-	],
-	method          => 'hold_pull_list',
+    api_name        => 'open-ils.storage.direct.action.hold_request.pull_list.id_list.current_copy_circ_lib.status_filtered',
+    api_level       => 1,
+    stream          => 1,
+    signature   => [
+        "Returns the hold ids for a specific library's pull list that are definitely in that library, based on status.",
+        [ [org_unit => "The library's org id", "number"],
+          [limit => 'An optional page size, defaults to 10', 'number'],
+          [offset => 'Offset for paging, defaults to 0, 0 based', 'number'],
+        ],
+        ['A list of holds for the stated library to pull for', 'array']
+    ],
+    method          => 'hold_pull_list',
 );
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.direct.action.hold_request.pull_list.search.current_copy_circ_lib.status_filtered',
-	api_level       => 1,
-	stream          => 1,
-	signature	=> [
-		"Returns the holds for a specific library's pull list that are definitely in that library, based on status.",
- 		[ [org_unit => "The library's org id", "number"],
-		  [limit => 'An optional page size, defaults to 10', 'number'],
-		  [offset => 'Offset for paging, defaults to 0, 0 based', 'number'],
-		],
-		['A list of holds for the stated library to pull for', 'array']
-	],
-	method          => 'hold_pull_list',
+    api_name        => 'open-ils.storage.direct.action.hold_request.pull_list.search.current_copy_circ_lib.status_filtered',
+    api_level       => 1,
+    stream          => 1,
+    signature   => [
+        "Returns the holds for a specific library's pull list that are definitely in that library, based on status.",
+        [ [org_unit => "The library's org id", "number"],
+          [limit => 'An optional page size, defaults to 10', 'number'],
+          [offset => 'Offset for paging, defaults to 0, 0 based', 'number'],
+        ],
+        ['A list of holds for the stated library to pull for', 'array']
+    ],
+    method          => 'hold_pull_list',
 );
 
 sub find_optional_surveys {
-	my $self = shift;
-	my $client = shift;
-	my $ou = ''.shift();
+    my $self = shift;
+    my $client = shift;
+    my $ou = ''.shift();
 
-	return undef unless ($ou);
-	my $s_table = action::survey->table;
+    return undef unless ($ou);
+    my $s_table = action::survey->table;
 
-	my $select = <<"	SQL";
-		SELECT	s.*
-		  FROM	$s_table s
-		  	JOIN actor.org_unit_full_path(?) p ON (p.id = s.owner)
-		  WHERE	CURRENT_TIMESTAMP BETWEEN s.start_date AND s.end_date
-		  	AND s.required IS FALSE;
-	SQL
+    my $select = <<"    SQL";
+        SELECT  s.*
+          FROM  $s_table s
+            JOIN actor.org_unit_full_path(?) p ON (p.id = s.owner)
+          WHERE CURRENT_TIMESTAMP BETWEEN s.start_date AND s.end_date
+            AND s.required IS FALSE;
+    SQL
 
-	my $sth = action::survey->db_Main->prepare_cached($select);
-	$sth->execute($ou);
+    my $sth = action::survey->db_Main->prepare_cached($select);
+    $sth->execute($ou);
 
-	$client->respond( $_->to_fieldmapper ) for ( map { action::survey->construct($_) } $sth->fetchall_hash );
+    $client->respond( $_->to_fieldmapper ) for ( map { action::survey->construct($_) } $sth->fetchall_hash );
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.action.survey.optional',
-	api_level       => 1,
-	stream          => 1,
-	method          => 'find_optional_surveys',
+    api_name        => 'open-ils.storage.action.survey.optional',
+    api_level       => 1,
+    stream          => 1,
+    method          => 'find_optional_surveys',
 );
 
 sub find_required_surveys {
-	my $self = shift;
-	my $client = shift;
-	my $ou = ''.shift();
+    my $self = shift;
+    my $client = shift;
+    my $ou = ''.shift();
 
-	return undef unless ($ou);
-	my $s_table = action::survey->table;
+    return undef unless ($ou);
+    my $s_table = action::survey->table;
 
-	my $select = <<"	SQL";
-		SELECT	s.*
-		  FROM	$s_table s
-		  	JOIN actor.org_unit_full_path(?) p ON (p.id = s.owner)
-		  WHERE	CURRENT_TIMESTAMP BETWEEN s.start_date AND s.end_date
-		  	AND s.required IS TRUE;
-	SQL
+    my $select = <<"    SQL";
+        SELECT  s.*
+          FROM  $s_table s
+            JOIN actor.org_unit_full_path(?) p ON (p.id = s.owner)
+          WHERE CURRENT_TIMESTAMP BETWEEN s.start_date AND s.end_date
+            AND s.required IS TRUE;
+    SQL
 
-	my $sth = action::survey->db_Main->prepare_cached($select);
-	$sth->execute($ou);
+    my $sth = action::survey->db_Main->prepare_cached($select);
+    $sth->execute($ou);
 
-	$client->respond( $_->to_fieldmapper ) for ( map { action::survey->construct($_) } $sth->fetchall_hash );
+    $client->respond( $_->to_fieldmapper ) for ( map { action::survey->construct($_) } $sth->fetchall_hash );
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.action.survey.required',
-	api_level       => 1,
-	stream          => 1,
-	method          => 'find_required_surveys',
+    api_name        => 'open-ils.storage.action.survey.required',
+    api_level       => 1,
+    stream          => 1,
+    method          => 'find_required_surveys',
 );
 
 sub find_usr_summary_surveys {
-	my $self = shift;
-	my $client = shift;
-	my $ou = ''.shift();
+    my $self = shift;
+    my $client = shift;
+    my $ou = ''.shift();
 
-	return undef unless ($ou);
-	my $s_table = action::survey->table;
+    return undef unless ($ou);
+    my $s_table = action::survey->table;
 
-	my $select = <<"	SQL";
-		SELECT	s.*
-		  FROM	$s_table s
-		  	JOIN actor.org_unit_full_path(?) p ON (p.id = s.owner)
-		  WHERE	CURRENT_TIMESTAMP BETWEEN s.start_date AND s.end_date
-		  	AND s.usr_summary IS TRUE;
-	SQL
+    my $select = <<"    SQL";
+        SELECT  s.*
+          FROM  $s_table s
+            JOIN actor.org_unit_full_path(?) p ON (p.id = s.owner)
+          WHERE CURRENT_TIMESTAMP BETWEEN s.start_date AND s.end_date
+            AND s.usr_summary IS TRUE;
+    SQL
 
-	my $sth = action::survey->db_Main->prepare_cached($select);
-	$sth->execute($ou);
+    my $sth = action::survey->db_Main->prepare_cached($select);
+    $sth->execute($ou);
 
-	$client->respond( $_->to_fieldmapper ) for ( map { action::survey->construct($_) } $sth->fetchall_hash );
+    $client->respond( $_->to_fieldmapper ) for ( map { action::survey->construct($_) } $sth->fetchall_hash );
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.action.survey.usr_summary',
-	api_level       => 1,
-	stream          => 1,
-	method          => 'find_usr_summary_surveys',
+    api_name        => 'open-ils.storage.action.survey.usr_summary',
+    api_level       => 1,
+    stream          => 1,
+    method          => 'find_usr_summary_surveys',
 );
 
 sub seconds_to_interval_hash {
-		my $interval = shift;
-		my $limit = shift || 's';
-		$limit =~ s/^(.)/$1/o;
-
-		my %output;
-
-		my ($y,$ym,$M,$Mm,$w,$wm,$d,$dm,$h,$hm,$m,$mm,$s);
-		my ($year, $month, $week, $day, $hour, $minute, $second) =
-				('years','months','weeks','days', 'hours', 'minutes', 'seconds');
-
-		if ($y = int($interval / (60 * 60 * 24 * 365))) {
-				$output{$year} = $y;
-				$ym = $interval % (60 * 60 * 24 * 365);
-		} else {
-				$ym = $interval;
-		}
-		return %output if ($limit eq 'y');
-
-		if ($M = int($ym / ((60 * 60 * 24 * 365)/12))) {
-				$output{$month} = $M;
-				$Mm = $ym % ((60 * 60 * 24 * 365)/12);
-		} else {
-				$Mm = $ym;
-		}
-		return %output if ($limit eq 'M');
-
-		if ($w = int($Mm / 604800)) {
-				$output{$week} = $w;
-				$wm = $Mm % 604800;
-		} else {
-				$wm = $Mm;
-		}
-		return %output if ($limit eq 'w');
-
-		if ($d = int($wm / 86400)) {
-				$output{$day} = $d;
-				$dm = $wm % 86400;
-		} else {
-				$dm = $wm;
-		}
-		return %output if ($limit eq 'd');
-
-		if ($h = int($dm / 3600)) {
-				$output{$hour} = $h;
-				$hm = $dm % 3600;
-		} else {
-				$hm = $dm;
-		}
-		return %output if ($limit eq 'h');
-
-		if ($m = int($hm / 60)) {
-				$output{$minute} = $m;
-				$mm = $hm % 60;
-		} else {
-				$mm = $hm;
-		}
-		return %output if ($limit eq 'm');
-
-		if ($s = int($mm)) {
-				$output{$second} = $s;
-		} else {
-				$output{$second} = 0 unless (keys %output);
-		}
-		return %output;
+        my $interval = shift;
+        my $limit = shift || 's';
+        $limit =~ s/^(.)/$1/o;
+
+        my %output;
+
+        my ($y,$ym,$M,$Mm,$w,$wm,$d,$dm,$h,$hm,$m,$mm,$s);
+        my ($year, $month, $week, $day, $hour, $minute, $second) =
+                ('years','months','weeks','days', 'hours', 'minutes', 'seconds');
+
+        if ($y = int($interval / (60 * 60 * 24 * 365))) {
+                $output{$year} = $y;
+                $ym = $interval % (60 * 60 * 24 * 365);
+        } else {
+                $ym = $interval;
+        }
+        return %output if ($limit eq 'y');
+
+        if ($M = int($ym / ((60 * 60 * 24 * 365)/12))) {
+                $output{$month} = $M;
+                $Mm = $ym % ((60 * 60 * 24 * 365)/12);
+        } else {
+                $Mm = $ym;
+        }
+        return %output if ($limit eq 'M');
+
+        if ($w = int($Mm / 604800)) {
+                $output{$week} = $w;
+                $wm = $Mm % 604800;
+        } else {
+                $wm = $Mm;
+        }
+        return %output if ($limit eq 'w');
+
+        if ($d = int($wm / 86400)) {
+                $output{$day} = $d;
+                $dm = $wm % 86400;
+        } else {
+                $dm = $wm;
+        }
+        return %output if ($limit eq 'd');
+
+        if ($h = int($dm / 3600)) {
+                $output{$hour} = $h;
+                $hm = $dm % 3600;
+        } else {
+                $hm = $dm;
+        }
+        return %output if ($limit eq 'h');
+
+        if ($m = int($hm / 60)) {
+                $output{$minute} = $m;
+                $mm = $hm % 60;
+        } else {
+                $mm = $hm;
+        }
+        return %output if ($limit eq 'm');
+
+        if ($s = int($mm)) {
+                $output{$second} = $s;
+        } else {
+                $output{$second} = 0 unless (keys %output);
+        }
+        return %output;
 }
 
 
 sub generate_fines {
-	my $self = shift;
-	my $client = shift;
-	my $circ = shift;
-	my $overbill = shift;
+    my $self = shift;
+    my $client = shift;
+    my $circ = shift;
+    my $overbill = shift;
 
-	local $OpenILS::Application::Storage::WRITE = 1;
+    local $OpenILS::Application::Storage::WRITE = 1;
 
-	my @circs;
-	if ($circ) {
-		push @circs,
+    my @circs;
+    if ($circ) {
+        push @circs,
             action::circulation->search_where( { id => $circ, stop_fines => undef } ),
             booking::reservation->search_where( { id => $circ, return_time => undef, cancel_time => undef } );
-	} else {
-		push @circs, overdue_circs();
-	}
+    } else {
+        push @circs, overdue_circs();
+    }
 
-	my %hoo = map { ( $_->id => $_ ) } actor::org_unit::hours_of_operation->retrieve_all;
+    my %hoo = map { ( $_->id => $_ ) } actor::org_unit::hours_of_operation->retrieve_all;
 
-	my $penalty = OpenSRF::AppSession->create('open-ils.penalty');
-	for my $c (@circs) {
+    my $penalty = OpenSRF::AppSession->create('open-ils.penalty');
+    for my $c (@circs) {
 
         my $ctype = ref($c);
         $ctype =~ s/^.+::(\w+)$/$1/;
-	
+    
         my $due_date_method = 'due_date';
         my $target_copy_method = 'target_copy';
         my $circ_lib_method = 'circ_lib';
@@ -1052,76 +1052,76 @@ sub generate_fines {
         #TODO: reservation grace periods
         my $grace_period = ($is_reservation ? 0 : interval_to_seconds($c->grace_period));
 
-		eval {
-			if ($self->method_lookup('open-ils.storage.transaction.current')->run) {
-				$log->debug("Cleaning up after previous transaction\n");
-				$self->method_lookup('open-ils.storage.transaction.rollback')->run;
-			}
-			$self->method_lookup('open-ils.storage.transaction.begin')->run( $client );
-			$log->info(
-				sprintf("Processing %s %d...",
-					($is_reservation ? "reservation" : "circ"), $c->id
-				)
-			);
-
-
-			my $due_dt = $parser->parse_datetime( cleanse_ISO8601( $c->$due_date_method ) );
-	
-			my $due = $due_dt->epoch;
-			my $now = time;
-
-			my $fine_interval = $c->fine_interval;
+        eval {
+            if ($self->method_lookup('open-ils.storage.transaction.current')->run) {
+                $log->debug("Cleaning up after previous transaction\n");
+                $self->method_lookup('open-ils.storage.transaction.rollback')->run;
+            }
+            $self->method_lookup('open-ils.storage.transaction.begin')->run( $client );
+            $log->info(
+                sprintf("Processing %s %d...",
+                    ($is_reservation ? "reservation" : "circ"), $c->id
+                )
+            );
+
+
+            my $due_dt = $parser->parse_datetime( cleanse_ISO8601( $c->$due_date_method ) );
+    
+            my $due = $due_dt->epoch;
+            my $now = time;
+
+            my $fine_interval = $c->fine_interval;
             $fine_interval =~ s/(\d{2}):(\d{2}):(\d{2})/$1 h $2 m $3 s/o;
-			$fine_interval = interval_to_seconds( $fine_interval );
-	
+            $fine_interval = interval_to_seconds( $fine_interval );
+    
             if ( $fine_interval == 0 || int($c->$recurring_fine_method * 100) == 0 || int($c->max_fine * 100) == 0 ) {
                 $client->respond( "Fine Generator skipping circ due to 0 fine interval, 0 fine rate, or 0 max fine.\n" );
                 $log->info( "Fine Generator skipping circ " . $c->id . " due to 0 fine interval, 0 fine rate, or 0 max fine." );
                 next;
             }
 
-			if ( $is_reservation and $fine_interval >= interval_to_seconds('1d') ) {	
-				my $tz_offset_s = 0;
-				if ($due_dt->strftime('%z') =~ /(-|\+)(\d{2}):?(\d{2})/) {
-					$tz_offset_s = $1 . interval_to_seconds( "${2}h ${3}m"); 
-				}
-	
-				$due -= ($due % $fine_interval) + $tz_offset_s;
-				$now -= ($now % $fine_interval) + $tz_offset_s;
-			}
-	
-			$client->respond(
-				"ARG! Overdue $ctype ".$c->id.
-				" for item ".$c->$target_copy_method.
-				" (user ".$c->usr.").\n".
-				"\tItem was due on or before: ".localtime($due)."\n");
-	
-			my @fines = money::billing->search_where(
-				{ xact => $c->id,
-				  btype => 1,
-				  billing_ts => { '>' => $c->$due_date_method } },
-				{ order_by => 'billing_ts DESC'}
-			);
-
-			my $f_idx = 0;
-			my $fine = $fines[$f_idx] if (@fines);
-			if ($overbill) {
-				$fine = $fines[++$f_idx] while ($fine and $fine->voided);
-			}
-
-			my $current_fine_total = 0;
-			$current_fine_total += int($_->amount * 100) for (grep { $_ and !$_->voided } @fines);
-	
-			my $last_fine;
-			if ($fine) {
-				$client->respond( "Last billing time: ".$fine->billing_ts." (clensed format: ".cleanse_ISO8601( $fine->billing_ts ).")");
-				$last_fine = $parser->parse_datetime( cleanse_ISO8601( $fine->billing_ts ) )->epoch;
-			} else {
-				$log->info( "Potential first billing for circ ".$c->id );
-				$last_fine = $due;
-
-				$grace_period = OpenILS::Application::Circ::CircCommon->extend_grace_period($c->$circ_lib_method->to_fieldmapper->id,$c->$due_date_method,$grace_period,undef,$hoo{$c->$circ_lib_method});
-			}
+            if ( $is_reservation and $fine_interval >= interval_to_seconds('1d') ) {    
+                my $tz_offset_s = 0;
+                if ($due_dt->strftime('%z') =~ /(-|\+)(\d{2}):?(\d{2})/) {
+                    $tz_offset_s = $1 . interval_to_seconds( "${2}h ${3}m"); 
+                }
+    
+                $due -= ($due % $fine_interval) + $tz_offset_s;
+                $now -= ($now % $fine_interval) + $tz_offset_s;
+            }
+    
+            $client->respond(
+                "ARG! Overdue $ctype ".$c->id.
+                " for item ".$c->$target_copy_method.
+                " (user ".$c->usr.").\n".
+                "\tItem was due on or before: ".localtime($due)."\n");
+    
+            my @fines = money::billing->search_where(
+                { xact => $c->id,
+                  btype => 1,
+                  billing_ts => { '>' => $c->$due_date_method } },
+                { order_by => 'billing_ts DESC'}
+            );
+
+            my $f_idx = 0;
+            my $fine = $fines[$f_idx] if (@fines);
+            if ($overbill) {
+                $fine = $fines[++$f_idx] while ($fine and $fine->voided);
+            }
+
+            my $current_fine_total = 0;
+            $current_fine_total += int($_->amount * 100) for (grep { $_ and !$_->voided } @fines);
+    
+            my $last_fine;
+            if ($fine) {
+                $client->respond( "Last billing time: ".$fine->billing_ts." (clensed format: ".cleanse_ISO8601( $fine->billing_ts ).")");
+                $last_fine = $parser->parse_datetime( cleanse_ISO8601( $fine->billing_ts ) )->epoch;
+            } else {
+                $log->info( "Potential first billing for circ ".$c->id );
+                $last_fine = $due;
+
+                $grace_period = OpenILS::Application::Circ::CircCommon->extend_grace_period($c->$circ_lib_method->to_fieldmapper->id,$c->$due_date_method,$grace_period,undef,$hoo{$c->$circ_lib_method});
+            }
 
             next if ($last_fine > $now);
             # Generate fines for each past interval, including the one we are inside
@@ -1139,214 +1139,214 @@ sub generate_fines {
             $client->respond( "\t$pending_fine_count pending fine(s)\n" );
             next unless ($pending_fine_count);
 
-			my $recurring_fine = int($c->$recurring_fine_method * 100);
-			my $max_fine = int($c->max_fine * 100);
-
-			my $skip_closed_check = $U->ou_ancestor_setting_value(
-				$c->$circ_lib_method->to_fieldmapper->id, 'circ.fines.charge_when_closed');
-			$skip_closed_check = $U->is_true($skip_closed_check);
-
-			my $truncate_to_max_fine = $U->ou_ancestor_setting_value(
-				$c->$circ_lib_method->to_fieldmapper->id, 'circ.fines.truncate_to_max_fine');
-			$truncate_to_max_fine = $U->is_true($truncate_to_max_fine);
-
-			my ($latest_billing_ts, $latest_amount) = ('',0);
-			for (my $bill = 1; $bill <= $pending_fine_count; $bill++) {
-	
-				if ($current_fine_total >= $max_fine) {
-					$c->update({stop_fines => 'MAXFINES', stop_fines_time => 'now'}) if ($ctype eq 'circulation');
-					$client->respond(
-						"\tMaximum fine level of ".$c->max_fine.
-						" reached for this $ctype.\n".
-						"\tNo more fines will be generated.\n" );
-					last;
-				}
-				
-				# XXX Use org time zone (or default to 'local') once we have the ou setting built for that
-				my $billing_ts = DateTime->from_epoch( epoch => $last_fine, time_zone => 'local' );
-				my $current_bill_count = $bill;
-				while ( $current_bill_count ) {
-					$billing_ts->add( seconds_to_interval_hash( $fine_interval ) );
-					$current_bill_count--;
-				}
-
-				my $timestamptz = $billing_ts->strftime('%FT%T%z');
-				if (!$skip_closed_check) {
-					my $dow = $billing_ts->day_of_week_0();
-					my $dow_open = "dow_${dow}_open";
-					my $dow_close = "dow_${dow}_close";
-
-					if (my $h = $hoo{$c->$circ_lib_method}) {
-						next if ( $h->$dow_open eq '00:00:00' and $h->$dow_close eq '00:00:00');
-					}
-	
-					my @cl = actor::org_unit::closed_date->search_where(
-							{ close_start	=> { '<=' => $timestamptz },
-							  close_end	=> { '>=' => $timestamptz },
-							  org_unit	=> $c->$circ_lib_method }
-					);
-					next if (@cl);
-				}
-
-				# The billing amount for this billing normally ought to be the recurring fine amount.
-				# However, if the recurring fine amount would cause total fines to exceed the max fine amount,
-				# we may wish to reduce the amount for this billing (if circ.fines.truncate_to_max_fine is true).
-				my $this_billing_amount = $recurring_fine;
-				if ( $truncate_to_max_fine && ($current_fine_total + $this_billing_amount) > $max_fine ) {
-					$this_billing_amount = ($max_fine - $current_fine_total);
-				}
-				$current_fine_total += $this_billing_amount;
-				$latest_amount += $this_billing_amount;
-				$latest_billing_ts = $timestamptz;
-
-				money::billing->create(
-					{ xact		=> ''.$c->id,
-					  note		=> "System Generated Overdue Fine",
-					  billing_type	=> "Overdue materials",
-					  btype		=> 1,
-					  amount	=> sprintf('%0.2f', $this_billing_amount/100),
-					  billing_ts	=> $timestamptz,
-					}
-				);
-
-			}
-
-			$client->respond( "\t\tAdding fines totaling $latest_amount for overdue up to $latest_billing_ts\n" )
-				if ($latest_billing_ts and $latest_amount);
-
-			$self->method_lookup('open-ils.storage.transaction.commit')->run;
-
-			if(1) { 
+            my $recurring_fine = int($c->$recurring_fine_method * 100);
+            my $max_fine = int($c->max_fine * 100);
+
+            my $skip_closed_check = $U->ou_ancestor_setting_value(
+                $c->$circ_lib_method->to_fieldmapper->id, 'circ.fines.charge_when_closed');
+            $skip_closed_check = $U->is_true($skip_closed_check);
+
+            my $truncate_to_max_fine = $U->ou_ancestor_setting_value(
+                $c->$circ_lib_method->to_fieldmapper->id, 'circ.fines.truncate_to_max_fine');
+            $truncate_to_max_fine = $U->is_true($truncate_to_max_fine);
+
+            my ($latest_billing_ts, $latest_amount) = ('',0);
+            for (my $bill = 1; $bill <= $pending_fine_count; $bill++) {
+    
+                if ($current_fine_total >= $max_fine) {
+                    $c->update({stop_fines => 'MAXFINES', stop_fines_time => 'now'}) if ($ctype eq 'circulation');
+                    $client->respond(
+                        "\tMaximum fine level of ".$c->max_fine.
+                        " reached for this $ctype.\n".
+                        "\tNo more fines will be generated.\n" );
+                    last;
+                }
+                
+                # XXX Use org time zone (or default to 'local') once we have the ou setting built for that
+                my $billing_ts = DateTime->from_epoch( epoch => $last_fine, time_zone => 'local' );
+                my $current_bill_count = $bill;
+                while ( $current_bill_count ) {
+                    $billing_ts->add( seconds_to_interval_hash( $fine_interval ) );
+                    $current_bill_count--;
+                }
+
+                my $timestamptz = $billing_ts->strftime('%FT%T%z');
+                if (!$skip_closed_check) {
+                    my $dow = $billing_ts->day_of_week_0();
+                    my $dow_open = "dow_${dow}_open";
+                    my $dow_close = "dow_${dow}_close";
+
+                    if (my $h = $hoo{$c->$circ_lib_method}) {
+                        next if ( $h->$dow_open eq '00:00:00' and $h->$dow_close eq '00:00:00');
+                    }
+    
+                    my @cl = actor::org_unit::closed_date->search_where(
+                            { close_start   => { '<=' => $timestamptz },
+                              close_end => { '>=' => $timestamptz },
+                              org_unit  => $c->$circ_lib_method }
+                    );
+                    next if (@cl);
+                }
+
+                # The billing amount for this billing normally ought to be the recurring fine amount.
+                # However, if the recurring fine amount would cause total fines to exceed the max fine amount,
+                # we may wish to reduce the amount for this billing (if circ.fines.truncate_to_max_fine is true).
+                my $this_billing_amount = $recurring_fine;
+                if ( $truncate_to_max_fine && ($current_fine_total + $this_billing_amount) > $max_fine ) {
+                    $this_billing_amount = ($max_fine - $current_fine_total);
+                }
+                $current_fine_total += $this_billing_amount;
+                $latest_amount += $this_billing_amount;
+                $latest_billing_ts = $timestamptz;
+
+                money::billing->create(
+                    { xact      => ''.$c->id,
+                      note      => "System Generated Overdue Fine",
+                      billing_type  => "Overdue materials",
+                      btype     => 1,
+                      amount    => sprintf('%0.2f', $this_billing_amount/100),
+                      billing_ts    => $timestamptz,
+                    }
+                );
+
+            }
+
+            $client->respond( "\t\tAdding fines totaling $latest_amount for overdue up to $latest_billing_ts\n" )
+                if ($latest_billing_ts and $latest_amount);
+
+            $self->method_lookup('open-ils.storage.transaction.commit')->run;
+
+            if(1) { 
 
                 # Caluclate penalties inline
-				OpenILS::Utils::Penalty->calculate_penalties(
-					undef, $c->usr->to_fieldmapper->id.'', $c->$circ_lib_method->to_fieldmapper->id.'');
+                OpenILS::Utils::Penalty->calculate_penalties(
+                    undef, $c->usr->to_fieldmapper->id.'', $c->$circ_lib_method->to_fieldmapper->id.'');
 
-			} else {
+            } else {
 
                 # Calculate penalties with an aysnc call to the penalty server.  This approach
                 # may lead to duplicate penalties since multiple penalty processes for a
                 # given user may be running at the same time. Leave this here for reference 
                 # in case we later find that asyc calls are needed in some environments.
-				$penalty->request(
-				    'open-ils.penalty.patron_penalty.calculate',
-				    { patronid	=> ''.$c->usr,
-				    context_org	=> ''.$c->$circ_lib_method,
-				    update	=> 1,
-				    background	=> 1,
-				    }
-			    )->gather(1);
-			}
-
-		};
-
-		if ($@) {
-			my $e = $@;
-			$client->respond( "Error processing overdue $ctype [".$c->id."]:\n\n$e\n" );
-			$log->error("Error processing overdue $ctype [".$c->id."]:\n$e\n");
-			$self->method_lookup('open-ils.storage.transaction.rollback')->run;
-			last if ($e =~ /IS NOT CONNECTED TO THE NETWORK/o);
-		}
-	}
+                $penalty->request(
+                    'open-ils.penalty.patron_penalty.calculate',
+                    { patronid  => ''.$c->usr,
+                    context_org => ''.$c->$circ_lib_method,
+                    update  => 1,
+                    background  => 1,
+                    }
+                )->gather(1);
+            }
+
+        };
+
+        if ($@) {
+            my $e = $@;
+            $client->respond( "Error processing overdue $ctype [".$c->id."]:\n\n$e\n" );
+            $log->error("Error processing overdue $ctype [".$c->id."]:\n$e\n");
+            $self->method_lookup('open-ils.storage.transaction.rollback')->run;
+            last if ($e =~ /IS NOT CONNECTED TO THE NETWORK/o);
+        }
+    }
 }
 __PACKAGE__->register_method(
-	api_name        => 'open-ils.storage.action.circulation.overdue.generate_fines',
-	api_level       => 1,
-	stream		=> 1,
-	method          => 'generate_fines',
+    api_name        => 'open-ils.storage.action.circulation.overdue.generate_fines',
+    api_level       => 1,
+    stream      => 1,
+    method          => 'generate_fines',
 );
 
 
 
 sub new_hold_copy_targeter {
-	my $self = shift;
-	my $client = shift;
-	my $check_expire = shift;
-	my $one_hold = shift;
+    my $self = shift;
+    my $client = shift;
+    my $check_expire = shift;
+    my $one_hold = shift;
     my $find_copy = shift;
 
-	local $OpenILS::Application::Storage::WRITE = 1;
-
-	$self->{target_weight} = {};
-	$self->{max_loops} = {};
-
-	my $holds;
-
-	try {
-		if ($one_hold) {
-			$self->method_lookup('open-ils.storage.transaction.begin')->run( $client );
-			$holds = [ action::hold_request->search_where( { id => $one_hold, fulfillment_time => undef, cancel_time => undef, frozen => 'f' } ) ];
-		} elsif ( $check_expire ) {
-
-			# what's the retarget time threashold?
-			my $time = time;
-			$check_expire ||= '12h';
-			$check_expire = interval_to_seconds( $check_expire );
-
-			my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time() - $check_expire);
-			$year += 1900;
-			$mon += 1;
-			my $expire_threshold = sprintf(
-				'%s-%0.2d-%0.2dT%0.2d:%0.2d:%0.2d-00',
-				$year, $mon, $mday, $hour, $min, $sec
-			);
-
-			# find all the holds holds needing retargeting
-			$holds = [ action::hold_request->search_where(
-							{ capture_time => undef,
-							  fulfillment_time => undef,
-							  cancel_time => undef,
-							  frozen => 'f',
-							  prev_check_time => { '<=' => $expire_threshold },
-							},
-							{ order_by => 'selection_depth DESC, request_time,prev_check_time' } ) ];
-
-			# find all the holds holds needing first time targeting
-			push @$holds, action::hold_request->search(
-							capture_time => undef,
-							fulfillment_time => undef,
-				  			prev_check_time => undef,
-							frozen => 'f',
-							cancel_time => undef,
-							{ order_by => 'selection_depth DESC, request_time' } );
-		} else {
-
-			# find all the holds holds needing first time targeting ONLY
-			$holds = [ action::hold_request->search(
-							capture_time => undef,
-							fulfillment_time => undef,
-				  			prev_check_time => undef,
-							cancel_time => undef,
-							frozen => 'f',
-							{ order_by => 'selection_depth DESC, request_time' } ) ];
-		}
-	} catch Error with {
-		my $e = shift;
-		die "Could not retrieve uncaptured hold requests:\n\n$e\n";
-	};
-
-	my @closed = actor::org_unit::closed_date->search_where(
-		{ close_start => { '<=', 'now' },
-		  close_end => { '>=', 'now' } }
-	);
+    local $OpenILS::Application::Storage::WRITE = 1;
+
+    $self->{target_weight} = {};
+    $self->{max_loops} = {};
+
+    my $holds;
+
+    try {
+        if ($one_hold) {
+            $self->method_lookup('open-ils.storage.transaction.begin')->run( $client );
+            $holds = [ action::hold_request->search_where( { id => $one_hold, fulfillment_time => undef, cancel_time => undef, frozen => 'f' } ) ];
+        } elsif ( $check_expire ) {
+
+            # what's the retarget time threashold?
+            my $time = time;
+            $check_expire ||= '12h';
+            $check_expire = interval_to_seconds( $check_expire );
+
+            my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time() - $check_expire);
+            $year += 1900;
+            $mon += 1;
+            my $expire_threshold = sprintf(
+                '%s-%0.2d-%0.2dT%0.2d:%0.2d:%0.2d-00',
+                $year, $mon, $mday, $hour, $min, $sec
+            );
+
+            # find all the holds holds needing retargeting
+            $holds = [ action::hold_request->search_where(
+                            { capture_time => undef,
+                              fulfillment_time => undef,
+                              cancel_time => undef,
+                              frozen => 'f',
+                              prev_check_time => { '<=' => $expire_threshold },
+                            },
+                            { order_by => 'selection_depth DESC, request_time,prev_check_time' } ) ];
+
+            # find all the holds holds needing first time targeting
+            push @$holds, action::hold_request->search(
+                            capture_time => undef,
+                            fulfillment_time => undef,
+                            prev_check_time => undef,
+                            frozen => 'f',
+                            cancel_time => undef,
+                            { order_by => 'selection_depth DESC, request_time' } );
+        } else {
+
+            # find all the holds holds needing first time targeting ONLY
+            $holds = [ action::hold_request->search(
+                            capture_time => undef,
+                            fulfillment_time => undef,
+                            prev_check_time => undef,
+                            cancel_time => undef,
+                            frozen => 'f',
+                            { order_by => 'selection_depth DESC, request_time' } ) ];
+        }
+    } catch Error with {
+        my $e = shift;
+        die "Could not retrieve uncaptured hold requests:\n\n$e\n";
+    };
+
+    my @closed = actor::org_unit::closed_date->search_where(
+        { close_start => { '<=', 'now' },
+          close_end => { '>=', 'now' } }
+    );
 
     if ($check_expire) {
 
         # $check_expire, if it exists, was already converted to seconds
-    	my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time() + $check_expire);
-	    $year += 1900;
-    	$mon += 1;
+        my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time() + $check_expire);
+        $year += 1900;
+        $mon += 1;
 
-	    my $next_check_time = sprintf(
-    		'%s-%0.2d-%0.2dT%0.2d:%0.2d:%0.2d-00',
-	    	$year, $mon, $mday, $hour, $min, $sec
-    	);
+        my $next_check_time = sprintf(
+            '%s-%0.2d-%0.2dT%0.2d:%0.2d:%0.2d-00',
+            $year, $mon, $mday, $hour, $min, $sec
+        );
 
 
-	    my @closed_at_next = actor::org_unit::closed_date->search_where(
-		    { close_start => { '<=', $next_check_time },
-    		  close_end => { '>=', $next_check_time } }
-	    );
+        my @closed_at_next = actor::org_unit::closed_date->search_where(
+            { close_start => { '<=', $next_check_time },
+              close_end => { '>=', $next_check_time } }
+        );
 
         my @new_closed;
         for my $c_at_n (@closed_at_next) {
@@ -1357,447 +1357,447 @@ sub new_hold_copy_targeter {
         @closed = @new_closed;
     }
 
-	my @successes;
-	my $actor = OpenSRF::AppSession->create('open-ils.actor');
+    my @successes;
+    my $actor = OpenSRF::AppSession->create('open-ils.actor');
 
-	my $target_when_closed = {};
-	my $target_when_closed_if_at_pickup_lib = {};
+    my $target_when_closed = {};
+    my $target_when_closed_if_at_pickup_lib = {};
 
-	for my $hold (@$holds) {
-		try {
-			#start a transaction if needed
-			if ($self->method_lookup('open-ils.storage.transaction.current')->run) {
-				$log->debug("Cleaning up after previous transaction\n");
-				$self->method_lookup('open-ils.storage.transaction.rollback')->run;
-			}
-			$self->method_lookup('open-ils.storage.transaction.begin')->run( $client );
-			$log->info("Processing hold ".$hold->id."...\n");
+    for my $hold (@$holds) {
+        try {
+            #start a transaction if needed
+            if ($self->method_lookup('open-ils.storage.transaction.current')->run) {
+                $log->debug("Cleaning up after previous transaction\n");
+                $self->method_lookup('open-ils.storage.transaction.rollback')->run;
+            }
+            $self->method_lookup('open-ils.storage.transaction.begin')->run( $client );
+            $log->info("Processing hold ".$hold->id."...\n");
 
-			#first, re-fetch the hold, to make sure it's not captured already
-			$hold->remove_from_object_index();
-			$hold = action::hold_request->retrieve( $hold->id );
+            #first, re-fetch the hold, to make sure it's not captured already
+            $hold->remove_from_object_index();
+            $hold = action::hold_request->retrieve( $hold->id );
 
-			die "OK\n" if (!$hold or $hold->capture_time or $hold->cancel_time);
+            die "OK\n" if (!$hold or $hold->capture_time or $hold->cancel_time);
 
-			# remove old auto-targeting maps
-			my @oldmaps = action::hold_copy_map->search( hold => $hold->id );
-			$_->delete for (@oldmaps);
+            # remove old auto-targeting maps
+            my @oldmaps = action::hold_copy_map->search( hold => $hold->id );
+            $_->delete for (@oldmaps);
 
-			if ($hold->expire_time) {
-				my $ex_time = $parser->parse_datetime( cleanse_ISO8601( $hold->expire_time ) );
-				if ( DateTime->compare($ex_time, DateTime->now) < 0 ) {
+            if ($hold->expire_time) {
+                my $ex_time = $parser->parse_datetime( cleanse_ISO8601( $hold->expire_time ) );
+                if ( DateTime->compare($ex_time, DateTime->now) < 0 ) {
 
-					# cancel cause = un-targeted expiration
-					$hold->update( { cancel_time => 'now', cancel_cause => 1 } ); 
+                    # cancel cause = un-targeted expiration
+                    $hold->update( { cancel_time => 'now', cancel_cause => 1 } ); 
 
-					# refresh fields from the DB while still in the xact
-					my $fm_hold = $hold->to_fieldmapper; 
+                    # refresh fields from the DB while still in the xact
+                    my $fm_hold = $hold->to_fieldmapper; 
 
-					$self->method_lookup('open-ils.storage.transaction.commit')->run;
+                    $self->method_lookup('open-ils.storage.transaction.commit')->run;
 
-					# tell A/T the hold was cancelled
-					my $ses = OpenSRF::AppSession->create('open-ils.trigger');
-					$ses->request('open-ils.trigger.event.autocreate', 
-						'hold_request.cancel.expire_no_target', $fm_hold, $fm_hold->pickup_lib);
+                    # tell A/T the hold was cancelled
+                    my $ses = OpenSRF::AppSession->create('open-ils.trigger');
+                    $ses->request('open-ils.trigger.event.autocreate', 
+                        'hold_request.cancel.expire_no_target', $fm_hold, $fm_hold->pickup_lib);
 
-					die "OK\n";
-				}
-			}
+                    die "OK\n";
+                }
+            }
 
-			my $all_copies = [];
+            my $all_copies = [];
 
-			# find filters for MR holds
-			my ($types, $formats, $lang);
-			if (defined($hold->holdable_formats)) {
-				($types, $formats, $lang) = split '-', $hold->holdable_formats;
-			}
+            # find filters for MR holds
+            my ($types, $formats, $lang);
+            if (defined($hold->holdable_formats)) {
+                ($types, $formats, $lang) = split '-', $hold->holdable_formats;
+            }
 
-			# find all the potential copies
-			if ($hold->hold_type eq 'M') {
-				my $records = [
-					map {
-						isTrue($_->deleted) ?  () : ($_->id)
-					} metabib::metarecord->retrieve($hold->target)->source_records
-				];
+            # find all the potential copies
+            if ($hold->hold_type eq 'M') {
+                my $records = [
+                    map {
+                        isTrue($_->deleted) ?  () : ($_->id)
+                    } metabib::metarecord->retrieve($hold->target)->source_records
+                ];
                 if(@$records > 0) {
-					for my $r ( map
-							{$_->record}
-							metabib::record_descriptor
-								->search(
-									record => $records,
-									( $types   ? (item_type => [split '', $types])   : () ),
-									( $formats ? (item_form => [split '', $formats]) : () ),
-									( $lang	   ? (item_lang => $lang)				 : () ),
-								)
-					) {
-						my ($rtree) = $self
-							->method_lookup( 'open-ils.storage.biblio.record_entry.ranged_tree')
-							->run( $r->id, $hold->selection_ou, $hold->selection_depth );
-
-						for my $cn ( @{ $rtree->call_numbers } ) {
-							push @$all_copies,
-								asset::copy->search_where(
-									{ id => [map {$_->id} @{ $cn->copies }],
-									  deleted => 'f' }
-								) if ($cn && @{ $cn->copies });
-						}
-					}
-				}
-			} elsif ($hold->hold_type eq 'T') {
-				my ($rtree) = $self
-					->method_lookup( 'open-ils.storage.biblio.record_entry.ranged_tree')
-					->run( $hold->target, $hold->selection_ou, $hold->selection_depth );
-
-				unless ($rtree) {
-					push @successes, { hold => $hold->id, eligible_copies => 0, error => 'NO_RECORD' };
-					die "OK\n";
-				}
-
-				for my $cn ( @{ $rtree->call_numbers } ) {
-					push @$all_copies,
-						asset::copy->search_where(
-							{ id => [map {$_->id} @{ $cn->copies }],
-							  deleted => 'f' }
-						) if ($cn && @{ $cn->copies });
-				}
-			} elsif ($hold->hold_type eq 'V') {
-				my ($vtree) = $self
-					->method_lookup( 'open-ils.storage.asset.call_number.ranged_tree')
-					->run( $hold->target, $hold->selection_ou, $hold->selection_depth );
-
-				push @$all_copies,
-					asset::copy->search_where(
-						{ id => [map {$_->id} @{ $vtree->copies }],
-						  deleted => 'f' }
-					) if ($vtree && @{ $vtree->copies });
-
-			} elsif ($hold->hold_type eq 'P') {
-				my @part_maps = asset::copy_part_map->search_where( { part => $hold->target } );
-				$all_copies = [
-					asset::copy->search_where(
-						{ id => [map {$_->target_copy} @part_maps],
-						  deleted => 'f' }
-					)
-				] if (@part_maps);
-					
-			} elsif ($hold->hold_type eq 'I') {
-				my ($itree) = $self
-					->method_lookup( 'open-ils.storage.serial.issuance.ranged_tree')
-					->run( $hold->target, $hold->selection_ou, $hold->selection_depth );
-
-				push @$all_copies,
-					asset::copy->search_where(
-						{ id => [map {$_->unit->id} @{ $itree->items }],
-						  deleted => 'f' }
-					) if ($itree && @{ $itree->items });
-					
-			} elsif  ($hold->hold_type eq 'C' || $hold->hold_type eq 'R' || $hold->hold_type eq 'F') {
-				my $_cp = asset::copy->retrieve($hold->target);
-				push @$all_copies, $_cp if $_cp;
-			}
-
-			# Force and recall holds bypass pretty much everything
-			if ($hold->hold_type ne 'R' && $hold->hold_type ne 'F') {
-				# trim unholdables
-				@$all_copies = grep {	isTrue($_->status->holdable) && 
-							isTrue($_->location->holdable) && 
-							isTrue($_->holdable) &&
-							!isTrue($_->deleted) &&
-							(isTrue($hold->mint_condition) ? isTrue($_->mint_condition) : 1) &&
-							( ( $hold->hold_type ne 'C' && $hold->hold_type ne 'I' # Copy-level holds don't care about parts
-								&& $hold->hold_type ne 'P' ) ? $_->part_maps->count == 0 : 1)
-						} @$all_copies;
-			}
-
-			# let 'em know we're still working
-			$client->status( new OpenSRF::DomainObject::oilsContinueStatus );
-			
-			# if we have no copies ...
-			if (!ref $all_copies || !@$all_copies) {
-				$log->info("\tNo copies available for targeting at all!\n");
-				push @successes, { hold => $hold->id, eligible_copies => 0, error => 'NO_COPIES' };
-
-				$hold->update( { prev_check_time => 'today', current_copy => undef } );
-				$self->method_lookup('open-ils.storage.transaction.commit')->run;
-				die "OK\n";
-			}
-
-			my $copy_count = @$all_copies;
+                    for my $r ( map
+                            {$_->record}
+                            metabib::record_descriptor
+                                ->search(
+                                    record => $records,
+                                    ( $types   ? (item_type => [split '', $types])   : () ),
+                                    ( $formats ? (item_form => [split '', $formats]) : () ),
+                                    ( $lang    ? (item_lang => $lang)                : () ),
+                                )
+                    ) {
+                        my ($rtree) = $self
+                            ->method_lookup( 'open-ils.storage.biblio.record_entry.ranged_tree')
+                            ->run( $r->id, $hold->selection_ou, $hold->selection_depth );
+
+                        for my $cn ( @{ $rtree->call_numbers } ) {
+                            push @$all_copies,
+                                asset::copy->search_where(
+                                    { id => [map {$_->id} @{ $cn->copies }],
+                                      deleted => 'f' }
+                                ) if ($cn && @{ $cn->copies });
+                        }
+                    }
+                }
+            } elsif ($hold->hold_type eq 'T') {
+                my ($rtree) = $self
+                    ->method_lookup( 'open-ils.storage.biblio.record_entry.ranged_tree')
+                    ->run( $hold->target, $hold->selection_ou, $hold->selection_depth );
+
+                unless ($rtree) {
+                    push @successes, { hold => $hold->id, eligible_copies => 0, error => 'NO_RECORD' };
+                    die "OK\n";
+                }
+
+                for my $cn ( @{ $rtree->call_numbers } ) {
+                    push @$all_copies,
+                        asset::copy->search_where(
+                            { id => [map {$_->id} @{ $cn->copies }],
+                              deleted => 'f' }
+                        ) if ($cn && @{ $cn->copies });
+                }
+            } elsif ($hold->hold_type eq 'V') {
+                my ($vtree) = $self
+                    ->method_lookup( 'open-ils.storage.asset.call_number.ranged_tree')
+                    ->run( $hold->target, $hold->selection_ou, $hold->selection_depth );
+
+                push @$all_copies,
+                    asset::copy->search_where(
+                        { id => [map {$_->id} @{ $vtree->copies }],
+                          deleted => 'f' }
+                    ) if ($vtree && @{ $vtree->copies });
+
+            } elsif ($hold->hold_type eq 'P') {
+                my @part_maps = asset::copy_part_map->search_where( { part => $hold->target } );
+                $all_copies = [
+                    asset::copy->search_where(
+                        { id => [map {$_->target_copy} @part_maps],
+                          deleted => 'f' }
+                    )
+                ] if (@part_maps);
+                    
+            } elsif ($hold->hold_type eq 'I') {
+                my ($itree) = $self
+                    ->method_lookup( 'open-ils.storage.serial.issuance.ranged_tree')
+                    ->run( $hold->target, $hold->selection_ou, $hold->selection_depth );
+
+                push @$all_copies,
+                    asset::copy->search_where(
+                        { id => [map {$_->unit->id} @{ $itree->items }],
+                          deleted => 'f' }
+                    ) if ($itree && @{ $itree->items });
+                    
+            } elsif  ($hold->hold_type eq 'C' || $hold->hold_type eq 'R' || $hold->hold_type eq 'F') {
+                my $_cp = asset::copy->retrieve($hold->target);
+                push @$all_copies, $_cp if $_cp;
+            }
+
+            # Force and recall holds bypass pretty much everything
+            if ($hold->hold_type ne 'R' && $hold->hold_type ne 'F') {
+                # trim unholdables
+                @$all_copies = grep {   isTrue($_->status->holdable) && 
+                            isTrue($_->location->holdable) && 
+                            isTrue($_->holdable) &&
+                            !isTrue($_->deleted) &&
+                            (isTrue($hold->mint_condition) ? isTrue($_->mint_condition) : 1) &&
+                            ( ( $hold->hold_type ne 'C' && $hold->hold_type ne 'I' # Copy-level holds don't care about parts
+                                && $hold->hold_type ne 'P' ) ? $_->part_maps->count == 0 : 1)
+                        } @$all_copies;
+            }
+
+            # let 'em know we're still working
+            $client->status( new OpenSRF::DomainObject::oilsContinueStatus );
+            
+            # if we have no copies ...
+            if (!ref $all_copies || !@$all_copies) {
+                $log->info("\tNo copies available for targeting at all!\n");
+                push @successes, { hold => $hold->id, eligible_copies => 0, error => 'NO_COPIES' };
+
+                $hold->update( { prev_check_time => 'today', current_copy => undef } );
+                $self->method_lookup('open-ils.storage.transaction.commit')->run;
+                die "OK\n";
+            }
+
+            my $copy_count = @$all_copies;
             my $found_copy = undef;
             $found_copy = 1 if($find_copy and grep $_ == $find_copy, @$all_copies);
 
-			# map the potentials, so that we can pick up checkins
-			# XXX Loop-based targeting may require that /only/ copies from this loop should be added to
-			# XXX the potentials list.  If this is the cased, hold_copy_map creation will move down further.
-			my $pu_lib = ''.$hold->pickup_lib;
-			my $prox_list = create_prox_list( $self, $pu_lib, $all_copies, $hold );
-			$log->debug( "\tMapping ".scalar(@$all_copies)." potential copies for hold ".$hold->id);
-			for my $prox ( keys %$prox_list ) {
-				action::hold_copy_map->create( { proximity => $prox, hold => $hold->id, target_copy => $_->id } ) for (@{$$prox_list{$prox}});
-			}
+            # map the potentials, so that we can pick up checkins
+            # XXX Loop-based targeting may require that /only/ copies from this loop should be added to
+            # XXX the potentials list.  If this is the cased, hold_copy_map creation will move down further.
+            my $pu_lib = ''.$hold->pickup_lib;
+            my $prox_list = create_prox_list( $self, $pu_lib, $all_copies, $hold );
+            $log->debug( "\tMapping ".scalar(@$all_copies)." potential copies for hold ".$hold->id);
+            for my $prox ( keys %$prox_list ) {
+                action::hold_copy_map->create( { proximity => $prox, hold => $hold->id, target_copy => $_->id } ) for (@{$$prox_list{$prox}});
+            }
 
-			#$client->status( new OpenSRF::DomainObject::oilsContinueStatus );
+            #$client->status( new OpenSRF::DomainObject::oilsContinueStatus );
 
-			my @good_copies;
-			for my $c (@$all_copies) {
-				# current target
-				next if ($hold->current_copy and $c->id eq $hold->current_copy);
+            my @good_copies;
+            for my $c (@$all_copies) {
+                # current target
+                next if ($hold->current_copy and $c->id eq $hold->current_copy);
 
-				# skip on circ lib is closed IFF we care
-				my $ignore_closing;
+                # skip on circ lib is closed IFF we care
+                my $ignore_closing;
 
-				if (''.$hold->pickup_lib eq ''.$c->circ_lib) {
-					$ignore_closing = ou_ancestor_setting_value_or_cache(
+                if (''.$hold->pickup_lib eq ''.$c->circ_lib) {
+                    $ignore_closing = ou_ancestor_setting_value_or_cache(
                         $actor,
-						''.$c->circ_lib,
-						'circ.holds.target_when_closed_if_at_pickup_lib',
-						$target_when_closed_if_at_pickup_lib
-					) || 0;
-				}
-				if (not $ignore_closing) {  # one more chance to find a reason
-											# to ignore OU closedness.
-					$ignore_closing = ou_ancestor_setting_value_or_cache(
+                        ''.$c->circ_lib,
+                        'circ.holds.target_when_closed_if_at_pickup_lib',
+                        $target_when_closed_if_at_pickup_lib
+                    ) || 0;
+                }
+                if (not $ignore_closing) {  # one more chance to find a reason
+                                            # to ignore OU closedness.
+                    $ignore_closing = ou_ancestor_setting_value_or_cache(
                         $actor,
-						''.$c->circ_lib,
-						'circ.holds.target_when_closed',
-						$target_when_closed
-					) || 0;
-				}
-
-#				$logger->info(
-#					"For hold " . $hold->id . " and copy with circ_lib " .
-#					$c->circ_lib . " we " .
-#					($ignore_closing ? "ignore" : "respect")
-#					. " closed dates"
-#				);
-
-				next if (
-					(not $ignore_closing) and
-					(grep { ''.$_->org_unit eq ''.$c->circ_lib } @closed)
-				);
-
-				# target of another hold
-				next if (action::hold_request
-						->search_where(
-							{ current_copy => $c->id,
-							  fulfillment_time => undef,
-							  cancel_time => undef,
-							}
-						)
-				);
-
-				# we passed all three, keep it
-				push @good_copies, $c if ($c);
-				#$client->status( new OpenSRF::DomainObject::oilsContinueStatus );
-			}
-
-			$log->debug("\t".scalar(@good_copies)." (non-current) copies available for targeting...");
-
-			my $old_best = $hold->current_copy;
-			my $old_best_still_valid = 0; # Assume no, but the next line says yes if it is still a potential.
-			$old_best_still_valid = 1 if ( $old_best && grep { ''.$old_best->id eq ''.$_->id } @$all_copies );
-			$hold->update({ current_copy => undef }) if ($old_best);
-	
-			if (!scalar(@good_copies)) {
-				$log->info("\tNo (non-current) copies eligible to fill the hold.");
-				if ( $old_best_still_valid ) {
-					# the old copy is still available
-					$log->debug("\tPushing current_copy back onto the targeting list");
-					push @good_copies, $old_best;
-				} else {
-					# oops, old copy is not available
-					$log->debug("\tcurrent_copy is no longer available for targeting... NEXT HOLD, PLEASE!");
-					$hold->update( { prev_check_time => 'today' } );
-					$self->method_lookup('open-ils.storage.transaction.commit')->run;
-					push @successes, { hold => $hold->id, eligible_copies => 0, error => 'NO_TARGETS' };
-					die "OK\n";
-				}
-			}
-
-			# reset prox list after trimming good copies
-			$prox_list = create_prox_list(
-				$self, $pu_lib,
-				[ grep { $_->status == 0 || $_->status == 7 } @good_copies ],
-				$hold
-			);
-
-			$all_copies = [ grep { ''.$_->circ_lib ne $pu_lib && ( $_->status == 0 || $_->status == 7 ) } @good_copies ];
-
-			my $min_prox = [ sort keys %$prox_list ]->[0];
-			my $best;
-			if  ($hold->hold_type eq 'R' || $hold->hold_type eq 'F') { # Recall/Force holds bypass hold rules.
-				$best = $good_copies[0] if(scalar @good_copies);
-			} else {
-				$best = choose_nearest_copy($hold, { $min_prox => delete($$prox_list{$min_prox}) });
-			}
-
-			$client->status( new OpenSRF::DomainObject::oilsContinueStatus );
-
-			if (!$best) {
-				$log->debug("\tNothing at the pickup lib, looking elsewhere among ".scalar(@$all_copies)." copies");
-
-				$self->{max_loops}{$pu_lib} = $actor->request(
-					'open-ils.actor.ou_setting.ancestor_default' => $pu_lib => 'circ.holds.max_org_unit_target_loops'
-				)->gather(1);
-
-				if (defined($self->{max_loops}{$pu_lib})) {
-					$self->{max_loops}{$pu_lib} = $self->{max_loops}{$pu_lib}{value};
-
-					my %circ_lib_map =  map { (''.$_->circ_lib => 1) } @$all_copies;
-					my $circ_lib_list = [keys %circ_lib_map];
-	
-					my $cstore = OpenSRF::AppSession->create('open-ils.cstore');
-	
-					# Grab the "biggest" loop for this hold so far
-					my $current_loop = $cstore->request(
-						'open-ils.cstore.json_query',
-						{ distinct => 1,
-						  select => { aufhmxl => ['max'] },
-						  from => 'aufhmxl',
-						  where => { hold => $hold->id}
-						}
-					)->gather(1);
-	
-					$current_loop = $current_loop->{max} if ($current_loop);
-					$current_loop ||= 1;
-	
-					my $exclude_list = $cstore->request(
-						'open-ils.cstore.json_query.atomic',
-						{ distinct => 1,
-						  select => { aufhol => ['circ_lib'] },
-						  from => 'aufhol',
-						  where => { hold => $hold->id}
-						}
-					)->gather(1);
-	
-					my @keepers;
-					if ($exclude_list && @$exclude_list) {
-						$exclude_list = [map {$_->{circ_lib}} @$exclude_list];
-						# check to see if we've used up every library in the potentials list
-						for my $l ( @$circ_lib_list ) {
-							my $keep = 1;
-							for my $ex ( @$exclude_list ) {
-								if ($ex eq $l) {
-									$keep = 0;
-									last;
-								}
-							}
-							push(@keepers, $l) if ($keep);
-						}
-					} else {
-						@keepers = @$circ_lib_list;
-					}
-	
-					$current_loop++ if (!@keepers);
-	
-					if ($self->{max_loops}{$pu_lib} && $self->{max_loops}{$pu_lib} >= $current_loop) {
-						# We haven't exceeded max_loops yet
-						my @keeper_copies;
-						for my $cp ( @$all_copies ) {
-							push(@keeper_copies, $cp) if ( !@keepers || grep { $_ eq ''.$cp->circ_lib } @keepers );
-
-						}
-						$all_copies = [@keeper_copies];
-					} else {
-						# We have, and should remove potentials and cancel the hold
-						my @oldmaps = action::hold_copy_map->search( hold => $hold->id );
-						$_->delete for (@oldmaps);
-
-						# cancel cause = un-targeted expiration
-						$hold->update( { cancel_time => 'now', cancel_cause => 1 } ); 
-
-						# refresh fields from the DB while still in the xact
-						my $fm_hold = $hold->to_fieldmapper; 
-
-						$self->method_lookup('open-ils.storage.transaction.commit')->run;
-
-						# tell A/T the hold was cancelled
-						my $ses = OpenSRF::AppSession->create('open-ils.trigger');
-						$ses->request('open-ils.trigger.event.autocreate', 
-							'hold_request.cancel.expire_no_target', $fm_hold, $fm_hold->pickup_lib);
-
-						die "OK\n";
-					}
-
-    				$prox_list = create_prox_list( $self, $pu_lib, $all_copies, $hold );
-
-    				$client->status( new OpenSRF::DomainObject::oilsContinueStatus );
-
-				}
-
-				$best = choose_nearest_copy($hold, $prox_list);
-			}
-
-			$client->status( new OpenSRF::DomainObject::oilsContinueStatus );
-			if ($old_best) {
-				# hold wasn't fulfilled, record the fact
-			
-				$log->info("\tHold was not (but should have been) fulfilled by ".$old_best->id);
-				action::unfulfilled_hold_list->create(
-						{ hold => ''.$hold->id,
-						  current_copy => ''.$old_best->id,
-						  circ_lib => ''.$old_best->circ_lib,
-						});
-			}
-
-			if ($best) {
-				$hold->update( { current_copy => ''.$best->id, prev_check_time => 'now' } );
-				$log->debug("\tUpdating hold [".$hold->id."] with new 'current_copy' [".$best->id."] for hold fulfillment.");
-			} elsif (
-				$old_best_still_valid &&
-				!action::hold_request
-					->search_where(
-						{ current_copy => $old_best->id,
-						  fulfillment_time => undef,
-						  cancel_time => undef,
-						}       
-					) &&
-				( OpenILS::Utils::PermitHold::permit_copy_hold(
-					{ title => $old_best->call_number->record->to_fieldmapper,
-					  title_descriptor => $old_best->call_number->record->record_descriptor->next->to_fieldmapper,
-					  patron => $hold->usr->to_fieldmapper,
-					  copy => $old_best->to_fieldmapper,
-					  requestor => $hold->requestor->to_fieldmapper,
-					  request_lib => $hold->request_lib->to_fieldmapper,
-					  pickup_lib => $hold->pickup_lib->id,
-					  retarget => 1
-					}
-				))
-			) {     
-				$hold->update( { prev_check_time => 'now', current_copy => ''.$old_best->id } );
-				$log->debug( "\tRetargeting the previously targeted copy [".$old_best->id."]" );
-			} else {
-				$hold->update( { prev_check_time => 'now' } );
-				$log->info( "\tThere were no targetable copies for the hold" );
-				process_recall($actor, $log, $hold, \@good_copies);
-			}
-
-			$self->method_lookup('open-ils.storage.transaction.commit')->run;
-			$log->info("\tProcessing of hold ".$hold->id." complete.");
-
-			push @successes,
-				{ hold => $hold->id,
-				  old_target => ($old_best ? $old_best->id : undef),
-				  eligible_copies => $copy_count,
-				  target => ($best ? $best->id : undef),
+                        ''.$c->circ_lib,
+                        'circ.holds.target_when_closed',
+                        $target_when_closed
+                    ) || 0;
+                }
+
+#               $logger->info(
+#                   "For hold " . $hold->id . " and copy with circ_lib " .
+#                   $c->circ_lib . " we " .
+#                   ($ignore_closing ? "ignore" : "respect")
+#                   . " closed dates"
+#               );
+
+                next if (
+                    (not $ignore_closing) and
+                    (grep { ''.$_->org_unit eq ''.$c->circ_lib } @closed)
+                );
+
+                # target of another hold
+                next if (action::hold_request
+                        ->search_where(
+                            { current_copy => $c->id,
+                              fulfillment_time => undef,
+                              cancel_time => undef,
+                            }
+                        )
+                );
+
+                # we passed all three, keep it
+                push @good_copies, $c if ($c);
+                #$client->status( new OpenSRF::DomainObject::oilsContinueStatus );
+            }
+
+            $log->debug("\t".scalar(@good_copies)." (non-current) copies available for targeting...");
+
+            my $old_best = $hold->current_copy;
+            my $old_best_still_valid = 0; # Assume no, but the next line says yes if it is still a potential.
+            $old_best_still_valid = 1 if ( $old_best && grep { ''.$old_best->id eq ''.$_->id } @$all_copies );
+            $hold->update({ current_copy => undef }) if ($old_best);
+    
+            if (!scalar(@good_copies)) {
+                $log->info("\tNo (non-current) copies eligible to fill the hold.");
+                if ( $old_best_still_valid ) {
+                    # the old copy is still available
+                    $log->debug("\tPushing current_copy back onto the targeting list");
+                    push @good_copies, $old_best;
+                } else {
+                    # oops, old copy is not available
+                    $log->debug("\tcurrent_copy is no longer available for targeting... NEXT HOLD, PLEASE!");
+                    $hold->update( { prev_check_time => 'today' } );
+                    $self->method_lookup('open-ils.storage.transaction.commit')->run;
+                    push @successes, { hold => $hold->id, eligible_copies => 0, error => 'NO_TARGETS' };
+                    die "OK\n";
+                }
+            }
+
+            # reset prox list after trimming good copies
+            $prox_list = create_prox_list(
+                $self, $pu_lib,
+                [ grep { $_->status == 0 || $_->status == 7 } @good_copies ],
+                $hold
+            );
+
+            $all_copies = [ grep { ''.$_->circ_lib ne $pu_lib && ( $_->status == 0 || $_->status == 7 ) } @good_copies ];
+
+            my $min_prox = [ sort keys %$prox_list ]->[0];
+            my $best;
+            if  ($hold->hold_type eq 'R' || $hold->hold_type eq 'F') { # Recall/Force holds bypass hold rules.
+                $best = $good_copies[0] if(scalar @good_copies);
+            } else {
+                $best = choose_nearest_copy($hold, { $min_prox => delete($$prox_list{$min_prox}) });
+            }
+
+            $client->status( new OpenSRF::DomainObject::oilsContinueStatus );
+
+            if (!$best) {
+                $log->debug("\tNothing at the pickup lib, looking elsewhere among ".scalar(@$all_copies)." copies");
+
+                $self->{max_loops}{$pu_lib} = $actor->request(
+                    'open-ils.actor.ou_setting.ancestor_default' => $pu_lib => 'circ.holds.max_org_unit_target_loops'
+                )->gather(1);
+
+                if (defined($self->{max_loops}{$pu_lib})) {
+                    $self->{max_loops}{$pu_lib} = $self->{max_loops}{$pu_lib}{value};
+
+                    my %circ_lib_map =  map { (''.$_->circ_lib => 1) } @$all_copies;
+                    my $circ_lib_list = [keys %circ_lib_map];
+    
+                    my $cstore = OpenSRF::AppSession->create('open-ils.cstore');
+    
+                    # Grab the "biggest" loop for this hold so far
+                    my $current_loop = $cstore->request(
+                        'open-ils.cstore.json_query',
+                        { distinct => 1,
+                          select => { aufhmxl => ['max'] },
+                          from => 'aufhmxl',
+                          where => { hold => $hold->id}
+                        }
+                    )->gather(1);
+    
+                    $current_loop = $current_loop->{max} if ($current_loop);
+                    $current_loop ||= 1;
+    
+                    my $exclude_list = $cstore->request(
+                        'open-ils.cstore.json_query.atomic',
+                        { distinct => 1,
+                          select => { aufhol => ['circ_lib'] },
+                          from => 'aufhol',
+                          where => { hold => $hold->id}
+                        }
+                    )->gather(1);
+    
+                    my @keepers;
+                    if ($exclude_list && @$exclude_list) {
+                        $exclude_list = [map {$_->{circ_lib}} @$exclude_list];
+                        # check to see if we've used up every library in the potentials list
+                        for my $l ( @$circ_lib_list ) {
+                            my $keep = 1;
+                            for my $ex ( @$exclude_list ) {
+                                if ($ex eq $l) {
+                                    $keep = 0;
+                                    last;
+                                }
+                            }
+                            push(@keepers, $l) if ($keep);
+                        }
+                    } else {
+                        @keepers = @$circ_lib_list;
+                    }
+    
+                    $current_loop++ if (!@keepers);
+    
+                    if ($self->{max_loops}{$pu_lib} && $self->{max_loops}{$pu_lib} >= $current_loop) {
+                        # We haven't exceeded max_loops yet
+                        my @keeper_copies;
+                        for my $cp ( @$all_copies ) {
+                            push(@keeper_copies, $cp) if ( !@keepers || grep { $_ eq ''.$cp->circ_lib } @keepers );
+
+                        }
+                        $all_copies = [@keeper_copies];
+                    } else {
+                        # We have, and should remove potentials and cancel the hold
+                        my @oldmaps = action::hold_copy_map->search( hold => $hold->id );
+                        $_->delete for (@oldmaps);
+
+                        # cancel cause = un-targeted expiration
+                        $hold->update( { cancel_time => 'now', cancel_cause => 1 } ); 
+
+                        # refresh fields from the DB while still in the xact
+                        my $fm_hold = $hold->to_fieldmapper; 
+
+                        $self->method_lookup('open-ils.storage.transaction.commit')->run;
+
+                        # tell A/T the hold was cancelled
+                        my $ses = OpenSRF::AppSession->create('open-ils.trigger');
+                        $ses->request('open-ils.trigger.event.autocreate', 
+                            'hold_request.cancel.expire_no_target', $fm_hold, $fm_hold->pickup_lib);
+
+                        die "OK\n";
+                    }
+
+                    $prox_list = create_prox_list( $self, $pu_lib, $all_copies, $hold );
+
+                    $client->status( new OpenSRF::DomainObject::oilsContinueStatus );
+
+                }
+
+                $best = choose_nearest_copy($hold, $prox_list);
+            }
+
+            $client->status( new OpenSRF::DomainObject::oilsContinueStatus );
+            if ($old_best) {
+                # hold wasn't fulfilled, record the fact
+            
+                $log->info("\tHold was not (but should have been) fulfilled by ".$old_best->id);
+                action::unfulfilled_hold_list->create(
+                        { hold => ''.$hold->id,
+                          current_copy => ''.$old_best->id,
+                          circ_lib => ''.$old_best->circ_lib,
+                        });
+            }
+
+            if ($best) {
+                $hold->update( { current_copy => ''.$best->id, prev_check_time => 'now' } );
+                $log->debug("\tUpdating hold [".$hold->id."] with new 'current_copy' [".$best->id."] for hold fulfillment.");
+            } elsif (
+                $old_best_still_valid &&
+                !action::hold_request
+                    ->search_where(
+                        { current_copy => $old_best->id,
+                          fulfillment_time => undef,
+                          cancel_time => undef,
+                        }       
+                    ) &&
+                ( OpenILS::Utils::PermitHold::permit_copy_hold(
+                    { title => $old_best->call_number->record->to_fieldmapper,
+                      title_descriptor => $old_best->call_number->record->record_descriptor->next->to_fieldmapper,
+                      patron => $hold->usr->to_fieldmapper,
+                      copy => $old_best->to_fieldmapper,
+                      requestor => $hold->requestor->to_fieldmapper,
+                      request_lib => $hold->request_lib->to_fieldmapper,
+                      pickup_lib => $hold->pickup_lib->id,
+                      retarget => 1
+                    }
+                ))
+            ) {     
+                $hold->update( { prev_check_time => 'now', current_copy => ''.$old_best->id } );
+                $log->debug( "\tRetargeting the previously targeted copy [".$old_best->id."]" );
+            } else {
+                $hold->update( { prev_check_time => 'now' } );
+                $log->info( "\tThere were no targetable copies for the hold" );
+                process_recall($actor, $log, $hold, \@good_copies);
+            }
+
+            $self->method_lookup('open-ils.storage.transaction.commit')->run;
+            $log->info("\tProcessing of hold ".$hold->id." complete.");
+
+            push @successes,
+                { hold => $hold->id,
+                  old_target => ($old_best ? $old_best->id : undef),
+                  eligible_copies => $copy_count,
+                  target => ($best ? $best->id : undef),
                   found_copy => $found_copy };
 
-		} otherwise {
-			my $e = shift;
-			if ($e !~ /^OK/o) {
-				$log->error("Processing of hold failed:  $e");
-				$self->method_lookup('open-ils.storage.transaction.rollback')->run;
-				throw $e if ($e =~ /IS NOT CONNECTED TO THE NETWORK/o);
-			}
-		};
-	}
-
-	return \@successes;
+        } otherwise {
+            my $e = shift;
+            if ($e !~ /^OK/o) {
+                $log->error("Processing of hold failed:  $e");
+                $self->method_lookup('open-ils.storage.transaction.rollback')->run;
+                throw $e if ($e =~ /IS NOT CONNECTED TO THE NETWORK/o);
+            }
+        };
+    }
+
+    return \@successes;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.action.hold_request.copy_targeter',
-	api_level	=> 1,
-	method		=> 'new_hold_copy_targeter',
+    api_name    => 'open-ils.storage.action.hold_request.copy_targeter',
+    api_level   => 1,
+    method      => 'new_hold_copy_targeter',
 );
 
 sub process_recall {
@@ -1891,90 +1891,90 @@ sub process_recall {
 }
 
 sub reservation_targeter {
-	my $self = shift;
-	my $client = shift;
-	my $one_reservation = shift;
+    my $self = shift;
+    my $client = shift;
+    my $one_reservation = shift;
 
-	local $OpenILS::Application::Storage::WRITE = 1;
+    local $OpenILS::Application::Storage::WRITE = 1;
 
-	my $reservations;
+    my $reservations;
 
-	try {
-		if ($one_reservation) {
-			$self->method_lookup('open-ils.storage.transaction.begin')->run( $client );
-			$reservations = [ booking::reservation->search_where( { id => $one_reservation, capture_time => undef, cancel_time => undef } ) ];
-		} else {
+    try {
+        if ($one_reservation) {
+            $self->method_lookup('open-ils.storage.transaction.begin')->run( $client );
+            $reservations = [ booking::reservation->search_where( { id => $one_reservation, capture_time => undef, cancel_time => undef } ) ];
+        } else {
 
-			# find all the reservations needing targeting
-			$reservations = [
+            # find all the reservations needing targeting
+            $reservations = [
                 booking::reservation->search_where(
-					{ current_resource => undef,
-					  cancel_time => undef,
-					  start_time => { '>' => 'now' }
+                    { current_resource => undef,
+                      cancel_time => undef,
+                      start_time => { '>' => 'now' }
                     },
                     { order_by => 'start_time' }
                 )
             ];
-		}
-	} catch Error with {
-		my $e = shift;
-		die "Could not retrieve reservation requests:\n\n$e\n";
-	};
+        }
+    } catch Error with {
+        my $e = shift;
+        die "Could not retrieve reservation requests:\n\n$e\n";
+    };
 
-	my @successes = ();
-	for my $bresv (@$reservations) {
-		try {
-			#start a transaction if needed
-			if ($self->method_lookup('open-ils.storage.transaction.current')->run) {
-				$log->debug("Cleaning up after previous transaction\n");
-				$self->method_lookup('open-ils.storage.transaction.rollback')->run;
-			}
-			$self->method_lookup('open-ils.storage.transaction.begin')->run( $client );
-			$log->info("Processing reservation ".$bresv->id."...\n");
+    my @successes = ();
+    for my $bresv (@$reservations) {
+        try {
+            #start a transaction if needed
+            if ($self->method_lookup('open-ils.storage.transaction.current')->run) {
+                $log->debug("Cleaning up after previous transaction\n");
+                $self->method_lookup('open-ils.storage.transaction.rollback')->run;
+            }
+            $self->method_lookup('open-ils.storage.transaction.begin')->run( $client );
+            $log->info("Processing reservation ".$bresv->id."...\n");
 
-			#first, re-fetch the hold, to make sure it's not captured already
-			$bresv->remove_from_object_index();
-			$bresv = booking::reservation->retrieve( $bresv->id );
+            #first, re-fetch the hold, to make sure it's not captured already
+            $bresv->remove_from_object_index();
+            $bresv = booking::reservation->retrieve( $bresv->id );
 
-			die "OK\n" if (!$bresv or $bresv->capture_time or $bresv->cancel_time);
+            die "OK\n" if (!$bresv or $bresv->capture_time or $bresv->cancel_time);
 
-			my $end_time = $parser->parse_datetime( cleanse_ISO8601( $bresv->end_time ) );
-			if (DateTime->compare($end_time, DateTime->now) < 0) {
+            my $end_time = $parser->parse_datetime( cleanse_ISO8601( $bresv->end_time ) );
+            if (DateTime->compare($end_time, DateTime->now) < 0) {
 
-				# cancel cause = un-targeted expiration
-				$bresv->update( { cancel_time => 'now' } ); 
+                # cancel cause = un-targeted expiration
+                $bresv->update( { cancel_time => 'now' } ); 
 
-				# refresh fields from the DB while still in the xact
-				my $fm_bresv = $bresv->to_fieldmapper;
+                # refresh fields from the DB while still in the xact
+                my $fm_bresv = $bresv->to_fieldmapper;
 
-				$self->method_lookup('open-ils.storage.transaction.commit')->run;
+                $self->method_lookup('open-ils.storage.transaction.commit')->run;
 
-				# tell A/T the reservation was cancelled
-				my $ses = OpenSRF::AppSession->create('open-ils.trigger');
-				$ses->request('open-ils.trigger.event.autocreate', 
-					'booking.reservation.cancel.expire_no_target', $fm_bresv, $fm_bresv->pickup_lib);
+                # tell A/T the reservation was cancelled
+                my $ses = OpenSRF::AppSession->create('open-ils.trigger');
+                $ses->request('open-ils.trigger.event.autocreate', 
+                    'booking.reservation.cancel.expire_no_target', $fm_bresv, $fm_bresv->pickup_lib);
 
-				die "OK\n";
-			}
+                die "OK\n";
+            }
 
-			my $possible_resources;
+            my $possible_resources;
 
-			# find all the potential resources
-			if (!$bresv->target_resource) {
-				my $filter = { type => $bresv->target_resource_type };
-				my $attr_maps = [ booking::reservation_attr_value_map->search( reservation => $bresv->id) ];
+            # find all the potential resources
+            if (!$bresv->target_resource) {
+                my $filter = { type => $bresv->target_resource_type };
+                my $attr_maps = [ booking::reservation_attr_value_map->search( reservation => $bresv->id) ];
 
-				$filter->{attribute_values} = [ map { $_->attr_value } @$attr_maps ] if (@$attr_maps);
+                $filter->{attribute_values} = [ map { $_->attr_value } @$attr_maps ] if (@$attr_maps);
 
-				$filter->{available} = [$bresv->start_time, $bresv->end_time];
-				my $ses = OpenSRF::AppSession->create('open-ils.booking');
-				$possible_resources = $ses->request('open-ils.booking.resources.filtered_id_list', undef, $filter)->gather(1);
-			} else {
-				$possible_resources = $bresv->target_resource;
-			}
+                $filter->{available} = [$bresv->start_time, $bresv->end_time];
+                my $ses = OpenSRF::AppSession->create('open-ils.booking');
+                $possible_resources = $ses->request('open-ils.booking.resources.filtered_id_list', undef, $filter)->gather(1);
+            } else {
+                $possible_resources = $bresv->target_resource;
+            }
 
             my $all_resources = [ booking::resource->search( id => $possible_resources ) ];
-			@$all_resources = grep { isTrue($_->type->transferable) || $_->owner.'' eq $bresv->pickup_lib.'' } @$all_resources;
+            @$all_resources = grep { isTrue($_->type->transferable) || $_->owner.'' eq $bresv->pickup_lib.'' } @$all_resources;
 
 
             my @good_resources = ();
@@ -2013,8 +2013,8 @@ sub reservation_targeter {
 
                     if (@$circs) {
                         my $due_date = $circs->[0]->due_date;
-			            $due_date = $parser->parse_datetime( cleanse_ISO8601( $due_date ) );
-			            my $start_time = $parser->parse_datetime( cleanse_ISO8601( $bresv->start_time ) );
+                        $due_date = $parser->parse_datetime( cleanse_ISO8601( $due_date ) );
+                        my $start_time = $parser->parse_datetime( cleanse_ISO8601( $bresv->start_time ) );
                         if (DateTime->compare($start_time, $due_date) < 0) {
                             $conflicts{$res->id} = $circs->[0]->to_fieldmapper;
                             next;
@@ -2029,43 +2029,43 @@ sub reservation_targeter {
                 push @good_resources, $res if (isTrue($copy->status->holdable));
             }
 
-			# let 'em know we're still working
-			$client->status( new OpenSRF::DomainObject::oilsContinueStatus );
-			
-			# if we have no copies ...
-			if (!@good_resources) {
-				$log->info("\tNo resources available for targeting at all!\n");
-				push @successes, { reservation => $bresv->id, eligible_copies => 0, error => 'NO_COPIES', conflicts => \%conflicts };
+            # let 'em know we're still working
+            $client->status( new OpenSRF::DomainObject::oilsContinueStatus );
+            
+            # if we have no copies ...
+            if (!@good_resources) {
+                $log->info("\tNo resources available for targeting at all!\n");
+                push @successes, { reservation => $bresv->id, eligible_copies => 0, error => 'NO_COPIES', conflicts => \%conflicts };
 
 
-				$self->method_lookup('open-ils.storage.transaction.commit')->run;
-				die "OK\n";
-			}
-
-			$log->debug("\t".scalar(@good_resources)." resources available for targeting...");
+                $self->method_lookup('open-ils.storage.transaction.commit')->run;
+                die "OK\n";
+            }
 
-			# LFW: note that after the inclusion of hold proximity
-			# adjustment, this prox_list is the only prox_list
-			# array in this perl package.  Other occurences are
-			# hashes.
-			my $prox_list = [];
-			$$prox_list[0] =
-			[
-				grep {
-					$_->owner == $bresv->pickup_lib
-				} @good_resources
-			];
+            $log->debug("\t".scalar(@good_resources)." resources available for targeting...");
+
+            # LFW: note that after the inclusion of hold proximity
+            # adjustment, this prox_list is the only prox_list
+            # array in this perl package.  Other occurences are
+            # hashes.
+            my $prox_list = [];
+            $$prox_list[0] =
+            [
+                grep {
+                    $_->owner == $bresv->pickup_lib
+                } @good_resources
+            ];
 
-			$all_resources = [grep {$_->owner != $bresv->pickup_lib } @good_resources];
-			# $all_copies is now a list of copies not at the pickup library
+            $all_resources = [grep {$_->owner != $bresv->pickup_lib } @good_resources];
+            # $all_copies is now a list of copies not at the pickup library
 
-			my $best = shift @good_resources;
-			$client->status( new OpenSRF::DomainObject::oilsContinueStatus );
+            my $best = shift @good_resources;
+            $client->status( new OpenSRF::DomainObject::oilsContinueStatus );
 
-			if (!$best) {
-				$log->debug("\tNothing at the pickup lib, looking elsewhere among ".scalar(@$all_resources)." resources");
+            if (!$best) {
+                $log->debug("\tNothing at the pickup lib, looking elsewhere among ".scalar(@$all_resources)." resources");
 
-				$prox_list =
+                $prox_list =
                     map  { $_->[1] }
                     sort { $a->[0] <=> $b->[0] }
                     map  {
@@ -2076,39 +2076,39 @@ sub reservation_targeter {
                         ]
                     } @$all_resources;
 
-				$client->status( new OpenSRF::DomainObject::oilsContinueStatus );
+                $client->status( new OpenSRF::DomainObject::oilsContinueStatus );
 
-				$best = shift @$prox_list
-			}
+                $best = shift @$prox_list
+            }
 
-			if ($best) {
-				$bresv->update( { current_resource => ''.$best->id } );
-				$log->debug("\tUpdating reservation [".$bresv->id."] with new 'current_resource' [".$best->id."] for reservation fulfillment.");
-			}
+            if ($best) {
+                $bresv->update( { current_resource => ''.$best->id } );
+                $log->debug("\tUpdating reservation [".$bresv->id."] with new 'current_resource' [".$best->id."] for reservation fulfillment.");
+            }
 
-			$self->method_lookup('open-ils.storage.transaction.commit')->run;
-			$log->info("\tProcessing of bresv ".$bresv->id." complete.");
+            $self->method_lookup('open-ils.storage.transaction.commit')->run;
+            $log->info("\tProcessing of bresv ".$bresv->id." complete.");
 
-			push @successes,
-				{ reservation => $bresv->id,
-				  current_resource => ($best ? $best->id : undef) };
+            push @successes,
+                { reservation => $bresv->id,
+                  current_resource => ($best ? $best->id : undef) };
 
-		} otherwise {
-			my $e = shift;
-			if ($e !~ /^OK/o) {
-				$log->error("Processing of bresv failed:  $e");
-				$self->method_lookup('open-ils.storage.transaction.rollback')->run;
-				throw $e if ($e =~ /IS NOT CONNECTED TO THE NETWORK/o);
-			}
-		};
-	}
+        } otherwise {
+            my $e = shift;
+            if ($e !~ /^OK/o) {
+                $log->error("Processing of bresv failed:  $e");
+                $self->method_lookup('open-ils.storage.transaction.rollback')->run;
+                throw $e if ($e =~ /IS NOT CONNECTED TO THE NETWORK/o);
+            }
+        };
+    }
 
-	return \@successes;
+    return \@successes;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.booking.reservation.resource_targeter',
-	api_level	=> 1,
-	method		=> 'reservation_targeter',
+    api_name    => 'open-ils.storage.booking.reservation.resource_targeter',
+    api_level   => 1,
+    method      => 'reservation_targeter',
 );
 
 my $locations;
@@ -2116,212 +2116,212 @@ my $statuses;
 my %cache = (titles => {}, cns => {});
 
 sub copy_hold_capture {
-	my $self = shift;
-	my $hold = shift;
-	my $cps = shift;
-
-	if (!defined($cps)) {
-		try {
-			$cps = [ asset::copy->search( id => $hold->target ) ];
-		} catch Error with {
-			my $e = shift;
-			die "Could not retrieve initial volume list:\n\n$e\n";
-		};
-	}
-
-	my @copies = grep { $_->holdable } @$cps;
-
-	for (my $i = 0; $i < @$cps; $i++) {
-		next unless $$cps[$i];
-		
-		my $cn = $cache{cns}{$copies[$i]->call_number};
-		my $rec = $cache{titles}{$cn->record};
-		$copies[$i] = undef if ($copies[$i] && !grep{ $copies[$i]->status eq $_->id}@$statuses);
-		$copies[$i] = undef if ($copies[$i] && !grep{ $copies[$i]->location eq $_->id}@$locations);
-		$copies[$i] = undef if (
-			!$copies[$i] ||
-			!$self->{user_filter}->request(
-				'open-ils.circ.permit_hold',
-				$hold->to_fieldmapper, do {
-					my $cp_fm = $copies[$i]->to_fieldmapper;
-					$cp_fm->circ_lib( $copies[$i]->circ_lib->to_fieldmapper );
-					$cp_fm->location( $copies[$i]->location->to_fieldmapper );
-					$cp_fm->status( $copies[$i]->status->to_fieldmapper );
-					$cp_fm;
-				},
-				{ title => $rec->to_fieldmapper,
-				  usr => actor::user->retrieve($hold->usr)->to_fieldmapper,
-				  requestor => actor::user->retrieve($hold->requestor)->to_fieldmapper,
-				})->gather(1)
-		);
-		$self->{client}->status( new OpenSRF::DomainObject::oilsContinueStatus );
-	}
-
-	@copies = grep { $_ } @copies;
-
-	my $count = @copies;
-
-	return unless ($count);
-	
-	action::hold_copy_map->search( hold => $hold->id )->delete_all;
-	
-	my @maps;
-	$self->{client}->respond( "\tMapping ".scalar(@copies)." eligable copies for hold ".$hold->id."\n");
-	for my $c (@copies) {
-		push @maps, action::hold_copy_map->create( { hold => $hold->id, target_copy => $c->id } );
-	}
-	$self->{client}->respond( "\tA total of ".scalar(@maps)." mapping were created for hold ".$hold->id."\n");
-
-	return \@copies;
+    my $self = shift;
+    my $hold = shift;
+    my $cps = shift;
+
+    if (!defined($cps)) {
+        try {
+            $cps = [ asset::copy->search( id => $hold->target ) ];
+        } catch Error with {
+            my $e = shift;
+            die "Could not retrieve initial volume list:\n\n$e\n";
+        };
+    }
+
+    my @copies = grep { $_->holdable } @$cps;
+
+    for (my $i = 0; $i < @$cps; $i++) {
+        next unless $$cps[$i];
+        
+        my $cn = $cache{cns}{$copies[$i]->call_number};
+        my $rec = $cache{titles}{$cn->record};
+        $copies[$i] = undef if ($copies[$i] && !grep{ $copies[$i]->status eq $_->id}@$statuses);
+        $copies[$i] = undef if ($copies[$i] && !grep{ $copies[$i]->location eq $_->id}@$locations);
+        $copies[$i] = undef if (
+            !$copies[$i] ||
+            !$self->{user_filter}->request(
+                'open-ils.circ.permit_hold',
+                $hold->to_fieldmapper, do {
+                    my $cp_fm = $copies[$i]->to_fieldmapper;
+                    $cp_fm->circ_lib( $copies[$i]->circ_lib->to_fieldmapper );
+                    $cp_fm->location( $copies[$i]->location->to_fieldmapper );
+                    $cp_fm->status( $copies[$i]->status->to_fieldmapper );
+                    $cp_fm;
+                },
+                { title => $rec->to_fieldmapper,
+                  usr => actor::user->retrieve($hold->usr)->to_fieldmapper,
+                  requestor => actor::user->retrieve($hold->requestor)->to_fieldmapper,
+                })->gather(1)
+        );
+        $self->{client}->status( new OpenSRF::DomainObject::oilsContinueStatus );
+    }
+
+    @copies = grep { $_ } @copies;
+
+    my $count = @copies;
+
+    return unless ($count);
+    
+    action::hold_copy_map->search( hold => $hold->id )->delete_all;
+    
+    my @maps;
+    $self->{client}->respond( "\tMapping ".scalar(@copies)." eligable copies for hold ".$hold->id."\n");
+    for my $c (@copies) {
+        push @maps, action::hold_copy_map->create( { hold => $hold->id, target_copy => $c->id } );
+    }
+    $self->{client}->respond( "\tA total of ".scalar(@maps)." mapping were created for hold ".$hold->id."\n");
+
+    return \@copies;
 }
 
 
 sub choose_nearest_copy {
-	my $hold = shift;
-	my $prox_list = shift;
-
-	for my $p ( sort keys %$prox_list ) {
-		next unless (ref $$prox_list{$p});
-
-		my @capturable = @{ $$prox_list{$p} };
-		next unless (@capturable);
-
-		my $rand = int(rand(scalar(@capturable)));
-		my %seen = ();
-		while (my ($c) = splice(@capturable, $rand, 1)) {
-			return $c if !exists($seen{$c->id}) && ( OpenILS::Utils::PermitHold::permit_copy_hold(
-				{ title => $c->call_number->record->to_fieldmapper,
-				  title_descriptor => $c->call_number->record->record_descriptor->next->to_fieldmapper,
-				  patron => $hold->usr->to_fieldmapper,
-				  copy => $c->to_fieldmapper,
-				  requestor => $hold->requestor->to_fieldmapper,
-				  request_lib => $hold->request_lib->to_fieldmapper,
-				  pickup_lib => $hold->pickup_lib->id,
-				  retarget => 1
-				}
-			));
-			$seen{$c->id}++;
-
-			last unless(@capturable);
-			$rand = int(rand(scalar(@capturable)));
-		}
-	}
+    my $hold = shift;
+    my $prox_list = shift;
+
+    for my $p ( sort keys %$prox_list ) {
+        next unless (ref $$prox_list{$p});
+
+        my @capturable = @{ $$prox_list{$p} };
+        next unless (@capturable);
+
+        my $rand = int(rand(scalar(@capturable)));
+        my %seen = ();
+        while (my ($c) = splice(@capturable, $rand, 1)) {
+            return $c if !exists($seen{$c->id}) && ( OpenILS::Utils::PermitHold::permit_copy_hold(
+                { title => $c->call_number->record->to_fieldmapper,
+                  title_descriptor => $c->call_number->record->record_descriptor->next->to_fieldmapper,
+                  patron => $hold->usr->to_fieldmapper,
+                  copy => $c->to_fieldmapper,
+                  requestor => $hold->requestor->to_fieldmapper,
+                  request_lib => $hold->request_lib->to_fieldmapper,
+                  pickup_lib => $hold->pickup_lib->id,
+                  retarget => 1
+                }
+            ));
+            $seen{$c->id}++;
+
+            last unless(@capturable);
+            $rand = int(rand(scalar(@capturable)));
+        }
+    }
 }
 
 sub create_prox_list {
-	my $self = shift;
-	my $lib = shift;
-	my $copies = shift;
-	my $hold = shift;
+    my $self = shift;
+    my $lib = shift;
+    my $copies = shift;
+    my $hold = shift;
 
-	my $actor = OpenSRF::AppSession->create('open-ils.actor');
+    my $actor = OpenSRF::AppSession->create('open-ils.actor');
 
-	my %prox_list;
-	for my $cp (@$copies) {
-		my ($prox) = $self->method_lookup('open-ils.storage.asset.copy.proximity')->run( $cp, $lib, $hold );
-		next unless (defined($prox));
+    my %prox_list;
+    for my $cp (@$copies) {
+        my ($prox) = $self->method_lookup('open-ils.storage.asset.copy.proximity')->run( $cp, $lib, $hold );
+        next unless (defined($prox));
 
         my $copy_circ_lib = ''.$cp->circ_lib;
-		# Fetch the weighting value for hold targeting, defaulting to 1
-		$self->{target_weight}{$copy_circ_lib} ||= $actor->request(
-			'open-ils.actor.ou_setting.ancestor_default' => $copy_circ_lib.'' => 'circ.holds.org_unit_target_weight'
-		)->gather(1);
+        # Fetch the weighting value for hold targeting, defaulting to 1
+        $self->{target_weight}{$copy_circ_lib} ||= $actor->request(
+            'open-ils.actor.ou_setting.ancestor_default' => $copy_circ_lib.'' => 'circ.holds.org_unit_target_weight'
+        )->gather(1);
         $self->{target_weight}{$copy_circ_lib} = $self->{target_weight}{$copy_circ_lib}{value} if (ref $self->{target_weight}{$copy_circ_lib});
         $self->{target_weight}{$copy_circ_lib} ||= 1;
 
-		$prox_list{$prox} = [] unless defined($prox_list{$prox});
-		for my $w ( 1 .. $self->{target_weight}{$copy_circ_lib} ) {
-			push @{$prox_list{$prox}}, $cp;
-		}
-	}
-	return \%prox_list;
+        $prox_list{$prox} = [] unless defined($prox_list{$prox});
+        for my $w ( 1 .. $self->{target_weight}{$copy_circ_lib} ) {
+            push @{$prox_list{$prox}}, $cp;
+        }
+    }
+    return \%prox_list;
 }
 
 sub volume_hold_capture {
-	my $self = shift;
-	my $hold = shift;
-	my $vols = shift;
-
-	if (!defined($vols)) {
-		try {
-			$vols = [ asset::call_number->search( id => $hold->target ) ];
-			$cache{cns}{$_->id} = $_ for (@$vols);
-		} catch Error with {
-			my $e = shift;
-			die "Could not retrieve initial volume list:\n\n$e\n";
-		};
-	}
-
-	my @v_ids = map { $_->id } @$vols;
-
-	my $cp_list;
-	try {
-		$cp_list = [ asset::copy->search( call_number => \@v_ids ) ];
-	
-	} catch Error with {
-		my $e = shift;
-		warn "Could not retrieve copy list:\n\n$e\n";
-	};
-
-	$self->copy_hold_capture($hold,$cp_list) if (ref $cp_list and @$cp_list);
+    my $self = shift;
+    my $hold = shift;
+    my $vols = shift;
+
+    if (!defined($vols)) {
+        try {
+            $vols = [ asset::call_number->search( id => $hold->target ) ];
+            $cache{cns}{$_->id} = $_ for (@$vols);
+        } catch Error with {
+            my $e = shift;
+            die "Could not retrieve initial volume list:\n\n$e\n";
+        };
+    }
+
+    my @v_ids = map { $_->id } @$vols;
+
+    my $cp_list;
+    try {
+        $cp_list = [ asset::copy->search( call_number => \@v_ids ) ];
+    
+    } catch Error with {
+        my $e = shift;
+        warn "Could not retrieve copy list:\n\n$e\n";
+    };
+
+    $self->copy_hold_capture($hold,$cp_list) if (ref $cp_list and @$cp_list);
 }
 
 sub title_hold_capture {
-	my $self = shift;
-	my $hold = shift;
-	my $titles = shift;
-
-	if (!defined($titles)) {
-		try {
-			$titles = [ biblio::record_entry->search( id => $hold->target ) ];
-			$cache{titles}{$_->id} = $_ for (@$titles);
-		} catch Error with {
-			my $e = shift;
-			die "Could not retrieve initial title list:\n\n$e\n";
-		};
-	}
-
-	my @t_ids = map { $_->id } @$titles;
-	my $cn_list;
-	try {
-		($cn_list) = $self->method_lookup('open-ils.storage.direct.asset.call_number.search.record.atomic')->run( \@t_ids );
-	
-	} catch Error with {
-		my $e = shift;
-		warn "Could not retrieve volume list:\n\n$e\n";
-	};
-
-	$cache{cns}{$_->id} = $_ for (@$cn_list);
-
-	$self->volume_hold_capture($hold,$cn_list) if (ref $cn_list and @$cn_list);
+    my $self = shift;
+    my $hold = shift;
+    my $titles = shift;
+
+    if (!defined($titles)) {
+        try {
+            $titles = [ biblio::record_entry->search( id => $hold->target ) ];
+            $cache{titles}{$_->id} = $_ for (@$titles);
+        } catch Error with {
+            my $e = shift;
+            die "Could not retrieve initial title list:\n\n$e\n";
+        };
+    }
+
+    my @t_ids = map { $_->id } @$titles;
+    my $cn_list;
+    try {
+        ($cn_list) = $self->method_lookup('open-ils.storage.direct.asset.call_number.search.record.atomic')->run( \@t_ids );
+    
+    } catch Error with {
+        my $e = shift;
+        warn "Could not retrieve volume list:\n\n$e\n";
+    };
+
+    $cache{cns}{$_->id} = $_ for (@$cn_list);
+
+    $self->volume_hold_capture($hold,$cn_list) if (ref $cn_list and @$cn_list);
 }
 
 sub metarecord_hold_capture {
-	my $self = shift;
-	my $hold = shift;
-
-	my $titles;
-	try {
-		$titles = [ metabib::metarecord_source_map->search( metarecord => $hold->target) ];
-	
-	} catch Error with {
-		my $e = shift;
-		die "Could not retrieve initial title list:\n\n$e\n";
-	};
-
-	try {
-		my @recs = map {$_->record} metabib::record_descriptor->search( record => $titles, item_type => [split '', $hold->holdable_formats] ); 
-
-		$titles = [ biblio::record_entry->search( id => \@recs ) ];
-	
-	} catch Error with {
-		my $e = shift;
-		die "Could not retrieve format-pruned title list:\n\n$e\n";
-	};
-
-
-	$cache{titles}{$_->id} = $_ for (@$titles);
-	$self->title_hold_capture($hold,$titles) if (ref $titles and @$titles);
+    my $self = shift;
+    my $hold = shift;
+
+    my $titles;
+    try {
+        $titles = [ metabib::metarecord_source_map->search( metarecord => $hold->target) ];
+    
+    } catch Error with {
+        my $e = shift;
+        die "Could not retrieve initial title list:\n\n$e\n";
+    };
+
+    try {
+        my @recs = map {$_->record} metabib::record_descriptor->search( record => $titles, item_type => [split '', $hold->holdable_formats] ); 
+
+        $titles = [ biblio::record_entry->search( id => \@recs ) ];
+    
+    } catch Error with {
+        my $e = shift;
+        die "Could not retrieve format-pruned title list:\n\n$e\n";
+    };
+
+
+    $cache{titles}{$_->id} = $_ for (@$titles);
+    $self->title_hold_capture($hold,$titles) if (ref $titles and @$titles);
 }
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm
index b0c9af2..06117ff 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/actor.pm
@@ -16,25 +16,25 @@ my $_dt_parser = DateTime::Format::ISO8601->new;
 my $log = 'OpenSRF::Utils::Logger';
 
 sub new_usergroup_id {
-	return actor::user->db_Main->selectrow_array("select nextval('actor.usr_usrgroup_seq'::regclass)");
+    return actor::user->db_Main->selectrow_array("select nextval('actor.usr_usrgroup_seq'::regclass)");
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.actor.user.group_id.new',
-	api_level	=> 1,
-	method		=> 'new_usergroup_id',
+    api_name    => 'open-ils.storage.actor.user.group_id.new',
+    api_level   => 1,
+    method      => 'new_usergroup_id',
 );
 
 sub juv_to_adult {
-	my $self = shift;
-	my $client = shift;
-	my $adult_age = shift;
+    my $self = shift;
+    my $client = shift;
+    my $adult_age = shift;
 
-	my $sql = <<"	SQL";
+    my $sql = <<"    SQL";
             UPDATE  actor.usr
               SET   juvenile = FALSE
               WHERE AGE(dob) > ?::INTERVAL
               AND juvenile IS TRUE;
-	SQL
+    SQL
 
     my $sth = actor::user->db_Main->prepare_cached($sql);
     $sth->execute($adult_age);
@@ -42,171 +42,171 @@ sub juv_to_adult {
     return $sth->rows;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.actor.user.juvenile_to_adult',
-	api_level	=> 1,
-	method		=> 'juv_to_adult',
+    api_name    => 'open-ils.storage.actor.user.juvenile_to_adult',
+    api_level   => 1,
+    method      => 'juv_to_adult',
 );
 
 sub usr_total_owed {
-	my $self = shift;
-	my $client = shift;
-	my $usr = shift;
-
-	my $sql = <<"	SQL";
-			SELECT	x.usr,
-					SUM(COALESCE((SELECT SUM(b.amount) FROM money.billing b WHERE b.voided IS FALSE AND b.xact = x.id),0.0)) -
-						SUM(COALESCE((SELECT SUM(p.amount) FROM money.payment p WHERE p.voided IS FALSE AND p.xact = x.id),0.0))
-			  FROM	money.billable_xact x
-			  WHERE	x.usr = ? AND x.xact_finish IS NULL
-			  GROUP BY 1
-	SQL
-
-	my (undef,$val) = actor::user->db_Main->selectrow_array($sql, {}, $usr);
-
-	return $val;
+    my $self = shift;
+    my $client = shift;
+    my $usr = shift;
+
+    my $sql = <<"    SQL";
+            SELECT  x.usr,
+                    SUM(COALESCE((SELECT SUM(b.amount) FROM money.billing b WHERE b.voided IS FALSE AND b.xact = x.id),0.0)) -
+                        SUM(COALESCE((SELECT SUM(p.amount) FROM money.payment p WHERE p.voided IS FALSE AND p.xact = x.id),0.0))
+              FROM  money.billable_xact x
+              WHERE x.usr = ? AND x.xact_finish IS NULL
+              GROUP BY 1
+    SQL
+
+    my (undef,$val) = actor::user->db_Main->selectrow_array($sql, {}, $usr);
+
+    return $val;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.actor.user.total_owed',
-	api_level	=> 1,
-	method		=> 'usr_total_owed',
+    api_name    => 'open-ils.storage.actor.user.total_owed',
+    api_level   => 1,
+    method      => 'usr_total_owed',
 );
 
 sub usr_breakdown_out {
-	my $self = shift;
-	my $client = shift;
-	my $usr = shift;
+    my $self = shift;
+    my $client = shift;
+    my $usr = shift;
 
-	$self->method_lookup('open-ils.storage.transaction.begin')->run($client);
+    $self->method_lookup('open-ils.storage.transaction.begin')->run($client);
 
-	my $out_sql = <<"	SQL";
-			SELECT	id
-			  FROM	action.circulation
-			  WHERE	usr = ?
+    my $out_sql = <<"    SQL";
+            SELECT  id
+              FROM  action.circulation
+              WHERE usr = ?
                     AND checkin_time IS NULL
                     AND (  (fine_interval >= '1 day' AND due_date >= 'today')
                         OR (fine_interval < '1 day'  AND due_date > 'now'   ))
                     AND (stop_fines IS NULL
                         OR stop_fines NOT IN ('LOST','CLAIMSRETURNED','LONGOVERDUE'))
-	SQL
+    SQL
 
-	my $out = actor::user->db_Main->selectcol_arrayref($out_sql, {}, $usr);
+    my $out = actor::user->db_Main->selectcol_arrayref($out_sql, {}, $usr);
 
-	my $od_sql = <<"	SQL";
-			SELECT	id
-			  FROM	action.circulation
-			  WHERE	usr = ?
+    my $od_sql = <<"    SQL";
+            SELECT  id
+              FROM  action.circulation
+              WHERE usr = ?
                     AND checkin_time IS NULL
                     AND (  (fine_interval >= '1 day' AND due_date < 'today')
                         OR (fine_interval < '1 day'  AND due_date < 'now'  ))
                     AND (stop_fines IS NULL
                         OR stop_fines NOT IN ('LOST','CLAIMSRETURNED','LONGOVERDUE'))
-	SQL
-
-	my $od = actor::user->db_Main->selectcol_arrayref($od_sql, {}, $usr);
-
-	my $lost_sql = <<"	SQL";
-			SELECT	id
-			  FROM	action.circulation
-			  WHERE	usr = ? AND checkin_time IS NULL AND xact_finish IS NULL AND stop_fines = 'LOST'
-	SQL
-
-	my $lost = actor::user->db_Main->selectcol_arrayref($lost_sql, {}, $usr);
-
-	my $cl_sql = <<"	SQL";
-			SELECT	id
-			  FROM	action.circulation
-			  WHERE	usr = ? AND checkin_time IS NULL AND stop_fines = 'CLAIMSRETURNED'
-	SQL
-
-	my $cl = actor::user->db_Main->selectcol_arrayref($cl_sql, {}, $usr);
-
-	my $lo_sql = <<"	SQL";
-			SELECT	id
-			  FROM	action.circulation
-			  WHERE	usr = ? AND checkin_time IS NULL AND stop_fines = 'LONGOVERDUE'
-	SQL
-
-	my $lo = actor::user->db_Main->selectcol_arrayref($lo_sql, {}, $usr);
-
-	$self->method_lookup('open-ils.storage.transaction.rollback')->run($client);
-
-	if ($self->api_name =~/count$/o) {
-		return {	total	=> scalar(@$out) + scalar(@$od) + scalar(@$lost) + scalar(@$cl) + scalar(@$lo),
-					out		=> scalar(@$out),
-					overdue	=> scalar(@$od),
-					lost	=> scalar(@$lost),
-					claims_returned	=> scalar(@$cl),
-					long_overdue		=> scalar(@$lo),
-		};
-	}
-
-	return {	out		=> $out,
-				overdue	=> $od,
-				lost	=> $lost,
-				claims_returned	=> $cl,
-				long_overdue		=> $lo,
-	};
+    SQL
+
+    my $od = actor::user->db_Main->selectcol_arrayref($od_sql, {}, $usr);
+
+    my $lost_sql = <<"    SQL";
+            SELECT  id
+              FROM  action.circulation
+              WHERE usr = ? AND checkin_time IS NULL AND xact_finish IS NULL AND stop_fines = 'LOST'
+    SQL
+
+    my $lost = actor::user->db_Main->selectcol_arrayref($lost_sql, {}, $usr);
+
+    my $cl_sql = <<"    SQL";
+            SELECT  id
+              FROM  action.circulation
+              WHERE usr = ? AND checkin_time IS NULL AND stop_fines = 'CLAIMSRETURNED'
+    SQL
+
+    my $cl = actor::user->db_Main->selectcol_arrayref($cl_sql, {}, $usr);
+
+    my $lo_sql = <<"    SQL";
+            SELECT  id
+              FROM  action.circulation
+              WHERE usr = ? AND checkin_time IS NULL AND stop_fines = 'LONGOVERDUE'
+    SQL
+
+    my $lo = actor::user->db_Main->selectcol_arrayref($lo_sql, {}, $usr);
+
+    $self->method_lookup('open-ils.storage.transaction.rollback')->run($client);
+
+    if ($self->api_name =~/count$/o) {
+        return {    total   => scalar(@$out) + scalar(@$od) + scalar(@$lost) + scalar(@$cl) + scalar(@$lo),
+                    out     => scalar(@$out),
+                    overdue => scalar(@$od),
+                    lost    => scalar(@$lost),
+                    claims_returned => scalar(@$cl),
+                    long_overdue        => scalar(@$lo),
+        };
+    }
+
+    return {    out     => $out,
+                overdue => $od,
+                lost    => $lost,
+                claims_returned => $cl,
+                long_overdue        => $lo,
+    };
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.actor.user.checked_out',
-	api_level	=> 1,
-	method		=> 'usr_breakdown_out',
+    api_name    => 'open-ils.storage.actor.user.checked_out',
+    api_level   => 1,
+    method      => 'usr_breakdown_out',
 );
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.actor.user.checked_out.count',
-	api_level	=> 1,
-	method		=> 'usr_breakdown_out',
+    api_name    => 'open-ils.storage.actor.user.checked_out.count',
+    api_level   => 1,
+    method      => 'usr_breakdown_out',
 );
 
 sub usr_total_out {
-	my $self = shift;
-	my $client = shift;
-	my $usr = shift;
+    my $self = shift;
+    my $client = shift;
+    my $usr = shift;
 
-	my $sql = <<"	SQL";
-			SELECT	count(*)
-			  FROM	action.circulation
-			  WHERE	usr = ? AND checkin_time IS NULL
-	SQL
+    my $sql = <<"    SQL";
+            SELECT  count(*)
+              FROM  action.circulation
+              WHERE usr = ? AND checkin_time IS NULL
+    SQL
 
-	my ($val) = actor::user->db_Main->selectrow_array($sql, {}, $usr);
+    my ($val) = actor::user->db_Main->selectrow_array($sql, {}, $usr);
 
-	return $val;
+    return $val;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.actor.user.total_out',
-	api_level	=> 1,
-	method		=> 'usr_total_out',
+    api_name    => 'open-ils.storage.actor.user.total_out',
+    api_level   => 1,
+    method      => 'usr_total_out',
 );
 
 sub calc_proximity {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	local $OpenILS::Application::Storage::WRITE = 1;
+    local $OpenILS::Application::Storage::WRITE = 1;
 
-	my $delete_sql = <<"	SQL";
-		DELETE FROM actor.org_unit_proximity;
-	SQL
+    my $delete_sql = <<"    SQL";
+        DELETE FROM actor.org_unit_proximity;
+    SQL
 
-	my $insert_sql = <<"	SQL";
-		INSERT INTO actor.org_unit_proximity (from_org, to_org, prox)
-			SELECT	l.id,
-				r.id,
-				actor.org_unit_proximity(l.id,r.id)
-			  FROM	actor.org_unit l,
-				actor.org_unit r;
-	SQL
+    my $insert_sql = <<"    SQL";
+        INSERT INTO actor.org_unit_proximity (from_org, to_org, prox)
+            SELECT  l.id,
+                r.id,
+                actor.org_unit_proximity(l.id,r.id)
+              FROM  actor.org_unit l,
+                actor.org_unit r;
+    SQL
 
-	actor::org_unit_proximity->db_Main->do($delete_sql);
-	actor::org_unit_proximity->db_Main->do($insert_sql);
+    actor::org_unit_proximity->db_Main->do($delete_sql);
+    actor::org_unit_proximity->db_Main->do($insert_sql);
 
-	return 1;
+    return 1;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.actor.org_unit.refresh_proximity',
-	api_level	=> 1,
-	method		=> 'calc_proximity',
+    api_name    => 'open-ils.storage.actor.org_unit.refresh_proximity',
+    api_level   => 1,
+    method      => 'calc_proximity',
 );
 
 sub make_hoo_spanset {
@@ -266,33 +266,33 @@ sub make_closure_spanset {
 }
 
 sub new_org_closed_overlap {
-	my $self = shift;
-	my $client = shift;
-	my $ou = shift;
-	my $date = shift;
-	my $direction = shift || 0;
-	my $no_hoo = shift || 0;
+    my $self = shift;
+    my $client = shift;
+    my $ou = shift;
+    my $date = shift;
+    my $direction = shift || 0;
+    my $no_hoo = shift || 0;
 
-	return undef unless ($date && $ou);
+    return undef unless ($date && $ou);
 
     # we're given a date and a direction, find any closures that contain the date
-	my $t = actor::org_unit::closed_date->table;
-	my $sql = <<"	SQL";
-		SELECT	*
-		  FROM	$t
-		  WHERE	close_end > ?
-			AND org_unit = ?
-		  ORDER BY close_start ASC, close_end DESC
-		  LIMIT 1
-	SQL
-
-	$date = cleanse_ISO8601($date);
+    my $t = actor::org_unit::closed_date->table;
+    my $sql = <<"    SQL";
+        SELECT  *
+          FROM  $t
+          WHERE close_end > ?
+            AND org_unit = ?
+          ORDER BY close_start ASC, close_end DESC
+          LIMIT 1
+    SQL
+
+    $date = cleanse_ISO8601($date);
 
     my $target_date = $_dt_parser->parse_datetime( $date );
-	my ($begin, $end) = ($target_date, $target_date);
+    my ($begin, $end) = ($target_date, $target_date);
 
     # create a spanset from the closures that contain the $date
-	my $closure_spanset = make_closure_spanset(
+    my $closure_spanset = make_closure_spanset(
         actor::org_unit::closed_date->db_Main->selectall_hashref( $sql, 'id', {}, $date, $ou )
     );
 
@@ -301,27 +301,27 @@ sub new_org_closed_overlap {
         $begin = $closure_intersection->min;
         $end = $closure_intersection->max;
 
-		if ( $direction <= 0 ) {
-			$begin->subtract( minutes => 1 );
+        if ( $direction <= 0 ) {
+            $begin->subtract( minutes => 1 );
 
-			while ( my $_b = new_org_closed_overlap($self, $client, $ou, $begin->strftime('%FT%T%z'), -1, 1 ) ) {
-				$begin = $_dt_parser->parse_datetime( cleanse_ISO8601($_b->{start}) );
-			}
-		}
+            while ( my $_b = new_org_closed_overlap($self, $client, $ou, $begin->strftime('%FT%T%z'), -1, 1 ) ) {
+                $begin = $_dt_parser->parse_datetime( cleanse_ISO8601($_b->{start}) );
+            }
+        }
 
-		if ( $direction >= 0 ) {
-			$end->add( minutes => 1 );
+        if ( $direction >= 0 ) {
+            $end->add( minutes => 1 );
 
-			while ( my $_a = new_org_closed_overlap($self, $client, $ou, $end->strftime('%FT%T%z'), 1, 1 ) ) {
-				$end = $_dt_parser->parse_datetime( cleanse_ISO8601($_a->{end}) );
-			}
-		}
+            while ( my $_a = new_org_closed_overlap($self, $client, $ou, $end->strftime('%FT%T%z'), 1, 1 ) ) {
+                $end = $_dt_parser->parse_datetime( cleanse_ISO8601($_a->{end}) );
+            }
+        }
     }
 
-	if ( !$no_hoo ) {
+    if ( !$no_hoo ) {
 
-	    my $begin_hoo = make_hoo_spanset(actor::org_unit::hours_of_operation->retrieve($ou), $begin);
-	    my $end_hoo   = make_hoo_spanset(actor::org_unit::hours_of_operation->retrieve($ou), $end  );
+        my $begin_hoo = make_hoo_spanset(actor::org_unit::hours_of_operation->retrieve($ou), $begin);
+        my $end_hoo   = make_hoo_spanset(actor::org_unit::hours_of_operation->retrieve($ou), $end  );
 
 
         if ( $begin_hoo && $direction <= 0 && $begin_hoo->intersects($begin) ) {
@@ -333,11 +333,11 @@ sub new_org_closed_overlap {
                 $begin = $_dt_parser->parse_datetime( cleanse_ISO8601($_b->{start}) );
             }
         }
-	
+    
         if ( $end_hoo && $direction >= 0 && $end_hoo->intersects($end) ) {
             my $hoo_intersection = $end_hoo->intersection( $end );
             $end = $hoo_intersection->max;
-			$end->add( minutes => 1 );
+            $end->add( minutes => 1 );
 
 
             while ( my $_b = new_org_closed_overlap($self, $client, $ou, $end->strftime('%FT%T%z'), -1 ) ) {
@@ -353,9 +353,9 @@ sub new_org_closed_overlap {
     return { start => $start, end => $stop };
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.actor.org_unit.closed_date.overlap',
-	api_level	=> 0,
-	method		=> 'new_org_closed_overlap',
+    api_name    => 'open-ils.storage.actor.org_unit.closed_date.overlap',
+    api_level   => 0,
+    method      => 'new_org_closed_overlap',
 );
 
 sub org_closed_overlap {
@@ -473,145 +473,145 @@ sub org_closed_overlap {
     return { start => $begin, end => $end };
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.actor.org_unit.closed_date.overlap',
-	api_level	=> 1,
-	method		=> 'org_closed_overlap',
+    api_name    => 'open-ils.storage.actor.org_unit.closed_date.overlap',
+    api_level   => 1,
+    method      => 'org_closed_overlap',
 );
 
 sub user_by_barcode {
-	my $self = shift;
-	my $client = shift;
-	my @barcodes = shift;
-
-	return undef unless @barcodes;
-
-	for my $card ( actor::card->search( { barcode => @barcodes } ) ) {
-		next unless $card;
-		if (@barcodes == 1) {
-			return $card->usr->to_fieldmapper;
-		}
-		$client->respond( $card->usr->to_fieldmapper);
-	}
-	return undef;
+    my $self = shift;
+    my $client = shift;
+    my @barcodes = shift;
+
+    return undef unless @barcodes;
+
+    for my $card ( actor::card->search( { barcode => @barcodes } ) ) {
+        next unless $card;
+        if (@barcodes == 1) {
+            return $card->usr->to_fieldmapper;
+        }
+        $client->respond( $card->usr->to_fieldmapper);
+    }
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.direct.actor.user.search.barcode',
-	api_level	=> 1,
-	method		=> 'user_by_barcode',
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => 'open-ils.storage.direct.actor.user.search.barcode',
+    api_level   => 1,
+    method      => 'user_by_barcode',
+    stream      => 1,
+    cachable    => 1,
 );
 
 sub lost_barcodes {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	my $c = actor::card->table;
-	my $p = actor::user->table;
+    my $c = actor::card->table;
+    my $p = actor::user->table;
 
-	my $sql = "SELECT c.barcode FROM $c c JOIN $p p ON (c.usr = p.id) WHERE p.card <> c.id";
+    my $sql = "SELECT c.barcode FROM $c c JOIN $p p ON (c.usr = p.id) WHERE p.card <> c.id";
 
-	my $list = actor::user->db_Main->selectcol_arrayref($sql);
-	for my $bc ( @$list ) {
-		$client->respond($bc);
-	}
-	return undef;
+    my $list = actor::user->db_Main->selectcol_arrayref($sql);
+    for my $bc ( @$list ) {
+        $client->respond($bc);
+    }
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.actor.user.lost_barcodes',
-	api_level	=> 1,
-	stream		=> 1,
-	method		=> 'lost_barcodes',
-	signature	=> <<'	NOTE',
-		Returns an array of barcodes that belong to lost cards.
-		@return array of barcodes
-	NOTE
+    api_name    => 'open-ils.storage.actor.user.lost_barcodes',
+    api_level   => 1,
+    stream      => 1,
+    method      => 'lost_barcodes',
+    signature    => <<'    NOTE',
+        Returns an array of barcodes that belong to lost cards.
+        @return array of barcodes
+    NOTE
 );
 
 sub expired_barcodes {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	my $c = actor::card->table;
-	my $p = actor::user->table;
+    my $c = actor::card->table;
+    my $p = actor::user->table;
 
-	my $sql = "SELECT c.barcode FROM $c c JOIN $p p ON (c.usr = p.id) WHERE p.expire_date < CURRENT_DATE";
+    my $sql = "SELECT c.barcode FROM $c c JOIN $p p ON (c.usr = p.id) WHERE p.expire_date < CURRENT_DATE";
 
-	my $list = actor::user->db_Main->selectcol_arrayref($sql);
-	for my $bc ( @$list ) {
-		$client->respond($bc);
-	}
-	return undef;
+    my $list = actor::user->db_Main->selectcol_arrayref($sql);
+    for my $bc ( @$list ) {
+        $client->respond($bc);
+    }
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.actor.user.expired_barcodes',
-	api_level	=> 1,
-	stream		=> 1,
-	method		=> 'expired_barcodes',
-	signature	=> <<'	NOTE',
-		Returns an array of barcodes that are currently expired.
-		@return array of barcodes
-	NOTE
+    api_name    => 'open-ils.storage.actor.user.expired_barcodes',
+    api_level   => 1,
+    stream      => 1,
+    method      => 'expired_barcodes',
+    signature    => <<'    NOTE',
+        Returns an array of barcodes that are currently expired.
+        @return array of barcodes
+    NOTE
 );
 
 sub barred_barcodes {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	my $c = actor::card->table;
-	my $p = actor::user->table;
+    my $c = actor::card->table;
+    my $p = actor::user->table;
 
-	my $sql = "SELECT c.barcode FROM $c c JOIN $p p ON (c.usr = p.id) WHERE p.barred IS TRUE";
+    my $sql = "SELECT c.barcode FROM $c c JOIN $p p ON (c.usr = p.id) WHERE p.barred IS TRUE";
 
-	my $list = actor::user->db_Main->selectcol_arrayref($sql);
-	for my $bc ( @$list ) {
-		$client->respond($bc);
-	}
-	return undef;
+    my $list = actor::user->db_Main->selectcol_arrayref($sql);
+    for my $bc ( @$list ) {
+        $client->respond($bc);
+    }
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.actor.user.barred_barcodes',
-	api_level	=> 1,
-	stream		=> 1,
-	method		=> 'barred_barcodes',
-	signature	=> <<'	NOTE',
-		Returns an array of barcodes that are currently barred.
-		@return array of barcodes
-	NOTE
+    api_name    => 'open-ils.storage.actor.user.barred_barcodes',
+    api_level   => 1,
+    stream      => 1,
+    method      => 'barred_barcodes',
+    signature    => <<'    NOTE',
+        Returns an array of barcodes that are currently barred.
+        @return array of barcodes
+    NOTE
 );
 
 sub penalized_barcodes {
-	my $self = shift;
-	my $client = shift;
-
-	my $c = actor::card->table;
-	my $p = actor::user_standing_penalty->table;
-
-	my $sql = <<"	SQL";
-		SELECT	DISTINCT c.barcode
-		  FROM	$c c
-			JOIN $p p USING (usr)
-			JOIN config.standing_penalty csp ON (csp.id = p.standing_penalty)
-		  WHERE	csp.block_list IS NOT NULL
-			AND p.set_date < CURRENT_DATE
-			AND (p.stop_date IS NULL OR p.stop_date > CURRENT_DATE);
-	SQL
-
-	my $list = actor::user->db_Main->selectcol_arrayref($sql);
-	for my $bc ( @$list ) {
-		$client->respond($bc);
-	}
-	return undef;
+    my $self = shift;
+    my $client = shift;
+
+    my $c = actor::card->table;
+    my $p = actor::user_standing_penalty->table;
+
+    my $sql = <<"    SQL";
+        SELECT  DISTINCT c.barcode
+          FROM  $c c
+            JOIN $p p USING (usr)
+            JOIN config.standing_penalty csp ON (csp.id = p.standing_penalty)
+          WHERE csp.block_list IS NOT NULL
+            AND p.set_date < CURRENT_DATE
+            AND (p.stop_date IS NULL OR p.stop_date > CURRENT_DATE);
+    SQL
+
+    my $list = actor::user->db_Main->selectcol_arrayref($sql);
+    for my $bc ( @$list ) {
+        $client->respond($bc);
+    }
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.actor.user.penalized_barcodes',
-	api_level	=> 1,
-	stream		=> 1,
-	method		=> 'penalized_barcodes',
-	signature	=> <<'	NOTE',
-		Returns an array of barcodes that have blocking penalties.
-		@return array of barcodes
-	NOTE
+    api_name    => 'open-ils.storage.actor.user.penalized_barcodes',
+    api_level   => 1,
+    stream      => 1,
+    method      => 'penalized_barcodes',
+    signature    => <<'    NOTE',
+        Returns an array of barcodes that have blocking penalties.
+        @return array of barcodes
+    NOTE
 );
 
 sub _clean_regex_chars {
@@ -633,305 +633,305 @@ sub _clean_regex_chars {
 }
 
 sub patron_search {
-	my $self = shift;
-	my $client = shift;
-	my $search = shift;
-	my $limit = shift || 1000;
-	my $sort = shift;
-	my $inactive = shift;
-	my $ws_ou = shift;
-	my $search_org = shift || $ws_ou;
-	my $opt_boundary = shift || 0;
+    my $self = shift;
+    my $client = shift;
+    my $search = shift;
+    my $limit = shift || 1000;
+    my $sort = shift;
+    my $inactive = shift;
+    my $ws_ou = shift;
+    my $search_org = shift || $ws_ou;
+    my $opt_boundary = shift || 0;
 
     my $penalty_sort = 0;
 
-	my $strict_opt_in = OpenSRF::Utils::SettingsClient->new->config_value( share => user => 'opt_in' );
+    my $strict_opt_in = OpenSRF::Utils::SettingsClient->new->config_value( share => user => 'opt_in' );
 
-	$sort = ['family_name','first_given_name'] unless ($$sort[0]);
-	push @$sort,'id';
+    $sort = ['family_name','first_given_name'] unless ($$sort[0]);
+    push @$sort,'id';
 
     if ($$sort[0] eq 'penalties') {
         shift @$sort;
         $penalty_sort = 1;
     }
 
-	# group 0 = user
-	# group 1 = address
-	# group 2 = phone, ident
-	# group 3 = barcode
-
-	my $usr = join ' AND ', map { "evergreen.lowercase(CAST($_ AS text)) ~ ?" } grep { ''.$$search{$_}{group} eq '0' } keys %$search;
-	my @usrv = map { "^" . _clean_regex_chars($$search{$_}{value}) } grep { ''.$$search{$_}{group} eq '0' } keys %$search;
-
-	my $addr = join ' AND ', map { "evergreen.lowercase(CAST($_ AS text)) ~ ?" } grep { ''.$$search{$_}{group} eq '1' } keys %$search;
-	my @addrv = map { "^" . _clean_regex_chars($$search{$_}{value}) } grep { ''.$$search{$_}{group} eq '1' } keys %$search;
-
-	my $pv = _clean_regex_chars($$search{phone}{value});
-	my $iv = _clean_regex_chars($$search{ident}{value});
-	my $nv = _clean_regex_chars($$search{name}{value});
-	my $cv = _clean_regex_chars($$search{card}{value});
-
-	my $card = '';
-	if ($cv) {
-	    $card = 'JOIN (SELECT DISTINCT usr FROM actor.card WHERE evergreen.lowercase(barcode) LIKE ?||\'%\') AS card ON (card.usr = users.id)';
-	    unshift(@usrv, $cv);
-	}
-
-	my $phone = '';
-	my @ps;
-	my @phonev;
-	if ($pv) {
-		for my $p ( qw/day_phone evening_phone other_phone/ ) {
-			if ($pv =~ /^\d+$/) {
-				push @ps, "evergreen.lowercase(REGEXP_REPLACE($p, '[^0-9]', '', 'g')) ~ ?";
- 			} else {
- 				push @ps, "evergreen.lowercase($p) ~ ?";
- 			}
-			push @phonev, "^$pv";
-		}
-		$phone = '(' . join(' OR ', @ps) . ')';
-	}
-
-	my $ident = '';
-	my @is;
-	my @identv;
-	if ($iv) {
-		for my $i ( qw/ident_value ident_value2/ ) {
-			push @is, "evergreen.lowercase($i) ~ ?";
-			push @identv, "^$iv";
-		}
-		$ident = '(' . join(' OR ', @is) . ')';
-	}
-
-	my $name = '';
-	my @ns;
-	my @namev;
-	if (0 && $nv) {
-		for my $n ( qw/first_given_name second_given_name family_name/ ) {
-			push @ns, "evergreen.lowercase($n) ~ ?";
-			push @namev, "^$nv";
-		}
-		$name = '(' . join(' OR ', @ns) . ')';
-	}
-
-	my $usr_where = join ' AND ', grep { $_ } ($usr,$phone,$ident,$name);
-	my $addr_where = $addr;
-
-
-	my $u_table = actor::user->table;
-	my $a_table = actor::user_address->table;
-	my $opt_in_table = actor::usr_org_unit_opt_in->table;
-	my $ou_table = actor::org_unit->table;
-
-	my $u_select = "SELECT id as id FROM $u_table u WHERE $usr_where";
-	my $a_select = "SELECT u.id as id FROM $a_table a JOIN $u_table u ON (u.mailing_address = a.id OR u.billing_address = a.id) WHERE $addr_where";
-
-	my $clone_select = '';
-
-	#$clone_select = "JOIN (SELECT cu.id as id FROM $a_table ca ".
-	#		   "JOIN $u_table cu ON (cu.mailing_address = ca.id OR cu.billing_address = ca.id) ".
-	#		   "WHERE $addr_where) AS clone ON (clone.id = users.id)" if ($addr_where);
-
-	my $select = '';
-	if ($usr_where) {
-		if ($addr_where) {
-			$select = "$u_select INTERSECT $a_select";
-		} else {
-			$select = $u_select;
-		}
-	} elsif ($addr_where) {
-		$select = "$a_select";
-	}
-
-	return undef if (!$select && !$card);
-
-	my $order_by = join ', ', map { 'evergreen.lowercase(CAST(users.'. (split / /,$_)[0] . ' AS text)) ' . (split / /,$_)[1] } @$sort;
-	my $distinct_list = join ', ', map { 'evergreen.lowercase(CAST(users.'. (split / /,$_)[0] . ' AS text))' } @$sort;
+    # group 0 = user
+    # group 1 = address
+    # group 2 = phone, ident
+    # group 3 = barcode
+
+    my $usr = join ' AND ', map { "evergreen.lowercase(CAST($_ AS text)) ~ ?" } grep { ''.$$search{$_}{group} eq '0' } keys %$search;
+    my @usrv = map { "^" . _clean_regex_chars($$search{$_}{value}) } grep { ''.$$search{$_}{group} eq '0' } keys %$search;
+
+    my $addr = join ' AND ', map { "evergreen.lowercase(CAST($_ AS text)) ~ ?" } grep { ''.$$search{$_}{group} eq '1' } keys %$search;
+    my @addrv = map { "^" . _clean_regex_chars($$search{$_}{value}) } grep { ''.$$search{$_}{group} eq '1' } keys %$search;
+
+    my $pv = _clean_regex_chars($$search{phone}{value});
+    my $iv = _clean_regex_chars($$search{ident}{value});
+    my $nv = _clean_regex_chars($$search{name}{value});
+    my $cv = _clean_regex_chars($$search{card}{value});
+
+    my $card = '';
+    if ($cv) {
+        $card = 'JOIN (SELECT DISTINCT usr FROM actor.card WHERE evergreen.lowercase(barcode) LIKE ?||\'%\') AS card ON (card.usr = users.id)';
+        unshift(@usrv, $cv);
+    }
+
+    my $phone = '';
+    my @ps;
+    my @phonev;
+    if ($pv) {
+        for my $p ( qw/day_phone evening_phone other_phone/ ) {
+            if ($pv =~ /^\d+$/) {
+                push @ps, "evergreen.lowercase(REGEXP_REPLACE($p, '[^0-9]', '', 'g')) ~ ?";
+            } else {
+                push @ps, "evergreen.lowercase($p) ~ ?";
+            }
+            push @phonev, "^$pv";
+        }
+        $phone = '(' . join(' OR ', @ps) . ')';
+    }
+
+    my $ident = '';
+    my @is;
+    my @identv;
+    if ($iv) {
+        for my $i ( qw/ident_value ident_value2/ ) {
+            push @is, "evergreen.lowercase($i) ~ ?";
+            push @identv, "^$iv";
+        }
+        $ident = '(' . join(' OR ', @is) . ')';
+    }
+
+    my $name = '';
+    my @ns;
+    my @namev;
+    if (0 && $nv) {
+        for my $n ( qw/first_given_name second_given_name family_name/ ) {
+            push @ns, "evergreen.lowercase($n) ~ ?";
+            push @namev, "^$nv";
+        }
+        $name = '(' . join(' OR ', @ns) . ')';
+    }
+
+    my $usr_where = join ' AND ', grep { $_ } ($usr,$phone,$ident,$name);
+    my $addr_where = $addr;
+
+
+    my $u_table = actor::user->table;
+    my $a_table = actor::user_address->table;
+    my $opt_in_table = actor::usr_org_unit_opt_in->table;
+    my $ou_table = actor::org_unit->table;
+
+    my $u_select = "SELECT id as id FROM $u_table u WHERE $usr_where";
+    my $a_select = "SELECT u.id as id FROM $a_table a JOIN $u_table u ON (u.mailing_address = a.id OR u.billing_address = a.id) WHERE $addr_where";
+
+    my $clone_select = '';
+
+    #$clone_select = "JOIN (SELECT cu.id as id FROM $a_table ca ".
+    #          "JOIN $u_table cu ON (cu.mailing_address = ca.id OR cu.billing_address = ca.id) ".
+    #          "WHERE $addr_where) AS clone ON (clone.id = users.id)" if ($addr_where);
+
+    my $select = '';
+    if ($usr_where) {
+        if ($addr_where) {
+            $select = "$u_select INTERSECT $a_select";
+        } else {
+            $select = $u_select;
+        }
+    } elsif ($addr_where) {
+        $select = "$a_select";
+    }
+
+    return undef if (!$select && !$card);
+
+    my $order_by = join ', ', map { 'evergreen.lowercase(CAST(users.'. (split / /,$_)[0] . ' AS text)) ' . (split / /,$_)[1] } @$sort;
+    my $distinct_list = join ', ', map { 'evergreen.lowercase(CAST(users.'. (split / /,$_)[0] . ' AS text))' } @$sort;
     my $group_list = $distinct_list;
 
-	if ($inactive) {
-		$inactive = '';
-	} else {
-		$inactive = 'AND users.active = TRUE';
-	}
-
-	if (!$ws_ou) {  # XXX This should be required!!
-		$ws_ou = actor::org_unit->search( { parent_ou => undef } )->next->id;
-	}
-
-	my $descendants = "actor.org_unit_descendants($search_org)";
-
-	my $opt_in_where = '';
-	if (lc($strict_opt_in) eq 'true') {
-		$opt_in_where = "AND (";
-		$opt_in_where .= "EXISTS (select id FROM $opt_in_table ";
-		$opt_in_where .= " WHERE org_unit in (select (actor.org_unit_ancestors($ws_ou)).id)";
-		$opt_in_where .= " AND usr = users.id) ";
-		$opt_in_where .= "OR";
-		$opt_in_where .= " users.home_ou IN (select (actor.org_unit_descendants($ws_ou,$opt_boundary)).id))";
-	}
-
-	my $penalty_join = '';
+    if ($inactive) {
+        $inactive = '';
+    } else {
+        $inactive = 'AND users.active = TRUE';
+    }
+
+    if (!$ws_ou) {  # XXX This should be required!!
+        $ws_ou = actor::org_unit->search( { parent_ou => undef } )->next->id;
+    }
+
+    my $descendants = "actor.org_unit_descendants($search_org)";
+
+    my $opt_in_where = '';
+    if (lc($strict_opt_in) eq 'true') {
+        $opt_in_where = "AND (";
+        $opt_in_where .= "EXISTS (select id FROM $opt_in_table ";
+        $opt_in_where .= " WHERE org_unit in (select (actor.org_unit_ancestors($ws_ou)).id)";
+        $opt_in_where .= " AND usr = users.id) ";
+        $opt_in_where .= "OR";
+        $opt_in_where .= " users.home_ou IN (select (actor.org_unit_descendants($ws_ou,$opt_boundary)).id))";
+    }
+
+    my $penalty_join = '';
     if ($penalty_sort) {
         $distinct_list = 'COUNT(penalties.id), ' . $distinct_list;
         $order_by = 'COUNT(penalties.id) DESC, ' . $order_by;
         unshift @$sort, 'COUNT(penalties.id)';
-	    $penalty_join = <<"        SQL";
+        $penalty_join = <<"        SQL";
             LEFT JOIN actor.usr_standing_penalty penalties
                 ON (users.id = penalties.usr AND (penalties.stop_date IS NULL OR penalties.stop_date > NOW()))
         SQL
     }
 
-	$select = "JOIN ($select) AS search ON (search.id = users.id)" if ($select);
-	$select = <<"	SQL";
-		SELECT	$distinct_list
-		  FROM	$u_table AS users $card
-			JOIN $descendants d ON (d.id = users.home_ou)
-			$select
-			$clone_select
+    $select = "JOIN ($select) AS search ON (search.id = users.id)" if ($select);
+    $select = <<"    SQL";
+        SELECT  $distinct_list
+          FROM  $u_table AS users $card
+            JOIN $descendants d ON (d.id = users.home_ou)
+            $select
+            $clone_select
             $penalty_join
-		  WHERE	users.deleted = FALSE
-			$inactive
-			$opt_in_where
-		  GROUP BY $group_list
-		  ORDER BY $order_by
-		  LIMIT $limit
-	SQL
-
-	return actor::user->db_Main->selectcol_arrayref($select, {Columns=>[scalar(@$sort)]}, map {lc($_)} (@usrv, at phonev, at identv, at namev, at addrv));
+          WHERE users.deleted = FALSE
+            $inactive
+            $opt_in_where
+          GROUP BY $group_list
+          ORDER BY $order_by
+          LIMIT $limit
+    SQL
+
+    return actor::user->db_Main->selectcol_arrayref($select, {Columns=>[scalar(@$sort)]}, map {lc($_)} (@usrv, at phonev, at identv, at namev, at addrv));
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.actor.user.crazy_search',
-	api_level	=> 1,
-	method		=> 'patron_search',
+    api_name    => 'open-ils.storage.actor.user.crazy_search',
+    api_level   => 1,
+    method      => 'patron_search',
 );
 
 sub org_unit_list {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	my $select =<<"	SQL";
-	SELECT	*
-	  FROM	actor.org_unit
-	  ORDER BY CASE WHEN parent_ou IS NULL THEN 0 ELSE 1 END, name;
-	SQL
+    my $select =<<"    SQL";
+    SELECT  *
+      FROM  actor.org_unit
+      ORDER BY CASE WHEN parent_ou IS NULL THEN 0 ELSE 1 END, name;
+    SQL
 
-	my $sth = actor::org_unit->db_Main->prepare_cached($select);
-	$sth->execute;
+    my $sth = actor::org_unit->db_Main->prepare_cached($select);
+    $sth->execute;
 
-	$client->respond( $_->to_fieldmapper ) for ( map { actor::org_unit->construct($_) } $sth->fetchall_hash );
+    $client->respond( $_->to_fieldmapper ) for ( map { actor::org_unit->construct($_) } $sth->fetchall_hash );
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.direct.actor.org_unit.retrieve.all',
-	api_level	=> 1,
-	stream		=> 1,
-	method		=> 'org_unit_list',
+    api_name    => 'open-ils.storage.direct.actor.org_unit.retrieve.all',
+    api_level   => 1,
+    stream      => 1,
+    method      => 'org_unit_list',
 );
 
 sub org_unit_type_list {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	my $select =<<"	SQL";
-	SELECT	*
-	  FROM	actor.org_unit_type
-	  ORDER BY depth, name;
-	SQL
+    my $select =<<"    SQL";
+    SELECT  *
+      FROM  actor.org_unit_type
+      ORDER BY depth, name;
+    SQL
 
-	my $sth = actor::org_unit_type->db_Main->prepare_cached($select);
-	$sth->execute;
+    my $sth = actor::org_unit_type->db_Main->prepare_cached($select);
+    $sth->execute;
 
-	$client->respond( $_->to_fieldmapper ) for ( map { actor::org_unit_type->construct($_) } $sth->fetchall_hash );
+    $client->respond( $_->to_fieldmapper ) for ( map { actor::org_unit_type->construct($_) } $sth->fetchall_hash );
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.direct.actor.org_unit_type.retrieve.all',
-	api_level	=> 1,
-	stream		=> 1,
-	method		=> 'org_unit_type_list',
+    api_name    => 'open-ils.storage.direct.actor.org_unit_type.retrieve.all',
+    api_level   => 1,
+    stream      => 1,
+    method      => 'org_unit_type_list',
 );
 
 sub org_unit_full_path {
-	my $self = shift;
-	my $client = shift;
-	my @binds = @_;
+    my $self = shift;
+    my $client = shift;
+    my @binds = @_;
 
-	return undef unless (@binds);
+    return undef unless (@binds);
 
-	my $func = 'actor.org_unit_full_path(?)';
-	$func = 'actor.org_unit_full_path(?,?)' if (@binds > 1);
+    my $func = 'actor.org_unit_full_path(?)';
+    $func = 'actor.org_unit_full_path(?,?)' if (@binds > 1);
 
-	my $sth = actor::org_unit->db_Main->prepare_cached("SELECT * FROM $func");
-	$sth->execute(@binds);
+    my $sth = actor::org_unit->db_Main->prepare_cached("SELECT * FROM $func");
+    $sth->execute(@binds);
 
-	$client->respond( $_->to_fieldmapper ) for ( map { actor::org_unit->construct($_) } $sth->fetchall_hash );
+    $client->respond( $_->to_fieldmapper ) for ( map { actor::org_unit->construct($_) } $sth->fetchall_hash );
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.actor.org_unit.full_path',
-	api_level	=> 1,
-	stream		=> 1,
-	method		=> 'org_unit_full_path',
+    api_name    => 'open-ils.storage.actor.org_unit.full_path',
+    api_level   => 1,
+    stream      => 1,
+    method      => 'org_unit_full_path',
 );
 
 sub org_unit_ancestors {
-	my $self = shift;
-	my $client = shift;
-	my $id = shift;
+    my $self = shift;
+    my $client = shift;
+    my $id = shift;
 
-	return undef unless ($id);
+    return undef unless ($id);
 
-	my $func = 'actor.org_unit_ancestors(?)';
+    my $func = 'actor.org_unit_ancestors(?)';
 
-	my $sth = actor::org_unit->db_Main->prepare_cached(<<"	SQL");
-		SELECT	f.*
-		  FROM	$func f
-			JOIN actor.org_unit_type t ON (f.ou_type = t.id)
-		  ORDER BY t.depth, f.name;
-	SQL
-	$sth->execute(''.$id);
+    my $sth = actor::org_unit->db_Main->prepare_cached(<<"    SQL");
+        SELECT  f.*
+          FROM  $func f
+            JOIN actor.org_unit_type t ON (f.ou_type = t.id)
+          ORDER BY t.depth, f.name;
+    SQL
+    $sth->execute(''.$id);
 
-	$client->respond( $_->to_fieldmapper ) for ( map { actor::org_unit->construct($_) } $sth->fetchall_hash );
+    $client->respond( $_->to_fieldmapper ) for ( map { actor::org_unit->construct($_) } $sth->fetchall_hash );
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.actor.org_unit.ancestors',
-	api_level	=> 1,
-	stream		=> 1,
-	method		=> 'org_unit_ancestors',
+    api_name    => 'open-ils.storage.actor.org_unit.ancestors',
+    api_level   => 1,
+    stream      => 1,
+    method      => 'org_unit_ancestors',
 );
 
 sub org_unit_descendants {
-	my $self = shift;
-	my $client = shift;
-	my $id = shift;
-	my $depth = shift;
+    my $self = shift;
+    my $client = shift;
+    my $id = shift;
+    my $depth = shift;
 
-	return undef unless ($id);
+    return undef unless ($id);
 
-	my $func = 'actor.org_unit_descendants(?)';
-	if (defined $depth) {
-		$func = 'actor.org_unit_descendants(?,?)';
-	}
+    my $func = 'actor.org_unit_descendants(?)';
+    if (defined $depth) {
+        $func = 'actor.org_unit_descendants(?,?)';
+    }
 
-	my $sth = actor::org_unit->db_Main->prepare_cached("SELECT * FROM $func");
-	$sth->execute(''.$id, ''.$depth) if (defined $depth);
-	$sth->execute(''.$id) unless (defined $depth);
+    my $sth = actor::org_unit->db_Main->prepare_cached("SELECT * FROM $func");
+    $sth->execute(''.$id, ''.$depth) if (defined $depth);
+    $sth->execute(''.$id) unless (defined $depth);
 
-	$client->respond( $_->to_fieldmapper ) for ( map { actor::org_unit->construct($_) } $sth->fetchall_hash );
+    $client->respond( $_->to_fieldmapper ) for ( map { actor::org_unit->construct($_) } $sth->fetchall_hash );
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.actor.org_unit.descendants',
-	api_level	=> 1,
-	stream		=> 1,
-	method		=> 'org_unit_descendants',
+    api_name    => 'open-ils.storage.actor.org_unit.descendants',
+    api_level   => 1,
+    stream      => 1,
+    method      => 'org_unit_descendants',
 );
 
 sub fleshed_actor_stat_cat {
@@ -939,33 +939,33 @@ sub fleshed_actor_stat_cat {
         my $client = shift;
         my @list = @_;
         
-	@list = ($list[0]) unless ($self->api_name =~ /batch/o);
+    @list = ($list[0]) unless ($self->api_name =~ /batch/o);
 
-	for my $sc (@list) {
-		my $cat = actor::stat_cat->retrieve($sc);
-		next unless ($cat);
+    for my $sc (@list) {
+        my $cat = actor::stat_cat->retrieve($sc);
+        next unless ($cat);
 
-		my $sc_fm = $cat->to_fieldmapper;
-		$sc_fm->entries( [ map { $_->to_fieldmapper } $cat->entries ] );
-		$sc_fm->default_entries( [ map { $_->to_fieldmapper } $cat->default_entries ] );
+        my $sc_fm = $cat->to_fieldmapper;
+        $sc_fm->entries( [ map { $_->to_fieldmapper } $cat->entries ] );
+        $sc_fm->default_entries( [ map { $_->to_fieldmapper } $cat->default_entries ] );
 
-		$client->respond( $sc_fm );
+        $client->respond( $sc_fm );
 
-	}
+    }
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
         api_name        => 'open-ils.storage.fleshed.actor.stat_cat.retrieve',
         api_level       => 1,
-	argc		=> 1,
+    argc        => 1,
         method          => 'fleshed_actor_stat_cat',
 );
 
 __PACKAGE__->register_method(
         api_name        => 'open-ils.storage.fleshed.actor.stat_cat.retrieve.batch',
         api_level       => 1,
-	argc		=> 1,
+    argc        => 1,
         stream          => 1,
         method          => 'fleshed_actor_stat_cat',
 );
@@ -983,32 +983,32 @@ sub ranged_actor_stat_cat_all {
                 SELECT  s.*
                   FROM  $s_table s
                         JOIN actor.org_unit_full_path(?) p ON (p.id = s.owner)
-		  ORDER BY name
+          ORDER BY name
         SQL
 
-	$fleshed = 0;
-	$fleshed = 1 if ($self->api_name =~ /fleshed/o);
+    $fleshed = 0;
+    $fleshed = 1 if ($self->api_name =~ /fleshed/o);
 
         my $sth = actor::stat_cat->db_Main->prepare_cached($select);
         $sth->execute($ou);
 
         for my $sc ( map { actor::stat_cat->construct($_) } $sth->fetchall_hash ) {
-		my $sc_fm = $sc->to_fieldmapper;
-		$sc_fm->entries(
-			[ $self->method_lookup( 'open-ils.storage.ranged.actor.stat_cat_entry.search.stat_cat' )->run($ou,$sc->id) ]
-		) if ($fleshed);
-		$sc_fm->default_entries(
-			[ $self->method_lookup( 'open-ils.storage.actor.stat_cat_entry_default.ancestor.retrieve' )->run($ou,$sc->id) ]
-		) if ($fleshed);
-		$client->respond( $sc_fm );
-	}
+        my $sc_fm = $sc->to_fieldmapper;
+        $sc_fm->entries(
+            [ $self->method_lookup( 'open-ils.storage.ranged.actor.stat_cat_entry.search.stat_cat' )->run($ou,$sc->id) ]
+        ) if ($fleshed);
+        $sc_fm->default_entries(
+            [ $self->method_lookup( 'open-ils.storage.actor.stat_cat_entry_default.ancestor.retrieve' )->run($ou,$sc->id) ]
+        ) if ($fleshed);
+        $client->respond( $sc_fm );
+    }
 
         return undef;
 }
 __PACKAGE__->register_method(
         api_name        => 'open-ils.storage.ranged.fleshed.actor.stat_cat.all',
         api_level       => 1,
-	argc		=> 1,
+    argc        => 1,
         stream          => 1,
         method          => 'ranged_actor_stat_cat_all',
 );
@@ -1016,7 +1016,7 @@ __PACKAGE__->register_method(
 __PACKAGE__->register_method(
         api_name        => 'open-ils.storage.ranged.actor.stat_cat.all',
         api_level       => 1,
-	argc		=> 1,
+    argc        => 1,
         stream          => 1,
         method          => 'ranged_actor_stat_cat_all',
 );
@@ -1035,17 +1035,17 @@ sub ranged_actor_stat_cat_entry {
                 SELECT  s.*
                   FROM  $s_table s
                         JOIN actor.org_unit_full_path(?) p ON (p.id = s.owner)
-		  WHERE	stat_cat = ?
-		  ORDER BY name
+          WHERE stat_cat = ?
+          ORDER BY name
         SQL
 
         my $sth = actor::stat_cat->db_Main->prepare_cached($select);
         $sth->execute($ou,$sc);
 
         for my $sce ( map { actor::stat_cat_entry->construct($_) } $sth->fetchall_hash ) {
-		my $sce_fm = $sce->to_fieldmapper;
-		$client->respond( $sce_fm );
-	}
+        my $sce_fm = $sce->to_fieldmapper;
+        $client->respond( $sce_fm );
+    }
 
         return undef;
 }
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/asset.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/asset.pm
index 90ca204..4dc3e47 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/asset.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/asset.pm
@@ -14,42 +14,42 @@ use MARC::Record;
 use MARC::File::XML ( BinaryEncoding => 'UTF-8' );
 
 sub circ_count {
-	my $self = shift;
-	my $client = shift;
-	my $copy = shift;
-	my $granularity = shift;
-
-	my $c_table = action::circulation->table;
-
-	if (lc($granularity) eq 'year') {
-		$granularity = ", to_char(xact_start, 'YYYY') as when";
-	} elsif (lc($granularity) eq 'month') {
-		$granularity = ", to_char(xact_start, 'YYYY-MM') as when";
-	} elsif (lc($granularity) eq 'day') {
-		$granularity = ", to_char(xact_start, 'YYYY-MM-DD') as when";
-	} else {
-		$granularity = ", 'total' as when";
-	}
+    my $self = shift;
+    my $client = shift;
+    my $copy = shift;
+    my $granularity = shift;
+
+    my $c_table = action::circulation->table;
+
+    if (lc($granularity) eq 'year') {
+        $granularity = ", to_char(xact_start, 'YYYY') as when";
+    } elsif (lc($granularity) eq 'month') {
+        $granularity = ", to_char(xact_start, 'YYYY-MM') as when";
+    } elsif (lc($granularity) eq 'day') {
+        $granularity = ", to_char(xact_start, 'YYYY-MM-DD') as when";
+    } else {
+        $granularity = ", 'total' as when";
+    }
 
-	my $SQL = <<"	SQL";
-		SELECT	COUNT(*) as count $granularity
-		  FROM	$c_table
-		  WHERE	target_copy = ?
-	SQL
+    my $SQL = <<"    SQL";
+        SELECT  COUNT(*) as count $granularity
+          FROM  $c_table
+          WHERE target_copy = ?
+    SQL
 
 
-	if ($granularity !~ /total/o) {
-		$SQL .= ' GROUP BY 2 ORDER BY 2';
-	}
+    if ($granularity !~ /total/o) {
+        $SQL .= ' GROUP BY 2 ORDER BY 2';
+    }
 
-	$log->debug("Circ count SQL [$SQL]", DEBUG);
+    $log->debug("Circ count SQL [$SQL]", DEBUG);
 
-	return action::circulation->db_Main->selectall_hashref($SQL, 'when', {}, $copy);
+    return action::circulation->db_Main->selectall_hashref($SQL, 'when', {}, $copy);
 }
 __PACKAGE__->register_method(
-	method		=> 'circ_count',
-	api_name	=> 'open-ils.storage.asset.copy.circ_count',
-	argc		=> 1,
+    method      => 'circ_count',
+    api_name    => 'open-ils.storage.asset.copy.circ_count',
+    argc        => 1,
 );
 
 
@@ -72,126 +72,126 @@ __PACKAGE__->register_method(
 my %org_cache;
 
 sub import_xml_holdings {
-	my $self = shift;
-	my $client = shift;
-	my $editor = shift;
-	my $record = shift;
-	my $xml = shift;
-	my $tag = shift;
-	my $map = shift;
-	my $date_format = shift || 'mm/dd/yyyy';
-
-	($record) = biblio::record_entry->search_where($record);
-
-	return 0 unless ($record);
-
-	my $r = MARC::Record->new_from_xml($xml);
-
-	my $count = 0;
-	for my $f ( $r->fields( $tag ) ) {
-		next unless ($f->subfield( $map->{owning_lib} ));
-
-		my ($ol,$cl);
-
-		try {
-			$ol = 
-				$org_cache{ $f->subfield( $map->{owning_lib} ) }
-				|| actor::org_unit->search( shortname => $f->subfield( $map->{owning_lib} ) )->next->id;
-
-			$org_cache{ $f->subfield( $map->{owning_lib} ) } = $ol;
-		} otherwise {
-			$log->debug('Could not find library with shortname ['.$f->subfield( $map->{owning_lib} ).'] : '. shift(), ERROR);
-			$log->info('Failed holdings tag: ['.OpenSRF::Utils::JSON->perl2JSON( $f ).']');
-		};
-		
-		try {
-			$cl =
-				$org_cache{ $f->subfield( $map->{circulating_lib} ) }
-				|| actor::org_unit->search( shortname => $f->subfield( $map->{circulating_lib} ) )->next->id;
-
-			$org_cache{ $f->subfield( $map->{circulating_lib} ) } = $cl;
-		} otherwise {
-			$log->debug('Could not find library with shortname ['.$f->subfield( $map->{circulating_lib} ).'] : '. shift(), ERROR);
-			$log->info('Failed holdings tag: ['.OpenSRF::Utils::JSON->perl2JSON( $f ).']');
-		};
-
-		next unless ($ol && $cl);
-
-		my $cn;
-		try {
-			$cn = asset::call_number->find_or_create(
-				{ label		=> $f->subfield( $map->{call_number} ),
-				  owning_lib	=> $ol,
-				  record	=> $record->id,
-				  creator	=> $editor,
-				  editor	=> $editor,
-				}
-			);
-		} otherwise {
-			$log->debug('Could not find or create callnumber ['.$f->subfield( $map->{call_number} )."] on record $record : ". shift(), ERROR);
-			$log->info('Failed holdings tag: ['.OpenSRF::Utils::JSON->perl2JSON( $f ).']');
-		};
-
-		next unless ($cn);
-
-		my $create_date =  $f->subfield( $map->{create_date} );
-
-		my ($m,$d,$y);
-		if ($date_format eq 'mm/dd/yyyy') {
-			($m,$d,$y) = split '/', $create_date;
-
-		} elsif ($date_format eq 'dd/mm/yyyy') {
-			($d,$m,$y) = split '/', $create_date;
-
-		} elsif ($date_format eq 'mm-dd-yyyy') {
-			($m,$d,$y) = split '-', $create_date;
-
-		} elsif ($date_format eq 'dd-mm-yyyy') {
-			($d,$m,$y) = split '-', $create_date;
-
-		} elsif ($date_format eq 'yyyy-mm-dd') {
-			($y,$m,$d) = split '-', $create_date;
-
-		} elsif ($date_format eq 'yyyy/mm/dd') {
-			($y,$m,$d) = split '/', $create_date;
-		}
-
-		if ($y == 0) {
-			(undef,undef,undef,$d,$m,$y) = localtime;
-			$m++;
-			$y+=1900;
-		}
-
-		my $price = $f->subfield( $map->{price} );
-		$price =~ s/[^0-9\.]+//gso;
-		$price ||= '0.00';
-
-		try {
-			$cn->add_to_copies(
-				{ circ_lib	=> $cl,
-				  copy_number	=> $f->subfield( $map->{copy_number} ),
-				  price		=> $price,
-				  barcode	=> $f->subfield( $map->{barcode} ),
-				  loan_duration	=> 2,
-				  fine_level	=> 2,
-				  creator	=> $editor,
-				  editor	=> $editor,
-				  create_date	=> sprintf('%04d-%02d-%02d',$y,$m,$d),
-				}
-			);
-			$count++;
-		} otherwise {
-			$log->debug('Could not create copy ['.$f->subfield( $map->{barcode} ).'] : '. shift(), ERROR);
-		};
-	}
-
-	return $count;
+    my $self = shift;
+    my $client = shift;
+    my $editor = shift;
+    my $record = shift;
+    my $xml = shift;
+    my $tag = shift;
+    my $map = shift;
+    my $date_format = shift || 'mm/dd/yyyy';
+
+    ($record) = biblio::record_entry->search_where($record);
+
+    return 0 unless ($record);
+
+    my $r = MARC::Record->new_from_xml($xml);
+
+    my $count = 0;
+    for my $f ( $r->fields( $tag ) ) {
+        next unless ($f->subfield( $map->{owning_lib} ));
+
+        my ($ol,$cl);
+
+        try {
+            $ol = 
+                $org_cache{ $f->subfield( $map->{owning_lib} ) }
+                || actor::org_unit->search( shortname => $f->subfield( $map->{owning_lib} ) )->next->id;
+
+            $org_cache{ $f->subfield( $map->{owning_lib} ) } = $ol;
+        } otherwise {
+            $log->debug('Could not find library with shortname ['.$f->subfield( $map->{owning_lib} ).'] : '. shift(), ERROR);
+            $log->info('Failed holdings tag: ['.OpenSRF::Utils::JSON->perl2JSON( $f ).']');
+        };
+        
+        try {
+            $cl =
+                $org_cache{ $f->subfield( $map->{circulating_lib} ) }
+                || actor::org_unit->search( shortname => $f->subfield( $map->{circulating_lib} ) )->next->id;
+
+            $org_cache{ $f->subfield( $map->{circulating_lib} ) } = $cl;
+        } otherwise {
+            $log->debug('Could not find library with shortname ['.$f->subfield( $map->{circulating_lib} ).'] : '. shift(), ERROR);
+            $log->info('Failed holdings tag: ['.OpenSRF::Utils::JSON->perl2JSON( $f ).']');
+        };
+
+        next unless ($ol && $cl);
+
+        my $cn;
+        try {
+            $cn = asset::call_number->find_or_create(
+                { label     => $f->subfield( $map->{call_number} ),
+                  owning_lib    => $ol,
+                  record    => $record->id,
+                  creator   => $editor,
+                  editor    => $editor,
+                }
+            );
+        } otherwise {
+            $log->debug('Could not find or create callnumber ['.$f->subfield( $map->{call_number} )."] on record $record : ". shift(), ERROR);
+            $log->info('Failed holdings tag: ['.OpenSRF::Utils::JSON->perl2JSON( $f ).']');
+        };
+
+        next unless ($cn);
+
+        my $create_date =  $f->subfield( $map->{create_date} );
+
+        my ($m,$d,$y);
+        if ($date_format eq 'mm/dd/yyyy') {
+            ($m,$d,$y) = split '/', $create_date;
+
+        } elsif ($date_format eq 'dd/mm/yyyy') {
+            ($d,$m,$y) = split '/', $create_date;
+
+        } elsif ($date_format eq 'mm-dd-yyyy') {
+            ($m,$d,$y) = split '-', $create_date;
+
+        } elsif ($date_format eq 'dd-mm-yyyy') {
+            ($d,$m,$y) = split '-', $create_date;
+
+        } elsif ($date_format eq 'yyyy-mm-dd') {
+            ($y,$m,$d) = split '-', $create_date;
+
+        } elsif ($date_format eq 'yyyy/mm/dd') {
+            ($y,$m,$d) = split '/', $create_date;
+        }
+
+        if ($y == 0) {
+            (undef,undef,undef,$d,$m,$y) = localtime;
+            $m++;
+            $y+=1900;
+        }
+
+        my $price = $f->subfield( $map->{price} );
+        $price =~ s/[^0-9\.]+//gso;
+        $price ||= '0.00';
+
+        try {
+            $cn->add_to_copies(
+                { circ_lib  => $cl,
+                  copy_number   => $f->subfield( $map->{copy_number} ),
+                  price     => $price,
+                  barcode   => $f->subfield( $map->{barcode} ),
+                  loan_duration => 2,
+                  fine_level    => 2,
+                  creator   => $editor,
+                  editor    => $editor,
+                  create_date   => sprintf('%04d-%02d-%02d',$y,$m,$d),
+                }
+            );
+            $count++;
+        } otherwise {
+            $log->debug('Could not create copy ['.$f->subfield( $map->{barcode} ).'] : '. shift(), ERROR);
+        };
+    }
+
+    return $count;
 }
 __PACKAGE__->register_method(
-	method		=> 'import_xml_holdings',
-	api_name	=> 'open-ils.storage.asset.holdings.import.xml',
-	argc		=> 5,
-	stream		=> 0,
+    method      => 'import_xml_holdings',
+    api_name    => 'open-ils.storage.asset.holdings.import.xml',
+    argc        => 5,
+    stream      => 0,
 );
 
 # XXX
@@ -199,266 +199,266 @@ __PACKAGE__->register_method(
 # XXX
 
 sub cn_browse_pagedown {
-	my $self = shift;
-	my $client = shift;
-
-	my %args = @_;
-
-	my $cn = uc($args{label});
-	my $org = $args{org_unit};
-	my $depth = $args{depth};
-	my $boundry_id = $args{boundry_id};
-	my $size = $args{page_size} || 20;
-	$size = int($size);
-
-	my $table = asset::call_number->table;
-
-	my $descendants = "actor.org_unit_descendants($org)";
-	if (defined $depth) {
-		$descendants = "actor.org_unit_descendants($org,$depth)";
-	}
-
-	my $orgs = join(',', @{ asset::call_number->db_Main->selectcol_arrayref("SELECT DISTINCT id FROM $descendants;") });
-	
-	my $sql = <<"	SQL";
-		select
-		        cn.label,
-		        cn.owning_lib,
-	        	cn.record,
-		        cn.id
-		from
-		        $table cn
-		where
-			not deleted
-		        and (oils_text_as_bytea(label) > ? or ( cn.id > ? and oils_text_as_bytea(label) = ? ))
-			and owning_lib in ($orgs)
-		order by oils_text_as_bytea(label), 4, 2
-		limit $size;
-	SQL
-
-	my $sth = asset::call_number->db_Main->prepare($sql);
-	$sth->execute($cn, $boundry_id, $cn);
-	while ( my @row = $sth->fetchrow_array ) {
-		$client->respond([@row]);
-	}
-	$sth->finish;
-
-	return undef;
+    my $self = shift;
+    my $client = shift;
+
+    my %args = @_;
+
+    my $cn = uc($args{label});
+    my $org = $args{org_unit};
+    my $depth = $args{depth};
+    my $boundry_id = $args{boundry_id};
+    my $size = $args{page_size} || 20;
+    $size = int($size);
+
+    my $table = asset::call_number->table;
+
+    my $descendants = "actor.org_unit_descendants($org)";
+    if (defined $depth) {
+        $descendants = "actor.org_unit_descendants($org,$depth)";
+    }
+
+    my $orgs = join(',', @{ asset::call_number->db_Main->selectcol_arrayref("SELECT DISTINCT id FROM $descendants;") });
+    
+    my $sql = <<"    SQL";
+        select
+                cn.label,
+                cn.owning_lib,
+                cn.record,
+                cn.id
+        from
+                $table cn
+        where
+            not deleted
+                and (oils_text_as_bytea(label) > ? or ( cn.id > ? and oils_text_as_bytea(label) = ? ))
+            and owning_lib in ($orgs)
+        order by oils_text_as_bytea(label), 4, 2
+        limit $size;
+    SQL
+
+    my $sth = asset::call_number->db_Main->prepare($sql);
+    $sth->execute($cn, $boundry_id, $cn);
+    while ( my @row = $sth->fetchrow_array ) {
+        $client->respond([@row]);
+    }
+    $sth->finish;
+
+    return undef;
 }
 __PACKAGE__->register_method(
-	method		=> 'cn_browse_pagedown',
-	api_name	=> 'open-ils.storage.asset.call_number.browse.page_down',
-	argc		=> 4,
-	stream		=> 1,
+    method      => 'cn_browse_pagedown',
+    api_name    => 'open-ils.storage.asset.call_number.browse.page_down',
+    argc        => 4,
+    stream      => 1,
 );
 
 sub cn_browse_pageup {
-	my $self = shift;
-	my $client = shift;
-
-	my %args = @_;
-
-	my $cn = uc($args{label});
-	my $org = $args{org_unit};
-	my $depth = $args{depth};
-	my $boundry_id = $args{boundry_id};
-	my $size = $args{page_size} || 20;
-	$size = int($size);
-
-	my $table = asset::call_number->table;
-
-	my $descendants = "actor.org_unit_descendants($org)";
-	if (defined $depth) {
-		$descendants = "actor.org_unit_descendants($org,$depth)";
-	}
-
-	my $orgs = join(',', @{ asset::call_number->db_Main->selectcol_arrayref("SELECT DISTINCT id FROM $descendants;") });
-
-	my $sql = <<"	SQL";
-		select * from (
-			select
-			        cn.label,
-			        cn.owning_lib,
-		        	cn.record,
-			        cn.id
-			from
-			        $table cn
-			where
-				not deleted
-			        and (oils_text_as_bytea(label) < ? or ( cn.id < ? and oils_text_as_bytea(label) = ? ))
-				and owning_lib in ($orgs)
-			order by oils_text_as_bytea(label) desc, 4 desc, 2 desc
-			limit $size
-		) as bar
-		order by 1,4,2;
-	SQL
-
-	my $sth = asset::call_number->db_Main->prepare($sql);
-	$sth->execute($cn, $boundry_id, $cn);
-	while ( my @row = $sth->fetchrow_array ) {
-		$client->respond([@row]);
-	}
-	$sth->finish;
-
-	return undef;
+    my $self = shift;
+    my $client = shift;
+
+    my %args = @_;
+
+    my $cn = uc($args{label});
+    my $org = $args{org_unit};
+    my $depth = $args{depth};
+    my $boundry_id = $args{boundry_id};
+    my $size = $args{page_size} || 20;
+    $size = int($size);
+
+    my $table = asset::call_number->table;
+
+    my $descendants = "actor.org_unit_descendants($org)";
+    if (defined $depth) {
+        $descendants = "actor.org_unit_descendants($org,$depth)";
+    }
+
+    my $orgs = join(',', @{ asset::call_number->db_Main->selectcol_arrayref("SELECT DISTINCT id FROM $descendants;") });
+
+    my $sql = <<"    SQL";
+        select * from (
+            select
+                    cn.label,
+                    cn.owning_lib,
+                    cn.record,
+                    cn.id
+            from
+                    $table cn
+            where
+                not deleted
+                    and (oils_text_as_bytea(label) < ? or ( cn.id < ? and oils_text_as_bytea(label) = ? ))
+                and owning_lib in ($orgs)
+            order by oils_text_as_bytea(label) desc, 4 desc, 2 desc
+            limit $size
+        ) as bar
+        order by 1,4,2;
+    SQL
+
+    my $sth = asset::call_number->db_Main->prepare($sql);
+    $sth->execute($cn, $boundry_id, $cn);
+    while ( my @row = $sth->fetchrow_array ) {
+        $client->respond([@row]);
+    }
+    $sth->finish;
+
+    return undef;
 }
 __PACKAGE__->register_method(
-	method		=> 'cn_browse_pageup',
-	api_name	=> 'open-ils.storage.asset.call_number.browse.page_up',
-	argc		=> 4,
-	stream		=> 1,
+    method      => 'cn_browse_pageup',
+    api_name    => 'open-ils.storage.asset.call_number.browse.page_up',
+    argc        => 4,
+    stream      => 1,
 );
 
 sub cn_browse_target {
-	my $self = shift;
-	my $client = shift;
-
-	my %args = @_;
-
-	my $cn = uc($args{label});
-	my $org = $args{org_unit};
-	my $depth = $args{depth};
-	my $size = $args{page_size} || 20;
-	my $topsize = $size / 2;
-	$topsize = int($topsize);
-	$bottomsize = $size - $topsize;
-
-	my $table = asset::call_number->table;
-
-	my $descendants = "actor.org_unit_descendants($org)";
-	if (defined $depth) {
-		$descendants = "actor.org_unit_descendants($org,$depth)";
-	}
-
-	my $orgs = join(',', @{ asset::call_number->db_Main->selectcol_arrayref("SELECT DISTINCT id FROM $descendants;") });
-
-	my $top_sql = <<"	SQL";
-		select * from (
-			select
-			        cn.label,
-			        cn.owning_lib,
-			       	cn.record,
-			        cn.id
-			from
-			        $table cn
-			where
-				not deleted
-			        and oils_text_as_bytea(label) < ?
-				and owning_lib in ($orgs)
-			order by oils_text_as_bytea(label) desc, 4 desc, 2 desc
-			limit $topsize
-		) as bar
-		order by 1,4,2;
-	SQL
-
-	my $bottom_sql = <<"	SQL";
-		select
-        		cn.label,
-		        cn.owning_lib,
-		        cn.record,
-	        	cn.id
-		from
-		        $table cn
-		where
-			not deleted
-		        and oils_text_as_bytea(label) >= ?
-			and owning_lib in ($orgs)
-		order by oils_text_as_bytea(label),4,2
-		limit $bottomsize;
-	SQL
-
-	my $sth = asset::call_number->db_Main->prepare($top_sql);
-	$sth->execute($cn);
-	while ( my @row = $sth->fetchrow_array ) {
-		$client->respond([@row]);
-	}
-	$sth->finish;
-
-	$sth = asset::call_number->db_Main->prepare($bottom_sql);
-	$sth->execute($cn);
-	while ( my @row = $sth->fetchrow_array ) {
-		$client->respond([@row]);
-	}
-	$sth->finish;
-
-	return undef;
+    my $self = shift;
+    my $client = shift;
+
+    my %args = @_;
+
+    my $cn = uc($args{label});
+    my $org = $args{org_unit};
+    my $depth = $args{depth};
+    my $size = $args{page_size} || 20;
+    my $topsize = $size / 2;
+    $topsize = int($topsize);
+    $bottomsize = $size - $topsize;
+
+    my $table = asset::call_number->table;
+
+    my $descendants = "actor.org_unit_descendants($org)";
+    if (defined $depth) {
+        $descendants = "actor.org_unit_descendants($org,$depth)";
+    }
+
+    my $orgs = join(',', @{ asset::call_number->db_Main->selectcol_arrayref("SELECT DISTINCT id FROM $descendants;") });
+
+    my $top_sql = <<"    SQL";
+        select * from (
+            select
+                    cn.label,
+                    cn.owning_lib,
+                    cn.record,
+                    cn.id
+            from
+                    $table cn
+            where
+                not deleted
+                    and oils_text_as_bytea(label) < ?
+                and owning_lib in ($orgs)
+            order by oils_text_as_bytea(label) desc, 4 desc, 2 desc
+            limit $topsize
+        ) as bar
+        order by 1,4,2;
+    SQL
+
+    my $bottom_sql = <<"    SQL";
+        select
+                cn.label,
+                cn.owning_lib,
+                cn.record,
+                cn.id
+        from
+                $table cn
+        where
+            not deleted
+                and oils_text_as_bytea(label) >= ?
+            and owning_lib in ($orgs)
+        order by oils_text_as_bytea(label),4,2
+        limit $bottomsize;
+    SQL
+
+    my $sth = asset::call_number->db_Main->prepare($top_sql);
+    $sth->execute($cn);
+    while ( my @row = $sth->fetchrow_array ) {
+        $client->respond([@row]);
+    }
+    $sth->finish;
+
+    $sth = asset::call_number->db_Main->prepare($bottom_sql);
+    $sth->execute($cn);
+    while ( my @row = $sth->fetchrow_array ) {
+        $client->respond([@row]);
+    }
+    $sth->finish;
+
+    return undef;
 }
 __PACKAGE__->register_method(
-	method		=> 'cn_browse_target',
-	api_name	=> 'open-ils.storage.asset.call_number.browse.target',
-	argc		=> 4,
-	stream		=> 1,
+    method      => 'cn_browse_target',
+    api_name    => 'open-ils.storage.asset.call_number.browse.target',
+    argc        => 4,
+    stream      => 1,
 );
 
 
 sub copy_proximity {
-	my $self = shift;
-	my $client = shift;
-
-	my $cp = shift;
-	my $org = shift;	# hold pickup lib
-	my $hold = shift;
-
-	return unless ($cp && $org);
-
-	if ($hold) {
-		my $row = action::hold_request->db_Main->selectrow_hashref(
-			'SELECT proximity AS prox FROM action.hold_copy_map WHERE hold = ? and target_copy = ?',
-			{},
-			"$hold",
-			"$cp"
-		);
-		return $row->{prox} if $row;
-
-		# There was a bug here before.
-		# action.hold_copy_calculated_proximity()  was called with a
-		# third argument, $org.  Wrong.  a.hccp() interprets its third
-		# argument as an optional override of copy circ lib.  $org
-		# here is hold pickup lib.  This had the effect of basically
-		# measuring the distance between a hold's pickup lib and
-		# itself, which is always zero, so all proximities landing in
-		# the hold copy map were zero.
-
-		$log->debug("Calculating copy proximity with: action.hold_copy_calculated_proximity($hold,$cp)", DEBUG);
-		$row = action::hold_request->db_Main->selectrow_hashref(
-			'SELECT action.hold_copy_calculated_proximity(?,?) AS prox',
-			{},
-			"$hold",
-			"$cp"
-		);
-
-		return $row->{prox} if $row;
-	}
-
-	$cp = asset::copy->retrieve($cp) unless (ref($cp));
-
-	return unless $cp;
-	my $ol = $cp->circ_lib;
-
-	return (actor::org_unit_proximity->search( from_org => "$ol", to_org => "$org"))[0]->prox;
+    my $self = shift;
+    my $client = shift;
+
+    my $cp = shift;
+    my $org = shift;    # hold pickup lib
+    my $hold = shift;
+
+    return unless ($cp && $org);
+
+    if ($hold) {
+        my $row = action::hold_request->db_Main->selectrow_hashref(
+            'SELECT proximity AS prox FROM action.hold_copy_map WHERE hold = ? and target_copy = ?',
+            {},
+            "$hold",
+            "$cp"
+        );
+        return $row->{prox} if $row;
+
+        # There was a bug here before.
+        # action.hold_copy_calculated_proximity()  was called with a
+        # third argument, $org.  Wrong.  a.hccp() interprets its third
+        # argument as an optional override of copy circ lib.  $org
+        # here is hold pickup lib.  This had the effect of basically
+        # measuring the distance between a hold's pickup lib and
+        # itself, which is always zero, so all proximities landing in
+        # the hold copy map were zero.
+
+        $log->debug("Calculating copy proximity with: action.hold_copy_calculated_proximity($hold,$cp)", DEBUG);
+        $row = action::hold_request->db_Main->selectrow_hashref(
+            'SELECT action.hold_copy_calculated_proximity(?,?) AS prox',
+            {},
+            "$hold",
+            "$cp"
+        );
+
+        return $row->{prox} if $row;
+    }
+
+    $cp = asset::copy->retrieve($cp) unless (ref($cp));
+
+    return unless $cp;
+    my $ol = $cp->circ_lib;
+
+    return (actor::org_unit_proximity->search( from_org => "$ol", to_org => "$org"))[0]->prox;
 }
 __PACKAGE__->register_method(
-	method		=> 'copy_proximity',
-	api_name	=> 'open-ils.storage.asset.copy.proximity',
-	argc		=> 2,
-	stream		=> 1,
+    method      => 'copy_proximity',
+    api_name    => 'open-ils.storage.asset.copy.proximity',
+    argc        => 2,
+    stream      => 1,
 );
 
 sub asset_copy_location_all {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	for my $rec ( asset::copy_location->retrieve_all ) {
-		$client->respond( $rec->to_fieldmapper );
-	}
+    for my $rec ( asset::copy_location->retrieve_all ) {
+        $client->respond( $rec->to_fieldmapper );
+    }
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
-	method		=> 'asset_copy_location_all',
-	api_name	=> 'open-ils.storage.direct.asset.copy_location.retrieve.all',
-	argc		=> 0,
-	stream		=> 1,
+    method      => 'asset_copy_location_all',
+    api_name    => 'open-ils.storage.direct.asset.copy_location.retrieve.all',
+    argc        => 0,
+    stream      => 1,
 );
 
 # XXX arg, with the descendancy SPs...
@@ -474,13 +474,13 @@ sub ranged_asset_copy_location {
                 "actor.org_unit_full_path(?)" ;
 
         
-        my $sql = <<"	SQL";
+        my $sql = <<"    SQL";
                 SELECT  DISTINCT c.*
                   FROM  $ctable c
                         JOIN $descendants d
                                 ON (d.id = c.owning_lib)
                  ORDER BY name
-	SQL
+    SQL
         
         my $sth = asset::copy_location->db_Main->prepare($sql);
         $sth->execute(@binds);
@@ -488,7 +488,7 @@ sub ranged_asset_copy_location {
         while ( my $rec = $sth->fetchrow_hashref ) {
         
                 my $cnct = new Fieldmapper::asset::copy_location;
-		map {$cnct->$_($$rec{$_})} keys %$rec;
+        map {$cnct->$_($$rec{$_})} keys %$rec;
                 $client->respond( $cnct );
         }
 
@@ -503,63 +503,63 @@ __PACKAGE__->register_method(
 
 
 sub fleshed_copy {
-	my $self = shift;
-	my $client = shift;
-	my @ids = @_;
+    my $self = shift;
+    my $client = shift;
+    my @ids = @_;
 
-	return undef unless (@ids);
+    return undef unless (@ids);
 
-	@ids = ($ids[0]) unless ($self->api_name =~ /batch/o);
+    @ids = ($ids[0]) unless ($self->api_name =~ /batch/o);
 
-	for my $id ( @ids ) {
-		next unless $id;
-		my $cp = asset::copy->retrieve($id);
-		next unless $cp;
+    for my $id ( @ids ) {
+        next unless $id;
+        my $cp = asset::copy->retrieve($id);
+        next unless $cp;
 
-		my $cp_fm = $cp->to_fieldmapper;
-		$cp_fm->circ_lib( $cp->circ_lib->to_fieldmapper );
-		$cp_fm->location( $cp->location->to_fieldmapper );
-		$cp_fm->status( $cp->status->to_fieldmapper );
-		$cp_fm->stat_cat_entries( [ map { $_->to_fieldmapper } $cp->stat_cat_entries ] );
+        my $cp_fm = $cp->to_fieldmapper;
+        $cp_fm->circ_lib( $cp->circ_lib->to_fieldmapper );
+        $cp_fm->location( $cp->location->to_fieldmapper );
+        $cp_fm->status( $cp->status->to_fieldmapper );
+        $cp_fm->stat_cat_entries( [ map { $_->to_fieldmapper } $cp->stat_cat_entries ] );
 
-		$client->respond( $cp_fm );
-	}
+        $client->respond( $cp_fm );
+    }
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.fleshed.asset.copy.batch.retrieve',
-	method		=> 'fleshed_copy',
-	argc		=> 1,
-	stream		=> 1,
+    api_name    => 'open-ils.storage.fleshed.asset.copy.batch.retrieve',
+    method      => 'fleshed_copy',
+    argc        => 1,
+    stream      => 1,
 );
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.fleshed.asset.copy.retrieve',
-	method		=> 'fleshed_copy',
-	argc		=> 1,
+    api_name    => 'open-ils.storage.fleshed.asset.copy.retrieve',
+    method      => 'fleshed_copy',
+    argc        => 1,
 );
 
 sub fleshed_copy_by_barcode {
-	my $self = shift;
-	my $client = shift;
-	my $bc = ''.shift;
+    my $self = shift;
+    my $client = shift;
+    my $bc = ''.shift;
 
-	my ($cp) = asset::copy->search( { barcode => $bc } );
+    my ($cp) = asset::copy->search( { barcode => $bc } );
 
-	return undef unless ($cp);
+    return undef unless ($cp);
 
-	my $cp_fm = $cp->to_fieldmapper;
-	$cp_fm->circ_lib( $cp->circ_lib->to_fieldmapper );
-	$cp_fm->location( $cp->location->to_fieldmapper );
-	$cp_fm->status( $cp->status->to_fieldmapper );
+    my $cp_fm = $cp->to_fieldmapper;
+    $cp_fm->circ_lib( $cp->circ_lib->to_fieldmapper );
+    $cp_fm->location( $cp->location->to_fieldmapper );
+    $cp_fm->status( $cp->status->to_fieldmapper );
 
-	return $cp_fm;
-}	
+    return $cp_fm;
+}   
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.fleshed.asset.copy.search.barcode',
-	method		=> 'fleshed_copy_by_barcode',
-	argc		=> 1,
-	stream		=> 1,
+    api_name    => 'open-ils.storage.fleshed.asset.copy.search.barcode',
+    method      => 'fleshed_copy_by_barcode',
+    argc        => 1,
+    stream      => 1,
 );
 
 
@@ -569,11 +569,11 @@ sub fleshed_asset_stat_cat {
         my $client = shift;
         my @list = @_;
 
-	@list = ($list[0]) unless ($self->api_name =~ /batch/o);
-	for my $sc (@list) {
-        	my $cat = asset::stat_cat->retrieve($sc);
-		
-		next unless ($cat);
+    @list = ($list[0]) unless ($self->api_name =~ /batch/o);
+    for my $sc (@list) {
+            my $cat = asset::stat_cat->retrieve($sc);
+        
+        next unless ($cat);
 
                 my $sc_fm = $cat->to_fieldmapper;
                 $sc_fm->entries( [ map { $_->to_fieldmapper } $cat->entries ] );
@@ -655,20 +655,20 @@ sub multiranged_asset_stat_cat {
         my $select = <<"        SQL";
                 SELECT  s.*
                   FROM  $s_table s
-		  WHERE s.owner IN ( XXX )
+          WHERE s.owner IN ( XXX )
                   ORDER BY name
         SQL
 
-	my $collector = ' INTERSECT ';
-	my $entry_method = 'open-ils.storage.multiranged.intersect.asset.stat_cat_entry.search.stat_cat';
-	if ($self->api_name =~ /union/o) {
-		$collector = ' UNION ';
-		$entry_method = 'open-ils.storage.multiranged.union.asset.stat_cat_entry.search.stat_cat';
-	}
+    my $collector = ' INTERSECT ';
+    my $entry_method = 'open-ils.storage.multiranged.intersect.asset.stat_cat_entry.search.stat_cat';
+    if ($self->api_name =~ /union/o) {
+        $collector = ' UNION ';
+        $entry_method = 'open-ils.storage.multiranged.union.asset.stat_cat_entry.search.stat_cat';
+    }
 
-	my $binds = join($collector, map { 'SELECT id FROM actor.org_unit_full_path(?)' } grep {defined} @$ous);
-	$select =~ s/XXX/$binds/so;
-	
+    my $binds = join($collector, map { 'SELECT id FROM actor.org_unit_full_path(?)' } grep {defined} @$ous);
+    $select =~ s/XXX/$binds/so;
+    
         $fleshed = 0;
         $fleshed = 1 if ($self->api_name =~ /fleshed/o);
 
@@ -742,19 +742,19 @@ sub multiranged_asset_stat_cat_entry {
         return undef unless (defined($ous) and @$ous);
         my $s_table = asset::stat_cat_entry->table;
 
-	my $collector = ' INTERSECT ';
-	$collector = ' UNION ' if ($self->api_name =~ /union/o);
+    my $collector = ' INTERSECT ';
+    $collector = ' UNION ' if ($self->api_name =~ /union/o);
 
         my $select = <<"        SQL";
                 SELECT  s.*
                   FROM  $s_table s
-		  WHERE s.owner IN ( XXX ) and s.stat_cat = ?
+          WHERE s.owner IN ( XXX ) and s.stat_cat = ?
                   ORDER BY value
         SQL
 
-	my $binds = join($collector, map { 'SELECT id FROM actor.org_unit_full_path(?)' } grep {defined} @$ous);
-	$select =~ s/XXX/$binds/so;
-	
+    my $binds = join($collector, map { 'SELECT id FROM actor.org_unit_full_path(?)' } grep {defined} @$ous);
+    $select =~ s/XXX/$binds/so;
+    
         my $sth = asset::stat_cat->db_Main->prepare_cached($select);
         $sth->execute(map {"$_"} @$ous,$sc);
 
@@ -779,50 +779,50 @@ __PACKAGE__->register_method(
 
 
 sub cn_ranged_tree {
-	my $self = shift;
-	my $client = shift;
-	my $cn = shift;
-	my $ou = shift;
-	my $depth = shift || 0;
-
-	my $ou_list =
-		actor::org_unit
-			->db_Main
-			->selectcol_arrayref(
-				'SELECT id FROM actor.org_unit_descendants(?,?)',
-				{},
-				$ou,
-				$depth
-			);
-
-	return undef unless ($ou_list and @$ou_list);
-
-	$cn = asset::call_number->retrieve( $cn );
-	return undef unless ($cn);
-	return undef if ($cn->deleted);
-
-	my $call_number = $cn->to_fieldmapper;
-	$call_number->copies([]);
-
-	$call_number->record( $cn->record->to_fieldmapper );
-	$call_number->record->fixed_fields( $cn->record->record_descriptor->next->to_fieldmapper );
-
-	for my $cp ( $cn->copies(circ_lib => $ou_list) ) {
-		next if ($cp->deleted);
-		my $copy = $cp->to_fieldmapper;
-		$copy->status( $cp->status->to_fieldmapper );
-		$copy->location( $cp->location->to_fieldmapper );
-
-		push @{ $call_number->copies }, $copy;
-	}
-
-	return $call_number;
+    my $self = shift;
+    my $client = shift;
+    my $cn = shift;
+    my $ou = shift;
+    my $depth = shift || 0;
+
+    my $ou_list =
+        actor::org_unit
+            ->db_Main
+            ->selectcol_arrayref(
+                'SELECT id FROM actor.org_unit_descendants(?,?)',
+                {},
+                $ou,
+                $depth
+            );
+
+    return undef unless ($ou_list and @$ou_list);
+
+    $cn = asset::call_number->retrieve( $cn );
+    return undef unless ($cn);
+    return undef if ($cn->deleted);
+
+    my $call_number = $cn->to_fieldmapper;
+    $call_number->copies([]);
+
+    $call_number->record( $cn->record->to_fieldmapper );
+    $call_number->record->fixed_fields( $cn->record->record_descriptor->next->to_fieldmapper );
+
+    for my $cp ( $cn->copies(circ_lib => $ou_list) ) {
+        next if ($cp->deleted);
+        my $copy = $cp->to_fieldmapper;
+        $copy->status( $cp->status->to_fieldmapper );
+        $copy->location( $cp->location->to_fieldmapper );
+
+        push @{ $call_number->copies }, $copy;
+    }
+
+    return $call_number;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.asset.call_number.ranged_tree',
-	method		=> 'cn_ranged_tree',
-	argc		=> 1,
-	api_level	=> 1,
+    api_name    => 'open-ils.storage.asset.call_number.ranged_tree',
+    method      => 'cn_ranged_tree',
+    argc        => 1,
+    api_level   => 1,
 );
 
 
@@ -889,30 +889,30 @@ __PACKAGE__->register_method(
 );
 
 sub merge_record_assets {
-	my $self = shift;
-	my $client = shift;
-	my $target = shift;
-	my @sources = @_;
-
-	my $count = 0;
-	for my $source ( @sources ) {
-		$count += asset::call_number
-				->db_Main
-				->selectcol_arrayref(
-					"SELECT asset.merge_record_assets(?,?);",
-					{},
-					$target,
-					$source
-				)->[0];
-	}
-
-	return $count;
+    my $self = shift;
+    my $client = shift;
+    my $target = shift;
+    my @sources = @_;
+
+    my $count = 0;
+    for my $source ( @sources ) {
+        $count += asset::call_number
+                ->db_Main
+                ->selectcol_arrayref(
+                    "SELECT asset.merge_record_assets(?,?);",
+                    {},
+                    $target,
+                    $source
+                )->[0];
+    }
+
+    return $count;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.asset.merge_record_assets',
-	method		=> 'merge_record_assets',
-	argc		=> 2,
-	api_level	=> 1,
+    api_name    => 'open-ils.storage.asset.merge_record_assets',
+    method      => 'merge_record_assets',
+    argc        => 2,
+    api_level   => 1,
 );
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/authority.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/authority.pm
index b0cdfe4..f5a86d1 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/authority.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/authority.pm
@@ -23,246 +23,246 @@ $VERSION = 1;
 my $parser = XML::LibXML->new;
 
 sub validate_tag {
-	my $self = shift;
-	my $client = shift;
-	my %args = @_;
-	
-	my @tags = @{$args{tags}};
-	my @searches = @{$args{searches}};
-
-	my $search_table = authority::full_rec->table;
-	my $rec_table = authority::record_entry->table;
-
-	my @values;
-	my @selects;
-	for my $t ( @tags ) {
-		for my $search ( @searches ) {
-			my $sf = $$search{subfield};
-			my $term = naco_normalize($$search{term}, $sf);
-
-			push @values, $t, $sf, $term;
-
-			push @selects,
-				"SELECT record FROM $search_table ".
-				"WHERE tag = ? AND subfield = ? AND value = ?";
-		}
-
-		my $sql;
-		if ($self->api_name =~ /id_list/) {
-			$sql = 'SELECT DISTINCT record FROM (';
-		} else {
-			$sql = 'SELECT COUNT(DISTINCT record) FROM (';
-		}
-		$sql .= 'SELECT record FROM (('.join(') INTERSECT (', @selects).')) AS x ';
-		$sql .= "JOIN $search_table recheck USING (record) ";
-		$sql .= "JOIN $rec_table delcheck ON (recheck.record = delcheck.id and delcheck.deleted = 'f') ";
-		$sql .= "WHERE recheck.tag = ? GROUP BY 1 HAVING (COUNT(recheck.id) - ?) = 0) AS foo;";
-
-		if ($self->api_name =~ /id_list/) {
-			my $id_list = authority::full_rec->db_Main->selectcol_arrayref( $sql, {}, @values, $t, scalar(@searches) );
-			return $id_list;
-		} else {
-			my $count = authority::full_rec->db_Main->selectcol_arrayref( $sql, {}, @values, $t, scalar(@searches) )->[0];
-			return $count if ($count > 0);
-		}
-	}
-
-	return 0;
+    my $self = shift;
+    my $client = shift;
+    my %args = @_;
+    
+    my @tags = @{$args{tags}};
+    my @searches = @{$args{searches}};
+
+    my $search_table = authority::full_rec->table;
+    my $rec_table = authority::record_entry->table;
+
+    my @values;
+    my @selects;
+    for my $t ( @tags ) {
+        for my $search ( @searches ) {
+            my $sf = $$search{subfield};
+            my $term = naco_normalize($$search{term}, $sf);
+
+            push @values, $t, $sf, $term;
+
+            push @selects,
+                "SELECT record FROM $search_table ".
+                "WHERE tag = ? AND subfield = ? AND value = ?";
+        }
+
+        my $sql;
+        if ($self->api_name =~ /id_list/) {
+            $sql = 'SELECT DISTINCT record FROM (';
+        } else {
+            $sql = 'SELECT COUNT(DISTINCT record) FROM (';
+        }
+        $sql .= 'SELECT record FROM (('.join(') INTERSECT (', @selects).')) AS x ';
+        $sql .= "JOIN $search_table recheck USING (record) ";
+        $sql .= "JOIN $rec_table delcheck ON (recheck.record = delcheck.id and delcheck.deleted = 'f') ";
+        $sql .= "WHERE recheck.tag = ? GROUP BY 1 HAVING (COUNT(recheck.id) - ?) = 0) AS foo;";
+
+        if ($self->api_name =~ /id_list/) {
+            my $id_list = authority::full_rec->db_Main->selectcol_arrayref( $sql, {}, @values, $t, scalar(@searches) );
+            return $id_list;
+        } else {
+            my $count = authority::full_rec->db_Main->selectcol_arrayref( $sql, {}, @values, $t, scalar(@searches) )->[0];
+            return $count if ($count > 0);
+        }
+    }
+
+    return 0;
 }
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.authority.validate.tag",
-	method		=> 'validate_tag',
-	api_level	=> 1,
+    api_name    => "open-ils.storage.authority.validate.tag",
+    method      => 'validate_tag',
+    api_level   => 1,
 );
 
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.authority.validate.tag.id_list",
-	method		=> 'validate_tag',
-	api_level	=> 1,
+    api_name    => "open-ils.storage.authority.validate.tag.id_list",
+    method      => 'validate_tag',
+    api_level   => 1,
 );
 
 
 sub find_authority_marc {
-	my $self = shift;
-	my $client = shift;
-	my %args = @_;
-	
-	my $term = NFD(lc($args{term}));
-	my $tag = $args{tag};
-	my $subfield = $args{subfield};
-	my $limit = $args{limit} || 100;
-	my $offset = $args{offset} || 0;
-
-	if ($limit) {
-		$limit = "LIMIT $limit";
-	} else {
-		$limit = '';
-	}
-
-	if ($offset) {
-		$offset = "OFFSET $offset";
-	} else {
-		$offset = '';
-	}
-
-	my $tag_where = "AND f.tag LIKE '$tag'";
-	if (ref $tag) {
-		$tag_where = "AND f.tag IN ('".join("','",@$tag)."')";
-	}
-
-	my $sf_where = "AND f.subfield = '$subfield'";
-	if (ref $subfield) {
-		$sf_where = "AND f.subfield IN ('".join("','",@$subfield)."')";
-	}
-
-	my $search_table = authority::full_rec->table;
-	my $marc_table = authority::record_entry->table;
-
-	my ($index_col) = authority::full_rec->columns('FTS');
-	$index_col ||= 'value';
-
-	my $fts = OpenILS::Application::Storage::FTS->compile(default => $term, 'f.value', "f.$index_col");
-
-	$term =~ s/\W+$//gso;
-	$term =~ s/'/''/gso;
-	$term =~ s/\pM//gso;
-
-	my $fts_where = $fts->sql_where_clause;
-	my $fts_words = join '%', $fts->words;
+    my $self = shift;
+    my $client = shift;
+    my %args = @_;
+    
+    my $term = NFD(lc($args{term}));
+    my $tag = $args{tag};
+    my $subfield = $args{subfield};
+    my $limit = $args{limit} || 100;
+    my $offset = $args{offset} || 0;
+
+    if ($limit) {
+        $limit = "LIMIT $limit";
+    } else {
+        $limit = '';
+    }
+
+    if ($offset) {
+        $offset = "OFFSET $offset";
+    } else {
+        $offset = '';
+    }
+
+    my $tag_where = "AND f.tag LIKE '$tag'";
+    if (ref $tag) {
+        $tag_where = "AND f.tag IN ('".join("','",@$tag)."')";
+    }
+
+    my $sf_where = "AND f.subfield = '$subfield'";
+    if (ref $subfield) {
+        $sf_where = "AND f.subfield IN ('".join("','",@$subfield)."')";
+    }
+
+    my $search_table = authority::full_rec->table;
+    my $marc_table = authority::record_entry->table;
+
+    my ($index_col) = authority::full_rec->columns('FTS');
+    $index_col ||= 'value';
+
+    my $fts = OpenILS::Application::Storage::FTS->compile(default => $term, 'f.value', "f.$index_col");
+
+    $term =~ s/\W+$//gso;
+    $term =~ s/'/''/gso;
+    $term =~ s/\pM//gso;
+
+    my $fts_where = $fts->sql_where_clause;
+    my $fts_words = join '%', $fts->words;
 
     return undef unless ($fts_words);
 
-	my $fts_words_where = "f.value LIKE '$fts_words\%'";
-	my $fts_start_where = "f.value LIKE '$term\%'";
-	my $fts_eq_where = "f.value = '$term'";
-
-	my $fts_rank = join '+', $fts->fts_rank;
-
-	my $select = <<"	SQL";
-		SELECT	a.marc, sum($fts_rank), count(f.record), first(f.value)
-  	  	FROM	$search_table f,
-			$marc_table a
-  	  	WHERE	$fts_start_where
-			$tag_where
-			$sf_where
-	  		AND a.id = f.record
-			GROUP BY 1
-			ORDER BY 2 desc, 3 desc, 4
-			$limit
-			$offset
-			
-	SQL
-
-	$log->debug("Authority Search SQL :: [$select]",DEBUG);
-
-	my $recs = authority::full_rec->db_Main->selectcol_arrayref( $select );
-	
-	$log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
-
-	$client->respond($_) for (@$recs);
-	return undef;
+    my $fts_words_where = "f.value LIKE '$fts_words\%'";
+    my $fts_start_where = "f.value LIKE '$term\%'";
+    my $fts_eq_where = "f.value = '$term'";
+
+    my $fts_rank = join '+', $fts->fts_rank;
+
+    my $select = <<"    SQL";
+        SELECT  a.marc, sum($fts_rank), count(f.record), first(f.value)
+        FROM    $search_table f,
+            $marc_table a
+        WHERE   $fts_start_where
+            $tag_where
+            $sf_where
+            AND a.id = f.record
+            GROUP BY 1
+            ORDER BY 2 desc, 3 desc, 4
+            $limit
+            $offset
+            
+    SQL
+
+    $log->debug("Authority Search SQL :: [$select]",DEBUG);
+
+    my $recs = authority::full_rec->db_Main->selectcol_arrayref( $select );
+    
+    $log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
+
+    $client->respond($_) for (@$recs);
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.authority.search.marc",
-	method		=> 'find_authority_marc',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => "open-ils.storage.authority.search.marc",
+    method      => 'find_authority_marc',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 
 sub _empty_check {
-	my $term = shift;
-	my $class = shift || 'metabib::full_rec';
+    my $term = shift;
+    my $class = shift || 'metabib::full_rec';
 
-	my $table = $class->table;
+    my $table = $class->table;
 
-	my ($index_col) = $class->columns('FTS');
-	$index_col ||= 'value';
+    my ($index_col) = $class->columns('FTS');
+    $index_col ||= 'value';
 
-	my $fts = OpenILS::Application::Storage::FTS->compile(default => $term, 'm.value', "m.$index_col");
-	my $fts_where = $fts->sql_where_clause;
+    my $fts = OpenILS::Application::Storage::FTS->compile(default => $term, 'm.value', "m.$index_col");
+    my $fts_where = $fts->sql_where_clause;
 
-	my $sql = <<"	SQL";
-		SELECT	TRUE
-		FROM	$table m
-		WHERE	$fts_where
-		LIMIT 1
-	SQL
+    my $sql = <<"    SQL";
+        SELECT  TRUE
+        FROM    $table m
+        WHERE   $fts_where
+        LIMIT 1
+    SQL
 
-	return $class->db_Main->selectcol_arrayref($sql)->[0];
+    return $class->db_Main->selectcol_arrayref($sql)->[0];
 }
 
 my $prevtime;
 
 sub find_see_from_controlled {
-	my $self = shift;
-	my $client = shift;
-	my $term = shift;
-	my $limit = shift;
-	my $offset = shift;
-
-	$prevtime = time;
-
-	(my $class = $self->api_name) =~ s/^.+authority.([^\.]+)\.see.+$/$1/o;
-	my $sf = 'a';
-	$sf = 't' if ($class eq 'title');
-
-	my @marc = $self->method_lookup('open-ils.storage.authority.search.marc')
-			->run( term => $term, tag => [400,410,411,430,450,455], subfield => $sf, limit => $limit, offset => $offset );
-
-	
-	for my $m ( @marc ) {
-		my $doc = $parser->parse_string($m);
-		my @nodes = $doc->documentElement->findnodes('//*[substring(@tag,1,1)="1"]/*[@code="a" or @code="d" or @code="x"]');
-		my $list = [ map { $_->textContent } @nodes ];
-		$client->respond( $list ) if (_empty_check(join(' ',@$list), "metabib::${class}_field_entry"));
-	}
-	return undef;
+    my $self = shift;
+    my $client = shift;
+    my $term = shift;
+    my $limit = shift;
+    my $offset = shift;
+
+    $prevtime = time;
+
+    (my $class = $self->api_name) =~ s/^.+authority.([^\.]+)\.see.+$/$1/o;
+    my $sf = 'a';
+    $sf = 't' if ($class eq 'title');
+
+    my @marc = $self->method_lookup('open-ils.storage.authority.search.marc')
+            ->run( term => $term, tag => [400,410,411,430,450,455], subfield => $sf, limit => $limit, offset => $offset );
+
+    
+    for my $m ( @marc ) {
+        my $doc = $parser->parse_string($m);
+        my @nodes = $doc->documentElement->findnodes('//*[substring(@tag,1,1)="1"]/*[@code="a" or @code="d" or @code="x"]');
+        my $list = [ map { $_->textContent } @nodes ];
+        $client->respond( $list ) if (_empty_check(join(' ',@$list), "metabib::${class}_field_entry"));
+    }
+    return undef;
 }
 for my $class ( qw/title author subject keyword series identifier/ ) {
-	__PACKAGE__->register_method(
-		api_name	=> "open-ils.storage.authority.$class.see_from.controlled",
-		method		=> 'find_see_from_controlled',
-		api_level	=> 1,
-		stream		=> 1,
-		cachable	=> 1,
-	);
+    __PACKAGE__->register_method(
+        api_name    => "open-ils.storage.authority.$class.see_from.controlled",
+        method      => 'find_see_from_controlled',
+        api_level   => 1,
+        stream      => 1,
+        cachable    => 1,
+    );
 }
 
 sub find_see_also_from_controlled {
-	my $self = shift;
-	my $client = shift;
-	my $term = shift;
-	my $limit = shift;
-	my $offset = shift;
-
-	(my $class = $self->api_name) =~ s/^.+authority.([^\.]+)\.see.+$/$1/o;
-	my $sf = 'a';
-	$sf = 't' if ($class eq 'title');
-
-	my @marc = $self->method_lookup('open-ils.storage.authority.search.marc')
-			->run( term => $term, tag => [500,510,511,530,550,555], subfield => $sf, limit => $limit, offset => $offset );
-	for my $m ( @marc ) {
-		my $doc = $parser->parse_string($m);
-		my @nodes = $doc->documentElement->findnodes('//*[substring(@tag,1,1)="1"]/*[@code="a" or @code="d" or @code="x"]');
-		my $list = [ map { $_->textContent } @nodes ];
-		$client->respond( $list ) if (_empty_check(join(' ',@$list), "metabib::${class}_field_entry"));
-	}
-	return undef;
+    my $self = shift;
+    my $client = shift;
+    my $term = shift;
+    my $limit = shift;
+    my $offset = shift;
+
+    (my $class = $self->api_name) =~ s/^.+authority.([^\.]+)\.see.+$/$1/o;
+    my $sf = 'a';
+    $sf = 't' if ($class eq 'title');
+
+    my @marc = $self->method_lookup('open-ils.storage.authority.search.marc')
+            ->run( term => $term, tag => [500,510,511,530,550,555], subfield => $sf, limit => $limit, offset => $offset );
+    for my $m ( @marc ) {
+        my $doc = $parser->parse_string($m);
+        my @nodes = $doc->documentElement->findnodes('//*[substring(@tag,1,1)="1"]/*[@code="a" or @code="d" or @code="x"]');
+        my $list = [ map { $_->textContent } @nodes ];
+        $client->respond( $list ) if (_empty_check(join(' ',@$list), "metabib::${class}_field_entry"));
+    }
+    return undef;
 }
 for my $class ( qw/title author subject keyword series identifier/ ) {
-	__PACKAGE__->register_method(
-		api_name	=> "open-ils.storage.authority.$class.see_also_from.controlled",
-		method		=> 'find_see_also_from_controlled',
-		api_level	=> 1,
-		stream		=> 1,
-		cachable	=> 1,
-	);
+    __PACKAGE__->register_method(
+        api_name    => "open-ils.storage.authority.$class.see_also_from.controlled",
+        method      => 'find_see_also_from_controlled',
+        api_level   => 1,
+        stream      => 1,
+        cachable    => 1,
+    );
 }
 __PACKAGE__->register_method(
-    api_name	=> "open-ils.storage.authority.in_db.browse_or_search",
-    method		=> "authority_in_db_browse_or_search",
-    api_level	=> 1,
+    api_name    => "open-ils.storage.authority.in_db.browse_or_search",
+    method      => "authority_in_db_browse_or_search",
+    api_level   => 1,
     argc        => 5,
     signature   => {
         desc => q/Use stored procedures to perform authorities-based
@@ -294,7 +294,7 @@ sub authority_in_db_browse_or_search {
     return unless $method =~ /^\w+$/;
 
     my $db = authority::full_rec->db_Main;
-	my $list = $db->selectcol_arrayref(
+    my $list = $db->selectcol_arrayref(
         qq/
             SELECT
                 (SELECT record FROM authority.simple_heading WHERE id = func.heading)
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/biblio.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/biblio.pm
index 65a777a..8d8648d 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/biblio.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/biblio.pm
@@ -9,235 +9,235 @@ use OpenILS::Utils::Fieldmapper;
 $VERSION = 1;
 
 sub record_copy_count {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	my %args = @_;
+    my %args = @_;
 
-	my $cn_table = asset::call_number->table;
-	my $cp_table = asset::copy->table;
-	my $st_table = config::copy_status->table;
-	my $src_table = config::bib_source->table;
-	my $br_table = biblio::record_entry->table;
-	my $loc_table = asset::copy_location->table;
-	my $out_table = actor::org_unit_type->table;
+    my $cn_table = asset::call_number->table;
+    my $cp_table = asset::copy->table;
+    my $st_table = config::copy_status->table;
+    my $src_table = config::bib_source->table;
+    my $br_table = biblio::record_entry->table;
+    my $loc_table = asset::copy_location->table;
+    my $out_table = actor::org_unit_type->table;
 
-	my $descendants = "actor.org_unit_descendants(u.id)";
-	my $ancestors = "actor.org_unit_ancestors(?) u JOIN $out_table t ON (u.ou_type = t.id)";
+    my $descendants = "actor.org_unit_descendants(u.id)";
+    my $ancestors = "actor.org_unit_ancestors(?) u JOIN $out_table t ON (u.ou_type = t.id)";
 
     if ($args{org_unit} < 0) {
         $args{org_unit} *= -1;
-	    $ancestors = "(select org_unit as id from actor.org_lasso_map where lasso = ?) u CROSS JOIN (SELECT -1 AS depth) t";
+        $ancestors = "(select org_unit as id from actor.org_lasso_map where lasso = ?) u CROSS JOIN (SELECT -1 AS depth) t";
     }
 
-	my $visible = 'AND a.opac_visible = TRUE AND st.opac_visible = TRUE AND loc.opac_visible = TRUE AND cp.opac_visible = TRUE';
-	if ($self->api_name =~ /staff/o) {
-		$visible = ''
-	}
-
-	my $sql = <<"	SQL";
-		SELECT	t.depth,
-			u.id AS org_unit,
-			sum(
-				(SELECT count(cp.id)
-				  FROM  $cn_table cn
-					JOIN $cp_table cp ON (cn.id = cp.call_number)
-					JOIN $descendants a ON (cp.circ_lib = a.id)
-					JOIN $st_table st ON (cp.status = st.id)
-					JOIN $loc_table loc ON (cp.location = loc.id)
-				  WHERE cn.record = ?
-					$visible
-				  	AND cn.deleted IS FALSE
-					AND cp.deleted IS FALSE)
-			) AS count,
-			sum(
-				(SELECT count(cp.id)
-				  FROM  $cn_table cn
-					JOIN $cp_table cp ON (cn.id = cp.call_number)
-					JOIN $descendants a ON (cp.circ_lib = a.id)
-					JOIN $st_table st ON (cp.status = st.id)
-					JOIN $loc_table loc ON (cp.location = loc.id)
-				  WHERE cn.record = ?
-					$visible
-				  	AND cn.deleted IS FALSE
-					AND cp.deleted IS FALSE
-				  	AND cp.status IN (0,7,12))
-			) AS available,
-			sum(
-				(SELECT count(cp.id)
-				  FROM  $cn_table cn
-					JOIN $cp_table cp ON (cn.id = cp.call_number)
-					JOIN $st_table st ON (cp.status = st.id)
-					JOIN $loc_table loc ON (cp.location = loc.id)
-				  WHERE cn.record = ?
-					AND st.opac_visible = TRUE
-					AND loc.opac_visible = TRUE
-					AND cp.opac_visible = TRUE
-				  	AND cn.deleted IS FALSE
-					AND cp.deleted IS FALSE)
-			) AS unshadow,
+    my $visible = 'AND a.opac_visible = TRUE AND st.opac_visible = TRUE AND loc.opac_visible = TRUE AND cp.opac_visible = TRUE';
+    if ($self->api_name =~ /staff/o) {
+        $visible = ''
+    }
+
+    my $sql = <<"    SQL";
+        SELECT  t.depth,
+            u.id AS org_unit,
+            sum(
+                (SELECT count(cp.id)
+                  FROM  $cn_table cn
+                    JOIN $cp_table cp ON (cn.id = cp.call_number)
+                    JOIN $descendants a ON (cp.circ_lib = a.id)
+                    JOIN $st_table st ON (cp.status = st.id)
+                    JOIN $loc_table loc ON (cp.location = loc.id)
+                  WHERE cn.record = ?
+                    $visible
+                    AND cn.deleted IS FALSE
+                    AND cp.deleted IS FALSE)
+            ) AS count,
+            sum(
+                (SELECT count(cp.id)
+                  FROM  $cn_table cn
+                    JOIN $cp_table cp ON (cn.id = cp.call_number)
+                    JOIN $descendants a ON (cp.circ_lib = a.id)
+                    JOIN $st_table st ON (cp.status = st.id)
+                    JOIN $loc_table loc ON (cp.location = loc.id)
+                  WHERE cn.record = ?
+                    $visible
+                    AND cn.deleted IS FALSE
+                    AND cp.deleted IS FALSE
+                    AND cp.status IN (0,7,12))
+            ) AS available,
+            sum(
+                (SELECT count(cp.id)
+                  FROM  $cn_table cn
+                    JOIN $cp_table cp ON (cn.id = cp.call_number)
+                    JOIN $st_table st ON (cp.status = st.id)
+                    JOIN $loc_table loc ON (cp.location = loc.id)
+                  WHERE cn.record = ?
+                    AND st.opac_visible = TRUE
+                    AND loc.opac_visible = TRUE
+                    AND cp.opac_visible = TRUE
+                    AND cn.deleted IS FALSE
+                    AND cp.deleted IS FALSE)
+            ) AS unshadow,
                         sum(    
                                 (SELECT sum(1)
-                                  FROM	$br_table br
+                                  FROM  $br_table br
                                         JOIN $src_table src ON (src.id = br.source)
                                   WHERE br.id = ?
                                         AND src.transcendant IS TRUE
                                 )
                         ) AS transcendant
-		  FROM  $ancestors
-		  GROUP BY 1,2
-	SQL
-
-	my $sth = biblio::record_entry->db_Main->prepare_cached($sql);
-	$sth->execute(''.$args{record}, ''.$args{record}, ''.$args{record}, ''.$args{record}, ''.$args{org_unit});
-	while ( my $row = $sth->fetchrow_hashref ) {
-		$client->respond( $row );
-	}
-	return undef;
+          FROM  $ancestors
+          GROUP BY 1,2
+    SQL
+
+    my $sth = biblio::record_entry->db_Main->prepare_cached($sql);
+    $sth->execute(''.$args{record}, ''.$args{record}, ''.$args{record}, ''.$args{record}, ''.$args{org_unit});
+    while ( my $row = $sth->fetchrow_hashref ) {
+        $client->respond( $row );
+    }
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.biblio.record_entry.copy_count',
-	method		=> 'record_copy_count',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => 'open-ils.storage.biblio.record_entry.copy_count',
+    method      => 'record_copy_count',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.biblio.record_entry.copy_count.staff',
-	method		=> 'record_copy_count',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => 'open-ils.storage.biblio.record_entry.copy_count.staff',
+    method      => 'record_copy_count',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 
 sub record_ranged_tree {
-	my $self = shift;
-	my $client = shift;
-	my $r = shift;
-	my $ou = shift;
-	my $depth = shift;
-	my $limit = shift || 0;
-	my $offset = shift || 0;
-
-	my $ou_sql = defined($depth) ?
-			"SELECT id FROM actor.org_unit_descendants(?,?)":
-			"SELECT id FROM actor.org_unit_descendants(?)";
-
-	my $ou_list =
-		actor::org_unit
-			->db_Main
-			->selectcol_arrayref(
-				$ou_sql,
-				{},
-				$ou,
-				(defined($depth) ? ($depth) : ()),
-			);
-
-	return undef unless ($ou_list and @$ou_list);
-
-	$r = biblio::record_entry->retrieve( $r );
-	return undef unless ($r);
-
-	my $rec = $r->to_fieldmapper;
-	$rec->call_numbers([]);
-
-	$rec->fixed_fields( $r->record_descriptor->next->to_fieldmapper );
-
-	my $offset_count = 0;
-	my $limit_count = 0;
-	for my $cn ( $r->call_numbers  ) {
-		next if ($cn->deleted);
-		my $call_number = $cn->to_fieldmapper;
-		$call_number->copies([]);
-
-
-		for my $cp ( $cn->copies(circ_lib => $ou_list) ) {
-			next if ($cp->deleted);
-			if ($offset > 0 && $offset_count < $offset) {
-				$offset_count++;
-				next;
-			}
-			
-			last if ($limit > 0 && $limit_count >= $limit);
-
-			my $copy = $cp->to_fieldmapper;
-			$copy->status( $cp->status->to_fieldmapper );
-			$copy->location( $cp->location->to_fieldmapper );
-			push @{ $call_number->copies }, $copy;
-
-			$limit_count++;
-		}
-
-		last if ($limit > 0 && $limit_count >= $limit);
-
-		push @{ $rec->call_numbers }, $call_number if (@{ $call_number->copies });
-	}
-
-	return $rec;
+    my $self = shift;
+    my $client = shift;
+    my $r = shift;
+    my $ou = shift;
+    my $depth = shift;
+    my $limit = shift || 0;
+    my $offset = shift || 0;
+
+    my $ou_sql = defined($depth) ?
+            "SELECT id FROM actor.org_unit_descendants(?,?)":
+            "SELECT id FROM actor.org_unit_descendants(?)";
+
+    my $ou_list =
+        actor::org_unit
+            ->db_Main
+            ->selectcol_arrayref(
+                $ou_sql,
+                {},
+                $ou,
+                (defined($depth) ? ($depth) : ()),
+            );
+
+    return undef unless ($ou_list and @$ou_list);
+
+    $r = biblio::record_entry->retrieve( $r );
+    return undef unless ($r);
+
+    my $rec = $r->to_fieldmapper;
+    $rec->call_numbers([]);
+
+    $rec->fixed_fields( $r->record_descriptor->next->to_fieldmapper );
+
+    my $offset_count = 0;
+    my $limit_count = 0;
+    for my $cn ( $r->call_numbers  ) {
+        next if ($cn->deleted);
+        my $call_number = $cn->to_fieldmapper;
+        $call_number->copies([]);
+
+
+        for my $cp ( $cn->copies(circ_lib => $ou_list) ) {
+            next if ($cp->deleted);
+            if ($offset > 0 && $offset_count < $offset) {
+                $offset_count++;
+                next;
+            }
+            
+            last if ($limit > 0 && $limit_count >= $limit);
+
+            my $copy = $cp->to_fieldmapper;
+            $copy->status( $cp->status->to_fieldmapper );
+            $copy->location( $cp->location->to_fieldmapper );
+            push @{ $call_number->copies }, $copy;
+
+            $limit_count++;
+        }
+
+        last if ($limit > 0 && $limit_count >= $limit);
+
+        push @{ $rec->call_numbers }, $call_number if (@{ $call_number->copies });
+    }
+
+    return $rec;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.biblio.record_entry.ranged_tree',
-	method		=> 'record_ranged_tree',
-	argc		=> 1,
-	api_level	=> 1,
+    api_name    => 'open-ils.storage.biblio.record_entry.ranged_tree',
+    method      => 'record_ranged_tree',
+    argc        => 1,
+    api_level   => 1,
 );
 
 sub record_by_barcode {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	my $cn_table = asset::call_number->table;
-	my $cp_table = asset::copy->table;
+    my $cn_table = asset::call_number->table;
+    my $cp_table = asset::copy->table;
 
-	my $id = ''.shift;
-	my ($r) = biblio::record_entry->db_Main->selectrow_array( <<"	SQL", {}, $id );
-		SELECT	cn.record
-		  FROM	$cn_table cn
-		  	JOIN $cp_table cp ON (cp.call_number = cn.id)
-		  WHERE	cp.barcode = ?
-	SQL
+    my $id = ''.shift;
+    my ($r) = biblio::record_entry->db_Main->selectrow_array( <<"    SQL", {}, $id );
+        SELECT  cn.record
+          FROM  $cn_table cn
+            JOIN $cp_table cp ON (cp.call_number = cn.id)
+          WHERE cp.barcode = ?
+    SQL
 
-	my $rec = biblio::record_entry->retrieve( $r );
+    my $rec = biblio::record_entry->retrieve( $r );
 
-	return $rec->to_fieldmapper if ($rec);
-	return undef;
+    return $rec->to_fieldmapper if ($rec);
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.biblio.record_entry.retrieve_by_barcode',
-	method		=> 'record_by_barcode',
-	api_level	=> 1,
-	cachable	=> 1,
+    api_name    => 'open-ils.storage.biblio.record_entry.retrieve_by_barcode',
+    method      => 'record_by_barcode',
+    api_level   => 1,
+    cachable    => 1,
 );
 
 sub record_by_copy {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	my $cn_table = asset::call_number->table;
-	my $cp_table = asset::copy->table;
+    my $cn_table = asset::call_number->table;
+    my $cp_table = asset::copy->table;
 
-	my $id = ''.shift;
-	my ($r) = biblio::record_entry->db_Main->selectrow_array( <<"	SQL", {}, $id );
-		SELECT	cn.record
-		  FROM	$cn_table cn
-		  	JOIN $cp_table cp ON (cp.call_number = cn.id)
-		  WHERE	cp.id = ?
-	SQL
+    my $id = ''.shift;
+    my ($r) = biblio::record_entry->db_Main->selectrow_array( <<"    SQL", {}, $id );
+        SELECT  cn.record
+          FROM  $cn_table cn
+            JOIN $cp_table cp ON (cp.call_number = cn.id)
+          WHERE cp.id = ?
+    SQL
 
-	my $rec = biblio::record_entry->retrieve( $r );
-	return undef unless ($rec);
+    my $rec = biblio::record_entry->retrieve( $r );
+    return undef unless ($rec);
 
-	my $r_fm = $rec->to_fieldmapper;
-	my $ff = $rec->record_descriptor->next;
-	$r_fm->fixed_fields( $ff->to_fieldmapper ) if ($ff);
+    my $r_fm = $rec->to_fieldmapper;
+    my $ff = $rec->record_descriptor->next;
+    $r_fm->fixed_fields( $ff->to_fieldmapper ) if ($ff);
 
-	return $r_fm;
+    return $r_fm;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.fleshed.biblio.record_entry.retrieve_by_copy',
-	method		=> 'record_by_copy',
-	api_level	=> 1,
-	cachable	=> 1,
+    api_name    => 'open-ils.storage.fleshed.biblio.record_entry.retrieve_by_copy',
+    method      => 'record_by_copy',
+    api_level   => 1,
+    cachable    => 1,
 );
 
 
@@ -245,283 +245,283 @@ __PACKAGE__->register_method(
 
 my $org_unit_lookup;
 sub record_copy_count {
-	my $self = shift;
-	my $client = shift;
-	my $oid = shift;
-	my @recs = @_;
+    my $self = shift;
+    my $client = shift;
+    my $oid = shift;
+    my @recs = @_;
 
-	if ($self->api_name !~ /batch/o) {
-		@recs = ($recs[0]);
-	}
+    if ($self->api_name !~ /batch/o) {
+        @recs = ($recs[0]);
+    }
 
-	throw OpenSRF::EX::InvalidArg ( "No org_unit id passed!" )
-		unless ($oid);
+    throw OpenSRF::EX::InvalidArg ( "No org_unit id passed!" )
+        unless ($oid);
 
-	throw OpenSRF::EX::InvalidArg ( "No record id passed!" )
-		unless (@recs);
+    throw OpenSRF::EX::InvalidArg ( "No record id passed!" )
+        unless (@recs);
 
-	$org_unit_lookup ||= $self->method_lookup('open-ils.storage.direct.actor.org_unit.retrieve');
-	my ($org_unit) = $org_unit_lookup->run($oid);
+    $org_unit_lookup ||= $self->method_lookup('open-ils.storage.direct.actor.org_unit.retrieve');
+    my ($org_unit) = $org_unit_lookup->run($oid);
 
-	# XXX Use descendancy tree here!!!
-	my $short_name_hack = $org_unit->shortname;
-	$short_name_hack = '' if (!$org_unit->parent_ou);
-	$short_name_hack .= '%';
-	# XXX Use descendancy tree here!!!
+    # XXX Use descendancy tree here!!!
+    my $short_name_hack = $org_unit->shortname;
+    $short_name_hack = '' if (!$org_unit->parent_ou);
+    $short_name_hack .= '%';
+    # XXX Use descendancy tree here!!!
 
-	my $rec_list = join(',', at recs);
+    my $rec_list = join(',', at recs);
 
-	my $cp_table = asset::copy->table;
-	my $cn_table = asset::call_number->table;
+    my $cp_table = asset::copy->table;
+    my $cn_table = asset::call_number->table;
 
-	my $select =<<"	SQL";
-		SELECT	count(cp.*) as copies
-		  FROM	$cn_table cn
-			JOIN $cp_table cp ON (cp.call_number = cn.id)
-		  WHERE	cn.owning_lib LIKE ? AND
-		  	cn.record IN ($rec_list)
-	SQL
+    my $select =<<"    SQL";
+        SELECT  count(cp.*) as copies
+          FROM  $cn_table cn
+            JOIN $cp_table cp ON (cp.call_number = cn.id)
+          WHERE cn.owning_lib LIKE ? AND
+            cn.record IN ($rec_list)
+    SQL
 
-	my $sth = asset::copy->db_Main->prepare_cached($select);
-	$sth->execute($short_name_hack);
+    my $sth = asset::copy->db_Main->prepare_cached($select);
+    $sth->execute($short_name_hack);
 
-	my $results = $sth->fetchall_hashref('record');
+    my $results = $sth->fetchall_hashref('record');
 
-	$client->respond($$results{$_}{copies} || 0) for (@recs);
+    $client->respond($$results{$_}{copies} || 0) for (@recs);
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
-	method		=> 'record_copy_count',
-	api_name	=> 'open-ils.storage.direct.biblio.record_copy_count',
-	api_level	=> 1,
-	argc		=> 1,
+    method      => 'record_copy_count',
+    api_name    => 'open-ils.storage.direct.biblio.record_copy_count',
+    api_level   => 1,
+    argc        => 1,
 );
 __PACKAGE__->register_method(
-	method		=> 'record_copy_count',
-	api_name	=> 'open-ils.storage.direct.biblio.record_copy_count.batch',
-	api_level	=> 1,
-	argc		=> 1,
-	stream		=> 1,
+    method      => 'record_copy_count',
+    api_name    => 'open-ils.storage.direct.biblio.record_copy_count.batch',
+    api_level   => 1,
+    argc        => 1,
+    stream      => 1,
 );
 
 =cut
 
 sub global_record_copy_count {
-	my $self = shift;
-	my $client = shift;
-
-	my $rec = shift;
-
-	my $cn_table = asset::call_number->table;
-	my $cp_table = asset::copy->table;
-	my $cl_table = asset::copy_location->table;
-	my $cs_table = config::copy_status->table;
-
-	my $copies_visible = 'AND cp.opac_visible IS TRUE AND cs.opac_visible IS TRUE AND cl.opac_visible IS TRUE';
-	$copies_visible = '' if ($self->api_name =~ /staff/o);
-
-	my $sql = <<"	SQL";
-
-		SELECT	owning_lib, sum(avail), sum(tot)
- 		  FROM	(
-        			SELECT	cn.owning_lib, count(cp.id) as avail, 0 as tot
-				  FROM	$cn_table cn
-					JOIN $cp_table cp ON (cn.id = cp.call_number)
-					JOIN $cs_table cs ON (cs.id = cp.status)
-					JOIN $cl_table cl ON (cl.id = cp.location)
-				  WHERE	cn.record = ?
-				  	AND cp.status IN (0,7,12)
-				  	$copies_visible
-				  GROUP BY 1
-                        			UNION
-        			SELECT	cn.owning_lib, 0 as avail, count(cp.id) as tot
-				  FROM	$cn_table cn
-					JOIN $cp_table cp ON (cn.id = cp.call_number)
-					JOIN $cs_table cs ON (cs.id = cp.status)
-					JOIN $cl_table cl ON (cl.id = cp.location)
-				  WHERE	cn.record = ?
-				  	$copies_visible
-				  GROUP BY 1
-			) x
-		  GROUP BY 1
-	SQL
-
-	my $sth = biblio::record_entry->db_Main->prepare_cached($sql);
-	$sth->execute("$rec", "$rec");
-
-	$client->respond( $_ ) for (@{$sth->fetchall_arrayref});
-	return undef;
+    my $self = shift;
+    my $client = shift;
+
+    my $rec = shift;
+
+    my $cn_table = asset::call_number->table;
+    my $cp_table = asset::copy->table;
+    my $cl_table = asset::copy_location->table;
+    my $cs_table = config::copy_status->table;
+
+    my $copies_visible = 'AND cp.opac_visible IS TRUE AND cs.opac_visible IS TRUE AND cl.opac_visible IS TRUE';
+    $copies_visible = '' if ($self->api_name =~ /staff/o);
+
+    my $sql = <<"    SQL";
+
+        SELECT  owning_lib, sum(avail), sum(tot)
+          FROM  (
+                    SELECT  cn.owning_lib, count(cp.id) as avail, 0 as tot
+                  FROM  $cn_table cn
+                    JOIN $cp_table cp ON (cn.id = cp.call_number)
+                    JOIN $cs_table cs ON (cs.id = cp.status)
+                    JOIN $cl_table cl ON (cl.id = cp.location)
+                  WHERE cn.record = ?
+                    AND cp.status IN (0,7,12)
+                    $copies_visible
+                  GROUP BY 1
+                                    UNION
+                    SELECT  cn.owning_lib, 0 as avail, count(cp.id) as tot
+                  FROM  $cn_table cn
+                    JOIN $cp_table cp ON (cn.id = cp.call_number)
+                    JOIN $cs_table cs ON (cs.id = cp.status)
+                    JOIN $cl_table cl ON (cl.id = cp.location)
+                  WHERE cn.record = ?
+                    $copies_visible
+                  GROUP BY 1
+            ) x
+          GROUP BY 1
+    SQL
+
+    my $sth = biblio::record_entry->db_Main->prepare_cached($sql);
+    $sth->execute("$rec", "$rec");
+
+    $client->respond( $_ ) for (@{$sth->fetchall_arrayref});
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.biblio.record_entry.global_copy_count',
-	method		=> 'global_record_copy_count',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => 'open-ils.storage.biblio.record_entry.global_copy_count',
+    method      => 'global_record_copy_count',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.biblio.record_entry.global_copy_count.staff',
-	method		=> 'global_record_copy_count',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => 'open-ils.storage.biblio.record_entry.global_copy_count.staff',
+    method      => 'global_record_copy_count',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 
 sub record_copy_status_count {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	my $rec = shift;
-	my $ou = shift || 1;
-	my $depth = shift || 0;
+    my $rec = shift;
+    my $ou = shift || 1;
+    my $depth = shift || 0;
 
 
-	my $descendants = "actor.org_unit_descendants(?,?)";
+    my $descendants = "actor.org_unit_descendants(?,?)";
 
-	my $cn_table = asset::call_number->table;
-	my $cnp_table = asset::call_number_prefix->table;
-	my $cns_table = asset::call_number_suffix->table;
-	my $cp_table = asset::copy->table;
-	my $cl_table = asset::copy_location->table;
-	my $cs_table = config::copy_status->table;
+    my $cn_table = asset::call_number->table;
+    my $cnp_table = asset::call_number_prefix->table;
+    my $cns_table = asset::call_number_suffix->table;
+    my $cp_table = asset::copy->table;
+    my $cl_table = asset::copy_location->table;
+    my $cs_table = config::copy_status->table;
 
-	my $sql = <<"	SQL";
+    my $sql = <<"    SQL";
 
-		SELECT	cp.circ_lib,
-				CASE WHEN cnp.id > -1 THEN cnp.label ELSE '' END,
+        SELECT  cp.circ_lib,
+                CASE WHEN cnp.id > -1 THEN cnp.label ELSE '' END,
                 cn.label,
                 CASE WHEN cns.id > -1 THEN cns.label ELSE '' END,
-				cp.status,
-				count(cp.id)
-		  FROM	$cp_table cp,
-		  	$cn_table cn,
-		  	$cns_table cns,
-		  	$cnp_table cnp,
-			$cl_table cl,
-			$cs_table cs,
-			$descendants d
-		  WHERE	cn.record = ?
-		  	AND cnp.id = cn.prefix
-		  	AND cns.id = cn.suffix
-		  	AND cp.call_number = cn.id
-		  	AND cp.location = cl.id
-			AND cp.circ_lib = d.id
-		  	AND cp.status = cs.id
-			AND cl.opac_visible IS TRUE
-			AND cp.opac_visible IS TRUE
-			AND cp.deleted IS FALSE
-			AND cs.opac_visible IS TRUE
-		  GROUP BY 1,2,3,4,5;
-	SQL
-
-	my $sth = biblio::record_entry->db_Main->prepare_cached($sql);
-	$sth->execute($ou, $depth, "$rec" );
-
-	my %data = ();
-	for my $row (@{$sth->fetchall_arrayref}) {
-		$data{$$row[0]}{$$row[1]}{$$row[2]}{$$row[3]}{$$row[4]} += $$row[5];
-	}
-	
-	for my $ou (keys %data) {
-		for my $cn_prefix (keys %{$data{$ou}}) {
-		    for my $cn (keys %{$data{$ou}{$cn_prefix}}) {
-		        for my $cn_suffix (keys %{$data{$ou}{$cn_prefix}{$cn}}) {
-			        $client->respond( [$ou, $cn_prefix, $cn, $cn_suffix, $data{$ou}{$cn}{$cn_prefix}{$cn}{$cn_suffix}] );
-		        }
+                cp.status,
+                count(cp.id)
+          FROM  $cp_table cp,
+            $cn_table cn,
+            $cns_table cns,
+            $cnp_table cnp,
+            $cl_table cl,
+            $cs_table cs,
+            $descendants d
+          WHERE cn.record = ?
+            AND cnp.id = cn.prefix
+            AND cns.id = cn.suffix
+            AND cp.call_number = cn.id
+            AND cp.location = cl.id
+            AND cp.circ_lib = d.id
+            AND cp.status = cs.id
+            AND cl.opac_visible IS TRUE
+            AND cp.opac_visible IS TRUE
+            AND cp.deleted IS FALSE
+            AND cs.opac_visible IS TRUE
+          GROUP BY 1,2,3,4,5;
+    SQL
+
+    my $sth = biblio::record_entry->db_Main->prepare_cached($sql);
+    $sth->execute($ou, $depth, "$rec" );
+
+    my %data = ();
+    for my $row (@{$sth->fetchall_arrayref}) {
+        $data{$$row[0]}{$$row[1]}{$$row[2]}{$$row[3]}{$$row[4]} += $$row[5];
+    }
+    
+    for my $ou (keys %data) {
+        for my $cn_prefix (keys %{$data{$ou}}) {
+            for my $cn (keys %{$data{$ou}{$cn_prefix}}) {
+                for my $cn_suffix (keys %{$data{$ou}{$cn_prefix}{$cn}}) {
+                    $client->respond( [$ou, $cn_prefix, $cn, $cn_suffix, $data{$ou}{$cn}{$cn_prefix}{$cn}{$cn_suffix}] );
+                }
             }
         }
-	}
-	return undef;
+    }
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.biblio.record_entry.status_copy_count',
-	method		=> 'record_copy_status_count',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => 'open-ils.storage.biblio.record_entry.status_copy_count',
+    method      => 'record_copy_status_count',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 
 
 sub record_copy_status_location_count {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	my $rec = shift;
-	my $ou = shift || 1;
-	my $depth = shift || 0;
+    my $rec = shift;
+    my $ou = shift || 1;
+    my $depth = shift || 0;
 
 
-	my $descendants = "actor.org_unit_descendants(?,?)";
+    my $descendants = "actor.org_unit_descendants(?,?)";
 
-	my $cn_table = asset::call_number->table;
-	my $cnp_table = asset::call_number_prefix->table;
-	my $cns_table = asset::call_number_suffix->table;
-	my $cp_table = asset::copy->table;
-	my $cl_table = asset::copy_location->table;
-	my $cs_table = config::copy_status->table;
+    my $cn_table = asset::call_number->table;
+    my $cnp_table = asset::call_number_prefix->table;
+    my $cns_table = asset::call_number_suffix->table;
+    my $cp_table = asset::copy->table;
+    my $cl_table = asset::copy_location->table;
+    my $cs_table = config::copy_status->table;
 
-	# FIXME using oils_i18n_xlate here is exposing a hitherto unexposed
-	# implementation detail of json_query; doing it this way because
-	# json_query currently doesn't grok joining a function to tables
-	my $sql = <<"	SQL";
+    # FIXME using oils_i18n_xlate here is exposing a hitherto unexposed
+    # implementation detail of json_query; doing it this way because
+    # json_query currently doesn't grok joining a function to tables
+    my $sql = <<"    SQL";
 
-		SELECT	cp.circ_lib,
-				CASE WHEN cnp.id > -1 THEN cnp.label ELSE '' END,
+        SELECT  cp.circ_lib,
+                CASE WHEN cnp.id > -1 THEN cnp.label ELSE '' END,
                 cn.label,
                 CASE WHEN cns.id > -1 THEN cns.label ELSE '' END,
-				oils_i18n_xlate('asset.copy_location', 'acpl', 'name', 'id', cl.id::TEXT, ?),
-				cp.status,
-				count(cp.id)
-		  FROM	$cp_table cp,
-		  	$cn_table cn,
-		  	$cns_table cns,
-		  	$cnp_table cnp,
-			$cl_table cl,
-			$cs_table cs,
-			$descendants d
-		  WHERE	cn.record = ?
-		  	AND cnp.id = cn.prefix
-		  	AND cns.id = cn.suffix
-		  	AND cp.call_number = cn.id
-		  	AND cp.location = cl.id
-			AND cp.circ_lib = d.id
-		  	AND cp.status = cs.id
-			AND cl.opac_visible IS TRUE
-			AND cp.opac_visible IS TRUE
-			AND cp.deleted IS FALSE
-			AND cs.opac_visible IS TRUE
-		  GROUP BY 1,2,3,4,5,6;
-	SQL
-
-	my $sth = biblio::record_entry->db_Main->prepare_cached($sql);
-	my $ses_locale = $client->session ? $client->session->session_locale : 'en-US';
-	$sth->execute($ses_locale, $ou, $depth, "$rec" );
-
-	my %data = ();
-	for my $row (@{$sth->fetchall_arrayref}) {
-		$data{$$row[0]}{$$row[1]}{$$row[2]}{$$row[3]}{$$row[4]}{$$row[5]} += $$row[6];
-	}
-	
-	for my $ou (keys %data) {
-		for my $cn_prefix (keys %{$data{$ou}}) {
-		    for my $cn (keys %{$data{$ou}{$cn_prefix}}) {
-		        for my $cn_suffix (keys %{$data{$ou}{$cn_prefix}{$cn}}) {
+                oils_i18n_xlate('asset.copy_location', 'acpl', 'name', 'id', cl.id::TEXT, ?),
+                cp.status,
+                count(cp.id)
+          FROM  $cp_table cp,
+            $cn_table cn,
+            $cns_table cns,
+            $cnp_table cnp,
+            $cl_table cl,
+            $cs_table cs,
+            $descendants d
+          WHERE cn.record = ?
+            AND cnp.id = cn.prefix
+            AND cns.id = cn.suffix
+            AND cp.call_number = cn.id
+            AND cp.location = cl.id
+            AND cp.circ_lib = d.id
+            AND cp.status = cs.id
+            AND cl.opac_visible IS TRUE
+            AND cp.opac_visible IS TRUE
+            AND cp.deleted IS FALSE
+            AND cs.opac_visible IS TRUE
+          GROUP BY 1,2,3,4,5,6;
+    SQL
+
+    my $sth = biblio::record_entry->db_Main->prepare_cached($sql);
+    my $ses_locale = $client->session ? $client->session->session_locale : 'en-US';
+    $sth->execute($ses_locale, $ou, $depth, "$rec" );
+
+    my %data = ();
+    for my $row (@{$sth->fetchall_arrayref}) {
+        $data{$$row[0]}{$$row[1]}{$$row[2]}{$$row[3]}{$$row[4]}{$$row[5]} += $$row[6];
+    }
+    
+    for my $ou (keys %data) {
+        for my $cn_prefix (keys %{$data{$ou}}) {
+            for my $cn (keys %{$data{$ou}{$cn_prefix}}) {
+                for my $cn_suffix (keys %{$data{$ou}{$cn_prefix}{$cn}}) {
                     for my $cl (keys %{$data{$ou}{$cn_prefix}{$cn}{$cn_suffix}}) {
                         $client->respond( [$ou, $cn_prefix, $cn, $cn_suffix, $cl, $data{$ou}{$cn_prefix}{$cn}{$cn_suffix}{$cl}] );
                     }
-		        }
-		    }
-		}
-	}
-	return undef;
+                }
+            }
+        }
+    }
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.biblio.record_entry.status_copy_location_count',
-	method		=> 'record_copy_status_location_count',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => 'open-ils.storage.biblio.record_entry.status_copy_location_count',
+    method      => 'record_copy_status_location_count',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/config.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/config.pm
index 33644ce..99c3be0 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/config.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/config.pm
@@ -4,78 +4,78 @@ use OpenILS::Application::Storage::CDBI::config;
 
 
 sub retrieve_all {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	$self->api_name =~ /direct\.config\.(.+)\.retrieve/o;
-	
-	my $class = 'config::'.$1;
-	for my $rec ( $class->retrieve_all ) {
-		$client->respond( $rec->to_fieldmapper );
-	}
+    $self->api_name =~ /direct\.config\.(.+)\.retrieve/o;
+    
+    my $class = 'config::'.$1;
+    for my $rec ( $class->retrieve_all ) {
+        $client->respond( $rec->to_fieldmapper );
+    }
 
-	return undef;
+    return undef;
 }
 
 for my $class (
-		qw/metabib_field standing identification_type copy_status
-		   non_cataloged_type audience_map item_form_map item_type_map
-		   language_map lit_form_map bib_source net_access_level/ ) {
-
-	__PACKAGE__->register_method(
-		method		=> 'retrieve_all',
-		api_name	=> "open-ils.storage.direct.config.$class.retrieve.all",
-		argc		=> 0,
-		stream		=> 1,
-	);
+        qw/metabib_field standing identification_type copy_status
+           non_cataloged_type audience_map item_form_map item_type_map
+           language_map lit_form_map bib_source net_access_level/ ) {
+
+    __PACKAGE__->register_method(
+        method      => 'retrieve_all',
+        api_name    => "open-ils.storage.direct.config.$class.retrieve.all",
+        argc        => 0,
+        stream      => 1,
+    );
 }
 
 
 # XXX arg, with the descendancy SPs...
 sub ranged_config_non_cat {
-	my $self = shift;
-	my $client = shift;
-	my @binds = @_;
+    my $self = shift;
+    my $client = shift;
+    my @binds = @_;
 
-	my $ctable = config::non_cataloged_type->table;
+    my $ctable = config::non_cataloged_type->table;
 
-	my $descendants = defined($binds[1]) ?
-		"actor.org_unit_full_path(?, ?)" :
-		"actor.org_unit_full_path(?)" ;
+    my $descendants = defined($binds[1]) ?
+        "actor.org_unit_full_path(?, ?)" :
+        "actor.org_unit_full_path(?)" ;
 
 
-	my $sql = <<"	SQL";
-		SELECT	DISTINCT c.*
-		  FROM	$ctable c
-		  	JOIN $descendants d
-				ON (d.id = c.owning_lib)
-	SQL
+    my $sql = <<"    SQL";
+        SELECT  DISTINCT c.*
+          FROM  $ctable c
+            JOIN $descendants d
+                ON (d.id = c.owning_lib)
+    SQL
 
-	my $sth = config::non_cataloged_type->db_Main->prepare($sql);
-	$sth->execute(@binds);
+    my $sth = config::non_cataloged_type->db_Main->prepare($sql);
+    $sth->execute(@binds);
 
-	while ( my $rec = $sth->fetchrow_hashref ) {
+    while ( my $rec = $sth->fetchrow_hashref ) {
 
-		my $cnct = new Fieldmapper::config::non_cataloged_type;
-		$cnct->name($rec->{name});
-		$cnct->owning_lib($rec->{owning_lib});
-		$cnct->id($rec->{id});
-		$cnct->circ_duration($rec->{circ_duration});
-		$cnct->in_house($rec->{in_house});
+        my $cnct = new Fieldmapper::config::non_cataloged_type;
+        $cnct->name($rec->{name});
+        $cnct->owning_lib($rec->{owning_lib});
+        $cnct->id($rec->{id});
+        $cnct->circ_duration($rec->{circ_duration});
+        $cnct->in_house($rec->{in_house});
 
-		$client->respond( $cnct );
-	}
+        $client->respond( $cnct );
+    }
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
-	method		=> 'ranged_config_non_cat',
-	api_name	=> 'open-ils.storage.ranged.config.non_cataloged_type.retrieve',
-	argc		=> 1,
-	stream		=> 1,
-	notes		=> <<"	NOTES",
-		Returns 
-	NOTES
+    method      => 'ranged_config_non_cat',
+    api_name    => 'open-ils.storage.ranged.config.non_cataloged_type.retrieve',
+    argc        => 1,
+    stream      => 1,
+    notes        => <<"    NOTES",
+        Returns 
+    NOTES
 );
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm
index 32d2cab..6f29126 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm
@@ -75,405 +75,405 @@ sub _initialize_parser {
 }
 
 sub ordered_records_from_metarecord {
-	my $self = shift;
-	my $client = shift;
-	my $mr = shift;
-	my $formats = shift;
-	my $org = shift || 1;
-	my $depth = shift;
-
-	my (@types, at forms, at blvl);
-
-	if ($formats) {
-		my ($t, $f, $b) = split '-', $formats;
-		@types = split '', $t;
-		@forms = split '', $f;
-		@blvl = split '', $b;
-	}
-
-	my $descendants =
-		defined($depth) ?
-			"actor.org_unit_descendants($org, $depth)" :
-			"actor.org_unit_descendants($org)" ;
-
-
-	my $copies_visible = 'AND d.opac_visible IS TRUE AND cp.opac_visible IS TRUE AND cs.opac_visible IS TRUE AND cl.opac_visible IS TRUE';
-	$copies_visible = '' if ($self->api_name =~ /staff/o);
-
-	my $sm_table = metabib::metarecord_source_map->table;
-	my $rd_table = metabib::record_descriptor->table;
-	my $fr_table = metabib::full_rec->table;
-	my $cn_table = asset::call_number->table;
-	my $cl_table = asset::copy_location->table;
-	my $cp_table = asset::copy->table;
-	my $cs_table = config::copy_status->table;
-	my $src_table = config::bib_source->table;
-	my $out_table = actor::org_unit_type->table;
-	my $br_table = biblio::record_entry->table;
-
-	my $sql = <<"	SQL";
-		SELECT	record,
-			item_type,
-			item_form,
-			quality,
-			FIRST(COALESCE(LTRIM(SUBSTR( value, COALESCE(SUBSTRING(ind2 FROM E'\\\\d+'),'0')::INT + 1 )),'zzzzzzzz')) AS title
-		FROM	(
-			SELECT	rd.record,
-				rd.item_type,
-				rd.item_form,
-				br.quality,
-				fr.tag,
-				fr.subfield,
-				fr.value,
-				fr.ind2
-	SQL
-
-	if ($copies_visible) {
-		$sql .= <<"		SQL";
-	  		  FROM	$sm_table sm,
-				$br_table br,
-				$fr_table fr,
-				$rd_table rd
-		  	  WHERE	rd.record = sm.source
-				AND fr.record = sm.source
-		  		AND br.id = sm.source
-				AND sm.metarecord = ?
-                        	AND (EXISTS ((SELECT	1
-						FROM	$cp_table cp
-							JOIN $cn_table cn ON (cp.call_number = cn.id)
-				       			JOIN $cs_table cs ON (cp.status = cs.id)
-				       			JOIN $cl_table cl ON (cp.location = cl.id)
-							JOIN $descendants d ON (cp.circ_lib = d.id)
-						WHERE	cn.record = sm.source
-		                                	$copies_visible
-						LIMIT 1))
-					OR EXISTS ((
-					    SELECT	1
-					      FROM	$src_table src
-					      WHERE	src.id = br.source
-					      		AND src.transcendant IS TRUE))
-				)
-					  
-		SQL
-	} else {
-		$sql .= <<"		SQL";
-			  FROM	$sm_table sm
-				JOIN $br_table br ON (sm.source = br.id)
-				JOIN $fr_table fr ON (fr.record = br.id)
-				JOIN $rd_table rd ON (rd.record = br.id)
-			  WHERE	sm.metarecord = ?
-				AND ((	EXISTS (
-						SELECT	1
-						  FROM	$cp_table cp,
-							$cn_table cn,
-							$descendants d
-						  WHERE	cn.record = br.id
-							AND cn.deleted = FALSE
-							AND cp.deleted = FALSE
-							AND cp.circ_lib = d.id
-							AND cn.id = cp.call_number
-						  LIMIT 1
-					) OR NOT EXISTS (
-						SELECT	1
-						  FROM	$cp_table cp,
-							$cn_table cn
-						  WHERE	cn.record = br.id
-							AND cn.deleted = FALSE
-							AND cp.deleted = FALSE
-							AND cn.id = cp.call_number
-						  LIMIT 1
-					))
-					OR EXISTS ((
-					    SELECT	1
-					      FROM	$src_table src
-					      WHERE	src.id = br.source
-					      		AND src.transcendant IS TRUE))
-				)
-		SQL
-	}
-
-	if (@types) {
-		$sql .= '				AND rd.item_type IN ('.join(',',map{'?'}@types).')';
-	}
-
-	if (@forms) {
-		$sql .= '				AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
-	}
-
-	if (@blvl) {
-		$sql .= '				AND rd.bib_level IN ('.join(',',map{'?'}@blvl).')';
-	}
-
-
-
-	$sql .= <<"	SQL";
-	  		  OFFSET 0
-			) AS x
-	  WHERE	tag = '245'
-	  	AND subfield = 'a'
-	  GROUP BY record, item_type, item_form, quality
-	  ORDER BY
-		CASE
-			WHEN item_type IS NULL -- default
-				THEN 0
-			WHEN item_type = '' -- default
-				THEN 0
-			WHEN item_type IN ('a','t') -- books
-				THEN 1
-			WHEN item_type = 'g' -- movies
-				THEN 2
-			WHEN item_type IN ('i','j') -- sound recordings
-				THEN 3
-			WHEN item_type = 'm' -- software
-				THEN 4
-			WHEN item_type = 'k' -- images
-				THEN 5
-			WHEN item_type IN ('e','f') -- maps
-				THEN 6
-			WHEN item_type IN ('o','p') -- mixed
-				THEN 7
-			WHEN item_type IN ('c','d') -- music
-				THEN 8
-			WHEN item_type = 'r' -- 3d
-				THEN 9
-		END,
-		title ASC,
-		quality DESC
-	SQL
-
-	my $ids = metabib::metarecord_source_map->db_Main->selectcol_arrayref($sql, {}, "$mr", @types, @forms, @blvl);
-	return $ids if ($self->api_name =~ /atomic$/o);
-
-	$client->respond( $_ ) for ( @$ids );
-	return undef;
+    my $self = shift;
+    my $client = shift;
+    my $mr = shift;
+    my $formats = shift;
+    my $org = shift || 1;
+    my $depth = shift;
+
+    my (@types, at forms, at blvl);
+
+    if ($formats) {
+        my ($t, $f, $b) = split '-', $formats;
+        @types = split '', $t;
+        @forms = split '', $f;
+        @blvl = split '', $b;
+    }
+
+    my $descendants =
+        defined($depth) ?
+            "actor.org_unit_descendants($org, $depth)" :
+            "actor.org_unit_descendants($org)" ;
+
+
+    my $copies_visible = 'AND d.opac_visible IS TRUE AND cp.opac_visible IS TRUE AND cs.opac_visible IS TRUE AND cl.opac_visible IS TRUE';
+    $copies_visible = '' if ($self->api_name =~ /staff/o);
+
+    my $sm_table = metabib::metarecord_source_map->table;
+    my $rd_table = metabib::record_descriptor->table;
+    my $fr_table = metabib::full_rec->table;
+    my $cn_table = asset::call_number->table;
+    my $cl_table = asset::copy_location->table;
+    my $cp_table = asset::copy->table;
+    my $cs_table = config::copy_status->table;
+    my $src_table = config::bib_source->table;
+    my $out_table = actor::org_unit_type->table;
+    my $br_table = biblio::record_entry->table;
+
+    my $sql = <<"    SQL";
+        SELECT  record,
+            item_type,
+            item_form,
+            quality,
+            FIRST(COALESCE(LTRIM(SUBSTR( value, COALESCE(SUBSTRING(ind2 FROM E'\\\\d+'),'0')::INT + 1 )),'zzzzzzzz')) AS title
+        FROM    (
+            SELECT  rd.record,
+                rd.item_type,
+                rd.item_form,
+                br.quality,
+                fr.tag,
+                fr.subfield,
+                fr.value,
+                fr.ind2
+    SQL
+
+    if ($copies_visible) {
+        $sql .= <<"        SQL";
+              FROM  $sm_table sm,
+                $br_table br,
+                $fr_table fr,
+                $rd_table rd
+              WHERE rd.record = sm.source
+                AND fr.record = sm.source
+                AND br.id = sm.source
+                AND sm.metarecord = ?
+                            AND (EXISTS ((SELECT    1
+                        FROM    $cp_table cp
+                            JOIN $cn_table cn ON (cp.call_number = cn.id)
+                                JOIN $cs_table cs ON (cp.status = cs.id)
+                                JOIN $cl_table cl ON (cp.location = cl.id)
+                            JOIN $descendants d ON (cp.circ_lib = d.id)
+                        WHERE   cn.record = sm.source
+                                            $copies_visible
+                        LIMIT 1))
+                    OR EXISTS ((
+                        SELECT  1
+                          FROM  $src_table src
+                          WHERE src.id = br.source
+                                AND src.transcendant IS TRUE))
+                )
+                      
+        SQL
+    } else {
+        $sql .= <<"        SQL";
+              FROM  $sm_table sm
+                JOIN $br_table br ON (sm.source = br.id)
+                JOIN $fr_table fr ON (fr.record = br.id)
+                JOIN $rd_table rd ON (rd.record = br.id)
+              WHERE sm.metarecord = ?
+                AND ((  EXISTS (
+                        SELECT  1
+                          FROM  $cp_table cp,
+                            $cn_table cn,
+                            $descendants d
+                          WHERE cn.record = br.id
+                            AND cn.deleted = FALSE
+                            AND cp.deleted = FALSE
+                            AND cp.circ_lib = d.id
+                            AND cn.id = cp.call_number
+                          LIMIT 1
+                    ) OR NOT EXISTS (
+                        SELECT  1
+                          FROM  $cp_table cp,
+                            $cn_table cn
+                          WHERE cn.record = br.id
+                            AND cn.deleted = FALSE
+                            AND cp.deleted = FALSE
+                            AND cn.id = cp.call_number
+                          LIMIT 1
+                    ))
+                    OR EXISTS ((
+                        SELECT  1
+                          FROM  $src_table src
+                          WHERE src.id = br.source
+                                AND src.transcendant IS TRUE))
+                )
+        SQL
+    }
+
+    if (@types) {
+        $sql .= '               AND rd.item_type IN ('.join(',',map{'?'}@types).')';
+    }
+
+    if (@forms) {
+        $sql .= '               AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
+    }
+
+    if (@blvl) {
+        $sql .= '               AND rd.bib_level IN ('.join(',',map{'?'}@blvl).')';
+    }
+
+
+
+    $sql .= <<"    SQL";
+              OFFSET 0
+            ) AS x
+      WHERE tag = '245'
+        AND subfield = 'a'
+      GROUP BY record, item_type, item_form, quality
+      ORDER BY
+        CASE
+            WHEN item_type IS NULL -- default
+                THEN 0
+            WHEN item_type = '' -- default
+                THEN 0
+            WHEN item_type IN ('a','t') -- books
+                THEN 1
+            WHEN item_type = 'g' -- movies
+                THEN 2
+            WHEN item_type IN ('i','j') -- sound recordings
+                THEN 3
+            WHEN item_type = 'm' -- software
+                THEN 4
+            WHEN item_type = 'k' -- images
+                THEN 5
+            WHEN item_type IN ('e','f') -- maps
+                THEN 6
+            WHEN item_type IN ('o','p') -- mixed
+                THEN 7
+            WHEN item_type IN ('c','d') -- music
+                THEN 8
+            WHEN item_type = 'r' -- 3d
+                THEN 9
+        END,
+        title ASC,
+        quality DESC
+    SQL
+
+    my $ids = metabib::metarecord_source_map->db_Main->selectcol_arrayref($sql, {}, "$mr", @types, @forms, @blvl);
+    return $ids if ($self->api_name =~ /atomic$/o);
+
+    $client->respond( $_ ) for ( @$ids );
+    return undef;
 
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.ordered.metabib.metarecord.records',
-	method		=> 'ordered_records_from_metarecord',
-	api_level	=> 1,
-	cachable	=> 1,
+    api_name    => 'open-ils.storage.ordered.metabib.metarecord.records',
+    method      => 'ordered_records_from_metarecord',
+    api_level   => 1,
+    cachable    => 1,
 );
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.ordered.metabib.metarecord.records.staff',
-	method		=> 'ordered_records_from_metarecord',
-	api_level	=> 1,
-	cachable	=> 1,
+    api_name    => 'open-ils.storage.ordered.metabib.metarecord.records.staff',
+    method      => 'ordered_records_from_metarecord',
+    api_level   => 1,
+    cachable    => 1,
 );
 
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.ordered.metabib.metarecord.records.atomic',
-	method		=> 'ordered_records_from_metarecord',
-	api_level	=> 1,
-	cachable	=> 1,
+    api_name    => 'open-ils.storage.ordered.metabib.metarecord.records.atomic',
+    method      => 'ordered_records_from_metarecord',
+    api_level   => 1,
+    cachable    => 1,
 );
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.ordered.metabib.metarecord.records.staff.atomic',
-	method		=> 'ordered_records_from_metarecord',
-	api_level	=> 1,
-	cachable	=> 1,
+    api_name    => 'open-ils.storage.ordered.metabib.metarecord.records.staff.atomic',
+    method      => 'ordered_records_from_metarecord',
+    api_level   => 1,
+    cachable    => 1,
 );
 
 # XXX: this subroutine and its two registered methods are marked for 
 # deprecation, as they do not work properly in 2.x (these tags are no longer
 # normalized in mfr) and are not in known use
 sub isxn_search {
-	my $self = shift;
-	my $client = shift;
-	my $isxn = lc(shift());
-
-	$isxn =~ s/^\s*//o;
-	$isxn =~ s/\s*$//o;
-	$isxn =~ s/-//o if ($self->api_name =~ /isbn/o);
-
-	my $tag = ($self->api_name =~ /isbn/o) ? "'020' OR f.tag = '024'" : "'022'";
-
-	my $fr_table = metabib::full_rec->table;
-	my $bib_table = biblio::record_entry->table;
-
-	my $sql = <<"	SQL";
-		SELECT	DISTINCT f.record
-		  FROM	$fr_table f
-			JOIN $bib_table b ON (b.id = f.record)
-		  WHERE	(f.tag = $tag)
-			AND f.value LIKE ?
-			AND b.deleted IS FALSE
-	SQL
-
-	my $list = metabib::full_rec->db_Main->selectcol_arrayref($sql, {}, "$isxn%");
-	$client->respond($_) for (@$list);
-	return undef;
+    my $self = shift;
+    my $client = shift;
+    my $isxn = lc(shift());
+
+    $isxn =~ s/^\s*//o;
+    $isxn =~ s/\s*$//o;
+    $isxn =~ s/-//o if ($self->api_name =~ /isbn/o);
+
+    my $tag = ($self->api_name =~ /isbn/o) ? "'020' OR f.tag = '024'" : "'022'";
+
+    my $fr_table = metabib::full_rec->table;
+    my $bib_table = biblio::record_entry->table;
+
+    my $sql = <<"    SQL";
+        SELECT  DISTINCT f.record
+          FROM  $fr_table f
+            JOIN $bib_table b ON (b.id = f.record)
+          WHERE (f.tag = $tag)
+            AND f.value LIKE ?
+            AND b.deleted IS FALSE
+    SQL
+
+    my $list = metabib::full_rec->db_Main->selectcol_arrayref($sql, {}, "$isxn%");
+    $client->respond($_) for (@$list);
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.id_list.biblio.record_entry.search.isbn',
-	method		=> 'isxn_search',
-	api_level	=> 1,
-	stream		=> 1,
+    api_name    => 'open-ils.storage.id_list.biblio.record_entry.search.isbn',
+    method      => 'isxn_search',
+    api_level   => 1,
+    stream      => 1,
 );
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.id_list.biblio.record_entry.search.issn',
-	method		=> 'isxn_search',
-	api_level	=> 1,
-	stream		=> 1,
+    api_name    => 'open-ils.storage.id_list.biblio.record_entry.search.issn',
+    method      => 'isxn_search',
+    api_level   => 1,
+    stream      => 1,
 );
 
 sub metarecord_copy_count {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	my %args = @_;
+    my %args = @_;
 
-	my $sm_table = metabib::metarecord_source_map->table;
-	my $rd_table = metabib::record_descriptor->table;
-	my $cn_table = asset::call_number->table;
-	my $cp_table = asset::copy->table;
-	my $br_table = biblio::record_entry->table;
-	my $src_table = config::bib_source->table;
-	my $cl_table = asset::copy_location->table;
-	my $cs_table = config::copy_status->table;
-	my $out_table = actor::org_unit_type->table;
+    my $sm_table = metabib::metarecord_source_map->table;
+    my $rd_table = metabib::record_descriptor->table;
+    my $cn_table = asset::call_number->table;
+    my $cp_table = asset::copy->table;
+    my $br_table = biblio::record_entry->table;
+    my $src_table = config::bib_source->table;
+    my $cl_table = asset::copy_location->table;
+    my $cs_table = config::copy_status->table;
+    my $out_table = actor::org_unit_type->table;
 
-	my $descendants = "actor.org_unit_descendants(u.id)";
-	my $ancestors = "actor.org_unit_ancestors(?) u JOIN $out_table t ON (u.ou_type = t.id)";
+    my $descendants = "actor.org_unit_descendants(u.id)";
+    my $ancestors = "actor.org_unit_ancestors(?) u JOIN $out_table t ON (u.ou_type = t.id)";
 
     if ($args{org_unit} < 0) {
         $args{org_unit} *= -1;
         $ancestors = "(select org_unit as id from actor.org_lasso_map where lasso = ?) u CROSS JOIN (SELECT -1 AS depth) t";
     }
 
-	my $copies_visible = 'AND a.opac_visible IS TRUE AND cp.opac_visible IS TRUE AND cs.opac_visible IS TRUE AND cl.opac_visible IS TRUE';
-	$copies_visible = '' if ($self->api_name =~ /staff/o);
-
-	my (@types, at forms, at blvl);
-	my ($t_filter, $f_filter, $b_filter) = ('','','');
-
-	if ($args{format}) {
-		my ($t, $f, $b) = split '-', $args{format};
-		@types = split '', $t;
-		@forms = split '', $f;
-		@blvl = split '', $b;
-
-		if (@types) {
-			$t_filter = ' AND rd.item_type IN ('.join(',',map{'?'}@types).')';
-		}
-
-		if (@forms) {
-			$f_filter .= ' AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
-		}
-
-		if (@blvl) {
-			$b_filter .= ' AND rd.bib_level IN ('.join(',',map{'?'}@blvl).')';
-		}
-	}
-
-	my $sql = <<"	SQL";
-		SELECT	t.depth,
-			u.id AS org_unit,
-			sum(
-				(SELECT count(cp.id)
-				  FROM  $sm_table r
-					JOIN $cn_table cn ON (cn.record = r.source)
-					JOIN $rd_table rd ON (cn.record = rd.record)
-					JOIN $cp_table cp ON (cn.id = cp.call_number)
-			       		JOIN $cs_table cs ON (cp.status = cs.id)
-			       		JOIN $cl_table cl ON (cp.location = cl.id)
-					JOIN $descendants a ON (cp.circ_lib = a.id)
-				  WHERE r.metarecord = ?
-				  	AND cn.deleted IS FALSE
-				  	AND cp.deleted IS FALSE
-				  	$copies_visible
-					$t_filter
-					$f_filter
-					$b_filter
-				)
-			) AS count,
-			sum(
-				(SELECT count(cp.id)
-				  FROM  $sm_table r
-					JOIN $cn_table cn ON (cn.record = r.source)
-					JOIN $rd_table rd ON (cn.record = rd.record)
-					JOIN $cp_table cp ON (cn.id = cp.call_number)
-			       		JOIN $cs_table cs ON (cp.status = cs.id)
-			       		JOIN $cl_table cl ON (cp.location = cl.id)
-					JOIN $descendants a ON (cp.circ_lib = a.id)
-				  WHERE r.metarecord = ?
-				  	AND cp.status IN (0,7,12)
-				  	AND cn.deleted IS FALSE
-				  	AND cp.deleted IS FALSE
-					$copies_visible
-					$t_filter
-					$f_filter
-					$b_filter
-				)
-			) AS available,
-			sum(
-				(SELECT count(cp.id)
-				  FROM  $sm_table r
-					JOIN $cn_table cn ON (cn.record = r.source)
-					JOIN $rd_table rd ON (cn.record = rd.record)
-					JOIN $cp_table cp ON (cn.id = cp.call_number)
-			       		JOIN $cs_table cs ON (cp.status = cs.id)
-			       		JOIN $cl_table cl ON (cp.location = cl.id)
-				  WHERE r.metarecord = ?
-				  	AND cn.deleted IS FALSE
-				  	AND cp.deleted IS FALSE
-					AND cp.opac_visible IS TRUE
-					AND cs.opac_visible IS TRUE
-					AND cl.opac_visible IS TRUE
-					$t_filter
-					$f_filter
-					$b_filter
-				)
-			) AS unshadow,
-			sum(	
-				(SELECT sum(1)
-				  FROM  $sm_table r
-			       		JOIN $br_table br ON (br.id = r.source)
-			       		JOIN $src_table src ON (src.id = br.source)
-				  WHERE r.metarecord = ?
-				  	AND src.transcendant IS TRUE
-				)
-			) AS transcendant
-
-		  FROM  $ancestors
-		  GROUP BY 1,2
-	SQL
-
-	my $sth = metabib::metarecord_source_map->db_Main->prepare_cached($sql);
-	$sth->execute(	''.$args{metarecord},
-			@types, 
-			@forms,
-			@blvl,
-			''.$args{metarecord},
-			@types, 
-			@forms,
-			@blvl,
-			''.$args{metarecord},
-			@types, 
-			@forms,
-			@blvl,
-			''.$args{metarecord},
-			''.$args{org_unit}, 
-	); 
-
-	while ( my $row = $sth->fetchrow_hashref ) {
-		$client->respond( $row );
-	}
-	return undef;
+    my $copies_visible = 'AND a.opac_visible IS TRUE AND cp.opac_visible IS TRUE AND cs.opac_visible IS TRUE AND cl.opac_visible IS TRUE';
+    $copies_visible = '' if ($self->api_name =~ /staff/o);
+
+    my (@types, at forms, at blvl);
+    my ($t_filter, $f_filter, $b_filter) = ('','','');
+
+    if ($args{format}) {
+        my ($t, $f, $b) = split '-', $args{format};
+        @types = split '', $t;
+        @forms = split '', $f;
+        @blvl = split '', $b;
+
+        if (@types) {
+            $t_filter = ' AND rd.item_type IN ('.join(',',map{'?'}@types).')';
+        }
+
+        if (@forms) {
+            $f_filter .= ' AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
+        }
+
+        if (@blvl) {
+            $b_filter .= ' AND rd.bib_level IN ('.join(',',map{'?'}@blvl).')';
+        }
+    }
+
+    my $sql = <<"    SQL";
+        SELECT  t.depth,
+            u.id AS org_unit,
+            sum(
+                (SELECT count(cp.id)
+                  FROM  $sm_table r
+                    JOIN $cn_table cn ON (cn.record = r.source)
+                    JOIN $rd_table rd ON (cn.record = rd.record)
+                    JOIN $cp_table cp ON (cn.id = cp.call_number)
+                        JOIN $cs_table cs ON (cp.status = cs.id)
+                        JOIN $cl_table cl ON (cp.location = cl.id)
+                    JOIN $descendants a ON (cp.circ_lib = a.id)
+                  WHERE r.metarecord = ?
+                    AND cn.deleted IS FALSE
+                    AND cp.deleted IS FALSE
+                    $copies_visible
+                    $t_filter
+                    $f_filter
+                    $b_filter
+                )
+            ) AS count,
+            sum(
+                (SELECT count(cp.id)
+                  FROM  $sm_table r
+                    JOIN $cn_table cn ON (cn.record = r.source)
+                    JOIN $rd_table rd ON (cn.record = rd.record)
+                    JOIN $cp_table cp ON (cn.id = cp.call_number)
+                        JOIN $cs_table cs ON (cp.status = cs.id)
+                        JOIN $cl_table cl ON (cp.location = cl.id)
+                    JOIN $descendants a ON (cp.circ_lib = a.id)
+                  WHERE r.metarecord = ?
+                    AND cp.status IN (0,7,12)
+                    AND cn.deleted IS FALSE
+                    AND cp.deleted IS FALSE
+                    $copies_visible
+                    $t_filter
+                    $f_filter
+                    $b_filter
+                )
+            ) AS available,
+            sum(
+                (SELECT count(cp.id)
+                  FROM  $sm_table r
+                    JOIN $cn_table cn ON (cn.record = r.source)
+                    JOIN $rd_table rd ON (cn.record = rd.record)
+                    JOIN $cp_table cp ON (cn.id = cp.call_number)
+                        JOIN $cs_table cs ON (cp.status = cs.id)
+                        JOIN $cl_table cl ON (cp.location = cl.id)
+                  WHERE r.metarecord = ?
+                    AND cn.deleted IS FALSE
+                    AND cp.deleted IS FALSE
+                    AND cp.opac_visible IS TRUE
+                    AND cs.opac_visible IS TRUE
+                    AND cl.opac_visible IS TRUE
+                    $t_filter
+                    $f_filter
+                    $b_filter
+                )
+            ) AS unshadow,
+            sum(    
+                (SELECT sum(1)
+                  FROM  $sm_table r
+                        JOIN $br_table br ON (br.id = r.source)
+                        JOIN $src_table src ON (src.id = br.source)
+                  WHERE r.metarecord = ?
+                    AND src.transcendant IS TRUE
+                )
+            ) AS transcendant
+
+          FROM  $ancestors
+          GROUP BY 1,2
+    SQL
+
+    my $sth = metabib::metarecord_source_map->db_Main->prepare_cached($sql);
+    $sth->execute(  ''.$args{metarecord},
+            @types, 
+            @forms,
+            @blvl,
+            ''.$args{metarecord},
+            @types, 
+            @forms,
+            @blvl,
+            ''.$args{metarecord},
+            @types, 
+            @forms,
+            @blvl,
+            ''.$args{metarecord},
+            ''.$args{org_unit}, 
+    ); 
+
+    while ( my $row = $sth->fetchrow_hashref ) {
+        $client->respond( $row );
+    }
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.metabib.metarecord.copy_count',
-	method		=> 'metarecord_copy_count',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => 'open-ils.storage.metabib.metarecord.copy_count',
+    method      => 'metarecord_copy_count',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.metabib.metarecord.copy_count.staff',
-	method		=> 'metarecord_copy_count',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => 'open-ils.storage.metabib.metarecord.copy_count.staff',
+    method      => 'metarecord_copy_count',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 
 sub biblio_multi_search_full_rec {
@@ -487,1024 +487,1024 @@ sub biblio_multi_search_full_rec {
     my $sort       = $args{'sort'};
     my $sort_dir   = $args{sort_dir}   || 'DESC';
 
-	my @binds;
-	my @selects;
-
-	for my $arg (@{ $args{searches} }) {
-		my $term     = $$arg{term};
-		my $limiters = $$arg{restrict};
-
-		my ($index_col)  = metabib::full_rec->columns('FTS');
-		$index_col ||= 'value';
-		my $search_table = metabib::full_rec->table;
-
-		my $fts = OpenILS::Application::Storage::FTS->compile('default' => $term, 'value',"$index_col");
-
-		my $fts_where = $fts->sql_where_clause();
-		my @fts_ranks = $fts->fts_rank;
-
-		my $rank = join(' + ', @fts_ranks);
-
-		my @wheres;
-		for my $limit (@$limiters) {
-			if ($$limit{tag} =~ /^\d+$/ and $$limit{tag} < 10) {
-				# MARC control field; mfr.subfield is NULL
-				push @wheres, "( tag = ? AND $fts_where )";
-				push @binds, $$limit{tag};
- 				$log->debug("Limiting query using { tag => $$limit{tag} }", DEBUG);
-			} else {
-				push @wheres, "( tag = ? AND subfield LIKE ? AND $fts_where )";
-				push @binds, $$limit{tag}, $$limit{subfield};
- 				$log->debug("Limiting query using { tag => $$limit{tag}, subfield => $$limit{subfield} }", DEBUG);
-			}
-		}
-		my $where = join(' OR ', @wheres);
-
-		push @selects, "SELECT record, AVG($rank) as sum FROM $search_table WHERE $where GROUP BY record";
-
-	}
-
-	my $descendants = defined($args{depth}) ?
-				"actor.org_unit_descendants($args{org_unit}, $args{depth})" :
-				"actor.org_unit_descendants($args{org_unit})" ;
-
-
-	my $metabib_record_descriptor = metabib::record_descriptor->table;
-	my $metabib_full_rec = metabib::full_rec->table;
-	my $asset_call_number_table = asset::call_number->table;
-	my $asset_copy_table = asset::copy->table;
-	my $cs_table = config::copy_status->table;
-	my $cl_table = asset::copy_location->table;
-	my $br_table = biblio::record_entry->table;
-
-	my $cj = 'HAVING COUNT(x.record) = ' . scalar(@selects) if ($class_join eq 'AND');
-	my $search_table =
-		'(SELECT x.record, sum(x.sum) FROM (('.
-			join(') UNION ALL (', @selects).
-			")) x GROUP BY 1 $cj ORDER BY 2 DESC )";
-
-	my $has_vols = 'AND cn.owning_lib = d.id';
-	my $has_copies = 'AND cp.call_number = cn.id';
-	my $copies_visible = 'AND d.opac_visible IS TRUE AND cp.opac_visible IS TRUE AND cs.opac_visible IS TRUE AND cl.opac_visible IS TRUE';
-
-	if ($self->api_name =~ /staff/o) {
-		$copies_visible = '';
-		$has_copies     = '' if ($ou_type == 0);
-		$has_vols       = '' if ($ou_type == 0);
-	}
-
-	my ($t_filter, $f_filter) = ('','');
-	my ($a_filter, $l_filter, $lf_filter) = ('','','');
-
-	if (my $a = $args{audience}) {
-		$a = [$a] if (!ref($a));
-		my @aud = @$a;
-			
-		$a_filter = ' AND rd.audience IN ('.join(',',map{'?'}@aud).')';
-		push @binds, @aud;
-	}
-
-	if (my $l = $args{language}) {
-		$l = [$l] if (!ref($l));
-		my @lang = @$l;
-
-		$l_filter = ' AND rd.item_lang IN ('.join(',',map{'?'}@lang).')';
-		push @binds, @lang;
-	}
-
-	if (my $f = $args{lit_form}) {
-		$f = [$f] if (!ref($f));
-		my @lit_form = @$f;
-
-		$lf_filter = ' AND rd.lit_form IN ('.join(',',map{'?'}@lit_form).')';
-		push @binds, @lit_form;
-	}
-
-	if (my $f = $args{item_form}) {
-		$f = [$f] if (!ref($f));
-		my @forms = @$f;
-
-		$f_filter = ' AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
-		push @binds, @forms;
-	}
-
-	if (my $t = $args{item_type}) {
-		$t = [$t] if (!ref($t));
-		my @types = @$t;
-
-		$t_filter = ' AND rd.item_type IN ('.join(',',map{'?'}@types).')';
-		push @binds, @types;
-	}
-
-
-	if ($args{format}) {
-		my ($t, $f) = split '-', $args{format};
-		my @types = split '', $t;
-		my @forms = split '', $f;
-		if (@types) {
-			$t_filter = ' AND rd.item_type IN ('.join(',',map{'?'}@types).')';
-		}
-
-		if (@forms) {
-			$f_filter .= ' AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
-		}
-		push @binds, @types, @forms;
-	}
-
-	my $relevance = 'sum(f.sum)';
-	$relevance = 1 if (!$copies_visible);
-
-	my $rank = $relevance;
-	if (lc($sort) eq 'pubdate') {
-		$rank = <<"		RANK";
-			( FIRST ((
-				SELECT	COALESCE(SUBSTRING(frp.value FROM E'\\\\d+'),'9999')::INT
-				  FROM	$metabib_full_rec frp
-				  WHERE	frp.record = f.record
-				  	AND frp.tag = '260'
-					AND frp.subfield = 'c'
-				  LIMIT 1
-			)) )
-		RANK
-	} elsif (lc($sort) eq 'create_date') {
-		$rank = <<"		RANK";
-			( FIRST (( SELECT create_date FROM $br_table rbr WHERE rbr.id = f.record)) )
-		RANK
-	} elsif (lc($sort) eq 'edit_date') {
-		$rank = <<"		RANK";
-			( FIRST (( SELECT edit_date FROM $br_table rbr WHERE rbr.id = f.record)) )
-		RANK
-	} elsif (lc($sort) eq 'title') {
-		$rank = <<"		RANK";
-			( FIRST ((
-				SELECT	COALESCE(LTRIM(SUBSTR( frt.value, COALESCE(SUBSTRING(frt.ind2 FROM E'\\\\d+'),'0')::INT + 1 )),'zzzzzzzz')
-				  FROM	$metabib_full_rec frt
-				  WHERE	frt.record = f.record
-				  	AND frt.tag = '245'
-					AND frt.subfield = 'a'
-				  LIMIT 1
-			)) )
-		RANK
-	} elsif (lc($sort) eq 'author') {
-		$rank = <<"		RANK";
-			( FIRST((
-				SELECT	COALESCE(LTRIM(fra.value),'zzzzzzzz')
-				  FROM	$metabib_full_rec fra
-				  WHERE	fra.record = f.record
-				  	AND fra.tag LIKE '1%'
-					AND fra.subfield = 'a'
-				  ORDER BY fra.tag::text::int
-				  LIMIT 1
-			)) )
-		RANK
-	} else {
-		$sort = undef;
-	}
-
-
-	if ($copies_visible) {
-		$select = <<"		SQL";
-			SELECT	f.record, $relevance, count(DISTINCT cp.id), $rank
-	  	  	FROM	$search_table f,
-				$asset_call_number_table cn,
-				$asset_copy_table cp,
-				$cs_table cs,
-				$cl_table cl,
-				$br_table br,
-				$metabib_record_descriptor rd,
-				$descendants d
-	  	  	WHERE	br.id = f.record
-				AND cn.record = f.record
-				AND rd.record = f.record
-				AND cp.status = cs.id
-				AND cp.location = cl.id
-				AND br.deleted IS FALSE
-				AND cn.deleted IS FALSE
-				AND cp.deleted IS FALSE
-				$has_vols
-				$has_copies
-				$copies_visible
-				$t_filter
-				$f_filter
-				$a_filter
-				$l_filter
-				$lf_filter
-	  	  	GROUP BY f.record HAVING count(DISTINCT cp.id) > 0
-	  	  	ORDER BY 4 $sort_dir,3 DESC
-		SQL
-	} else {
-		$select = <<"		SQL";
-			SELECT	f.record, 1, 1, $rank
-	  	  	FROM	$search_table f,
-				$br_table br,
-				$metabib_record_descriptor rd
-	  	  	WHERE	br.id = f.record
-				AND rd.record = f.record
-				AND br.deleted IS FALSE
-				$t_filter
-				$f_filter
-				$a_filter
-				$l_filter
-				$lf_filter
-	  	  	GROUP BY 1,2,3 
-	  	  	ORDER BY 4 $sort_dir
-		SQL
-	}
-
-
-	$log->debug("Search SQL :: [$select]",DEBUG);
-
-	my $recs = metabib::full_rec->db_Main->selectall_arrayref("$select;", {}, @binds);
-	$log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
-
-	my $max = 0;
-	$max = 1 if (!@$recs);
-	for (@$recs) {
-		$max = $$_[1] if ($$_[1] > $max);
-	}
-
-	my $count = @$recs;
-	for my $rec (@$recs[$offset .. $offset + $limit - 1]) {
-		next unless ($$rec[0]);
-		my ($rid,$rank,$junk,$skip) = @$rec;
-		$client->respond( [$rid, sprintf('%0.3f',$rank/$max), $count] );
-	}
-	return undef;
+    my @binds;
+    my @selects;
+
+    for my $arg (@{ $args{searches} }) {
+        my $term     = $$arg{term};
+        my $limiters = $$arg{restrict};
+
+        my ($index_col)  = metabib::full_rec->columns('FTS');
+        $index_col ||= 'value';
+        my $search_table = metabib::full_rec->table;
+
+        my $fts = OpenILS::Application::Storage::FTS->compile('default' => $term, 'value',"$index_col");
+
+        my $fts_where = $fts->sql_where_clause();
+        my @fts_ranks = $fts->fts_rank;
+
+        my $rank = join(' + ', @fts_ranks);
+
+        my @wheres;
+        for my $limit (@$limiters) {
+            if ($$limit{tag} =~ /^\d+$/ and $$limit{tag} < 10) {
+                # MARC control field; mfr.subfield is NULL
+                push @wheres, "( tag = ? AND $fts_where )";
+                push @binds, $$limit{tag};
+                $log->debug("Limiting query using { tag => $$limit{tag} }", DEBUG);
+            } else {
+                push @wheres, "( tag = ? AND subfield LIKE ? AND $fts_where )";
+                push @binds, $$limit{tag}, $$limit{subfield};
+                $log->debug("Limiting query using { tag => $$limit{tag}, subfield => $$limit{subfield} }", DEBUG);
+            }
+        }
+        my $where = join(' OR ', @wheres);
+
+        push @selects, "SELECT record, AVG($rank) as sum FROM $search_table WHERE $where GROUP BY record";
+
+    }
+
+    my $descendants = defined($args{depth}) ?
+                "actor.org_unit_descendants($args{org_unit}, $args{depth})" :
+                "actor.org_unit_descendants($args{org_unit})" ;
+
+
+    my $metabib_record_descriptor = metabib::record_descriptor->table;
+    my $metabib_full_rec = metabib::full_rec->table;
+    my $asset_call_number_table = asset::call_number->table;
+    my $asset_copy_table = asset::copy->table;
+    my $cs_table = config::copy_status->table;
+    my $cl_table = asset::copy_location->table;
+    my $br_table = biblio::record_entry->table;
+
+    my $cj = 'HAVING COUNT(x.record) = ' . scalar(@selects) if ($class_join eq 'AND');
+    my $search_table =
+        '(SELECT x.record, sum(x.sum) FROM (('.
+            join(') UNION ALL (', @selects).
+            ")) x GROUP BY 1 $cj ORDER BY 2 DESC )";
+
+    my $has_vols = 'AND cn.owning_lib = d.id';
+    my $has_copies = 'AND cp.call_number = cn.id';
+    my $copies_visible = 'AND d.opac_visible IS TRUE AND cp.opac_visible IS TRUE AND cs.opac_visible IS TRUE AND cl.opac_visible IS TRUE';
+
+    if ($self->api_name =~ /staff/o) {
+        $copies_visible = '';
+        $has_copies     = '' if ($ou_type == 0);
+        $has_vols       = '' if ($ou_type == 0);
+    }
+
+    my ($t_filter, $f_filter) = ('','');
+    my ($a_filter, $l_filter, $lf_filter) = ('','','');
+
+    if (my $a = $args{audience}) {
+        $a = [$a] if (!ref($a));
+        my @aud = @$a;
+            
+        $a_filter = ' AND rd.audience IN ('.join(',',map{'?'}@aud).')';
+        push @binds, @aud;
+    }
+
+    if (my $l = $args{language}) {
+        $l = [$l] if (!ref($l));
+        my @lang = @$l;
+
+        $l_filter = ' AND rd.item_lang IN ('.join(',',map{'?'}@lang).')';
+        push @binds, @lang;
+    }
+
+    if (my $f = $args{lit_form}) {
+        $f = [$f] if (!ref($f));
+        my @lit_form = @$f;
+
+        $lf_filter = ' AND rd.lit_form IN ('.join(',',map{'?'}@lit_form).')';
+        push @binds, @lit_form;
+    }
+
+    if (my $f = $args{item_form}) {
+        $f = [$f] if (!ref($f));
+        my @forms = @$f;
+
+        $f_filter = ' AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
+        push @binds, @forms;
+    }
+
+    if (my $t = $args{item_type}) {
+        $t = [$t] if (!ref($t));
+        my @types = @$t;
+
+        $t_filter = ' AND rd.item_type IN ('.join(',',map{'?'}@types).')';
+        push @binds, @types;
+    }
+
+
+    if ($args{format}) {
+        my ($t, $f) = split '-', $args{format};
+        my @types = split '', $t;
+        my @forms = split '', $f;
+        if (@types) {
+            $t_filter = ' AND rd.item_type IN ('.join(',',map{'?'}@types).')';
+        }
+
+        if (@forms) {
+            $f_filter .= ' AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
+        }
+        push @binds, @types, @forms;
+    }
+
+    my $relevance = 'sum(f.sum)';
+    $relevance = 1 if (!$copies_visible);
+
+    my $rank = $relevance;
+    if (lc($sort) eq 'pubdate') {
+        $rank = <<"        RANK";
+            ( FIRST ((
+                SELECT  COALESCE(SUBSTRING(frp.value FROM E'\\\\d+'),'9999')::INT
+                  FROM  $metabib_full_rec frp
+                  WHERE frp.record = f.record
+                    AND frp.tag = '260'
+                    AND frp.subfield = 'c'
+                  LIMIT 1
+            )) )
+        RANK
+    } elsif (lc($sort) eq 'create_date') {
+        $rank = <<"        RANK";
+            ( FIRST (( SELECT create_date FROM $br_table rbr WHERE rbr.id = f.record)) )
+        RANK
+    } elsif (lc($sort) eq 'edit_date') {
+        $rank = <<"        RANK";
+            ( FIRST (( SELECT edit_date FROM $br_table rbr WHERE rbr.id = f.record)) )
+        RANK
+    } elsif (lc($sort) eq 'title') {
+        $rank = <<"        RANK";
+            ( FIRST ((
+                SELECT  COALESCE(LTRIM(SUBSTR( frt.value, COALESCE(SUBSTRING(frt.ind2 FROM E'\\\\d+'),'0')::INT + 1 )),'zzzzzzzz')
+                  FROM  $metabib_full_rec frt
+                  WHERE frt.record = f.record
+                    AND frt.tag = '245'
+                    AND frt.subfield = 'a'
+                  LIMIT 1
+            )) )
+        RANK
+    } elsif (lc($sort) eq 'author') {
+        $rank = <<"        RANK";
+            ( FIRST((
+                SELECT  COALESCE(LTRIM(fra.value),'zzzzzzzz')
+                  FROM  $metabib_full_rec fra
+                  WHERE fra.record = f.record
+                    AND fra.tag LIKE '1%'
+                    AND fra.subfield = 'a'
+                  ORDER BY fra.tag::text::int
+                  LIMIT 1
+            )) )
+        RANK
+    } else {
+        $sort = undef;
+    }
+
+
+    if ($copies_visible) {
+        $select = <<"        SQL";
+            SELECT  f.record, $relevance, count(DISTINCT cp.id), $rank
+            FROM    $search_table f,
+                $asset_call_number_table cn,
+                $asset_copy_table cp,
+                $cs_table cs,
+                $cl_table cl,
+                $br_table br,
+                $metabib_record_descriptor rd,
+                $descendants d
+            WHERE   br.id = f.record
+                AND cn.record = f.record
+                AND rd.record = f.record
+                AND cp.status = cs.id
+                AND cp.location = cl.id
+                AND br.deleted IS FALSE
+                AND cn.deleted IS FALSE
+                AND cp.deleted IS FALSE
+                $has_vols
+                $has_copies
+                $copies_visible
+                $t_filter
+                $f_filter
+                $a_filter
+                $l_filter
+                $lf_filter
+            GROUP BY f.record HAVING count(DISTINCT cp.id) > 0
+            ORDER BY 4 $sort_dir,3 DESC
+        SQL
+    } else {
+        $select = <<"        SQL";
+            SELECT  f.record, 1, 1, $rank
+            FROM    $search_table f,
+                $br_table br,
+                $metabib_record_descriptor rd
+            WHERE   br.id = f.record
+                AND rd.record = f.record
+                AND br.deleted IS FALSE
+                $t_filter
+                $f_filter
+                $a_filter
+                $l_filter
+                $lf_filter
+            GROUP BY 1,2,3 
+            ORDER BY 4 $sort_dir
+        SQL
+    }
+
+
+    $log->debug("Search SQL :: [$select]",DEBUG);
+
+    my $recs = metabib::full_rec->db_Main->selectall_arrayref("$select;", {}, @binds);
+    $log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
+
+    my $max = 0;
+    $max = 1 if (!@$recs);
+    for (@$recs) {
+        $max = $$_[1] if ($$_[1] > $max);
+    }
+
+    my $count = @$recs;
+    for my $rec (@$recs[$offset .. $offset + $limit - 1]) {
+        next unless ($$rec[0]);
+        my ($rid,$rank,$junk,$skip) = @$rec;
+        $client->respond( [$rid, sprintf('%0.3f',$rank/$max), $count] );
+    }
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.biblio.full_rec.multi_search',
-	method		=> 'biblio_multi_search_full_rec',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => 'open-ils.storage.biblio.full_rec.multi_search',
+    method      => 'biblio_multi_search_full_rec',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.biblio.full_rec.multi_search.staff',
-	method		=> 'biblio_multi_search_full_rec',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => 'open-ils.storage.biblio.full_rec.multi_search.staff',
+    method      => 'biblio_multi_search_full_rec',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 
 sub search_full_rec {
-	my $self = shift;
-	my $client = shift;
-
-	my %args = @_;
-	
-	my $term = $args{term};
-	my $limiters = $args{restrict};
-
-	my ($index_col) = metabib::full_rec->columns('FTS');
-	$index_col ||= 'value';
-	my $search_table = metabib::full_rec->table;
-
-	my $fts = OpenILS::Application::Storage::FTS->compile('default' => $term, 'value',"$index_col");
-
-	my $fts_where = $fts->sql_where_clause();
-	my @fts_ranks = $fts->fts_rank;
-
-	my $rank = join(' + ', @fts_ranks);
-
-	my @binds;
-	my @wheres;
-	for my $limit (@$limiters) {
-		if ($$limit{tag} =~ /^\d+$/ and $$limit{tag} < 10) {
-			# MARC control field; mfr.subfield is NULL
-			push @wheres, "( tag = ? AND $fts_where )";
-			push @binds, $$limit{tag};
- 			$log->debug("Limiting query using { tag => $$limit{tag} }", DEBUG);
-		} else {
-			push @wheres, "( tag = ? AND subfield LIKE ? AND $fts_where )";
-			push @binds, $$limit{tag}, $$limit{subfield};
- 			$log->debug("Limiting query using { tag => $$limit{tag}, subfield => $$limit{subfield} }", DEBUG);
-		}
-	}
-	my $where = join(' OR ', @wheres);
-
-	my $select = "SELECT record, sum($rank) FROM $search_table WHERE $where GROUP BY 1 ORDER BY 2 DESC;";
-
-	$log->debug("Search SQL :: [$select]",DEBUG);
-
-	my $recs = metabib::full_rec->db_Main->selectall_arrayref($select, {}, @binds);
-	$log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
-
-	$client->respond($_) for (@$recs);
-	return undef;
+    my $self = shift;
+    my $client = shift;
+
+    my %args = @_;
+    
+    my $term = $args{term};
+    my $limiters = $args{restrict};
+
+    my ($index_col) = metabib::full_rec->columns('FTS');
+    $index_col ||= 'value';
+    my $search_table = metabib::full_rec->table;
+
+    my $fts = OpenILS::Application::Storage::FTS->compile('default' => $term, 'value',"$index_col");
+
+    my $fts_where = $fts->sql_where_clause();
+    my @fts_ranks = $fts->fts_rank;
+
+    my $rank = join(' + ', @fts_ranks);
+
+    my @binds;
+    my @wheres;
+    for my $limit (@$limiters) {
+        if ($$limit{tag} =~ /^\d+$/ and $$limit{tag} < 10) {
+            # MARC control field; mfr.subfield is NULL
+            push @wheres, "( tag = ? AND $fts_where )";
+            push @binds, $$limit{tag};
+            $log->debug("Limiting query using { tag => $$limit{tag} }", DEBUG);
+        } else {
+            push @wheres, "( tag = ? AND subfield LIKE ? AND $fts_where )";
+            push @binds, $$limit{tag}, $$limit{subfield};
+            $log->debug("Limiting query using { tag => $$limit{tag}, subfield => $$limit{subfield} }", DEBUG);
+        }
+    }
+    my $where = join(' OR ', @wheres);
+
+    my $select = "SELECT record, sum($rank) FROM $search_table WHERE $where GROUP BY 1 ORDER BY 2 DESC;";
+
+    $log->debug("Search SQL :: [$select]",DEBUG);
+
+    my $recs = metabib::full_rec->db_Main->selectall_arrayref($select, {}, @binds);
+    $log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
+
+    $client->respond($_) for (@$recs);
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.direct.metabib.full_rec.search_fts.value',
-	method		=> 'search_full_rec',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => 'open-ils.storage.direct.metabib.full_rec.search_fts.value',
+    method      => 'search_full_rec',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 __PACKAGE__->register_method(
-	api_name	=> 'open-ils.storage.direct.metabib.full_rec.search_fts.index_vector',
-	method		=> 'search_full_rec',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => 'open-ils.storage.direct.metabib.full_rec.search_fts.index_vector',
+    method      => 'search_full_rec',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 
 
 # XXX factored most of the PG dependant stuff out of here... need to find a way to do "dependants".
 sub search_class_fts {
-	my $self = shift;
-	my $client = shift;
-	my %args = @_;
-	
-	my $term = $args{term};
-	my $ou = $args{org_unit};
-	my $ou_type = $args{depth};
-	my $limit = $args{limit};
-	my $offset = $args{offset};
-
-	my $limit_clause = '';
-	my $offset_clause = '';
-
-	$limit_clause = "LIMIT $limit" if (defined $limit and int($limit) > 0);
-	$offset_clause = "OFFSET $offset" if (defined $offset and int($offset) > 0);
-
-	my (@types, at forms);
-	my ($t_filter, $f_filter) = ('','');
-
-	if ($args{format}) {
-		my ($t, $f) = split '-', $args{format};
-		@types = split '', $t;
-		@forms = split '', $f;
-		if (@types) {
-			$t_filter = ' AND rd.item_type IN ('.join(',',map{'?'}@types).')';
-		}
-
-		if (@forms) {
-			$f_filter .= ' AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
-		}
-	}
-
-
-
-	my $descendants = defined($ou_type) ?
-				"actor.org_unit_descendants($ou, $ou_type)" :
-				"actor.org_unit_descendants($ou)";
-
-	my $class = $self->{cdbi};
-	my $search_table = $class->table;
-
-	my $metabib_record_descriptor = metabib::record_descriptor->table;
-	my $metabib_metarecord = metabib::metarecord->table;
-	my $metabib_metarecord_source_map_table = metabib::metarecord_source_map->table;
-	my $asset_call_number_table = asset::call_number->table;
-	my $asset_copy_table = asset::copy->table;
-	my $cs_table = config::copy_status->table;
-	my $cl_table = asset::copy_location->table;
-
-	my ($index_col) = $class->columns('FTS');
-	$index_col ||= 'value';
-
-	(my $search_class = $self->api_name) =~ s/.*metabib.(\w+).search_fts.*/$1/o;
-	my $fts = OpenILS::Application::Storage::FTS->compile($search_class => $term, 'f.value', "f.$index_col");
-
-	my $fts_where = $fts->sql_where_clause;
-	my @fts_ranks = $fts->fts_rank;
-
-	my $rank = join(' + ', @fts_ranks);
-
-	my $has_vols = 'AND cn.owning_lib = d.id';
-	my $has_copies = 'AND cp.call_number = cn.id';
-	my $copies_visible = 'AND d.opac_visible IS TRUE AND cp.opac_visible IS TRUE AND cs.opac_visible IS TRUE AND cl.opac_visible IS TRUE';
-
-	my $visible_count = ', count(DISTINCT cp.id)';
-	my $visible_count_test = 'HAVING count(DISTINCT cp.id) > 0';
-
-	if ($self->api_name =~ /staff/o) {
-		$copies_visible = '';
-		$visible_count_test = '';
-		$has_copies = '' if ($ou_type == 0);
-		$has_vols = '' if ($ou_type == 0);
-	}
-
-	my $rank_calc = <<"	RANK";
-		, (SUM(	$rank
-			* CASE WHEN f.value ILIKE ? THEN 1.2 ELSE 1 END -- phrase order
-			* CASE WHEN f.value ILIKE ? THEN 1.5 ELSE 1 END -- first word match
-			* CASE WHEN f.value ~* ? THEN 2 ELSE 1 END -- only word match
-		)/COUNT(m.source)), MIN(COALESCE(CHAR_LENGTH(f.value),1))
-	RANK
-
-	$rank_calc = ',1 , 1' if ($self->api_name =~ /unordered/o);
-
-	if ($copies_visible) {
-		$select = <<"		SQL";
-			SELECT	m.metarecord $rank_calc $visible_count, CASE WHEN COUNT(DISTINCT m.source) = 1 THEN MAX(m.source) ELSE MAX(0) END
-	  	  	FROM	$search_table f,
-				$metabib_metarecord_source_map_table m,
-				$asset_call_number_table cn,
-				$asset_copy_table cp,
-				$cs_table cs,
-				$cl_table cl,
-				$metabib_record_descriptor rd,
-				$descendants d
-	  	  	WHERE	$fts_where
-		  		AND m.source = f.source
-				AND cn.record = m.source
-				AND rd.record = m.source
-				AND cp.status = cs.id
-				AND cp.location = cl.id
-				$has_vols
-				$has_copies
-				$copies_visible
-				$t_filter
-				$f_filter
-	  	  	GROUP BY 1 $visible_count_test
-	  	  	ORDER BY 2 DESC,3
-		  	$limit_clause $offset_clause
-		SQL
-	} else {
-		$select = <<"		SQL";
-			SELECT	m.metarecord $rank_calc, 0, CASE WHEN COUNT(DISTINCT m.source) = 1 THEN MAX(m.source) ELSE MAX(0) END
-	  	  	FROM	$search_table f,
-				$metabib_metarecord_source_map_table m,
-				$metabib_record_descriptor rd
-	  	  	WHERE	$fts_where
-		  		AND m.source = f.source
-				AND rd.record = m.source
-				$t_filter
-				$f_filter
-	  	  	GROUP BY 1, 4
-	  	  	ORDER BY 2 DESC,3
-		  	$limit_clause $offset_clause
-		SQL
-	}
-
-	$log->debug("Field Search SQL :: [$select]",DEBUG);
-
-	my $SQLstring = join('%',$fts->words);
-	my $REstring = join('\\s+',$fts->words);
-	my $first_word = ($fts->words)[0].'%';
-	my $recs = ($self->api_name =~ /unordered/o) ? 
-			$class->db_Main->selectall_arrayref($select, {}, @types, @forms) :
-			$class->db_Main->selectall_arrayref($select, {},
-				'%'.lc($SQLstring).'%',			# phrase order match
-				lc($first_word),			# first word match
-				'^\\s*'.lc($REstring).'\\s*/?\s*$',	# full exact match
-				@types, @forms
-			);
-	
-	$log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
-
-	$client->respond($_) for (map { [@$_[0,1,3,4]] } @$recs);
-	return undef;
+    my $self = shift;
+    my $client = shift;
+    my %args = @_;
+    
+    my $term = $args{term};
+    my $ou = $args{org_unit};
+    my $ou_type = $args{depth};
+    my $limit = $args{limit};
+    my $offset = $args{offset};
+
+    my $limit_clause = '';
+    my $offset_clause = '';
+
+    $limit_clause = "LIMIT $limit" if (defined $limit and int($limit) > 0);
+    $offset_clause = "OFFSET $offset" if (defined $offset and int($offset) > 0);
+
+    my (@types, at forms);
+    my ($t_filter, $f_filter) = ('','');
+
+    if ($args{format}) {
+        my ($t, $f) = split '-', $args{format};
+        @types = split '', $t;
+        @forms = split '', $f;
+        if (@types) {
+            $t_filter = ' AND rd.item_type IN ('.join(',',map{'?'}@types).')';
+        }
+
+        if (@forms) {
+            $f_filter .= ' AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
+        }
+    }
+
+
+
+    my $descendants = defined($ou_type) ?
+                "actor.org_unit_descendants($ou, $ou_type)" :
+                "actor.org_unit_descendants($ou)";
+
+    my $class = $self->{cdbi};
+    my $search_table = $class->table;
+
+    my $metabib_record_descriptor = metabib::record_descriptor->table;
+    my $metabib_metarecord = metabib::metarecord->table;
+    my $metabib_metarecord_source_map_table = metabib::metarecord_source_map->table;
+    my $asset_call_number_table = asset::call_number->table;
+    my $asset_copy_table = asset::copy->table;
+    my $cs_table = config::copy_status->table;
+    my $cl_table = asset::copy_location->table;
+
+    my ($index_col) = $class->columns('FTS');
+    $index_col ||= 'value';
+
+    (my $search_class = $self->api_name) =~ s/.*metabib.(\w+).search_fts.*/$1/o;
+    my $fts = OpenILS::Application::Storage::FTS->compile($search_class => $term, 'f.value', "f.$index_col");
+
+    my $fts_where = $fts->sql_where_clause;
+    my @fts_ranks = $fts->fts_rank;
+
+    my $rank = join(' + ', @fts_ranks);
+
+    my $has_vols = 'AND cn.owning_lib = d.id';
+    my $has_copies = 'AND cp.call_number = cn.id';
+    my $copies_visible = 'AND d.opac_visible IS TRUE AND cp.opac_visible IS TRUE AND cs.opac_visible IS TRUE AND cl.opac_visible IS TRUE';
+
+    my $visible_count = ', count(DISTINCT cp.id)';
+    my $visible_count_test = 'HAVING count(DISTINCT cp.id) > 0';
+
+    if ($self->api_name =~ /staff/o) {
+        $copies_visible = '';
+        $visible_count_test = '';
+        $has_copies = '' if ($ou_type == 0);
+        $has_vols = '' if ($ou_type == 0);
+    }
+
+    my $rank_calc = <<"    RANK";
+        , (SUM( $rank
+            * CASE WHEN f.value ILIKE ? THEN 1.2 ELSE 1 END -- phrase order
+            * CASE WHEN f.value ILIKE ? THEN 1.5 ELSE 1 END -- first word match
+            * CASE WHEN f.value ~* ? THEN 2 ELSE 1 END -- only word match
+        )/COUNT(m.source)), MIN(COALESCE(CHAR_LENGTH(f.value),1))
+    RANK
+
+    $rank_calc = ',1 , 1' if ($self->api_name =~ /unordered/o);
+
+    if ($copies_visible) {
+        $select = <<"        SQL";
+            SELECT  m.metarecord $rank_calc $visible_count, CASE WHEN COUNT(DISTINCT m.source) = 1 THEN MAX(m.source) ELSE MAX(0) END
+            FROM    $search_table f,
+                $metabib_metarecord_source_map_table m,
+                $asset_call_number_table cn,
+                $asset_copy_table cp,
+                $cs_table cs,
+                $cl_table cl,
+                $metabib_record_descriptor rd,
+                $descendants d
+            WHERE   $fts_where
+                AND m.source = f.source
+                AND cn.record = m.source
+                AND rd.record = m.source
+                AND cp.status = cs.id
+                AND cp.location = cl.id
+                $has_vols
+                $has_copies
+                $copies_visible
+                $t_filter
+                $f_filter
+            GROUP BY 1 $visible_count_test
+            ORDER BY 2 DESC,3
+            $limit_clause $offset_clause
+        SQL
+    } else {
+        $select = <<"        SQL";
+            SELECT  m.metarecord $rank_calc, 0, CASE WHEN COUNT(DISTINCT m.source) = 1 THEN MAX(m.source) ELSE MAX(0) END
+            FROM    $search_table f,
+                $metabib_metarecord_source_map_table m,
+                $metabib_record_descriptor rd
+            WHERE   $fts_where
+                AND m.source = f.source
+                AND rd.record = m.source
+                $t_filter
+                $f_filter
+            GROUP BY 1, 4
+            ORDER BY 2 DESC,3
+            $limit_clause $offset_clause
+        SQL
+    }
+
+    $log->debug("Field Search SQL :: [$select]",DEBUG);
+
+    my $SQLstring = join('%',$fts->words);
+    my $REstring = join('\\s+',$fts->words);
+    my $first_word = ($fts->words)[0].'%';
+    my $recs = ($self->api_name =~ /unordered/o) ? 
+            $class->db_Main->selectall_arrayref($select, {}, @types, @forms) :
+            $class->db_Main->selectall_arrayref($select, {},
+                '%'.lc($SQLstring).'%',         # phrase order match
+                lc($first_word),            # first word match
+                '^\\s*'.lc($REstring).'\\s*/?\s*$', # full exact match
+                @types, @forms
+            );
+    
+    $log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
+
+    $client->respond($_) for (map { [@$_[0,1,3,4]] } @$recs);
+    return undef;
 }
 
 for my $class ( qw/title author subject keyword series identifier/ ) {
-	__PACKAGE__->register_method(
-		api_name	=> "open-ils.storage.metabib.$class.search_fts.metarecord",
-		method		=> 'search_class_fts',
-		api_level	=> 1,
-		stream		=> 1,
-		cdbi		=> "metabib::${class}_field_entry",
-		cachable	=> 1,
-	);
-	__PACKAGE__->register_method(
-		api_name	=> "open-ils.storage.metabib.$class.search_fts.metarecord.unordered",
-		method		=> 'search_class_fts',
-		api_level	=> 1,
-		stream		=> 1,
-		cdbi		=> "metabib::${class}_field_entry",
-		cachable	=> 1,
-	);
-	__PACKAGE__->register_method(
-		api_name	=> "open-ils.storage.metabib.$class.search_fts.metarecord.staff",
-		method		=> 'search_class_fts',
-		api_level	=> 1,
-		stream		=> 1,
-		cdbi		=> "metabib::${class}_field_entry",
-		cachable	=> 1,
-	);
-	__PACKAGE__->register_method(
-		api_name	=> "open-ils.storage.metabib.$class.search_fts.metarecord.staff.unordered",
-		method		=> 'search_class_fts',
-		api_level	=> 1,
-		stream		=> 1,
-		cdbi		=> "metabib::${class}_field_entry",
-		cachable	=> 1,
-	);
+    __PACKAGE__->register_method(
+        api_name    => "open-ils.storage.metabib.$class.search_fts.metarecord",
+        method      => 'search_class_fts',
+        api_level   => 1,
+        stream      => 1,
+        cdbi        => "metabib::${class}_field_entry",
+        cachable    => 1,
+    );
+    __PACKAGE__->register_method(
+        api_name    => "open-ils.storage.metabib.$class.search_fts.metarecord.unordered",
+        method      => 'search_class_fts',
+        api_level   => 1,
+        stream      => 1,
+        cdbi        => "metabib::${class}_field_entry",
+        cachable    => 1,
+    );
+    __PACKAGE__->register_method(
+        api_name    => "open-ils.storage.metabib.$class.search_fts.metarecord.staff",
+        method      => 'search_class_fts',
+        api_level   => 1,
+        stream      => 1,
+        cdbi        => "metabib::${class}_field_entry",
+        cachable    => 1,
+    );
+    __PACKAGE__->register_method(
+        api_name    => "open-ils.storage.metabib.$class.search_fts.metarecord.staff.unordered",
+        method      => 'search_class_fts',
+        api_level   => 1,
+        stream      => 1,
+        cdbi        => "metabib::${class}_field_entry",
+        cachable    => 1,
+    );
 }
 
 # XXX factored most of the PG dependant stuff out of here... need to find a way to do "dependants".
 sub search_class_fts_count {
-	my $self = shift;
-	my $client = shift;
-	my %args = @_;
-	
-	my $term = $args{term};
-	my $ou = $args{org_unit};
-	my $ou_type = $args{depth};
-	my $limit = $args{limit} || 100;
-	my $offset = $args{offset} || 0;
-
-	my $descendants = defined($ou_type) ?
-				"actor.org_unit_descendants($ou, $ou_type)" :
-				"actor.org_unit_descendants($ou)";
-		
-	my (@types, at forms);
-	my ($t_filter, $f_filter) = ('','');
-
-	if ($args{format}) {
-		my ($t, $f) = split '-', $args{format};
-		@types = split '', $t;
-		@forms = split '', $f;
-		if (@types) {
-			$t_filter = ' AND rd.item_type IN ('.join(',',map{'?'}@types).')';
-		}
-
-		if (@forms) {
-			$f_filter .= ' AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
-		}
-	}
-
-
-	(my $search_class = $self->api_name) =~ s/.*metabib.(\w+).search_fts.*/$1/o;
-
-	my $class = $self->{cdbi};
-	my $search_table = $class->table;
-
-	my $metabib_record_descriptor = metabib::record_descriptor->table;
-	my $metabib_metarecord_source_map_table = metabib::metarecord_source_map->table;
-	my $asset_call_number_table = asset::call_number->table;
-	my $asset_copy_table = asset::copy->table;
-	my $cs_table = config::copy_status->table;
-	my $cl_table = asset::copy_location->table;
-
-	my ($index_col) = $class->columns('FTS');
-	$index_col ||= 'value';
-
-	my $fts = OpenILS::Application::Storage::FTS->compile($search_class => $term, 'value',"$index_col");
-
-	my $fts_where = $fts->sql_where_clause;
-
-	my $has_vols = 'AND cn.owning_lib = d.id';
-	my $has_copies = 'AND cp.call_number = cn.id';
-	my $copies_visible = 'AND d.opac_visible IS TRUE AND cp.opac_visible IS TRUE AND cs.opac_visible IS TRUE AND cl.opac_visible IS TRUE';
-	if ($self->api_name =~ /staff/o) {
-		$copies_visible = '';
-		$has_vols = '' if ($ou_type == 0);
-		$has_copies = '' if ($ou_type == 0);
-	}
-
-	# XXX test an "EXISTS version of descendant checking...
-	my $select;
-	if ($copies_visible) {
-		$select = <<"		SQL";
-		SELECT	count(distinct  m.metarecord)
-	  	  FROM	$search_table f,
-			$metabib_metarecord_source_map_table m,
-			$metabib_metarecord_source_map_table mr,
-			$asset_call_number_table cn,
-			$asset_copy_table cp,
-			$cs_table cs,
-			$cl_table cl,
-			$metabib_record_descriptor rd,
-			$descendants d
-	  	  WHERE	$fts_where
-		  	AND mr.source = f.source
-			AND mr.metarecord = m.metarecord
-			AND cn.record = m.source
-			AND rd.record = m.source
-			AND cp.status = cs.id
-			AND cp.location = cl.id
-			$has_vols
-			$has_copies
-			$copies_visible
-			$t_filter
-			$f_filter
-		SQL
-	} else {
-		$select = <<"		SQL";
-		SELECT	count(distinct  m.metarecord)
-	  	  FROM	$search_table f,
-			$metabib_metarecord_source_map_table m,
-			$metabib_metarecord_source_map_table mr,
-			$metabib_record_descriptor rd
-	  	  WHERE	$fts_where
-		  	AND mr.source = f.source
-			AND mr.metarecord = m.metarecord
-			AND rd.record = m.source
-			$t_filter
-			$f_filter
-		SQL
-	}
-
-	$log->debug("Field Search Count SQL :: [$select]",DEBUG);
-
-	my $recs = $class->db_Main->selectrow_arrayref($select, {}, @types, @forms)->[0];
-	
-	$log->debug("Count Search yielded $recs results.",DEBUG);
-
-	return $recs;
+    my $self = shift;
+    my $client = shift;
+    my %args = @_;
+    
+    my $term = $args{term};
+    my $ou = $args{org_unit};
+    my $ou_type = $args{depth};
+    my $limit = $args{limit} || 100;
+    my $offset = $args{offset} || 0;
+
+    my $descendants = defined($ou_type) ?
+                "actor.org_unit_descendants($ou, $ou_type)" :
+                "actor.org_unit_descendants($ou)";
+        
+    my (@types, at forms);
+    my ($t_filter, $f_filter) = ('','');
+
+    if ($args{format}) {
+        my ($t, $f) = split '-', $args{format};
+        @types = split '', $t;
+        @forms = split '', $f;
+        if (@types) {
+            $t_filter = ' AND rd.item_type IN ('.join(',',map{'?'}@types).')';
+        }
+
+        if (@forms) {
+            $f_filter .= ' AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
+        }
+    }
+
+
+    (my $search_class = $self->api_name) =~ s/.*metabib.(\w+).search_fts.*/$1/o;
+
+    my $class = $self->{cdbi};
+    my $search_table = $class->table;
+
+    my $metabib_record_descriptor = metabib::record_descriptor->table;
+    my $metabib_metarecord_source_map_table = metabib::metarecord_source_map->table;
+    my $asset_call_number_table = asset::call_number->table;
+    my $asset_copy_table = asset::copy->table;
+    my $cs_table = config::copy_status->table;
+    my $cl_table = asset::copy_location->table;
+
+    my ($index_col) = $class->columns('FTS');
+    $index_col ||= 'value';
+
+    my $fts = OpenILS::Application::Storage::FTS->compile($search_class => $term, 'value',"$index_col");
+
+    my $fts_where = $fts->sql_where_clause;
+
+    my $has_vols = 'AND cn.owning_lib = d.id';
+    my $has_copies = 'AND cp.call_number = cn.id';
+    my $copies_visible = 'AND d.opac_visible IS TRUE AND cp.opac_visible IS TRUE AND cs.opac_visible IS TRUE AND cl.opac_visible IS TRUE';
+    if ($self->api_name =~ /staff/o) {
+        $copies_visible = '';
+        $has_vols = '' if ($ou_type == 0);
+        $has_copies = '' if ($ou_type == 0);
+    }
+
+    # XXX test an "EXISTS version of descendant checking...
+    my $select;
+    if ($copies_visible) {
+        $select = <<"        SQL";
+        SELECT  count(distinct  m.metarecord)
+          FROM  $search_table f,
+            $metabib_metarecord_source_map_table m,
+            $metabib_metarecord_source_map_table mr,
+            $asset_call_number_table cn,
+            $asset_copy_table cp,
+            $cs_table cs,
+            $cl_table cl,
+            $metabib_record_descriptor rd,
+            $descendants d
+          WHERE $fts_where
+            AND mr.source = f.source
+            AND mr.metarecord = m.metarecord
+            AND cn.record = m.source
+            AND rd.record = m.source
+            AND cp.status = cs.id
+            AND cp.location = cl.id
+            $has_vols
+            $has_copies
+            $copies_visible
+            $t_filter
+            $f_filter
+        SQL
+    } else {
+        $select = <<"        SQL";
+        SELECT  count(distinct  m.metarecord)
+          FROM  $search_table f,
+            $metabib_metarecord_source_map_table m,
+            $metabib_metarecord_source_map_table mr,
+            $metabib_record_descriptor rd
+          WHERE $fts_where
+            AND mr.source = f.source
+            AND mr.metarecord = m.metarecord
+            AND rd.record = m.source
+            $t_filter
+            $f_filter
+        SQL
+    }
+
+    $log->debug("Field Search Count SQL :: [$select]",DEBUG);
+
+    my $recs = $class->db_Main->selectrow_arrayref($select, {}, @types, @forms)->[0];
+    
+    $log->debug("Count Search yielded $recs results.",DEBUG);
+
+    return $recs;
 
 }
 for my $class ( qw/title author subject keyword series identifier/ ) {
-	__PACKAGE__->register_method(
-		api_name	=> "open-ils.storage.metabib.$class.search_fts.metarecord_count",
-		method		=> 'search_class_fts_count',
-		api_level	=> 1,
-		stream		=> 1,
-		cdbi		=> "metabib::${class}_field_entry",
-		cachable	=> 1,
-	);
-	__PACKAGE__->register_method(
-		api_name	=> "open-ils.storage.metabib.$class.search_fts.metarecord_count.staff",
-		method		=> 'search_class_fts_count',
-		api_level	=> 1,
-		stream		=> 1,
-		cdbi		=> "metabib::${class}_field_entry",
-		cachable	=> 1,
-	);
+    __PACKAGE__->register_method(
+        api_name    => "open-ils.storage.metabib.$class.search_fts.metarecord_count",
+        method      => 'search_class_fts_count',
+        api_level   => 1,
+        stream      => 1,
+        cdbi        => "metabib::${class}_field_entry",
+        cachable    => 1,
+    );
+    __PACKAGE__->register_method(
+        api_name    => "open-ils.storage.metabib.$class.search_fts.metarecord_count.staff",
+        method      => 'search_class_fts_count',
+        api_level   => 1,
+        stream      => 1,
+        cdbi        => "metabib::${class}_field_entry",
+        cachable    => 1,
+    );
 }
 
 
 # XXX factored most of the PG dependant stuff out of here... need to find a way to do "dependants".
 sub postfilter_search_class_fts {
-	my $self = shift;
-	my $client = shift;
-	my %args = @_;
-	
-	my $term = $args{term};
-	my $sort = $args{'sort'};
-	my $sort_dir = $args{sort_dir} || 'DESC';
-	my $ou = $args{org_unit};
-	my $ou_type = $args{depth};
-	my $limit = $args{limit} || 10;
-	my $visibility_limit = $args{visibility_limit} || 5000;
-	my $offset = $args{offset} || 0;
-
-	my $outer_limit = 1000;
-
-	my $limit_clause = '';
-	my $offset_clause = '';
-
-	$limit_clause = "LIMIT $outer_limit";
-	$offset_clause = "OFFSET $offset" if (defined $offset and int($offset) > 0);
-
-	my (@types, at forms, at lang, at aud, at lit_form);
-	my ($t_filter, $f_filter) = ('','');
-	my ($a_filter, $l_filter, $lf_filter) = ('','','');
-	my ($ot_filter, $of_filter) = ('','');
-	my ($oa_filter, $ol_filter, $olf_filter) = ('','','');
-
-	if (my $a = $args{audience}) {
-		$a = [$a] if (!ref($a));
-		@aud = @$a;
-			
-		$a_filter = ' AND rd.audience IN ('.join(',',map{'?'}@aud).')';
-		$oa_filter = ' AND ord.audience IN ('.join(',',map{'?'}@aud).')';
-	}
-
-	if (my $l = $args{language}) {
-		$l = [$l] if (!ref($l));
-		@lang = @$l;
-
-		$l_filter = ' AND rd.item_lang IN ('.join(',',map{'?'}@lang).')';
-		$ol_filter = ' AND ord.item_lang IN ('.join(',',map{'?'}@lang).')';
-	}
-
-	if (my $f = $args{lit_form}) {
-		$f = [$f] if (!ref($f));
-		@lit_form = @$f;
-
-		$lf_filter = ' AND rd.lit_form IN ('.join(',',map{'?'}@lit_form).')';
-		$olf_filter = ' AND ord.lit_form IN ('.join(',',map{'?'}@lit_form).')';
-	}
-
-	if ($args{format}) {
-		my ($t, $f) = split '-', $args{format};
-		@types = split '', $t;
-		@forms = split '', $f;
-		if (@types) {
-			$t_filter = ' AND rd.item_type IN ('.join(',',map{'?'}@types).')';
-			$ot_filter = ' AND ord.item_type IN ('.join(',',map{'?'}@types).')';
-		}
-
-		if (@forms) {
-			$f_filter .= ' AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
-			$of_filter .= ' AND ord.item_form IN ('.join(',',map{'?'}@forms).')';
-		}
-	}
-
-
-	my $descendants = defined($ou_type) ?
-				"actor.org_unit_descendants($ou, $ou_type)" :
-				"actor.org_unit_descendants($ou)";
-
-	my $class = $self->{cdbi};
-	my $search_table = $class->table;
-
-	my $metabib_full_rec = metabib::full_rec->table;
-	my $metabib_record_descriptor = metabib::record_descriptor->table;
-	my $metabib_metarecord = metabib::metarecord->table;
-	my $metabib_metarecord_source_map_table = metabib::metarecord_source_map->table;
-	my $asset_call_number_table = asset::call_number->table;
-	my $asset_copy_table = asset::copy->table;
-	my $cs_table = config::copy_status->table;
-	my $cl_table = asset::copy_location->table;
-	my $br_table = biblio::record_entry->table;
-
-	my ($index_col) = $class->columns('FTS');
-	$index_col ||= 'value';
-
-	(my $search_class = $self->api_name) =~ s/.*metabib.(\w+).post_filter.*/$1/o;
-
-	my $fts = OpenILS::Application::Storage::FTS->compile($search_class => $term, 'f.value', "f.$index_col");
-
-	my $SQLstring = join('%',map { lc($_) } $fts->words);
-	my $REstring = '^' . join('\s+',map { lc($_) } $fts->words) . '\W*$';
-	my $first_word = lc(($fts->words)[0]).'%';
-
-	my $fts_where = $fts->sql_where_clause;
-	my @fts_ranks = $fts->fts_rank;
-
-	my %bonus = ();
-	$bonus{'metabib::identifier_field_entry'} =
+    my $self = shift;
+    my $client = shift;
+    my %args = @_;
+    
+    my $term = $args{term};
+    my $sort = $args{'sort'};
+    my $sort_dir = $args{sort_dir} || 'DESC';
+    my $ou = $args{org_unit};
+    my $ou_type = $args{depth};
+    my $limit = $args{limit} || 10;
+    my $visibility_limit = $args{visibility_limit} || 5000;
+    my $offset = $args{offset} || 0;
+
+    my $outer_limit = 1000;
+
+    my $limit_clause = '';
+    my $offset_clause = '';
+
+    $limit_clause = "LIMIT $outer_limit";
+    $offset_clause = "OFFSET $offset" if (defined $offset and int($offset) > 0);
+
+    my (@types, at forms, at lang, at aud, at lit_form);
+    my ($t_filter, $f_filter) = ('','');
+    my ($a_filter, $l_filter, $lf_filter) = ('','','');
+    my ($ot_filter, $of_filter) = ('','');
+    my ($oa_filter, $ol_filter, $olf_filter) = ('','','');
+
+    if (my $a = $args{audience}) {
+        $a = [$a] if (!ref($a));
+        @aud = @$a;
+            
+        $a_filter = ' AND rd.audience IN ('.join(',',map{'?'}@aud).')';
+        $oa_filter = ' AND ord.audience IN ('.join(',',map{'?'}@aud).')';
+    }
+
+    if (my $l = $args{language}) {
+        $l = [$l] if (!ref($l));
+        @lang = @$l;
+
+        $l_filter = ' AND rd.item_lang IN ('.join(',',map{'?'}@lang).')';
+        $ol_filter = ' AND ord.item_lang IN ('.join(',',map{'?'}@lang).')';
+    }
+
+    if (my $f = $args{lit_form}) {
+        $f = [$f] if (!ref($f));
+        @lit_form = @$f;
+
+        $lf_filter = ' AND rd.lit_form IN ('.join(',',map{'?'}@lit_form).')';
+        $olf_filter = ' AND ord.lit_form IN ('.join(',',map{'?'}@lit_form).')';
+    }
+
+    if ($args{format}) {
+        my ($t, $f) = split '-', $args{format};
+        @types = split '', $t;
+        @forms = split '', $f;
+        if (@types) {
+            $t_filter = ' AND rd.item_type IN ('.join(',',map{'?'}@types).')';
+            $ot_filter = ' AND ord.item_type IN ('.join(',',map{'?'}@types).')';
+        }
+
+        if (@forms) {
+            $f_filter .= ' AND rd.item_form IN ('.join(',',map{'?'}@forms).')';
+            $of_filter .= ' AND ord.item_form IN ('.join(',',map{'?'}@forms).')';
+        }
+    }
+
+
+    my $descendants = defined($ou_type) ?
+                "actor.org_unit_descendants($ou, $ou_type)" :
+                "actor.org_unit_descendants($ou)";
+
+    my $class = $self->{cdbi};
+    my $search_table = $class->table;
+
+    my $metabib_full_rec = metabib::full_rec->table;
+    my $metabib_record_descriptor = metabib::record_descriptor->table;
+    my $metabib_metarecord = metabib::metarecord->table;
+    my $metabib_metarecord_source_map_table = metabib::metarecord_source_map->table;
+    my $asset_call_number_table = asset::call_number->table;
+    my $asset_copy_table = asset::copy->table;
+    my $cs_table = config::copy_status->table;
+    my $cl_table = asset::copy_location->table;
+    my $br_table = biblio::record_entry->table;
+
+    my ($index_col) = $class->columns('FTS');
+    $index_col ||= 'value';
+
+    (my $search_class = $self->api_name) =~ s/.*metabib.(\w+).post_filter.*/$1/o;
+
+    my $fts = OpenILS::Application::Storage::FTS->compile($search_class => $term, 'f.value', "f.$index_col");
+
+    my $SQLstring = join('%',map { lc($_) } $fts->words);
+    my $REstring = '^' . join('\s+',map { lc($_) } $fts->words) . '\W*$';
+    my $first_word = lc(($fts->words)[0]).'%';
+
+    my $fts_where = $fts->sql_where_clause;
+    my @fts_ranks = $fts->fts_rank;
+
+    my %bonus = ();
+    $bonus{'metabib::identifier_field_entry'} =
         $bonus{'metabib::keyword_field_entry'} = [
             { 'CASE WHEN f.value ILIKE ? THEN 1.2 ELSE 1 END' => $SQLstring }
         ];
 
-	$bonus{'metabib::title_field_entry'} =
-		$bonus{'metabib::series_field_entry'} = [
-			{ 'CASE WHEN f.value ILIKE ? THEN 1.5 ELSE 1 END' => $first_word },
-			{ 'CASE WHEN f.value ~* ? THEN 2 ELSE 1 END' => $REstring },
-			@{ $bonus{'metabib::keyword_field_entry'} }
-		];
-
-	my $bonus_list = join ' * ', map { keys %$_ } @{ $bonus{$class} };
-	$bonus_list ||= '1';
-
-	my @bonus_values = map { values %$_ } @{ $bonus{$class} };
-
-	my $relevance = join(' + ', @fts_ranks);
-	$relevance = <<"	RANK";
-			(SUM( ( $relevance )  * ( $bonus_list ) )/COUNT(m.source))
-	RANK
-
-	my $string_default_sort = 'zzzz';
-	$string_default_sort = 'AAAA' if ($sort_dir eq 'DESC');
-
-	my $number_default_sort = '9999';
-	$number_default_sort = '0000' if ($sort_dir eq 'DESC');
-
-	my $rank = $relevance;
-	if (lc($sort) eq 'pubdate') {
-		$rank = <<"		RANK";
-			( FIRST ((
-				SELECT	COALESCE(SUBSTRING(frp.value FROM E'\\\\d+'),'$number_default_sort')::INT
-				  FROM	$metabib_full_rec frp
-				  WHERE	frp.record = mr.master_record
-				  	AND frp.tag = '260'
-					AND frp.subfield = 'c'
-				  LIMIT 1
-			)) )
-		RANK
-	} elsif (lc($sort) eq 'create_date') {
-		$rank = <<"		RANK";
-			( FIRST (( SELECT create_date FROM $br_table rbr WHERE rbr.id = mr.master_record)) )
-		RANK
-	} elsif (lc($sort) eq 'edit_date') {
-		$rank = <<"		RANK";
-			( FIRST (( SELECT edit_date FROM $br_table rbr WHERE rbr.id = mr.master_record)) )
-		RANK
-	} elsif (lc($sort) eq 'title') {
-		$rank = <<"		RANK";
-			( FIRST ((
-				SELECT	COALESCE(LTRIM(SUBSTR( frt.value, COALESCE(SUBSTRING(frt.ind2 FROM E'\\\\d+'),'0')::INT + 1 )),'$string_default_sort')
-				  FROM	$metabib_full_rec frt
-				  WHERE	frt.record = mr.master_record
-				  	AND frt.tag = '245'
-					AND frt.subfield = 'a'
-				  LIMIT 1
-			)) )
-		RANK
-	} elsif (lc($sort) eq 'author') {
-		$rank = <<"		RANK";
-			( FIRST((
-				SELECT	COALESCE(LTRIM(fra.value),'$string_default_sort')
-				  FROM	$metabib_full_rec fra
-				  WHERE	fra.record = mr.master_record
-				  	AND fra.tag LIKE '1%'
-					AND fra.subfield = 'a'
-				  ORDER BY fra.tag::text::int
-				  LIMIT 1
-			)) )
-		RANK
-	} else {
-		$sort = undef;
-	}
-
-	my $select = <<"	SQL";
-		SELECT	m.metarecord,
-			$relevance,
-			CASE WHEN COUNT(DISTINCT smrs.source) = 1 THEN MIN(m.source) ELSE 0 END,
-			$rank
-  	  	FROM	$search_table f,
-			$metabib_metarecord_source_map_table m,
-			$metabib_metarecord_source_map_table smrs,
-			$metabib_metarecord mr,
-			$metabib_record_descriptor rd
-  	  	WHERE	$fts_where
-	  		AND smrs.metarecord = mr.id
-	  		AND m.source = f.source
-	  		AND m.metarecord = mr.id
-			AND rd.record = smrs.source
-			$t_filter
-			$f_filter
-			$a_filter
-			$l_filter
-			$lf_filter
-  	  	GROUP BY m.metarecord
-  	  	ORDER BY 4 $sort_dir, MIN(COALESCE(CHAR_LENGTH(f.value),1))
-		LIMIT $visibility_limit
-	SQL
-
-	if (0) {
-		$select = <<"		SQL";
-
-			SELECT	DISTINCT s.*
-			  FROM	$asset_call_number_table cn,
-				$metabib_metarecord_source_map_table mrs,
-				$asset_copy_table cp,
-				$cs_table cs,
-				$cl_table cl,
-				$br_table br,
-				$descendants d,
-				$metabib_record_descriptor ord,
-				($select) s
-			  WHERE	mrs.metarecord = s.metarecord
-				AND br.id = mrs.source
-				AND cn.record = mrs.source
-				AND cp.status = cs.id
-				AND cp.location = cl.id
-				AND cn.owning_lib = d.id
-				AND cp.call_number = cn.id
-				AND cp.opac_visible IS TRUE
-				AND cs.opac_visible IS TRUE
-				AND cl.opac_visible IS TRUE
-				AND d.opac_visible IS TRUE
-				AND br.active IS TRUE
-				AND br.deleted IS FALSE
-				AND ord.record = mrs.source
-				$ot_filter
-				$of_filter
-				$oa_filter
-				$ol_filter
-				$olf_filter
-			  ORDER BY 4 $sort_dir
-		SQL
-	} elsif ($self->api_name !~ /staff/o) {
-		$select = <<"		SQL";
-
-			SELECT	DISTINCT s.*
-			  FROM	($select) s
-			  WHERE	EXISTS (
-			  	SELECT	1
-				  FROM	$asset_call_number_table cn,
-					$metabib_metarecord_source_map_table mrs,
-					$asset_copy_table cp,
-					$cs_table cs,
-					$cl_table cl,
-					$br_table br,
-					$descendants d,
-					$metabib_record_descriptor ord
-				
-				  WHERE	mrs.metarecord = s.metarecord
-					AND br.id = mrs.source
-					AND cn.record = mrs.source
-					AND cp.status = cs.id
-					AND cp.location = cl.id
-					AND cp.circ_lib = d.id
-					AND cp.call_number = cn.id
-					AND cp.opac_visible IS TRUE
-					AND cs.opac_visible IS TRUE
-					AND cl.opac_visible IS TRUE
-					AND d.opac_visible IS TRUE
-					AND br.active IS TRUE
-					AND br.deleted IS FALSE
-					AND ord.record = mrs.source
-					$ot_filter
-					$of_filter
-					$oa_filter
-					$ol_filter
-					$olf_filter
-				  LIMIT 1
-				)
-			  ORDER BY 4 $sort_dir
-		SQL
-	} else {
-		$select = <<"		SQL";
-
-			SELECT	DISTINCT s.*
-			  FROM	($select) s
-			  WHERE	EXISTS (
-			  	SELECT	1
-				  FROM	$asset_call_number_table cn,
-					$asset_copy_table cp,
-					$metabib_metarecord_source_map_table mrs,
-					$br_table br,
-					$descendants d,
-					$metabib_record_descriptor ord
-				
-				  WHERE	mrs.metarecord = s.metarecord
-					AND br.id = mrs.source
-					AND cn.record = mrs.source
-					AND cn.id = cp.call_number
-					AND br.deleted IS FALSE
-					AND cn.deleted IS FALSE
-					AND ord.record = mrs.source
-					AND (	cn.owning_lib = d.id
-						OR (	cp.circ_lib = d.id
-							AND cp.deleted IS FALSE
-						)
-					)
-					$ot_filter
-					$of_filter
-					$oa_filter
-					$ol_filter
-					$olf_filter
-				  LIMIT 1
-				)
-				OR NOT EXISTS (
-				SELECT	1
-				  FROM	$asset_call_number_table cn,
-					$metabib_metarecord_source_map_table mrs,
-					$metabib_record_descriptor ord
-				  WHERE	mrs.metarecord = s.metarecord
-					AND cn.record = mrs.source
-					AND ord.record = mrs.source
-					$ot_filter
-					$of_filter
-					$oa_filter
-					$ol_filter
-					$olf_filter
-				  LIMIT 1
-				)
-			  ORDER BY 4 $sort_dir
-		SQL
-	}
-
-
-	$log->debug("Field Search SQL :: [$select]",DEBUG);
-
-	my $recs = $class->db_Main->selectall_arrayref(
-			$select, {},
-			(@bonus_values > 0 ? @bonus_values : () ),
-			( (!$sort && @bonus_values > 0) ? @bonus_values : () ),
-			@types, @forms, @aud, @lang, @lit_form,
-			@types, @forms, @aud, @lang, @lit_form,
-			($self->api_name =~ /staff/o ? (@types, @forms, @aud, @lang, @lit_form) : () ) );
-	
-	$log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
-
-	my $max = 0;
-	$max = 1 if (!@$recs);
-	for (@$recs) {
-		$max = $$_[1] if ($$_[1] > $max);
-	}
-
-	my $count = scalar(@$recs);
-	for my $rec (@$recs[$offset .. $offset + $limit - 1]) {
-		my ($mrid,$rank,$skip) = @$rec;
-		$client->respond( [$mrid, sprintf('%0.3f',$rank/$max), $skip, $count] );
-	}
-	return undef;
+    $bonus{'metabib::title_field_entry'} =
+        $bonus{'metabib::series_field_entry'} = [
+            { 'CASE WHEN f.value ILIKE ? THEN 1.5 ELSE 1 END' => $first_word },
+            { 'CASE WHEN f.value ~* ? THEN 2 ELSE 1 END' => $REstring },
+            @{ $bonus{'metabib::keyword_field_entry'} }
+        ];
+
+    my $bonus_list = join ' * ', map { keys %$_ } @{ $bonus{$class} };
+    $bonus_list ||= '1';
+
+    my @bonus_values = map { values %$_ } @{ $bonus{$class} };
+
+    my $relevance = join(' + ', @fts_ranks);
+    $relevance = <<"    RANK";
+            (SUM( ( $relevance )  * ( $bonus_list ) )/COUNT(m.source))
+    RANK
+
+    my $string_default_sort = 'zzzz';
+    $string_default_sort = 'AAAA' if ($sort_dir eq 'DESC');
+
+    my $number_default_sort = '9999';
+    $number_default_sort = '0000' if ($sort_dir eq 'DESC');
+
+    my $rank = $relevance;
+    if (lc($sort) eq 'pubdate') {
+        $rank = <<"        RANK";
+            ( FIRST ((
+                SELECT  COALESCE(SUBSTRING(frp.value FROM E'\\\\d+'),'$number_default_sort')::INT
+                  FROM  $metabib_full_rec frp
+                  WHERE frp.record = mr.master_record
+                    AND frp.tag = '260'
+                    AND frp.subfield = 'c'
+                  LIMIT 1
+            )) )
+        RANK
+    } elsif (lc($sort) eq 'create_date') {
+        $rank = <<"        RANK";
+            ( FIRST (( SELECT create_date FROM $br_table rbr WHERE rbr.id = mr.master_record)) )
+        RANK
+    } elsif (lc($sort) eq 'edit_date') {
+        $rank = <<"        RANK";
+            ( FIRST (( SELECT edit_date FROM $br_table rbr WHERE rbr.id = mr.master_record)) )
+        RANK
+    } elsif (lc($sort) eq 'title') {
+        $rank = <<"        RANK";
+            ( FIRST ((
+                SELECT  COALESCE(LTRIM(SUBSTR( frt.value, COALESCE(SUBSTRING(frt.ind2 FROM E'\\\\d+'),'0')::INT + 1 )),'$string_default_sort')
+                  FROM  $metabib_full_rec frt
+                  WHERE frt.record = mr.master_record
+                    AND frt.tag = '245'
+                    AND frt.subfield = 'a'
+                  LIMIT 1
+            )) )
+        RANK
+    } elsif (lc($sort) eq 'author') {
+        $rank = <<"        RANK";
+            ( FIRST((
+                SELECT  COALESCE(LTRIM(fra.value),'$string_default_sort')
+                  FROM  $metabib_full_rec fra
+                  WHERE fra.record = mr.master_record
+                    AND fra.tag LIKE '1%'
+                    AND fra.subfield = 'a'
+                  ORDER BY fra.tag::text::int
+                  LIMIT 1
+            )) )
+        RANK
+    } else {
+        $sort = undef;
+    }
+
+    my $select = <<"    SQL";
+        SELECT  m.metarecord,
+            $relevance,
+            CASE WHEN COUNT(DISTINCT smrs.source) = 1 THEN MIN(m.source) ELSE 0 END,
+            $rank
+        FROM    $search_table f,
+            $metabib_metarecord_source_map_table m,
+            $metabib_metarecord_source_map_table smrs,
+            $metabib_metarecord mr,
+            $metabib_record_descriptor rd
+        WHERE   $fts_where
+            AND smrs.metarecord = mr.id
+            AND m.source = f.source
+            AND m.metarecord = mr.id
+            AND rd.record = smrs.source
+            $t_filter
+            $f_filter
+            $a_filter
+            $l_filter
+            $lf_filter
+        GROUP BY m.metarecord
+        ORDER BY 4 $sort_dir, MIN(COALESCE(CHAR_LENGTH(f.value),1))
+        LIMIT $visibility_limit
+    SQL
+
+    if (0) {
+        $select = <<"        SQL";
+
+            SELECT  DISTINCT s.*
+              FROM  $asset_call_number_table cn,
+                $metabib_metarecord_source_map_table mrs,
+                $asset_copy_table cp,
+                $cs_table cs,
+                $cl_table cl,
+                $br_table br,
+                $descendants d,
+                $metabib_record_descriptor ord,
+                ($select) s
+              WHERE mrs.metarecord = s.metarecord
+                AND br.id = mrs.source
+                AND cn.record = mrs.source
+                AND cp.status = cs.id
+                AND cp.location = cl.id
+                AND cn.owning_lib = d.id
+                AND cp.call_number = cn.id
+                AND cp.opac_visible IS TRUE
+                AND cs.opac_visible IS TRUE
+                AND cl.opac_visible IS TRUE
+                AND d.opac_visible IS TRUE
+                AND br.active IS TRUE
+                AND br.deleted IS FALSE
+                AND ord.record = mrs.source
+                $ot_filter
+                $of_filter
+                $oa_filter
+                $ol_filter
+                $olf_filter
+              ORDER BY 4 $sort_dir
+        SQL
+    } elsif ($self->api_name !~ /staff/o) {
+        $select = <<"        SQL";
+
+            SELECT  DISTINCT s.*
+              FROM  ($select) s
+              WHERE EXISTS (
+                SELECT  1
+                  FROM  $asset_call_number_table cn,
+                    $metabib_metarecord_source_map_table mrs,
+                    $asset_copy_table cp,
+                    $cs_table cs,
+                    $cl_table cl,
+                    $br_table br,
+                    $descendants d,
+                    $metabib_record_descriptor ord
+                
+                  WHERE mrs.metarecord = s.metarecord
+                    AND br.id = mrs.source
+                    AND cn.record = mrs.source
+                    AND cp.status = cs.id
+                    AND cp.location = cl.id
+                    AND cp.circ_lib = d.id
+                    AND cp.call_number = cn.id
+                    AND cp.opac_visible IS TRUE
+                    AND cs.opac_visible IS TRUE
+                    AND cl.opac_visible IS TRUE
+                    AND d.opac_visible IS TRUE
+                    AND br.active IS TRUE
+                    AND br.deleted IS FALSE
+                    AND ord.record = mrs.source
+                    $ot_filter
+                    $of_filter
+                    $oa_filter
+                    $ol_filter
+                    $olf_filter
+                  LIMIT 1
+                )
+              ORDER BY 4 $sort_dir
+        SQL
+    } else {
+        $select = <<"        SQL";
+
+            SELECT  DISTINCT s.*
+              FROM  ($select) s
+              WHERE EXISTS (
+                SELECT  1
+                  FROM  $asset_call_number_table cn,
+                    $asset_copy_table cp,
+                    $metabib_metarecord_source_map_table mrs,
+                    $br_table br,
+                    $descendants d,
+                    $metabib_record_descriptor ord
+                
+                  WHERE mrs.metarecord = s.metarecord
+                    AND br.id = mrs.source
+                    AND cn.record = mrs.source
+                    AND cn.id = cp.call_number
+                    AND br.deleted IS FALSE
+                    AND cn.deleted IS FALSE
+                    AND ord.record = mrs.source
+                    AND (   cn.owning_lib = d.id
+                        OR (    cp.circ_lib = d.id
+                            AND cp.deleted IS FALSE
+                        )
+                    )
+                    $ot_filter
+                    $of_filter
+                    $oa_filter
+                    $ol_filter
+                    $olf_filter
+                  LIMIT 1
+                )
+                OR NOT EXISTS (
+                SELECT  1
+                  FROM  $asset_call_number_table cn,
+                    $metabib_metarecord_source_map_table mrs,
+                    $metabib_record_descriptor ord
+                  WHERE mrs.metarecord = s.metarecord
+                    AND cn.record = mrs.source
+                    AND ord.record = mrs.source
+                    $ot_filter
+                    $of_filter
+                    $oa_filter
+                    $ol_filter
+                    $olf_filter
+                  LIMIT 1
+                )
+              ORDER BY 4 $sort_dir
+        SQL
+    }
+
+
+    $log->debug("Field Search SQL :: [$select]",DEBUG);
+
+    my $recs = $class->db_Main->selectall_arrayref(
+            $select, {},
+            (@bonus_values > 0 ? @bonus_values : () ),
+            ( (!$sort && @bonus_values > 0) ? @bonus_values : () ),
+            @types, @forms, @aud, @lang, @lit_form,
+            @types, @forms, @aud, @lang, @lit_form,
+            ($self->api_name =~ /staff/o ? (@types, @forms, @aud, @lang, @lit_form) : () ) );
+    
+    $log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
+
+    my $max = 0;
+    $max = 1 if (!@$recs);
+    for (@$recs) {
+        $max = $$_[1] if ($$_[1] > $max);
+    }
+
+    my $count = scalar(@$recs);
+    for my $rec (@$recs[$offset .. $offset + $limit - 1]) {
+        my ($mrid,$rank,$skip) = @$rec;
+        $client->respond( [$mrid, sprintf('%0.3f',$rank/$max), $skip, $count] );
+    }
+    return undef;
 }
 
 for my $class ( qw/title author subject keyword series identifier/ ) {
-	__PACKAGE__->register_method(
-		api_name	=> "open-ils.storage.metabib.$class.post_filter.search_fts.metarecord",
-		method		=> 'postfilter_search_class_fts',
-		api_level	=> 1,
-		stream		=> 1,
-		cdbi		=> "metabib::${class}_field_entry",
-		cachable	=> 1,
-	);
-	__PACKAGE__->register_method(
-		api_name	=> "open-ils.storage.metabib.$class.post_filter.search_fts.metarecord.staff",
-		method		=> 'postfilter_search_class_fts',
-		api_level	=> 1,
-		stream		=> 1,
-		cdbi		=> "metabib::${class}_field_entry",
-		cachable	=> 1,
-	);
+    __PACKAGE__->register_method(
+        api_name    => "open-ils.storage.metabib.$class.post_filter.search_fts.metarecord",
+        method      => 'postfilter_search_class_fts',
+        api_level   => 1,
+        stream      => 1,
+        cdbi        => "metabib::${class}_field_entry",
+        cachable    => 1,
+    );
+    __PACKAGE__->register_method(
+        api_name    => "open-ils.storage.metabib.$class.post_filter.search_fts.metarecord.staff",
+        method      => 'postfilter_search_class_fts',
+        api_level   => 1,
+        stream      => 1,
+        cdbi        => "metabib::${class}_field_entry",
+        cachable    => 1,
+    );
 }
 
 
 
-my $_cdbi = {	title	=> "metabib::title_field_entry",
-		author	=> "metabib::author_field_entry",
-		subject	=> "metabib::subject_field_entry",
-		keyword	=> "metabib::keyword_field_entry",
-		series	=> "metabib::series_field_entry",
-		identifier	=> "metabib::identifier_field_entry",
+my $_cdbi = {   title   => "metabib::title_field_entry",
+        author  => "metabib::author_field_entry",
+        subject => "metabib::subject_field_entry",
+        keyword => "metabib::keyword_field_entry",
+        series  => "metabib::series_field_entry",
+        identifier  => "metabib::identifier_field_entry",
 };
 
 # XXX factored most of the PG dependant stuff out of here... need to find a way to do "dependants".
@@ -1512,7 +1512,7 @@ sub postfilter_search_multi_class_fts {
     my $self   = shift;
     my $client = shift;
     my %args   = @_;
-	
+    
     my $sort             = $args{'sort'};
     my $sort_dir         = $args{sort_dir} || 'DESC';
     my $ou               = $args{org_unit};
@@ -1521,491 +1521,491 @@ sub postfilter_search_multi_class_fts {
     my $offset           = $args{offset} ||  0;
     my $visibility_limit = $args{visibility_limit} || 5000;
 
-	if (!$ou) {
-		$ou = actor::org_unit->search( { parent_ou => undef } )->next->id;
-	}
+    if (!$ou) {
+        $ou = actor::org_unit->search( { parent_ou => undef } )->next->id;
+    }
 
-	if (!defined($args{org_unit})) {
-		die "No target organizational unit passed to ".$self->api_name;
-	}
+    if (!defined($args{org_unit})) {
+        die "No target organizational unit passed to ".$self->api_name;
+    }
 
-	if (! scalar( keys %{$args{searches}} )) {
-		die "No search arguments were passed to ".$self->api_name;
-	}
+    if (! scalar( keys %{$args{searches}} )) {
+        die "No search arguments were passed to ".$self->api_name;
+    }
 
-	my $outer_limit = 1000;
+    my $outer_limit = 1000;
 
-	my $limit_clause  = '';
-	my $offset_clause = '';
+    my $limit_clause  = '';
+    my $offset_clause = '';
 
-	$limit_clause  = "LIMIT $outer_limit";
-	$offset_clause = "OFFSET $offset" if (defined $offset and int($offset) > 0);
+    $limit_clause  = "LIMIT $outer_limit";
+    $offset_clause = "OFFSET $offset" if (defined $offset and int($offset) > 0);
 
-	my ($avail_filter, at types, at forms, at lang, at aud, at lit_form, at vformats) = ('');
-	my ($t_filter,   $f_filter,   $v_filter) = ('','','');
-	my ($a_filter,   $l_filter,  $lf_filter) = ('','','');
-	my ($ot_filter, $of_filter,  $ov_filter) = ('','','');
-	my ($oa_filter, $ol_filter, $olf_filter) = ('','','');
+    my ($avail_filter, at types, at forms, at lang, at aud, at lit_form, at vformats) = ('');
+    my ($t_filter,   $f_filter,   $v_filter) = ('','','');
+    my ($a_filter,   $l_filter,  $lf_filter) = ('','','');
+    my ($ot_filter, $of_filter,  $ov_filter) = ('','','');
+    my ($oa_filter, $ol_filter, $olf_filter) = ('','','');
 
-	if ($args{available}) {
-		$avail_filter = ' AND cp.status IN (0,7,12)';
-	}
+    if ($args{available}) {
+        $avail_filter = ' AND cp.status IN (0,7,12)';
+    }
 
-	if (my $a = $args{audience}) {
-		$a = [$a] if (!ref($a));
-		@aud = @$a;
-			
-		$a_filter  = ' AND  rd.audience IN ('.join(',',map{'?'}@aud).')';
-		$oa_filter = ' AND ord.audience IN ('.join(',',map{'?'}@aud).')';
-	}
+    if (my $a = $args{audience}) {
+        $a = [$a] if (!ref($a));
+        @aud = @$a;
+            
+        $a_filter  = ' AND  rd.audience IN ('.join(',',map{'?'}@aud).')';
+        $oa_filter = ' AND ord.audience IN ('.join(',',map{'?'}@aud).')';
+    }
 
-	if (my $l = $args{language}) {
-		$l = [$l] if (!ref($l));
-		@lang = @$l;
+    if (my $l = $args{language}) {
+        $l = [$l] if (!ref($l));
+        @lang = @$l;
 
-		$l_filter  = ' AND  rd.item_lang IN ('.join(',',map{'?'}@lang).')';
-		$ol_filter = ' AND ord.item_lang IN ('.join(',',map{'?'}@lang).')';
-	}
+        $l_filter  = ' AND  rd.item_lang IN ('.join(',',map{'?'}@lang).')';
+        $ol_filter = ' AND ord.item_lang IN ('.join(',',map{'?'}@lang).')';
+    }
 
-	if (my $f = $args{lit_form}) {
-		$f = [$f] if (!ref($f));
-		@lit_form = @$f;
+    if (my $f = $args{lit_form}) {
+        $f = [$f] if (!ref($f));
+        @lit_form = @$f;
 
-		$lf_filter  = ' AND  rd.lit_form IN ('.join(',',map{'?'}@lit_form).')';
-		$olf_filter = ' AND ord.lit_form IN ('.join(',',map{'?'}@lit_form).')';
-	}
+        $lf_filter  = ' AND  rd.lit_form IN ('.join(',',map{'?'}@lit_form).')';
+        $olf_filter = ' AND ord.lit_form IN ('.join(',',map{'?'}@lit_form).')';
+    }
 
-	if (my $f = $args{item_form}) {
-		$f = [$f] if (!ref($f));
-		@forms = @$f;
+    if (my $f = $args{item_form}) {
+        $f = [$f] if (!ref($f));
+        @forms = @$f;
 
-		$f_filter  = ' AND  rd.item_form IN ('.join(',',map{'?'}@forms).')';
-		$of_filter = ' AND ord.item_form IN ('.join(',',map{'?'}@forms).')';
-	}
+        $f_filter  = ' AND  rd.item_form IN ('.join(',',map{'?'}@forms).')';
+        $of_filter = ' AND ord.item_form IN ('.join(',',map{'?'}@forms).')';
+    }
 
-	if (my $t = $args{item_type}) {
-		$t = [$t] if (!ref($t));
-		@types = @$t;
+    if (my $t = $args{item_type}) {
+        $t = [$t] if (!ref($t));
+        @types = @$t;
 
-		$t_filter  = ' AND  rd.item_type IN ('.join(',',map{'?'}@types).')';
-		$ot_filter = ' AND ord.item_type IN ('.join(',',map{'?'}@types).')';
-	}
+        $t_filter  = ' AND  rd.item_type IN ('.join(',',map{'?'}@types).')';
+        $ot_filter = ' AND ord.item_type IN ('.join(',',map{'?'}@types).')';
+    }
 
-	if (my $v = $args{vr_format}) {
-		$v = [$v] if (!ref($v));
-		@vformats = @$v;
+    if (my $v = $args{vr_format}) {
+        $v = [$v] if (!ref($v));
+        @vformats = @$v;
 
-		$v_filter  = ' AND  rd.vr_format IN ('.join(',',map{'?'}@vformats).')';
-		$ov_filter = ' AND ord.vr_format IN ('.join(',',map{'?'}@vformats).')';
-	}
+        $v_filter  = ' AND  rd.vr_format IN ('.join(',',map{'?'}@vformats).')';
+        $ov_filter = ' AND ord.vr_format IN ('.join(',',map{'?'}@vformats).')';
+    }
 
 
-	# XXX legacy format and item type support
-	if ($args{format}) {
-		my ($t, $f) = split '-', $args{format};
-		@types = split '', $t;
-		@forms = split '', $f;
-		if (@types) {
-			$t_filter  = ' AND  rd.item_type IN ('.join(',',map{'?'}@types).')';
-			$ot_filter = ' AND ord.item_type IN ('.join(',',map{'?'}@types).')';
-		}
+    # XXX legacy format and item type support
+    if ($args{format}) {
+        my ($t, $f) = split '-', $args{format};
+        @types = split '', $t;
+        @forms = split '', $f;
+        if (@types) {
+            $t_filter  = ' AND  rd.item_type IN ('.join(',',map{'?'}@types).')';
+            $ot_filter = ' AND ord.item_type IN ('.join(',',map{'?'}@types).')';
+        }
 
-		if (@forms) {
-			$f_filter  .= ' AND  rd.item_form IN ('.join(',',map{'?'}@forms).')';
-			$of_filter .= ' AND ord.item_form IN ('.join(',',map{'?'}@forms).')';
-		}
-	}
+        if (@forms) {
+            $f_filter  .= ' AND  rd.item_form IN ('.join(',',map{'?'}@forms).')';
+            $of_filter .= ' AND ord.item_form IN ('.join(',',map{'?'}@forms).')';
+        }
+    }
 
 
 
-	my $descendants = defined($ou_type) ?
-				"actor.org_unit_descendants($ou, $ou_type)" :
-				"actor.org_unit_descendants($ou)";
+    my $descendants = defined($ou_type) ?
+                "actor.org_unit_descendants($ou, $ou_type)" :
+                "actor.org_unit_descendants($ou)";
 
     my $search_table_list = '';
     my $fts_list          = '';
     my $join_table_list   = '';
     my @rank_list;
 
-	my $field_table = config::metabib_field->table;
+    my $field_table = config::metabib_field->table;
+
+    my @bonus_lists;
+    my @bonus_values;
+    my $prev_search_group;
+    my $curr_search_group;
+    my $search_class;
+    my $search_field;
+    my $metabib_field;
+    for my $search_group (sort keys %{$args{searches}}) {
+        (my $search_group_name = $search_group) =~ s/\|/_/gso;
+        ($search_class,$search_field) = split /\|/, $search_group;
+        $log->debug("Searching class [$search_class] and field [$search_field]",DEBUG);
+
+        if ($search_field) {
+            unless ( $metabib_field = config::metabib_field->search( field_class => $search_class, name => $search_field )->next ) {
+                $log->warn("Requested class [$search_class] or field [$search_field] does not exist!");
+                return undef;
+            }
+        }
+
+        $prev_search_group = $curr_search_group if ($curr_search_group);
+
+        $curr_search_group = $search_group_name;
+
+        my $class = $_cdbi->{$search_class};
+        my $search_table = $class->table;
+
+        my ($index_col) = $class->columns('FTS');
+        $index_col ||= 'value';
+
+        
+        my $fts = OpenILS::Application::Storage::FTS->compile($search_class => $args{searches}{$search_group}{term}, $search_group_name.'.value', "$search_group_name.$index_col");
+
+        my $fts_where = $fts->sql_where_clause;
+        my @fts_ranks = $fts->fts_rank;
+
+        my $SQLstring = join('%',map { lc($_) } $fts->words);
+        my $REstring = '^' . join('\s+',map { lc($_) } $fts->words) . '\W*$';
+        my $first_word = lc(($fts->words)[0]).'%';
+
+        $_.=" * (SELECT weight FROM $field_table WHERE $search_group_name.field = id)" for (@fts_ranks);
+        my $rank = join(' + ', @fts_ranks);
+
+        my %bonus = ();
+        $bonus{'keyword'} = [ { "CASE WHEN $search_group_name.value LIKE ? THEN 10 ELSE 1 END" => $SQLstring } ];
+        $bonus{'author'}  = [ { "CASE WHEN $search_group_name.value ILIKE ? THEN 10 ELSE 1 END" => $first_word } ];
+
+        $bonus{'series'} = [
+            { "CASE WHEN $search_group_name.value LIKE ? THEN 1.5 ELSE 1 END" => $first_word },
+            { "CASE WHEN $search_group_name.value ~ ? THEN 20 ELSE 1 END" => $REstring },
+        ];
+
+        $bonus{'title'} = [ @{ $bonus{'series'} }, @{ $bonus{'keyword'} } ];
+
+        my $bonus_list = join ' * ', map { keys %$_ } @{ $bonus{$search_class} };
+        $bonus_list ||= '1';
+
+        push @bonus_lists, $bonus_list;
+        push @bonus_values, map { values %$_ } @{ $bonus{$search_class} };
+
+
+        #---------------------
 
-	my @bonus_lists;
-	my @bonus_values;
-	my $prev_search_group;
-	my $curr_search_group;
-	my $search_class;
-	my $search_field;
-	my $metabib_field;
-	for my $search_group (sort keys %{$args{searches}}) {
-		(my $search_group_name = $search_group) =~ s/\|/_/gso;
-		($search_class,$search_field) = split /\|/, $search_group;
-		$log->debug("Searching class [$search_class] and field [$search_field]",DEBUG);
+        $search_table_list .= "$search_table $search_group_name, ";
+        push @rank_list,$rank;
+        $fts_list .= " AND $fts_where AND m.source = $search_group_name.source";
 
-		if ($search_field) {
-			unless ( $metabib_field = config::metabib_field->search( field_class => $search_class, name => $search_field )->next ) {
-				$log->warn("Requested class [$search_class] or field [$search_field] does not exist!");
-				return undef;
-			}
-		}
-
-		$prev_search_group = $curr_search_group if ($curr_search_group);
-
-		$curr_search_group = $search_group_name;
-
-		my $class = $_cdbi->{$search_class};
-		my $search_table = $class->table;
-
-		my ($index_col) = $class->columns('FTS');
-		$index_col ||= 'value';
-
-		
-		my $fts = OpenILS::Application::Storage::FTS->compile($search_class => $args{searches}{$search_group}{term}, $search_group_name.'.value', "$search_group_name.$index_col");
-
-		my $fts_where = $fts->sql_where_clause;
-		my @fts_ranks = $fts->fts_rank;
-
-		my $SQLstring = join('%',map { lc($_) } $fts->words);
-		my $REstring = '^' . join('\s+',map { lc($_) } $fts->words) . '\W*$';
-		my $first_word = lc(($fts->words)[0]).'%';
-
-		$_.=" * (SELECT weight FROM $field_table WHERE $search_group_name.field = id)" for (@fts_ranks);
-		my $rank = join(' + ', @fts_ranks);
-
-		my %bonus = ();
-		$bonus{'keyword'} = [ { "CASE WHEN $search_group_name.value LIKE ? THEN 10 ELSE 1 END" => $SQLstring } ];
-		$bonus{'author'}  = [ { "CASE WHEN $search_group_name.value ILIKE ? THEN 10 ELSE 1 END" => $first_word } ];
-
-		$bonus{'series'} = [
-			{ "CASE WHEN $search_group_name.value LIKE ? THEN 1.5 ELSE 1 END" => $first_word },
-			{ "CASE WHEN $search_group_name.value ~ ? THEN 20 ELSE 1 END" => $REstring },
-		];
-
-		$bonus{'title'} = [ @{ $bonus{'series'} }, @{ $bonus{'keyword'} } ];
-
-		my $bonus_list = join ' * ', map { keys %$_ } @{ $bonus{$search_class} };
-		$bonus_list ||= '1';
-
-		push @bonus_lists, $bonus_list;
-		push @bonus_values, map { values %$_ } @{ $bonus{$search_class} };
-
-
-		#---------------------
-
-		$search_table_list .= "$search_table $search_group_name, ";
-		push @rank_list,$rank;
-		$fts_list .= " AND $fts_where AND m.source = $search_group_name.source";
-
-		if ($metabib_field) {
-			$join_table_list .= " AND $search_group_name.field = " . $metabib_field->id;
-			$metabib_field = undef;
-		}
-
-		if ($prev_search_group) {
-			$join_table_list .= " AND $prev_search_group.source = $curr_search_group.source";
-		}
-	}
-
-	my $metabib_record_descriptor = metabib::record_descriptor->table;
-	my $metabib_full_rec = metabib::full_rec->table;
-	my $metabib_metarecord = metabib::metarecord->table;
-	my $metabib_metarecord_source_map_table = metabib::metarecord_source_map->table;
-	my $asset_call_number_table = asset::call_number->table;
-	my $asset_copy_table = asset::copy->table;
-	my $cs_table = config::copy_status->table;
-	my $cl_table = asset::copy_location->table;
-	my $br_table = biblio::record_entry->table;
-	my $source_table = config::bib_source->table;
-
-	my $bonuses = join (' * ', @bonus_lists);
-	my $relevance = join (' + ', @rank_list);
-	$relevance = "SUM( ($relevance) * ($bonuses) )/COUNT(DISTINCT smrs.source)";
-
-	my $string_default_sort = 'zzzz';
-	$string_default_sort = 'AAAA' if ($sort_dir eq 'DESC');
-
-	my $number_default_sort = '9999';
-	$number_default_sort = '0000' if ($sort_dir eq 'DESC');
-
-
-
-	my $secondary_sort = <<"	SORT";
-		( FIRST ((
-			SELECT	COALESCE(LTRIM(SUBSTR( sfrt.value, COALESCE(SUBSTRING(sfrt.ind2 FROM E'\\\\d+'),'0')::INT + 1 )),'$string_default_sort')
-			  FROM	$metabib_full_rec sfrt,
-				$metabib_metarecord mr
-			  WHERE	sfrt.record = mr.master_record
-			  	AND sfrt.tag = '245'
-				AND sfrt.subfield = 'a'
-			  LIMIT 1
-		)) )
-	SORT
-
-	my $rank = $relevance;
-	if (lc($sort) eq 'pubdate') {
-		$rank = <<"		RANK";
-			( FIRST ((
-				SELECT	COALESCE(SUBSTRING(frp.value FROM E'\\\\d+'),'$number_default_sort')::INT
-				  FROM	$metabib_full_rec frp
-				  WHERE	frp.record = mr.master_record
-				  	AND frp.tag = '260'
-					AND frp.subfield = 'c'
-				  LIMIT 1
-			)) )
-		RANK
-	} elsif (lc($sort) eq 'create_date') {
-		$rank = <<"		RANK";
-			( FIRST (( SELECT create_date FROM $br_table rbr WHERE rbr.id = mr.master_record)) )
-		RANK
-	} elsif (lc($sort) eq 'edit_date') {
-		$rank = <<"		RANK";
-			( FIRST (( SELECT edit_date FROM $br_table rbr WHERE rbr.id = mr.master_record)) )
-		RANK
-	} elsif (lc($sort) eq 'title') {
-		$rank = <<"		RANK";
-			( FIRST ((
-				SELECT	COALESCE(LTRIM(SUBSTR( frt.value, COALESCE(SUBSTRING(frt.ind2 FROM E'\\\\d+'),'0')::INT + 1 )),'$string_default_sort')
-				  FROM	$metabib_full_rec frt
-				  WHERE	frt.record = mr.master_record
-				  	AND frt.tag = '245'
-					AND frt.subfield = 'a'
-				  LIMIT 1
-			)) )
-		RANK
-		$secondary_sort = <<"		SORT";
-			( FIRST ((
-				SELECT	COALESCE(SUBSTRING(sfrp.value FROM E'\\\\d+'),'$number_default_sort')::INT
-				  FROM	$metabib_full_rec sfrp
-				  WHERE	sfrp.record = mr.master_record
-				  	AND sfrp.tag = '260'
-					AND sfrp.subfield = 'c'
-				  LIMIT 1
-			)) )
-		SORT
-	} elsif (lc($sort) eq 'author') {
-		$rank = <<"		RANK";
-			( FIRST((
-				SELECT	COALESCE(LTRIM(fra.value),'$string_default_sort')
-				  FROM	$metabib_full_rec fra
-				  WHERE	fra.record = mr.master_record
-				  	AND fra.tag LIKE '1%'
-					AND fra.subfield = 'a'
-				  ORDER BY fra.tag::text::int
-				  LIMIT 1
-			)) )
-		RANK
-	} else {
-		push @bonus_values, @bonus_values;
-		$sort = undef;
-	}
-
-
-	my $select = <<"	SQL";
-		SELECT	m.metarecord,
-			$relevance,
-			CASE WHEN COUNT(DISTINCT smrs.source) = 1 THEN FIRST(m.source) ELSE 0 END,
-			$rank,
-			$secondary_sort
-  	  	FROM	$search_table_list
-			$metabib_metarecord mr,
-			$metabib_metarecord_source_map_table m,
-			$metabib_metarecord_source_map_table smrs
-	  	WHERE	m.metarecord = smrs.metarecord 
-			AND mr.id = m.metarecord
-  	  		$fts_list
-			$join_table_list
-  	  	GROUP BY m.metarecord
-  	  	-- ORDER BY 4 $sort_dir
-		LIMIT $visibility_limit
-	SQL
-
-	if ($self->api_name !~ /staff/o) {
-		$select = <<"		SQL";
-
-			SELECT	s.*
-			  FROM	($select) s
-			  WHERE	EXISTS (
-			  	SELECT	1
-				  FROM	$asset_call_number_table cn,
-					$metabib_metarecord_source_map_table mrs,
-					$asset_copy_table cp,
-					$cs_table cs,
-					$cl_table cl,
-					$br_table br,
-					$descendants d,
-					$metabib_record_descriptor ord
-				  WHERE	mrs.metarecord = s.metarecord
-					AND br.id = mrs.source
-					AND cn.record = mrs.source
-					AND cp.status = cs.id
-					AND cp.location = cl.id
-					AND cp.circ_lib = d.id
-					AND cp.call_number = cn.id
-					AND cp.opac_visible IS TRUE
-					AND cs.opac_visible IS TRUE
-					AND cl.opac_visible IS TRUE
-					AND d.opac_visible IS TRUE
-					AND br.active IS TRUE
-					AND br.deleted IS FALSE
-					AND cp.deleted IS FALSE
-					AND cn.deleted IS FALSE
-					AND ord.record = mrs.source
-					$ot_filter
-					$of_filter
-					$ov_filter
-					$oa_filter
-					$ol_filter
-					$olf_filter
-					$avail_filter
-				  LIMIT 1
-			  	)
-				OR EXISTS (
-				SELECT	1
-				  FROM	$br_table br,
-					$metabib_metarecord_source_map_table mrs,
-					$metabib_record_descriptor ord,
-					$source_table src
-				  WHERE	mrs.metarecord = s.metarecord
-					AND ord.record = mrs.source
-					AND br.id = mrs.source
-					AND br.source = src.id
-					AND src.transcendant IS TRUE
-					$ot_filter
-					$of_filter
-					$ov_filter
-					$oa_filter
-					$ol_filter
-					$olf_filter
-				)
-			  ORDER BY 4 $sort_dir, 5
-		SQL
-	} else {
-		$select = <<"		SQL";
-
-			SELECT	DISTINCT s.*
-			  FROM	($select) s,
-				$metabib_metarecord_source_map_table omrs,
-				$metabib_record_descriptor ord
-			  WHERE	omrs.metarecord = s.metarecord
-				AND ord.record = omrs.source
-			  	AND (	EXISTS (
-					  	SELECT	1
-						  FROM	$asset_call_number_table cn,
-							$asset_copy_table cp,
-							$descendants d,
-							$br_table br
-						  WHERE	br.id = omrs.source
-							AND cn.record = omrs.source
-							AND br.deleted IS FALSE
-							AND cn.deleted IS FALSE
-							AND cp.call_number = cn.id
-							AND (	cn.owning_lib = d.id
-								OR (	cp.circ_lib = d.id
-									AND cp.deleted IS FALSE
-								)
-							)
-							$avail_filter
-						  LIMIT 1
-					)
-					OR NOT EXISTS (
-						SELECT	1
-						  FROM	$asset_call_number_table cn
-						  WHERE	cn.record = omrs.source
-							AND cn.deleted IS FALSE
-						  LIMIT 1
-					)
-					OR EXISTS (
-					SELECT	1
-					  FROM	$br_table br,
-						$metabib_metarecord_source_map_table mrs,
-						$metabib_record_descriptor ord,
-						$source_table src
-					  WHERE	mrs.metarecord = s.metarecord
-						AND br.id = mrs.source
-						AND br.source = src.id
-						AND src.transcendant IS TRUE
-						$ot_filter
-						$of_filter
-						$ov_filter
-						$oa_filter
-						$ol_filter
-						$olf_filter
-					)
-				)
-				$ot_filter
-				$of_filter
-				$ov_filter
-				$oa_filter
-				$ol_filter
-				$olf_filter
-
-			  ORDER BY 4 $sort_dir, 5
-		SQL
-	}
-
-
-	$log->debug("Field Search SQL :: [$select]",DEBUG);
-
-	my $recs = $_cdbi->{title}->db_Main->selectall_arrayref(
-			$select, {},
-			@bonus_values,
-			@types, @forms, @vformats, @aud, @lang, @lit_form,
-			@types, @forms, @vformats, @aud, @lang, @lit_form,
-			# ($self->api_name =~ /staff/o ? (@types, @forms, @aud, @lang, @lit_form) : () )
-	);
-	
-	$log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
-
-	my $max = 0;
-	$max = 1 if (!@$recs);
-	for (@$recs) {
-		$max = $$_[1] if ($$_[1] > $max);
-	}
-
-	my $count = scalar(@$recs);
-	for my $rec (@$recs[$offset .. $offset + $limit - 1]) {
-		next unless ($$rec[0]);
-		my ($mrid,$rank,$skip) = @$rec;
-		$client->respond( [$mrid, sprintf('%0.3f',$rank/$max), $skip, $count] );
-	}
-	return undef;
+        if ($metabib_field) {
+            $join_table_list .= " AND $search_group_name.field = " . $metabib_field->id;
+            $metabib_field = undef;
+        }
+
+        if ($prev_search_group) {
+            $join_table_list .= " AND $prev_search_group.source = $curr_search_group.source";
+        }
+    }
+
+    my $metabib_record_descriptor = metabib::record_descriptor->table;
+    my $metabib_full_rec = metabib::full_rec->table;
+    my $metabib_metarecord = metabib::metarecord->table;
+    my $metabib_metarecord_source_map_table = metabib::metarecord_source_map->table;
+    my $asset_call_number_table = asset::call_number->table;
+    my $asset_copy_table = asset::copy->table;
+    my $cs_table = config::copy_status->table;
+    my $cl_table = asset::copy_location->table;
+    my $br_table = biblio::record_entry->table;
+    my $source_table = config::bib_source->table;
+
+    my $bonuses = join (' * ', @bonus_lists);
+    my $relevance = join (' + ', @rank_list);
+    $relevance = "SUM( ($relevance) * ($bonuses) )/COUNT(DISTINCT smrs.source)";
+
+    my $string_default_sort = 'zzzz';
+    $string_default_sort = 'AAAA' if ($sort_dir eq 'DESC');
+
+    my $number_default_sort = '9999';
+    $number_default_sort = '0000' if ($sort_dir eq 'DESC');
+
+
+
+    my $secondary_sort = <<"    SORT";
+        ( FIRST ((
+            SELECT  COALESCE(LTRIM(SUBSTR( sfrt.value, COALESCE(SUBSTRING(sfrt.ind2 FROM E'\\\\d+'),'0')::INT + 1 )),'$string_default_sort')
+              FROM  $metabib_full_rec sfrt,
+                $metabib_metarecord mr
+              WHERE sfrt.record = mr.master_record
+                AND sfrt.tag = '245'
+                AND sfrt.subfield = 'a'
+              LIMIT 1
+        )) )
+    SORT
+
+    my $rank = $relevance;
+    if (lc($sort) eq 'pubdate') {
+        $rank = <<"        RANK";
+            ( FIRST ((
+                SELECT  COALESCE(SUBSTRING(frp.value FROM E'\\\\d+'),'$number_default_sort')::INT
+                  FROM  $metabib_full_rec frp
+                  WHERE frp.record = mr.master_record
+                    AND frp.tag = '260'
+                    AND frp.subfield = 'c'
+                  LIMIT 1
+            )) )
+        RANK
+    } elsif (lc($sort) eq 'create_date') {
+        $rank = <<"        RANK";
+            ( FIRST (( SELECT create_date FROM $br_table rbr WHERE rbr.id = mr.master_record)) )
+        RANK
+    } elsif (lc($sort) eq 'edit_date') {
+        $rank = <<"        RANK";
+            ( FIRST (( SELECT edit_date FROM $br_table rbr WHERE rbr.id = mr.master_record)) )
+        RANK
+    } elsif (lc($sort) eq 'title') {
+        $rank = <<"        RANK";
+            ( FIRST ((
+                SELECT  COALESCE(LTRIM(SUBSTR( frt.value, COALESCE(SUBSTRING(frt.ind2 FROM E'\\\\d+'),'0')::INT + 1 )),'$string_default_sort')
+                  FROM  $metabib_full_rec frt
+                  WHERE frt.record = mr.master_record
+                    AND frt.tag = '245'
+                    AND frt.subfield = 'a'
+                  LIMIT 1
+            )) )
+        RANK
+        $secondary_sort = <<"        SORT";
+            ( FIRST ((
+                SELECT  COALESCE(SUBSTRING(sfrp.value FROM E'\\\\d+'),'$number_default_sort')::INT
+                  FROM  $metabib_full_rec sfrp
+                  WHERE sfrp.record = mr.master_record
+                    AND sfrp.tag = '260'
+                    AND sfrp.subfield = 'c'
+                  LIMIT 1
+            )) )
+        SORT
+    } elsif (lc($sort) eq 'author') {
+        $rank = <<"        RANK";
+            ( FIRST((
+                SELECT  COALESCE(LTRIM(fra.value),'$string_default_sort')
+                  FROM  $metabib_full_rec fra
+                  WHERE fra.record = mr.master_record
+                    AND fra.tag LIKE '1%'
+                    AND fra.subfield = 'a'
+                  ORDER BY fra.tag::text::int
+                  LIMIT 1
+            )) )
+        RANK
+    } else {
+        push @bonus_values, @bonus_values;
+        $sort = undef;
+    }
+
+
+    my $select = <<"    SQL";
+        SELECT  m.metarecord,
+            $relevance,
+            CASE WHEN COUNT(DISTINCT smrs.source) = 1 THEN FIRST(m.source) ELSE 0 END,
+            $rank,
+            $secondary_sort
+        FROM    $search_table_list
+            $metabib_metarecord mr,
+            $metabib_metarecord_source_map_table m,
+            $metabib_metarecord_source_map_table smrs
+        WHERE   m.metarecord = smrs.metarecord 
+            AND mr.id = m.metarecord
+            $fts_list
+            $join_table_list
+        GROUP BY m.metarecord
+        -- ORDER BY 4 $sort_dir
+        LIMIT $visibility_limit
+    SQL
+
+    if ($self->api_name !~ /staff/o) {
+        $select = <<"        SQL";
+
+            SELECT  s.*
+              FROM  ($select) s
+              WHERE EXISTS (
+                SELECT  1
+                  FROM  $asset_call_number_table cn,
+                    $metabib_metarecord_source_map_table mrs,
+                    $asset_copy_table cp,
+                    $cs_table cs,
+                    $cl_table cl,
+                    $br_table br,
+                    $descendants d,
+                    $metabib_record_descriptor ord
+                  WHERE mrs.metarecord = s.metarecord
+                    AND br.id = mrs.source
+                    AND cn.record = mrs.source
+                    AND cp.status = cs.id
+                    AND cp.location = cl.id
+                    AND cp.circ_lib = d.id
+                    AND cp.call_number = cn.id
+                    AND cp.opac_visible IS TRUE
+                    AND cs.opac_visible IS TRUE
+                    AND cl.opac_visible IS TRUE
+                    AND d.opac_visible IS TRUE
+                    AND br.active IS TRUE
+                    AND br.deleted IS FALSE
+                    AND cp.deleted IS FALSE
+                    AND cn.deleted IS FALSE
+                    AND ord.record = mrs.source
+                    $ot_filter
+                    $of_filter
+                    $ov_filter
+                    $oa_filter
+                    $ol_filter
+                    $olf_filter
+                    $avail_filter
+                  LIMIT 1
+                )
+                OR EXISTS (
+                SELECT  1
+                  FROM  $br_table br,
+                    $metabib_metarecord_source_map_table mrs,
+                    $metabib_record_descriptor ord,
+                    $source_table src
+                  WHERE mrs.metarecord = s.metarecord
+                    AND ord.record = mrs.source
+                    AND br.id = mrs.source
+                    AND br.source = src.id
+                    AND src.transcendant IS TRUE
+                    $ot_filter
+                    $of_filter
+                    $ov_filter
+                    $oa_filter
+                    $ol_filter
+                    $olf_filter
+                )
+              ORDER BY 4 $sort_dir, 5
+        SQL
+    } else {
+        $select = <<"        SQL";
+
+            SELECT  DISTINCT s.*
+              FROM  ($select) s,
+                $metabib_metarecord_source_map_table omrs,
+                $metabib_record_descriptor ord
+              WHERE omrs.metarecord = s.metarecord
+                AND ord.record = omrs.source
+                AND (   EXISTS (
+                        SELECT  1
+                          FROM  $asset_call_number_table cn,
+                            $asset_copy_table cp,
+                            $descendants d,
+                            $br_table br
+                          WHERE br.id = omrs.source
+                            AND cn.record = omrs.source
+                            AND br.deleted IS FALSE
+                            AND cn.deleted IS FALSE
+                            AND cp.call_number = cn.id
+                            AND (   cn.owning_lib = d.id
+                                OR (    cp.circ_lib = d.id
+                                    AND cp.deleted IS FALSE
+                                )
+                            )
+                            $avail_filter
+                          LIMIT 1
+                    )
+                    OR NOT EXISTS (
+                        SELECT  1
+                          FROM  $asset_call_number_table cn
+                          WHERE cn.record = omrs.source
+                            AND cn.deleted IS FALSE
+                          LIMIT 1
+                    )
+                    OR EXISTS (
+                    SELECT  1
+                      FROM  $br_table br,
+                        $metabib_metarecord_source_map_table mrs,
+                        $metabib_record_descriptor ord,
+                        $source_table src
+                      WHERE mrs.metarecord = s.metarecord
+                        AND br.id = mrs.source
+                        AND br.source = src.id
+                        AND src.transcendant IS TRUE
+                        $ot_filter
+                        $of_filter
+                        $ov_filter
+                        $oa_filter
+                        $ol_filter
+                        $olf_filter
+                    )
+                )
+                $ot_filter
+                $of_filter
+                $ov_filter
+                $oa_filter
+                $ol_filter
+                $olf_filter
+
+              ORDER BY 4 $sort_dir, 5
+        SQL
+    }
+
+
+    $log->debug("Field Search SQL :: [$select]",DEBUG);
+
+    my $recs = $_cdbi->{title}->db_Main->selectall_arrayref(
+            $select, {},
+            @bonus_values,
+            @types, @forms, @vformats, @aud, @lang, @lit_form,
+            @types, @forms, @vformats, @aud, @lang, @lit_form,
+            # ($self->api_name =~ /staff/o ? (@types, @forms, @aud, @lang, @lit_form) : () )
+    );
+    
+    $log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
+
+    my $max = 0;
+    $max = 1 if (!@$recs);
+    for (@$recs) {
+        $max = $$_[1] if ($$_[1] > $max);
+    }
+
+    my $count = scalar(@$recs);
+    for my $rec (@$recs[$offset .. $offset + $limit - 1]) {
+        next unless ($$rec[0]);
+        my ($mrid,$rank,$skip) = @$rec;
+        $client->respond( [$mrid, sprintf('%0.3f',$rank/$max), $skip, $count] );
+    }
+    return undef;
 }
 
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.metabib.post_filter.multiclass.search_fts.metarecord",
-	method		=> 'postfilter_search_multi_class_fts',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => "open-ils.storage.metabib.post_filter.multiclass.search_fts.metarecord",
+    method      => 'postfilter_search_multi_class_fts',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.metabib.post_filter.multiclass.search_fts.metarecord.staff",
-	method		=> 'postfilter_search_multi_class_fts',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => "open-ils.storage.metabib.post_filter.multiclass.search_fts.metarecord.staff",
+    method      => 'postfilter_search_multi_class_fts',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.metabib.multiclass.search_fts",
-	method		=> 'postfilter_search_multi_class_fts',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => "open-ils.storage.metabib.multiclass.search_fts",
+    method      => 'postfilter_search_multi_class_fts',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.metabib.multiclass.search_fts.staff",
-	method		=> 'postfilter_search_multi_class_fts',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => "open-ils.storage.metabib.multiclass.search_fts.staff",
+    method      => 'postfilter_search_multi_class_fts',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 
 # XXX factored most of the PG dependant stuff out of here... need to find a way to do "dependants".
 sub biblio_search_multi_class_fts {
-	my $self = shift;
-	my $client = shift;
-	my %args = @_;
-	
+    my $self = shift;
+    my $client = shift;
+    my %args = @_;
+    
     my $sort             = $args{'sort'};
     my $sort_dir         = $args{sort_dir} || 'DESC';
     my $ou               = $args{org_unit};
@@ -2015,395 +2015,395 @@ sub biblio_search_multi_class_fts {
     my $pref_lang        = $args{preferred_language} || 'eng';
     my $visibility_limit = $args{visibility_limit}  || 5000;
 
-	if (!$ou) {
-		$ou = actor::org_unit->search( { parent_ou => undef } )->next->id;
-	}
-
-	if (! scalar( keys %{$args{searches}} )) {
-		die "No search arguments were passed to ".$self->api_name;
-	}
-
-	my $outer_limit = 1000;
-
-	my $limit_clause  = '';
-	my $offset_clause = '';
-
-	$limit_clause  = "LIMIT $outer_limit";
-	$offset_clause = "OFFSET $offset" if (defined $offset and int($offset) > 0);
-
-	my ($avail_filter, at types, at forms, at lang, at aud, at lit_form, at vformats) = ('');
-	my ($t_filter,   $f_filter,   $v_filter) = ('','','');
-	my ($a_filter,   $l_filter,  $lf_filter) = ('','','');
-	my ($ot_filter, $of_filter,  $ov_filter) = ('','','');
-	my ($oa_filter, $ol_filter, $olf_filter) = ('','','');
-
-	if ($args{available}) {
-		$avail_filter = ' AND cp.status IN (0,7,12)';
-	}
-
-	if (my $a = $args{audience}) {
-		$a = [$a] if (!ref($a));
-		@aud = @$a;
-			
-		$a_filter  = ' AND rd.audience  IN ('.join(',',map{'?'}@aud).')';
-		$oa_filter = ' AND ord.audience IN ('.join(',',map{'?'}@aud).')';
-	}
-
-	if (my $l = $args{language}) {
-		$l = [$l] if (!ref($l));
-		@lang = @$l;
-
-		$l_filter  = ' AND rd.item_lang  IN ('.join(',',map{'?'}@lang).')';
-		$ol_filter = ' AND ord.item_lang IN ('.join(',',map{'?'}@lang).')';
-	}
-
-	if (my $f = $args{lit_form}) {
-		$f = [$f] if (!ref($f));
-		@lit_form = @$f;
-
-		$lf_filter  = ' AND rd.lit_form  IN ('.join(',',map{'?'}@lit_form).')';
-		$olf_filter = ' AND ord.lit_form IN ('.join(',',map{'?'}@lit_form).')';
-	}
+    if (!$ou) {
+        $ou = actor::org_unit->search( { parent_ou => undef } )->next->id;
+    }
+
+    if (! scalar( keys %{$args{searches}} )) {
+        die "No search arguments were passed to ".$self->api_name;
+    }
+
+    my $outer_limit = 1000;
+
+    my $limit_clause  = '';
+    my $offset_clause = '';
+
+    $limit_clause  = "LIMIT $outer_limit";
+    $offset_clause = "OFFSET $offset" if (defined $offset and int($offset) > 0);
+
+    my ($avail_filter, at types, at forms, at lang, at aud, at lit_form, at vformats) = ('');
+    my ($t_filter,   $f_filter,   $v_filter) = ('','','');
+    my ($a_filter,   $l_filter,  $lf_filter) = ('','','');
+    my ($ot_filter, $of_filter,  $ov_filter) = ('','','');
+    my ($oa_filter, $ol_filter, $olf_filter) = ('','','');
+
+    if ($args{available}) {
+        $avail_filter = ' AND cp.status IN (0,7,12)';
+    }
+
+    if (my $a = $args{audience}) {
+        $a = [$a] if (!ref($a));
+        @aud = @$a;
+            
+        $a_filter  = ' AND rd.audience  IN ('.join(',',map{'?'}@aud).')';
+        $oa_filter = ' AND ord.audience IN ('.join(',',map{'?'}@aud).')';
+    }
+
+    if (my $l = $args{language}) {
+        $l = [$l] if (!ref($l));
+        @lang = @$l;
+
+        $l_filter  = ' AND rd.item_lang  IN ('.join(',',map{'?'}@lang).')';
+        $ol_filter = ' AND ord.item_lang IN ('.join(',',map{'?'}@lang).')';
+    }
+
+    if (my $f = $args{lit_form}) {
+        $f = [$f] if (!ref($f));
+        @lit_form = @$f;
+
+        $lf_filter  = ' AND rd.lit_form  IN ('.join(',',map{'?'}@lit_form).')';
+        $olf_filter = ' AND ord.lit_form IN ('.join(',',map{'?'}@lit_form).')';
+    }
+
+    if (my $f = $args{item_form}) {
+        $f = [$f] if (!ref($f));
+        @forms = @$f;
+
+        $f_filter  = ' AND rd.item_form  IN ('.join(',',map{'?'}@forms).')';
+        $of_filter = ' AND ord.item_form IN ('.join(',',map{'?'}@forms).')';
+    }
+
+    if (my $t = $args{item_type}) {
+        $t = [$t] if (!ref($t));
+        @types = @$t;
+
+        $t_filter  = ' AND rd.item_type  IN ('.join(',',map{'?'}@types).')';
+        $ot_filter = ' AND ord.item_type IN ('.join(',',map{'?'}@types).')';
+    }
+
+    if (my $v = $args{vr_format}) {
+        $v = [$v] if (!ref($v));
+        @vformats = @$v;
+
+        $v_filter  = ' AND rd.vr_format  IN ('.join(',',map{'?'}@vformats).')';
+        $ov_filter = ' AND ord.vr_format IN ('.join(',',map{'?'}@vformats).')';
+    }
+
+    # XXX legacy format and item type support
+    if ($args{format}) {
+        my ($t, $f) = split '-', $args{format};
+        @types = split '', $t;
+        @forms = split '', $f;
+        if (@types) {
+            $t_filter  = ' AND rd.item_type  IN ('.join(',',map{'?'}@types).')';
+            $ot_filter = ' AND ord.item_type IN ('.join(',',map{'?'}@types).')';
+        }
+
+        if (@forms) {
+            $f_filter  .= ' AND rd.item_form  IN ('.join(',',map{'?'}@forms).')';
+            $of_filter .= ' AND ord.item_form IN ('.join(',',map{'?'}@forms).')';
+        }
+    }
+
+
+    my $descendants = defined($ou_type) ?
+                "actor.org_unit_descendants($ou, $ou_type)" :
+                "actor.org_unit_descendants($ou)";
+
+    my $search_table_list = '';
+    my $fts_list = '';
+    my $join_table_list = '';
+    my @rank_list;
+
+    my $field_table = config::metabib_field->table;
+
+    my @bonus_lists;
+    my @bonus_values;
+    my $prev_search_group;
+    my $curr_search_group;
+    my $search_class;
+    my $search_field;
+    my $metabib_field;
+    for my $search_group (sort keys %{$args{searches}}) {
+        (my $search_group_name = $search_group) =~ s/\|/_/gso;
+        ($search_class,$search_field) = split /\|/, $search_group;
+        $log->debug("Searching class [$search_class] and field [$search_field]",DEBUG);
+
+        if ($search_field) {
+            unless ( $metabib_field = config::metabib_field->search( field_class => $search_class, name => $search_field )->next ) {
+                $log->warn("Requested class [$search_class] or field [$search_field] does not exist!");
+                return undef;
+            }
+        }
+
+        $prev_search_group = $curr_search_group if ($curr_search_group);
+
+        $curr_search_group = $search_group_name;
+
+        my $class = $_cdbi->{$search_class};
+        my $search_table = $class->table;
+
+        my ($index_col) = $class->columns('FTS');
+        $index_col ||= 'value';
+
+        
+        my $fts = OpenILS::Application::Storage::FTS->compile($search_class => $args{searches}{$search_group}{term}, $search_group_name.'.value', "$search_group_name.$index_col");
+
+        my $fts_where = $fts->sql_where_clause;
+        my @fts_ranks = $fts->fts_rank;
+
+        my $SQLstring = join('%',map { lc($_) } $fts->words) .'%';
+        my $REstring = '^' . join('\s+',map { lc($_) } $fts->words) . '\W*$';
+        my $first_word = lc(($fts->words)[0]).'%';
+
+        $_.=" * (SELECT weight FROM $field_table WHERE $search_group_name.field = id)" for (@fts_ranks);
+        my $rank = join('  + ', @fts_ranks);
+
+        my %bonus = ();
+        $bonus{'subject'} = [];
+        $bonus{'author'}  = [ { "CASE WHEN $search_group_name.value ILIKE ? THEN 1.5 ELSE 1 END" => $first_word } ];
+
+        $bonus{'keyword'} = [ { "CASE WHEN $search_group_name.value ILIKE ? THEN 10 ELSE 1 END" => $SQLstring } ];
+
+        $bonus{'series'} = [
+            { "CASE WHEN $search_group_name.value ILIKE ? THEN 1.5 ELSE 1 END" => $first_word },
+            { "CASE WHEN $search_group_name.value ~ ? THEN 20 ELSE 1 END" => $REstring },
+        ];
+
+        $bonus{'title'} = [ @{ $bonus{'series'} }, @{ $bonus{'keyword'} } ];
+
+        if ($pref_lang) {
+            push @{ $bonus{'title'}   }, { "CASE WHEN rd.item_lang = ? THEN 10 ELSE 1 END" => $pref_lang };
+            push @{ $bonus{'author'}  }, { "CASE WHEN rd.item_lang = ? THEN 10 ELSE 1 END" => $pref_lang };
+            push @{ $bonus{'subject'} }, { "CASE WHEN rd.item_lang = ? THEN 10 ELSE 1 END" => $pref_lang };
+            push @{ $bonus{'keyword'} }, { "CASE WHEN rd.item_lang = ? THEN 10 ELSE 1 END" => $pref_lang };
+            push @{ $bonus{'series'}  }, { "CASE WHEN rd.item_lang = ? THEN 10 ELSE 1 END" => $pref_lang };
+        }
+
+        my $bonus_list = join ' * ', map { keys %$_ } @{ $bonus{$search_class} };
+        $bonus_list ||= '1';
+
+        push @bonus_lists, $bonus_list;
+        push @bonus_values, map { values %$_ } @{ $bonus{$search_class} };
+
+        #---------------------
+
+        $search_table_list .= "$search_table $search_group_name, ";
+        push @rank_list,$rank;
+        $fts_list .= " AND $fts_where AND b.id = $search_group_name.source";
+
+        if ($metabib_field) {
+            $fts_list .= " AND $curr_search_group.field = " . $metabib_field->id;
+            $metabib_field = undef;
+        }
+
+        if ($prev_search_group) {
+            $join_table_list .= " AND $prev_search_group.source = $curr_search_group.source";
+        }
+    }
+
+    my $metabib_record_descriptor = metabib::record_descriptor->table;
+    my $metabib_full_rec = metabib::full_rec->table;
+    my $metabib_metarecord = metabib::metarecord->table;
+    my $metabib_metarecord_source_map_table = metabib::metarecord_source_map->table;
+    my $asset_call_number_table = asset::call_number->table;
+    my $asset_copy_table = asset::copy->table;
+    my $cs_table = config::copy_status->table;
+    my $cl_table = asset::copy_location->table;
+    my $br_table = biblio::record_entry->table;
+    my $source_table = config::bib_source->table;
+
+
+    my $bonuses = join (' * ', @bonus_lists);
+    my $relevance = join (' + ', @rank_list);
+    $relevance = "AVG( ($relevance) * ($bonuses) )";
+
+    my $string_default_sort = 'zzzz';
+    $string_default_sort = 'AAAA' if ($sort_dir eq 'DESC');
+
+    my $number_default_sort = '9999';
+    $number_default_sort = '0000' if ($sort_dir eq 'DESC');
+
+    my $rank = $relevance;
+    if (lc($sort) eq 'pubdate') {
+        $rank = <<"        RANK";
+            ( FIRST ((
+                SELECT  COALESCE(SUBSTRING(frp.value FROM E'\\\\d{4}'),'$number_default_sort')::INT
+                  FROM  $metabib_full_rec frp
+                  WHERE frp.record = b.id
+                    AND frp.tag = '260'
+                    AND frp.subfield = 'c'
+                  LIMIT 1
+            )) )
+        RANK
+    } elsif (lc($sort) eq 'create_date') {
+        $rank = <<"        RANK";
+            ( FIRST (( SELECT create_date FROM $br_table rbr WHERE rbr.id = b.id)) )
+        RANK
+    } elsif (lc($sort) eq 'edit_date') {
+        $rank = <<"        RANK";
+            ( FIRST (( SELECT edit_date FROM $br_table rbr WHERE rbr.id = b.id)) )
+        RANK
+    } elsif (lc($sort) eq 'title') {
+        $rank = <<"        RANK";
+            ( FIRST ((
+                SELECT  COALESCE(LTRIM(SUBSTR( frt.value, COALESCE(SUBSTRING(frt.ind2 FROM E'\\\\d+'),'0')::INT + 1 )),'$string_default_sort')
+                  FROM  $metabib_full_rec frt
+                  WHERE frt.record = b.id
+                    AND frt.tag = '245'
+                    AND frt.subfield = 'a'
+                  LIMIT 1
+            )) )
+        RANK
+    } elsif (lc($sort) eq 'author') {
+        $rank = <<"        RANK";
+            ( FIRST((
+                SELECT  COALESCE(LTRIM(fra.value),'$string_default_sort')
+                  FROM  $metabib_full_rec fra
+                  WHERE fra.record = b.id
+                    AND fra.tag LIKE '1%'
+                    AND fra.subfield = 'a'
+                  ORDER BY fra.tag::text::int
+                  LIMIT 1
+            )) )
+        RANK
+    } else {
+        push @bonus_values, @bonus_values;
+        $sort = undef;
+    }
+
+
+    my $select = <<"    SQL";
+        SELECT  b.id,
+            $relevance AS rel,
+            $rank AS rank,
+            b.source
+        FROM    $search_table_list
+            $metabib_record_descriptor rd,
+            $source_table src,
+            $br_table b
+        WHERE   rd.record = b.id
+            AND b.active IS TRUE
+            AND b.deleted IS FALSE
+            $fts_list
+            $join_table_list
+            $t_filter
+            $f_filter
+            $v_filter
+            $a_filter
+            $l_filter
+            $lf_filter
+        GROUP BY b.id, b.source
+        ORDER BY 3 $sort_dir
+        LIMIT $visibility_limit
+    SQL
+
+    if ($self->api_name !~ /staff/o) {
+        $select = <<"        SQL";
+
+            SELECT  s.*
+              FROM  ($select) s
+                LEFT OUTER JOIN $source_table src ON (s.source = src.id)
+              WHERE EXISTS (
+                SELECT  1
+                  FROM  $asset_call_number_table cn,
+                    $asset_copy_table cp,
+                    $cs_table cs,
+                    $cl_table cl,
+                    $descendants d
+                  WHERE cn.record = s.id
+                    AND cp.status = cs.id
+                    AND cp.location = cl.id
+                    AND cp.call_number = cn.id
+                    AND cp.opac_visible IS TRUE
+                    AND cs.opac_visible IS TRUE
+                    AND cl.opac_visible IS TRUE
+                    AND d.opac_visible IS TRUE
+                    AND cp.deleted IS FALSE
+                    AND cn.deleted IS FALSE
+                    AND cp.circ_lib = d.id
+                    $avail_filter
+                  LIMIT 1
+                )
+                OR src.transcendant IS TRUE
+              ORDER BY 3 $sort_dir
+        SQL
+    } else {
+        $select = <<"        SQL";
+
+            SELECT  s.*
+              FROM  ($select) s
+                LEFT OUTER JOIN $source_table src ON (s.source = src.id)
+              WHERE EXISTS (
+                SELECT  1
+                  FROM  $asset_call_number_table cn,
+                    $asset_copy_table cp,
+                    $descendants d
+                  WHERE cn.record = s.id
+                    AND cp.call_number = cn.id
+                    AND cn.deleted IS FALSE
+                    AND cp.circ_lib = d.id
+                    AND cp.deleted IS FALSE
+                    $avail_filter
+                  LIMIT 1
+                )
+                OR NOT EXISTS (
+                SELECT  1
+                  FROM  $asset_call_number_table cn
+                  WHERE cn.record = s.id
+                  LIMIT 1
+                )
+                OR src.transcendant IS TRUE
+              ORDER BY 3 $sort_dir
+        SQL
+    }
 
-	if (my $f = $args{item_form}) {
-		$f = [$f] if (!ref($f));
-		@forms = @$f;
-
-		$f_filter  = ' AND rd.item_form  IN ('.join(',',map{'?'}@forms).')';
-		$of_filter = ' AND ord.item_form IN ('.join(',',map{'?'}@forms).')';
-	}
 
-	if (my $t = $args{item_type}) {
-		$t = [$t] if (!ref($t));
-		@types = @$t;
-
-		$t_filter  = ' AND rd.item_type  IN ('.join(',',map{'?'}@types).')';
-		$ot_filter = ' AND ord.item_type IN ('.join(',',map{'?'}@types).')';
-	}
-
-	if (my $v = $args{vr_format}) {
-		$v = [$v] if (!ref($v));
-		@vformats = @$v;
-
-		$v_filter  = ' AND rd.vr_format  IN ('.join(',',map{'?'}@vformats).')';
-		$ov_filter = ' AND ord.vr_format IN ('.join(',',map{'?'}@vformats).')';
-	}
+    $log->debug("Field Search SQL :: [$select]",DEBUG);
 
-	# XXX legacy format and item type support
-	if ($args{format}) {
-		my ($t, $f) = split '-', $args{format};
-		@types = split '', $t;
-		@forms = split '', $f;
-		if (@types) {
-			$t_filter  = ' AND rd.item_type  IN ('.join(',',map{'?'}@types).')';
-			$ot_filter = ' AND ord.item_type IN ('.join(',',map{'?'}@types).')';
-		}
-
-		if (@forms) {
-			$f_filter  .= ' AND rd.item_form  IN ('.join(',',map{'?'}@forms).')';
-			$of_filter .= ' AND ord.item_form IN ('.join(',',map{'?'}@forms).')';
-		}
-	}
-
-
-	my $descendants = defined($ou_type) ?
-				"actor.org_unit_descendants($ou, $ou_type)" :
-				"actor.org_unit_descendants($ou)";
-
-	my $search_table_list = '';
-	my $fts_list = '';
-	my $join_table_list = '';
-	my @rank_list;
-
-	my $field_table = config::metabib_field->table;
-
-	my @bonus_lists;
-	my @bonus_values;
-	my $prev_search_group;
-	my $curr_search_group;
-	my $search_class;
-	my $search_field;
-	my $metabib_field;
-	for my $search_group (sort keys %{$args{searches}}) {
-		(my $search_group_name = $search_group) =~ s/\|/_/gso;
-		($search_class,$search_field) = split /\|/, $search_group;
-		$log->debug("Searching class [$search_class] and field [$search_field]",DEBUG);
-
-		if ($search_field) {
-			unless ( $metabib_field = config::metabib_field->search( field_class => $search_class, name => $search_field )->next ) {
-				$log->warn("Requested class [$search_class] or field [$search_field] does not exist!");
-				return undef;
-			}
-		}
-
-		$prev_search_group = $curr_search_group if ($curr_search_group);
-
-		$curr_search_group = $search_group_name;
-
-		my $class = $_cdbi->{$search_class};
-		my $search_table = $class->table;
-
-		my ($index_col) = $class->columns('FTS');
-		$index_col ||= 'value';
-
-		
-		my $fts = OpenILS::Application::Storage::FTS->compile($search_class => $args{searches}{$search_group}{term}, $search_group_name.'.value', "$search_group_name.$index_col");
-
-		my $fts_where = $fts->sql_where_clause;
-		my @fts_ranks = $fts->fts_rank;
-
-		my $SQLstring = join('%',map { lc($_) } $fts->words) .'%';
-		my $REstring = '^' . join('\s+',map { lc($_) } $fts->words) . '\W*$';
-		my $first_word = lc(($fts->words)[0]).'%';
-
-		$_.=" * (SELECT weight FROM $field_table WHERE $search_group_name.field = id)" for (@fts_ranks);
-		my $rank = join('  + ', @fts_ranks);
-
-		my %bonus = ();
-		$bonus{'subject'} = [];
-		$bonus{'author'}  = [ { "CASE WHEN $search_group_name.value ILIKE ? THEN 1.5 ELSE 1 END" => $first_word } ];
-
-		$bonus{'keyword'} = [ { "CASE WHEN $search_group_name.value ILIKE ? THEN 10 ELSE 1 END" => $SQLstring } ];
-
-		$bonus{'series'} = [
-			{ "CASE WHEN $search_group_name.value ILIKE ? THEN 1.5 ELSE 1 END" => $first_word },
-			{ "CASE WHEN $search_group_name.value ~ ? THEN 20 ELSE 1 END" => $REstring },
-		];
-
-		$bonus{'title'} = [ @{ $bonus{'series'} }, @{ $bonus{'keyword'} } ];
-
-		if ($pref_lang) {
-			push @{ $bonus{'title'}   }, { "CASE WHEN rd.item_lang = ? THEN 10 ELSE 1 END" => $pref_lang };
-			push @{ $bonus{'author'}  }, { "CASE WHEN rd.item_lang = ? THEN 10 ELSE 1 END" => $pref_lang };
-			push @{ $bonus{'subject'} }, { "CASE WHEN rd.item_lang = ? THEN 10 ELSE 1 END" => $pref_lang };
-			push @{ $bonus{'keyword'} }, { "CASE WHEN rd.item_lang = ? THEN 10 ELSE 1 END" => $pref_lang };
-			push @{ $bonus{'series'}  }, { "CASE WHEN rd.item_lang = ? THEN 10 ELSE 1 END" => $pref_lang };
-		}
-
-		my $bonus_list = join ' * ', map { keys %$_ } @{ $bonus{$search_class} };
-		$bonus_list ||= '1';
-
-		push @bonus_lists, $bonus_list;
-		push @bonus_values, map { values %$_ } @{ $bonus{$search_class} };
-
-		#---------------------
-
-		$search_table_list .= "$search_table $search_group_name, ";
-		push @rank_list,$rank;
-		$fts_list .= " AND $fts_where AND b.id = $search_group_name.source";
-
-		if ($metabib_field) {
-			$fts_list .= " AND $curr_search_group.field = " . $metabib_field->id;
-			$metabib_field = undef;
-		}
-
-		if ($prev_search_group) {
-			$join_table_list .= " AND $prev_search_group.source = $curr_search_group.source";
-		}
-	}
-
-	my $metabib_record_descriptor = metabib::record_descriptor->table;
-	my $metabib_full_rec = metabib::full_rec->table;
-	my $metabib_metarecord = metabib::metarecord->table;
-	my $metabib_metarecord_source_map_table = metabib::metarecord_source_map->table;
-	my $asset_call_number_table = asset::call_number->table;
-	my $asset_copy_table = asset::copy->table;
-	my $cs_table = config::copy_status->table;
-	my $cl_table = asset::copy_location->table;
-	my $br_table = biblio::record_entry->table;
-	my $source_table = config::bib_source->table;
-
-
-	my $bonuses = join (' * ', @bonus_lists);
-	my $relevance = join (' + ', @rank_list);
-	$relevance = "AVG( ($relevance) * ($bonuses) )";
-
-	my $string_default_sort = 'zzzz';
-	$string_default_sort = 'AAAA' if ($sort_dir eq 'DESC');
-
-	my $number_default_sort = '9999';
-	$number_default_sort = '0000' if ($sort_dir eq 'DESC');
-
-	my $rank = $relevance;
-	if (lc($sort) eq 'pubdate') {
-		$rank = <<"		RANK";
-			( FIRST ((
-				SELECT	COALESCE(SUBSTRING(frp.value FROM E'\\\\d{4}'),'$number_default_sort')::INT
-				  FROM	$metabib_full_rec frp
-				  WHERE	frp.record = b.id
-				  	AND frp.tag = '260'
-					AND frp.subfield = 'c'
-				  LIMIT 1
-			)) )
-		RANK
-	} elsif (lc($sort) eq 'create_date') {
-		$rank = <<"		RANK";
-			( FIRST (( SELECT create_date FROM $br_table rbr WHERE rbr.id = b.id)) )
-		RANK
-	} elsif (lc($sort) eq 'edit_date') {
-		$rank = <<"		RANK";
-			( FIRST (( SELECT edit_date FROM $br_table rbr WHERE rbr.id = b.id)) )
-		RANK
-	} elsif (lc($sort) eq 'title') {
-		$rank = <<"		RANK";
-			( FIRST ((
-				SELECT	COALESCE(LTRIM(SUBSTR( frt.value, COALESCE(SUBSTRING(frt.ind2 FROM E'\\\\d+'),'0')::INT + 1 )),'$string_default_sort')
-				  FROM	$metabib_full_rec frt
-				  WHERE	frt.record = b.id
-				  	AND frt.tag = '245'
-					AND frt.subfield = 'a'
-				  LIMIT 1
-			)) )
-		RANK
-	} elsif (lc($sort) eq 'author') {
-		$rank = <<"		RANK";
-			( FIRST((
-				SELECT	COALESCE(LTRIM(fra.value),'$string_default_sort')
-				  FROM	$metabib_full_rec fra
-				  WHERE	fra.record = b.id
-				  	AND fra.tag LIKE '1%'
-					AND fra.subfield = 'a'
-				  ORDER BY fra.tag::text::int
-				  LIMIT 1
-			)) )
-		RANK
-	} else {
-		push @bonus_values, @bonus_values;
-		$sort = undef;
-	}
-
-
-	my $select = <<"	SQL";
-		SELECT	b.id,
-			$relevance AS rel,
-			$rank AS rank,
-			b.source
-  	  	FROM	$search_table_list
-			$metabib_record_descriptor rd,
-			$source_table src,
-			$br_table b
-	  	WHERE	rd.record = b.id
-			AND b.active IS TRUE
-			AND b.deleted IS FALSE
-			$fts_list
-			$join_table_list
-			$t_filter
-			$f_filter
-			$v_filter
-			$a_filter
-			$l_filter
-			$lf_filter
-  	  	GROUP BY b.id, b.source
-  	  	ORDER BY 3 $sort_dir
-		LIMIT $visibility_limit
-	SQL
-
-	if ($self->api_name !~ /staff/o) {
-		$select = <<"		SQL";
-
-			SELECT	s.*
-			  FROM	($select) s
-			  	LEFT OUTER JOIN $source_table src ON (s.source = src.id)
-			  WHERE	EXISTS (
-			  	SELECT	1
-				  FROM	$asset_call_number_table cn,
-					$asset_copy_table cp,
-					$cs_table cs,
-					$cl_table cl,
-					$descendants d
-				  WHERE	cn.record = s.id
-					AND cp.status = cs.id
-					AND cp.location = cl.id
-					AND cp.call_number = cn.id
-					AND cp.opac_visible IS TRUE
-					AND cs.opac_visible IS TRUE
-					AND cl.opac_visible IS TRUE
-					AND d.opac_visible IS TRUE
-					AND cp.deleted IS FALSE
-					AND cn.deleted IS FALSE
-					AND cp.circ_lib = d.id
-					$avail_filter
-				  LIMIT 1
-			  	)
-				OR src.transcendant IS TRUE
-			  ORDER BY 3 $sort_dir
-		SQL
-	} else {
-		$select = <<"		SQL";
-
-			SELECT	s.*
-			  FROM	($select) s
-			  	LEFT OUTER JOIN $source_table src ON (s.source = src.id)
-			  WHERE	EXISTS (
-			  	SELECT	1
-				  FROM	$asset_call_number_table cn,
-					$asset_copy_table cp,
-					$descendants d
-				  WHERE	cn.record = s.id
-					AND cp.call_number = cn.id
-					AND cn.deleted IS FALSE
-					AND cp.circ_lib = d.id
-					AND cp.deleted IS FALSE
-					$avail_filter
-				  LIMIT 1
-				)
-				OR NOT EXISTS (
-				SELECT	1
-				  FROM	$asset_call_number_table cn
-				  WHERE	cn.record = s.id
-				  LIMIT 1
-				)
-				OR src.transcendant IS TRUE
-			  ORDER BY 3 $sort_dir
-		SQL
-	}
-
-
-	$log->debug("Field Search SQL :: [$select]",DEBUG);
-
-	my $recs = $_cdbi->{title}->db_Main->selectall_arrayref(
-			$select, {},
-			@bonus_values, @types, @forms, @vformats, @aud, @lang, @lit_form
-	);
-	
-	$log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
-
-	my $count = scalar(@$recs);
-	for my $rec (@$recs[$offset .. $offset + $limit - 1]) {
-		next unless ($$rec[0]);
-		my ($mrid,$rank) = @$rec;
-		$client->respond( [$mrid, sprintf('%0.3f',$rank), $count] );
-	}
-	return undef;
+    my $recs = $_cdbi->{title}->db_Main->selectall_arrayref(
+            $select, {},
+            @bonus_values, @types, @forms, @vformats, @aud, @lang, @lit_form
+    );
+    
+    $log->debug("Search yielded ".scalar(@$recs)." results.",DEBUG);
+
+    my $count = scalar(@$recs);
+    for my $rec (@$recs[$offset .. $offset + $limit - 1]) {
+        next unless ($$rec[0]);
+        my ($mrid,$rank) = @$rec;
+        $client->respond( [$mrid, sprintf('%0.3f',$rank), $count] );
+    }
+    return undef;
 }
 
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.biblio.multiclass.search_fts.record",
-	method		=> 'biblio_search_multi_class_fts',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => "open-ils.storage.biblio.multiclass.search_fts.record",
+    method      => 'biblio_search_multi_class_fts',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.biblio.multiclass.search_fts.record.staff",
-	method		=> 'biblio_search_multi_class_fts',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => "open-ils.storage.biblio.multiclass.search_fts.record.staff",
+    method      => 'biblio_search_multi_class_fts',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.biblio.multiclass.search_fts",
-	method		=> 'biblio_search_multi_class_fts',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => "open-ils.storage.biblio.multiclass.search_fts",
+    method      => 'biblio_search_multi_class_fts',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.biblio.multiclass.search_fts.staff",
-	method		=> 'biblio_search_multi_class_fts',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => "open-ils.storage.biblio.multiclass.search_fts.staff",
+    method      => 'biblio_search_multi_class_fts',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 
 
@@ -2455,18 +2455,18 @@ sub staged_fts {
     my $limit  = $args{limit}  || 10;
     my $offset = $args{offset} ||  0;
 
-	if (!$ou) {
-		$ou = actor::org_unit->search( { parent_ou => undef } )->next->id;
-	}
+    if (!$ou) {
+        $ou = actor::org_unit->search( { parent_ou => undef } )->next->id;
+    }
 
-	if (! scalar( keys %{$args{searches}} )) {
-		die "No search arguments were passed to ".$self->api_name;
-	}
+    if (! scalar( keys %{$args{searches}} )) {
+        die "No search arguments were passed to ".$self->api_name;
+    }
 
-	my (@between, at statuses, at locations, at types, at forms, at lang, at aud, at lit_form, at vformats, at bib_level);
+    my (@between, at statuses, at locations, at types, at forms, at lang, at aud, at lit_form, at vformats, at bib_level);
 
     if (!defined($args{preferred_language})) {
-		my $ses_locale = $client->session ? $client->session->session_locale : $default_preferred_language;
+        my $ses_locale = $client->session ? $client->session->session_locale : $default_preferred_language;
         $args{preferred_language} =
             $locale_map{ lc($ses_locale) } || 'eng';
     }
@@ -2475,99 +2475,99 @@ sub staged_fts {
         $args{preferred_language_weight} = $default_preferred_language_weight || 2;
     }
 
-	if ($args{available}) {
-		@statuses = (0,7,12);
-	}
+    if ($args{available}) {
+        @statuses = (0,7,12);
+    }
 
-	if (my $s = $args{locations}) {
-		$s = [$s] if (!ref($s));
-		@locations = @$s;
-	}
+    if (my $s = $args{locations}) {
+        $s = [$s] if (!ref($s));
+        @locations = @$s;
+    }
 
-	if (my $b = $args{between}) {
-		if (ref($b) && @$b == 2) {
-		    @between = @$b;
+    if (my $b = $args{between}) {
+        if (ref($b) && @$b == 2) {
+            @between = @$b;
         }
-	}
-
-	if (my $s = $args{statuses}) {
-		$s = [$s] if (!ref($s));
-		@statuses = @$s;
-	}
-
-	if (my $a = $args{audience}) {
-		$a = [$a] if (!ref($a));
-		@aud = @$a;
-	}
-
-	if (my $l = $args{language}) {
-		$l = [$l] if (!ref($l));
-		@lang = @$l;
-	}
-
-	if (my $f = $args{lit_form}) {
-		$f = [$f] if (!ref($f));
-		@lit_form = @$f;
-	}
-
-	if (my $f = $args{item_form}) {
-		$f = [$f] if (!ref($f));
-		@forms = @$f;
-	}
-
-	if (my $t = $args{item_type}) {
-		$t = [$t] if (!ref($t));
-		@types = @$t;
-	}
-
-	if (my $b = $args{bib_level}) {
-		$b = [$b] if (!ref($b));
-		@bib_level = @$b;
-	}
-
-	if (my $v = $args{vr_format}) {
-		$v = [$v] if (!ref($v));
-		@vformats = @$v;
-	}
-
-	# XXX legacy format and item type support
-	if ($args{format}) {
-		my ($t, $f) = split '-', $args{format};
-		@types = split '', $t;
-		@forms = split '', $f;
-	}
+    }
+
+    if (my $s = $args{statuses}) {
+        $s = [$s] if (!ref($s));
+        @statuses = @$s;
+    }
+
+    if (my $a = $args{audience}) {
+        $a = [$a] if (!ref($a));
+        @aud = @$a;
+    }
+
+    if (my $l = $args{language}) {
+        $l = [$l] if (!ref($l));
+        @lang = @$l;
+    }
+
+    if (my $f = $args{lit_form}) {
+        $f = [$f] if (!ref($f));
+        @lit_form = @$f;
+    }
+
+    if (my $f = $args{item_form}) {
+        $f = [$f] if (!ref($f));
+        @forms = @$f;
+    }
+
+    if (my $t = $args{item_type}) {
+        $t = [$t] if (!ref($t));
+        @types = @$t;
+    }
+
+    if (my $b = $args{bib_level}) {
+        $b = [$b] if (!ref($b));
+        @bib_level = @$b;
+    }
+
+    if (my $v = $args{vr_format}) {
+        $v = [$v] if (!ref($v));
+        @vformats = @$v;
+    }
+
+    # XXX legacy format and item type support
+    if ($args{format}) {
+        my ($t, $f) = split '-', $args{format};
+        @types = split '', $t;
+        @forms = split '', $f;
+    }
 
     my %stored_proc_search_args;
-	for my $search_group (sort keys %{$args{searches}}) {
-		(my $search_group_name = $search_group) =~ s/\|/_/gso;
-		my ($search_class,$search_field) = split /\|/, $search_group;
-		$log->debug("Searching class [$search_class] and field [$search_field]",DEBUG);
-
-		if ($search_field) {
-			unless ( config::metabib_field->search( field_class => $search_class, name => $search_field )->next ) {
-				$log->warn("Requested class [$search_class] or field [$search_field] does not exist!");
-				return undef;
-			}
-		}
-
-		my $class = $_cdbi->{$search_class};
-		my $search_table = $class->table;
-
-		my ($index_col) = $class->columns('FTS');
-		$index_col ||= 'value';
-
-		
-		my $fts = OpenILS::Application::Storage::FTS->compile(
+    for my $search_group (sort keys %{$args{searches}}) {
+        (my $search_group_name = $search_group) =~ s/\|/_/gso;
+        my ($search_class,$search_field) = split /\|/, $search_group;
+        $log->debug("Searching class [$search_class] and field [$search_field]",DEBUG);
+
+        if ($search_field) {
+            unless ( config::metabib_field->search( field_class => $search_class, name => $search_field )->next ) {
+                $log->warn("Requested class [$search_class] or field [$search_field] does not exist!");
+                return undef;
+            }
+        }
+
+        my $class = $_cdbi->{$search_class};
+        my $search_table = $class->table;
+
+        my ($index_col) = $class->columns('FTS');
+        $index_col ||= 'value';
+
+        
+        my $fts = OpenILS::Application::Storage::FTS->compile(
             $search_class => $args{searches}{$search_group}{term},
             $search_group_name.'.value',
             "$search_group_name.$index_col"
         );
-		$fts->sql_where_clause; # this builds the ranks for us
+        $fts->sql_where_clause; # this builds the ranks for us
 
-		my @fts_ranks   = $fts->fts_rank;
-		my @fts_queries = $fts->fts_query;
-		my @phrases = map { lc($_) } $fts->phrases;
-		my @words   = map { lc($_) } $fts->words;
+        my @fts_ranks   = $fts->fts_rank;
+        my @fts_queries = $fts->fts_query;
+        my @phrases = map { lc($_) } $fts->phrases;
+        my @words   = map { lc($_) } $fts->words;
 
         $stored_proc_search_args{$search_group} = {
             fts_rank    => \@fts_ranks,
@@ -2576,35 +2576,35 @@ sub staged_fts {
             word        => \@words,
         };
 
-	}
-
-	my $param_search_ou = $ou;
-	my $param_depth = $args{depth}; $param_depth = 'NULL' unless (defined($param_depth) and length($param_depth) > 0 );
-	my $param_searches = OpenSRF::Utils::JSON->perl2JSON( \%stored_proc_search_args ); $param_searches =~ s/\$//go; $param_searches = '$$'.$param_searches.'$$';
-	my $param_statuses  = '$${' . join(',', map { s/\$//go; "\"$_\"" } @statuses ) . '}$$';
-	my $param_locations = '$${' . join(',', map { s/\$//go; "\"$_\"" } @locations) . '}$$';
-	my $param_audience  = '$${' . join(',', map { s/\$//go; "\"$_\"" } @aud      ) . '}$$';
-	my $param_language  = '$${' . join(',', map { s/\$//go; "\"$_\"" } @lang     ) . '}$$';
-	my $param_lit_form  = '$${' . join(',', map { s/\$//go; "\"$_\"" } @lit_form ) . '}$$';
-	my $param_types     = '$${' . join(',', map { s/\$//go; "\"$_\"" } @types    ) . '}$$';
-	my $param_forms     = '$${' . join(',', map { s/\$//go; "\"$_\"" } @forms    ) . '}$$';
-	my $param_vformats  = '$${' . join(',', map { s/\$//go; "\"$_\"" } @vformats ) . '}$$';
+    }
+
+    my $param_search_ou = $ou;
+    my $param_depth = $args{depth}; $param_depth = 'NULL' unless (defined($param_depth) and length($param_depth) > 0 );
+    my $param_searches = OpenSRF::Utils::JSON->perl2JSON( \%stored_proc_search_args ); $param_searches =~ s/\$//go; $param_searches = '$$'.$param_searches.'$$';
+    my $param_statuses  = '$${' . join(',', map { s/\$//go; "\"$_\"" } @statuses ) . '}$$';
+    my $param_locations = '$${' . join(',', map { s/\$//go; "\"$_\"" } @locations) . '}$$';
+    my $param_audience  = '$${' . join(',', map { s/\$//go; "\"$_\"" } @aud      ) . '}$$';
+    my $param_language  = '$${' . join(',', map { s/\$//go; "\"$_\"" } @lang     ) . '}$$';
+    my $param_lit_form  = '$${' . join(',', map { s/\$//go; "\"$_\"" } @lit_form ) . '}$$';
+    my $param_types     = '$${' . join(',', map { s/\$//go; "\"$_\"" } @types    ) . '}$$';
+    my $param_forms     = '$${' . join(',', map { s/\$//go; "\"$_\"" } @forms    ) . '}$$';
+    my $param_vformats  = '$${' . join(',', map { s/\$//go; "\"$_\"" } @vformats ) . '}$$';
     my $param_bib_level = '$${' . join(',', map { s/\$//go; "\"$_\"" } @bib_level) . '}$$';
-	my $param_before = $args{before}; $param_before = 'NULL' unless (defined($param_before) and length($param_before) > 0 );
-	my $param_after  = $args{after} ; $param_after  = 'NULL' unless (defined($param_after ) and length($param_after ) > 0 );
-	my $param_during = $args{during}; $param_during = 'NULL' unless (defined($param_during) and length($param_during) > 0 );
+    my $param_before = $args{before}; $param_before = 'NULL' unless (defined($param_before) and length($param_before) > 0 );
+    my $param_after  = $args{after} ; $param_after  = 'NULL' unless (defined($param_after ) and length($param_after ) > 0 );
+    my $param_during = $args{during}; $param_during = 'NULL' unless (defined($param_during) and length($param_during) > 0 );
     my $param_between = '$${"' . join('","', map { int($_) } @between) . '"}$$';
-	my $param_pref_lang = $args{preferred_language}; $param_pref_lang =~ s/\$//go; $param_pref_lang = '$$'.$param_pref_lang.'$$';
-	my $param_pref_lang_multiplier = $args{preferred_language_weight}; $param_pref_lang_multiplier ||= 'NULL';
-	my $param_sort = $args{'sort'}; $param_sort =~ s/\$//go; $param_sort = '$$'.$param_sort.'$$';
-	my $param_sort_desc = defined($args{sort_dir}) && $args{sort_dir} =~ /^d/io ? "'t'" : "'f'";
-	my $metarecord = $self->api_name =~ /metabib/o ? "'t'" : "'f'";
-	my $staff = $self->api_name =~ /staff/o ? "'t'" : "'f'";
+    my $param_pref_lang = $args{preferred_language}; $param_pref_lang =~ s/\$//go; $param_pref_lang = '$$'.$param_pref_lang.'$$';
+    my $param_pref_lang_multiplier = $args{preferred_language_weight}; $param_pref_lang_multiplier ||= 'NULL';
+    my $param_sort = $args{'sort'}; $param_sort =~ s/\$//go; $param_sort = '$$'.$param_sort.'$$';
+    my $param_sort_desc = defined($args{sort_dir}) && $args{sort_dir} =~ /^d/io ? "'t'" : "'f'";
+    my $metarecord = $self->api_name =~ /metabib/o ? "'t'" : "'f'";
+    my $staff = $self->api_name =~ /staff/o ? "'t'" : "'f'";
     my $param_rel_limit = $args{core_limit};  $param_rel_limit ||= 'NULL';
     my $param_chk_limit = $args{check_limit}; $param_chk_limit ||= 'NULL';
     my $param_skip_chk  = $args{skip_check};  $param_skip_chk  ||= 'NULL';
 
-	my $sth = metabib::metarecord_source_map->db_Main->prepare(<<"    SQL");
+    my $sth = metabib::metarecord_source_map->db_Main->prepare(<<"    SQL");
         SELECT  *
           FROM  search.staged_fts(
                     $param_search_ou\:\:INT,
@@ -2660,9 +2660,9 @@ sub staged_fts {
 
     $client->respond( $summary_row );
 
-	$log->debug("Search yielded ".scalar(@$recs)." checked, visible results with an approximate visible total of $estimate.",DEBUG);
+    $log->debug("Search yielded ".scalar(@$recs)." checked, visible results with an approximate visible total of $estimate.",DEBUG);
 
-	for my $rec (@$recs[$offset .. $offset + $limit - 1]) {
+    for my $rec (@$recs[$offset .. $offset + $limit - 1]) {
         delete $$rec{checked};
         delete $$rec{visible};
         delete $$rec{excluded};
@@ -2670,37 +2670,37 @@ sub staged_fts {
         delete $$rec{total};
         $$rec{rel} = sprintf('%0.3f',$$rec{rel});
 
-		$client->respond( $rec );
-	}
-	return undef;
+        $client->respond( $rec );
+    }
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.biblio.multiclass.staged.search_fts",
-	method		=> 'staged_fts',
-	api_level	=> 0,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => "open-ils.storage.biblio.multiclass.staged.search_fts",
+    method      => 'staged_fts',
+    api_level   => 0,
+    stream      => 1,
+    cachable    => 1,
 );
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.biblio.multiclass.staged.search_fts.staff",
-	method		=> 'staged_fts',
-	api_level	=> 0,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => "open-ils.storage.biblio.multiclass.staged.search_fts.staff",
+    method      => 'staged_fts',
+    api_level   => 0,
+    stream      => 1,
+    cachable    => 1,
 );
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.metabib.multiclass.staged.search_fts",
-	method		=> 'staged_fts',
-	api_level	=> 0,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => "open-ils.storage.metabib.multiclass.staged.search_fts",
+    method      => 'staged_fts',
+    api_level   => 0,
+    stream      => 1,
+    cachable    => 1,
 );
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.metabib.multiclass.staged.search_fts.staff",
-	method		=> 'staged_fts',
-	api_level	=> 0,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => "open-ils.storage.metabib.multiclass.staged.search_fts.staff",
+    method      => 'staged_fts',
+    api_level   => 0,
+    stream      => 1,
+    cachable    => 1,
 );
 
 sub FTS_paging_estimate {
@@ -2730,11 +2730,11 @@ sub FTS_paging_estimate {
     };
 }
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.fts_paging_estimate",
-	method		=> 'FTS_paging_estimate',
+    api_name    => "open-ils.storage.fts_paging_estimate",
+    method      => 'FTS_paging_estimate',
     argc        => 5,
     strict      => 1,
-	api_level	=> 1,
+    api_level   => 1,
     signature   => {
         'return'=> q#
             Hash of estimation values based on four variant estimation strategies:
@@ -2784,49 +2784,49 @@ sub xref_count {
     my $term  = $$args{term};
     my $limit = $$args{max} || 1;
     my $min   = $$args{min} || 1;
-	my @classes = @{$$args{class}};
-
-	$limit = $min if ($min > $limit);
-
-	if (!@classes) {
-		@classes = ( qw/ title author subject series keyword / );
-	}
+    my @classes = @{$$args{class}};
 
-	my %matches;
-	my $bre_table = biblio::record_entry->table;
-	my $cn_table  = asset::call_number->table;
-	my $cp_table  = asset::copy->table;
+    $limit = $min if ($min > $limit);
 
-	for my $search_class ( @classes ) {
+    if (!@classes) {
+        @classes = ( qw/ title author subject series keyword / );
+    }
 
-		my $class = $_cdbi->{$search_class};
-		my $search_table = $class->table;
+    my %matches;
+    my $bre_table = biblio::record_entry->table;
+    my $cn_table  = asset::call_number->table;
+    my $cp_table  = asset::copy->table;
 
-		my ($index_col) = $class->columns('FTS');
-		$index_col ||= 'value';
+    for my $search_class ( @classes ) {
 
-		
-		my $where = OpenILS::Application::Storage::FTS
-			->compile($search_class => $term, $search_class.'.value', "$search_class.$index_col")
-			->sql_where_clause;
+        my $class = $_cdbi->{$search_class};
+        my $search_table = $class->table;
 
-		my $SQL = <<"		SQL";
-			SELECT	COUNT(DISTINCT X.source)
-			  FROM	(SELECT	$search_class.source
-				  FROM	$search_table $search_class
-					JOIN $bre_table b ON (b.id = $search_class.source)
-				  WHERE	$where
-				  	AND NOT b.deleted
-					AND b.active
-				  LIMIT $limit) X
-			  HAVING COUNT(DISTINCT X.source) >= $min;
-		SQL
+        my ($index_col) = $class->columns('FTS');
+        $index_col ||= 'value';
 
-		my $res = $class->db_Main->selectrow_arrayref( $SQL );
-		$matches{$search_class} = $res ? $res->[0] : 0;
-	}
+        
+        my $where = OpenILS::Application::Storage::FTS
+            ->compile($search_class => $term, $search_class.'.value', "$search_class.$index_col")
+            ->sql_where_clause;
+
+        my $SQL = <<"        SQL";
+            SELECT  COUNT(DISTINCT X.source)
+              FROM  (SELECT $search_class.source
+                  FROM  $search_table $search_class
+                    JOIN $bre_table b ON (b.id = $search_class.source)
+                  WHERE $where
+                    AND NOT b.deleted
+                    AND b.active
+                  LIMIT $limit) X
+              HAVING COUNT(DISTINCT X.source) >= $min;
+        SQL
+
+        my $res = $class->db_Main->selectrow_arrayref( $SQL );
+        $matches{$search_class} = $res ? $res->[0] : 0;
+    }
 
-	return \%matches;
+    return \%matches;
 }
 __PACKAGE__->register_method(
     api_name  => "open-ils.storage.search.xref",
@@ -2843,9 +2843,9 @@ sub abstract_query2str {
 }
 
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.query_parser.abstract_query.canonicalize",
-	method		=> "abstract_query2str",
-	api_level	=> 1,
+    api_name    => "open-ils.storage.query_parser.abstract_query.canonicalize",
+    method      => "abstract_query2str",
+    api_level   => 1,
     signature   => {
         params  => [
             {desc => q/
@@ -2884,9 +2884,9 @@ sub str2abstract_query {
 }
 
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.query_parser.abstract_query.from_string",
-	method		=> "str2abstract_query",
-	api_level	=> 1,
+    api_name    => "open-ils.storage.query_parser.abstract_query.from_string",
+    method      => "str2abstract_query",
+    api_level   => 1,
     signature   => {
         params  => [
             {desc => "Query", type => "string"},
@@ -2923,9 +2923,9 @@ sub query_parser_fts {
     }
 
     # I hope we have a query!
-	if (! $args{query} ) {
-		die "No query was passed to ".$self->api_name;
-	}
+    if (! $args{query} ) {
+        die "No query was passed to ".$self->api_name;
+    }
 
     my $default_CD_modifiers = OpenSRF::Utils::SettingsClient->new->config_value(
         apps => 'open-ils.search' => app_settings => 'default_CD_modifiers'
@@ -2954,7 +2954,7 @@ sub query_parser_fts {
         $parser->default_preferred_language( $args{preferred_language} );
 
         if (!$parser->default_preferred_language) {
-		    my $ses_locale = $client->session ? $client->session->session_locale : '';
+            my $ses_locale = $client->session ? $client->session->session_locale : '';
             $parser->default_preferred_language( $locale_map{ lc($ses_locale) } );
         }
 
@@ -2989,18 +2989,18 @@ sub query_parser_fts {
     }
 
     # gather the site, if one is specified, defaulting to the in-query version
-	my $ou = $args{org_unit};
-	if (my ($filter) = $query->parse_tree->find_filter('site')) {
+    my $ou = $args{org_unit};
+    if (my ($filter) = $query->parse_tree->find_filter('site')) {
             $ou = $filter->args->[0] if (@{$filter->args});
     }
     $ou = actor::org_unit->search( { shortname => $ou } )->next->id if ($ou and $ou !~ /^(-)?\d+$/);
 
     # gather lasso, as with $ou
-	my $lasso = $args{lasso};
-	if (my ($filter) = $query->parse_tree->find_filter('lasso')) {
+    my $lasso = $args{lasso};
+    if (my ($filter) = $query->parse_tree->find_filter('lasso')) {
             $lasso = $filter->args->[0] if (@{$filter->args});
     }
-	$lasso = actor::org_lasso->search( { name => $lasso } )->next->id if ($lasso and $lasso !~ /^\d+$/);
+    $lasso = actor::org_lasso->search( { name => $lasso } )->next->id if ($lasso and $lasso !~ /^\d+$/);
     $lasso = -$lasso if ($lasso);
 
 
@@ -3018,55 +3018,55 @@ sub query_parser_fts {
 
     # gather the preferred OU, if one is specified, as with $ou
     my $pref_ou = $args{pref_ou};
-	$log->info("pref_ou = $pref_ou");
-	if (my ($filter) = $query->parse_tree->find_filter('pref_ou')) {
+    $log->info("pref_ou = $pref_ou");
+    if (my ($filter) = $query->parse_tree->find_filter('pref_ou')) {
             $pref_ou = $filter->args->[0] if (@{$filter->args});
     }
     $pref_ou = actor::org_unit->search( { shortname => $pref_ou } )->next->id if ($pref_ou and $pref_ou !~ /^(-)?\d+$/);
 
     # get the default $ou if we have nothing
-	$ou = actor::org_unit->search( { parent_ou => undef } )->next->id if (!$ou and !$lasso and !$mylasso);
+    $ou = actor::org_unit->search( { parent_ou => undef } )->next->id if (!$ou and !$lasso and !$mylasso);
 
 
     # XXX when user lassos are here, check to make sure we don't have one -- it'll be passed in the depth, with an ou of 0
     # gather the depth, if one is specified, defaulting to the in-query version
-	my $depth = $args{depth};
-	if (my ($filter) = $query->parse_tree->find_filter('depth')) {
+    my $depth = $args{depth};
+    if (my ($filter) = $query->parse_tree->find_filter('depth')) {
             $depth = $filter->args->[0] if (@{$filter->args});
     }
-	$depth = actor::org_unit->search_where( [{ name => $depth },{ opac_label => $depth }], {limit => 1} )->next->id if ($depth and $depth !~ /^\d+$/);
+    $depth = actor::org_unit->search_where( [{ name => $depth },{ opac_label => $depth }], {limit => 1} )->next->id if ($depth and $depth !~ /^\d+$/);
 
 
     # gather the limit or default to 10
-	my $limit = $args{check_limit} || 'NULL';
-	if (my ($filter) = $query->parse_tree->find_filter('limit')) {
+    my $limit = $args{check_limit} || 'NULL';
+    if (my ($filter) = $query->parse_tree->find_filter('limit')) {
             $limit = $filter->args->[0] if (@{$filter->args});
     }
-	if (my ($filter) = $query->parse_tree->find_filter('check_limit')) {
+    if (my ($filter) = $query->parse_tree->find_filter('check_limit')) {
             $limit = $filter->args->[0] if (@{$filter->args});
     }
 
 
     # gather the offset or default to 0
-	my $offset = $args{skip_check} || $args{offset} || 0;
-	if (my ($filter) = $query->parse_tree->find_filter('offset')) {
+    my $offset = $args{skip_check} || $args{offset} || 0;
+    if (my ($filter) = $query->parse_tree->find_filter('offset')) {
             $offset = $filter->args->[0] if (@{$filter->args});
     }
-	if (my ($filter) = $query->parse_tree->find_filter('skip_check')) {
+    if (my ($filter) = $query->parse_tree->find_filter('skip_check')) {
             $offset = $filter->args->[0] if (@{$filter->args});
     }
 
 
     # gather the estimation strategy or default to inclusion
     my $estimation_strategy = $args{estimation_strategy} || 'inclusion';
-	if (my ($filter) = $query->parse_tree->find_filter('estimation_strategy')) {
+    if (my ($filter) = $query->parse_tree->find_filter('estimation_strategy')) {
             $estimation_strategy = $filter->args->[0] if (@{$filter->args});
     }
 
 
     # gather the estimation strategy or default to inclusion
     my $core_limit = $args{core_limit};
-	if (my ($filter) = $query->parse_tree->find_filter('core_limit')) {
+    if (my ($filter) = $query->parse_tree->find_filter('core_limit')) {
             $core_limit = $filter->args->[0] if (@{$filter->args});
     }
 
@@ -3111,17 +3111,17 @@ sub query_parser_fts {
         $param_offset = ($sp - 1) * $sp_size;
     }
 
-	my $param_search_ou = $ou;
-	my $param_depth = $depth; $param_depth = 'NULL' unless (defined($depth) and length($depth) > 0 );
-	my $param_core_query = "\$core_query_$$\$" . $query->parse_tree->toSQL . "\$core_query_$$\$";
-	my $param_statuses = '$${' . join(',', map { s/\$//go; "\"$_\""} @statuses) . '}$$';
-	my $param_locations = '$${' . join(',', map { s/\$//go; "\"$_\""} @location) . '}$$';
-	my $staff = ($self->api_name =~ /staff/ or $query->parse_tree->find_modifier('staff')) ? "'t'" : "'f'";
-	my $deleted_search = ($query->parse_tree->find_modifier('deleted')) ? "'t'" : "'f'";
-	my $metarecord = ($self->api_name =~ /metabib/ or $query->parse_tree->find_modifier('metabib') or $query->parse_tree->find_modifier('metarecord')) ? "'t'" : "'f'";
-	my $param_pref_ou = $pref_ou || 'NULL';
-
-	my $sth = metabib::metarecord_source_map->db_Main->prepare(<<"    SQL");
+    my $param_search_ou = $ou;
+    my $param_depth = $depth; $param_depth = 'NULL' unless (defined($depth) and length($depth) > 0 );
+    my $param_core_query = "\$core_query_$$\$" . $query->parse_tree->toSQL . "\$core_query_$$\$";
+    my $param_statuses = '$${' . join(',', map { s/\$//go; "\"$_\""} @statuses) . '}$$';
+    my $param_locations = '$${' . join(',', map { s/\$//go; "\"$_\""} @location) . '}$$';
+    my $staff = ($self->api_name =~ /staff/ or $query->parse_tree->find_modifier('staff')) ? "'t'" : "'f'";
+    my $deleted_search = ($query->parse_tree->find_modifier('deleted')) ? "'t'" : "'f'";
+    my $metarecord = ($self->api_name =~ /metabib/ or $query->parse_tree->find_modifier('metabib') or $query->parse_tree->find_modifier('metarecord')) ? "'t'" : "'f'";
+    my $param_pref_ou = $pref_ou || 'NULL';
+
+    my $sth = metabib::metarecord_source_map->db_Main->prepare(<<"    SQL");
         SELECT  * -- bib search: $args{query}
           FROM  search.query_parser_fts(
                     $param_search_ou\:\:INT,
@@ -3170,9 +3170,9 @@ sub query_parser_fts {
 
     $client->respond( $summary_row );
 
-	$log->debug("Search yielded ".scalar(@$recs)." checked, visible results with an approximate visible total of $estimate.",DEBUG);
+    $log->debug("Search yielded ".scalar(@$recs)." checked, visible results with an approximate visible total of $estimate.",DEBUG);
 
-	for my $rec (@$recs) {
+    for my $rec (@$recs) {
         delete $$rec{checked};
         delete $$rec{visible};
         delete $$rec{excluded};
@@ -3180,38 +3180,38 @@ sub query_parser_fts {
         delete $$rec{total};
         $$rec{rel} = sprintf('%0.3f',$$rec{rel});
 
-		$client->respond( $rec );
-	}
-	return undef;
+        $client->respond( $rec );
+    }
+    return undef;
 }
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.query_parser_search",
-	method		=> 'query_parser_fts',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => "open-ils.storage.query_parser_search",
+    method      => 'query_parser_fts',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 
 sub query_parser_fts_wrapper {
-	my $self = shift;
-	my $client = shift;
-	my %args = @_;
+    my $self = shift;
+    my $client = shift;
+    my %args = @_;
 
- 	$log->debug("Entering compatability wrapper function for old-style staged search", DEBUG);
+    $log->debug("Entering compatability wrapper function for old-style staged search", DEBUG);
     # grab the query parser and initialize it
     my $parser = $OpenILS::Application::Storage::QParser;
     $parser->use;
 
     _initialize_parser($parser) unless $parser->initialization_complete;
 
-	if (! scalar( keys %{$args{searches}} )) {
-		die "No search arguments were passed to ".$self->api_name;
-	}
+    if (! scalar( keys %{$args{searches}} )) {
+        die "No search arguments were passed to ".$self->api_name;
+    }
 
- 	$log->debug("Constructing QueryParser query from staged search hash ...", DEBUG);
+    $log->debug("Constructing QueryParser query from staged search hash ...", DEBUG);
     my $base_query = '';
     for my $sclass ( keys %{$args{searches}} ) {
- 	    $log->debug(" --> staged search key: $sclass --> term: $args{searches}{$sclass}{term}", DEBUG);
+        $log->debug(" --> staged search key: $sclass --> term: $args{searches}{$sclass}{term}", DEBUG);
         $base_query .= " $sclass: $args{searches}{$sclass}{term}";
     }
 
@@ -3261,27 +3261,27 @@ sub query_parser_fts_wrapper {
         if ( ref($args{between}) and @{$args{between}} == 2 and $args{between}[0] =~ /^\d+$/ and $args{between}[1] =~ /^\d+$/ );
 
 
-	my (@between, at statuses, at locations, at location_groups, at types, at forms, at lang, at aud, at lit_form, at vformats, at bib_level);
+    my (@between, at statuses, at locations, at location_groups, at types, at forms, at lang, at aud, at lit_form, at vformats, at bib_level);
 
-	# XXX legacy format and item type support
-	if ($args{format}) {
-		my ($t, $f) = split '-', $args{format};
-		$args{item_type} = [ split '', $t ];
-		$args{item_form} = [ split '', $f ];
-	}
+    # XXX legacy format and item type support
+    if ($args{format}) {
+        my ($t, $f) = split '-', $args{format};
+        $args{item_type} = [ split '', $t ];
+        $args{item_form} = [ split '', $f ];
+    }
 
     for my $filter ( qw/locations location_groups statuses between audience language lit_form item_form item_type bib_level vr_format/ ) {
-    	if (my $s = $args{$filter}) {
-    		$s = [$s] if (!ref($s));
+        if (my $s = $args{$filter}) {
+            $s = [$s] if (!ref($s));
 
-    		my @filter_list = @$s;
+            my @filter_list = @$s;
 
             next if ($filter eq 'between' and scalar(@filter_list) != 2);
             next if (@filter_list == 0);
 
             my $filter_string = join ',', @filter_list;
             $query = "$query $filter($filter_string)";
-	    }
+        }
     }
 
     $log->debug("Full QueryParser query: $query", DEBUG);
@@ -3289,32 +3289,32 @@ sub query_parser_fts_wrapper {
     return query_parser_fts($self, $client, query => $query, _simple_plan => $base_plan->simple_plan );
 }
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.biblio.multiclass.staged.search_fts",
-	method		=> 'query_parser_fts_wrapper',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => "open-ils.storage.biblio.multiclass.staged.search_fts",
+    method      => 'query_parser_fts_wrapper',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.biblio.multiclass.staged.search_fts.staff",
-	method		=> 'query_parser_fts_wrapper',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => "open-ils.storage.biblio.multiclass.staged.search_fts.staff",
+    method      => 'query_parser_fts_wrapper',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.metabib.multiclass.staged.search_fts",
-	method		=> 'query_parser_fts_wrapper',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => "open-ils.storage.metabib.multiclass.staged.search_fts",
+    method      => 'query_parser_fts_wrapper',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 __PACKAGE__->register_method(
-	api_name	=> "open-ils.storage.metabib.multiclass.staged.search_fts.staff",
-	method		=> 'query_parser_fts_wrapper',
-	api_level	=> 1,
-	stream		=> 1,
-	cachable	=> 1,
+    api_name    => "open-ils.storage.metabib.multiclass.staged.search_fts.staff",
+    method      => 'query_parser_fts_wrapper',
+    api_level   => 1,
+    stream      => 1,
+    cachable    => 1,
 );
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/money.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/money.pm
index a8336ea..877ffd7 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/money.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/money.pm
@@ -19,7 +19,7 @@ sub _make_mbts {
                 my $lb = undef;
                 for my $b ($x->billings) {
                         next if ($b->voided);
-			#$log->debug( "billing is ".$b->amount, DEBUG );
+            #$log->debug( "billing is ".$b->amount, DEBUG );
                         $to += ($b->amount * 100);
                         $lb ||= $b->billing_ts;
                         if ($b->billing_ts ge $lb) {
@@ -35,7 +35,7 @@ sub _make_mbts {
                 my $tp = 0;
                 my $lp = undef;
                 for my $p ($x->payments) {
-			#$log->debug( "payment is ".$p->amount." voided = ".$p->voided, DEBUG );
+            #$log->debug( "payment is ".$p->amount." voided = ".$p->voided, DEBUG );
                         next if ($p->voided eq 't');
                         $tp += ($p->amount * 100);
                         $lp ||= $p->payment_ts;
@@ -49,7 +49,7 @@ sub _make_mbts {
                 $s->total_paid( sprintf('%0.2f', ($tp) / 100 ) );
 
                 $s->balance_owed( sprintf('%0.2f', (($to) - ($tp)) / 100) );
-		#$log->debug( "balance of ".$x->id." == ".$s->balance_owed, DEBUG );
+        #$log->debug( "balance of ".$x->id." == ".$s->balance_owed, DEBUG );
 
                 if (action::circulation->retrieve($x->id)) {
                     $s->xact_type( 'circulation' );
@@ -66,66 +66,66 @@ sub _make_mbts {
 }
 
 sub search_mbts {
-	my $self = shift;
-	my $client = shift;
-	my $search = shift;
+    my $self = shift;
+    my $client = shift;
+    my $search = shift;
 
-	my @xacts = money::billable_transaction->search_where( $search );
-	$client->respond( $_ ) for (_make_mbts(@xacts));
+    my @xacts = money::billable_transaction->search_where( $search );
+    $client->respond( $_ ) for (_make_mbts(@xacts));
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
-	method		=> 'search_mbts',
-	api_name	=> 'open-ils.storage.money.billable_transaction.summary.search',
-	stream		=> 1,
-	argc		=> 1,
+    method      => 'search_mbts',
+    api_name    => 'open-ils.storage.money.billable_transaction.summary.search',
+    stream      => 1,
+    argc        => 1,
 );
 
 sub search_ous {
-	my $self = shift;
-	my $client = shift;
-	my $usr = shift;
-
-	my @xacts = $self->method_lookup( 'open-ils.storage.money.billable_transaction.summary.search' )->run( { usr => $usr, xact_finish => undef } );
-
-	my ($total,$owed,$paid) = (0.0,0.0,0.0);
-	for my $x (@xacts) {
-		$total += $x->total_owed;
-		$owed += $x->balance_owed;
-		$paid += $x->total_paid;
-	}
-
-	my $ous = Fieldmapper::money::open_user_summary->new;
-	$ous->usr( $usr );
-	$ous->total_paid( sprintf('%0.2f', $paid) );
-	$ous->total_owed( sprintf('%0.2f', $total) );
-	$ous->balance_owed( sprintf('%0.2f', $owed) );
-
-	return $ous;
+    my $self = shift;
+    my $client = shift;
+    my $usr = shift;
+
+    my @xacts = $self->method_lookup( 'open-ils.storage.money.billable_transaction.summary.search' )->run( { usr => $usr, xact_finish => undef } );
+
+    my ($total,$owed,$paid) = (0.0,0.0,0.0);
+    for my $x (@xacts) {
+        $total += $x->total_owed;
+        $owed += $x->balance_owed;
+        $paid += $x->total_paid;
+    }
+
+    my $ous = Fieldmapper::money::open_user_summary->new;
+    $ous->usr( $usr );
+    $ous->total_paid( sprintf('%0.2f', $paid) );
+    $ous->total_owed( sprintf('%0.2f', $total) );
+    $ous->balance_owed( sprintf('%0.2f', $owed) );
+
+    return $ous;
 }
 __PACKAGE__->register_method(
-	method		=> 'search_ous',
-	api_name	=> 'open-ils.storage.money.open_user_summary.search',
-	argc		=> 1,
+    method      => 'search_ous',
+    api_name    => 'open-ils.storage.money.open_user_summary.search',
+    argc        => 1,
 );
 
 
 sub new_collections {
-	my $self = shift;
-	my $client = shift;
-	my $age = shift;
-	my $amount = shift;
-	my @loc = @_;
+    my $self = shift;
+    my $client = shift;
+    my $age = shift;
+    my $amount = shift;
+    my @loc = @_;
 
-	my $mct = money::collections_tracker->table;
-	my $mb = money::billing->table;
-	my $circ = action::circulation->table;
-	my $mg = money::grocery->table;
-	my $res = booking::reservation->table;
-	my $descendants = "actor.org_unit_descendants((select id from actor.org_unit where shortname = ?))";
+    my $mct = money::collections_tracker->table;
+    my $mb = money::billing->table;
+    my $circ = action::circulation->table;
+    my $mg = money::grocery->table;
+    my $res = booking::reservation->table;
+    my $descendants = "actor.org_unit_descendants((select id from actor.org_unit where shortname = ?))";
 
-	my $SQL = <<"	SQL";
+    my $SQL = <<"    SQL";
 
 select
         usr,
@@ -190,52 +190,52 @@ select
   group by 1
   having SUM(total_billing) - SUM(COALESCE(p.amount,0)) > ?
 ;
-	SQL
+    SQL
 
-	my @l_ids;
-	for my $l (@loc) {
-		my ($org) = actor::org_unit->search( shortname => uc($l) );
-		next unless $org;
+    my @l_ids;
+    for my $l (@loc) {
+        my ($org) = actor::org_unit->search( shortname => uc($l) );
+        next unless $org;
 
-		my $o_list = actor::org_unit->db_Main->selectcol_arrayref( "SELECT id FROM actor.org_unit_descendants(?);", {}, $org->id );
-		next unless (@$o_list);
+        my $o_list = actor::org_unit->db_Main->selectcol_arrayref( "SELECT id FROM actor.org_unit_descendants(?);", {}, $org->id );
+        next unless (@$o_list);
 
-		my $o_txt = join ',' => @$o_list;
+        my $o_txt = join ',' => @$o_list;
 
-		(my $real_sql = $SQL) =~ s/XX/$o_txt/gsm;
+        (my $real_sql = $SQL) =~ s/XX/$o_txt/gsm;
 
-		my $sth = money::collections_tracker->db_Main->prepare($real_sql);
-		$sth->execute( $org->id, $age, $org->id, $age, $org->id, $age, $amount );
+        my $sth = money::collections_tracker->db_Main->prepare($real_sql);
+        $sth->execute( $org->id, $age, $org->id, $age, $org->id, $age, $amount );
 
-		while (my $row = $sth->fetchrow_hashref) {
-			#$row->{usr} = actor::user->retrieve($row->{usr})->to_fieldmapper;
-			$client->respond( $row );
-		}
-	}
-	return undef;
+        while (my $row = $sth->fetchrow_hashref) {
+            #$row->{usr} = actor::user->retrieve($row->{usr})->to_fieldmapper;
+            $client->respond( $row );
+        }
+    }
+    return undef;
 }
 __PACKAGE__->register_method(
-	method		=> 'new_collections',
-	api_name	=> 'open-ils.storage.money.collections.users_of_interest',
-	stream		=> 1,
-	argc		=> 3,
+    method      => 'new_collections',
+    api_name    => 'open-ils.storage.money.collections.users_of_interest',
+    stream      => 1,
+    argc        => 3,
 );
 
 sub users_owing_money {
-	my $self = shift;
-	my $client = shift;
-	my $start = shift;
-	my $end = shift;
-	my $amount = shift;
-	my @loc = @_;
+    my $self = shift;
+    my $client = shift;
+    my $start = shift;
+    my $end = shift;
+    my $amount = shift;
+    my @loc = @_;
 
-	my $mct = money::collections_tracker->table;
-	my $mb = money::billing->table;
-	my $circ = action::circulation->table;
-	my $mg = money::grocery->table;
-	my $descendants = "actor.org_unit_descendants((select id from actor.org_unit where shortname = ?))";
+    my $mct = money::collections_tracker->table;
+    my $mb = money::billing->table;
+    my $circ = action::circulation->table;
+    my $mg = money::grocery->table;
+    my $descendants = "actor.org_unit_descendants((select id from actor.org_unit where shortname = ?))";
 
-	my $SQL = <<"	SQL";
+    my $SQL = <<"    SQL";
 
 select
         usr,
@@ -284,50 +284,50 @@ select
   group by 1
   having SUM(total_billing) - SUM(COALESCE(p.amount,0)) > ?
 ;
-	SQL
+    SQL
 
-	my @l_ids;
-	for my $l (@loc) {
-		my ($org) = actor::org_unit->search( shortname => uc($l) );
-		next unless $org;
+    my @l_ids;
+    for my $l (@loc) {
+        my ($org) = actor::org_unit->search( shortname => uc($l) );
+        next unless $org;
 
-		my $o_list = actor::org_unit->db_Main->selectcol_arrayref( "SELECT id FROM actor.org_unit_descendants(?);", {}, $org->id );
-		next unless (@$o_list);
+        my $o_list = actor::org_unit->db_Main->selectcol_arrayref( "SELECT id FROM actor.org_unit_descendants(?);", {}, $org->id );
+        next unless (@$o_list);
 
-		my $o_txt = join ',' => @$o_list;
+        my $o_txt = join ',' => @$o_list;
 
-		(my $real_sql = $SQL) =~ s/XX/$o_txt/gsm;
+        (my $real_sql = $SQL) =~ s/XX/$o_txt/gsm;
 
-		my $sth = money::collections_tracker->db_Main->prepare($real_sql);
-		$sth->execute( $start, $end, $start, $end, $amount );
+        my $sth = money::collections_tracker->db_Main->prepare($real_sql);
+        $sth->execute( $start, $end, $start, $end, $amount );
 
-		while (my $row = $sth->fetchrow_hashref) {
-			#$row->{usr} = actor::user->retrieve($row->{usr})->to_fieldmapper;
-			$client->respond( $row );
-		}
-	}
-	return undef;
+        while (my $row = $sth->fetchrow_hashref) {
+            #$row->{usr} = actor::user->retrieve($row->{usr})->to_fieldmapper;
+            $client->respond( $row );
+        }
+    }
+    return undef;
 }
 __PACKAGE__->register_method(
-	method		=> 'users_owing_money',
-	api_name	=> 'open-ils.storage.money.collections.users_owing_money',
-	stream		=> 1,
-	argc		=> 4,
+    method      => 'users_owing_money',
+    api_name    => 'open-ils.storage.money.collections.users_owing_money',
+    stream      => 1,
+    argc        => 4,
 );
 
 sub active_in_collections {
-	my $self = shift;
-	my $client = shift;
-	my $startdate = shift;
-	my $enddate = shift;
-	my @loc = @_;
-
-	my $mct = money::collections_tracker->table;
-	my $mb = money::billing->table;
-	my $circ = action::circulation->table;
-	my $mg = money::grocery->table;
-
-	my $SQL = <<"	SQL";
+    my $self = shift;
+    my $client = shift;
+    my $startdate = shift;
+    my $enddate = shift;
+    my @loc = @_;
+
+    my $mct = money::collections_tracker->table;
+    my $mb = money::billing->table;
+    my $circ = action::circulation->table;
+    my $mg = money::grocery->table;
+
+    my $SQL = <<"    SQL";
 SELECT  usr,
         MAX(last_pertinent_billing) AS last_pertinent_billing,
         MAX(last_pertinent_payment) AS last_pertinent_payment
@@ -452,166 +452,166 @@ SELECT  usr,
         ) foo
   GROUP BY 1
 ;
-	SQL
+    SQL
 
-	my @l_ids;
-	for my $l (@loc) {
-		my ($org) = actor::org_unit->search( shortname => uc($l) );
-		next unless $org;
+    my @l_ids;
+    for my $l (@loc) {
+        my ($org) = actor::org_unit->search( shortname => uc($l) );
+        next unless $org;
 
-		my $o_list = actor::org_unit->db_Main->selectcol_arrayref( "SELECT id FROM actor.org_unit_descendants(?);", {}, $org->id );
-		next unless (@$o_list);
+        my $o_list = actor::org_unit->db_Main->selectcol_arrayref( "SELECT id FROM actor.org_unit_descendants(?);", {}, $org->id );
+        next unless (@$o_list);
 
-		my $o_txt = join ',' => @$o_list;
+        my $o_txt = join ',' => @$o_list;
 
-		(my $real_sql = $SQL) =~ s/XX/$o_txt/gsm;
+        (my $real_sql = $SQL) =~ s/XX/$o_txt/gsm;
 
-		my $sth = money::collections_tracker->db_Main->prepare($real_sql);
-		$sth->execute(
+        my $sth = money::collections_tracker->db_Main->prepare($real_sql);
+        $sth->execute(
             # reservation queries
-			$org->id, $startdate, $enddate,
-			$org->id, $startdate, $enddate,
-			$org->id, $startdate, $enddate,
+            $org->id, $startdate, $enddate,
+            $org->id, $startdate, $enddate,
+            $org->id, $startdate, $enddate,
 
             # grocery queries
-			$org->id, $startdate, $enddate,
-			$org->id, $startdate, $enddate,
-			$org->id, $startdate, $enddate,
+            $org->id, $startdate, $enddate,
+            $org->id, $startdate, $enddate,
+            $org->id, $startdate, $enddate,
 
             # circ queries
-			$org->id, $startdate, $enddate,
-			$org->id, $startdate, $enddate,
-			$org->id, $startdate, $enddate,
-			$org->id, $startdate, $enddate
-		);
-
-		while (my $row = $sth->fetchrow_hashref) {
-			$row->{usr} = actor::user->retrieve($row->{usr})->to_fieldmapper;
-			$client->respond( $row );
-		}
-	}
-	return undef;
+            $org->id, $startdate, $enddate,
+            $org->id, $startdate, $enddate,
+            $org->id, $startdate, $enddate,
+            $org->id, $startdate, $enddate
+        );
+
+        while (my $row = $sth->fetchrow_hashref) {
+            $row->{usr} = actor::user->retrieve($row->{usr})->to_fieldmapper;
+            $client->respond( $row );
+        }
+    }
+    return undef;
 }
 __PACKAGE__->register_method(
-	method		=> 'active_in_collections',
-	api_name	=> 'open-ils.storage.money.collections.users_with_activity',
-	stream		=> 1,
-	argc		=> 3,
+    method      => 'active_in_collections',
+    api_name    => 'open-ils.storage.money.collections.users_with_activity',
+    stream      => 1,
+    argc        => 3,
 );
 
 sub ou_desk_payments {
-	my $self = shift;
-	my $client = shift;
-	my $lib = shift;
-	my $startdate = shift;
-	my $enddate = shift;
-
-	return undef unless ($startdate =~ /^\d{4}-\d{2}-\d{2}$/o);
-	return undef unless ($enddate =~ /^\d{4}-\d{2}-\d{2}$/o);
-	return undef unless ($lib =~ /^\d+$/o);
-
-	my $sql = <<"	SQL";
-
-	SELECT	ws.id as workstation,
-		SUM( CASE WHEN p.payment_type = 'cash_payment' THEN p.amount ELSE 0.0 END ) as cash_payment,
-		SUM( CASE WHEN p.payment_type = 'check_payment' THEN p.amount ELSE 0.0 END ) as check_payment,
-		SUM( CASE WHEN p.payment_type = 'credit_card_payment' THEN p.amount ELSE 0.0 END ) as credit_card_payment
-	  FROM	money.desk_payment_view p
-		JOIN actor.workstation ws ON (ws.id = p.cash_drawer)
-	  WHERE	p.payment_ts >= '$startdate'
-		AND p.payment_ts < '$enddate'::TIMESTAMPTZ + INTERVAL '1 day'
-		AND p.voided IS FALSE
-		AND ws.owning_lib = $lib
-	 GROUP BY 1
-	 ORDER BY 1;
-
-	SQL
-
-	my $rows = money::payment->db_Main->selectall_arrayref( $sql );
-
-	for my $r (@$rows) {
-		my $x = new Fieldmapper::money::workstation_payment_summary;
-		$x->workstation( actor::workstation->retrieve($$r[0])->to_fieldmapper );
-		$x->cash_payment($$r[1]);
-		$x->check_payment($$r[2]);
-		$x->credit_card_payment($$r[3]);
-
-		$client->respond($x);
-	}
-
-	return undef;
+    my $self = shift;
+    my $client = shift;
+    my $lib = shift;
+    my $startdate = shift;
+    my $enddate = shift;
+
+    return undef unless ($startdate =~ /^\d{4}-\d{2}-\d{2}$/o);
+    return undef unless ($enddate =~ /^\d{4}-\d{2}-\d{2}$/o);
+    return undef unless ($lib =~ /^\d+$/o);
+
+    my $sql = <<"    SQL";
+
+    SELECT  ws.id as workstation,
+        SUM( CASE WHEN p.payment_type = 'cash_payment' THEN p.amount ELSE 0.0 END ) as cash_payment,
+        SUM( CASE WHEN p.payment_type = 'check_payment' THEN p.amount ELSE 0.0 END ) as check_payment,
+        SUM( CASE WHEN p.payment_type = 'credit_card_payment' THEN p.amount ELSE 0.0 END ) as credit_card_payment
+      FROM  money.desk_payment_view p
+        JOIN actor.workstation ws ON (ws.id = p.cash_drawer)
+      WHERE p.payment_ts >= '$startdate'
+        AND p.payment_ts < '$enddate'::TIMESTAMPTZ + INTERVAL '1 day'
+        AND p.voided IS FALSE
+        AND ws.owning_lib = $lib
+     GROUP BY 1
+     ORDER BY 1;
+
+    SQL
+
+    my $rows = money::payment->db_Main->selectall_arrayref( $sql );
+
+    for my $r (@$rows) {
+        my $x = new Fieldmapper::money::workstation_payment_summary;
+        $x->workstation( actor::workstation->retrieve($$r[0])->to_fieldmapper );
+        $x->cash_payment($$r[1]);
+        $x->check_payment($$r[2]);
+        $x->credit_card_payment($$r[3]);
+
+        $client->respond($x);
+    }
+
+    return undef;
 }
 __PACKAGE__->register_method(
-	method		=> 'ou_desk_payments',
-	api_name	=> 'open-ils.storage.money.org_unit.desk_payments',
-	stream		=> 1,
-	argc		=> 3,
+    method      => 'ou_desk_payments',
+    api_name    => 'open-ils.storage.money.org_unit.desk_payments',
+    stream      => 1,
+    argc        => 3,
 );
 
 sub ou_user_payments {
-	my $self = shift;
-	my $client = shift;
-	my $lib = shift;
-	my $startdate = shift;
-	my $enddate = shift;
-
-	return undef unless ($startdate =~ /^\d{4}-\d{2}-\d{2}$/o);
-	return undef unless ($enddate =~ /^\d{4}-\d{2}-\d{2}$/o);
-	return undef unless ($lib =~ /^\d+$/o);
-
-	my $sql = <<"	SQL";
-
-       	SELECT	au.id as usr,
-		SUM( CASE WHEN p.payment_type = 'forgive_payment' THEN p.amount ELSE 0.0 END ) as forgive_payment,
-		SUM( CASE WHEN p.payment_type = 'work_payment' THEN p.amount ELSE 0.0 END ) as work_payment,
-		SUM( CASE WHEN p.payment_type = 'credit_payment' THEN p.amount ELSE 0.0 END ) as credit_payment,
-		SUM( CASE WHEN p.payment_type = 'goods_payment' THEN p.amount ELSE 0.0 END ) as goods_payment
+    my $self = shift;
+    my $client = shift;
+    my $lib = shift;
+    my $startdate = shift;
+    my $enddate = shift;
+
+    return undef unless ($startdate =~ /^\d{4}-\d{2}-\d{2}$/o);
+    return undef unless ($enddate =~ /^\d{4}-\d{2}-\d{2}$/o);
+    return undef unless ($lib =~ /^\d+$/o);
+
+    my $sql = <<"    SQL";
+
+        SELECT  au.id as usr,
+        SUM( CASE WHEN p.payment_type = 'forgive_payment' THEN p.amount ELSE 0.0 END ) as forgive_payment,
+        SUM( CASE WHEN p.payment_type = 'work_payment' THEN p.amount ELSE 0.0 END ) as work_payment,
+        SUM( CASE WHEN p.payment_type = 'credit_payment' THEN p.amount ELSE 0.0 END ) as credit_payment,
+        SUM( CASE WHEN p.payment_type = 'goods_payment' THEN p.amount ELSE 0.0 END ) as goods_payment
           FROM  money.bnm_payment_view p
                 JOIN actor.usr au ON (au.id = p.accepting_usr)
           WHERE p.payment_ts >= '$startdate'
                 AND p.payment_ts < '$enddate'::TIMESTAMPTZ + INTERVAL '1 day'
                 AND p.voided IS FALSE
                 AND au.home_ou = $lib
-		AND p.payment_type IN ('credit_payment','forgive_payment','work_payment','goods_payment')
+        AND p.payment_type IN ('credit_payment','forgive_payment','work_payment','goods_payment')
          GROUP BY 1
          ORDER BY 1;
 
-	SQL
+    SQL
 
-	my $rows = money::payment->db_Main->selectall_arrayref( $sql );
+    my $rows = money::payment->db_Main->selectall_arrayref( $sql );
 
-	for my $r (@$rows) {
-		my $x = new Fieldmapper::money::user_payment_summary;
-		$x->usr( actor::user->retrieve($$r[0])->to_fieldmapper );
-		$x->forgive_payment($$r[1]);
-		$x->work_payment($$r[2]);
-		$x->credit_payment($$r[3]);
-		$x->goods_payment($$r[4]);
+    for my $r (@$rows) {
+        my $x = new Fieldmapper::money::user_payment_summary;
+        $x->usr( actor::user->retrieve($$r[0])->to_fieldmapper );
+        $x->forgive_payment($$r[1]);
+        $x->work_payment($$r[2]);
+        $x->credit_payment($$r[3]);
+        $x->goods_payment($$r[4]);
 
-		$client->respond($x);
-	}
+        $client->respond($x);
+    }
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
-	method		=> 'ou_user_payments',
-	api_name	=> 'open-ils.storage.money.org_unit.user_payments',
-	stream		=> 1,
-	argc		=> 3,
+    method      => 'ou_user_payments',
+    api_name    => 'open-ils.storage.money.org_unit.user_payments',
+    stream      => 1,
+    argc        => 3,
 );
 
 sub mark_unrecovered {
-	my $self = shift;
-	my $xact = shift;
+    my $self = shift;
+    my $xact = shift;
 
     my $x = money::billable_xact->retrieve($xact);
     $x->unrecovered( 't' );
     return $x->update;
 }
 __PACKAGE__->register_method(
-	method		=> 'mark_unrecovered',
-	api_name	=> 'open-ils.storage.money.billable_xact.mark_unrecovered',
-	argc		=> 1,
+    method      => 'mark_unrecovered',
+    api_name    => 'open-ils.storage.money.billable_xact.mark_unrecovered',
+    argc        => 1,
 );
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/permission.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/permission.pm
index 5253627..52733c4 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/permission.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/permission.pm
@@ -4,107 +4,107 @@ use base qw/OpenILS::Application::Storage/;
 
 
 sub retrieve_all {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	for my $rec ( permission::grp_tree->retrieve_all ) {
-		$client->respond( $rec->to_fieldmapper );
-	}
+    for my $rec ( permission::grp_tree->retrieve_all ) {
+        $client->respond( $rec->to_fieldmapper );
+    }
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
-	method		=> 'retrieve_all',
-	api_name	=> 'open-ils.storage.direct.permission.grp_tree.retrieve.all',
-	argc		=> 0,
-	stream		=> 1,
+    method      => 'retrieve_all',
+    api_name    => 'open-ils.storage.direct.permission.grp_tree.retrieve.all',
+    argc        => 0,
+    stream      => 1,
 );
 
 sub retrieve_perms {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	for my $rec ( sort { $a->code cmp $b->code } permission::perm_list->retrieve_all ) {
-		$client->respond( $rec->to_fieldmapper );
-	}
+    for my $rec ( sort { $a->code cmp $b->code } permission::perm_list->retrieve_all ) {
+        $client->respond( $rec->to_fieldmapper );
+    }
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
-	method		=> 'retrieve_perms',
-	api_name	=> 'open-ils.storage.direct.permission.perm_list.retrieve.all',
-	argc		=> 0,
-	stream		=> 1,
+    method      => 'retrieve_perms',
+    api_name    => 'open-ils.storage.direct.permission.perm_list.retrieve.all',
+    argc        => 0,
+    stream      => 1,
 );
 
 sub usr_has_perm {
-	my $self = shift;
-	my $client = shift;
-	my $usr = shift;
-	my $perm = shift;
-	my $target = shift;
-
-	return permission::usr_grp_map->db_Main->selectrow_arrayref(<<"	SQL",{}, "$usr", "$perm", "$target")->[0];
-		SELECT permission.usr_has_perm(?,?,?)
-	SQL
+    my $self = shift;
+    my $client = shift;
+    my $usr = shift;
+    my $perm = shift;
+    my $target = shift;
+
+    return permission::usr_grp_map->db_Main->selectrow_arrayref(<<"    SQL",{}, "$usr", "$perm", "$target")->[0];
+        SELECT permission.usr_has_perm(?,?,?)
+    SQL
 }
 __PACKAGE__->register_method(
-	method		=> 'usr_has_perm',
-	api_name	=> 'open-ils.storage.permission.user_has_perm',
-	argc		=> 3,
+    method      => 'usr_has_perm',
+    api_name    => 'open-ils.storage.permission.user_has_perm',
+    argc        => 3,
 );
 
 sub usr_has_home_perm {
-	my $self = shift;
-	my $client = shift;
-	my $usr = shift;
-	my $perm = shift;
-	my $target = shift;
-
-	return permission::usr_grp_map->db_Main->selectrow_arrayref(<<"	SQL",{}, "$usr", "$perm", "$target")->[0];
-		SELECT permission.usr_has_home_perm(?,?,?)
-	SQL
+    my $self = shift;
+    my $client = shift;
+    my $usr = shift;
+    my $perm = shift;
+    my $target = shift;
+
+    return permission::usr_grp_map->db_Main->selectrow_arrayref(<<"    SQL",{}, "$usr", "$perm", "$target")->[0];
+        SELECT permission.usr_has_home_perm(?,?,?)
+    SQL
 }
 __PACKAGE__->register_method(
-	method		=> 'usr_has_home_perm',
-	api_name	=> 'open-ils.storage.permission.user_has_home_perm',
-	argc		=> 3,
+    method      => 'usr_has_home_perm',
+    api_name    => 'open-ils.storage.permission.user_has_home_perm',
+    argc        => 3,
 );
 
 sub usr_has_work_perm {
-	my $self = shift;
-	my $client = shift;
-	my $usr = shift;
-	my $perm = shift;
-	my $target = shift;
-
-	return permission::usr_grp_map->db_Main->selectrow_arrayref(<<"	SQL",{}, "$usr", "$perm", "$target")->[0];
-		SELECT permission.usr_has_work_perm(?,?,?)
-	SQL
+    my $self = shift;
+    my $client = shift;
+    my $usr = shift;
+    my $perm = shift;
+    my $target = shift;
+
+    return permission::usr_grp_map->db_Main->selectrow_arrayref(<<"    SQL",{}, "$usr", "$perm", "$target")->[0];
+        SELECT permission.usr_has_work_perm(?,?,?)
+    SQL
 }
 __PACKAGE__->register_method(
-	method		=> 'usr_has_work_perm',
-	api_name	=> 'open-ils.storage.permission.user_has_work_perm',
-	argc		=> 3,
+    method      => 'usr_has_work_perm',
+    api_name    => 'open-ils.storage.permission.user_has_work_perm',
+    argc        => 3,
 );
 
 sub usr_perms {
-	my $self = shift;
-	my $client = shift;
-	my $usr = shift;
+    my $self = shift;
+    my $client = shift;
+    my $usr = shift;
 
-	my $sth = permission::usr_perm_map->db_Main->prepare('SELECT DISTINCT * FROM permission.usr_perms(?)');
-	$sth->execute("$usr");
+    my $sth = permission::usr_perm_map->db_Main->prepare('SELECT DISTINCT * FROM permission.usr_perms(?)');
+    $sth->execute("$usr");
 
-	$client->respond( $_->to_fieldmapper ) for ( map { permission::usr_perm_map->construct($_) } $sth->fetchall_hash );
+    $client->respond( $_->to_fieldmapper ) for ( map { permission::usr_perm_map->construct($_) } $sth->fetchall_hash );
 
-	return undef;
+    return undef;
 }
 __PACKAGE__->register_method(
-	method		=> 'usr_perms',
-	api_name	=> 'open-ils.storage.permission.user_perms',
-	argc		=> 1,
-	stream		=> 1,
+    method      => 'usr_perms',
+    api_name    => 'open-ils.storage.permission.user_perms',
+    argc        => 1,
+    stream      => 1,
 );
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm
index 2e7000e..64687720 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm
@@ -49,183 +49,183 @@ our (
 );
 
 sub child_init {
-	# we need an XML parser
-	$_parser = new XML::LibXML;
-
-	# and an xslt parser
-	$_xslt = new XML::LibXSLT;
-
-	# parse the MODS xslt ...
-	my $mods33_xslt = $_parser->parse_file(
-		OpenSRF::Utils::SettingsClient
-			->new
-			->config_value( dirs => 'xsl' ).
-		"/MARC21slim2MODS33.xsl"
-	);
-	# and stash a transformer
-	$record_xslt{mods33}{xslt} = $_xslt->parse_stylesheet( $mods33_xslt );
-	$record_xslt{mods33}{namespace_uri} = 'http://www.loc.gov/mods/v3';
-	$record_xslt{mods33}{docs} = 'http://www.loc.gov/mods/';
-	$record_xslt{mods33}{schema_location} = 'http://www.loc.gov/standards/mods/v3/mods-3-3.xsd';
-
-	# parse the MODS xslt ...
-	my $mods32_xslt = $_parser->parse_file(
-		OpenSRF::Utils::SettingsClient
-			->new
-			->config_value( dirs => 'xsl' ).
-		"/MARC21slim2MODS32.xsl"
-	);
-	# and stash a transformer
-	$record_xslt{mods32}{xslt} = $_xslt->parse_stylesheet( $mods32_xslt );
-	$record_xslt{mods32}{namespace_uri} = 'http://www.loc.gov/mods/v3';
-	$record_xslt{mods32}{docs} = 'http://www.loc.gov/mods/';
-	$record_xslt{mods32}{schema_location} = 'http://www.loc.gov/standards/mods/v3/mods-3-2.xsd';
-
-	# parse the MODS xslt ...
-	my $mods3_xslt = $_parser->parse_file(
-		OpenSRF::Utils::SettingsClient
-			->new
-			->config_value( dirs => 'xsl' ).
-		"/MARC21slim2MODS3.xsl"
-	);
-	# and stash a transformer
-	$record_xslt{mods3}{xslt} = $_xslt->parse_stylesheet( $mods3_xslt );
-	$record_xslt{mods3}{namespace_uri} = 'http://www.loc.gov/mods/v3';
-	$record_xslt{mods3}{docs} = 'http://www.loc.gov/mods/';
-	$record_xslt{mods3}{schema_location} = 'http://www.loc.gov/standards/mods/v3/mods-3-1.xsd';
-
-	# parse the MODS xslt ...
-	my $mods_xslt = $_parser->parse_file(
-		OpenSRF::Utils::SettingsClient
-			->new
-			->config_value( dirs => 'xsl' ).
-		"/MARC21slim2MODS.xsl"
-	);
-	# and stash a transformer
-	$record_xslt{mods}{xslt} = $_xslt->parse_stylesheet( $mods_xslt );
-	$record_xslt{mods}{namespace_uri} = 'http://www.loc.gov/mods/';
-	$record_xslt{mods}{docs} = 'http://www.loc.gov/mods/';
-	$record_xslt{mods}{schema_location} = 'http://www.loc.gov/standards/mods/mods.xsd';
-
-	# parse the ATOM entry xslt ...
-	my $atom_xslt = $_parser->parse_file(
-		OpenSRF::Utils::SettingsClient
-			->new
-			->config_value( dirs => 'xsl' ).
-		"/MARC21slim2ATOM.xsl"
-	);
-	# and stash a transformer
-	$record_xslt{atom}{xslt} = $_xslt->parse_stylesheet( $atom_xslt );
-	$record_xslt{atom}{namespace_uri} = 'http://www.w3.org/2005/Atom';
-	$record_xslt{atom}{docs} = 'http://www.ietf.org/rfc/rfc4287.txt';
-
-	# parse the RDFDC xslt ...
-	my $rdf_dc_xslt = $_parser->parse_file(
-		OpenSRF::Utils::SettingsClient
-			->new
-			->config_value( dirs => 'xsl' ).
-		"/MARC21slim2RDFDC.xsl"
-	);
-	# and stash a transformer
-	$record_xslt{rdf_dc}{xslt} = $_xslt->parse_stylesheet( $rdf_dc_xslt );
-	$record_xslt{rdf_dc}{namespace_uri} = 'http://purl.org/dc/elements/1.1/';
-	$record_xslt{rdf_dc}{schema_location} = 'http://purl.org/dc/elements/1.1/';
-
-	# parse the SRWDC xslt ...
-	my $srw_dc_xslt = $_parser->parse_file(
-		OpenSRF::Utils::SettingsClient
-			->new
-			->config_value( dirs => 'xsl' ).
-		"/MARC21slim2SRWDC.xsl"
-	);
-	# and stash a transformer
-	$record_xslt{srw_dc}{xslt} = $_xslt->parse_stylesheet( $srw_dc_xslt );
-	$record_xslt{srw_dc}{namespace_uri} = 'info:srw/schema/1/dc-schema';
-	$record_xslt{srw_dc}{schema_location} = 'http://www.loc.gov/z3950/agency/zing/srw/dc-schema.xsd';
-
-	# parse the OAIDC xslt ...
-	my $oai_dc_xslt = $_parser->parse_file(
-		OpenSRF::Utils::SettingsClient
-			->new
-			->config_value( dirs => 'xsl' ).
-		"/MARC21slim2OAIDC.xsl"
-	);
-	# and stash a transformer
-	$record_xslt{oai_dc}{xslt} = $_xslt->parse_stylesheet( $oai_dc_xslt );
-	$record_xslt{oai_dc}{namespace_uri} = 'http://www.openarchives.org/OAI/2.0/oai_dc/';
-	$record_xslt{oai_dc}{schema_location} = 'http://www.openarchives.org/OAI/2.0/oai_dc.xsd';
-
-	# parse the RSS xslt ...
-	my $rss_xslt = $_parser->parse_file(
-		OpenSRF::Utils::SettingsClient
-			->new
-			->config_value( dirs => 'xsl' ).
-		"/MARC21slim2RSS2.xsl"
-	);
-	# and stash a transformer
-	$record_xslt{rss2}{xslt} = $_xslt->parse_stylesheet( $rss_xslt );
-
-	# parse the FGDC xslt ...
-	my $fgdc_xslt = $_parser->parse_file(
-		OpenSRF::Utils::SettingsClient
-			->new
-			->config_value( dirs => 'xsl' ).
-		"/MARC21slim2FGDC.xsl"
-	);
-	# and stash a transformer
-	$record_xslt{fgdc}{xslt} = $_xslt->parse_stylesheet( $fgdc_xslt );
-	$record_xslt{fgdc}{docs} = 'http://www.fgdc.gov/metadata/csdgm/index_html';
-	$record_xslt{fgdc}{schema_location} = 'http://www.fgdc.gov/metadata/fgdc-std-001-1998.xsd';
-
-	register_record_transforms();
-
-	register_new_authorities_methods();
-
-	return 1;
+    # we need an XML parser
+    $_parser = new XML::LibXML;
+
+    # and an xslt parser
+    $_xslt = new XML::LibXSLT;
+
+    # parse the MODS xslt ...
+    my $mods33_xslt = $_parser->parse_file(
+        OpenSRF::Utils::SettingsClient
+            ->new
+            ->config_value( dirs => 'xsl' ).
+        "/MARC21slim2MODS33.xsl"
+    );
+    # and stash a transformer
+    $record_xslt{mods33}{xslt} = $_xslt->parse_stylesheet( $mods33_xslt );
+    $record_xslt{mods33}{namespace_uri} = 'http://www.loc.gov/mods/v3';
+    $record_xslt{mods33}{docs} = 'http://www.loc.gov/mods/';
+    $record_xslt{mods33}{schema_location} = 'http://www.loc.gov/standards/mods/v3/mods-3-3.xsd';
+
+    # parse the MODS xslt ...
+    my $mods32_xslt = $_parser->parse_file(
+        OpenSRF::Utils::SettingsClient
+            ->new
+            ->config_value( dirs => 'xsl' ).
+        "/MARC21slim2MODS32.xsl"
+    );
+    # and stash a transformer
+    $record_xslt{mods32}{xslt} = $_xslt->parse_stylesheet( $mods32_xslt );
+    $record_xslt{mods32}{namespace_uri} = 'http://www.loc.gov/mods/v3';
+    $record_xslt{mods32}{docs} = 'http://www.loc.gov/mods/';
+    $record_xslt{mods32}{schema_location} = 'http://www.loc.gov/standards/mods/v3/mods-3-2.xsd';
+
+    # parse the MODS xslt ...
+    my $mods3_xslt = $_parser->parse_file(
+        OpenSRF::Utils::SettingsClient
+            ->new
+            ->config_value( dirs => 'xsl' ).
+        "/MARC21slim2MODS3.xsl"
+    );
+    # and stash a transformer
+    $record_xslt{mods3}{xslt} = $_xslt->parse_stylesheet( $mods3_xslt );
+    $record_xslt{mods3}{namespace_uri} = 'http://www.loc.gov/mods/v3';
+    $record_xslt{mods3}{docs} = 'http://www.loc.gov/mods/';
+    $record_xslt{mods3}{schema_location} = 'http://www.loc.gov/standards/mods/v3/mods-3-1.xsd';
+
+    # parse the MODS xslt ...
+    my $mods_xslt = $_parser->parse_file(
+        OpenSRF::Utils::SettingsClient
+            ->new
+            ->config_value( dirs => 'xsl' ).
+        "/MARC21slim2MODS.xsl"
+    );
+    # and stash a transformer
+    $record_xslt{mods}{xslt} = $_xslt->parse_stylesheet( $mods_xslt );
+    $record_xslt{mods}{namespace_uri} = 'http://www.loc.gov/mods/';
+    $record_xslt{mods}{docs} = 'http://www.loc.gov/mods/';
+    $record_xslt{mods}{schema_location} = 'http://www.loc.gov/standards/mods/mods.xsd';
+
+    # parse the ATOM entry xslt ...
+    my $atom_xslt = $_parser->parse_file(
+        OpenSRF::Utils::SettingsClient
+            ->new
+            ->config_value( dirs => 'xsl' ).
+        "/MARC21slim2ATOM.xsl"
+    );
+    # and stash a transformer
+    $record_xslt{atom}{xslt} = $_xslt->parse_stylesheet( $atom_xslt );
+    $record_xslt{atom}{namespace_uri} = 'http://www.w3.org/2005/Atom';
+    $record_xslt{atom}{docs} = 'http://www.ietf.org/rfc/rfc4287.txt';
+
+    # parse the RDFDC xslt ...
+    my $rdf_dc_xslt = $_parser->parse_file(
+        OpenSRF::Utils::SettingsClient
+            ->new
+            ->config_value( dirs => 'xsl' ).
+        "/MARC21slim2RDFDC.xsl"
+    );
+    # and stash a transformer
+    $record_xslt{rdf_dc}{xslt} = $_xslt->parse_stylesheet( $rdf_dc_xslt );
+    $record_xslt{rdf_dc}{namespace_uri} = 'http://purl.org/dc/elements/1.1/';
+    $record_xslt{rdf_dc}{schema_location} = 'http://purl.org/dc/elements/1.1/';
+
+    # parse the SRWDC xslt ...
+    my $srw_dc_xslt = $_parser->parse_file(
+        OpenSRF::Utils::SettingsClient
+            ->new
+            ->config_value( dirs => 'xsl' ).
+        "/MARC21slim2SRWDC.xsl"
+    );
+    # and stash a transformer
+    $record_xslt{srw_dc}{xslt} = $_xslt->parse_stylesheet( $srw_dc_xslt );
+    $record_xslt{srw_dc}{namespace_uri} = 'info:srw/schema/1/dc-schema';
+    $record_xslt{srw_dc}{schema_location} = 'http://www.loc.gov/z3950/agency/zing/srw/dc-schema.xsd';
+
+    # parse the OAIDC xslt ...
+    my $oai_dc_xslt = $_parser->parse_file(
+        OpenSRF::Utils::SettingsClient
+            ->new
+            ->config_value( dirs => 'xsl' ).
+        "/MARC21slim2OAIDC.xsl"
+    );
+    # and stash a transformer
+    $record_xslt{oai_dc}{xslt} = $_xslt->parse_stylesheet( $oai_dc_xslt );
+    $record_xslt{oai_dc}{namespace_uri} = 'http://www.openarchives.org/OAI/2.0/oai_dc/';
+    $record_xslt{oai_dc}{schema_location} = 'http://www.openarchives.org/OAI/2.0/oai_dc.xsd';
+
+    # parse the RSS xslt ...
+    my $rss_xslt = $_parser->parse_file(
+        OpenSRF::Utils::SettingsClient
+            ->new
+            ->config_value( dirs => 'xsl' ).
+        "/MARC21slim2RSS2.xsl"
+    );
+    # and stash a transformer
+    $record_xslt{rss2}{xslt} = $_xslt->parse_stylesheet( $rss_xslt );
+
+    # parse the FGDC xslt ...
+    my $fgdc_xslt = $_parser->parse_file(
+        OpenSRF::Utils::SettingsClient
+            ->new
+            ->config_value( dirs => 'xsl' ).
+        "/MARC21slim2FGDC.xsl"
+    );
+    # and stash a transformer
+    $record_xslt{fgdc}{xslt} = $_xslt->parse_stylesheet( $fgdc_xslt );
+    $record_xslt{fgdc}{docs} = 'http://www.fgdc.gov/metadata/csdgm/index_html';
+    $record_xslt{fgdc}{schema_location} = 'http://www.fgdc.gov/metadata/fgdc-std-001-1998.xsd';
+
+    register_record_transforms();
+
+    register_new_authorities_methods();
+
+    return 1;
 }
 
 sub register_record_transforms {
-	for my $type ( keys %record_xslt ) {
-		__PACKAGE__->register_method(
-			method    => 'retrieve_record_transform',
-			api_name  => "open-ils.supercat.record.$type.retrieve",
-			api_level => 1,
-			argc      => 1,
-			signature =>
-				{ desc     => "Returns the \U$type\E representation ".
-				              "of the requested bibliographic record",
-				  params   =>
-			  		[
-						{ name => 'bibId',
-						  desc => 'An OpenILS biblio::record_entry id',
-						  type => 'number' },
-					],
-			  	'return' =>
-		  			{ desc => "The bib record in \U$type\E",
-					  type => 'string' }
-				}
-		);
-
-		__PACKAGE__->register_method(
-			method    => 'retrieve_isbn_transform',
-			api_name  => "open-ils.supercat.isbn.$type.retrieve",
-			api_level => 1,
-			argc      => 1,
-			signature =>
-				{ desc     => "Returns the \U$type\E representation ".
-				              "of the requested bibliographic record",
-				  params   =>
-			  		[
-						{ name => 'isbn',
-						  desc => 'An ISBN',
-						  type => 'string' },
-					],
-			  	'return' =>
-		  			{ desc => "The bib record in \U$type\E",
-					  type => 'string' }
-				}
-		);
-	}
+    for my $type ( keys %record_xslt ) {
+        __PACKAGE__->register_method(
+            method    => 'retrieve_record_transform',
+            api_name  => "open-ils.supercat.record.$type.retrieve",
+            api_level => 1,
+            argc      => 1,
+            signature =>
+                { desc     => "Returns the \U$type\E representation ".
+                              "of the requested bibliographic record",
+                  params   =>
+                    [
+                        { name => 'bibId',
+                          desc => 'An OpenILS biblio::record_entry id',
+                          type => 'number' },
+                    ],
+                'return' =>
+                    { desc => "The bib record in \U$type\E",
+                      type => 'string' }
+                }
+        );
+
+        __PACKAGE__->register_method(
+            method    => 'retrieve_isbn_transform',
+            api_name  => "open-ils.supercat.isbn.$type.retrieve",
+            api_level => 1,
+            argc      => 1,
+            signature =>
+                { desc     => "Returns the \U$type\E representation ".
+                              "of the requested bibliographic record",
+                  params   =>
+                    [
+                        { name => 'isbn',
+                          desc => 'An ISBN',
+                          type => 'string' },
+                    ],
+                'return' =>
+                    { desc => "The bib record in \U$type\E",
+                      type => 'string' }
+                }
+        );
+    }
 }
 
 sub register_new_authorities_methods {
@@ -313,86 +313,86 @@ sub generic_new_authorities_method {
 
 
 sub tree_walker {
-	my $tree = shift;
-	my $field = shift;
-	my $filter = shift;
-
-	return unless ($tree && ref($tree->$field));
-
-	my @things = $filter->($tree);
-	for my $v ( @{$tree->$field} ){
-		push @things, $filter->($v);
-		push @things, tree_walker($v, $field, $filter);
-	}
-	return @things
+    my $tree = shift;
+    my $field = shift;
+    my $filter = shift;
+
+    return unless ($tree && ref($tree->$field));
+
+    my @things = $filter->($tree);
+    for my $v ( @{$tree->$field} ){
+        push @things, $filter->($v);
+        push @things, tree_walker($v, $field, $filter);
+    }
+    return @things
 }
 
 # find a label_sortkey for a call number with a label which is equal
 # (or close to) a given label value
 sub _label_sortkey_from_label {
-	my ($label, $_storage, $ou_ids, $cp_filter) = @_;
-
-	my $closest_cn = $_storage->request(
-			"open-ils.cstore.direct.asset.call_number.search.atomic",
-			{ label      => { ">=" => { transform => "oils_text_as_bytea", value => ["oils_text_as_bytea", $label] } },
-			  owning_lib => $ou_ids,
-			  deleted    => 'f',
-			  @$cp_filter
-			},
-			{ limit     => 1,
-			  order_by  => { acn => "oils_text_as_bytea(label), id" }
-			}
-		)->gather(1);
-	if (@$closest_cn) {
-		return $closest_cn->[0]->label_sortkey;
-	} else {
-		return '~~~'; #fallback to high ascii value, we are at the end
-	}
+    my ($label, $_storage, $ou_ids, $cp_filter) = @_;
+
+    my $closest_cn = $_storage->request(
+            "open-ils.cstore.direct.asset.call_number.search.atomic",
+            { label      => { ">=" => { transform => "oils_text_as_bytea", value => ["oils_text_as_bytea", $label] } },
+              owning_lib => $ou_ids,
+              deleted    => 'f',
+              @$cp_filter
+            },
+            { limit     => 1,
+              order_by  => { acn => "oils_text_as_bytea(label), id" }
+            }
+        )->gather(1);
+    if (@$closest_cn) {
+        return $closest_cn->[0]->label_sortkey;
+    } else {
+        return '~~~'; #fallback to high ascii value, we are at the end
+    }
 }
 
 sub cn_browse {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	my $label = shift;
-	my $ou = shift;
-	my $page_size = shift || 9;
-	my $page = shift || 0;
-	my $statuses = shift || [];
-	my $copy_locations = shift || [];
+    my $label = shift;
+    my $ou = shift;
+    my $page_size = shift || 9;
+    my $page = shift || 0;
+    my $statuses = shift || [];
+    my $copy_locations = shift || [];
 
-	my ($before_limit,$after_limit) = (0,0);
-	my ($before_offset,$after_offset) = (0,0);
+    my ($before_limit,$after_limit) = (0,0);
+    my ($before_offset,$after_offset) = (0,0);
 
-	if (!$page) {
-		$before_limit = $after_limit = int($page_size / 2);
-		$after_limit += 1 if ($page_size % 2);
-	} else {
-		$before_offset = $after_offset = int($page_size / 2);
-		$before_offset += 1 if ($page_size % 2);
-		$before_limit = $after_limit = $page_size;
-	}
+    if (!$page) {
+        $before_limit = $after_limit = int($page_size / 2);
+        $after_limit += 1 if ($page_size % 2);
+    } else {
+        $before_offset = $after_offset = int($page_size / 2);
+        $before_offset += 1 if ($page_size % 2);
+        $before_limit = $after_limit = $page_size;
+    }
 
-	my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
+    my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
 
-	my $o_search = { shortname => $ou };
-	if (!$ou || $ou eq '-') {
-		$o_search = { parent_ou => undef };
-	}
+    my $o_search = { shortname => $ou };
+    if (!$ou || $ou eq '-') {
+        $o_search = { parent_ou => undef };
+    }
 
-	my $orgs = $_storage->request(
-		"open-ils.cstore.direct.actor.org_unit.search",
-		$o_search,
-		{ flesh		=> 100,
-		  flesh_fields	=> { aou	=> [qw/children/] }
-		}
-	)->gather(1);
+    my $orgs = $_storage->request(
+        "open-ils.cstore.direct.actor.org_unit.search",
+        $o_search,
+        { flesh     => 100,
+          flesh_fields  => { aou    => [qw/children/] }
+        }
+    )->gather(1);
 
-	my @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
+    my @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
 
-	$logger->debug("Searching for CNs at orgs [".join(',', at ou_ids)."], based on $ou");
+    $logger->debug("Searching for CNs at orgs [".join(',', at ou_ids)."], based on $ou");
 
-	my @list = ();
+    my @list = ();
 
     my @cp_filter = ();
     if (@$statuses || @$copy_locations) {
@@ -400,125 +400,125 @@ sub cn_browse {
             '-exists' => {
                 limit => 1,
                 from  => 'acp',
-				where => {
+                where => {
                     call_number => { '=' => { '+acn' => 'id' } },
                     deleted     => 'f',
                     ((@$statuses)       ? ( status   => $statuses)       : ()),
-				    ((@$copy_locations) ? ( location => $copy_locations) : ())
+                    ((@$copy_locations) ? ( location => $copy_locations) : ())
                 }
             }
         );
     }
 
-	my $label_sortkey = _label_sortkey_from_label($label, $_storage, \@ou_ids, \@cp_filter);
+    my $label_sortkey = _label_sortkey_from_label($label, $_storage, \@ou_ids, \@cp_filter);
 
-	if ($page <= 0) {
-		my $before = $_storage->request(
-			"open-ils.cstore.direct.asset.call_number.search.atomic",
-			{ label_sortkey	=> { "<" => { transform => "oils_text_as_bytea", value => ["oils_text_as_bytea", $label_sortkey] } },
-			  owning_lib	=> \@ou_ids,
+    if ($page <= 0) {
+        my $before = $_storage->request(
+            "open-ils.cstore.direct.asset.call_number.search.atomic",
+            { label_sortkey => { "<" => { transform => "oils_text_as_bytea", value => ["oils_text_as_bytea", $label_sortkey] } },
+              owning_lib    => \@ou_ids,
               deleted => 'f',
               @cp_filter
-			},
-			{ flesh		=> 1,
-			  flesh_fields	=> { acn => [qw/record owning_lib prefix suffix/] },
-			  order_by	=> { acn => "oils_text_as_bytea(label_sortkey) desc, oils_text_as_bytea(label) desc, id desc, owning_lib desc" },
-			  limit		=> $before_limit,
-			  offset	=> abs($page) * $page_size - $before_offset,
-			}
-		)->gather(1);
-		push @list, reverse(@$before);
-	}
-
-	if ($page >= 0) {
-		my $after = $_storage->request(
-			"open-ils.cstore.direct.asset.call_number.search.atomic",
-			{ label_sortkey	=> { ">=" => { transform => "oils_text_as_bytea", value => ["oils_text_as_bytea", $label_sortkey] } },
-			  owning_lib	=> \@ou_ids,
+            },
+            { flesh     => 1,
+              flesh_fields  => { acn => [qw/record owning_lib prefix suffix/] },
+              order_by  => { acn => "oils_text_as_bytea(label_sortkey) desc, oils_text_as_bytea(label) desc, id desc, owning_lib desc" },
+              limit     => $before_limit,
+              offset    => abs($page) * $page_size - $before_offset,
+            }
+        )->gather(1);
+        push @list, reverse(@$before);
+    }
+
+    if ($page >= 0) {
+        my $after = $_storage->request(
+            "open-ils.cstore.direct.asset.call_number.search.atomic",
+            { label_sortkey => { ">=" => { transform => "oils_text_as_bytea", value => ["oils_text_as_bytea", $label_sortkey] } },
+              owning_lib    => \@ou_ids,
               deleted => 'f',
               @cp_filter
-			},
-			{ flesh		=> 1,
-			  flesh_fields	=> { acn => [qw/record owning_lib prefix suffix/] },
-			  order_by	=> { acn => "oils_text_as_bytea(label_sortkey), oils_text_as_bytea(label), id, owning_lib" },
-			  limit		=> $after_limit,
-			  offset	=> abs($page) * $page_size - $after_offset,
-			}
-		)->gather(1);
-		push @list, @$after;
-	}
-
-	return \@list;
+            },
+            { flesh     => 1,
+              flesh_fields  => { acn => [qw/record owning_lib prefix suffix/] },
+              order_by  => { acn => "oils_text_as_bytea(label_sortkey), oils_text_as_bytea(label), id, owning_lib" },
+              limit     => $after_limit,
+              offset    => abs($page) * $page_size - $after_offset,
+            }
+        )->gather(1);
+        push @list, @$after;
+    }
+
+    return \@list;
 }
 __PACKAGE__->register_method(
-	method    => 'cn_browse',
-	api_name  => 'open-ils.supercat.call_number.browse',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'cn_browse',
+    api_name  => 'open-ils.supercat.call_number.browse',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns the XML representation of the requested bibliographic record's holdings
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'label',
-				  desc => 'The target call number label',
-				  type => 'string' },
-				{ name => 'org_unit',
-				  desc => 'The org unit shortname (or "-" or undef for global) to browse',
-				  type => 'string' },
-				{ name => 'page_size',
-				  desc => 'Count of call numbers to retrieve, default is 9',
-				  type => 'number' },
-				{ name => 'page',
-				  desc => 'The page of call numbers to retrieve, calculated based on page_size.  Can be positive, negative or 0.',
-				  type => 'number' },
-				{ name => 'statuses',
-				  desc => 'Array of statuses to filter copies by, optional and can be undef.',
-				  type => 'array' },
-				{ name => 'locations',
-				  desc => 'Array of copy locations to filter copies by, optional and can be undef.',
-				  type => 'array' },
-			],
-		  'return' =>
-		  	{ desc => 'Call numbers with owning_lib and record fleshed',
-			  type => 'array' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'label',
+                  desc => 'The target call number label',
+                  type => 'string' },
+                { name => 'org_unit',
+                  desc => 'The org unit shortname (or "-" or undef for global) to browse',
+                  type => 'string' },
+                { name => 'page_size',
+                  desc => 'Count of call numbers to retrieve, default is 9',
+                  type => 'number' },
+                { name => 'page',
+                  desc => 'The page of call numbers to retrieve, calculated based on page_size.  Can be positive, negative or 0.',
+                  type => 'number' },
+                { name => 'statuses',
+                  desc => 'Array of statuses to filter copies by, optional and can be undef.',
+                  type => 'array' },
+                { name => 'locations',
+                  desc => 'Array of copy locations to filter copies by, optional and can be undef.',
+                  type => 'array' },
+            ],
+          'return' =>
+            { desc => 'Call numbers with owning_lib and record fleshed',
+              type => 'array' }
+        }
 );
 
 sub cn_startwith {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	my $label = shift;
-	my $ou = shift;
-	my $limit = shift || 10;
-	my $page = shift || 0;
-	my $statuses = shift || [];
-	my $copy_locations = shift || [];
+    my $label = shift;
+    my $ou = shift;
+    my $limit = shift || 10;
+    my $page = shift || 0;
+    my $statuses = shift || [];
+    my $copy_locations = shift || [];
 
 
-	my $offset = abs($page) * $limit;
-	my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
+    my $offset = abs($page) * $limit;
+    my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
 
-	my $o_search = { shortname => $ou };
-	if (!$ou || $ou eq '-') {
-		$o_search = { parent_ou => undef };
-	}
+    my $o_search = { shortname => $ou };
+    if (!$ou || $ou eq '-') {
+        $o_search = { parent_ou => undef };
+    }
 
-	my $orgs = $_storage->request(
-		"open-ils.cstore.direct.actor.org_unit.search",
-		$o_search,
-		{ flesh		=> 100,
-		  flesh_fields	=> { aou	=> [qw/children/] }
-		}
-	)->gather(1);
+    my $orgs = $_storage->request(
+        "open-ils.cstore.direct.actor.org_unit.search",
+        $o_search,
+        { flesh     => 100,
+          flesh_fields  => { aou    => [qw/children/] }
+        }
+    )->gather(1);
 
-	my @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
+    my @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
 
-	$logger->debug("Searching for CNs at orgs [".join(',', at ou_ids)."], based on $ou");
+    $logger->debug("Searching for CNs at orgs [".join(',', at ou_ids)."], based on $ou");
 
-	my @list = ();
+    my @list = ();
 
     my @cp_filter = ();
     if (@$statuses || @$copy_locations) {
@@ -526,453 +526,453 @@ sub cn_startwith {
             '-exists' => {
                 limit => 1,
                 from  => 'acp',
-				where => {
+                where => {
                     call_number => { '=' => { '+acn' => 'id' } },
                     deleted     => 'f',
                     ((@$statuses)       ? ( status   => $statuses)       : ()),
-				    ((@$copy_locations) ? ( location => $copy_locations) : ())
+                    ((@$copy_locations) ? ( location => $copy_locations) : ())
                 }
             }
         );
     }
 
-	my $label_sortkey = _label_sortkey_from_label($label, $_storage, \@ou_ids, \@cp_filter);
+    my $label_sortkey = _label_sortkey_from_label($label, $_storage, \@ou_ids, \@cp_filter);
 
-	if ($page < 0) {
-		my $before = $_storage->request(
-			"open-ils.cstore.direct.asset.call_number.search.atomic",
-			{ label_sortkey	=> { "<" => { transform => "oils_text_as_bytea", value => ["oils_text_as_bytea", $label_sortkey] } },
-			  owning_lib	=> \@ou_ids,
+    if ($page < 0) {
+        my $before = $_storage->request(
+            "open-ils.cstore.direct.asset.call_number.search.atomic",
+            { label_sortkey => { "<" => { transform => "oils_text_as_bytea", value => ["oils_text_as_bytea", $label_sortkey] } },
+              owning_lib    => \@ou_ids,
               deleted => 'f',
               @cp_filter
-			},
-			{ flesh		=> 1,
-			  flesh_fields	=> { acn => [qw/record owning_lib prefix suffix/] },
-			  order_by	=> { acn => "oils_text_as_bytea(label_sortkey) desc, oils_text_as_bytea(label) desc, id desc, owning_lib desc" },
-			  limit		=> $limit,
-			  offset	=> $offset,
-			}
-		)->gather(1);
-		push @list, reverse(@$before);
-	}
-
-	if ($page >= 0) {
-		my $after = $_storage->request(
-			"open-ils.cstore.direct.asset.call_number.search.atomic",
-			{ label_sortkey	=> { ">=" => { transform => "oils_text_as_bytea", value => ["oils_text_as_bytea", $label_sortkey] } },
-			  owning_lib	=> \@ou_ids,
+            },
+            { flesh     => 1,
+              flesh_fields  => { acn => [qw/record owning_lib prefix suffix/] },
+              order_by  => { acn => "oils_text_as_bytea(label_sortkey) desc, oils_text_as_bytea(label) desc, id desc, owning_lib desc" },
+              limit     => $limit,
+              offset    => $offset,
+            }
+        )->gather(1);
+        push @list, reverse(@$before);
+    }
+
+    if ($page >= 0) {
+        my $after = $_storage->request(
+            "open-ils.cstore.direct.asset.call_number.search.atomic",
+            { label_sortkey => { ">=" => { transform => "oils_text_as_bytea", value => ["oils_text_as_bytea", $label_sortkey] } },
+              owning_lib    => \@ou_ids,
               deleted => 'f',
               @cp_filter
-			},
-			{ flesh		=> 1,
-			  flesh_fields	=> { acn => [qw/record owning_lib prefix suffix/] },
-			  order_by	=> { acn => "oils_text_as_bytea(label_sortkey), oils_text_as_bytea(label), id, owning_lib" },
-			  limit		=> $limit,
-			  offset	=> $offset,
-			}
-		)->gather(1);
-		push @list, @$after;
-	}
-
-	return \@list;
+            },
+            { flesh     => 1,
+              flesh_fields  => { acn => [qw/record owning_lib prefix suffix/] },
+              order_by  => { acn => "oils_text_as_bytea(label_sortkey), oils_text_as_bytea(label), id, owning_lib" },
+              limit     => $limit,
+              offset    => $offset,
+            }
+        )->gather(1);
+        push @list, @$after;
+    }
+
+    return \@list;
 }
 __PACKAGE__->register_method(
-	method    => 'cn_startwith',
-	api_name  => 'open-ils.supercat.call_number.startwith',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'cn_startwith',
+    api_name  => 'open-ils.supercat.call_number.startwith',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns the XML representation of the requested bibliographic record's holdings
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'label',
-				  desc => 'The target call number label',
-				  type => 'string' },
-				{ name => 'org_unit',
-				  desc => 'The org unit shortname (or "-" or undef for global) to browse',
-				  type => 'string' },
-				{ name => 'page_size',
-				  desc => 'Count of call numbers to retrieve, default is 9',
-				  type => 'number' },
-				{ name => 'page',
-				  desc => 'The page of call numbers to retrieve, calculated based on page_size.  Can be positive, negative or 0.',
-				  type => 'number' },
-				{ name => 'statuses',
-				  desc => 'Array of statuses to filter copies by, optional and can be undef.',
-				  type => 'array' },
-				{ name => 'locations',
-				  desc => 'Array of copy locations to filter copies by, optional and can be undef.',
-				  type => 'array' },
-			],
-		  'return' =>
-		  	{ desc => 'Call numbers with owning_lib and record fleshed',
-			  type => 'array' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'label',
+                  desc => 'The target call number label',
+                  type => 'string' },
+                { name => 'org_unit',
+                  desc => 'The org unit shortname (or "-" or undef for global) to browse',
+                  type => 'string' },
+                { name => 'page_size',
+                  desc => 'Count of call numbers to retrieve, default is 9',
+                  type => 'number' },
+                { name => 'page',
+                  desc => 'The page of call numbers to retrieve, calculated based on page_size.  Can be positive, negative or 0.',
+                  type => 'number' },
+                { name => 'statuses',
+                  desc => 'Array of statuses to filter copies by, optional and can be undef.',
+                  type => 'array' },
+                { name => 'locations',
+                  desc => 'Array of copy locations to filter copies by, optional and can be undef.',
+                  type => 'array' },
+            ],
+          'return' =>
+            { desc => 'Call numbers with owning_lib and record fleshed',
+              type => 'array' }
+        }
 );
 
 
 sub new_books_by_item {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
 
-	my $ou = shift;
-	my $page_size = shift || 10;
-	my $page = shift || 1;
-	my $statuses = shift || [];
-	my $copy_locations = shift || [];
+    my $ou = shift;
+    my $page_size = shift || 10;
+    my $page = shift || 1;
+    my $statuses = shift || [];
+    my $copy_locations = shift || [];
 
     my $offset = $page_size * ($page - 1);
 
-	my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
-
-	my @ou_ids;
-	if ($ou && $ou ne '-') {
-		my $orgs = $_storage->request(
-			"open-ils.cstore.direct.actor.org_unit.search",
-			{ shortname => $ou },
-			{ flesh		=> 100,
-			  flesh_fields	=> { aou	=> [qw/children/] }
-			}
-		)->gather(1);
-		@ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
-	}
-
-	$logger->debug("Searching for records with new copies at orgs [".join(',', at ou_ids)."], based on $ou");
-	my $cns = $_storage->request(
-		"open-ils.cstore.json_query.atomic",
-		{ select	=> { acn => ['record'],
+    my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
+
+    my @ou_ids;
+    if ($ou && $ou ne '-') {
+        my $orgs = $_storage->request(
+            "open-ils.cstore.direct.actor.org_unit.search",
+            { shortname => $ou },
+            { flesh     => 100,
+              flesh_fields  => { aou    => [qw/children/] }
+            }
+        )->gather(1);
+        @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
+    }
+
+    $logger->debug("Searching for records with new copies at orgs [".join(',', at ou_ids)."], based on $ou");
+    my $cns = $_storage->request(
+        "open-ils.cstore.json_query.atomic",
+        { select    => { acn => ['record'],
                          acp => [{ aggregate => 1 => transform => max => column => create_date => alias => 'create_date'}]
                        },
-		  from		=> { 'acn' => { 'acp' => { field => call_number => fkey => 'id' } } },
-		  where		=>
-			{ '+acp' =>
-				{ deleted => 'f',
-				  ((@ou_ids)          ? ( circ_lib => \@ou_ids)        : ()),
-				  ((@$statuses)       ? ( status   => $statuses)       : ()),
-				  ((@$copy_locations) ? ( location => $copy_locations) : ())
-				}, 
-			  '+acn' => { record => { '>' => 0 } },
-			}, 
-		  order_by	=> { acp => { create_date => { transform => 'max', direction => 'desc' } } },
-		  limit		=> $page_size,
-		  offset	=> $offset
-		}
-	)->gather(1);
-
-	return [ map { $_->{record} } @$cns ];
+          from      => { 'acn' => { 'acp' => { field => call_number => fkey => 'id' } } },
+          where     =>
+            { '+acp' =>
+                { deleted => 'f',
+                  ((@ou_ids)          ? ( circ_lib => \@ou_ids)        : ()),
+                  ((@$statuses)       ? ( status   => $statuses)       : ()),
+                  ((@$copy_locations) ? ( location => $copy_locations) : ())
+                }, 
+              '+acn' => { record => { '>' => 0 } },
+            }, 
+          order_by  => { acp => { create_date => { transform => 'max', direction => 'desc' } } },
+          limit     => $page_size,
+          offset    => $offset
+        }
+    )->gather(1);
+
+    return [ map { $_->{record} } @$cns ];
 }
 __PACKAGE__->register_method(
-	method    => 'new_books_by_item',
-	api_name  => 'open-ils.supercat.new_book_list',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'new_books_by_item',
+    api_name  => 'open-ils.supercat.new_book_list',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns the XML representation of the requested bibliographic record's holdings
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'org_unit',
-				  desc => 'The org unit shortname (or "-" or undef for global) to list',
-				  type => 'string' },
-				{ name => 'page_size',
-				  desc => 'Count of records to retrieve, default is 10',
-				  type => 'number' },
-				{ name => 'page',
-				  desc => 'The page of records to retrieve, calculated based on page_size.  Starts at 1.',
-				  type => 'number' },
-				{ name => 'statuses',
-				  desc => 'Array of statuses to filter copies by, optional and can be undef.',
-				  type => 'array' },
-				{ name => 'locations',
-				  desc => 'Array of copy locations to filter copies by, optional and can be undef.',
-				  type => 'array' },
-			],
-		  'return' =>
-		  	{ desc => 'Record IDs',
-			  type => 'array' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'org_unit',
+                  desc => 'The org unit shortname (or "-" or undef for global) to list',
+                  type => 'string' },
+                { name => 'page_size',
+                  desc => 'Count of records to retrieve, default is 10',
+                  type => 'number' },
+                { name => 'page',
+                  desc => 'The page of records to retrieve, calculated based on page_size.  Starts at 1.',
+                  type => 'number' },
+                { name => 'statuses',
+                  desc => 'Array of statuses to filter copies by, optional and can be undef.',
+                  type => 'array' },
+                { name => 'locations',
+                  desc => 'Array of copy locations to filter copies by, optional and can be undef.',
+                  type => 'array' },
+            ],
+          'return' =>
+            { desc => 'Record IDs',
+              type => 'array' }
+        }
 );
 
 
 sub general_browse {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
     return tag_sf_browse($self, $client, $self->{tag}, $self->{subfield}, @_);
 }
 __PACKAGE__->register_method(
-	method    => 'general_browse',
-	api_name  => 'open-ils.supercat.title.browse',
-	tag       => 'tnf', subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested org-scoped record IDs held",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target title', type => 'string' },
-			  { name => 'org_unit', desc => 'The org unit shortname (or "-" or undef for global) to browse', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' },
-			  { name => 'statuses', desc => 'Array of statuses to filter copies by, optional and can be undef.', type => 'array' },
-			  { name => 'locations', desc => 'Array of copy locations to filter copies by, optional and can be undef.', type => 'array' }, ],
-		  'return' => { desc => 'Record IDs that have copies at the relevant org units', type => 'array' }
-		}
+    method    => 'general_browse',
+    api_name  => 'open-ils.supercat.title.browse',
+    tag       => 'tnf', subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested org-scoped record IDs held",
+          params   =>
+            [ { name => 'value', desc => 'The target title', type => 'string' },
+              { name => 'org_unit', desc => 'The org unit shortname (or "-" or undef for global) to browse', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' },
+              { name => 'statuses', desc => 'Array of statuses to filter copies by, optional and can be undef.', type => 'array' },
+              { name => 'locations', desc => 'Array of copy locations to filter copies by, optional and can be undef.', type => 'array' }, ],
+          'return' => { desc => 'Record IDs that have copies at the relevant org units', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_browse',
-	api_name  => 'open-ils.supercat.author.browse',
-	tag       => [qw/100 110 111/], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested org-scoped record IDs held",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target author', type => 'string' },
-			  { name => 'org_unit', desc => 'The org unit shortname (or "-" or undef for global) to browse', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' },
-			  { name => 'statuses', desc => 'Array of statuses to filter copies by, optional and can be undef.', type => 'array' },
-			  { name => 'locations', desc => 'Array of copy locations to filter copies by, optional and can be undef.', type => 'array' }, ],
-		  'return' => { desc => 'Record IDs that have copies at the relevant org units', type => 'array' }
-		}
+    method    => 'general_browse',
+    api_name  => 'open-ils.supercat.author.browse',
+    tag       => [qw/100 110 111/], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested org-scoped record IDs held",
+          params   =>
+            [ { name => 'value', desc => 'The target author', type => 'string' },
+              { name => 'org_unit', desc => 'The org unit shortname (or "-" or undef for global) to browse', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' },
+              { name => 'statuses', desc => 'Array of statuses to filter copies by, optional and can be undef.', type => 'array' },
+              { name => 'locations', desc => 'Array of copy locations to filter copies by, optional and can be undef.', type => 'array' }, ],
+          'return' => { desc => 'Record IDs that have copies at the relevant org units', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_browse',
-	api_name  => 'open-ils.supercat.subject.browse',
-	tag       => [qw/600 610 611 630 648 650 651 653 655 656 662 690 691 696 697 698 699/], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested org-scoped record IDs held",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target subject', type => 'string' },
-			  { name => 'org_unit', desc => 'The org unit shortname (or "-" or undef for global) to browse', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' },
-			  { name => 'statuses', desc => 'Array of statuses to filter copies by, optional and can be undef.', type => 'array' },
-			  { name => 'locations', desc => 'Array of copy locations to filter copies by, optional and can be undef.', type => 'array' }, ],
-		  'return' => { desc => 'Record IDs that have copies at the relevant org units', type => 'array' }
-		}
+    method    => 'general_browse',
+    api_name  => 'open-ils.supercat.subject.browse',
+    tag       => [qw/600 610 611 630 648 650 651 653 655 656 662 690 691 696 697 698 699/], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested org-scoped record IDs held",
+          params   =>
+            [ { name => 'value', desc => 'The target subject', type => 'string' },
+              { name => 'org_unit', desc => 'The org unit shortname (or "-" or undef for global) to browse', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' },
+              { name => 'statuses', desc => 'Array of statuses to filter copies by, optional and can be undef.', type => 'array' },
+              { name => 'locations', desc => 'Array of copy locations to filter copies by, optional and can be undef.', type => 'array' }, ],
+          'return' => { desc => 'Record IDs that have copies at the relevant org units', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_browse',
-	api_name  => 'open-ils.supercat.topic.browse',
-	tag       => [qw/650 690/], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested org-scoped record IDs held",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target topical subject', type => 'string' },
-			  { name => 'org_unit', desc => 'The org unit shortname (or "-" or undef for global) to browse', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' },
-			  { name => 'statuses', desc => 'Array of statuses to filter copies by, optional and can be undef.', type => 'array' },
-			  { name => 'locations', desc => 'Array of copy locations to filter copies by, optional and can be undef.', type => 'array' }, ],
-		  'return' => { desc => 'Record IDs that have copies at the relevant org units', type => 'array' }
-		}
+    method    => 'general_browse',
+    api_name  => 'open-ils.supercat.topic.browse',
+    tag       => [qw/650 690/], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested org-scoped record IDs held",
+          params   =>
+            [ { name => 'value', desc => 'The target topical subject', type => 'string' },
+              { name => 'org_unit', desc => 'The org unit shortname (or "-" or undef for global) to browse', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' },
+              { name => 'statuses', desc => 'Array of statuses to filter copies by, optional and can be undef.', type => 'array' },
+              { name => 'locations', desc => 'Array of copy locations to filter copies by, optional and can be undef.', type => 'array' }, ],
+          'return' => { desc => 'Record IDs that have copies at the relevant org units', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_browse',
-	api_name  => 'open-ils.supercat.series.browse',
-	tag       => [qw/440 490 800 810 811 830/], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested org-scoped record IDs held",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target series', type => 'string' },
-			  { name => 'org_unit', desc => 'The org unit shortname (or "-" or undef for global) to browse', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' },
-			  { name => 'statuses', desc => 'Array of statuses to filter copies by, optional and can be undef.', type => 'array' },
-			  { name => 'locations', desc => 'Array of copy locations to filter copies by, optional and can be undef.', type => 'array' }, ],
-		  'return' => { desc => 'Record IDs that have copies at the relevant org units', type => 'array' }
-		}
+    method    => 'general_browse',
+    api_name  => 'open-ils.supercat.series.browse',
+    tag       => [qw/440 490 800 810 811 830/], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested org-scoped record IDs held",
+          params   =>
+            [ { name => 'value', desc => 'The target series', type => 'string' },
+              { name => 'org_unit', desc => 'The org unit shortname (or "-" or undef for global) to browse', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' },
+              { name => 'statuses', desc => 'Array of statuses to filter copies by, optional and can be undef.', type => 'array' },
+              { name => 'locations', desc => 'Array of copy locations to filter copies by, optional and can be undef.', type => 'array' }, ],
+          'return' => { desc => 'Record IDs that have copies at the relevant org units', type => 'array' }
+        }
 );
 
 
 sub tag_sf_browse {
-	my $self = shift;
-	my $client = shift;
-
-	my $tag = shift;
-	my $subfield = shift;
-	my $value = shift;
-	my $ou = shift;
-	my $page_size = shift || 9;
-	my $page = shift || 0;
-	my $statuses = shift || [];
-	my $copy_locations = shift || [];
-
-	my ($before_limit,$after_limit) = (0,0);
-	my ($before_offset,$after_offset) = (0,0);
-
-	if (!$page) {
-		$before_limit = $after_limit = int($page_size / 2);
-		$after_limit += 1 if ($page_size % 2);
-	} else {
-		$before_offset = $after_offset = int($page_size / 2);
-		$before_offset += 1 if ($page_size % 2);
-		$before_limit = $after_limit = $page_size;
-	}
-
-	my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
-
-	my @ou_ids;
-	if ($ou && $ou ne '-') {
-		my $orgs = $_storage->request(
-			"open-ils.cstore.direct.actor.org_unit.search",
-			{ shortname => $ou },
-			{ flesh		=> 100,
-			  flesh_fields	=> { aou	=> [qw/children/] }
-			}
-		)->gather(1);
-		@ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
-	}
-
-	$logger->debug("Searching for records at orgs [".join(',', at ou_ids)."], based on $ou");
-
-	my @list = ();
-
-	if ($page <= 0) {
-		my $before = $_storage->request(
-			"open-ils.cstore.json_query.atomic",
-			{ select	=> { mfr => [qw/record value/] },
-			  from		=> 'mfr',
-			  where		=>
-				{ '+mfr'	=>
-					{ tag	=> $tag,
-					  subfield => $subfield,
-					  value => { '<' => lc($value) }
-					},
+    my $self = shift;
+    my $client = shift;
+
+    my $tag = shift;
+    my $subfield = shift;
+    my $value = shift;
+    my $ou = shift;
+    my $page_size = shift || 9;
+    my $page = shift || 0;
+    my $statuses = shift || [];
+    my $copy_locations = shift || [];
+
+    my ($before_limit,$after_limit) = (0,0);
+    my ($before_offset,$after_offset) = (0,0);
+
+    if (!$page) {
+        $before_limit = $after_limit = int($page_size / 2);
+        $after_limit += 1 if ($page_size % 2);
+    } else {
+        $before_offset = $after_offset = int($page_size / 2);
+        $before_offset += 1 if ($page_size % 2);
+        $before_limit = $after_limit = $page_size;
+    }
+
+    my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
+
+    my @ou_ids;
+    if ($ou && $ou ne '-') {
+        my $orgs = $_storage->request(
+            "open-ils.cstore.direct.actor.org_unit.search",
+            { shortname => $ou },
+            { flesh     => 100,
+              flesh_fields  => { aou    => [qw/children/] }
+            }
+        )->gather(1);
+        @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
+    }
+
+    $logger->debug("Searching for records at orgs [".join(',', at ou_ids)."], based on $ou");
+
+    my @list = ();
+
+    if ($page <= 0) {
+        my $before = $_storage->request(
+            "open-ils.cstore.json_query.atomic",
+            { select    => { mfr => [qw/record value/] },
+              from      => 'mfr',
+              where     =>
+                { '+mfr'    =>
+                    { tag   => $tag,
+                      subfield => $subfield,
+                      value => { '<' => lc($value) }
+                    },
                   '-or' => [
-		    		{ '-exists'	=>
-	    				{ select=> { acp => [ 'id' ] },
-    					  from	=> { acn => { acp => { field => 'call_number', fkey => 'id' } } },
-					      where	=>
-				    		{ '+acn' => { record => { '=' => { '+mfr' => 'record' } } },
-			    			  '+acp' =>
-								{ deleted => 'f',
-								  ((@ou_ids)          ? ( circ_lib => \@ou_ids)        : ()),
-								  ((@$statuses)       ? ( status   => $statuses)       : ()),
-								  ((@$copy_locations) ? ( location => $copy_locations) : ())
-								}
-		    				},
-	    				  limit => 1
-    					}
+                    { '-exists' =>
+                        { select=> { acp => [ 'id' ] },
+                          from  => { acn => { acp => { field => 'call_number', fkey => 'id' } } },
+                          where =>
+                            { '+acn' => { record => { '=' => { '+mfr' => 'record' } } },
+                              '+acp' =>
+                                { deleted => 'f',
+                                  ((@ou_ids)          ? ( circ_lib => \@ou_ids)        : ()),
+                                  ((@$statuses)       ? ( status   => $statuses)       : ()),
+                                  ((@$copy_locations) ? ( location => $copy_locations) : ())
+                                }
+                            },
+                          limit => 1
+                        }
                     },
-                    { '-exists'	=>
-    					{ select=> { auri => [ 'id' ] },
-	    				  from	=> { acn => { auricnm => { field => 'call_number', fkey => 'id', join => { auri => { field => 'id', fkey => 'uri' } } } } },
-		    			  where	=>
-			    			{ '+acn' => { record => { '=' => { '+mfr' => 'record' } }, (@ou_ids) ? ( owning_lib => \@ou_ids) : () },
-				    		  '+auri' => { active => 't' }
-					    	},
-    					  limit => 1
-	    				}
+                    { '-exists' =>
+                        { select=> { auri => [ 'id' ] },
+                          from  => { acn => { auricnm => { field => 'call_number', fkey => 'id', join => { auri => { field => 'id', fkey => 'uri' } } } } },
+                          where =>
+                            { '+acn' => { record => { '=' => { '+mfr' => 'record' } }, (@ou_ids) ? ( owning_lib => \@ou_ids) : () },
+                              '+auri' => { active => 't' }
+                            },
+                          limit => 1
+                        }
                     }
                   ]
-				}, 
-			  order_by	=> { mfr => { value => 'desc' } },
-			  limit		=> $before_limit,
-			  offset	=> abs($page) * $page_size - $before_offset,
-			}
-		)->gather(1);
-		push @list, map { $_->{record} } reverse(@$before);
-	}
-
-	if ($page >= 0) {
-		my $after = $_storage->request(
-			"open-ils.cstore.json_query.atomic",
-			{ select	=> { mfr => [qw/record value/] },
-			  from		=> 'mfr',
-			  where		=>
-				{ '+mfr'	=>
-					{ tag	=> $tag,
-					  subfield => $subfield,
-					  value => { '>=' => lc($value) }
-					},
-				  '-or' => [
-                    { '-exists'	=>
-    					{ select=> { acp => [ 'id' ] },
-	    				  from	=> { acn => { acp => { field => 'call_number', fkey => 'id' } } },
-		    			  where	=>
-			    			{ '+acn' => { record => { '=' => { '+mfr' => 'record' } } },
-			    			  '+acp' =>
-								{ deleted => 'f',
-								  ((@ou_ids)          ? ( circ_lib => \@ou_ids)        : ()),
-								  ((@$statuses)       ? ( status   => $statuses)       : ()),
-								  ((@$copy_locations) ? ( location => $copy_locations) : ())
-								}
-					    	},
-    					  limit => 1
-	    				}
+                }, 
+              order_by  => { mfr => { value => 'desc' } },
+              limit     => $before_limit,
+              offset    => abs($page) * $page_size - $before_offset,
+            }
+        )->gather(1);
+        push @list, map { $_->{record} } reverse(@$before);
+    }
+
+    if ($page >= 0) {
+        my $after = $_storage->request(
+            "open-ils.cstore.json_query.atomic",
+            { select    => { mfr => [qw/record value/] },
+              from      => 'mfr',
+              where     =>
+                { '+mfr'    =>
+                    { tag   => $tag,
+                      subfield => $subfield,
+                      value => { '>=' => lc($value) }
                     },
-                    { '-exists'	=>
-    					{ select=> { auri => [ 'id' ] },
-	    				  from	=> { acn => { auricnm => { field => 'call_number', fkey => 'id', join => { auri => { field => 'id', fkey => 'uri' } } } } },
-		    			  where	=>
-			    			{ '+acn' => { record => { '=' => { '+mfr' => 'record' } }, (@ou_ids) ? ( owning_lib => \@ou_ids) : () },
-				    		  '+auri' => { active => 't' }
-					    	},
-    					  limit => 1
-	    				},
+                  '-or' => [
+                    { '-exists' =>
+                        { select=> { acp => [ 'id' ] },
+                          from  => { acn => { acp => { field => 'call_number', fkey => 'id' } } },
+                          where =>
+                            { '+acn' => { record => { '=' => { '+mfr' => 'record' } } },
+                              '+acp' =>
+                                { deleted => 'f',
+                                  ((@ou_ids)          ? ( circ_lib => \@ou_ids)        : ()),
+                                  ((@$statuses)       ? ( status   => $statuses)       : ()),
+                                  ((@$copy_locations) ? ( location => $copy_locations) : ())
+                                }
+                            },
+                          limit => 1
+                        }
+                    },
+                    { '-exists' =>
+                        { select=> { auri => [ 'id' ] },
+                          from  => { acn => { auricnm => { field => 'call_number', fkey => 'id', join => { auri => { field => 'id', fkey => 'uri' } } } } },
+                          where =>
+                            { '+acn' => { record => { '=' => { '+mfr' => 'record' } }, (@ou_ids) ? ( owning_lib => \@ou_ids) : () },
+                              '+auri' => { active => 't' }
+                            },
+                          limit => 1
+                        },
                     }
                   ]
-				}, 
-			  order_by	=> { mfr => { value => 'asc' } },
-			  limit		=> $after_limit,
-			  offset	=> abs($page) * $page_size - $after_offset,
-			}
-		)->gather(1);
-		push @list, map { $_->{record} } @$after;
-	}
-
-	return \@list;
+                }, 
+              order_by  => { mfr => { value => 'asc' } },
+              limit     => $after_limit,
+              offset    => abs($page) * $page_size - $after_offset,
+            }
+        )->gather(1);
+        push @list, map { $_->{record} } @$after;
+    }
+
+    return \@list;
 }
 __PACKAGE__->register_method(
-	method    => 'tag_sf_browse',
-	api_name  => 'open-ils.supercat.tag.browse',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'tag_sf_browse',
+    api_name  => 'open-ils.supercat.tag.browse',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns a list of the requested org-scoped record IDs held
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'tag',
-				  desc => 'The target MARC tag',
-				  type => 'string' },
-				{ name => 'subfield',
-				  desc => 'The target MARC subfield',
-				  type => 'string' },
-				{ name => 'value',
-				  desc => 'The target string',
-				  type => 'string' },
-				{ name => 'org_unit',
-				  desc => 'The org unit shortname (or "-" or undef for global) to browse',
-				  type => 'string' },
-				{ name => 'page_size',
-				  desc => 'Count of call numbers to retrieve, default is 9',
-				  type => 'number' },
-				{ name => 'page',
-				  desc => 'The page of call numbers to retrieve, calculated based on page_size.  Can be positive, negative or 0.',
-				  type => 'number' },
-				{ name => 'statuses',
-				  desc => 'Array of statuses to filter copies by, optional and can be undef.',
-				  type => 'array' },
-				{ name => 'locations',
-				  desc => 'Array of copy locations to filter copies by, optional and can be undef.',
-				  type => 'array' },
-			],
-		  'return' =>
-		  	{ desc => 'Record IDs that have copies at the relevant org units',
-			  type => 'array' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'tag',
+                  desc => 'The target MARC tag',
+                  type => 'string' },
+                { name => 'subfield',
+                  desc => 'The target MARC subfield',
+                  type => 'string' },
+                { name => 'value',
+                  desc => 'The target string',
+                  type => 'string' },
+                { name => 'org_unit',
+                  desc => 'The org unit shortname (or "-" or undef for global) to browse',
+                  type => 'string' },
+                { name => 'page_size',
+                  desc => 'Count of call numbers to retrieve, default is 9',
+                  type => 'number' },
+                { name => 'page',
+                  desc => 'The page of call numbers to retrieve, calculated based on page_size.  Can be positive, negative or 0.',
+                  type => 'number' },
+                { name => 'statuses',
+                  desc => 'Array of statuses to filter copies by, optional and can be undef.',
+                  type => 'array' },
+                { name => 'locations',
+                  desc => 'Array of copy locations to filter copies by, optional and can be undef.',
+                  type => 'array' },
+            ],
+          'return' =>
+            { desc => 'Record IDs that have copies at the relevant org units',
+              type => 'array' }
+        }
 );
 
 sub grab_authority_browse_axes {
@@ -995,22 +995,22 @@ sub grab_authority_browse_axes {
     }
 }
 __PACKAGE__->register_method(
-	method    => 'grab_authority_browse_axes',
-	api_name  => 'open-ils.supercat.authority.browse_axis_list',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of valid authority browse/startswith axes",
-		  params   => [
+    method    => 'grab_authority_browse_axes',
+    api_name  => 'open-ils.supercat.authority.browse_axis_list',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of valid authority browse/startswith axes",
+          params   => [
               { name => 'full', desc => 'Optional. If true, return array containing the full object for each axis, sorted by code. Otherwise just return an array of the codes.', type => 'number' }
           ],
-		  'return' => { desc => 'Axis codes or whole axes, see "full" param', type => 'array' }
-		}
+          'return' => { desc => 'Axis codes or whole axes, see "full" param', type => 'array' }
+        }
 );
 
 sub axis_authority_browse {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
     my $axis = shift;
 
     $axis =~ s/^authority\.//;
@@ -1030,147 +1030,147 @@ sub axis_authority_browse {
     return authority_tag_sf_browse($self, $client, \@tags, 'a', @_); # XXX TODO figure out something more correct for the subfield param
 }
 __PACKAGE__->register_method(
-	method    => 'axis_authority_browse',
-	api_name  => 'open-ils.supercat.authority.browse.by_axis',
-	api_level => 1,
-	argc      => 2,
-	signature =>
-		{ desc     => "Returns a list of the requested authority record IDs held",
-		  params   =>
-		  	[ { name => 'axis', desc => 'The target axis', type => 'string' },
-		  	  { name => 'value', desc => 'The target value', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
-		  'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
-		}
+    method    => 'axis_authority_browse',
+    api_name  => 'open-ils.supercat.authority.browse.by_axis',
+    api_level => 1,
+    argc      => 2,
+    signature =>
+        { desc     => "Returns a list of the requested authority record IDs held",
+          params   =>
+            [ { name => 'axis', desc => 'The target axis', type => 'string' },
+              { name => 'value', desc => 'The target value', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
+          'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
+        }
 );
 
 =pod
 
 sub general_authority_browse {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
     return authority_tag_sf_browse($self, $client, $self->{tag}, $self->{subfield}, @_);
 }
 __PACKAGE__->register_method(
-	method    => 'general_authority_browse',
-	api_name  => 'open-ils.supercat.authority.title.browse',
-	tag       => ['130'], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested authority record IDs held",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target title', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
-		  'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
-		}
+    method    => 'general_authority_browse',
+    api_name  => 'open-ils.supercat.authority.title.browse',
+    tag       => ['130'], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested authority record IDs held",
+          params   =>
+            [ { name => 'value', desc => 'The target title', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
+          'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_authority_browse',
-	api_name  => 'open-ils.supercat.authority.author.browse',
-	tag       => [qw/100 110 111/], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested authority record IDs held",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target author', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
-		  'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
-		}
+    method    => 'general_authority_browse',
+    api_name  => 'open-ils.supercat.authority.author.browse',
+    tag       => [qw/100 110 111/], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested authority record IDs held",
+          params   =>
+            [ { name => 'value', desc => 'The target author', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
+          'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_authority_browse',
-	api_name  => 'open-ils.supercat.authority.subject.browse',
-	tag       => [qw/148 150 151 155/], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested authority record IDs held",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target subject', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
-		  'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
-		}
+    method    => 'general_authority_browse',
+    api_name  => 'open-ils.supercat.authority.subject.browse',
+    tag       => [qw/148 150 151 155/], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested authority record IDs held",
+          params   =>
+            [ { name => 'value', desc => 'The target subject', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
+          'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_authority_browse',
-	api_name  => 'open-ils.supercat.authority.topic.browse',
-	tag       => ['150'], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested authority record IDs held",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target topical subject', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
-		  'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
-		}
+    method    => 'general_authority_browse',
+    api_name  => 'open-ils.supercat.authority.topic.browse',
+    tag       => ['150'], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested authority record IDs held",
+          params   =>
+            [ { name => 'value', desc => 'The target topical subject', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
+          'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_authority_browse',
-	api_name  => 'open-ils.supercat.authority.title.refs.browse',
-	tag       => ['130'], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested authority record IDs held, including see (4xx) and see also (5xx) references",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target title', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
-		  'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
-		}
+    method    => 'general_authority_browse',
+    api_name  => 'open-ils.supercat.authority.title.refs.browse',
+    tag       => ['130'], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested authority record IDs held, including see (4xx) and see also (5xx) references",
+          params   =>
+            [ { name => 'value', desc => 'The target title', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
+          'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_authority_browse',
-	api_name  => 'open-ils.supercat.authority.author.refs.browse',
-	tag       => [qw/100 110 111/], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested authority record IDs held, including see (4xx) and see also (5xx) references",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target author', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
-		  'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
-		}
+    method    => 'general_authority_browse',
+    api_name  => 'open-ils.supercat.authority.author.refs.browse',
+    tag       => [qw/100 110 111/], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested authority record IDs held, including see (4xx) and see also (5xx) references",
+          params   =>
+            [ { name => 'value', desc => 'The target author', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
+          'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_authority_browse',
-	api_name  => 'open-ils.supercat.authority.subject.refs.browse',
-	tag       => [qw/148 150 151 155/], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested authority record IDs held, including see (4xx) and see also (5xx) references",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target subject', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
-		  'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
-		}
+    method    => 'general_authority_browse',
+    api_name  => 'open-ils.supercat.authority.subject.refs.browse',
+    tag       => [qw/148 150 151 155/], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested authority record IDs held, including see (4xx) and see also (5xx) references",
+          params   =>
+            [ { name => 'value', desc => 'The target subject', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
+          'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_authority_browse',
-	api_name  => 'open-ils.supercat.authority.topic.refs.browse',
-	tag       => ['150'], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested authority record IDs held, including see (4xx) and see also (5xx) references",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target topical subject', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
-		  'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
-		}
+    method    => 'general_authority_browse',
+    api_name  => 'open-ils.supercat.authority.topic.refs.browse',
+    tag       => ['150'], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested authority record IDs held, including see (4xx) and see also (5xx) references",
+          params   =>
+            [ { name => 'value', desc => 'The target topical subject', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
+          'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
+        }
 );
 
 =cut
@@ -1258,308 +1258,308 @@ sub authority_tag_sf_browse {
     return \@retlist;
 }
 __PACKAGE__->register_method(
-	method    => 'authority_tag_sf_browse',
-	api_name  => 'open-ils.supercat.authority.tag.browse',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'authority_tag_sf_browse',
+    api_name  => 'open-ils.supercat.authority.tag.browse',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns a list of the requested authority record IDs held
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'tag',
-				  desc => 'The target Authority MARC tag',
-				  type => 'string' },
-				{ name => 'subfield',
-				  desc => 'The target Authority MARC subfield',
-				  type => 'string' },
-				{ name => 'value',
-				  desc => 'The target string',
-				  type => 'string' },
-				{ name => 'page_size',
-				  desc => 'Count of call numbers to retrieve, default is 9',
-				  type => 'number' },
-				{ name => 'page',
-				  desc => 'The page of call numbers to retrieve, calculated based on page_size.  Can be positive, negative or 0.',
-				  type => 'number' },
-			],
-		  'return' =>
-		  	{ desc => 'Authority Record IDs that are near the target string',
-			  type => 'array' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'tag',
+                  desc => 'The target Authority MARC tag',
+                  type => 'string' },
+                { name => 'subfield',
+                  desc => 'The target Authority MARC subfield',
+                  type => 'string' },
+                { name => 'value',
+                  desc => 'The target string',
+                  type => 'string' },
+                { name => 'page_size',
+                  desc => 'Count of call numbers to retrieve, default is 9',
+                  type => 'number' },
+                { name => 'page',
+                  desc => 'The page of call numbers to retrieve, calculated based on page_size.  Can be positive, negative or 0.',
+                  type => 'number' },
+            ],
+          'return' =>
+            { desc => 'Authority Record IDs that are near the target string',
+              type => 'array' }
+        }
 );
 
 sub general_startwith {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
     return tag_sf_startwith($self, $client, $self->{tag}, $self->{subfield}, @_);
 }
 __PACKAGE__->register_method(
-	method    => 'general_startwith',
-	api_name  => 'open-ils.supercat.title.startwith',
-	tag       => 'tnf', subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested org-scoped record IDs held",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target title', type => 'string' },
-			  { name => 'org_unit', desc => 'The org unit shortname (or "-" or undef for global) to browse', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' },
-			  { name => 'statuses', desc => 'Array of statuses to filter copies by, optional and can be undef.', type => 'array' },
-			  { name => 'locations', desc => 'Array of copy locations to filter copies by, optional and can be undef.', type => 'array' }, ],
-		  'return' => { desc => 'Record IDs that have copies at the relevant org units', type => 'array' }
-		}
+    method    => 'general_startwith',
+    api_name  => 'open-ils.supercat.title.startwith',
+    tag       => 'tnf', subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested org-scoped record IDs held",
+          params   =>
+            [ { name => 'value', desc => 'The target title', type => 'string' },
+              { name => 'org_unit', desc => 'The org unit shortname (or "-" or undef for global) to browse', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' },
+              { name => 'statuses', desc => 'Array of statuses to filter copies by, optional and can be undef.', type => 'array' },
+              { name => 'locations', desc => 'Array of copy locations to filter copies by, optional and can be undef.', type => 'array' }, ],
+          'return' => { desc => 'Record IDs that have copies at the relevant org units', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_startwith',
-	api_name  => 'open-ils.supercat.author.startwith',
-	tag       => [qw/100 110 111/], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested org-scoped record IDs held",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target author', type => 'string' },
-			  { name => 'org_unit', desc => 'The org unit shortname (or "-" or undef for global) to browse', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' },
-			  { name => 'statuses', desc => 'Array of statuses to filter copies by, optional and can be undef.', type => 'array' },
-			  { name => 'locations', desc => 'Array of copy locations to filter copies by, optional and can be undef.', type => 'array' }, ],
-		  'return' => { desc => 'Record IDs that have copies at the relevant org units', type => 'array' }
-		}
+    method    => 'general_startwith',
+    api_name  => 'open-ils.supercat.author.startwith',
+    tag       => [qw/100 110 111/], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested org-scoped record IDs held",
+          params   =>
+            [ { name => 'value', desc => 'The target author', type => 'string' },
+              { name => 'org_unit', desc => 'The org unit shortname (or "-" or undef for global) to browse', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' },
+              { name => 'statuses', desc => 'Array of statuses to filter copies by, optional and can be undef.', type => 'array' },
+              { name => 'locations', desc => 'Array of copy locations to filter copies by, optional and can be undef.', type => 'array' }, ],
+          'return' => { desc => 'Record IDs that have copies at the relevant org units', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_startwith',
-	api_name  => 'open-ils.supercat.subject.startwith',
-	tag       => [qw/600 610 611 630 648 650 651 653 655 656 662 690 691 696 697 698 699/], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested org-scoped record IDs held",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target subject', type => 'string' },
-			  { name => 'org_unit', desc => 'The org unit shortname (or "-" or undef for global) to browse', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' },
-			  { name => 'statuses', desc => 'Array of statuses to filter copies by, optional and can be undef.', type => 'array' },
-			  { name => 'locations', desc => 'Array of copy locations to filter copies by, optional and can be undef.', type => 'array' }, ],
-		  'return' => { desc => 'Record IDs that have copies at the relevant org units', type => 'array' }
-		}
+    method    => 'general_startwith',
+    api_name  => 'open-ils.supercat.subject.startwith',
+    tag       => [qw/600 610 611 630 648 650 651 653 655 656 662 690 691 696 697 698 699/], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested org-scoped record IDs held",
+          params   =>
+            [ { name => 'value', desc => 'The target subject', type => 'string' },
+              { name => 'org_unit', desc => 'The org unit shortname (or "-" or undef for global) to browse', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' },
+              { name => 'statuses', desc => 'Array of statuses to filter copies by, optional and can be undef.', type => 'array' },
+              { name => 'locations', desc => 'Array of copy locations to filter copies by, optional and can be undef.', type => 'array' }, ],
+          'return' => { desc => 'Record IDs that have copies at the relevant org units', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_startwith',
-	api_name  => 'open-ils.supercat.topic.startwith',
-	tag       => [qw/650 690/], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested org-scoped record IDs held",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target topical subject', type => 'string' },
-			  { name => 'org_unit', desc => 'The org unit shortname (or "-" or undef for global) to browse', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' },
-			  { name => 'statuses', desc => 'Array of statuses to filter copies by, optional and can be undef.', type => 'array' },
-			  { name => 'locations', desc => 'Array of copy locations to filter copies by, optional and can be undef.', type => 'array' }, ],
-		  'return' => { desc => 'Record IDs that have copies at the relevant org units', type => 'array' }
-		}
+    method    => 'general_startwith',
+    api_name  => 'open-ils.supercat.topic.startwith',
+    tag       => [qw/650 690/], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested org-scoped record IDs held",
+          params   =>
+            [ { name => 'value', desc => 'The target topical subject', type => 'string' },
+              { name => 'org_unit', desc => 'The org unit shortname (or "-" or undef for global) to browse', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' },
+              { name => 'statuses', desc => 'Array of statuses to filter copies by, optional and can be undef.', type => 'array' },
+              { name => 'locations', desc => 'Array of copy locations to filter copies by, optional and can be undef.', type => 'array' }, ],
+          'return' => { desc => 'Record IDs that have copies at the relevant org units', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_startwith',
-	api_name  => 'open-ils.supercat.series.startwith',
-	tag       => [qw/440 490 800 810 811 830/], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested org-scoped record IDs held",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target series', type => 'string' },
-			  { name => 'org_unit', desc => 'The org unit shortname (or "-" or undef for global) to browse', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' },
-			  { name => 'statuses', desc => 'Array of statuses to filter copies by, optional and can be undef.', type => 'array' },
-			  { name => 'locations', desc => 'Array of copy locations to filter copies by, optional and can be undef.', type => 'array' }, ],
-		  'return' => { desc => 'Record IDs that have copies at the relevant org units', type => 'array' }
-		}
+    method    => 'general_startwith',
+    api_name  => 'open-ils.supercat.series.startwith',
+    tag       => [qw/440 490 800 810 811 830/], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested org-scoped record IDs held",
+          params   =>
+            [ { name => 'value', desc => 'The target series', type => 'string' },
+              { name => 'org_unit', desc => 'The org unit shortname (or "-" or undef for global) to browse', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 9', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' },
+              { name => 'statuses', desc => 'Array of statuses to filter copies by, optional and can be undef.', type => 'array' },
+              { name => 'locations', desc => 'Array of copy locations to filter copies by, optional and can be undef.', type => 'array' }, ],
+          'return' => { desc => 'Record IDs that have copies at the relevant org units', type => 'array' }
+        }
 );
 
 
 sub tag_sf_startwith {
-	my $self = shift;
-	my $client = shift;
-
-	my $tag = shift;
-	my $subfield = shift;
-	my $value = shift;
-	my $ou = shift;
-	my $limit = shift || 10;
-	my $page = shift || 0;
-	my $statuses = shift || [];
-	my $copy_locations = shift || [];
-
-	my $offset = $limit * abs($page);
-	my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
-
-	my @ou_ids;
-	if ($ou && $ou ne '-') {
-		my $orgs = $_storage->request(
-			"open-ils.cstore.direct.actor.org_unit.search",
-			{ shortname => $ou },
-			{ flesh		=> 100,
-			  flesh_fields	=> { aou	=> [qw/children/] }
-			}
-		)->gather(1);
-		@ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
-	}
-
-	$logger->debug("Searching for records at orgs [".join(',', at ou_ids)."], based on $ou");
-
-	my @list = ();
-
-	if ($page < 0) {
-		my $before = $_storage->request(
-			"open-ils.cstore.json_query.atomic",
-			{ select	=> { mfr => [qw/record value/] },
-			  from		=> 'mfr',
-			  where		=>
-				{ '+mfr'	=>
-					{ tag	=> $tag,
-					  subfield => $subfield,
-					  value => { '<' => lc($value) }
-					},
+    my $self = shift;
+    my $client = shift;
+
+    my $tag = shift;
+    my $subfield = shift;
+    my $value = shift;
+    my $ou = shift;
+    my $limit = shift || 10;
+    my $page = shift || 0;
+    my $statuses = shift || [];
+    my $copy_locations = shift || [];
+
+    my $offset = $limit * abs($page);
+    my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
+
+    my @ou_ids;
+    if ($ou && $ou ne '-') {
+        my $orgs = $_storage->request(
+            "open-ils.cstore.direct.actor.org_unit.search",
+            { shortname => $ou },
+            { flesh     => 100,
+              flesh_fields  => { aou    => [qw/children/] }
+            }
+        )->gather(1);
+        @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
+    }
+
+    $logger->debug("Searching for records at orgs [".join(',', at ou_ids)."], based on $ou");
+
+    my @list = ();
+
+    if ($page < 0) {
+        my $before = $_storage->request(
+            "open-ils.cstore.json_query.atomic",
+            { select    => { mfr => [qw/record value/] },
+              from      => 'mfr',
+              where     =>
+                { '+mfr'    =>
+                    { tag   => $tag,
+                      subfield => $subfield,
+                      value => { '<' => lc($value) }
+                    },
                   '-or' => [
-		    		{ '-exists'	=>
-	    				{ select=> { acp => [ 'id' ] },
-    					  from	=> { acn => { acp => { field => 'call_number', fkey => 'id' } } },
-					      where	=>
-				    		{ '+acn' => { record => { '=' => { '+mfr' => 'record' } } },
-			    			  '+acp' =>
-								{ deleted => 'f',
-								  ((@ou_ids)          ? ( circ_lib => \@ou_ids)        : ()),
-								  ((@$statuses)       ? ( status   => $statuses)       : ()),
-								  ((@$copy_locations) ? ( location => $copy_locations) : ())
-								}
-		    				},
-	    				  limit => 1
-    					}
+                    { '-exists' =>
+                        { select=> { acp => [ 'id' ] },
+                          from  => { acn => { acp => { field => 'call_number', fkey => 'id' } } },
+                          where =>
+                            { '+acn' => { record => { '=' => { '+mfr' => 'record' } } },
+                              '+acp' =>
+                                { deleted => 'f',
+                                  ((@ou_ids)          ? ( circ_lib => \@ou_ids)        : ()),
+                                  ((@$statuses)       ? ( status   => $statuses)       : ()),
+                                  ((@$copy_locations) ? ( location => $copy_locations) : ())
+                                }
+                            },
+                          limit => 1
+                        }
                     },
-                    { '-exists'	=>
-    					{ select=> { auri => [ 'id' ] },
-	    				  from	=> { acn => { auricnm => { field => 'call_number', fkey => 'id', join => { auri => { field => 'id', fkey => 'uri' } } } } },
-		    			  where	=>
-			    			{ '+acn' => { record => { '=' => { '+mfr' => 'record' } }, (@ou_ids) ? ( owning_lib => \@ou_ids) : () },
-				    		  '+auri' => { active => 't' }
-					    	},
-    					  limit => 1
-	    				}
+                    { '-exists' =>
+                        { select=> { auri => [ 'id' ] },
+                          from  => { acn => { auricnm => { field => 'call_number', fkey => 'id', join => { auri => { field => 'id', fkey => 'uri' } } } } },
+                          where =>
+                            { '+acn' => { record => { '=' => { '+mfr' => 'record' } }, (@ou_ids) ? ( owning_lib => \@ou_ids) : () },
+                              '+auri' => { active => 't' }
+                            },
+                          limit => 1
+                        }
                     }
                   ]
-				}, 
-			  order_by	=> { mfr => { value => 'desc' } },
-			  limit		=> $limit,
-			  offset	=> $offset
-			}
-		)->gather(1);
-		push @list, map { $_->{record} } reverse(@$before);
-	}
-
-	if ($page >= 0) {
-		my $after = $_storage->request(
-			"open-ils.cstore.json_query.atomic",
-			{ select	=> { mfr => [qw/record value/] },
-			  from		=> 'mfr',
-			  where		=>
-				{ '+mfr'	=>
-					{ tag	=> $tag,
-					  subfield => $subfield,
-					  value => { '>=' => lc($value) }
-					},
-				  '-or' => [
-                    { '-exists'	=>
-    					{ select=> { acp => [ 'id' ] },
-	    				  from	=> { acn => { acp => { field => 'call_number', fkey => 'id' } } },
-		    			  where	=>
-			    			{ '+acn' => { record => { '=' => { '+mfr' => 'record' } } },
-			    			  '+acp' =>
-								{ deleted => 'f',
-								  ((@ou_ids)          ? ( circ_lib => \@ou_ids)        : ()),
-								  ((@$statuses)       ? ( status   => $statuses)       : ()),
-								  ((@$copy_locations) ? ( location => $copy_locations) : ())
-								}
-					    	},
-    					  limit => 1
-	    				}
+                }, 
+              order_by  => { mfr => { value => 'desc' } },
+              limit     => $limit,
+              offset    => $offset
+            }
+        )->gather(1);
+        push @list, map { $_->{record} } reverse(@$before);
+    }
+
+    if ($page >= 0) {
+        my $after = $_storage->request(
+            "open-ils.cstore.json_query.atomic",
+            { select    => { mfr => [qw/record value/] },
+              from      => 'mfr',
+              where     =>
+                { '+mfr'    =>
+                    { tag   => $tag,
+                      subfield => $subfield,
+                      value => { '>=' => lc($value) }
                     },
-                    { '-exists'	=>
-    					{ select=> { auri => [ 'id' ] },
-	    				  from	=> { acn => { auricnm => { field => 'call_number', fkey => 'id', join => { auri => { field => 'id', fkey => 'uri' } } } } },
-		    			  where	=>
-			    			{ '+acn' => { record => { '=' => { '+mfr' => 'record' } }, (@ou_ids) ? ( owning_lib => \@ou_ids) : () },
-				    		  '+auri' => { active => 't' }
-					    	},
-    					  limit => 1
-	    				},
+                  '-or' => [
+                    { '-exists' =>
+                        { select=> { acp => [ 'id' ] },
+                          from  => { acn => { acp => { field => 'call_number', fkey => 'id' } } },
+                          where =>
+                            { '+acn' => { record => { '=' => { '+mfr' => 'record' } } },
+                              '+acp' =>
+                                { deleted => 'f',
+                                  ((@ou_ids)          ? ( circ_lib => \@ou_ids)        : ()),
+                                  ((@$statuses)       ? ( status   => $statuses)       : ()),
+                                  ((@$copy_locations) ? ( location => $copy_locations) : ())
+                                }
+                            },
+                          limit => 1
+                        }
+                    },
+                    { '-exists' =>
+                        { select=> { auri => [ 'id' ] },
+                          from  => { acn => { auricnm => { field => 'call_number', fkey => 'id', join => { auri => { field => 'id', fkey => 'uri' } } } } },
+                          where =>
+                            { '+acn' => { record => { '=' => { '+mfr' => 'record' } }, (@ou_ids) ? ( owning_lib => \@ou_ids) : () },
+                              '+auri' => { active => 't' }
+                            },
+                          limit => 1
+                        },
                     }
                   ]
-				}, 
-			  order_by	=> { mfr => { value => 'asc' } },
-			  limit		=> $limit,
-			  offset	=> $offset
-			}
-		)->gather(1);
-		push @list, map { $_->{record} } @$after;
-	}
-
-	return \@list;
+                }, 
+              order_by  => { mfr => { value => 'asc' } },
+              limit     => $limit,
+              offset    => $offset
+            }
+        )->gather(1);
+        push @list, map { $_->{record} } @$after;
+    }
+
+    return \@list;
 }
 __PACKAGE__->register_method(
-	method    => 'tag_sf_startwith',
-	api_name  => 'open-ils.supercat.tag.startwith',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'tag_sf_startwith',
+    api_name  => 'open-ils.supercat.tag.startwith',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns a list of the requested org-scoped record IDs held
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'tag',
-				  desc => 'The target MARC tag',
-				  type => 'string' },
-				{ name => 'subfield',
-				  desc => 'The target MARC subfield',
-				  type => 'string' },
-				{ name => 'value',
-				  desc => 'The target string',
-				  type => 'string' },
-				{ name => 'org_unit',
-				  desc => 'The org unit shortname (or "-" or undef for global) to browse',
-				  type => 'string' },
-				{ name => 'page_size',
-				  desc => 'Count of call numbers to retrieve, default is 9',
-				  type => 'number' },
-				{ name => 'page',
-				  desc => 'The page of call numbers to retrieve, calculated based on page_size.  Can be positive, negative or 0.',
-				  type => 'number' },
-				{ name => 'statuses',
-				  desc => 'Array of statuses to filter copies by, optional and can be undef.',
-				  type => 'array' },
-				{ name => 'locations',
-				  desc => 'Array of copy locations to filter copies by, optional and can be undef.',
-				  type => 'array' },
-			],
-		  'return' =>
-		  	{ desc => 'Record IDs that have copies at the relevant org units',
-			  type => 'array' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'tag',
+                  desc => 'The target MARC tag',
+                  type => 'string' },
+                { name => 'subfield',
+                  desc => 'The target MARC subfield',
+                  type => 'string' },
+                { name => 'value',
+                  desc => 'The target string',
+                  type => 'string' },
+                { name => 'org_unit',
+                  desc => 'The org unit shortname (or "-" or undef for global) to browse',
+                  type => 'string' },
+                { name => 'page_size',
+                  desc => 'Count of call numbers to retrieve, default is 9',
+                  type => 'number' },
+                { name => 'page',
+                  desc => 'The page of call numbers to retrieve, calculated based on page_size.  Can be positive, negative or 0.',
+                  type => 'number' },
+                { name => 'statuses',
+                  desc => 'Array of statuses to filter copies by, optional and can be undef.',
+                  type => 'array' },
+                { name => 'locations',
+                  desc => 'Array of copy locations to filter copies by, optional and can be undef.',
+                  type => 'array' },
+            ],
+          'return' =>
+            { desc => 'Record IDs that have copies at the relevant org units',
+              type => 'array' }
+        }
 );
 
 sub axis_authority_startwith {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
     my $axis = shift;
 
     $axis =~ s/^authority\.//;
@@ -1579,147 +1579,147 @@ sub axis_authority_startwith {
     return authority_tag_sf_startwith($self, $client, \@tags, 'a', @_); # XXX TODO figure out something more correct for the subfield param
 }
 __PACKAGE__->register_method(
-	method    => 'axis_authority_startwith',
-	api_name  => 'open-ils.supercat.authority.startwith.by_axis',
-	api_level => 1,
-	argc      => 2,
-	signature =>
-		{ desc     => "Returns a list of the requested authority record IDs held",
-		  params   =>
-		  	[ { name => 'axis', desc => 'The target axis', type => 'string' },
-		  	  { name => 'value', desc => 'The target value', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 10', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
-		  'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
-		}
+    method    => 'axis_authority_startwith',
+    api_name  => 'open-ils.supercat.authority.startwith.by_axis',
+    api_level => 1,
+    argc      => 2,
+    signature =>
+        { desc     => "Returns a list of the requested authority record IDs held",
+          params   =>
+            [ { name => 'axis', desc => 'The target axis', type => 'string' },
+              { name => 'value', desc => 'The target value', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 10', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
+          'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
+        }
 );
 
 =pod
 
 sub general_authority_startwith {
-	my $self = shift;
-	my $client = shift;
+    my $self = shift;
+    my $client = shift;
     return authority_tag_sf_startwith($self, $client, $self->{tag}, $self->{subfield}, @_);
 }
 __PACKAGE__->register_method(
-	method    => 'general_authority_startwith',
-	api_name  => 'open-ils.supercat.authority.title.startwith',
-	tag       => ['130'], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested authority record IDs held",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target title', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 10', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
-		  'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
-		}
+    method    => 'general_authority_startwith',
+    api_name  => 'open-ils.supercat.authority.title.startwith',
+    tag       => ['130'], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested authority record IDs held",
+          params   =>
+            [ { name => 'value', desc => 'The target title', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 10', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
+          'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_authority_startwith',
-	api_name  => 'open-ils.supercat.authority.author.startwith',
-	tag       => [qw/100 110 111/], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested authority record IDs held",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target author', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 10', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
-		  'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
-		}
+    method    => 'general_authority_startwith',
+    api_name  => 'open-ils.supercat.authority.author.startwith',
+    tag       => [qw/100 110 111/], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested authority record IDs held",
+          params   =>
+            [ { name => 'value', desc => 'The target author', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 10', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
+          'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_authority_startwith',
-	api_name  => 'open-ils.supercat.authority.subject.startwith',
-	tag       => [qw/148 150 151 155/], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested authority record IDs held",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target subject', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 10', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
-		  'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
-		}
+    method    => 'general_authority_startwith',
+    api_name  => 'open-ils.supercat.authority.subject.startwith',
+    tag       => [qw/148 150 151 155/], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested authority record IDs held",
+          params   =>
+            [ { name => 'value', desc => 'The target subject', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 10', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
+          'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_authority_startwith',
-	api_name  => 'open-ils.supercat.authority.topic.startwith',
-	tag       => ['150'], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested authority record IDs held",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target topical subject', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 10', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
-		  'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
-		}
+    method    => 'general_authority_startwith',
+    api_name  => 'open-ils.supercat.authority.topic.startwith',
+    tag       => ['150'], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested authority record IDs held",
+          params   =>
+            [ { name => 'value', desc => 'The target topical subject', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 10', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
+          'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_authority_startwith',
-	api_name  => 'open-ils.supercat.authority.title.refs.startwith',
-	tag       => ['130'], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested authority record IDs held, including see (4xx) and see also (5xx) references",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target title', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 10', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
-		  'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
-		}
+    method    => 'general_authority_startwith',
+    api_name  => 'open-ils.supercat.authority.title.refs.startwith',
+    tag       => ['130'], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested authority record IDs held, including see (4xx) and see also (5xx) references",
+          params   =>
+            [ { name => 'value', desc => 'The target title', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 10', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
+          'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_authority_startwith',
-	api_name  => 'open-ils.supercat.authority.author.refs.startwith',
-	tag       => [qw/100 110 111/], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested authority record IDs held, including see (4xx) and see also (5xx) references",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target author', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 10', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
-		  'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
-		}
+    method    => 'general_authority_startwith',
+    api_name  => 'open-ils.supercat.authority.author.refs.startwith',
+    tag       => [qw/100 110 111/], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested authority record IDs held, including see (4xx) and see also (5xx) references",
+          params   =>
+            [ { name => 'value', desc => 'The target author', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 10', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
+          'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_authority_startwith',
-	api_name  => 'open-ils.supercat.authority.subject.refs.startwith',
-	tag       => [qw/148 150 151 155/], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested authority record IDs held, including see (4xx) and see also (5xx) references",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target subject', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 10', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
-		  'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
-		}
+    method    => 'general_authority_startwith',
+    api_name  => 'open-ils.supercat.authority.subject.refs.startwith',
+    tag       => [qw/148 150 151 155/], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested authority record IDs held, including see (4xx) and see also (5xx) references",
+          params   =>
+            [ { name => 'value', desc => 'The target subject', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 10', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
+          'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'general_authority_startwith',
-	api_name  => 'open-ils.supercat.authority.topic.refs.startwith',
-	tag       => ['150'], subfield => 'a',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => "Returns a list of the requested authority record IDs held, including see (4xx) and see also (5xx) references",
-		  params   =>
-		  	[ { name => 'value', desc => 'The target topical subject', type => 'string' },
-			  { name => 'page_size', desc => 'Count of records to retrieve, default is 10', type => 'number' },
-			  { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
-		  'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
-		}
+    method    => 'general_authority_startwith',
+    api_name  => 'open-ils.supercat.authority.topic.refs.startwith',
+    tag       => ['150'], subfield => 'a',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => "Returns a list of the requested authority record IDs held, including see (4xx) and see also (5xx) references",
+          params   =>
+            [ { name => 'value', desc => 'The target topical subject', type => 'string' },
+              { name => 'page_size', desc => 'Count of records to retrieve, default is 10', type => 'number' },
+              { name => 'page', desc => 'The page of records retrieved, calculated based on page_size.  Can be positive, negative or 0.', type => 'number' }, ],
+          'return' => { desc => 'Authority Record IDs that are near the target string', type => 'array' }
+        }
 );
 
 =cut
@@ -1802,47 +1802,47 @@ sub authority_tag_sf_startwith {
     return \@retlist;
 }
 __PACKAGE__->register_method(
-	method    => 'authority_tag_sf_startwith',
-	api_name  => 'open-ils.supercat.authority.tag.startwith',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'authority_tag_sf_startwith',
+    api_name  => 'open-ils.supercat.authority.tag.startwith',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns a list of the requested authority record IDs held
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'tag',
-				  desc => 'The target Authority MARC tag',
-				  type => 'string' },
-				{ name => 'subfield',
-				  desc => 'The target Authority MARC subfield',
-				  type => 'string' },
-				{ name => 'value',
-				  desc => 'The target string',
-				  type => 'string' },
-				{ name => 'page_size',
-				  desc => 'Count of call numbers to retrieve, default is 10',
-				  type => 'number' },
-				{ name => 'page',
-				  desc => 'The page of call numbers to retrieve, calculated based on page_size.  Can be positive, negative or 0.',
-				  type => 'number' },
-			],
-		  'return' =>
-		  	{ desc => 'Authority Record IDs that are near the target string',
-			  type => 'array' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'tag',
+                  desc => 'The target Authority MARC tag',
+                  type => 'string' },
+                { name => 'subfield',
+                  desc => 'The target Authority MARC subfield',
+                  type => 'string' },
+                { name => 'value',
+                  desc => 'The target string',
+                  type => 'string' },
+                { name => 'page_size',
+                  desc => 'Count of call numbers to retrieve, default is 10',
+                  type => 'number' },
+                { name => 'page',
+                  desc => 'The page of call numbers to retrieve, calculated based on page_size.  Can be positive, negative or 0.',
+                  type => 'number' },
+            ],
+          'return' =>
+            { desc => 'Authority Record IDs that are near the target string',
+              type => 'array' }
+        }
 );
 
 
 sub holding_data_formats {
     return [{
         marcxml => {
-            namespace_uri	  => 'http://www.loc.gov/MARC21/slim',
-			docs		  => 'http://www.loc.gov/marcxml/',
-			schema_location => 'http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd',
-		}
-	}];
+            namespace_uri     => 'http://www.loc.gov/MARC21/slim',
+            docs          => 'http://www.loc.gov/marcxml/',
+            schema_location => 'http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd',
+        }
+    }];
 }
 __PACKAGE__->register_method( method => 'holding_data_formats', api_name => 'open-ils.supercat.acn.formats', api_level => 1 );
 __PACKAGE__->register_method( method => 'holding_data_formats', api_name => 'open-ils.supercat.acp.formats', api_level => 1 );
@@ -1850,227 +1850,227 @@ __PACKAGE__->register_method( method => 'holding_data_formats', api_name => 'ope
 
 
 __PACKAGE__->register_method(
-	method    => 'retrieve_uri',
-	api_name  => 'open-ils.supercat.auri.marcxml.retrieve',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'retrieve_uri',
+    api_name  => 'open-ils.supercat.auri.marcxml.retrieve',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns a fleshed call number object
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'uri_id',
-				  desc => 'An OpenILS asset::uri id',
-				  type => 'number' },
-			],
-		  'return' =>
-		  	{ desc => 'fleshed uri',
-			  type => 'object' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'uri_id',
+                  desc => 'An OpenILS asset::uri id',
+                  type => 'number' },
+            ],
+          'return' =>
+            { desc => 'fleshed uri',
+              type => 'object' }
+        }
 );
 sub retrieve_uri {
-	my $self = shift;
-	my $client = shift;
-	my $cpid = shift;
-	my $args = shift || {};
+    my $self = shift;
+    my $client = shift;
+    my $cpid = shift;
+    my $args = shift || {};
 
     return OpenILS::Application::SuperCat::unAPI
         ->new(OpenSRF::AppSession
             ->create( 'open-ils.cstore' )
             ->request(
-    	    	"open-ils.cstore.direct.asset.uri.retrieve",
-	    	    $cpid,
-    		    { flesh		=> 10,
-        		  flesh_fields	=> {
-	        	  			auri    => [qw/call_number_maps/],
-	        	  			auricnm	=> [qw/call_number/],
-	        	  			acn	    => [qw/owning_lib record prefix suffix/],
-    				}
-	    	    })
+                "open-ils.cstore.direct.asset.uri.retrieve",
+                $cpid,
+                { flesh     => 10,
+                  flesh_fields  => {
+                            auri    => [qw/call_number_maps/],
+                            auricnm => [qw/call_number/],
+                            acn     => [qw/owning_lib record prefix suffix/],
+                    }
+                })
             ->gather(1))
         ->as_xml($args);
 }
 
 __PACKAGE__->register_method(
-	method    => 'retrieve_copy',
-	api_name  => 'open-ils.supercat.acp.marcxml.retrieve',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'retrieve_copy',
+    api_name  => 'open-ils.supercat.acp.marcxml.retrieve',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns a fleshed call number object
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'cn_id',
-				  desc => 'An OpenILS asset::copy id',
-				  type => 'number' },
-			],
-		  'return' =>
-		  	{ desc => 'fleshed copy',
-			  type => 'object' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'cn_id',
+                  desc => 'An OpenILS asset::copy id',
+                  type => 'number' },
+            ],
+          'return' =>
+            { desc => 'fleshed copy',
+              type => 'object' }
+        }
 );
 sub retrieve_copy {
-	my $self = shift;
-	my $client = shift;
-	my $cpid = shift;
-	my $args = shift || {};
+    my $self = shift;
+    my $client = shift;
+    my $cpid = shift;
+    my $args = shift || {};
 
     return OpenILS::Application::SuperCat::unAPI
         ->new(OpenSRF::AppSession
             ->create( 'open-ils.cstore' )
             ->request(
-    	    	"open-ils.cstore.direct.asset.copy.retrieve",
-	    	    $cpid,
-    		    { flesh		=> 2,
-        		  flesh_fields	=> {
-	        	  			acn	=> [qw/owning_lib record prefix suffix/],
-		        			acp	=> [qw/call_number location status circ_lib stat_cat_entries notes parts/],
-    				}
-	    	    })
+                "open-ils.cstore.direct.asset.copy.retrieve",
+                $cpid,
+                { flesh     => 2,
+                  flesh_fields  => {
+                            acn => [qw/owning_lib record prefix suffix/],
+                            acp => [qw/call_number location status circ_lib stat_cat_entries notes parts/],
+                    }
+                })
             ->gather(1))
         ->as_xml($args);
 }
 
 __PACKAGE__->register_method(
-	method    => 'retrieve_callnumber',
-	api_name  => 'open-ils.supercat.acn.marcxml.retrieve',
-	api_level => 1,
-	argc      => 1,
-	stream    => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'retrieve_callnumber',
+    api_name  => 'open-ils.supercat.acn.marcxml.retrieve',
+    api_level => 1,
+    argc      => 1,
+    stream    => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns a fleshed call number object
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'cn_id',
-				  desc => 'An OpenILS asset::call_number id',
-				  type => 'number' },
-			],
-		  'return' =>
-		  	{ desc => 'call number with copies',
-			  type => 'object' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'cn_id',
+                  desc => 'An OpenILS asset::call_number id',
+                  type => 'number' },
+            ],
+          'return' =>
+            { desc => 'call number with copies',
+              type => 'object' }
+        }
 );
 sub retrieve_callnumber {
-	my $self = shift;
-	my $client = shift;
-	my $cnid = shift;
-	my $args = shift || {};
+    my $self = shift;
+    my $client = shift;
+    my $cnid = shift;
+    my $args = shift || {};
 
     return OpenILS::Application::SuperCat::unAPI
         ->new(OpenSRF::AppSession
             ->create( 'open-ils.cstore' )
             ->request(
-    	    	"open-ils.cstore.direct.asset.call_number.retrieve",
-	    	    $cnid,
-    		    { flesh		=> 5,
-        		  flesh_fields	=> {
-	        	  			acn	=> [qw/owning_lib record copies uri_maps prefix suffix/],
-	        	  			auricnm	=> [qw/uri/],
-		        			acp	=> [qw/location status circ_lib stat_cat_entries notes parts/],
-    				}
-	    	    })
+                "open-ils.cstore.direct.asset.call_number.retrieve",
+                $cnid,
+                { flesh     => 5,
+                  flesh_fields  => {
+                            acn => [qw/owning_lib record copies uri_maps prefix suffix/],
+                            auricnm => [qw/uri/],
+                            acp => [qw/location status circ_lib stat_cat_entries notes parts/],
+                    }
+                })
             ->gather(1))
         ->as_xml($args);
 
 }
 
 __PACKAGE__->register_method(
-	method    => 'basic_record_holdings',
-	api_name  => 'open-ils.supercat.record.basic_holdings.retrieve',
-	api_level => 1,
-	argc      => 1,
-	stream    => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'basic_record_holdings',
+    api_name  => 'open-ils.supercat.record.basic_holdings.retrieve',
+    api_level => 1,
+    argc      => 1,
+    stream    => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns a basic hash representation of the requested bibliographic record's holdings
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'bibId',
-				  desc => 'An OpenILS biblio::record_entry id',
-				  type => 'number' },
-			],
-		  'return' =>
-		  	{ desc => 'Hash of bib record holdings hierarchy (call numbers and copies)',
-			  type => 'string' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'bibId',
+                  desc => 'An OpenILS biblio::record_entry id',
+                  type => 'number' },
+            ],
+          'return' =>
+            { desc => 'Hash of bib record holdings hierarchy (call numbers and copies)',
+              type => 'string' }
+        }
 );
 sub basic_record_holdings {
-	my $self = shift;
-	my $client = shift;
-	my $bib = shift;
-	my $ou = shift;
-
-	#  holdings hold an array of call numbers, which hold an array of copies
-	#  holdings => [ label: { library, [ copies: { barcode, location, status, circ_lib } ] } ]
-	my %holdings;
-
-	my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
-
-	my $tree = $_storage->request(
-		"open-ils.cstore.direct.biblio.record_entry.retrieve",
-		$bib,
-		{ flesh		=> 5,
-		  flesh_fields	=> {
-					bre	=> [qw/call_numbers/],
-		  			acn	=> [qw/copies owning_lib prefix suffix/],
-					acp	=> [qw/location status circ_lib parts/],
-				}
-		}
-	)->gather(1);
-
-	my $o_search = { shortname => uc($ou) };
-	if (!$ou || $ou eq '-') {
-		$o_search = { parent_ou => undef };
-	}
-
-	my $orgs = $_storage->request(
-		"open-ils.cstore.direct.actor.org_unit.search",
-		$o_search,
-		{ flesh		=> 100,
-		  flesh_fields	=> { aou	=> [qw/children/] }
-		}
-	)->gather(1);
-
-	my @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
-
-	$logger->debug("Searching for holdings at orgs [".join(',', at ou_ids)."], based on $ou");
-
-	for my $cn (@{$tree->call_numbers}) {
+    my $self = shift;
+    my $client = shift;
+    my $bib = shift;
+    my $ou = shift;
+
+    #  holdings hold an array of call numbers, which hold an array of copies
+    #  holdings => [ label: { library, [ copies: { barcode, location, status, circ_lib } ] } ]
+    my %holdings;
+
+    my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
+
+    my $tree = $_storage->request(
+        "open-ils.cstore.direct.biblio.record_entry.retrieve",
+        $bib,
+        { flesh     => 5,
+          flesh_fields  => {
+                    bre => [qw/call_numbers/],
+                    acn => [qw/copies owning_lib prefix suffix/],
+                    acp => [qw/location status circ_lib parts/],
+                }
+        }
+    )->gather(1);
+
+    my $o_search = { shortname => uc($ou) };
+    if (!$ou || $ou eq '-') {
+        $o_search = { parent_ou => undef };
+    }
+
+    my $orgs = $_storage->request(
+        "open-ils.cstore.direct.actor.org_unit.search",
+        $o_search,
+        { flesh     => 100,
+          flesh_fields  => { aou    => [qw/children/] }
+        }
+    )->gather(1);
+
+    my @ou_ids = tree_walker($orgs, 'children', sub {shift->id}) if $orgs;
+
+    $logger->debug("Searching for holdings at orgs [".join(',', at ou_ids)."], based on $ou");
+
+    for my $cn (@{$tree->call_numbers}) {
         next unless ( $cn->deleted eq 'f' || $cn->deleted == 0 );
 
-		my $found = 0;
-		for my $c (@{$cn->copies}) {
-			next unless grep {$c->circ_lib->id == $_} @ou_ids;
-			next unless _cp_is_visible($cn, $c);
-			$found = 1;
-			last;
-		}
-		next unless $found;
+        my $found = 0;
+        for my $c (@{$cn->copies}) {
+            next unless grep {$c->circ_lib->id == $_} @ou_ids;
+            next unless _cp_is_visible($cn, $c);
+            $found = 1;
+            last;
+        }
+        next unless $found;
 
-		$holdings{$cn->label}{'owning_lib'} = $cn->owning_lib->shortname;
+        $holdings{$cn->label}{'owning_lib'} = $cn->owning_lib->shortname;
 
-		for my $cp (@{$cn->copies}) {
+        for my $cp (@{$cn->copies}) {
 
-			next unless grep { $cp->circ_lib->id == $_ } @ou_ids;
-			next unless _cp_is_visible($cn, $cp);
+            next unless grep { $cp->circ_lib->id == $_ } @ou_ids;
+            next unless _cp_is_visible($cn, $cp);
 
-			push @{$holdings{$cn->label}{'copies'}}, {
+            push @{$holdings{$cn->label}{'copies'}}, {
                 barcode => $cp->barcode,
                 status => $cp->status->name,
                 location => $cp->location->name,
                 circlib => $cp->circ_lib->shortname
             };
 
-		}
-	}
+        }
+    }
 
-	return \%holdings;
+    return \%holdings;
 }
 
 sub _cp_is_visible {
@@ -2092,48 +2092,48 @@ sub _cp_is_visible {
 }
 
 #__PACKAGE__->register_method(
-#	method    => 'new_record_holdings',
-#	api_name  => 'open-ils.supercat.record.holdings_xml.retrieve',
-#	api_level => 1,
-#	argc      => 1,
-#	stream    => 1,
-#	signature =>
-#		{ desc     => <<"		  DESC",
+#   method    => 'new_record_holdings',
+#   api_name  => 'open-ils.supercat.record.holdings_xml.retrieve',
+#   api_level => 1,
+#   argc      => 1,
+#   stream    => 1,
+#   signature =>
+#        { desc     => <<"          DESC",
 #Returns the XML representation of the requested bibliographic record's holdings
-#		  DESC
-#		  params   =>
-#		  	[
-#				{ name => 'bibId',
-#				  desc => 'An OpenILS biblio::record_entry id',
-#				  type => 'number' },
-#			],
-#		  'return' =>
-#		  	{ desc => 'Stream of bib record holdings hierarchy in XML',
-#			  type => 'string' }
-#		}
+#         DESC
+#         params   =>
+#           [
+#               { name => 'bibId',
+#                 desc => 'An OpenILS biblio::record_entry id',
+#                 type => 'number' },
+#           ],
+#         'return' =>
+#           { desc => 'Stream of bib record holdings hierarchy in XML',
+#             type => 'string' }
+#       }
 #);
 #
 
 sub new_record_holdings {
-	my $self = shift;
-	my $client = shift;
-	my $bib = shift;
-	my $ou = shift;
-	my $depth = shift;
-	my $flesh = shift;
-	my $paging = shift;
+    my $self = shift;
+    my $client = shift;
+    my $bib = shift;
+    my $ou = shift;
+    my $depth = shift;
+    my $flesh = shift;
+    my $paging = shift;
 
     $paging = [-1,0] if (!$paging or !ref($paging) or @$paging == 0);
     my $limit = $$paging[0];
     my $offset = $$paging[1] || 0;
 
-	my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
-	my $_search = OpenSRF::AppSession->create( 'open-ils.search' );
+    my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
+    my $_search = OpenSRF::AppSession->create( 'open-ils.search' );
 
-	my $o_search = { shortname => uc($ou) };
-	if (!$ou || $ou eq '-') {
-		$o_search = { parent_ou => undef };
-	}
+    my $o_search = { shortname => uc($ou) };
+    if (!$ou || $ou eq '-') {
+        $o_search = { parent_ou => undef };
+    }
 
     my $one_org = $_storage->request(
         "open-ils.cstore.direct.actor.org_unit.search",
@@ -2149,9 +2149,9 @@ sub new_record_holdings {
     )->gather(1);
 
 
-	my @ou_ids = map { $_->{id} } @$orgs;
+    my @ou_ids = map { $_->{id} } @$orgs;
 
-	$logger->info("Searching for holdings at orgs [".join(',', at ou_ids)."], based on $ou");
+    $logger->info("Searching for holdings at orgs [".join(',', at ou_ids)."], based on $ou");
 
     my %subselect = ( '-or' => [
         { owning_lib => \@ou_ids },
@@ -2222,66 +2222,66 @@ sub new_record_holdings {
         }
     }
 
-	my $cns = $_storage->request(
-		"open-ils.cstore.direct.asset.call_number.search.atomic",
-		{ record  => $bib,
+    my $cns = $_storage->request(
+        "open-ils.cstore.direct.asset.call_number.search.atomic",
+        { record  => $bib,
           deleted => 'f',
           %subselect
         },
-		{ flesh		=> 5,
-		  flesh_fields	=> {
-		  			acn	=> [qw/copies owning_lib uri_maps prefix suffix/],
-		  			auricnm	=> [qw/uri/],
-					acp	=> [qw/circ_lib location status stat_cat_entries notes parts/],
-					asce	=> [qw/stat_cat/],
-				},
+        { flesh     => 5,
+          flesh_fields  => {
+                    acn => [qw/copies owning_lib uri_maps prefix suffix/],
+                    auricnm => [qw/uri/],
+                    acp => [qw/circ_lib location status stat_cat_entries notes parts/],
+                    asce    => [qw/stat_cat/],
+                },
           ( $limit > -1 ? ( limit  => $limit  ) : () ),
           ( $offset     ? ( offset => $offset ) : () ),
           order_by  => { acn => { label_sortkey => {} } }
-		}
-	)->gather(1);
+        }
+    )->gather(1);
 
-	my ($year,$month,$day) = reverse( (localtime)[3,4,5] );
-	$year += 1900;
-	$month += 1;
+    my ($year,$month,$day) = reverse( (localtime)[3,4,5] );
+    $year += 1900;
+    $month += 1;
 
-	$client->respond("<holdings xmlns='http://open-ils.org/spec/holdings/v1'><counts>\n");
+    $client->respond("<holdings xmlns='http://open-ils.org/spec/holdings/v1'><counts>\n");
 
-	my $copy_counts = $count_req->gather(1);
-	my $staff_copy_counts = $staff_count_req->gather(1);
+    my $copy_counts = $count_req->gather(1);
+    my $staff_copy_counts = $staff_count_req->gather(1);
 
-	for my $c (@$copy_counts) {
-		$$c{transcendant} ||= 0;
-		my $out = "<count type='public'";
-		$out .= " $_='$$c{$_}'" for (qw/count available unshadow transcendant org_unit depth/);
-		$client->respond("$out/>\n")
-	}
+    for my $c (@$copy_counts) {
+        $$c{transcendant} ||= 0;
+        my $out = "<count type='public'";
+        $out .= " $_='$$c{$_}'" for (qw/count available unshadow transcendant org_unit depth/);
+        $client->respond("$out/>\n")
+    }
 
-	for my $c (@$staff_copy_counts) {
-		$$c{transcendant} ||= 0;
-		my $out = "<count type='staff'";
-		$out .= " $_='$$c{$_}'" for (qw/count available unshadow transcendant org_unit depth/);
-		$client->respond("$out/>\n")
-	}
+    for my $c (@$staff_copy_counts) {
+        $$c{transcendant} ||= 0;
+        my $out = "<count type='staff'";
+        $out .= " $_='$$c{$_}'" for (qw/count available unshadow transcendant org_unit depth/);
+        $client->respond("$out/>\n")
+    }
 
     $client->respond("</counts><volumes>\n");
     
-	for my $cn (@$cns) {
-		next unless (@{$cn->copies} > 0 or (ref($cn->uri_maps) and @{$cn->uri_maps}));
+    for my $cn (@$cns) {
+        next unless (@{$cn->copies} > 0 or (ref($cn->uri_maps) and @{$cn->uri_maps}));
 
-		# We don't want O:A:S:unAPI::acn to return the record, we've got that already
-		# In the context of BibTemplate, copies aren't necessary because we pull those
-		# in a separate call
+        # We don't want O:A:S:unAPI::acn to return the record, we've got that already
+        # In the context of BibTemplate, copies aren't necessary because we pull those
+        # in a separate call
         $client->respond(
             OpenILS::Application::SuperCat::unAPI::acn
                 ->new( $cn )
                 ->as_xml( {no_record => 1, no_copies => ($flesh ? 0 : 1)} )
         );
-	}
+    }
 
-	$client->respond("</volumes><subscriptions>\n");
+    $client->respond("</volumes><subscriptions>\n");
 
-	$logger->info("Searching for serial holdings at orgs [".join(',', at ou_ids)."], based on $ou");
+    $logger->info("Searching for serial holdings at orgs [".join(',', at ou_ids)."], based on $ou");
 
     %subselect = ( '-or' => [
         { owning_lib => \@ou_ids },
@@ -2293,848 +2293,848 @@ sub new_record_holdings {
         }
     ]);
 
-	my $ssubs = $_storage->request(
-		"open-ils.cstore.direct.serial.subscription.search.atomic",
-		{ record_entry  => $bib,
+    my $ssubs = $_storage->request(
+        "open-ils.cstore.direct.serial.subscription.search.atomic",
+        { record_entry  => $bib,
           %subselect
         },
-		{ flesh		=> 7,
-		  flesh_fields	=> {
-		  			ssub	=> [qw/distributions issuances scaps owning_lib/],
-		  			sdist	=> [qw/basic_summary supplement_summary index_summary streams holding_lib/],
-					sstr	=> [qw/items/],
-					sitem	=> [qw/notes unit/],
-					sunit	=> [qw/notes location status circ_lib stat_cat_entries call_number/],
-					acn	=> [qw/owning_lib prefix suffix/],
-				},
+        { flesh     => 7,
+          flesh_fields  => {
+                    ssub    => [qw/distributions issuances scaps owning_lib/],
+                    sdist   => [qw/basic_summary supplement_summary index_summary streams holding_lib/],
+                    sstr    => [qw/items/],
+                    sitem   => [qw/notes unit/],
+                    sunit   => [qw/notes location status circ_lib stat_cat_entries call_number/],
+                    acn => [qw/owning_lib prefix suffix/],
+                },
           ( $limit > -1 ? ( limit  => $limit  ) : () ),
           ( $offset     ? ( offset => $offset ) : () ),
           order_by  => {
-			ssub => {
-				start_date => {},
-				owning_lib => {},
-				id => {}
-			},
-			sdist => {
-				label => {},
-				owning_lib => {},
-			},
-			sunit => {
-				date_expected => {},
-			}
-		  }
-		}
-	)->gather(1);
-
-
-	for my $ssub (@$ssubs) {
-		next unless (@{$ssub->distributions} or @{$ssub->issuances} or @{$ssub->scaps});
-
-		# We don't want O:A:S:unAPI::ssub to return the record, we've got that already
-		# In the context of BibTemplate, copies aren't necessary because we pull those
-		# in a separate call
+            ssub => {
+                start_date => {},
+                owning_lib => {},
+                id => {}
+            },
+            sdist => {
+                label => {},
+                owning_lib => {},
+            },
+            sunit => {
+                date_expected => {},
+            }
+          }
+        }
+    )->gather(1);
+
+
+    for my $ssub (@$ssubs) {
+        next unless (@{$ssub->distributions} or @{$ssub->issuances} or @{$ssub->scaps});
+
+        # We don't want O:A:S:unAPI::ssub to return the record, we've got that already
+        # In the context of BibTemplate, copies aren't necessary because we pull those
+        # in a separate call
         $client->respond(
             OpenILS::Application::SuperCat::unAPI::ssub
                 ->new( $ssub )
                 ->as_xml( {no_record => 1, no_items => ($flesh ? 0 : 1)} )
         );
-	}
+    }
 
 
-	return "</subscriptions></holdings>\n";
+    return "</subscriptions></holdings>\n";
 }
 __PACKAGE__->register_method(
-	method    => 'new_record_holdings',
-	api_name  => 'open-ils.supercat.record.holdings_xml.retrieve',
-	api_level => 1,
-	argc      => 1,
-	stream    => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'new_record_holdings',
+    api_name  => 'open-ils.supercat.record.holdings_xml.retrieve',
+    api_level => 1,
+    argc      => 1,
+    stream    => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns the XML representation of the requested bibliographic record's holdings
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'bibId',
-				  desc => 'An OpenILS biblio::record_entry ID',
-				  type => 'number' },
-				{ name => 'orgUnit',
-				  desc => 'An OpenILS actor::org_unit short name that limits the scope of returned holdings',
-				  type => 'text' },
-				{ name => 'depth',
-				  desc => 'An OpenILS actor::org_unit_type depththat limits the scope of returned holdings',
-				  type => 'number' },
-				{ name => 'hideCopies',
-				  desc => 'Flag that prevents the inclusion of copies in the returned holdings',
-				  type => 'boolean' },
-				{ name => 'paging',
-				  desc => 'Arry of limit and offset for holdings paging',
-				  type => 'array' },
-			],
-		  'return' =>
-		  	{ desc => 'Stream of bib record holdings hierarchy in XML',
-			  type => 'string' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'bibId',
+                  desc => 'An OpenILS biblio::record_entry ID',
+                  type => 'number' },
+                { name => 'orgUnit',
+                  desc => 'An OpenILS actor::org_unit short name that limits the scope of returned holdings',
+                  type => 'text' },
+                { name => 'depth',
+                  desc => 'An OpenILS actor::org_unit_type depththat limits the scope of returned holdings',
+                  type => 'number' },
+                { name => 'hideCopies',
+                  desc => 'Flag that prevents the inclusion of copies in the returned holdings',
+                  type => 'boolean' },
+                { name => 'paging',
+                  desc => 'Arry of limit and offset for holdings paging',
+                  type => 'array' },
+            ],
+          'return' =>
+            { desc => 'Stream of bib record holdings hierarchy in XML',
+              type => 'string' }
+        }
 );
 
 sub isbn_holdings {
-	my $self = shift;
-	my $client = shift;
-	my $isbn = shift;
+    my $self = shift;
+    my $client = shift;
+    my $isbn = shift;
 
-	my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
+    my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
 
-	my $recs = $_storage->request(
-			'open-ils.cstore.direct.metabib.full_rec.search.atomic',
-			{ tag => { like => '02%'}, value => {like => "$isbn\%"}}
-	)->gather(1);
+    my $recs = $_storage->request(
+            'open-ils.cstore.direct.metabib.full_rec.search.atomic',
+            { tag => { like => '02%'}, value => {like => "$isbn\%"}}
+    )->gather(1);
 
-	return undef unless (@$recs);
+    return undef unless (@$recs);
 
-	return ($self->method_lookup( 'open-ils.supercat.record.holdings_xml.retrieve')->run( $recs->[0]->record ))[0];
+    return ($self->method_lookup( 'open-ils.supercat.record.holdings_xml.retrieve')->run( $recs->[0]->record ))[0];
 }
 __PACKAGE__->register_method(
-	method    => 'isbn_holdings',
-	api_name  => 'open-ils.supercat.isbn.holdings_xml.retrieve',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'isbn_holdings',
+    api_name  => 'open-ils.supercat.isbn.holdings_xml.retrieve',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns the XML representation of the requested bibliographic record's holdings
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'isbn',
-				  desc => 'An isbn',
-				  type => 'string' },
-			],
-		  'return' =>
-		  	{ desc => 'The bib record holdings hierarchy in XML',
-			  type => 'string' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'isbn',
+                  desc => 'An isbn',
+                  type => 'string' },
+            ],
+          'return' =>
+            { desc => 'The bib record holdings hierarchy in XML',
+              type => 'string' }
+        }
 );
 
 sub escape {
-	my $self = shift;
-	my $text = shift;
+    my $self = shift;
+    my $text = shift;
     return '' unless $text;
-	$text =~ s/&/&amp;/gsom;
-	$text =~ s/</&lt;/gsom;
-	$text =~ s/>/&gt;/gsom;
-	$text =~ s/"/&quot;/gsom;
-	$text =~ s/'/&apos;/gsom;
-	return $text;
+    $text =~ s/&/&amp;/gsom;
+    $text =~ s/</&lt;/gsom;
+    $text =~ s/>/&gt;/gsom;
+    $text =~ s/"/&quot;/gsom;
+    $text =~ s/'/&apos;/gsom;
+    return $text;
 }
 
 sub recent_changes {
-	my $self = shift;
-	my $client = shift;
-	my $when = shift || '1-01-01';
-	my $limit = shift;
+    my $self = shift;
+    my $client = shift;
+    my $when = shift || '1-01-01';
+    my $limit = shift;
 
-	my $type = 'biblio';
-	my $hint = 'bre';
+    my $type = 'biblio';
+    my $hint = 'bre';
 
-	if ($self->api_name =~ /authority/o) {
-		$type = 'authority';
-		$hint = 'are';
-	}
+    if ($self->api_name =~ /authority/o) {
+        $type = 'authority';
+        $hint = 'are';
+    }
 
-	my $axis = 'create_date';
-	$axis = 'edit_date' if ($self->api_name =~ /edit/o);
+    my $axis = 'create_date';
+    $axis = 'edit_date' if ($self->api_name =~ /edit/o);
 
-	my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
+    my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
 
-	return $_storage->request(
-		"open-ils.cstore.direct.$type.record_entry.id_list.atomic",
-		{ $axis => { ">" => $when }, id => { '>' => 0 }, deleted => 'f', active => 't' },
-		{ order_by => { $hint => "$axis desc" }, limit => $limit }
-	)->gather(1);
+    return $_storage->request(
+        "open-ils.cstore.direct.$type.record_entry.id_list.atomic",
+        { $axis => { ">" => $when }, id => { '>' => 0 }, deleted => 'f', active => 't' },
+        { order_by => { $hint => "$axis desc" }, limit => $limit }
+    )->gather(1);
 }
 
 for my $t ( qw/biblio authority/ ) {
-	for my $a ( qw/import edit/ ) {
-
-		__PACKAGE__->register_method(
-			method    => 'recent_changes',
-			api_name  => "open-ils.supercat.$t.record.$a.recent",
-			api_level => 1,
-			argc      => 0,
-			signature =>
-				{ desc     => "Returns a list of recently ${a}ed $t records",
-		  		  params   =>
-		  			[
-						{ name => 'when',
-				  		  desc => "Date to start looking for ${a}ed records",
-				  		  default => '1-01-01',
-				  		  type => 'string' },
-
-						{ name => 'limit',
-				  		  desc => "Maximum count to retrieve",
-				  		  type => 'number' },
-					],
-		  		  'return' =>
-		  			{ desc => "An id list of $t records",
-			  		  type => 'array' }
-				},
-		);
-	}
+    for my $a ( qw/import edit/ ) {
+
+        __PACKAGE__->register_method(
+            method    => 'recent_changes',
+            api_name  => "open-ils.supercat.$t.record.$a.recent",
+            api_level => 1,
+            argc      => 0,
+            signature =>
+                { desc     => "Returns a list of recently ${a}ed $t records",
+                  params   =>
+                    [
+                        { name => 'when',
+                          desc => "Date to start looking for ${a}ed records",
+                          default => '1-01-01',
+                          type => 'string' },
+
+                        { name => 'limit',
+                          desc => "Maximum count to retrieve",
+                          type => 'number' },
+                    ],
+                  'return' =>
+                    { desc => "An id list of $t records",
+                      type => 'array' }
+                },
+        );
+    }
 }
 
 
 sub retrieve_authority_marcxml {
-	my $self = shift;
-	my $client = shift;
-	my $rid = shift;
+    my $self = shift;
+    my $client = shift;
+    my $rid = shift;
 
-	my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
+    my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
 
-	my $record = $_storage->request( 'open-ils.cstore.direct.authority.record_entry.retrieve' => $rid )->gather(1);
-	return $U->entityize( $record->marc ) if ($record);
-	return undef;
+    my $record = $_storage->request( 'open-ils.cstore.direct.authority.record_entry.retrieve' => $rid )->gather(1);
+    return $U->entityize( $record->marc ) if ($record);
+    return undef;
 }
 
 __PACKAGE__->register_method(
-	method    => 'retrieve_authority_marcxml',
-	api_name  => 'open-ils.supercat.authority.marcxml.retrieve',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'retrieve_authority_marcxml',
+    api_name  => 'open-ils.supercat.authority.marcxml.retrieve',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns the MARCXML representation of the requested authority record
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'authorityId',
-				  desc => 'An OpenILS authority::record_entry id',
-				  type => 'number' },
-			],
-		  'return' =>
-		  	{ desc => 'The authority record in MARCXML',
-			  type => 'string' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'authorityId',
+                  desc => 'An OpenILS authority::record_entry id',
+                  type => 'number' },
+            ],
+          'return' =>
+            { desc => 'The authority record in MARCXML',
+              type => 'string' }
+        }
 );
 
 sub retrieve_record_marcxml {
-	my $self = shift;
-	my $client = shift;
-	my $rid = shift;
+    my $self = shift;
+    my $client = shift;
+    my $rid = shift;
 
-	my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
+    my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
 
-	my $record = $_storage->request( 'open-ils.cstore.direct.biblio.record_entry.retrieve' => $rid )->gather(1);
-	return $U->entityize( $record->marc ) if ($record);
-	return undef;
+    my $record = $_storage->request( 'open-ils.cstore.direct.biblio.record_entry.retrieve' => $rid )->gather(1);
+    return $U->entityize( $record->marc ) if ($record);
+    return undef;
 }
 
 __PACKAGE__->register_method(
-	method    => 'retrieve_record_marcxml',
-	api_name  => 'open-ils.supercat.record.marcxml.retrieve',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'retrieve_record_marcxml',
+    api_name  => 'open-ils.supercat.record.marcxml.retrieve',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns the MARCXML representation of the requested bibliographic record
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'bibId',
-				  desc => 'An OpenILS biblio::record_entry id',
-				  type => 'number' },
-			],
-		  'return' =>
-		  	{ desc => 'The bib record in MARCXML',
-			  type => 'string' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'bibId',
+                  desc => 'An OpenILS biblio::record_entry id',
+                  type => 'number' },
+            ],
+          'return' =>
+            { desc => 'The bib record in MARCXML',
+              type => 'string' }
+        }
 );
 
 sub retrieve_isbn_marcxml {
-	my $self = shift;
-	my $client = shift;
-	my $isbn = shift;
+    my $self = shift;
+    my $client = shift;
+    my $isbn = shift;
 
-	my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
+    my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
 
-	my $recs = $_storage->request(
-			'open-ils.cstore.direct.metabib.full_rec.search.atomic',
-			{ tag => { like => '02%'}, value => {like => "$isbn\%"}}
-	)->gather(1);
+    my $recs = $_storage->request(
+            'open-ils.cstore.direct.metabib.full_rec.search.atomic',
+            { tag => { like => '02%'}, value => {like => "$isbn\%"}}
+    )->gather(1);
 
-	return undef unless (@$recs);
+    return undef unless (@$recs);
 
-	my $record = $_storage->request( 'open-ils.cstore.direct.biblio.record_entry.retrieve' => $recs->[0]->record )->gather(1);
-	return $U->entityize( $record->marc ) if ($record);
-	return undef;
+    my $record = $_storage->request( 'open-ils.cstore.direct.biblio.record_entry.retrieve' => $recs->[0]->record )->gather(1);
+    return $U->entityize( $record->marc ) if ($record);
+    return undef;
 }
 
 __PACKAGE__->register_method(
-	method    => 'retrieve_isbn_marcxml',
-	api_name  => 'open-ils.supercat.isbn.marcxml.retrieve',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'retrieve_isbn_marcxml',
+    api_name  => 'open-ils.supercat.isbn.marcxml.retrieve',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns the MARCXML representation of the requested ISBN
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'ISBN',
-				  desc => 'An ... um ... ISBN',
-				  type => 'string' },
-			],
-		  'return' =>
-		  	{ desc => 'The bib record in MARCXML',
-			  type => 'string' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'ISBN',
+                  desc => 'An ... um ... ISBN',
+                  type => 'string' },
+            ],
+          'return' =>
+            { desc => 'The bib record in MARCXML',
+              type => 'string' }
+        }
 );
 
 sub retrieve_record_transform {
-	my $self = shift;
-	my $client = shift;
-	my $rid = shift;
+    my $self = shift;
+    my $client = shift;
+    my $rid = shift;
 
-	(my $transform = $self->api_name) =~ s/^.+record\.([^\.]+)\.retrieve$/$1/o;
+    (my $transform = $self->api_name) =~ s/^.+record\.([^\.]+)\.retrieve$/$1/o;
 
-	my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
-	#$_storage->connect;
+    my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
+    #$_storage->connect;
 
-	my $record = $_storage->request(
-		'open-ils.cstore.direct.biblio.record_entry.retrieve',
-		$rid
-	)->gather(1);
+    my $record = $_storage->request(
+        'open-ils.cstore.direct.biblio.record_entry.retrieve',
+        $rid
+    )->gather(1);
 
-	return undef unless ($record);
+    return undef unless ($record);
 
-	return $U->entityize($record_xslt{$transform}{xslt}->transform( $_parser->parse_string( $record->marc ) )->toString);
+    return $U->entityize($record_xslt{$transform}{xslt}->transform( $_parser->parse_string( $record->marc ) )->toString);
 }
 
 sub retrieve_isbn_transform {
-	my $self = shift;
-	my $client = shift;
-	my $isbn = shift;
+    my $self = shift;
+    my $client = shift;
+    my $isbn = shift;
 
-	my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
+    my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
 
-	my $recs = $_storage->request(
-			'open-ils.cstore.direct.metabib.full_rec.search.atomic',
-			{ tag => { like => '02%'}, value => {like => "$isbn\%"}}
-	)->gather(1);
+    my $recs = $_storage->request(
+            'open-ils.cstore.direct.metabib.full_rec.search.atomic',
+            { tag => { like => '02%'}, value => {like => "$isbn\%"}}
+    )->gather(1);
 
-	return undef unless (@$recs);
+    return undef unless (@$recs);
 
-	(my $transform = $self->api_name) =~ s/^.+isbn\.([^\.]+)\.retrieve$/$1/o;
+    (my $transform = $self->api_name) =~ s/^.+isbn\.([^\.]+)\.retrieve$/$1/o;
 
-	my $record = $_storage->request( 'open-ils.cstore.direct.biblio.record_entry.retrieve' => $recs->[0]->record )->gather(1);
+    my $record = $_storage->request( 'open-ils.cstore.direct.biblio.record_entry.retrieve' => $recs->[0]->record )->gather(1);
 
-	return undef unless ($record);
+    return undef unless ($record);
 
-	return $U->entityize($record_xslt{$transform}{xslt}->transform( $_parser->parse_string( $record->marc ) )->toString);
+    return $U->entityize($record_xslt{$transform}{xslt}->transform( $_parser->parse_string( $record->marc ) )->toString);
 }
 
 sub retrieve_record_objects {
-	my $self = shift;
-	my $client = shift;
-	my $ids = shift;
+    my $self = shift;
+    my $client = shift;
+    my $ids = shift;
 
-	my $type = 'biblio';
+    my $type = 'biblio';
 
-	if ($self->api_name =~ /authority/) {
-		$type = 'authority';
-	}
+    if ($self->api_name =~ /authority/) {
+        $type = 'authority';
+    }
 
-	$ids = [$ids] unless (ref $ids);
-	$ids = [grep {$_} @$ids];
+    $ids = [$ids] unless (ref $ids);
+    $ids = [grep {$_} @$ids];
 
-	return [] unless (@$ids);
+    return [] unless (@$ids);
 
-	my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
-	return $_storage->request("open-ils.cstore.direct.$type.record_entry.search.atomic" => { id => [grep {$_} @$ids] })->gather(1);
+    my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
+    return $_storage->request("open-ils.cstore.direct.$type.record_entry.search.atomic" => { id => [grep {$_} @$ids] })->gather(1);
 }
 __PACKAGE__->register_method(
-	method    => 'retrieve_record_objects',
-	api_name  => 'open-ils.supercat.record.object.retrieve',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'retrieve_record_objects',
+    api_name  => 'open-ils.supercat.record.object.retrieve',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns the Fieldmapper object representation of the requested bibliographic records
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'bibIds',
-				  desc => 'OpenILS biblio::record_entry ids',
-				  type => 'array' },
-			],
-		  'return' =>
-		  	{ desc => 'The bib records',
-			  type => 'array' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'bibIds',
+                  desc => 'OpenILS biblio::record_entry ids',
+                  type => 'array' },
+            ],
+          'return' =>
+            { desc => 'The bib records',
+              type => 'array' }
+        }
 );
 
 __PACKAGE__->register_method(
-	method    => 'retrieve_record_objects',
-	api_name  => 'open-ils.supercat.authority.object.retrieve',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'retrieve_record_objects',
+    api_name  => 'open-ils.supercat.authority.object.retrieve',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns the Fieldmapper object representation of the requested authority records
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'authIds',
-				  desc => 'OpenILS authority::record_entry ids',
-				  type => 'array' },
-			],
-		  'return' =>
-		  	{ desc => 'The authority records',
-			  type => 'array' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'authIds',
+                  desc => 'OpenILS authority::record_entry ids',
+                  type => 'array' },
+            ],
+          'return' =>
+            { desc => 'The authority records',
+              type => 'array' }
+        }
 );
 
 sub retrieve_isbn_object {
-	my $self = shift;
-	my $client = shift;
-	my $isbn = shift;
+    my $self = shift;
+    my $client = shift;
+    my $isbn = shift;
 
-	return undef unless ($isbn);
+    return undef unless ($isbn);
 
-	my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
-	my $recs = $_storage->request(
-			'open-ils.cstore.direct.metabib.full_rec.search.atomic',
-			{ tag => { like => '02%'}, value => {like => "$isbn\%"}}
-	)->gather(1);
+    my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
+    my $recs = $_storage->request(
+            'open-ils.cstore.direct.metabib.full_rec.search.atomic',
+            { tag => { like => '02%'}, value => {like => "$isbn\%"}}
+    )->gather(1);
 
-	return undef unless (@$recs);
+    return undef unless (@$recs);
 
-	return $_storage->request(
-		'open-ils.cstore.direct.biblio.record_entry.search.atomic',
-		{ id => $recs->[0]->record }
-	)->gather(1);
+    return $_storage->request(
+        'open-ils.cstore.direct.biblio.record_entry.search.atomic',
+        { id => $recs->[0]->record }
+    )->gather(1);
 }
 __PACKAGE__->register_method(
-	method    => 'retrieve_isbn_object',
-	api_name  => 'open-ils.supercat.isbn.object.retrieve',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'retrieve_isbn_object',
+    api_name  => 'open-ils.supercat.isbn.object.retrieve',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns the Fieldmapper object representation of the requested bibliographic record
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'isbn',
-				  desc => 'an ISBN',
-				  type => 'string' },
-			],
-		  'return' =>
-		  	{ desc => 'The bib record',
-			  type => 'object' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'isbn',
+                  desc => 'an ISBN',
+                  type => 'string' },
+            ],
+          'return' =>
+            { desc => 'The bib record',
+              type => 'object' }
+        }
 );
 
 
 
 sub retrieve_metarecord_mods {
-	my $self = shift;
-	my $client = shift;
-	my $rid = shift;
-
-	my $_storage = OpenSRF::AppSession->connect( 'open-ils.cstore' );
-
-	# Get the metarecord in question
-	my $mr =
-	$_storage->request(
-		'open-ils.cstore.direct.metabib.metarecord.retrieve' => $rid
-	)->gather(1);
-
-	# Now get the map of all bib records for the metarecord
-	my $recs =
-	$_storage->request(
-		'open-ils.cstore.direct.metabib.metarecord_source_map.search.atomic',
-		{metarecord => $rid}
-	)->gather(1);
-
-	$logger->debug("Adding ".scalar(@$recs)." bib record to the MODS of the metarecord");
-
-	# and retrieve the lead (master) record as MODS
-	my ($master) =
-		$self	->method_lookup('open-ils.supercat.record.mods.retrieve')
-			->run($mr->master_record);
-	my $master_mods = $_parser->parse_string($master)->documentElement;
-	$master_mods->setNamespace( "http://www.loc.gov/mods/", "mods" );
-	$master_mods->setNamespace( "http://www.loc.gov/mods/", undef, 1 );
-
-	# ... and a MODS clone to populate, with guts removed.
-	my $mods = $_parser->parse_string($master)->documentElement;
-	$mods->setNamespace( "http://www.loc.gov/mods/", "mods" ); # modsCollection element
-	$mods->setNamespace('http://www.loc.gov/mods/', undef, 1);
-	($mods) = $mods->findnodes('//mods:mods');
-	#$mods->setNamespace( "http://www.loc.gov/mods/", "mods" ); # mods element
-	$mods->removeChildNodes;
-	$mods->setNamespace('http://www.loc.gov/mods/', undef, 1);
-
-	# Add the metarecord ID as a (locally defined) info URI
-	my $recordInfo = $mods
-		->ownerDocument
-		->createElement("recordInfo");
-
-	my $recordIdentifier = $mods
-		->ownerDocument
-		->createElement("recordIdentifier");
-
-	my ($year,$month,$day) = reverse( (localtime)[3,4,5] );
-	$year += 1900;
-	$month += 1;
-
-	my $id = $mr->id;
-	$recordIdentifier->appendTextNode(
-		sprintf("tag:open-ils.org,$year-\%0.2d-\%0.2d:metabib-metarecord/$id", $month, $day)
-	);
-
-	$recordInfo->appendChild($recordIdentifier);
-	$mods->appendChild($recordInfo);
-
-	# Grab the title, author and ISBN for the master record and populate the metarecord
-	my ($title) = $master_mods->findnodes( './mods:titleInfo[not(@type)]' );
-	
-	if ($title) {
-		$title->setNamespace( "http://www.loc.gov/mods/", "mods" );
-		$title->setNamespace( "http://www.loc.gov/mods/", undef, 1 );
-		$title = $mods->ownerDocument->importNode($title);
-		$mods->appendChild($title);
-	}
-
-	my ($author) = $master_mods->findnodes( './mods:name[mods:role/mods:text[text()="creator"]]' );
-	if ($author) {
-		$author->setNamespace( "http://www.loc.gov/mods/", "mods" );
-		$author->setNamespace( "http://www.loc.gov/mods/", undef, 1 );
-		$author = $mods->ownerDocument->importNode($author);
-		$mods->appendChild($author);
-	}
-
-	my ($isbn) = $master_mods->findnodes( './mods:identifier[@type="isbn"]' );
-	if ($isbn) {
-		$isbn->setNamespace( "http://www.loc.gov/mods/", "mods" );
-		$isbn->setNamespace( "http://www.loc.gov/mods/", undef, 1 );
-		$isbn = $mods->ownerDocument->importNode($isbn);
-		$mods->appendChild($isbn);
-	}
-
-	# ... and loop over the constituent records
-	for my $map ( @$recs ) {
-
-		# get the MODS
-		my ($rec) =
-			$self	->method_lookup('open-ils.supercat.record.mods.retrieve')
-				->run($map->source);
-
-		my $part_mods = $_parser->parse_string($rec);
-		$part_mods->documentElement->setNamespace( "http://www.loc.gov/mods/", "mods" );
-		$part_mods->documentElement->setNamespace( "http://www.loc.gov/mods/", undef, 1 );
-		($part_mods) = $part_mods->findnodes('//mods:mods');
-
-		for my $node ( ($part_mods->findnodes( './mods:subject' )) ) {
-			$node->setNamespace( "http://www.loc.gov/mods/", "mods" );
-			$node->setNamespace( "http://www.loc.gov/mods/", undef, 1 );
-			$node = $mods->ownerDocument->importNode($node);
-			$mods->appendChild( $node );
-		}
-
-		my $relatedItem = $mods
-			->ownerDocument
-			->createElement("relatedItem");
-
-		$relatedItem->setAttribute( type => 'constituent' );
-
-		my $identifier = $mods
-			->ownerDocument
-			->createElement("identifier");
-
-		$identifier->setAttribute( type => 'uri' );
-
-		my $subRecordInfo = $mods
-			->ownerDocument
-			->createElement("recordInfo");
-
-		my $subRecordIdentifier = $mods
-			->ownerDocument
-			->createElement("recordIdentifier");
-
-		my $subid = $map->source;
-		$subRecordIdentifier->appendTextNode(
-			sprintf("tag:open-ils.org,$year-\%0.2d-\%0.2d:biblio-record_entry/$subid",
-				$month,
-				$day
-			)
-		);
-		$subRecordInfo->appendChild($subRecordIdentifier);
-
-		$relatedItem->appendChild( $subRecordInfo );
-
-		my ($tor) = $part_mods->findnodes( './mods:typeOfResource' );
-		$tor->setNamespace( "http://www.loc.gov/mods/", "mods" );
-		$tor->setNamespace( "http://www.loc.gov/mods/", undef, 1 ) if ($tor);
-		$tor = $mods->ownerDocument->importNode($tor) if ($tor);
-		$relatedItem->appendChild($tor) if ($tor);
-
-		if ( my ($part_isbn) = $part_mods->findnodes( './mods:identifier[@type="isbn"]' ) ) {
-			$part_isbn->setNamespace( "http://www.loc.gov/mods/", "mods" );
-			$part_isbn->setNamespace( "http://www.loc.gov/mods/", undef, 1 );
-			$part_isbn = $mods->ownerDocument->importNode($part_isbn);
-			$relatedItem->appendChild( $part_isbn );
-
-			if (!$isbn) {
-				$isbn = $mods->appendChild( $part_isbn->cloneNode(1) );
-			}
-		}
-
-		$mods->appendChild( $relatedItem );
-
-	}
-
-	$_storage->disconnect;
-
-	return $U->entityize($mods->toString);
+    my $self = shift;
+    my $client = shift;
+    my $rid = shift;
+
+    my $_storage = OpenSRF::AppSession->connect( 'open-ils.cstore' );
+
+    # Get the metarecord in question
+    my $mr =
+    $_storage->request(
+        'open-ils.cstore.direct.metabib.metarecord.retrieve' => $rid
+    )->gather(1);
+
+    # Now get the map of all bib records for the metarecord
+    my $recs =
+    $_storage->request(
+        'open-ils.cstore.direct.metabib.metarecord_source_map.search.atomic',
+        {metarecord => $rid}
+    )->gather(1);
+
+    $logger->debug("Adding ".scalar(@$recs)." bib record to the MODS of the metarecord");
+
+    # and retrieve the lead (master) record as MODS
+    my ($master) =
+        $self   ->method_lookup('open-ils.supercat.record.mods.retrieve')
+            ->run($mr->master_record);
+    my $master_mods = $_parser->parse_string($master)->documentElement;
+    $master_mods->setNamespace( "http://www.loc.gov/mods/", "mods" );
+    $master_mods->setNamespace( "http://www.loc.gov/mods/", undef, 1 );
+
+    # ... and a MODS clone to populate, with guts removed.
+    my $mods = $_parser->parse_string($master)->documentElement;
+    $mods->setNamespace( "http://www.loc.gov/mods/", "mods" ); # modsCollection element
+    $mods->setNamespace('http://www.loc.gov/mods/', undef, 1);
+    ($mods) = $mods->findnodes('//mods:mods');
+    #$mods->setNamespace( "http://www.loc.gov/mods/", "mods" ); # mods element
+    $mods->removeChildNodes;
+    $mods->setNamespace('http://www.loc.gov/mods/', undef, 1);
+
+    # Add the metarecord ID as a (locally defined) info URI
+    my $recordInfo = $mods
+        ->ownerDocument
+        ->createElement("recordInfo");
+
+    my $recordIdentifier = $mods
+        ->ownerDocument
+        ->createElement("recordIdentifier");
+
+    my ($year,$month,$day) = reverse( (localtime)[3,4,5] );
+    $year += 1900;
+    $month += 1;
+
+    my $id = $mr->id;
+    $recordIdentifier->appendTextNode(
+        sprintf("tag:open-ils.org,$year-\%0.2d-\%0.2d:metabib-metarecord/$id", $month, $day)
+    );
+
+    $recordInfo->appendChild($recordIdentifier);
+    $mods->appendChild($recordInfo);
+
+    # Grab the title, author and ISBN for the master record and populate the metarecord
+    my ($title) = $master_mods->findnodes( './mods:titleInfo[not(@type)]' );
+    
+    if ($title) {
+        $title->setNamespace( "http://www.loc.gov/mods/", "mods" );
+        $title->setNamespace( "http://www.loc.gov/mods/", undef, 1 );
+        $title = $mods->ownerDocument->importNode($title);
+        $mods->appendChild($title);
+    }
+
+    my ($author) = $master_mods->findnodes( './mods:name[mods:role/mods:text[text()="creator"]]' );
+    if ($author) {
+        $author->setNamespace( "http://www.loc.gov/mods/", "mods" );
+        $author->setNamespace( "http://www.loc.gov/mods/", undef, 1 );
+        $author = $mods->ownerDocument->importNode($author);
+        $mods->appendChild($author);
+    }
+
+    my ($isbn) = $master_mods->findnodes( './mods:identifier[@type="isbn"]' );
+    if ($isbn) {
+        $isbn->setNamespace( "http://www.loc.gov/mods/", "mods" );
+        $isbn->setNamespace( "http://www.loc.gov/mods/", undef, 1 );
+        $isbn = $mods->ownerDocument->importNode($isbn);
+        $mods->appendChild($isbn);
+    }
+
+    # ... and loop over the constituent records
+    for my $map ( @$recs ) {
+
+        # get the MODS
+        my ($rec) =
+            $self   ->method_lookup('open-ils.supercat.record.mods.retrieve')
+                ->run($map->source);
+
+        my $part_mods = $_parser->parse_string($rec);
+        $part_mods->documentElement->setNamespace( "http://www.loc.gov/mods/", "mods" );
+        $part_mods->documentElement->setNamespace( "http://www.loc.gov/mods/", undef, 1 );
+        ($part_mods) = $part_mods->findnodes('//mods:mods');
+
+        for my $node ( ($part_mods->findnodes( './mods:subject' )) ) {
+            $node->setNamespace( "http://www.loc.gov/mods/", "mods" );
+            $node->setNamespace( "http://www.loc.gov/mods/", undef, 1 );
+            $node = $mods->ownerDocument->importNode($node);
+            $mods->appendChild( $node );
+        }
+
+        my $relatedItem = $mods
+            ->ownerDocument
+            ->createElement("relatedItem");
+
+        $relatedItem->setAttribute( type => 'constituent' );
+
+        my $identifier = $mods
+            ->ownerDocument
+            ->createElement("identifier");
+
+        $identifier->setAttribute( type => 'uri' );
+
+        my $subRecordInfo = $mods
+            ->ownerDocument
+            ->createElement("recordInfo");
+
+        my $subRecordIdentifier = $mods
+            ->ownerDocument
+            ->createElement("recordIdentifier");
+
+        my $subid = $map->source;
+        $subRecordIdentifier->appendTextNode(
+            sprintf("tag:open-ils.org,$year-\%0.2d-\%0.2d:biblio-record_entry/$subid",
+                $month,
+                $day
+            )
+        );
+        $subRecordInfo->appendChild($subRecordIdentifier);
+
+        $relatedItem->appendChild( $subRecordInfo );
+
+        my ($tor) = $part_mods->findnodes( './mods:typeOfResource' );
+        $tor->setNamespace( "http://www.loc.gov/mods/", "mods" );
+        $tor->setNamespace( "http://www.loc.gov/mods/", undef, 1 ) if ($tor);
+        $tor = $mods->ownerDocument->importNode($tor) if ($tor);
+        $relatedItem->appendChild($tor) if ($tor);
+
+        if ( my ($part_isbn) = $part_mods->findnodes( './mods:identifier[@type="isbn"]' ) ) {
+            $part_isbn->setNamespace( "http://www.loc.gov/mods/", "mods" );
+            $part_isbn->setNamespace( "http://www.loc.gov/mods/", undef, 1 );
+            $part_isbn = $mods->ownerDocument->importNode($part_isbn);
+            $relatedItem->appendChild( $part_isbn );
+
+            if (!$isbn) {
+                $isbn = $mods->appendChild( $part_isbn->cloneNode(1) );
+            }
+        }
+
+        $mods->appendChild( $relatedItem );
+
+    }
+
+    $_storage->disconnect;
+
+    return $U->entityize($mods->toString);
 
 }
 __PACKAGE__->register_method(
-	method    => 'retrieve_metarecord_mods',
-	api_name  => 'open-ils.supercat.metarecord.mods.retrieve',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'retrieve_metarecord_mods',
+    api_name  => 'open-ils.supercat.metarecord.mods.retrieve',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns the MODS representation of the requested metarecord
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'metarecordId',
-				  desc => 'An OpenILS metabib::metarecord id',
-				  type => 'number' },
-			],
-		  'return' =>
-		  	{ desc => 'The metarecord in MODS',
-			  type => 'string' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'metarecordId',
+                  desc => 'An OpenILS metabib::metarecord id',
+                  type => 'number' },
+            ],
+          'return' =>
+            { desc => 'The metarecord in MODS',
+              type => 'string' }
+        }
 );
 
 sub list_metarecord_formats {
-	my @list = (
-		{ mods =>
-			{ namespace_uri	  => 'http://www.loc.gov/mods/',
-			  docs		  => 'http://www.loc.gov/mods/',
-			  schema_location => 'http://www.loc.gov/standards/mods/mods.xsd',
-			}
-		}
-	);
-
-	for my $type ( keys %metarecord_xslt ) {
-		push @list,
-			{ $type => 
-				{ namespace_uri	  => $metarecord_xslt{$type}{namespace_uri},
-				  docs		  => $metarecord_xslt{$type}{docs},
-				  schema_location => $metarecord_xslt{$type}{schema_location},
-				}
-			};
-	}
-
-	return \@list;
+    my @list = (
+        { mods =>
+            { namespace_uri   => 'http://www.loc.gov/mods/',
+              docs        => 'http://www.loc.gov/mods/',
+              schema_location => 'http://www.loc.gov/standards/mods/mods.xsd',
+            }
+        }
+    );
+
+    for my $type ( keys %metarecord_xslt ) {
+        push @list,
+            { $type => 
+                { namespace_uri   => $metarecord_xslt{$type}{namespace_uri},
+                  docs        => $metarecord_xslt{$type}{docs},
+                  schema_location => $metarecord_xslt{$type}{schema_location},
+                }
+            };
+    }
+
+    return \@list;
 }
 __PACKAGE__->register_method(
-	method    => 'list_metarecord_formats',
-	api_name  => 'open-ils.supercat.metarecord.formats',
-	api_level => 1,
-	argc      => 0,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'list_metarecord_formats',
+    api_name  => 'open-ils.supercat.metarecord.formats',
+    api_level => 1,
+    argc      => 0,
+    signature =>
+        { desc     => <<"          DESC",
 Returns the list of valid metarecord formats that supercat understands.
-		  DESC
-		  'return' =>
-		  	{ desc => 'The format list',
-			  type => 'array' }
-		}
+          DESC
+          'return' =>
+            { desc => 'The format list',
+              type => 'array' }
+        }
 );
 
 
 sub list_authority_formats {
-	my @list = (
-		{ marcxml =>
-			{ namespace_uri	  => 'http://www.loc.gov/MARC21/slim',
-			  docs		  => 'http://www.loc.gov/marcxml/',
-			  schema_location => 'http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd',
-			},
-		  marc21 => { docs => 'http://www.loc.gov/marc/' }
-		}
-	);
-
-#	for my $type ( keys %record_xslt ) {
-#		push @list,
-#			{ $type => 
-#				{ namespace_uri	  => $record_xslt{$type}{namespace_uri},
-#				  docs		  => $record_xslt{$type}{docs},
-#				  schema_location => $record_xslt{$type}{schema_location},
-#				}
-#			};
-#	}
+    my @list = (
+        { marcxml =>
+            { namespace_uri   => 'http://www.loc.gov/MARC21/slim',
+              docs        => 'http://www.loc.gov/marcxml/',
+              schema_location => 'http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd',
+            },
+          marc21 => { docs => 'http://www.loc.gov/marc/' }
+        }
+    );
+
+#   for my $type ( keys %record_xslt ) {
+#       push @list,
+#           { $type => 
+#               { namespace_uri   => $record_xslt{$type}{namespace_uri},
+#                 docs        => $record_xslt{$type}{docs},
+#                 schema_location => $record_xslt{$type}{schema_location},
+#               }
+#           };
+#   }
 #
-	return \@list;
+    return \@list;
 }
 __PACKAGE__->register_method(
-	method    => 'list_authority_formats',
-	api_name  => 'open-ils.supercat.authority.formats',
-	api_level => 1,
-	argc      => 0,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'list_authority_formats',
+    api_name  => 'open-ils.supercat.authority.formats',
+    api_level => 1,
+    argc      => 0,
+    signature =>
+        { desc     => <<"          DESC",
 Returns the list of valid authority formats that supercat understands.
-		  DESC
-		  'return' =>
-		  	{ desc => 'The format list',
-			  type => 'array' }
-		}
+          DESC
+          'return' =>
+            { desc => 'The format list',
+              type => 'array' }
+        }
 );
 
 sub list_record_formats {
-	my @list = (
-		{ marcxml =>
-			{ namespace_uri	  => 'http://www.loc.gov/MARC21/slim',
-			  docs		  => 'http://www.loc.gov/marcxml/',
-			  schema_location => 'http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd',
-			},
-		},
-		{ marc21 => { docs => 'http://www.loc.gov/marc/' } }
-	);
-
-	for my $type ( keys %record_xslt ) {
-		push @list,
-			{ $type => 
-				{ namespace_uri	  => $record_xslt{$type}{namespace_uri},
-				  docs		  => $record_xslt{$type}{docs},
-				  schema_location => $record_xslt{$type}{schema_location},
-				}
-			};
-	}
-
-	return \@list;
+    my @list = (
+        { marcxml =>
+            { namespace_uri   => 'http://www.loc.gov/MARC21/slim',
+              docs        => 'http://www.loc.gov/marcxml/',
+              schema_location => 'http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd',
+            },
+        },
+        { marc21 => { docs => 'http://www.loc.gov/marc/' } }
+    );
+
+    for my $type ( keys %record_xslt ) {
+        push @list,
+            { $type => 
+                { namespace_uri   => $record_xslt{$type}{namespace_uri},
+                  docs        => $record_xslt{$type}{docs},
+                  schema_location => $record_xslt{$type}{schema_location},
+                }
+            };
+    }
+
+    return \@list;
 }
 __PACKAGE__->register_method(
-	method    => 'list_record_formats',
-	api_name  => 'open-ils.supercat.record.formats',
-	api_level => 1,
-	argc      => 0,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'list_record_formats',
+    api_name  => 'open-ils.supercat.record.formats',
+    api_level => 1,
+    argc      => 0,
+    signature =>
+        { desc     => <<"          DESC",
 Returns the list of valid record formats that supercat understands.
-		  DESC
-		  'return' =>
-		  	{ desc => 'The format list',
-			  type => 'array' }
-		}
+          DESC
+          'return' =>
+            { desc => 'The format list',
+              type => 'array' }
+        }
 );
 __PACKAGE__->register_method(
-	method    => 'list_record_formats',
-	api_name  => 'open-ils.supercat.isbn.formats',
-	api_level => 1,
-	argc      => 0,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'list_record_formats',
+    api_name  => 'open-ils.supercat.isbn.formats',
+    api_level => 1,
+    argc      => 0,
+    signature =>
+        { desc     => <<"          DESC",
 Returns the list of valid record formats that supercat understands.
-		  DESC
-		  'return' =>
-		  	{ desc => 'The format list',
-			  type => 'array' }
-		}
+          DESC
+          'return' =>
+            { desc => 'The format list',
+              type => 'array' }
+        }
 );
 
 
 sub oISBN {
-	my $self = shift;
-	my $client = shift;
-	my $isbn = shift;
+    my $self = shift;
+    my $client = shift;
+    my $isbn = shift;
 
-	$isbn =~ s/-//gso;
+    $isbn =~ s/-//gso;
 
-	throw OpenSRF::EX::InvalidArg ('I need an ISBN please')
-		unless (length($isbn) >= 10);
+    throw OpenSRF::EX::InvalidArg ('I need an ISBN please')
+        unless (length($isbn) >= 10);
 
-	my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
+    my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
 
-	# Create a storage session, since we'll be making muliple requests.
-	$_storage->connect;
+    # Create a storage session, since we'll be making muliple requests.
+    $_storage->connect;
 
-	# Find the record that has that ISBN.
-	my $bibrec = $_storage->request(
-		'open-ils.cstore.direct.metabib.full_rec.search.atomic',
-		{ tag => '020', subfield => 'a', value => { like => lc($isbn).'%'} }
-	)->gather(1);
+    # Find the record that has that ISBN.
+    my $bibrec = $_storage->request(
+        'open-ils.cstore.direct.metabib.full_rec.search.atomic',
+        { tag => '020', subfield => 'a', value => { like => lc($isbn).'%'} }
+    )->gather(1);
 
-	# Go away if we don't have one.
-	return {} unless (@$bibrec);
+    # Go away if we don't have one.
+    return {} unless (@$bibrec);
 
-	# Find the metarecord for that bib record.
-	my $mr = $_storage->request(
-		'open-ils.cstore.direct.metabib.metarecord_source_map.search.atomic',
-		{source => $bibrec->[0]->record}
-	)->gather(1);
+    # Find the metarecord for that bib record.
+    my $mr = $_storage->request(
+        'open-ils.cstore.direct.metabib.metarecord_source_map.search.atomic',
+        {source => $bibrec->[0]->record}
+    )->gather(1);
 
-	# Find the other records for that metarecord.
-	my $records = $_storage->request(
-		'open-ils.cstore.direct.metabib.metarecord_source_map.search.atomic',
-		{metarecord => $mr->[0]->metarecord}
-	)->gather(1);
+    # Find the other records for that metarecord.
+    my $records = $_storage->request(
+        'open-ils.cstore.direct.metabib.metarecord_source_map.search.atomic',
+        {metarecord => $mr->[0]->metarecord}
+    )->gather(1);
 
-	# Just to be safe.  There's currently no unique constraint on sources...
-	my %unique_recs = map { ($_->source, 1) } @$records;
-	my @rec_list = sort keys %unique_recs;
+    # Just to be safe.  There's currently no unique constraint on sources...
+    my %unique_recs = map { ($_->source, 1) } @$records;
+    my @rec_list = sort keys %unique_recs;
 
-	# And now fetch the ISBNs for thos records.
-	my $recs = [];
-	push @$recs,
-		$_storage->request(
-			'open-ils.cstore.direct.metabib.full_rec.search',
-			{ tag => '020', subfield => 'a', record => $_ }
-		)->gather(1) for (@rec_list);
+    # And now fetch the ISBNs for thos records.
+    my $recs = [];
+    push @$recs,
+        $_storage->request(
+            'open-ils.cstore.direct.metabib.full_rec.search',
+            { tag => '020', subfield => 'a', record => $_ }
+        )->gather(1) for (@rec_list);
 
-	# We're done with the storage server session.
-	$_storage->disconnect;
+    # We're done with the storage server session.
+    $_storage->disconnect;
 
-	# Return the oISBN data structure.  This will be XMLized at a higher layer.
-	return
-		{ metarecord => $mr->[0]->metarecord,
-		  record_list => { map { $_ ? ($_->record, $_->value) : () } @$recs } };
+    # Return the oISBN data structure.  This will be XMLized at a higher layer.
+    return
+        { metarecord => $mr->[0]->metarecord,
+          record_list => { map { $_ ? ($_->record, $_->value) : () } @$recs } };
 
 }
 __PACKAGE__->register_method(
-	method    => 'oISBN',
-	api_name  => 'open-ils.supercat.oisbn',
-	api_level => 1,
-	argc      => 1,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'oISBN',
+    api_name  => 'open-ils.supercat.oisbn',
+    api_level => 1,
+    argc      => 1,
+    signature =>
+        { desc     => <<"          DESC",
 Returns the ISBN list for the metarecord of the requested isbn
-		  DESC
-		  params   =>
-		  	[
-				{ name => 'isbn',
-				  desc => 'An ISBN.  Duh.',
-				  type => 'string' },
-			],
-		  'return' =>
-		  	{ desc => 'record to isbn map',
-			  type => 'object' }
-		}
+          DESC
+          params   =>
+            [
+                { name => 'isbn',
+                  desc => 'An ISBN.  Duh.',
+                  type => 'string' },
+            ],
+          'return' =>
+            { desc => 'record to isbn map',
+              type => 'object' }
+        }
 );
 
 sub return_bib_search_aliases {
     my %aliases;
 
-	my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
+    my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
 
-	my $cmsa = $_storage->request(
-		'open-ils.cstore.direct.config.metabib_search_alias.search.atomic',
-		{ alias => { '!=' => undef } }
-	)->gather(1);
+    my $cmsa = $_storage->request(
+        'open-ils.cstore.direct.config.metabib_search_alias.search.atomic',
+        { alias => { '!=' => undef } }
+    )->gather(1);
 
     foreach (@$cmsa) {
         if ($_->alias =~ /\./) {
@@ -3153,19 +3153,19 @@ sub return_bib_search_aliases {
 }
 
 __PACKAGE__->register_method(
-	method    => 'return_bib_search_aliases',
-	api_name  => 'open-ils.supercat.biblio.search_aliases',
-	api_level => 1,
-	argc      => 0,
-	signature =>
-		{ desc     => <<"		  DESC",
+    method    => 'return_bib_search_aliases',
+    api_name  => 'open-ils.supercat.biblio.search_aliases',
+    api_level => 1,
+    argc      => 0,
+    signature =>
+        { desc     => <<"          DESC",
 Returns the set of qualified search aliases in the system
-		  DESC
-		  params   => [ ],
-		  'return' =>
-		  	{ desc => 'Hash of qualified search aliases',
-			  type => 'object' }
-		}
+          DESC
+          params   => [ ],
+          'return' =>
+            { desc => 'Hash of qualified search aliases',
+              type => 'object' }
+        }
 );
 
 
@@ -3412,7 +3412,7 @@ sub as_xml {
     $xml .= 'textual_holdings="' . $self->escape( $self->obj->textual_holdings ) . '">';
     $xml .= "\n";
 
-	$xml .= OpenILS::Application::SuperCat::unAPI->new( $self->obj->distribution )->as_xml({ %$args, no_summaries=>1 }) if (!$args->{no_distribution});
+    $xml .= OpenILS::Application::SuperCat::unAPI->new( $self->obj->distribution )->as_xml({ %$args, no_summaries=>1 }) if (!$args->{no_distribution});
 
     $xml .= "    </serial_summary>\n";
 
@@ -3481,7 +3481,7 @@ sub as_xml {
     $xml .= 'name="'.$self->escape( $self->obj->holding_lib->name ) .'"/>';
     $xml .= "\n";
 
-	$xml .= OpenILS::Application::SuperCat::unAPI->new( $self->obj->subscription )->as_xml({ %$args, no_distributions=>1 }) if (!$args->{no_subscription});
+    $xml .= OpenILS::Application::SuperCat::unAPI->new( $self->obj->subscription )->as_xml({ %$args, no_distributions=>1 }) if (!$args->{no_subscription});
 
     if (!$args->{no_record} && $self->obj->record_entry) {
         my $rec_tag = "tag:open-ils.org:serial-record_entry/".$self->obj->record_entry->id ;
@@ -3525,9 +3525,9 @@ sub as_xml {
         }
     }
 
-	#XXX routing_list_user's?
+    #XXX routing_list_user's?
 
-	$xml .= OpenILS::Application::SuperCat::unAPI->new( $self->obj->distribution )->as_xml({ %$args, no_streams=>1 }) if (!$args->{no_distribution});
+    $xml .= OpenILS::Application::SuperCat::unAPI->new( $self->obj->distribution )->as_xml({ %$args, no_streams=>1 }) if (!$args->{no_distribution});
 
     $xml .= "    </stream>\n";
 
@@ -3547,29 +3547,29 @@ sub as_xml {
     $xml .= 'date_expected="' . $self->escape( $self->obj->date_expected ) . '"';
     $xml .= ' date_received="' . $self->escape( $self->obj->date_received ) .'"'if ($self->obj->date_received);
 
-	if ($args->{no_issuance}) {
-		my $siss = ref($self->obj->issuance) ? $self->obj->issuance->id : $self->obj->issuance;
-	    $xml .= ' issuance="tag:open-ils.org:serial-issuance/' . $siss . '"';
-	}
+    if ($args->{no_issuance}) {
+        my $siss = ref($self->obj->issuance) ? $self->obj->issuance->id : $self->obj->issuance;
+        $xml .= ' issuance="tag:open-ils.org:serial-issuance/' . $siss . '"';
+    }
 
     $xml .= ">\n";
 
-	if (ref($self->obj->notes) && $self->obj->notes) {
-		$xml .= "        <notes>\n";
-		for my $note ( @{$self->obj->notes} ) {
-			next unless ( $note->pub eq 't' );
-			$xml .= sprintf('        <note date="%s" title="%s">%s</note>',$note->create_date, $self->escape($note->title), $self->escape($note->value));
-			$xml .= "\n";
-		}
-		$xml .= "        </notes>\n";
+    if (ref($self->obj->notes) && $self->obj->notes) {
+        $xml .= "        <notes>\n";
+        for my $note ( @{$self->obj->notes} ) {
+            next unless ( $note->pub eq 't' );
+            $xml .= sprintf('        <note date="%s" title="%s">%s</note>',$note->create_date, $self->escape($note->title), $self->escape($note->value));
+            $xml .= "\n";
+        }
+        $xml .= "        </notes>\n";
     } else {
         $xml .= "      <notes/>\n";
-	}
+    }
 
-	$xml .= OpenILS::Application::SuperCat::unAPI->new( $self->obj->issuance )->as_xml({ %$args, no_items=>1 }) if (!$args->{no_issuance});
-	$xml .= OpenILS::Application::SuperCat::unAPI->new( $self->obj->stream )->as_xml({ %$args, no_items=>1 }) if (!$args->{no_stream});
-	$xml .= OpenILS::Application::SuperCat::unAPI->new( $self->obj->unit )->as_xml({ %$args, no_items=>1, no_volumes=>1 }) if ($self->obj->unit && !$args->{no_unit});
-	$xml .= OpenILS::Application::SuperCat::unAPI->new( $self->obj->uri )->as_xml({ %$args, no_items=>1, no_volumes=>1 }) if ($self->obj->uri && !$args->{no_uri});
+    $xml .= OpenILS::Application::SuperCat::unAPI->new( $self->obj->issuance )->as_xml({ %$args, no_items=>1 }) if (!$args->{no_issuance});
+    $xml .= OpenILS::Application::SuperCat::unAPI->new( $self->obj->stream )->as_xml({ %$args, no_items=>1 }) if (!$args->{no_stream});
+    $xml .= OpenILS::Application::SuperCat::unAPI->new( $self->obj->unit )->as_xml({ %$args, no_items=>1, no_volumes=>1 }) if ($self->obj->unit && !$args->{no_unit});
+    $xml .= OpenILS::Application::SuperCat::unAPI->new( $self->obj->uri )->as_xml({ %$args, no_items=>1, no_volumes=>1 }) if ($self->obj->uri && !$args->{no_uri});
 
     $xml .= "    </serial_item>\n";
 
@@ -3589,7 +3589,7 @@ sub as_xml {
     $xml .= $_ . '="' . $self->escape( $self->obj->$_  ) . '" ' for (qw/
         create_date edit_date copy_number circulate deposit ref holdable deleted
         deposit_amount price barcode circ_modifier circ_as_type opac_visible cost
-	status_changed_time floating mint_condition detailed_contents sort_key summary_contents
+    status_changed_time floating mint_condition detailed_contents sort_key summary_contents
     /);
 
     $xml .= ">\n";
@@ -3604,26 +3604,26 @@ sub as_xml {
     $xml .= 'name="'.$self->escape( $self->obj->circ_lib->name ) .'"/>';
     $xml .= "\n";
 
-	$xml .= "        <copy_notes>\n";
-	if (ref($self->obj->notes) && $self->obj->notes) {
-		for my $note ( @{$self->obj->notes} ) {
-			next unless ( $note->pub eq 't' );
-			$xml .= sprintf('        <copy_note date="%s" title="%s">%s</copy_note>',$note->create_date, $self->escape($note->title), $self->escape($note->value));
-			$xml .= "\n";
-		}
-	}
+    $xml .= "        <copy_notes>\n";
+    if (ref($self->obj->notes) && $self->obj->notes) {
+        for my $note ( @{$self->obj->notes} ) {
+            next unless ( $note->pub eq 't' );
+            $xml .= sprintf('        <copy_note date="%s" title="%s">%s</copy_note>',$note->create_date, $self->escape($note->title), $self->escape($note->value));
+            $xml .= "\n";
+        }
+    }
 
-	$xml .= "        </copy_notes>\n";
+    $xml .= "        </copy_notes>\n";
     $xml .= "        <statcats>\n";
 
-	if (ref($self->obj->stat_cat_entries) && $self->obj->stat_cat_entries) {
-		for my $sce ( @{$self->obj->stat_cat_entries} ) {
-			next unless ( $sce->stat_cat->opac_visible eq 't' );
-			$xml .= sprintf('          <statcat name="%s">%s</statcat>',$self->escape($sce->stat_cat->name) ,$self->escape($sce->value));
-			$xml .= "\n";
-		}
-	}
-	$xml .= "        </statcats>\n";
+    if (ref($self->obj->stat_cat_entries) && $self->obj->stat_cat_entries) {
+        for my $sce ( @{$self->obj->stat_cat_entries} ) {
+            next unless ( $sce->stat_cat->opac_visible eq 't' );
+            $xml .= sprintf('          <statcat name="%s">%s</statcat>',$self->escape($sce->stat_cat->name) ,$self->escape($sce->value));
+            $xml .= "\n";
+        }
+    }
+    $xml .= "        </statcats>\n";
 
     unless ($args->{no_volume}) {
         if (ref($self->obj->call_number)) {
@@ -3652,10 +3652,10 @@ sub as_xml {
 
     $xml .= $_ . '="' . $self->escape( $self->obj->$_  ) . '" ' for (qw/
         create_date type active pattern_code enum_1 enum_2 enum_3 enum_4
-		enum_5 enum_6 chron_1 chron_2 chron_3 chron_4 chron_5 start_date end_date
+        enum_5 enum_6 chron_1 chron_2 chron_3 chron_4 chron_5 start_date end_date
     /);
     $xml .= ">\n";
-	$xml .= OpenILS::Application::SuperCat::unAPI->new( $self->obj->subscription )->as_xml({ %$args, no_captions_and_patterns=>1 }) if (!$args->{no_subscription});
+    $xml .= OpenILS::Application::SuperCat::unAPI->new( $self->obj->subscription )->as_xml({ %$args, no_captions_and_patterns=>1 }) if (!$args->{no_subscription});
     $xml .= "      </caption_and_pattern>\n";
 
     return $xml;
@@ -3672,7 +3672,7 @@ sub as_xml {
         'id="tag:open-ils.org:serial-issuance/' . $self->obj->id . '" ';
 
     $xml .= $_ . '="' . $self->escape( $self->obj->$_  ) . '" '
-		for (qw/create_date edit_date label date_published holding_code holding_type holding_link_id/);
+        for (qw/create_date edit_date label date_published holding_code holding_type holding_link_id/);
 
     $xml .= ">\n";
 
@@ -3692,7 +3692,7 @@ sub as_xml {
         }
     }
 
-	$xml .= OpenILS::Application::SuperCat::unAPI->new( $self->obj->subscription )->as_xml({ %$args, no_issuances=>1 }) if (!$args->{no_subscription});
+    $xml .= OpenILS::Application::SuperCat::unAPI->new( $self->obj->subscription )->as_xml({ %$args, no_issuances=>1 }) if (!$args->{no_subscription});
     $xml .= "      </issuance>\n";
 
     return $xml;
@@ -3725,35 +3725,35 @@ sub as_xml {
     $xml .= 'name="'.$self->escape( $self->obj->circ_lib->name ) .'" opac_visible="'.$self->obj->circ_lib->opac_visible.'"/>';
     $xml .= "\n";
 
-	$xml .= "        <monograph_parts>\n";
-	if (ref($self->obj->parts) && $self->obj->parts) {
-		for my $part ( @{$self->obj->parts} ) {
-			$xml .= sprintf('        <monograph_part record="%s" sortkey="%s">%s</monograph_part>',$part->record, $self->escape($part->label_sortkey), $self->escape($part->label));
-			$xml .= "\n";
-		}
-	}
-
-	$xml .= "        </monograph_parts>\n";
-	$xml .= "        <copy_notes>\n";
-	if (ref($self->obj->notes) && $self->obj->notes) {
-		for my $note ( @{$self->obj->notes} ) {
-			next unless ( $note->pub eq 't' );
-			$xml .= sprintf('        <copy_note date="%s" title="%s">%s</copy_note>',$note->create_date, $self->escape($note->title), $self->escape($note->value));
-			$xml .= "\n";
-		}
-	}
-
-	$xml .= "        </copy_notes>\n";
+    $xml .= "        <monograph_parts>\n";
+    if (ref($self->obj->parts) && $self->obj->parts) {
+        for my $part ( @{$self->obj->parts} ) {
+            $xml .= sprintf('        <monograph_part record="%s" sortkey="%s">%s</monograph_part>',$part->record, $self->escape($part->label_sortkey), $self->escape($part->label));
+            $xml .= "\n";
+        }
+    }
+
+    $xml .= "        </monograph_parts>\n";
+    $xml .= "        <copy_notes>\n";
+    if (ref($self->obj->notes) && $self->obj->notes) {
+        for my $note ( @{$self->obj->notes} ) {
+            next unless ( $note->pub eq 't' );
+            $xml .= sprintf('        <copy_note date="%s" title="%s">%s</copy_note>',$note->create_date, $self->escape($note->title), $self->escape($note->value));
+            $xml .= "\n";
+        }
+    }
+
+    $xml .= "        </copy_notes>\n";
     $xml .= "        <statcats>\n";
 
-	if (ref($self->obj->stat_cat_entries) && $self->obj->stat_cat_entries) {
-		for my $sce ( @{$self->obj->stat_cat_entries} ) {
-			next unless ( $sce->stat_cat->opac_visible eq 't' );
-			$xml .= sprintf('          <statcat name="%s">%s</statcat>',$self->escape($sce->stat_cat->name) ,$self->escape($sce->value));
-			$xml .= "\n";
-		}
-	}
-	$xml .= "        </statcats>\n";
+    if (ref($self->obj->stat_cat_entries) && $self->obj->stat_cat_entries) {
+        for my $sce ( @{$self->obj->stat_cat_entries} ) {
+            next unless ( $sce->stat_cat->opac_visible eq 't' );
+            $xml .= sprintf('          <statcat name="%s">%s</statcat>',$self->escape($sce->stat_cat->name) ,$self->escape($sce->value));
+            $xml .= "\n";
+        }
+    }
+    $xml .= "        </statcats>\n";
 
     unless ($args->{no_volume}) {
         if (ref($self->obj->call_number)) {
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm
index 093e551..7c9127a 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm
@@ -459,7 +459,7 @@ sub run_TT {
         my $key = ($error) ? 'error_output' : 'template_output';
         $env->{EventProcessor}->update_state( $state, { $key => $t_o->id } );
     }
-	
+    
     return $output;
 }
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/AstCall.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/AstCall.pm
index 7986d2c..dea456b 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/AstCall.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor/AstCall.pm
@@ -302,8 +302,8 @@ sub cleanup {
 }
 
 sub retrieve {
-	$logger->info("retrieve() not implemented. how'd we get here?"); # XXX
-	return;
+    $logger->info("retrieve() not implemented. how'd we get here?"); # XXX
+    return;
 }
 
 #sub retrieve {
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm
index ad92caf..0f0976b 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm
@@ -1184,7 +1184,7 @@ sub import_record_list_impl {
     # see if we need to mark any queues as complete
     for my $q_id (keys %queues) {
 
-    	my $e = new_editor(xact => 1);
+        my $e = new_editor(xact => 1);
         my $remaining = $e->$search_func(
             [{queue => $q_id, import_time => undef}, {limit =>1}], {idlist => 1});
 
@@ -1197,7 +1197,7 @@ sub import_record_list_impl {
                 next;
             }
         } 
-    	$e->rollback;
+        $e->rollback;
     }
 
     # import the copies
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Const.pm b/Open-ILS/src/perlmods/lib/OpenILS/Const.pm
index f86a801..07db6ed 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Const.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Const.pm
@@ -35,7 +35,7 @@ econst OILS_COPY_STATUS_IN_PROCESS    => 5;
 econst OILS_COPY_STATUS_IN_TRANSIT    => 6;
 econst OILS_COPY_STATUS_RESHELVING    => 7;
 econst OILS_COPY_STATUS_ON_HOLDS_SHELF=> 8;
-econst OILS_COPY_STATUS_ON_ORDER	     => 9;
+econst OILS_COPY_STATUS_ON_ORDER         => 9;
 econst OILS_COPY_STATUS_ILL           => 10;
 econst OILS_COPY_STATUS_CATALOGING    => 11;
 econst OILS_COPY_STATUS_RESERVES      => 12;
@@ -50,7 +50,7 @@ econst OILS_COPY_STATUS_ON_RESV_SHELF => 15;
 econst OILS_PRECAT_COPY_FINE_LEVEL    => 2;
 econst OILS_PRECAT_COPY_LOAN_DURATION => 2;
 econst OILS_PRECAT_CALL_NUMBER        => -1;
-econst OILS_PRECAT_RECORD			     => -1;
+econst OILS_PRECAT_RECORD                => -1;
 
 
 # ---------------------------------------------------------------------
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Event.pm b/Open-ILS/src/perlmods/lib/OpenILS/Event.pm
index 805859d..b147f84 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Event.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Event.pm
@@ -10,9 +10,9 @@ my $logger = "OpenSRF::Utils::Logger";
 # Returns a new Event data hash (not a blessed object)
 # The first param is the event name
 # Following the first param is an optional hash of params:
-#		perm => the name of the permission error for permimssion errors
-#		permloc => the location of the permission error for permission errors
-#		payload => the payload to be returned on successfull events
+#       perm => the name of the permission error for permimssion errors
+#       permloc => the location of the permission error for permission errors
+#       payload => the payload to be returned on successfull events
 
 
 my $events = undef;
@@ -52,39 +52,39 @@ sub new {
 }
 
 sub _load_events {
-	my $settings_client = OpenSRF::Utils::SettingsClient->new();
-	my $eventsxml =  $settings_client->config_value( "ils_events" );
-
-	if(!$eventsxml) { 
-		throw OpenSRF::EX ("No ils_events file found in settings config"); 
-	}
-
-	$logger->info("Loading events xml file $eventsxml");
-
-	my $doc = XML::LibXML->new->parse_file($eventsxml);
-
-	my @nodes = $doc->documentElement->findnodes('//event');
-	for my $node (@nodes) {
-		$events->{$node->getAttribute('textcode')} = 
-			$node->getAttribute('code');
-	}
-
-	$descs = {};
-	my @desc = $doc->documentElement->findnodes('//desc');
-	for my $d (@desc) {
-		my $lang = $d->getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang');
-		my $code = $d->parentNode->getAttribute('code');
-		unless ($descs && $lang && exists $descs->{$lang}) {
-			$descs->{$lang} = {};
-			if (!$descs) {
-				$logger->error("No error description nodes found in $eventsxml.");
-			}
-			if (!$lang) {
-				$logger->error("No xml:lang attribute found for node in $eventsxml.");
-			}
-		}
-		$descs->{$lang}->{$code} = $d->textContent;
-	}
+    my $settings_client = OpenSRF::Utils::SettingsClient->new();
+    my $eventsxml =  $settings_client->config_value( "ils_events" );
+
+    if(!$eventsxml) { 
+        throw OpenSRF::EX ("No ils_events file found in settings config"); 
+    }
+
+    $logger->info("Loading events xml file $eventsxml");
+
+    my $doc = XML::LibXML->new->parse_file($eventsxml);
+
+    my @nodes = $doc->documentElement->findnodes('//event');
+    for my $node (@nodes) {
+        $events->{$node->getAttribute('textcode')} = 
+            $node->getAttribute('code');
+    }
+
+    $descs = {};
+    my @desc = $doc->documentElement->findnodes('//desc');
+    for my $d (@desc) {
+        my $lang = $d->getAttributeNS('http://www.w3.org/XML/1998/namespace', 'lang');
+        my $code = $d->parentNode->getAttribute('code');
+        unless ($descs && $lang && exists $descs->{$lang}) {
+            $descs->{$lang} = {};
+            if (!$descs) {
+                $logger->error("No error description nodes found in $eventsxml.");
+            }
+            if (!$lang) {
+                $logger->error("No xml:lang attribute found for node in $eventsxml.");
+            }
+        }
+        $descs->{$lang}->{$code} = $d->textContent;
+    }
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Perm.pm b/Open-ILS/src/perlmods/lib/OpenILS/Perm.pm
index 0bfbeb7..d9ad5d1 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Perm.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Perm.pm
@@ -15,9 +15,9 @@ use OpenSRF::Utils::Logger;
 my $logger = 'OpenSRF::Utils::Logger';
 
 sub new {
-	my($class, $type) = @_;
-	$logger->warn("Returning permission error: $type");
-	return bless( { ilsevent => 5000, ilsperm => $type }, 'OpenILS::Perm');
+    my($class, $type) = @_;
+    $logger->warn("Returning permission error: $type");
+    return bless( { ilsevent => 5000, ilsperm => $type }, 'OpenILS::Perm');
 }
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Reporter/Proxy.pm b/Open-ILS/src/perlmods/lib/OpenILS/Reporter/Proxy.pm
index d70d359..cf5e9b0 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Reporter/Proxy.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Reporter/Proxy.pm
@@ -17,140 +17,140 @@ use OpenSRF::System;
 my $bootstrap;
 
 sub import {
-	my $self = shift;
-	$bootstrap = shift;
+    my $self = shift;
+    $bootstrap = shift;
 }
 
 
 sub child_init {
-	OpenSRF::System->bootstrap_client( config_file => $bootstrap );
+    OpenSRF::System->bootstrap_client( config_file => $bootstrap );
 }
 
 sub handler {
-	my $apache = shift;
-	my $cgi = new CGI;
-	my $auth_ses = $cgi->cookie('ses');
-	my $ws_ou = $cgi->cookie('ws_ou') || 1;
+    my $apache = shift;
+    my $cgi = new CGI;
+    my $auth_ses = $cgi->cookie('ses');
+    my $ws_ou = $cgi->cookie('ws_ou') || 1;
 
-	my $url = $cgi->url;
+    my $url = $cgi->url;
 
-	# push everyone to the secure site
-	if ($url =~ /^http:/o) {
-		$url =~ s/^http:/https:/o;
-		print "Location: $url\n\n";
-		return Apache2::Const::OK;
-	}
+    # push everyone to the secure site
+    if ($url =~ /^http:/o) {
+        $url =~ s/^http:/https:/o;
+        print "Location: $url\n\n";
+        return Apache2::Const::OK;
+    }
 
-	if (!$auth_ses) {
-		my $u = $cgi->param('user');
-		my $p = $cgi->param('passwd');
+    if (!$auth_ses) {
+        my $u = $cgi->param('user');
+        my $p = $cgi->param('passwd');
 
-		if (!$u) {
+        if (!$u) {
 
-			print $cgi->header(-type=>'text/html', -expires=>'-1d');
-			print <<"			HTML";
+            print $cgi->header(-type=>'text/html', -expires=>'-1d');
+            print <<"            HTML";
 
 <html>
-	<head>
-		<title>Report Output Login</title>
-	</head>
-	<body>
-		<br/><br/><br/>
-		<center>
-		<form method='POST'>
-			<table style='border-collapse: collapse; border: 1px solid black;'>
-				<tr>
-					<th colspan='2' align='center'><u>Please log in to view reports</u></th>
-				</tr>
-				<tr>
-					<th align="right">Username or barcode:</th>
-					<td><input type="text" name="user"/></td>
-				</tr>
-				<tr>
-					<th align="right">Password:</th>
-					<td><input type="password" name="passwd"/></td>
-				</tr>
-			</table>
-			<input type="submit" value="Log in"/>
-		</form>
-		</center>
-	</body>
+    <head>
+        <title>Report Output Login</title>
+    </head>
+    <body>
+        <br/><br/><br/>
+        <center>
+        <form method='POST'>
+            <table style='border-collapse: collapse; border: 1px solid black;'>
+                <tr>
+                    <th colspan='2' align='center'><u>Please log in to view reports</u></th>
+                </tr>
+                <tr>
+                    <th align="right">Username or barcode:</th>
+                    <td><input type="text" name="user"/></td>
+                </tr>
+                <tr>
+                    <th align="right">Password:</th>
+                    <td><input type="password" name="passwd"/></td>
+                </tr>
+            </table>
+            <input type="submit" value="Log in"/>
+        </form>
+        </center>
+    </body>
 </html>
 
-			HTML
-			return Apache2::Const::OK;
-		}
-
-		$auth_ses = oils_login($u, $p);
-		if ($auth_ses) {
-			print $cgi->redirect(
-				-uri=>$url,
-				-cookie=>$cgi->cookie(
-					-name=>'ses',
-					-value=>$auth_ses,
-					-path=>'/',-expires=>'+1h'
-				)
-			);
-			return Apache2::Const::REDIRECT;
-		}
-	}
-
-	my $user = verify_login($auth_ses);
-	return Apache2::Const::FORBIDDEN unless ($user);
-
-	my $failures = OpenSRF::AppSession
-		->create('open-ils.actor')
-		->request('open-ils.actor.user.perm.check', $auth_ses, $user->id, $ws_ou, ['VIEW_REPORT_OUTPUT'])
-		->gather(1);
-
-	return Apache2::Const::FORBIDDEN if (@$failures > 0);
-
-	# they're good, let 'em through
-	return Apache2::Const::DECLINED if (-e $apache->filename);
-
-	# oops, file not found
-	return Apache2::Const::NOT_FOUND;
+            HTML
+            return Apache2::Const::OK;
+        }
+
+        $auth_ses = oils_login($u, $p);
+        if ($auth_ses) {
+            print $cgi->redirect(
+                -uri=>$url,
+                -cookie=>$cgi->cookie(
+                    -name=>'ses',
+                    -value=>$auth_ses,
+                    -path=>'/',-expires=>'+1h'
+                )
+            );
+            return Apache2::Const::REDIRECT;
+        }
+    }
+
+    my $user = verify_login($auth_ses);
+    return Apache2::Const::FORBIDDEN unless ($user);
+
+    my $failures = OpenSRF::AppSession
+        ->create('open-ils.actor')
+        ->request('open-ils.actor.user.perm.check', $auth_ses, $user->id, $ws_ou, ['VIEW_REPORT_OUTPUT'])
+        ->gather(1);
+
+    return Apache2::Const::FORBIDDEN if (@$failures > 0);
+
+    # they're good, let 'em through
+    return Apache2::Const::DECLINED if (-e $apache->filename);
+
+    # oops, file not found
+    return Apache2::Const::NOT_FOUND;
 }
 
 # returns the user object if the session is valid, 0 otherwise
 sub verify_login {
-	my $auth_token = shift;
-	return undef unless $auth_token;
+    my $auth_token = shift;
+    return undef unless $auth_token;
 
-	my $user = OpenSRF::AppSession
-		->create("open-ils.auth")
-		->request( "open-ils.auth.session.retrieve", $auth_token )
-		->gather(1);
+    my $user = OpenSRF::AppSession
+        ->create("open-ils.auth")
+        ->request( "open-ils.auth.session.retrieve", $auth_token )
+        ->gather(1);
 
-	if (ref($user) eq 'HASH' && $user->{ilsevent} == 1001) {
-		return undef;
-	}
+    if (ref($user) eq 'HASH' && $user->{ilsevent} == 1001) {
+        return undef;
+    }
 
-	return $user if ref($user);
-	return undef;
+    return $user if ref($user);
+    return undef;
 }
 
 sub oils_login {
         my( $username, $password, $type ) = @_;
 
         $type |= "staff";
-	my $nametype = 'username';
-	$nametype = 'barcode' if ($username =~ /^\d+$/o);
+    my $nametype = 'username';
+    $nametype = 'barcode' if ($username =~ /^\d+$/o);
 
         my $seed = OpenSRF::AppSession
-		->create("open-ils.auth")
-		->request( 'open-ils.auth.authenticate.init', $username )
-		->gather(1);
+        ->create("open-ils.auth")
+        ->request( 'open-ils.auth.authenticate.init', $username )
+        ->gather(1);
 
         return undef unless $seed;
 
         my $response = OpenSRF::AppSession
-		->create("open-ils.auth")
-		->request( 'open-ils.auth.authenticate.complete',
-			{ $nametype => $username,
-			  password => md5_hex($seed . md5_hex($password)),
-			  type => $type })
-		->gather(1);
+        ->create("open-ils.auth")
+        ->request( 'open-ils.auth.authenticate.complete',
+            { $nametype => $username,
+              password => md5_hex($seed . md5_hex($password)),
+              type => $type })
+        ->gather(1);
 
         return undef unless $response;
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Reporter/SQLBuilder.pm b/Open-ILS/src/perlmods/lib/OpenILS/Reporter/SQLBuilder.pm
index b7d7177..67c8af6 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Reporter/SQLBuilder.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Reporter/SQLBuilder.pm
@@ -2,82 +2,82 @@
 package OpenILS::Reporter::SQLBuilder;
 
 sub new {
-	my $class = shift;
-	$class = ref($class) || $class;
+    my $class = shift;
+    $class = ref($class) || $class;
 
-	return bless { _sql => undef } => $class;
+    return bless { _sql => undef } => $class;
 }
 
 sub register_params {
-	my $self  = shift;
-	my $p = shift;
-	$self->{_params} = $p;
+    my $self  = shift;
+    my $p = shift;
+    $self->{_params} = $p;
 }
 
 sub get_param {
-	my $self = shift;
-	my $p = shift;
-	return $self->{_builder}->{_params}->{$p};
+    my $self = shift;
+    my $p = shift;
+    return $self->{_builder}->{_params}->{$p};
 }
 
 sub set_builder {
-	my $self = shift;
-	$self->{_builder} = shift;
-	return $self;
+    my $self = shift;
+    $self->{_builder} = shift;
+    return $self;
 }
 
 sub builder {
-	my $self = shift;
-	return $self->{_builder};
+    my $self = shift;
+    return $self->{_builder};
 }
 
 sub relative_time {
-	my $self = shift;
-	my $t = shift;
-	$self->builder->{_relative_time} = $t if (defined $t);
-	return $self->builder->{_relative_time};
+    my $self = shift;
+    my $t = shift;
+    $self->builder->{_relative_time} = $t if (defined $t);
+    return $self->builder->{_relative_time};
 }
 
 sub resolve_param {
-	my $self = shift;
-	my $val = shift;
+    my $self = shift;
+    my $val = shift;
 
-	if (defined($val) && $val =~ /^::(.+)$/o) {
-		$val = $self->get_param($1);
-	}
+    if (defined($val) && $val =~ /^::(.+)$/o) {
+        $val = $self->get_param($1);
+    }
 
-	if (defined($val) && !ref($val)) {
-		$val =~ s/\\/\\\\/go;
-		$val =~ s/"/\\"/go;
-	}
+    if (defined($val) && !ref($val)) {
+        $val =~ s/\\/\\\\/go;
+        $val =~ s/"/\\"/go;
+    }
 
-	return $val;
+    return $val;
 }
 
 sub parse_report {
-	my $self = shift;
-	my $report = shift;
+    my $self = shift;
+    my $report = shift;
 
-	my $rs = OpenILS::Reporter::SQLBuilder::ResultSet->new;
+    my $rs = OpenILS::Reporter::SQLBuilder::ResultSet->new;
 
-	if (!$report->{order_by} || @{$report->{order_by}} == 0) {
-		$report->{order_by} = $report->{select};
-	}
+    if (!$report->{order_by} || @{$report->{order_by}} == 0) {
+        $report->{order_by} = $report->{select};
+    }
 
-	$rs->is_subquery( 1 ) if ( $report->{alias} );
+    $rs->is_subquery( 1 ) if ( $report->{alias} );
 
-	$rs	->set_builder( $self )
-		->set_subquery_alias( $report->{alias} )
-		->set_select( $report->{select} )
-		->set_from( $report->{from} )
-		->set_where( $report->{where} )
-		->set_having( $report->{having} )
-		->set_order_by( $report->{order_by} )
-		->set_pivot_data( $report->{pivot_data} )
-		->set_pivot_label( $report->{pivot_label} )
-		->set_pivot_default( $report->{pivot_default} );
+    $rs ->set_builder( $self )
+        ->set_subquery_alias( $report->{alias} )
+        ->set_select( $report->{select} )
+        ->set_from( $report->{from} )
+        ->set_where( $report->{where} )
+        ->set_having( $report->{having} )
+        ->set_order_by( $report->{order_by} )
+        ->set_pivot_data( $report->{pivot_data} )
+        ->set_pivot_label( $report->{pivot_label} )
+        ->set_pivot_default( $report->{pivot_default} );
 
-	return $rs;
+    return $rs;
 }
 
 
@@ -86,174 +86,174 @@ package OpenILS::Reporter::SQLBuilder::ResultSet;
 use base qw/OpenILS::Reporter::SQLBuilder/;
 
 sub is_subquery {
-	my $self = shift;
-	my $flag = shift;
-	$self->{_is_subquery} = $flag if (defined $flag);
-	return $self->{_is_subquery};
+    my $self = shift;
+    my $flag = shift;
+    $self->{_is_subquery} = $flag if (defined $flag);
+    return $self->{_is_subquery};
 }
 
 sub pivot_data {
-	my $self = shift;
-	return $self->builder->{_pivot_data};
+    my $self = shift;
+    return $self->builder->{_pivot_data};
 }
 
 sub pivot_label {
-	my $self = shift;
-	return $self->builder->{_pivot_label};
+    my $self = shift;
+    return $self->builder->{_pivot_label};
 }
 
 sub pivot_default {
-	my $self = shift;
-	return $self->builder->{_pivot_default};
+    my $self = shift;
+    return $self->builder->{_pivot_default};
 }
 
 sub set_pivot_default {
-	my $self = shift;
-	my $p = shift;
-	$self->builder->{_pivot_default} = $p if (defined $p);
-	return $self;
+    my $self = shift;
+    my $p = shift;
+    $self->builder->{_pivot_default} = $p if (defined $p);
+    return $self;
 }
 
 sub set_pivot_data {
-	my $self = shift;
-	my $p = shift;
-	$self->builder->{_pivot_data} = $p if (defined $p);
-	return $self;
+    my $self = shift;
+    my $p = shift;
+    $self->builder->{_pivot_data} = $p if (defined $p);
+    return $self;
 }
 
 sub set_pivot_label {
-	my $self = shift;
-	my $p = shift;
-	$self->builder->{_pivot_label} = $p if (defined $p);
-	return $self;
+    my $self = shift;
+    my $p = shift;
+    $self->builder->{_pivot_label} = $p if (defined $p);
+    return $self;
 }
 
 sub set_subquery_alias {
-	my $self = shift;
-	my $alias = shift;
-	$self->{_alias} = $alias if (defined $alias);
-	return $self;
+    my $self = shift;
+    my $alias = shift;
+    $self->{_alias} = $alias if (defined $alias);
+    return $self;
 }
 
 sub set_select {
-	my $self = shift;
-	my @cols = @_;
+    my $self = shift;
+    my @cols = @_;
 
-	$self->{_select} = [];
+    $self->{_select} = [];
 
-	return $self unless (@cols && defined($cols[0]));
-	@cols = @{ $cols[0] } if (@cols == 1 && ref($cols[0]) eq 'ARRAY');
+    return $self unless (@cols && defined($cols[0]));
+    @cols = @{ $cols[0] } if (@cols == 1 && ref($cols[0]) eq 'ARRAY');
 
-	push @{ $self->{_select} }, map { OpenILS::Reporter::SQLBuilder::Column::Select->new( $_ )->set_builder( $self->builder ) } @cols;
+    push @{ $self->{_select} }, map { OpenILS::Reporter::SQLBuilder::Column::Select->new( $_ )->set_builder( $self->builder ) } @cols;
 
-	return $self;
+    return $self;
 }
 
 sub set_from {
-	my $self = shift;
-	my $f = shift;
+    my $self = shift;
+    my $f = shift;
 
-	$self->{_from} = OpenILS::Reporter::SQLBuilder::Relation->parse( $f, $self->builder );
+    $self->{_from} = OpenILS::Reporter::SQLBuilder::Relation->parse( $f, $self->builder );
 
-	return $self;
+    return $self;
 }
 
 sub set_where {
-	my $self = shift;
-	my @cols = @_;
+    my $self = shift;
+    my @cols = @_;
 
-	$self->{_where} = [];
+    $self->{_where} = [];
 
-	return $self unless (@cols && defined($cols[0]));
-	@cols = @{ $cols[0] } if (@cols == 1 && ref($cols[0]) eq 'ARRAY');
+    return $self unless (@cols && defined($cols[0]));
+    @cols = @{ $cols[0] } if (@cols == 1 && ref($cols[0]) eq 'ARRAY');
 
-	push @{ $self->{_where} }, map { OpenILS::Reporter::SQLBuilder::Column::Where->new( $_ )->set_builder( $self->builder ) } @cols;
+    push @{ $self->{_where} }, map { OpenILS::Reporter::SQLBuilder::Column::Where->new( $_ )->set_builder( $self->builder ) } @cols;
 
-	return $self;
+    return $self;
 }
 
 sub set_having {
-	my $self = shift;
-	my @cols = @_;
+    my $self = shift;
+    my @cols = @_;
 
-	$self->{_having} = [];
+    $self->{_having} = [];
 
-	return $self unless (@cols && defined($cols[0]));
-	@cols = @{ $cols[0] } if (@cols == 1 && ref($cols[0]) eq 'ARRAY');
+    return $self unless (@cols && defined($cols[0]));
+    @cols = @{ $cols[0] } if (@cols == 1 && ref($cols[0]) eq 'ARRAY');
 
-	push @{ $self->{_having} }, map { OpenILS::Reporter::SQLBuilder::Column::Having->new( $_ )->set_builder( $self->builder ) } @cols;
+    push @{ $self->{_having} }, map { OpenILS::Reporter::SQLBuilder::Column::Having->new( $_ )->set_builder( $self->builder ) } @cols;
 
-	return $self;
+    return $self;
 }
 
 sub set_order_by {
-	my $self = shift;
-	my @cols = @_;
+    my $self = shift;
+    my @cols = @_;
 
-	$self->{_order_by} = [];
+    $self->{_order_by} = [];
 
-	return $self unless (@cols && defined($cols[0]));
-	@cols = @{ $cols[0] } if (@cols == 1 && ref($cols[0]) eq 'ARRAY');
+    return $self unless (@cols && defined($cols[0]));
+    @cols = @{ $cols[0] } if (@cols == 1 && ref($cols[0]) eq 'ARRAY');
 
-	push @{ $self->{_order_by} }, map { OpenILS::Reporter::SQLBuilder::Column::OrderBy->new( $_ )->set_builder( $self->builder ) } @cols;
+    push @{ $self->{_order_by} }, map { OpenILS::Reporter::SQLBuilder::Column::OrderBy->new( $_ )->set_builder( $self->builder ) } @cols;
 
-	return $self;
+    return $self;
 }
 
 sub column_label_list {
-	my $self = shift;
+    my $self = shift;
 
-	my @labels;
-	push @labels, $self->resolve_param( $_->{_alias} ) for ( @{ $self->{_select} } );
-	return @labels;
+    my @labels;
+    push @labels, $self->resolve_param( $_->{_alias} ) for ( @{ $self->{_select} } );
+    return @labels;
 }
 
 sub group_by_list {
-	my $self = shift;
-	my $base = shift;
-	$base = 1 unless (defined $base);
+    my $self = shift;
+    my $base = shift;
+    $base = 1 unless (defined $base);
 
-	my $seen_label = 0;
-	my $gcount = $base;
-	my @group_by;
-	for my $c ( @{ $self->{_select} } ) {
-		if ($base == 0 && !$seen_label  && defined($self->pivot_label) && $gcount == $self->pivot_label - 1) {
-			$seen_label++;
-			next;
-		}
-		push @group_by, $gcount if (!$c->is_aggregate);
-		$gcount++;
-	}
+    my $seen_label = 0;
+    my $gcount = $base;
+    my @group_by;
+    for my $c ( @{ $self->{_select} } ) {
+        if ($base == 0 && !$seen_label  && defined($self->pivot_label) && $gcount == $self->pivot_label - 1) {
+            $seen_label++;
+            next;
+        }
+        push @group_by, $gcount if (!$c->is_aggregate);
+        $gcount++;
+    }
 
-	return @group_by;
+    return @group_by;
 }
 
 sub toSQL {
-	my $self = shift;
+    my $self = shift;
 
-	return $self->{_sql} if ($self->{_sql});
+    return $self->{_sql} if ($self->{_sql});
 
-	my $sql = '';
+    my $sql = '';
 
-	if ($self->is_subquery) {
-		$sql = '(';
-	}
+    if ($self->is_subquery) {
+        $sql = '(';
+    }
 
-	$sql .= "SELECT\t" . join(",\n\t", map { $_->toSQL } @{ $self->{_select} }) . "\n" if (@{ $self->{_select} });
-	$sql .= "  FROM\t" . $self->{_from}->toSQL . "\n" if ($self->{_from});
-	$sql .= "  WHERE\t" . join("\n\tAND ", map { $_->toSQL } @{ $self->{_where} }) . "\n" if (@{ $self->{_where} });
+    $sql .= "SELECT\t" . join(",\n\t", map { $_->toSQL } @{ $self->{_select} }) . "\n" if (@{ $self->{_select} });
+    $sql .= "  FROM\t" . $self->{_from}->toSQL . "\n" if ($self->{_from});
+    $sql .= "  WHERE\t" . join("\n\tAND ", map { $_->toSQL } @{ $self->{_where} }) . "\n" if (@{ $self->{_where} });
 
-	my @group_by = $self->group_by_list;
+    my @group_by = $self->group_by_list;
 
-	$sql .= '  GROUP BY ' . join(', ', @group_by) . "\n" if (@group_by);
-	$sql .= "  HAVING " . join("\n\tAND ", map { $_->toSQL } @{ $self->{_having} }) . "\n" if (@{ $self->{_having} });
-	$sql .= '  ORDER BY ' . join(', ', map { $_->toSQL } @{ $self->{_order_by} }) . "\n" if (@{ $self->{_order_by} });
+    $sql .= '  GROUP BY ' . join(', ', @group_by) . "\n" if (@group_by);
+    $sql .= "  HAVING " . join("\n\tAND ", map { $_->toSQL } @{ $self->{_having} }) . "\n" if (@{ $self->{_having} });
+    $sql .= '  ORDER BY ' . join(', ', map { $_->toSQL } @{ $self->{_order_by} }) . "\n" if (@{ $self->{_order_by} });
 
-	if ($self->is_subquery) {
-		$sql .= ') '. $self->{_alias} . "\n";
-	}
+    if ($self->is_subquery) {
+        $sql .= ') '. $self->{_alias} . "\n";
+    }
 
-	return $self->{_sql} = $sql;
+    return $self->{_sql} = $sql;
 }
 
 
@@ -262,55 +262,55 @@ package OpenILS::Reporter::SQLBuilder::Input;
 use base qw/OpenILS::Reporter::SQLBuilder/;
 
 sub new {
-	my $class = shift;
-	my $self = $class->SUPER::new;
+    my $class = shift;
+    my $self = $class->SUPER::new;
 
-	my $col_data = shift;
+    my $col_data = shift;
 
-	if (ref($col_data)) {
-		$self->{params} = $col_data->{params};
-		my $trans = $col_data->{transform} || 'Bare';
-		my $pkg = "OpenILS::Reporter::SQLBuilder::Input::Transform::$trans";
-		if (UNIVERSAL::can($pkg => 'toSQL')) {
-			$self->{_transform} = $trans;
-		} else {
-			$self->{_transform} = 'GenericTransform';
-		}
-	} elsif( defined($col_data) ) {
-		$self->{_transform} = 'Bare';
-		$self->{params} = $col_data;
-	} else {
-		$self->{_transform} = 'NULL';
-	}
+    if (ref($col_data)) {
+        $self->{params} = $col_data->{params};
+        my $trans = $col_data->{transform} || 'Bare';
+        my $pkg = "OpenILS::Reporter::SQLBuilder::Input::Transform::$trans";
+        if (UNIVERSAL::can($pkg => 'toSQL')) {
+            $self->{_transform} = $trans;
+        } else {
+            $self->{_transform} = 'GenericTransform';
+        }
+    } elsif( defined($col_data) ) {
+        $self->{_transform} = 'Bare';
+        $self->{params} = $col_data;
+    } else {
+        $self->{_transform} = 'NULL';
+    }
 
 
 
-	return $self;
+    return $self;
 }
 
 sub toSQL {
-	my $self = shift;
-	my $type = $self->{_transform};
-	return $self->{_sql} if ($self->{_sql});
-	my $toSQL = "OpenILS::Reporter::SQLBuilder::Input::Transform::${type}::toSQL";
-	return $self->{_sql} = $self->$toSQL;
+    my $self = shift;
+    my $type = $self->{_transform};
+    return $self->{_sql} if ($self->{_sql});
+    my $toSQL = "OpenILS::Reporter::SQLBuilder::Input::Transform::${type}::toSQL";
+    return $self->{_sql} = $self->$toSQL;
 }
 
 #-------------------------------------------------------------------------------------------------
 package OpenILS::Reporter::SQLBuilder::Input::Transform::GenericTransform;
 
 sub toSQL {
-	my $self = shift;
-	my $func = $self->{transform};
+    my $self = shift;
+    my $func = $self->{transform};
 
-	my @params;
-	@params = @{ $self->{params} } if ($self->{params});
+    my @params;
+    @params = @{ $self->{params} } if ($self->{params});
 
-	my $sql = $func . '(\'';
-	$sql .= join("','", @params) if (@params);
-	$sql .= '\')';
+    my $sql = $func . '(\'';
+    $sql .= join("','", @params) if (@params);
+    $sql .= '\')';
 
-	return $sql;
+    return $sql;
 }
 
 
@@ -318,7 +318,7 @@ sub toSQL {
 package OpenILS::Reporter::SQLBuilder::Input::Transform::NULL;
 
 sub toSQL {
-	return "NULL";
+    return "NULL";
 }
 
 
@@ -326,15 +326,15 @@ sub toSQL {
 package OpenILS::Reporter::SQLBuilder::Input::Transform::Bare;
 
 sub toSQL {
-	my $self = shift;
+    my $self = shift;
 
-	my $val = $self->{params};
-	$val = $$val[0] if (ref($val));
-	
-	$val =~ s/\\/\\\\/go;
-	$val =~ s/'/\\'/go;
+    my $val = $self->{params};
+    $val = $$val[0] if (ref($val));
+    
+    $val =~ s/\\/\\\\/go;
+    $val =~ s/'/\\'/go;
 
-	return "'$val'";
+    return "'$val'";
 }
 
 
@@ -342,15 +342,15 @@ sub toSQL {
 package OpenILS::Reporter::SQLBuilder::Input::Transform::age;
 
 sub toSQL {
-	my $self = shift;
+    my $self = shift;
 
-	my $val = $self->{params};
-	$val = $$val[0] if (ref($val));
+    my $val = $self->{params};
+    $val = $$val[0] if (ref($val));
 
-	$val =~ s/\\/\\\\/go;
-	$val =~ s/'/\\'/go;
+    $val =~ s/\\/\\\\/go;
+    $val =~ s/'/\\'/go;
 
-	return "AGE(NOW(),'" . $val . "'::TIMESTAMPTZ)";
+    return "AGE(NOW(),'" . $val . "'::TIMESTAMPTZ)";
 }
 
 sub is_aggregate { return 0 }
@@ -360,20 +360,20 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Input::Transform::relative_year;
 
 sub toSQL {
-	my $self = shift;
+    my $self = shift;
 
-	my $rtime = $self->relative_time || 'now';
+    my $rtime = $self->relative_time || 'now';
 
-	$rtime =~ s/\\/\\\\/go;
-	$rtime =~ s/'/\\'/go;
+    $rtime =~ s/\\/\\\\/go;
+    $rtime =~ s/'/\\'/go;
 
-	my $val = $self->{params};
-	$val = $$val[0] if (ref($val));
+    my $val = $self->{params};
+    $val = $$val[0] if (ref($val));
 
-	$val =~ s/\\/\\\\/go;
-	$val =~ s/'/\\'/go;
+    $val =~ s/\\/\\\\/go;
+    $val =~ s/'/\\'/go;
 
-	return "EXTRACT(YEAR FROM '$rtime'::TIMESTAMPTZ + '$val years')";
+    return "EXTRACT(YEAR FROM '$rtime'::TIMESTAMPTZ + '$val years')";
 }
 
 
@@ -381,21 +381,21 @@ sub toSQL {
 package OpenILS::Reporter::SQLBuilder::Input::Transform::relative_month;
 
 sub toSQL {
-	my $self = shift;
+    my $self = shift;
 
-	my $rtime = $self->relative_time || 'now';
+    my $rtime = $self->relative_time || 'now';
 
-	$rtime =~ s/\\/\\\\/go;
-	$rtime =~ s/'/\\'/go;
+    $rtime =~ s/\\/\\\\/go;
+    $rtime =~ s/'/\\'/go;
 
-	my $val = $self->{params};
-	$val = $$val[0] if (ref($val));
+    my $val = $self->{params};
+    $val = $$val[0] if (ref($val));
 
-	$val =~ s/\\/\\\\/go;
-	$val =~ s/'/\\'/go;
+    $val =~ s/\\/\\\\/go;
+    $val =~ s/'/\\'/go;
 
-	return "EXTRACT(YEAR FROM '$rtime'::TIMESTAMPTZ + '$val months')" .
-		" || '-' || LPAD(EXTRACT(MONTH FROM '$rtime'::TIMESTAMPTZ + '$val months')::text,2,'0')";
+    return "EXTRACT(YEAR FROM '$rtime'::TIMESTAMPTZ + '$val months')" .
+        " || '-' || LPAD(EXTRACT(MONTH FROM '$rtime'::TIMESTAMPTZ + '$val months')::text,2,'0')";
 }
 
 
@@ -403,20 +403,20 @@ sub toSQL {
 package OpenILS::Reporter::SQLBuilder::Input::Transform::relative_date;
 
 sub toSQL {
-	my $self = shift;
+    my $self = shift;
 
-	my $rtime = $self->relative_time || 'now';
+    my $rtime = $self->relative_time || 'now';
 
-	$rtime =~ s/\\/\\\\/go;
-	$rtime =~ s/'/\\'/go;
+    $rtime =~ s/\\/\\\\/go;
+    $rtime =~ s/'/\\'/go;
 
-	my $val = $self->{params};
-	$val = $$val[0] if (ref($val));
+    my $val = $self->{params};
+    $val = $$val[0] if (ref($val));
 
-	$val =~ s/\\/\\\\/go;
-	$val =~ s/'/\\'/go;
+    $val =~ s/\\/\\\\/go;
+    $val =~ s/'/\\'/go;
 
-	return "DATE('$rtime'::TIMESTAMPTZ + '$val days')";
+    return "DATE('$rtime'::TIMESTAMPTZ + '$val days')";
 }
 
 
@@ -424,20 +424,20 @@ sub toSQL {
 package OpenILS::Reporter::SQLBuilder::Input::Transform::relative_week;
 
 sub toSQL {
-	my $self = shift;
+    my $self = shift;
 
-	my $rtime = $self->relative_time || 'now';
+    my $rtime = $self->relative_time || 'now';
 
-	$rtime =~ s/\\/\\\\/go;
-	$rtime =~ s/'/\\'/go;
+    $rtime =~ s/\\/\\\\/go;
+    $rtime =~ s/'/\\'/go;
 
-	my $val = $self->{params};
-	$val = $$val[0] if (ref($val));
+    my $val = $self->{params};
+    $val = $$val[0] if (ref($val));
 
-	$val =~ s/\\/\\\\/go;
-	$val =~ s/'/\\'/go;
+    $val =~ s/\\/\\\\/go;
+    $val =~ s/'/\\'/go;
 
-	return "EXTRACT(WEEK FROM '$rtime'::TIMESTAMPTZ + '$val weeks')";
+    return "EXTRACT(WEEK FROM '$rtime'::TIMESTAMPTZ + '$val weeks')";
 }
 
 
@@ -446,60 +446,60 @@ package OpenILS::Reporter::SQLBuilder::Column;
 use base qw/OpenILS::Reporter::SQLBuilder/;
 
 sub new {
-	my $class = shift;
-	my $self = $class->SUPER::new;
+    my $class = shift;
+    my $self = $class->SUPER::new;
 
-	my $col_data = shift;
-	$self->{_relation} = $col_data->{relation};
-	$self->{_column} = $col_data->{column};
+    my $col_data = shift;
+    $self->{_relation} = $col_data->{relation};
+    $self->{_column} = $col_data->{column};
 
-	$self->{_aggregate} = $col_data->{aggregate};
+    $self->{_aggregate} = $col_data->{aggregate};
 
-	if (ref($self->{_column})) {
-		my $trans = $self->{_column}->{transform} || 'Bare';
-		my $pkg = "OpenILS::Reporter::SQLBuilder::Column::Transform::$trans";
-		if (UNIVERSAL::can($pkg => 'toSQL')) {
-			$self->{_transform} = $trans;
-		} else {
-			$self->{_transform} = 'GenericTransform';
-		}
-	} elsif( defined($self->{_column}) ) {
-		$self->{_transform} = 'Bare';
-	} else {
-		$self->{_transform} = 'NULL';
-	}
+    if (ref($self->{_column})) {
+        my $trans = $self->{_column}->{transform} || 'Bare';
+        my $pkg = "OpenILS::Reporter::SQLBuilder::Column::Transform::$trans";
+        if (UNIVERSAL::can($pkg => 'toSQL')) {
+            $self->{_transform} = $trans;
+        } else {
+            $self->{_transform} = 'GenericTransform';
+        }
+    } elsif( defined($self->{_column}) ) {
+        $self->{_transform} = 'Bare';
+    } else {
+        $self->{_transform} = 'NULL';
+    }
 
 
-	return $self;
+    return $self;
 }
 
 sub find_relation {
-	my $self = shift;
-	return $self->builder->{_rels}->{$self->{_relation}};
+    my $self = shift;
+    return $self->builder->{_rels}->{$self->{_relation}};
 }
 
 sub name {
-	my $self = shift;
-	if (ref($self->{_column})) {
-		 return $self->{_column}->{colname};
-	} else {
-		return $self->{_column};
-	}
+    my $self = shift;
+    if (ref($self->{_column})) {
+         return $self->{_column}->{colname};
+    } else {
+        return $self->{_column};
+    }
 }
 
 sub toSQL {
-	my $self = shift;
-	my $type = $self->{_transform};
-	return $self->{_sql} if ($self->{_sql});
-	my $toSQL = "OpenILS::Reporter::SQLBuilder::Column::Transform::${type}::toSQL";
-	return $self->{_sql} = $self->$toSQL;
+    my $self = shift;
+    my $type = $self->{_transform};
+    return $self->{_sql} if ($self->{_sql});
+    my $toSQL = "OpenILS::Reporter::SQLBuilder::Column::Transform::${type}::toSQL";
+    return $self->{_sql} = $self->$toSQL;
 }
 
 sub is_aggregate {
-	my $self = shift;
-	my $type = $self->{_transform};
-	my $is_agg = "OpenILS::Reporter::SQLBuilder::Column::Transform::${type}::is_aggregate";
-	return $self->$is_agg;
+    my $self = shift;
+    my $type = $self->{_transform};
+    my $is_agg = "OpenILS::Reporter::SQLBuilder::Column::Transform::${type}::is_aggregate";
+    return $self->$is_agg;
 }
 
 
@@ -508,19 +508,19 @@ package OpenILS::Reporter::SQLBuilder::Column::OrderBy;
 use base qw/OpenILS::Reporter::SQLBuilder::Column/;
 
 sub new {
-	my $class = shift;
-	my $self = $class->SUPER::new(@_);
+    my $class = shift;
+    my $self = $class->SUPER::new(@_);
 
-	my $col_data = shift;
-	$self->{_direction} = $col_data->{direction} || 'ascending';
-	return $self;
+    my $col_data = shift;
+    $self->{_direction} = $col_data->{direction} || 'ascending';
+    return $self;
 }
 
 sub toSQL {
-	my $self = shift;
-	my $dir = ($self->{_direction} =~ /^d/oi) ? 'DESC' : 'ASC';
-	return $self->{_sql} if ($self->{_sql});
-	return $self->{_sql} = $self->SUPER::toSQL .  " $dir";
+    my $self = shift;
+    my $dir = ($self->{_direction} =~ /^d/oi) ? 'DESC' : 'ASC';
+    return $self->{_sql} if ($self->{_sql});
+    return $self->{_sql} = $self->SUPER::toSQL .  " $dir";
 }
 
 
@@ -529,18 +529,18 @@ package OpenILS::Reporter::SQLBuilder::Column::Select;
 use base qw/OpenILS::Reporter::SQLBuilder::Column/;
 
 sub new {
-	my $class = shift;
-	my $self = $class->SUPER::new(@_);
+    my $class = shift;
+    my $self = $class->SUPER::new(@_);
 
-	my $col_data = shift;
-	$self->{_alias} = $col_data->{alias} || $self->name;
-	return $self;
+    my $col_data = shift;
+    $self->{_alias} = $col_data->{alias} || $self->name;
+    return $self;
 }
 
 sub toSQL {
-	my $self = shift;
-	return $self->{_sql} if ($self->{_sql});
-	return $self->{_sql} = $self->SUPER::toSQL .  ' AS "' . $self->resolve_param( $self->{_alias} ) . '"';
+    my $self = shift;
+    return $self->{_sql} if ($self->{_sql});
+    return $self->{_sql} = $self->SUPER::toSQL .  ' AS "' . $self->resolve_param( $self->{_alias} ) . '"';
 }
 
 
@@ -548,18 +548,18 @@ sub toSQL {
 package OpenILS::Reporter::SQLBuilder::Column::Transform::GenericTransform;
 
 sub toSQL {
-	my $self = shift;
-	my $name = $self->name;
-	my $func = $self->{_column}->{transform};
+    my $self = shift;
+    my $name = $self->name;
+    my $func = $self->{_column}->{transform};
 
-	my @params;
-	@params = @{ $self->resolve_param( $self->{_column}->{params} ) } if ($self->{_column}->{params});
+    my @params;
+    @params = @{ $self->resolve_param( $self->{_column}->{params} ) } if ($self->{_column}->{params});
 
-	my $sql = $func . '("' . $self->{_relation} . '"."' . $self->name . '"';
-	$sql .= ",'" . join("','", @params) . "'" if (@params);
-	$sql .= ')';
+    my $sql = $func . '("' . $self->{_relation} . '"."' . $self->name . '"';
+    $sql .= ",'" . join("','", @params) . "'" if (@params);
+    $sql .= ')';
 
-	return $sql;
+    return $sql;
 }
 
 sub is_aggregate { return $self->{_aggregate} }
@@ -568,8 +568,8 @@ sub is_aggregate { return $self->{_aggregate} }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::Bare;
 
 sub toSQL {
-	my $self = shift;
-	return '"' . $self->{_relation} . '"."' . $self->name . '"';
+    my $self = shift;
+    return '"' . $self->{_relation} . '"."' . $self->name . '"';
 }
 
 sub is_aggregate { return 0 }
@@ -578,11 +578,11 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::upper;
 
 sub toSQL {
-	my $self = shift;
-	my $params = $self->resolve_param( $self->{_column}->{params} );
-	my $start = $$params[0];
-	my $len = $$params[1];
-	return 'UPPER("' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    my $params = $self->resolve_param( $self->{_column}->{params} );
+    my $start = $$params[0];
+    my $len = $$params[1];
+    return 'UPPER("' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 0 }
@@ -592,11 +592,11 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::lower;
 
 sub toSQL {
-	my $self = shift;
-	my $params = $self->resolve_param( $self->{_column}->{params} );
-	my $start = $$params[0];
-	my $len = $$params[1];
-	return 'evergreen.lowercase("' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    my $params = $self->resolve_param( $self->{_column}->{params} );
+    my $start = $$params[0];
+    my $len = $$params[1];
+    return 'evergreen.lowercase("' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 0 }
@@ -606,11 +606,11 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::substring;
 
 sub toSQL {
-	my $self = shift;
-	my $params = $self->resolve_param( $self->{_column}->{params} );
-	my $start = $$params[0];
-	my $len = $$params[1];
-	return 'SUBSTRING("' . $self->{_relation} . '"."' . $self->name . "\",$start,$len)";
+    my $self = shift;
+    my $params = $self->resolve_param( $self->{_column}->{params} );
+    my $start = $$params[0];
+    my $len = $$params[1];
+    return 'SUBSTRING("' . $self->{_relation} . '"."' . $self->name . "\",$start,$len)";
 }
 
 sub is_aggregate { return 0 }
@@ -620,8 +620,8 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::day_name;
 
 sub toSQL {
-	my $self = shift;
-	return 'TO_CHAR("' . $self->{_relation} . '"."' . $self->name . '", \'Day\')';
+    my $self = shift;
+    return 'TO_CHAR("' . $self->{_relation} . '"."' . $self->name . '", \'Day\')';
 }
 
 sub is_aggregate { return 0 }
@@ -631,8 +631,8 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::month_name;
 
 sub toSQL {
-	my $self = shift;
-	return 'TO_CHAR("' . $self->{_relation} . '"."' . $self->name . '", \'Month\')';
+    my $self = shift;
+    return 'TO_CHAR("' . $self->{_relation} . '"."' . $self->name . '", \'Month\')';
 }
 
 sub is_aggregate { return 0 }
@@ -642,8 +642,8 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::doy;
 
 sub toSQL {
-	my $self = shift;
-	return 'EXTRACT(DOY FROM "' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    return 'EXTRACT(DOY FROM "' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 0 }
@@ -653,8 +653,8 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::woy;
 
 sub toSQL {
-	my $self = shift;
-	return 'EXTRACT(WEEK FROM "' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    return 'EXTRACT(WEEK FROM "' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 0 }
@@ -664,8 +664,8 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::moy;
 
 sub toSQL {
-	my $self = shift;
-	return 'EXTRACT(MONTH FROM "' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    return 'EXTRACT(MONTH FROM "' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 0 }
@@ -675,8 +675,8 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::qoy;
 
 sub toSQL {
-	my $self = shift;
-	return 'EXTRACT(QUARTER FROM "' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    return 'EXTRACT(QUARTER FROM "' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 0 }
@@ -686,8 +686,8 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::dom;
 
 sub toSQL {
-	my $self = shift;
-	return 'EXTRACT(DAY FROM "' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    return 'EXTRACT(DAY FROM "' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 0 }
@@ -697,8 +697,8 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::dow;
 
 sub toSQL {
-	my $self = shift;
-	return 'EXTRACT(DOW FROM "' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    return 'EXTRACT(DOW FROM "' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 0 }
@@ -708,8 +708,8 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::year_trunc;
 
 sub toSQL {
-	my $self = shift;
-	return 'EXTRACT(YEAR FROM "' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    return 'EXTRACT(YEAR FROM "' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 0 }
@@ -719,9 +719,9 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::month_trunc;
 
 sub toSQL {
-	my $self = shift;
-	return 'EXTRACT(YEAR FROM "' . $self->{_relation} . '"."' . $self->name . '")' .
-		' || \'-\' || LPAD(EXTRACT(MONTH FROM "' . $self->{_relation} . '"."' . $self->name . '")::text,2,\'0\')';
+    my $self = shift;
+    return 'EXTRACT(YEAR FROM "' . $self->{_relation} . '"."' . $self->name . '")' .
+        ' || \'-\' || LPAD(EXTRACT(MONTH FROM "' . $self->{_relation} . '"."' . $self->name . '")::text,2,\'0\')';
 }
 
 sub is_aggregate { return 0 }
@@ -731,8 +731,8 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::date_trunc;
 
 sub toSQL {
-	my $self = shift;
-	return 'DATE("' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    return 'DATE("' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 0 }
@@ -742,8 +742,8 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::hour_trunc;
 
 sub toSQL {
-	my $self = shift;
-	return 'EXTRACT(HOUR FROM "' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    return 'EXTRACT(HOUR FROM "' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 0 }
@@ -753,9 +753,9 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::quarter;
 
 sub toSQL {
-	my $self = shift;
-	return 'EXTRACT(YEAR FROM "' . $self->{_relation} . '"."' . $self->name . '")' .
-		' || \'-Q\' || EXTRACT(QUARTER FROM "' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    return 'EXTRACT(YEAR FROM "' . $self->{_relation} . '"."' . $self->name . '")' .
+        ' || \'-Q\' || EXTRACT(QUARTER FROM "' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 0 }
@@ -765,8 +765,8 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::months_ago;
 
 sub toSQL {
-	my $self = shift;
-	return 'EXTRACT(MONTH FROM AGE(NOW(),"' . $self->{_relation} . '"."' . $self->name . '"))';
+    my $self = shift;
+    return 'EXTRACT(MONTH FROM AGE(NOW(),"' . $self->{_relation} . '"."' . $self->name . '"))';
 }
 
 sub is_aggregate { return 0 }
@@ -776,8 +776,8 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::hod;
 
 sub toSQL {
-	my $self = shift;
-	return 'EXTRACT(HOUR FROM "' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    return 'EXTRACT(HOUR FROM "' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 0 }
@@ -787,8 +787,8 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::quarters_ago;
 
 sub toSQL {
-	my $self = shift;
-	return 'EXTRACT(QUARTER FROM AGE(NOW(),"' . $self->{_relation} . '"."' . $self->name . '"))';
+    my $self = shift;
+    return 'EXTRACT(QUARTER FROM AGE(NOW(),"' . $self->{_relation} . '"."' . $self->name . '"))';
 }
 
 sub is_aggregate { return 0 }
@@ -798,8 +798,8 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::age;
 
 sub toSQL {
-	my $self = shift;
-	return 'AGE(NOW(),"' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    return 'AGE(NOW(),"' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 0 }
@@ -809,8 +809,8 @@ sub is_aggregate { return 0 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::first;
 
 sub toSQL {
-	my $self = shift;
-	return 'FIRST("' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    return 'FIRST("' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 1 }
@@ -820,8 +820,8 @@ sub is_aggregate { return 1 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::last;
 
 sub toSQL {
-	my $self = shift;
-	return 'LAST("' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    return 'LAST("' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 1 }
@@ -831,8 +831,8 @@ sub is_aggregate { return 1 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::min;
 
 sub toSQL {
-	my $self = shift;
-	return 'MIN("' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    return 'MIN("' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 1 }
@@ -842,8 +842,8 @@ sub is_aggregate { return 1 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::max;
 
 sub toSQL {
-	my $self = shift;
-	return 'MAX("' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    return 'MAX("' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 1 }
@@ -853,8 +853,8 @@ sub is_aggregate { return 1 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::count;
 
 sub toSQL {
-	my $self = shift;
-	return 'COUNT("' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    return 'COUNT("' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 1 }
@@ -864,8 +864,8 @@ sub is_aggregate { return 1 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::count_distinct;
 
 sub toSQL {
-	my $self = shift;
-	return 'COUNT(DISTINCT "' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    return 'COUNT(DISTINCT "' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 1 }
@@ -875,8 +875,8 @@ sub is_aggregate { return 1 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::sum;
 
 sub toSQL {
-	my $self = shift;
-	return 'SUM("' . $self->{_relation} . '"."' . $self->name . '")';
+    my $self = shift;
+    return 'SUM("' . $self->{_relation} . '"."' . $self->name . '")';
 }
 
 sub is_aggregate { return 1 }
@@ -886,8 +886,8 @@ sub is_aggregate { return 1 }
 package OpenILS::Reporter::SQLBuilder::Column::Transform::average;
 
 sub toSQL {
-	my $self = shift;
-	return 'AVG("' . $self->{_relation} . '"."' . $self->name .  '")';
+    my $self = shift;
+    return 'AVG("' . $self->{_relation} . '"."' . $self->name .  '")';
 }
 
 sub is_aggregate { return 1 }
@@ -898,119 +898,119 @@ package OpenILS::Reporter::SQLBuilder::Column::Where;
 use base qw/OpenILS::Reporter::SQLBuilder::Column/;
 
 sub new {
-	my $class = shift;
-	my $self = $class->SUPER::new(@_);
+    my $class = shift;
+    my $self = $class->SUPER::new(@_);
 
-	my $col_data = shift;
-	$self->{_condition} = $col_data->{condition};
+    my $col_data = shift;
+    $self->{_condition} = $col_data->{condition};
 
-	return $self;
+    return $self;
 }
 
 sub _flesh_conditions {
-	my $cond = shift;
-	my $builder = shift;
-	$cond = [$cond] unless (ref($cond) eq 'ARRAY');
+    my $cond = shift;
+    my $builder = shift;
+    $cond = [$cond] unless (ref($cond) eq 'ARRAY');
 
-	my @out;
-	for my $c (@$cond) {
-		push @out, OpenILS::Reporter::SQLBuilder::Input->new( $c )->set_builder( $builder );
-	}
+    my @out;
+    for my $c (@$cond) {
+        push @out, OpenILS::Reporter::SQLBuilder::Input->new( $c )->set_builder( $builder );
+    }
 
-	return \@out;
+    return \@out;
 }
 
 sub toSQL {
-	my $self = shift;
-
-	return $self->{_sql} if ($self->{_sql});
-
-	my $sql = '';
-
-	my $rel = $self->find_relation();
-	if ($rel && $rel->is_nullable) {
-		$sql = "((". $self->SUPER::toSQL .") IS NULL OR ";
-	}
-
-	$sql .= $self->SUPER::toSQL;
-
-	my ($op) = keys %{ $self->{_condition} };
-	my $val = _flesh_conditions( $self->resolve_param( $self->{_condition}->{$op} ), $self->builder );
-
-	if (lc($op) eq 'in') {
-		$sql .= " IN (". join(",", map { $_->toSQL } @$val).")";
-
-	} elsif (lc($op) eq 'not in') {
-		$sql .= " NOT IN (". join(",", map { $_->toSQL } @$val).")";
-
-	} elsif (lc($op) eq '= any') {
-		$val = $$val[0] if (ref($val) eq 'ARRAY');
-		$val = $val->toSQL;
-		if ($rel && $rel->is_nullable) { # need to redo this
-		    $sql = "((". $self->SUPER::toSQL .") IS NULL OR ";
-		} else {
-		    $sql = '';
-		}
-		$sql .= "$val = ANY (".$self->SUPER::toSQL.")";
-
-	} elsif (lc($op) eq '<> any') {
-		$val = $$val[0] if (ref($val) eq 'ARRAY');
-		$val = $val->toSQL;
-		if ($rel && $rel->is_nullable) { # need to redo this
-		    $sql = "((". $self->SUPER::toSQL .") IS NULL OR ";
-		} else {
-		    $sql = '';
-		}
-		$sql .= "$val <> ANY (".$self->SUPER::toSQL.")";
-
-	} elsif (lc($op) eq 'is blank') {
-		if ($rel && $rel->is_nullable) { # need to redo this
-		    $sql = "((". $self->SUPER::toSQL .") IS NULL OR ";
-		} else {
-		    $sql = '';
-		}
-		$sql .= '('. $self->SUPER::toSQL ." IS NULL OR ". $self->SUPER::toSQL ." = '')";
-
-	} elsif (lc($op) eq 'is not blank') {
-		if ($rel && $rel->is_nullable) { # need to redo this
-		    $sql = "((". $self->SUPER::toSQL .") IS NULL OR ";
-		} else {
-		    $sql = '';
-		}
-		$sql .= '('. $self->SUPER::toSQL ." IS NOT NULL AND ". $self->SUPER::toSQL ." <> '')";
-
-	} elsif (lc($op) eq 'between') {
-		$sql .= " BETWEEN ". join(" AND ", map { $_->toSQL } @$val);
-
-	} elsif (lc($op) eq 'not between') {
-		$sql .= " NOT BETWEEN ". join(" AND ", map { $_->toSQL } @$val);
-
-	} elsif (lc($op) eq 'like') {
-		$val = $$val[0] if (ref($val) eq 'ARRAY');
-		$val = $val->toSQL;
-		$val =~ s/^'(.*)'$/$1/o;
-		$val =~ s/%/\\\\%/o;
-		$val =~ s/_/\\\\_/o;
-		$sql .= " LIKE '\%$val\%'";
-
-	} elsif (lc($op) eq 'ilike') {
-		$val = $$val[0] if (ref($val) eq 'ARRAY');
-		$val = $val->toSQL;
-		$val =~ s/^'(.*)'$/$1/o;
-		$val =~ s/%/\\\\%/o;
-		$val =~ s/_/\\\\_/o;
-		$sql .= " ILIKE '\%$val\%'";
-
-	} else {
-		$val = $$val[0] if (ref($val) eq 'ARRAY');
-		$sql .= " $op " . $val->toSQL;
-	}
-
-	if ($rel && $rel->is_nullable) {
-		$sql .= ")";
-	}
-
-	return $self->{_sql} = $sql;
+    my $self = shift;
+
+    return $self->{_sql} if ($self->{_sql});
+
+    my $sql = '';
+
+    my $rel = $self->find_relation();
+    if ($rel && $rel->is_nullable) {
+        $sql = "((". $self->SUPER::toSQL .") IS NULL OR ";
+    }
+
+    $sql .= $self->SUPER::toSQL;
+
+    my ($op) = keys %{ $self->{_condition} };
+    my $val = _flesh_conditions( $self->resolve_param( $self->{_condition}->{$op} ), $self->builder );
+
+    if (lc($op) eq 'in') {
+        $sql .= " IN (". join(",", map { $_->toSQL } @$val).")";
+
+    } elsif (lc($op) eq 'not in') {
+        $sql .= " NOT IN (". join(",", map { $_->toSQL } @$val).")";
+
+    } elsif (lc($op) eq '= any') {
+        $val = $$val[0] if (ref($val) eq 'ARRAY');
+        $val = $val->toSQL;
+        if ($rel && $rel->is_nullable) { # need to redo this
+            $sql = "((". $self->SUPER::toSQL .") IS NULL OR ";
+        } else {
+            $sql = '';
+        }
+        $sql .= "$val = ANY (".$self->SUPER::toSQL.")";
+
+    } elsif (lc($op) eq '<> any') {
+        $val = $$val[0] if (ref($val) eq 'ARRAY');
+        $val = $val->toSQL;
+        if ($rel && $rel->is_nullable) { # need to redo this
+            $sql = "((". $self->SUPER::toSQL .") IS NULL OR ";
+        } else {
+            $sql = '';
+        }
+        $sql .= "$val <> ANY (".$self->SUPER::toSQL.")";
+
+    } elsif (lc($op) eq 'is blank') {
+        if ($rel && $rel->is_nullable) { # need to redo this
+            $sql = "((". $self->SUPER::toSQL .") IS NULL OR ";
+        } else {
+            $sql = '';
+        }
+        $sql .= '('. $self->SUPER::toSQL ." IS NULL OR ". $self->SUPER::toSQL ." = '')";
+
+    } elsif (lc($op) eq 'is not blank') {
+        if ($rel && $rel->is_nullable) { # need to redo this
+            $sql = "((". $self->SUPER::toSQL .") IS NULL OR ";
+        } else {
+            $sql = '';
+        }
+        $sql .= '('. $self->SUPER::toSQL ." IS NOT NULL AND ". $self->SUPER::toSQL ." <> '')";
+
+    } elsif (lc($op) eq 'between') {
+        $sql .= " BETWEEN ". join(" AND ", map { $_->toSQL } @$val);
+
+    } elsif (lc($op) eq 'not between') {
+        $sql .= " NOT BETWEEN ". join(" AND ", map { $_->toSQL } @$val);
+
+    } elsif (lc($op) eq 'like') {
+        $val = $$val[0] if (ref($val) eq 'ARRAY');
+        $val = $val->toSQL;
+        $val =~ s/^'(.*)'$/$1/o;
+        $val =~ s/%/\\\\%/o;
+        $val =~ s/_/\\\\_/o;
+        $sql .= " LIKE '\%$val\%'";
+
+    } elsif (lc($op) eq 'ilike') {
+        $val = $$val[0] if (ref($val) eq 'ARRAY');
+        $val = $val->toSQL;
+        $val =~ s/^'(.*)'$/$1/o;
+        $val =~ s/%/\\\\%/o;
+        $val =~ s/_/\\\\_/o;
+        $sql .= " ILIKE '\%$val\%'";
+
+    } else {
+        $val = $$val[0] if (ref($val) eq 'ARRAY');
+        $sql .= " $op " . $val->toSQL;
+    }
+
+    if ($rel && $rel->is_nullable) {
+        $sql .= ")";
+    }
+
+    return $self->{_sql} = $sql;
 }
 
 
@@ -1023,90 +1023,90 @@ package OpenILS::Reporter::SQLBuilder::Relation;
 use base qw/OpenILS::Reporter::SQLBuilder/;
 
 sub parse {
-	my $self = shift;
-	$self = $self->SUPER::new if (!ref($self));
+    my $self = shift;
+    $self = $self->SUPER::new if (!ref($self));
 
-	my $rel_data = shift;
-	my $b = shift;
-	$self->set_builder($b);
+    my $rel_data = shift;
+    my $b = shift;
+    $self->set_builder($b);
 
-	$self->{_table} = $rel_data->{table};
-	$self->{_alias} = $rel_data->{alias} || $self->{_table};
-	$self->{_join} = [];
-	$self->{_columns} = [];
+    $self->{_table} = $rel_data->{table};
+    $self->{_alias} = $rel_data->{alias} || $self->{_table};
+    $self->{_join} = [];
+    $self->{_columns} = [];
 
-	$self->builder->{_rels}{$self->{_alias}} = $self;
+    $self->builder->{_rels}{$self->{_alias}} = $self;
 
-	if ($rel_data->{join}) {
-		$self->add_join(
-			$_ => OpenILS::Reporter::SQLBuilder::Relation->parse( $rel_data->{join}->{$_}, $b ) => $rel_data->{join}->{$_}->{key} => $rel_data->{join}->{$_}->{type}
-		) for ( keys %{ $rel_data->{join} } );
-	}
+    if ($rel_data->{join}) {
+        $self->add_join(
+            $_ => OpenILS::Reporter::SQLBuilder::Relation->parse( $rel_data->{join}->{$_}, $b ) => $rel_data->{join}->{$_}->{key} => $rel_data->{join}->{$_}->{type}
+        ) for ( keys %{ $rel_data->{join} } );
+    }
 
-	return $self;
+    return $self;
 }
 
 sub add_column {
-	my $self = shift;
-	my $col = shift;
-	
-	push @{ $self->{_columns} }, $col;
+    my $self = shift;
+    my $col = shift;
+    
+    push @{ $self->{_columns} }, $col;
 }
 
 sub find_column {
-	my $self = shift;
-	my $col = shift;
-	return (grep { $_->name eq $col} @{ $self->{_columns} })[0];
+    my $self = shift;
+    my $col = shift;
+    return (grep { $_->name eq $col} @{ $self->{_columns} })[0];
 }
 
 sub add_join {
-	my $self = shift;
-	my $col = shift;
-	my $frel = shift;
-	my $fkey = shift;
-	my $type = lc(shift()) || 'inner';
+    my $self = shift;
+    my $col = shift;
+    my $frel = shift;
+    my $fkey = shift;
+    my $type = lc(shift()) || 'inner';
 
-	if (UNIVERSAL::isa($col,'OpenILS::Reporter::SQLBuilder::Join')) {
-		push @{ $self->{_join} }, $col;
-	} else {
-		push @{ $self->{_join} }, OpenILS::Reporter::SQLBuilder::Join->build( $self => $col, $frel => $fkey, $type );
-	}
+    if (UNIVERSAL::isa($col,'OpenILS::Reporter::SQLBuilder::Join')) {
+        push @{ $self->{_join} }, $col;
+    } else {
+        push @{ $self->{_join} }, OpenILS::Reporter::SQLBuilder::Join->build( $self => $col, $frel => $fkey, $type );
+    }
 
-	return $self;
+    return $self;
 }
 
 sub is_nullable {
-	my $self = shift;
-	return $self->{_nullable};
+    my $self = shift;
+    return $self->{_nullable};
 }
 
 sub is_join {
-	my $self = shift;
-	my $j = shift;
-	$self->{_is_join} = $j if ($j);
-	return $self->{_is_join};
+    my $self = shift;
+    my $j = shift;
+    $self->{_is_join} = $j if ($j);
+    return $self->{_is_join};
 }
 
 sub join_type {
-	my $self = shift;
-	my $j = shift;
-	$self->{_join_type} = $j if ($j);
-	return $self->{_join_type};
+    my $self = shift;
+    my $j = shift;
+    $self->{_join_type} = $j if ($j);
+    return $self->{_join_type};
 }
 
 sub toSQL {
-	my $self = shift;
-	return $self->{_sql} if ($self->{_sql});
+    my $self = shift;
+    return $self->{_sql} if ($self->{_sql});
 
-	my $sql = $self->{_table} .' AS "'. $self->{_alias} .'"';
+    my $sql = $self->{_table} .' AS "'. $self->{_alias} .'"';
 
-	if (!$self->is_join) {
-		for my $j ( @{ $self->{_join} } ) {
-			$sql .= $j->toSQL;
-		}
-	}
+    if (!$self->is_join) {
+        for my $j ( @{ $self->{_join} } ) {
+            $sql .= $j->toSQL;
+        }
+    }
 
-	return $self->{_sql} = $sql;
+    return $self->{_sql} = $sql;
 }
 
 #-------------------------------------------------------------------------------------------------
@@ -1114,51 +1114,51 @@ package OpenILS::Reporter::SQLBuilder::Join;
 use base qw/OpenILS::Reporter::SQLBuilder/;
 
 sub build {
-	my $class = shift;
-	my $self = $class->SUPER::new if (!ref($class));
+    my $class = shift;
+    my $self = $class->SUPER::new if (!ref($class));
 
-	$self->{_left_rel} = shift;
-	($self->{_left_col}) = split(/-/,shift());
+    $self->{_left_rel} = shift;
+    ($self->{_left_col}) = split(/-/,shift());
 
-	$self->{_right_rel} = shift;
-	$self->{_right_col} = shift;
+    $self->{_right_rel} = shift;
+    $self->{_right_col} = shift;
 
-	$self->{_join_type} = shift;
+    $self->{_join_type} = shift;
 
-	$self->{_right_rel}->set_builder($self->{_left_rel}->builder);
+    $self->{_right_rel}->set_builder($self->{_left_rel}->builder);
 
-	$self->{_right_rel}->is_join(1);
-	$self->{_right_rel}->join_type($self->{_join_type});
+    $self->{_right_rel}->is_join(1);
+    $self->{_right_rel}->join_type($self->{_join_type});
 
-	bless $self => "OpenILS::Reporter::SQLBuilder::Join::$self->{_join_type}";
+    bless $self => "OpenILS::Reporter::SQLBuilder::Join::$self->{_join_type}";
 
-	if ( $self->{_join_type} eq 'inner' or !$self->{_join_type}) {
-		$self->{_join_type} = 'i';
-	} else {
-		if ($self->{_join_type} eq 'left') {
-			$self->{_right_rel}->{_nullable} = 'l';
-		} elsif ($self->{_join_type} eq 'right') {
-			$self->{_left_rel}->{_nullable} = 'r';
-		} else {
-			$self->{_right_rel}->{_nullable} = 'f';
-			$self->{_left_rel}->{_nullable} = 'f';
-		}
-	}
+    if ( $self->{_join_type} eq 'inner' or !$self->{_join_type}) {
+        $self->{_join_type} = 'i';
+    } else {
+        if ($self->{_join_type} eq 'left') {
+            $self->{_right_rel}->{_nullable} = 'l';
+        } elsif ($self->{_join_type} eq 'right') {
+            $self->{_left_rel}->{_nullable} = 'r';
+        } else {
+            $self->{_right_rel}->{_nullable} = 'f';
+            $self->{_left_rel}->{_nullable} = 'f';
+        }
+    }
 
-	return $self;
+    return $self;
 }
 
 sub toSQL {
-	my $self = shift;
-	my $dir = shift;
+    my $self = shift;
+    my $dir = shift;
 
-	my $sql = "JOIN " . $self->{_right_rel}->toSQL .
-		' ON ("' . $self->{_left_rel}->{_alias} . '"."' . $self->{_left_col} .
-		'" = "' . $self->{_right_rel}->{_alias} . '"."' . $self->{_right_col} . '")';
+    my $sql = "JOIN " . $self->{_right_rel}->toSQL .
+        ' ON ("' . $self->{_left_rel}->{_alias} . '"."' . $self->{_left_col} .
+        '" = "' . $self->{_right_rel}->{_alias} . '"."' . $self->{_right_col} . '")';
 
-	$sql .= $_->toSQL($dir) for (@{ $self->{_right_rel}->{_join} });
+    $sql .= $_->toSQL($dir) for (@{ $self->{_right_rel}->{_join} });
 
-	return $sql;
+    return $sql;
 }
 
 #-------------------------------------------------------------------------------------------------
@@ -1166,17 +1166,17 @@ package OpenILS::Reporter::SQLBuilder::Join::left;
 use base qw/OpenILS::Reporter::SQLBuilder::Join/;
 
 sub toSQL {
-	my $self = shift;
-	my $dir = shift;
-	#return $self->{_sql} if ($self->{_sql});
+    my $self = shift;
+    my $dir = shift;
+    #return $self->{_sql} if ($self->{_sql});
 
-	my $j = $dir && $dir eq 'r' ? 'FULL OUTER' : 'LEFT OUTER';
+    my $j = $dir && $dir eq 'r' ? 'FULL OUTER' : 'LEFT OUTER';
 
-	my $sql = "\n\t$j ". $self->SUPER::toSQL('l');
+    my $sql = "\n\t$j ". $self->SUPER::toSQL('l');
 
-	#$sql .= $_->toSQL for (@{ $self->{_right_rel}->{_join} });
+    #$sql .= $_->toSQL for (@{ $self->{_right_rel}->{_join} });
 
-	return $self->{_sql} = $sql;
+    return $self->{_sql} = $sql;
 }
 
 #-------------------------------------------------------------------------------------------------
@@ -1184,21 +1184,21 @@ package OpenILS::Reporter::SQLBuilder::Join::right;
 use base qw/OpenILS::Reporter::SQLBuilder::Join/;
 
 sub toSQL {
-	my $self = shift;
-	my $dir = shift;
-	#return $self->{_sql} if ($self->{_sql});
+    my $self = shift;
+    my $dir = shift;
+    #return $self->{_sql} if ($self->{_sql});
 
-	my $_nullable_rel = $dir && $dir eq 'l' ? '_right_rel' : '_left_rel';
-	$self->{_left_rel}->{_nullable} = 'r';
-	$self->{$_nullable_rel}->{_nullable} = $dir;
+    my $_nullable_rel = $dir && $dir eq 'l' ? '_right_rel' : '_left_rel';
+    $self->{_left_rel}->{_nullable} = 'r';
+    $self->{$_nullable_rel}->{_nullable} = $dir;
 
-	my $j = $dir && $dir eq 'l' ? 'FULL OUTER' : 'RIGHT OUTER';
+    my $j = $dir && $dir eq 'l' ? 'FULL OUTER' : 'RIGHT OUTER';
 
-	my $sql = "\n\t$j ". $self->SUPER::toSQL('r');
+    my $sql = "\n\t$j ". $self->SUPER::toSQL('r');
 
-	#$sql .= $_->toSQL for (@{ $self->{_right_rel}->{_join} });
+    #$sql .= $_->toSQL for (@{ $self->{_right_rel}->{_join} });
 
-	return $self->{_sql} = $sql;
+    return $self->{_sql} = $sql;
 }
 
 #-------------------------------------------------------------------------------------------------
@@ -1206,20 +1206,20 @@ package OpenILS::Reporter::SQLBuilder::Join::inner;
 use base qw/OpenILS::Reporter::SQLBuilder::Join/;
 
 sub toSQL {
-	my $self = shift;
-	my $dir = shift;
-	#return $self->{_sql} if ($self->{_sql});
+    my $self = shift;
+    my $dir = shift;
+    #return $self->{_sql} if ($self->{_sql});
 
-	my $_nullable_rel = $dir && $dir eq 'l' ? '_right_rel' : '_left_rel';
-	$self->{$_nullable_rel}->{_nullable} = $dir;
+    my $_nullable_rel = $dir && $dir eq 'l' ? '_right_rel' : '_left_rel';
+    $self->{$_nullable_rel}->{_nullable} = $dir;
 
-	my $j = $dir ? ( $dir eq 'l' ? 'LEFT OUTER' : ( $dir eq 'r' ? 'RIGHT OUTER' : 'FULL OUTER' ) ) : 'INNER';
+    my $j = $dir ? ( $dir eq 'l' ? 'LEFT OUTER' : ( $dir eq 'r' ? 'RIGHT OUTER' : 'FULL OUTER' ) ) : 'INNER';
 
-	my $sql = "\n\t$j ". $self->SUPER::toSQL;
+    my $sql = "\n\t$j ". $self->SUPER::toSQL;
 
-	#$sql .= $_->toSQL for (@{ $self->{_right_rel}->{_join} });
+    #$sql .= $_->toSQL for (@{ $self->{_right_rel}->{_join} });
 
-	return $self->{_sql} = $sql;
+    return $self->{_sql} = $sql;
 }
 
 #-------------------------------------------------------------------------------------------------
@@ -1227,17 +1227,17 @@ package OpenILS::Reporter::SQLBuilder::Join::cross;
 use base qw/OpenILS::Reporter::SQLBuilder::Join/;
 
 sub toSQL {
-	my $self = shift;
-	#return $self->{_sql} if ($self->{_sql});
+    my $self = shift;
+    #return $self->{_sql} if ($self->{_sql});
 
-	$self->{_right_rel}->{_nullable} = 'f';
-	$self->{_left_rel}->{_nullable} = 'f';
+    $self->{_right_rel}->{_nullable} = 'f';
+    $self->{_left_rel}->{_nullable} = 'f';
 
-	my $sql = "\n\tFULL OUTER ". $self->SUPER::toSQL('f');
+    my $sql = "\n\tFULL OUTER ". $self->SUPER::toSQL('f');
 
-	#$sql .= $_->toSQL for (@{ $self->{_right_rel}->{_join} });
+    #$sql .= $_->toSQL for (@{ $self->{_right_rel}->{_join} });
 
-	return $self->{_sql} = $sql;
+    return $self->{_sql} = $sql;
 }
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Item.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Item.pm
index 69787e6..59e97d0 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Item.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Item.pm
@@ -83,23 +83,23 @@ sub new {
     my $e = OpenILS::SIP->editor();
 
     my $copy = $e->search_asset_copy(
-		[
-			{ barcode => $item_id, deleted => 'f' },
-			{
-				flesh => 3,
-				flesh_fields => {
-					acp => [ 'circ_lib', 'call_number', 'status', 'stat_cat_entry_copy_maps' ],
-					acn => [ 'owning_lib', 'record' ],
+        [
+            { barcode => $item_id, deleted => 'f' },
+            {
+                flesh => 3,
+                flesh_fields => {
+                    acp => [ 'circ_lib', 'call_number', 'status', 'stat_cat_entry_copy_maps' ],
+                    acn => [ 'owning_lib', 'record' ],
                     ascecm => [ 'stat_cat', 'stat_cat_entry' ],
-				}
-			}
-		]
+                }
+            }
+        ]
     )->[0];
 
-	if(!$copy) {
-		syslog("LOG_DEBUG", "OILS: Item '%s' : not found", $item_id);
-		return undef;
-	}
+    if(!$copy) {
+        syslog("LOG_DEBUG", "OILS: Item '%s' : not found", $item_id);
+        return undef;
+    }
 
     my $circ = $e->search_action_circulation([
         {
@@ -241,9 +241,9 @@ sub fetch_hold {
 }
 
 sub run_attr_script {
-	my $self = shift;
-	return 1 if $self->{ran_script};
-	$self->{ran_script} = 1;
+    my $self = shift;
+    return 1 if $self->{ran_script};
+    $self->{ran_script} = 1;
 
     if($self->{legacy_script_support}){
 
@@ -291,7 +291,7 @@ sub run_attr_script {
         $self->{item_config_result} = { item_config => $config };
     }
 
-	return 1;
+    return 1;
 }
 
 sub magnetic_media {
@@ -380,8 +380,8 @@ sub fee {
 
 
 sub fee_currency {
-	my $self = shift;
-	return OpenILS::SIP->config()->{implementation_config}->{currency};
+    my $self = shift;
+    return OpenILS::SIP->config()->{implementation_config}->{currency};
 }
 
 sub owner {
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction.pm
index 5ef185d..729182e 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction.pm
@@ -36,37 +36,37 @@ sub new {
 
     my $self = { _permitted => \%fields, %fields };
 
-	bless $self, $class;
-	$self->authtoken($args{authtoken});
+    bless $self, $class;
+    $self->authtoken($args{authtoken});
 
-	syslog('LOG_DEBUG', "OILS: Created new transaction with authtoken %s", $self->authtoken);
+    syslog('LOG_DEBUG', "OILS: Created new transaction with authtoken %s", $self->authtoken);
 
-	my $e = OpenILS::SIP->editor();
-	$e->{authtoken} = $self->authtoken;
+    my $e = OpenILS::SIP->editor();
+    $e->{authtoken} = $self->authtoken;
 
-	return $self;
+    return $self;
 }
 
 sub DESTROY { 
-	# be cool
+    # be cool
 }
 
 sub AUTOLOAD {
-	my $self = shift;
-	my $class = ref($self) or croak "$self is not an object";
-	my $name = $AUTOLOAD;
+    my $self = shift;
+    my $class = ref($self) or croak "$self is not an object";
+    my $name = $AUTOLOAD;
 
-	$name =~ s/.*://;
+    $name =~ s/.*://;
 
-	unless (exists $self->{_permitted}->{$name}) {
-		croak "Can't access '$name' field of class '$class'";
-	}
+    unless (exists $self->{_permitted}->{$name}) {
+        croak "Can't access '$name' field of class '$class'";
+    }
 
-	if (@_) {
-		return $self->{$name} = shift;
-	} else {
-		return $self->{$name};
-	}
+    if (@_) {
+        return $self->{$name} = shift;
+    } else {
+        return $self->{$name};
+    }
 }
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/Checkout.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/Checkout.pm
index ab8d17a..5b91445 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/Checkout.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/Checkout.pm
@@ -22,9 +22,9 @@ our @ISA = qw(OpenILS::SIP::Transaction);
 
 # Most fields are handled by the Transaction superclass
 my %fields = (
-	      security_inhibit => 0,
-	      due              => undef,
-	      renew_ok         => 0,
+          security_inhibit => 0,
+          due              => undef,
+          renew_ok         => 0,
              );
 
 sub new {
@@ -69,8 +69,8 @@ sub do_checkout {
     $self->ok(0);
 
     my $args = {
-		barcode => $self->{item}->id,
-		patron_barcode => $self->{patron}->id
+        barcode => $self->{item}->id,
+        patron_barcode => $self->{patron}->id
                };
 
     my ($resp, $method);
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/Renew.pm b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/Renew.pm
index d4d7f49..dceaec1 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/Renew.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/SIP/Transaction/Renew.pm
@@ -14,41 +14,41 @@ my $U = 'OpenILS::Application::AppUtils';
 our @ISA = qw(OpenILS::SIP::Transaction);
 
 my %fields = (
-	      renewal_ok => 0,
-	      );
+          renewal_ok => 0,
+          );
 
 sub new {
-	my $class = shift;;
-	my $self = $class->SUPER::new(@_);
+    my $class = shift;;
+    my $self = $class->SUPER::new(@_);
 
-	$self->{_permitted}->{$_} = $fields{$_} for keys %fields;
-	@{$self}{keys %fields} = values %fields;
+    $self->{_permitted}->{$_} = $fields{$_} for keys %fields;
+    @{$self}{keys %fields} = values %fields;
 
-	return bless $self, $class;
+    return bless $self, $class;
 }
 
 sub do_renew {
-	my $self = shift;
+    my $self = shift;
 
-	my $resp = $U->simplereq(
-		'open-ils.circ',
-		'open-ils.circ.renew', $self->{authtoken},
-		{ barcode => $self->item->id, patron_barcode => $self->patron->id });
+    my $resp = $U->simplereq(
+        'open-ils.circ',
+        'open-ils.circ.renew', $self->{authtoken},
+        { barcode => $self->item->id, patron_barcode => $self->patron->id });
 
-	if( my $code = $U->event_code($resp) ) {
-		syslog('LOG_INFO', "OILS: Renewal failed with event $code : " . $resp->{textcode});
-		$self->renewal_ok(0);
-		$self->ok(0);
-		return $self;
-	}
+    if( my $code = $U->event_code($resp) ) {
+        syslog('LOG_INFO', "OILS: Renewal failed with event $code : " . $resp->{textcode});
+        $self->renewal_ok(0);
+        $self->ok(0);
+        return $self;
+    }
 
-	$self->item->{due_date} = $resp->{payload}->{circ}->due_date;
-	syslog('LOG_INFO', "OILS: Renewal succeeded with due_date = " . $self->item->{due_date});
+    $self->item->{due_date} = $resp->{payload}->{circ}->due_date;
+    syslog('LOG_INFO', "OILS: Renewal succeeded with due_date = " . $self->item->{due_date});
 
-	$self->renewal_ok(1);
-	$self->ok(1);
+    $self->renewal_ok(1);
+    $self->ok(1);
 
-	return $self;
+    return $self;
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Template/Plugin/WebSession.pm b/Open-ILS/src/perlmods/lib/OpenILS/Template/Plugin/WebSession.pm
index ace78c0..127dbfe 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Template/Plugin/WebSession.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Template/Plugin/WebSession.pm
@@ -8,25 +8,25 @@ use OpenSRF::AppSession;
 use OpenSRF::System;
 
 sub new {
-	my ($class) = @_;
-	$class = ref($class) || $class;
-	my $self = {};
-	return bless($self,$class);
+    my ($class) = @_;
+    $class = ref($class) || $class;
+    my $self = {};
+    return bless($self,$class);
 }
-	
+    
 my $bootstrapped = 0;
 sub bootstrap_client {
-	my( $self, $config_file ) = @_;
-	if(!$bootstrapped) {
-		OpenSRF::System->bootstrap_client( config_file => $config_file );
-		$bootstrapped = 1;
-	}
+    my( $self, $config_file ) = @_;
+    if(!$bootstrapped) {
+        OpenSRF::System->bootstrap_client( config_file => $config_file );
+        $bootstrapped = 1;
+    }
 }
 
 sub init_app_session {
-	my($self, $service) = @_;
-	return undef unless $service;
-	return OpenSRF::AppSession->create($service);
+    my($self, $service) = @_;
+    return undef unless $service;
+    return OpenSRF::AppSession->create($service);
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Template/Plugin/WebUtils.pm b/Open-ILS/src/perlmods/lib/OpenILS/Template/Plugin/WebUtils.pm
index 050aee2..5cbd336 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Template/Plugin/WebUtils.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Template/Plugin/WebUtils.pm
@@ -11,37 +11,37 @@ use OpenSRF::Utils::SettingsParser;
 use OpenSRF::Utils::JSON;
 
 sub new {
-	my ($class) = @_;
-	$class = ref($class) || $class;
-	my $self = {};
-	return bless($self,$class);
+    my ($class) = @_;
+    $class = ref($class) || $class;
+    my $self = {};
+    return bless($self,$class);
 }
-	
+    
 
 sub XML2perl {
-	my( $self, $doc ) = @_;
-	return OpenSRF::Utils::SettingsParser::XML2perl($doc);
+    my( $self, $doc ) = @_;
+    return OpenSRF::Utils::SettingsParser::XML2perl($doc);
 }
 
 
 sub perl2JSON {
-	my( $self, $perl ) = @_;
-	my $json = OpenSRF::Utils::JSON->perl2JSON($perl);
-	warn "Created JSON from perl:\n$json\n";
-	return $json;
+    my( $self, $perl ) = @_;
+    my $json = OpenSRF::Utils::JSON->perl2JSON($perl);
+    warn "Created JSON from perl:\n$json\n";
+    return $json;
 }
-	
+    
 sub JSON2perl {
-	my( $self, $perl ) = @_;
-	warn "Turning JSON into perl:\n$perl\n";
-	my $obj = OpenSRF::Utils::JSON->JSON2perl($perl);
-	warn "Created Perl from JSON: $obj \n";
-	return $obj;
+    my( $self, $perl ) = @_;
+    warn "Turning JSON into perl:\n$perl\n";
+    my $obj = OpenSRF::Utils::JSON->JSON2perl($perl);
+    warn "Created Perl from JSON: $obj \n";
+    return $obj;
 }
 
 sub perl2prettyJSON {
-	my( $self, $perl ) = @_;
-	return OpenSRF::Utils::JSON->perl2prettyJSON($perl);
+    my( $self, $perl ) = @_;
+    return OpenSRF::Utils::JSON->perl2prettyJSON($perl);
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm
index 0a70648..4ad858f 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm
@@ -22,10 +22,10 @@ our $always_xact = 0;
 our $_loaded = 1;
 
 #my %PERMS = (
-#	'biblio.record_entry'	=> { update => 'UPDATE_MARC' },
-#	'asset.copy'				=> { update => 'UPDATE_COPY'},
-#	'asset.call_number'		=> { update => 'UPDATE_VOLUME'},
-#	'action.circulation'		=> { retrieve => 'VIEW_CIRCULATIONS'},
+#   'biblio.record_entry'   => { update => 'UPDATE_MARC' },
+#   'asset.copy'                => { update => 'UPDATE_COPY'},
+#   'asset.call_number'     => { update => 'UPDATE_VOLUME'},
+#   'action.circulation'        => { retrieve => 'VIEW_CIRCULATIONS'},
 #);
 
 sub flush_forced_xacts {
@@ -51,9 +51,9 @@ push @EXPORT_OK, ( 'new_editor', 'new_rstore_editor' );
 sub new_editor { return OpenILS::Utils::CStoreEditor->new(@_); }
 
 sub new_rstore_editor { 
-	my $e = OpenILS::Utils::CStoreEditor->new(@_); 
-	$e->app('open-ils.reporter-store');
-	return $e;
+    my $e = OpenILS::Utils::CStoreEditor->new(@_); 
+    $e->app('open-ils.reporter-store');
+    return $e;
 }
 
 
@@ -70,15 +70,15 @@ use constant A => 'activity';
 
 # -----------------------------------------------------------------------------
 # Params include:
-#	xact=><true> : creates a storage transaction
-#	authtoken=>$token : the login session key
+#   xact=><true> : creates a storage transaction
+#   authtoken=>$token : the login session key
 # -----------------------------------------------------------------------------
 sub new {
-	my( $class, %params ) = @_;
-	$class = ref($class) || $class;
-	my $self = bless( \%params, $class );
-	$self->{checked_perms} = {};
-	return $self;
+    my( $class, %params ) = @_;
+    $class = ref($class) || $class;
+    my $self = bless( \%params, $class );
+    $self->{checked_perms} = {};
+    return $self;
 }
 
 sub DESTROY {
@@ -88,10 +88,10 @@ sub DESTROY {
 }
 
 sub app {
-	my( $self, $app ) = @_;
-	$self->{app} = $app if $app;
-	$self->{app} = 'open-ils.cstore' unless $self->{app};
-	return $self->{app};
+    my( $self, $app ) = @_;
+    $self->{app} = $app if $app;
+    $self->{app} = 'open-ils.cstore' unless $self->{app};
+    return $self->{app};
 }
 
 
@@ -99,31 +99,31 @@ sub app {
 # Log the editor metadata along with the log string
 # -----------------------------------------------------------------------------
 sub log {
-	my( $self, $lev, $str ) = @_;
-	my $s = "editor[";
+    my( $self, $lev, $str ) = @_;
+    my $s = "editor[";
     if ($always_xact) {
         $s .= "!|";
     } elsif ($self->{xact}) {
         $s .= "1|";
     } else {
-	    $s .= "0|";
+        $s .= "0|";
     }
-	$s .= "0" unless $self->requestor;
-	$s .= $self->requestor->id if $self->requestor;
-	$s .= "]";
-	$logger->$lev("$s $str");
+    $s .= "0" unless $self->requestor;
+    $s .= $self->requestor->id if $self->requestor;
+    $s .= "]";
+    $logger->$lev("$s $str");
 }
 
 # -----------------------------------------------------------------------------
 # Verifies the auth token and fetches the requestor object
 # -----------------------------------------------------------------------------
 sub checkauth {
-	my $self = shift;
-	$self->log(D, "checking auth token ".$self->authtoken);
+    my $self = shift;
+    $self->log(D, "checking auth token ".$self->authtoken);
 
-	my $content = $U->simplereq( 
-		'open-ils.auth', 
-		'open-ils.auth.session.retrieve', $self->authtoken, 1);
+    my $content = $U->simplereq( 
+        'open-ils.auth', 
+        'open-ils.auth.session.retrieve', $self->authtoken, 1);
 
     if(!$content or $U->event_code($content)) {
         $self->event( ($content) ? $content : OpenILS::Event->new('NO_SESSION'));
@@ -131,19 +131,19 @@ sub checkauth {
     }
 
     $self->{authtime} = $content->{authtime};
-	return $self->{requestor} = $content->{userobj};
+    return $self->{requestor} = $content->{userobj};
 }
 
 =head1 test
 
 sub checkauth {
-	my $self = shift;
-	$cache = OpenSRF::Utils::Cache->new('global') unless $cache;
-	$self->log(D, "checking cached auth token ".$self->authtoken);
-	my $user = $cache->get_cache("oils_auth_".$self->authtoken);
-	return $self->{requestor} = $user->{userobj} if $user;
-	$self->event(OpenILS::Event->new('NO_SESSION'));
-	return undef;
+    my $self = shift;
+    $cache = OpenSRF::Utils::Cache->new('global') unless $cache;
+    $self->log(D, "checking cached auth token ".$self->authtoken);
+    my $user = $cache->get_cache("oils_auth_".$self->authtoken);
+    return $self->{requestor} = $user->{userobj} if $user;
+    $self->event(OpenILS::Event->new('NO_SESSION'));
+    return undef;
 }
 
 =cut
@@ -153,9 +153,9 @@ sub checkauth {
 # Returns the last generated event
 # -----------------------------------------------------------------------------
 sub event {
-	my( $self, $evt ) = @_;
-	$self->{event} = $evt if $evt;
-	return $self->{event};
+    my( $self, $evt ) = @_;
+    $self->{event} = $evt if $evt;
+    return $self->{event};
 }
 
 # -----------------------------------------------------------------------------
@@ -163,12 +163,12 @@ sub event {
 # then returns the last event that occurred
 # -----------------------------------------------------------------------------
 sub die_event {
-	my $self = shift;
+    my $self = shift;
     my $evt = shift;
-	$self->rollback;
+    $self->rollback;
     $self->died(1);
     $self->event($evt);
-	return $self->event;
+    return $self->event;
 }
 
 
@@ -176,8 +176,8 @@ sub die_event {
 # Clears the last caught event
 # -----------------------------------------------------------------------------
 sub clear_event {
-	my $self = shift;
-	$self->{event} = undef;
+    my $self = shift;
+    $self->{event} = undef;
 }
 
 sub died {
@@ -187,15 +187,15 @@ sub died {
 }
 
 sub authtoken {
-	my( $self, $auth ) = @_;
-	$self->{authtoken} = $auth if $auth;
-	return $self->{authtoken};
+    my( $self, $auth ) = @_;
+    $self->{authtoken} = $auth if $auth;
+    return $self->{authtoken};
 }
 
 sub authtime {
-	my( $self, $auth ) = @_;
-	$self->{authtime} = $auth if $auth;
-	return $self->{authtime};
+    my( $self, $auth ) = @_;
+    $self->{authtime} = $auth if $auth;
+    return $self->{authtime};
 }
 
 sub timeout {
@@ -209,33 +209,33 @@ sub timeout {
 # object, a db session is created
 # -----------------------------------------------------------------------------
 sub session {
-	my( $self, $session ) = @_;
-	$self->{session} = $session if $session;
-
-	# sessions can stick around longer than a single request/transaction.
-	# kill it if our default locale was altered since the last request
-	# and it does not match the locale of the existing session.
-	delete $self->{session} if
-		$default_locale and
-		$self->{session} and
-		$self->{session}->session_locale ne $default_locale;
-
-	if(!$self->{session}) {
-		$self->{session} = OpenSRF::AppSession->create($self->app);
-		$self->{session}->session_locale($default_locale) if $default_locale;
-
-		if( ! $self->{session} ) {
-			my $str = "Error creating cstore session with OpenSRF::AppSession->create()!";
-			$self->log(E, $str);
-			throw OpenSRF::EX::ERROR ($str);
-		}
-
-		$self->{session}->connect if $self->{xact} or $self->{connect} or $always_xact;
-		$self->xact_begin if $self->{xact} or $always_xact;
-	}
+    my( $self, $session ) = @_;
+    $self->{session} = $session if $session;
+
+    # sessions can stick around longer than a single request/transaction.
+    # kill it if our default locale was altered since the last request
+    # and it does not match the locale of the existing session.
+    delete $self->{session} if
+        $default_locale and
+        $self->{session} and
+        $self->{session}->session_locale ne $default_locale;
+
+    if(!$self->{session}) {
+        $self->{session} = OpenSRF::AppSession->create($self->app);
+        $self->{session}->session_locale($default_locale) if $default_locale;
+
+        if( ! $self->{session} ) {
+            my $str = "Error creating cstore session with OpenSRF::AppSession->create()!";
+            $self->log(E, $str);
+            throw OpenSRF::EX::ERROR ($str);
+        }
+
+        $self->{session}->connect if $self->{xact} or $self->{connect} or $always_xact;
+        $self->xact_begin if $self->{xact} or $always_xact;
+    }
 
     $xact_ed_cache{$self->{xact_id}} = $self if $always_xact and $self->{xact_id};
-	return $self->{session};
+    return $self->{session};
 }
 
 
@@ -246,10 +246,10 @@ sub xact_begin {
     my $self = shift;
     return $self->{xact_id} if $self->{xact_id};
     $self->session->connect unless $self->session->state == OpenSRF::AppSession::CONNECTED();
-	$self->log(D, "starting new database transaction");
-	unless($self->{xact_id}) {
-	    my $stat = $self->request($self->app . '.transaction.begin');
-	    $self->log(E, "error starting database transaction") unless $stat;
+    $self->log(D, "starting new database transaction");
+    unless($self->{xact_id}) {
+        my $stat = $self->request($self->app . '.transaction.begin');
+        $self->log(E, "error starting database transaction") unless $stat;
         $self->{xact_id} = $stat;
         if($self->authtoken) {
             if(!$self->requestor) {
@@ -272,28 +272,28 @@ sub xact_begin {
 # Commits a storage transaction
 # -----------------------------------------------------------------------------
 sub xact_commit {
-	my $self = shift;
+    my $self = shift;
     return unless $self->{xact_id};
-	$self->log(D, "comitting db session");
-	my $stat = $self->request($self->app.'.transaction.commit');
-	$self->log(E, "error comitting database transaction") unless $stat;
+    $self->log(D, "comitting db session");
+    my $stat = $self->request($self->app.'.transaction.commit');
+    $self->log(E, "error comitting database transaction") unless $stat;
     delete $self->{xact_id};
     delete $self->{xact};
-	return $stat;
+    return $stat;
 }
 
 # -----------------------------------------------------------------------------
 # Rolls back a storage stransaction
 # -----------------------------------------------------------------------------
 sub xact_rollback {
-	my $self = shift;
+    my $self = shift;
     return unless $self->{session} and $self->{xact_id};
-	$self->log(I, "rolling back db session");
-	my $stat = $self->request($self->app.".transaction.rollback");
-	$self->log(E, "error rolling back database transaction") unless $stat;
+    $self->log(I, "rolling back db session");
+    my $stat = $self->request($self->app.".transaction.rollback");
+    $self->log(E, "error rolling back database transaction") unless $stat;
     delete $self->{xact_id};
     delete $self->{xact};
-	return $stat;
+    return $stat;
 }
 
 
@@ -306,9 +306,9 @@ sub set_savepoint {
     my $self = shift;
     my $name = shift || 'savepoint';
     return unless $self->{session} and $self->{xact_id};
-	$self->log(I, "setting savepoint '$name'");
-	my $stat = $self->request($self->app.".savepoint.set", $name)
-	    or $self->log(E, "error setting savepoint '$name'");
+    $self->log(I, "setting savepoint '$name'");
+    my $stat = $self->request($self->app.".savepoint.set", $name)
+        or $self->log(E, "error setting savepoint '$name'");
     return $stat;
 }
 
@@ -316,8 +316,8 @@ sub release_savepoint {
     my $self = shift;
     my $name = shift || 'savepoint';
     return unless $self->{session} and $self->{xact_id};
-	$self->log(I, "releasing savepoint '$name'");
-	my $stat = $self->request($self->app.".savepoint.release", $name)
+    $self->log(I, "releasing savepoint '$name'");
+    my $stat = $self->request($self->app.".savepoint.release", $name)
         or $self->log(E, "error releasing savepoint '$name'");
     return $stat;
 }
@@ -326,8 +326,8 @@ sub rollback_savepoint {
     my $self = shift;
     my $name = shift || 'savepoint';
     return unless $self->{session} and $self->{xact_id};
-	$self->log(I, "rollback savepoint '$name'");
-	my $stat = $self->request($self->app.".savepoint.rollback", $name)
+    $self->log(I, "rollback savepoint '$name'");
+    my $stat = $self->request($self->app.".savepoint.rollback", $name)
         or $self->log(E, "error rolling back savepoint '$name'");
     return $stat;
 }
@@ -337,10 +337,10 @@ sub rollback_savepoint {
 # Rolls back the transaction and disconnects
 # -----------------------------------------------------------------------------
 sub rollback {
-	my $self = shift;
+    my $self = shift;
     my $err;
     my $ret;
-	try {
+    try {
         $self->xact_rollback;
     } catch Error with  {
         $err = shift
@@ -352,8 +352,8 @@ sub rollback {
 }
 
 sub disconnect {
-	my $self = shift;
-	$self->session->disconnect if 
+    my $self = shift;
+    $self->session->disconnect if 
         $self->{session} and 
         $self->{session}->state == OpenSRF::AppSession::CONNECTED();
     delete $self->{session};
@@ -365,9 +365,9 @@ sub disconnect {
 # returns the status of the commit call
 # -----------------------------------------------------------------------------
 sub commit {
-	my $self = shift;
-	return unless $self->{xact_id};
-	my $stat = $self->xact_commit;
+    my $self = shift;
+    return unless $self->{xact_id};
+    my $stat = $self->xact_commit;
     $self->disconnect;
     return $stat;
 }
@@ -376,9 +376,9 @@ sub commit {
 # clears all object data. Does not commit the db transaction.
 # -----------------------------------------------------------------------------
 sub reset {
-	my $self = shift;
-	$self->disconnect;
-	$$self{$_} = undef for (keys %$self);
+    my $self = shift;
+    $self->disconnect;
+    $$self{$_} = undef for (keys %$self);
 }
 
 
@@ -386,10 +386,10 @@ sub reset {
 # commits and resets
 # -----------------------------------------------------------------------------
 sub finish {
-	my $self = shift;
+    my $self = shift;
     my $err;
     my $ret;
-	try {
+    try {
         $self->commit;
     } catch Error with  {
         $err = shift
@@ -406,23 +406,23 @@ sub finish {
 # Does a simple storage request
 # -----------------------------------------------------------------------------
 sub request {
-	my( $self, $method, @params ) = @_;
+    my( $self, $method, @params ) = @_;
 
     my $val;
-	my $err;
-	my $argstr = __arg_to_string( (scalar(@params)) == 1 ? $params[0] : \@params);
-	my $locale = $self->session->session_locale;
+    my $err;
+    my $argstr = __arg_to_string( (scalar(@params)) == 1 ? $params[0] : \@params);
+    my $locale = $self->session->session_locale;
 
-	$self->log(I, "request $locale $method $argstr");
+    $self->log(I, "request $locale $method $argstr");
 
-	if( ($self->{xact} or $always_xact) and 
-			$self->session->state != OpenSRF::AppSession::CONNECTED() ) {
-		#$logger->error("CStoreEditor lost it's connection!!");
-		throw OpenSRF::EX::ERROR ("CStore connection timed out - transaction cannot continue");
-	}
+    if( ($self->{xact} or $always_xact) and 
+            $self->session->state != OpenSRF::AppSession::CONNECTED() ) {
+        #$logger->error("CStoreEditor lost it's connection!!");
+        throw OpenSRF::EX::ERROR ("CStore connection timed out - transaction cannot continue");
+    }
 
 
-	try {
+    try {
 
         my $req = $self->session->request($method, @params);
 
@@ -437,7 +437,7 @@ sub request {
             my $resp = $req->recv(timeout => $self->timeout);
             if($req->failed) {
                 $err = $resp;
-		        $self->log(E, "request error $method : $argstr : $err");
+                $self->log(E, "request error $method : $argstr : $err");
             } else {
                 $val = $resp->content if $resp;
             }
@@ -445,13 +445,13 @@ sub request {
 
         $req->finish;
 
-	} catch Error with {
-		$err = shift;
-		$self->log(E, "request error $method : $argstr : $err");
-	};
+    } catch Error with {
+        $err = shift;
+        $self->log(E, "request error $method : $argstr : $err");
+    };
 
-	throw $err if $err;
-	return $val;
+    throw $err if $err;
+    return $val;
 }
 
 sub substream {
@@ -475,9 +475,9 @@ sub discard {
 # Sets / Returns the requestor object.  This is set when checkauth succeeds.
 # -----------------------------------------------------------------------------
 sub requestor {
-	my($self, $requestor) = @_;
-	$self->{requestor} = $requestor if $requestor;
-	return $self->{requestor};
+    my($self, $requestor) = @_;
+    $self->{requestor} = $requestor if $requestor;
+    return $self->{requestor};
 }
 
 
@@ -486,9 +486,9 @@ sub requestor {
 # Holds the last data received from a storage call
 # -----------------------------------------------------------------------------
 sub data {
-	my( $self, $data ) = @_;
-	$self->{data} = $data if defined $data;
-	return $self->{data};
+    my( $self, $data ) = @_;
+    $self->{data} = $data if defined $data;
+    return $self->{data};
 }
 
 
@@ -496,15 +496,15 @@ sub data {
 # True if this perm has already been checked at this org
 # -----------------------------------------------------------------------------
 sub perm_checked {
-	my( $self, $perm, $org ) = @_;
-	$self->{checked_perms}->{$org} = {}
-		unless $self->{checked_perms}->{$org};
-	my $checked = $self->{checked_perms}->{$org}->{$perm};
-	if(!$checked) {
-		$self->{checked_perms}->{$org}->{$perm} = 1;
-		return 0;
-	}
-	return 1;
+    my( $self, $perm, $org ) = @_;
+    $self->{checked_perms}->{$org} = {}
+        unless $self->{checked_perms}->{$org};
+    my $checked = $self->{checked_perms}->{$org}->{$perm};
+    if(!$checked) {
+        $self->{checked_perms}->{$org}->{$perm} = 1;
+        return 0;
+    }
+    return 1;
 }
 
 
@@ -545,14 +545,14 @@ my $OBJECT_PERM_QUERY = {
 };
 
 sub allowed {
-	my( $self, $perm, $org, $object, $hint ) = @_;
-	my $uid = $self->requestor->id;
-	$org ||= $self->requestor->ws_ou;
+    my( $self, $perm, $org, $object, $hint ) = @_;
+    my $uid = $self->requestor->id;
+    $org ||= $self->requestor->ws_ou;
 
     my $perms = (ref($perm) eq 'ARRAY') ? $perm : [$perm];
 
     for $perm (@$perms) {
-	    $self->log(I, "checking perms user=$uid, org=$org, perm=$perm");
+        $self->log(I, "checking perms user=$uid, org=$org, perm=$perm");
     
         if($object) {
             my $params;
@@ -577,9 +577,9 @@ sub allowed {
     }
 
     # set the perm failure event if the permission check returned false
-	my $e = OpenILS::Event->new('PERM_FAILURE', ilsperm => $perm, ilspermloc => $org);
-	$self->event($e);
-	return undef;
+    my $e = OpenILS::Event->new('PERM_FAILURE', ilsperm => $perm, ilspermloc => $org);
+    $self->event($e);
+    return undef;
 }
 
 
@@ -620,16 +620,16 @@ sub objects_allowed {
 # checks the appropriate perm for the operation
 # -----------------------------------------------------------------------------
 sub _checkperm {
-	my( $self, $ptype, $action, $org ) = @_;
-	$org ||= $self->requestor->ws_ou;
-	my $perm = $PERMS{$ptype}{$action};
-	if( $perm ) {
-		return undef if $self->perm_checked($perm, $org);
-		return $self->event unless $self->allowed($perm, $org);
-	} else {
-		$self->log(I, "no perm provided for $ptype.$action");
-	}
-	return undef;
+    my( $self, $ptype, $action, $org ) = @_;
+    $org ||= $self->requestor->ws_ou;
+    my $perm = $PERMS{$ptype}{$action};
+    if( $perm ) {
+        return undef if $self->perm_checked($perm, $org);
+        return $self->event unless $self->allowed($perm, $org);
+    } else {
+        $self->log(I, "no perm provided for $ptype.$action");
+    }
+    return undef;
 }
 
 
@@ -638,8 +638,8 @@ sub _checkperm {
 # Logs update actions to the activity log
 # -----------------------------------------------------------------------------
 sub log_activity {
-	my( $self, $method, $type, $action, $arg ) = @_;
-	my $str = "$type.$action";
+    my( $self, $method, $type, $action, $arg ) = @_;
+    my $str = "$type.$action";
 
     if ($arg) {
         
@@ -661,33 +661,33 @@ sub log_activity {
     }
 
 
-	$self->log(A, $str);
+    $self->log(A, $str);
 }
 
 
 
 sub _prop_string {
-	my $obj = shift;
-	my @props = $obj->properties;
-	my $str = "";
-	for(@props) {
-		my $prop = $obj->$_() || "";
-		$prop = substr($prop, 0, 128) . "..." if length $prop > 131;
-		$str .= " $_=$prop";
-	}
-	return $str;
+    my $obj = shift;
+    my @props = $obj->properties;
+    my $str = "";
+    for(@props) {
+        my $prop = $obj->$_() || "";
+        $prop = substr($prop, 0, 128) . "..." if length $prop > 131;
+        $str .= " $_=$prop";
+    }
+    return $str;
 }
 
 
 sub __arg_to_string {
-	my $arg = shift;
-	return "" unless defined $arg;
-	if( UNIVERSAL::isa($arg, "Fieldmapper") ) {
+    my $arg = shift;
+    return "" unless defined $arg;
+    if( UNIVERSAL::isa($arg, "Fieldmapper") ) {
         my $idf = $arg->Identity;
-		return (defined $arg->$idf) ? $arg->$idf : '<new object>';
-	}
-	return OpenSRF::Utils::JSON->perl2JSON($arg);
-	return "";
+        return (defined $arg->$idf) ? $arg->$idf : '<new object>';
+    }
+    return OpenSRF::Utils::JSON->perl2JSON($arg);
+    return "";
 }
 
 
@@ -718,160 +718,160 @@ sub __arg_to_string {
 # return $e->event unless @$results; 
 # -----------------------------------------------------------------------------
 sub runmethod {
-	my( $self, $action, $type, $arg, $options ) = @_;
+    my( $self, $action, $type, $arg, $options ) = @_;
 
    $options ||= {};
 
-	if( $action eq 'retrieve' ) {
-		if(! defined($arg) ) {
-			$self->log(W,"$action $type called with no ID...");
-			$self->event(_mk_not_found($type, $arg));
-			return undef;
-		} elsif( ref($arg) =~ /Fieldmapper/ ) {
-			$self->log(D,"$action $type called with an object.. attempting Identity retrieval..");
+    if( $action eq 'retrieve' ) {
+        if(! defined($arg) ) {
+            $self->log(W,"$action $type called with no ID...");
+            $self->event(_mk_not_found($type, $arg));
+            return undef;
+        } elsif( ref($arg) =~ /Fieldmapper/ ) {
+            $self->log(D,"$action $type called with an object.. attempting Identity retrieval..");
             my $idf = $arg->Identity;
-			$arg = $arg->$idf;
-		}
-	}
-
-	my @arg = ( ref($arg) eq 'ARRAY' ) ? @$arg : ($arg);
-	my $method = $self->app.".direct.$type.$action";
-
-	if( $action eq 'search' ) {
-		$method .= '.atomic';
-
-	} elsif( $action eq 'batch_retrieve' ) {
-		$action = 'search';
-		$method =~ s/batch_retrieve/search/o;
-		$method .= '.atomic';
-		my $tt = $type;
-		$tt =~ s/\./::/og;
-		my $fmobj = "Fieldmapper::$tt";
-		my $ident_field = $fmobj->Identity;
-
-		if (ref $arg[0] eq 'ARRAY') {
-			# $arg looks like: ([1, 2, 3], {search_args})
-			@arg = ( { $ident_field => $arg[0] }, @arg[1 .. $#arg] );
-		} else {
-			# $arg looks like: [1, 2, 3]
-			@arg = ( { $ident_field => $arg } );
-		}
-
-	} elsif( $action eq 'retrieve_all' ) {
-		$action = 'search';
-		$method =~ s/retrieve_all/search/o;
-		my $tt = $type;
-		$tt =~ s/\./::/og;
-		my $fmobj = "Fieldmapper::$tt";
-		@arg = ( { $fmobj->Identity => { '!=' => undef } } );
-		$method .= '.atomic';
-	}
-
-	$method =~ s/search/id_list/o if $options->{idlist};
+            $arg = $arg->$idf;
+        }
+    }
+
+    my @arg = ( ref($arg) eq 'ARRAY' ) ? @$arg : ($arg);
+    my $method = $self->app.".direct.$type.$action";
+
+    if( $action eq 'search' ) {
+        $method .= '.atomic';
+
+    } elsif( $action eq 'batch_retrieve' ) {
+        $action = 'search';
+        $method =~ s/batch_retrieve/search/o;
+        $method .= '.atomic';
+        my $tt = $type;
+        $tt =~ s/\./::/og;
+        my $fmobj = "Fieldmapper::$tt";
+        my $ident_field = $fmobj->Identity;
+
+        if (ref $arg[0] eq 'ARRAY') {
+            # $arg looks like: ([1, 2, 3], {search_args})
+            @arg = ( { $ident_field => $arg[0] }, @arg[1 .. $#arg] );
+        } else {
+            # $arg looks like: [1, 2, 3]
+            @arg = ( { $ident_field => $arg } );
+        }
+
+    } elsif( $action eq 'retrieve_all' ) {
+        $action = 'search';
+        $method =~ s/retrieve_all/search/o;
+        my $tt = $type;
+        $tt =~ s/\./::/og;
+        my $fmobj = "Fieldmapper::$tt";
+        @arg = ( { $fmobj->Identity => { '!=' => undef } } );
+        $method .= '.atomic';
+    }
+
+    $method =~ s/search/id_list/o if $options->{idlist};
 
     $method =~ s/\.atomic$//o if $self->substream($$options{substream} || 0);
     $self->timeout($$options{timeout});
     $self->discard($$options{discard});
 
-	# remove any stale events
-	$self->clear_event;
-
-	if( $action eq 'update' or $action eq 'delete' or $action eq 'create' ) {
-		if(!($self->{xact} or $always_xact)) {
-			$logger->error("Attempt to update DB while not in a transaction : $method");
-			throw OpenSRF::EX::ERROR ("Attempt to update DB while not in a transaction : $method");
-		}
-		$self->log_activity($method, $type, $action, $arg);
-	}
-
-	if($$options{checkperm}) {
-		my $a = ($action eq 'search') ? 'retrieve' : $action;
-		my $e = $self->_checkperm($type, $a, $$options{permorg});
-		if($e) {
-			$self->event($e);
-			return undef;
-		}
-	}
-
-	my $obj; 
-	my $err = '';
-
-	try {
-		$obj = $self->request($method, @arg);
-	} catch Error with { $err = shift; };
-	
-
-	if(!defined $obj) {
-		$self->log(I, "request returned no data : $method");
-
-		if( $action eq 'retrieve' ) {
-			$self->event(_mk_not_found($type, $arg));
-
-		} elsif( $action eq 'update' or 
-				$action eq 'delete' or $action eq 'create' ) {
-			my $evt = OpenILS::Event->new(
-				'DATABASE_UPDATE_FAILED', payload => $arg, debug => "$err" );
-			$self->event($evt);
-		}
-
-		if( $err ) {
-			$self->event( 
-				OpenILS::Event->new( 'DATABASE_QUERY_FAILED', 
-					payload => $arg, debug => "$err" ));
-			return undef;
-		}
-
-		return undef;
-	}
-
-	if( $action eq 'create' and $obj == 0 ) {
-		my $evt = OpenILS::Event->new(
-			'DATABASE_UPDATE_FAILED', payload => $arg, debug => "$err" );
-		$self->event($evt);
-		return undef;
-	}
-
-	# If we havn't dealt with the error in a nice way, go ahead and throw it
-	if( $err ) {
-		$self->event( 
-			OpenILS::Event->new( 'DATABASE_QUERY_FAILED', 
-				payload => $arg, debug => "$err" ));
-		return undef;
-	}
-
-	if( $action eq 'search' ) {
-		$self->log(I, "$type.$action : returned ".scalar(@$obj). " result(s)");
-		$self->event(_mk_not_found($type, $arg)) unless @$obj;
-	}
-
-	if( $action eq 'create' ) {
+    # remove any stale events
+    $self->clear_event;
+
+    if( $action eq 'update' or $action eq 'delete' or $action eq 'create' ) {
+        if(!($self->{xact} or $always_xact)) {
+            $logger->error("Attempt to update DB while not in a transaction : $method");
+            throw OpenSRF::EX::ERROR ("Attempt to update DB while not in a transaction : $method");
+        }
+        $self->log_activity($method, $type, $action, $arg);
+    }
+
+    if($$options{checkperm}) {
+        my $a = ($action eq 'search') ? 'retrieve' : $action;
+        my $e = $self->_checkperm($type, $a, $$options{permorg});
+        if($e) {
+            $self->event($e);
+            return undef;
+        }
+    }
+
+    my $obj; 
+    my $err = '';
+
+    try {
+        $obj = $self->request($method, @arg);
+    } catch Error with { $err = shift; };
+    
+
+    if(!defined $obj) {
+        $self->log(I, "request returned no data : $method");
+
+        if( $action eq 'retrieve' ) {
+            $self->event(_mk_not_found($type, $arg));
+
+        } elsif( $action eq 'update' or 
+                $action eq 'delete' or $action eq 'create' ) {
+            my $evt = OpenILS::Event->new(
+                'DATABASE_UPDATE_FAILED', payload => $arg, debug => "$err" );
+            $self->event($evt);
+        }
+
+        if( $err ) {
+            $self->event( 
+                OpenILS::Event->new( 'DATABASE_QUERY_FAILED', 
+                    payload => $arg, debug => "$err" ));
+            return undef;
+        }
+
+        return undef;
+    }
+
+    if( $action eq 'create' and $obj == 0 ) {
+        my $evt = OpenILS::Event->new(
+            'DATABASE_UPDATE_FAILED', payload => $arg, debug => "$err" );
+        $self->event($evt);
+        return undef;
+    }
+
+    # If we havn't dealt with the error in a nice way, go ahead and throw it
+    if( $err ) {
+        $self->event( 
+            OpenILS::Event->new( 'DATABASE_QUERY_FAILED', 
+                payload => $arg, debug => "$err" ));
+        return undef;
+    }
+
+    if( $action eq 'search' ) {
+        $self->log(I, "$type.$action : returned ".scalar(@$obj). " result(s)");
+        $self->event(_mk_not_found($type, $arg)) unless @$obj;
+    }
+
+    if( $action eq 'create' ) {
         my $idf = $obj->Identity;
-		$self->log(I, "created a new $type object with Identity " . $obj->$idf);
-		$arg->$idf($obj->$idf);
-	}
+        $self->log(I, "created a new $type object with Identity " . $obj->$idf);
+        $arg->$idf($obj->$idf);
+    }
 
-	$self->data($obj); # cache the data for convenience
+    $self->data($obj); # cache the data for convenience
 
-	return ($obj) ? $obj : 1;
+    return ($obj) ? $obj : 1;
 }
 
 
 sub _mk_not_found {
-	my( $type, $arg ) = @_;
-	(my $t = $type) =~ s/\./_/og;
-	$t = uc($t);
-	return OpenILS::Event->new("${t}_NOT_FOUND", payload => $arg);
+    my( $type, $arg ) = @_;
+    (my $t = $type) =~ s/\./_/og;
+    $t = uc($t);
+    return OpenILS::Event->new("${t}_NOT_FOUND", payload => $arg);
 }
 
 
 
 # utility method for loading
 sub __fm2meth { 
-	my $str = shift;
-	my $sep = shift;
-	$str =~ s/Fieldmapper:://o;
-	$str =~ s/::/$sep/g;
-	return $str;
+    my $str = shift;
+    my $sep = shift;
+    $str =~ s/Fieldmapper:://o;
+    $str =~ s/::/$sep/g;
+    return $str;
 }
 
 
@@ -897,13 +897,13 @@ init();  # Add very many subs to this namespace
 sub json_query {
     my( $self, $arg, $options ) = @_;
     $options ||= {};
-	my @arg = ( ref($arg) eq 'ARRAY' ) ? @$arg : ($arg);
+    my @arg = ( ref($arg) eq 'ARRAY' ) ? @$arg : ($arg);
     my $method = $self->app.'.json_query.atomic';
     $method =~ s/\.atomic$//o if $self->substream($$options{substream} || 0);
 
     $self->timeout($$options{timeout});
     $self->discard($$options{discard});
-	$self->clear_event;
+    $self->clear_event;
     my $obj;
     my $err;
     
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/Configure.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/Configure.pm
index 2501f59..4bd5b3a 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/Configure.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/Configure.pm
@@ -199,19 +199,19 @@ sub org_tree_html_options {
 }
 
 sub print_org_tree_html {
-	my $node = shift;
-	my $org_tree_html = shift;
+    my $node = shift;
+    my $org_tree_html = shift;
     my $types = shift;
 
-	return unless ($node->opac_visible =~ /^[y1t]+/i);
+    return unless ($node->opac_visible =~ /^[y1t]+/i);
 
-	my $depth = $types->[$node->ou_type]->depth;
-	my $sname = OpenILS::Application::AppUtils->entityize($node->shortname);
-	my $name = OpenILS::Application::AppUtils->entityize($node->name);
-	my $kids = $node->children;
+    my $depth = $types->[$node->ou_type]->depth;
+    my $sname = OpenILS::Application::AppUtils->entityize($node->shortname);
+    my $name = OpenILS::Application::AppUtils->entityize($node->name);
+    my $kids = $node->children;
 
-	push @$org_tree_html, "<option value='$sname'>" . '&#160;&#160;&#160;'x$depth . "$name</option>\n";
-	print_org_tree_html($_, $org_tree_html, $types) for (@$kids);
+    push @$org_tree_html, "<option value='$sname'>" . '&#160;&#160;&#160;'x$depth . "$name</option>\n";
+    print_org_tree_html($_, $org_tree_html, $types) for (@$kids);
 }
 
 sub org_lasso {
@@ -254,13 +254,13 @@ sub locale_html_options {
     # Turns supported locales into a static HTML option list
     my $locales = get_locales();
 
-	my $output = "<select name='locale'>\n";
-	foreach my $locale (@$locales) {
-		my $code = OpenILS::Application::AppUtils->entityize($locale->code);
-		my $name = OpenILS::Application::AppUtils->entityize($locale->name);
-		$output .= "  <option value='$code'>$name</option>\n";
-	}
-	$output .= "</select>\n";
+    my $output = "<select name='locale'>\n";
+    foreach my $locale (@$locales) {
+        my $code = OpenILS::Application::AppUtils->entityize($locale->code);
+        my $name = OpenILS::Application::AppUtils->entityize($locale->name);
+        $output .= "  <option value='$code'>$name</option>\n";
+    }
+    $output .= "</select>\n";
 
     return $output;
 }
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/Editor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/Editor.pm
index e31e29d..2a6b7e6 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/Editor.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/Editor.pm
@@ -43,40 +43,40 @@ use constant A => 'activity';
 
 # -----------------------------------------------------------------------------
 # Params include:
-#	xact=><true> : creates a storage transaction
-#	authtoken=>$token : the login session key
+#   xact=><true> : creates a storage transaction
+#   authtoken=>$token : the login session key
 # -----------------------------------------------------------------------------
 sub new {
-	my( $class, %params ) = @_;
-	$class = ref($class) || $class;
-	my $self = bless( \%params, $class );
-	$self->{checked_perms} = {};
-	return $self;
+    my( $class, %params ) = @_;
+    $class = ref($class) || $class;
+    my $self = bless( \%params, $class );
+    $self->{checked_perms} = {};
+    return $self;
 }
 
 # -----------------------------------------------------------------------------
 # Log the editor metadata along with the log string
 # -----------------------------------------------------------------------------
 sub log {
-	my( $self, $lev, $str ) = @_;
-	my $s = "editor[";
-	$s .= "0|" unless $self->{xact};
-	$s .= "1|" if $self->{xact};
-	$s .= "0" unless $self->requestor;
-	$s .= $self->requestor->id if $self->requestor;
-	$s .= "]";
-	$logger->$lev("$s $str");
+    my( $self, $lev, $str ) = @_;
+    my $s = "editor[";
+    $s .= "0|" unless $self->{xact};
+    $s .= "1|" if $self->{xact};
+    $s .= "0" unless $self->requestor;
+    $s .= $self->requestor->id if $self->requestor;
+    $s .= "]";
+    $logger->$lev("$s $str");
 }
 
 # -----------------------------------------------------------------------------
 # Verifies the auth token and fetches the requestor object
 # -----------------------------------------------------------------------------
 sub checkauth {
-	my $self = shift;
-	$self->log(D, "checking auth token ".$self->authtoken);
-	my ($reqr, $evt) = $U->checkses($self->authtoken);
-	$self->event($evt) if $evt;
-	return $self->{requestor} = $reqr;
+    my $self = shift;
+    $self->log(D, "checking auth token ".$self->authtoken);
+    my ($reqr, $evt) = $U->checkses($self->authtoken);
+    $self->event($evt) if $evt;
+    return $self->{requestor} = $reqr;
 }
 
 
@@ -84,23 +84,23 @@ sub checkauth {
 # Returns the last generated event
 # -----------------------------------------------------------------------------
 sub event {
-	my( $self, $evt ) = @_;
-	$self->{event} = $evt if $evt;
-	return $self->{event};
+    my( $self, $evt ) = @_;
+    $self->{event} = $evt if $evt;
+    return $self->{event};
 }
 
 # -----------------------------------------------------------------------------
 # Clears the last caught event
 # -----------------------------------------------------------------------------
 sub clear_event {
-	my $self = shift;
-	$self->{event} = undef;
+    my $self = shift;
+    $self->{event} = undef;
 }
 
 sub authtoken {
-	my( $self, $auth ) = @_;
-	$self->{authtoken} = $auth if $auth;
-	return $self->{authtoken};
+    my( $self, $auth ) = @_;
+    $self->{authtoken} = $auth if $auth;
+    return $self->{authtoken};
 }
 
 # -----------------------------------------------------------------------------
@@ -108,22 +108,22 @@ sub authtoken {
 # object, a db session is created
 # -----------------------------------------------------------------------------
 sub session {
-	my( $self, $session ) = @_;
-	$self->{session} = $session if $session;
-
-	if(!$self->{session}) {
-		$self->{session} = OpenSRF::AppSession->create('open-ils.storage');
-
-		if( ! $self->{session} ) {
-			my $str = "Error creating storage session with OpenSRF::AppSession->create()!";
-			$self->log(E, $str);
-			throw OpenSRF::EX::ERROR ($str);
-		}
-
-		$self->{session}->connect if $self->{xact} or $self->{connect};
-		$self->xact_start if $self->{xact};
-	}
-	return $self->{session};
+    my( $self, $session ) = @_;
+    $self->{session} = $session if $session;
+
+    if(!$self->{session}) {
+        $self->{session} = OpenSRF::AppSession->create('open-ils.storage');
+
+        if( ! $self->{session} ) {
+            my $str = "Error creating storage session with OpenSRF::AppSession->create()!";
+            $self->log(E, $str);
+            throw OpenSRF::EX::ERROR ($str);
+        }
+
+        $self->{session}->connect if $self->{xact} or $self->{connect};
+        $self->xact_start if $self->{xact};
+    }
+    return $self->{session};
 }
 
 
@@ -131,10 +131,10 @@ sub session {
 # Starts a storage transaction
 # -----------------------------------------------------------------------------
 sub xact_start {
-	my $self = shift;
-	$self->log(D, "starting new db session");
-	my $stat = $self->request('open-ils.storage.transaction.begin');
-	$self->log(E, "error starting database transaction") unless $stat;
+    my $self = shift;
+    $self->log(D, "starting new db session");
+    my $stat = $self->request('open-ils.storage.transaction.begin');
+    $self->log(E, "error starting database transaction") unless $stat;
     if($self->authtoken) {
         if(!$self->requestor) {
             $self->checkauth;
@@ -147,27 +147,27 @@ sub xact_start {
         }
         $self->request('open-ils.storage.set_audit_info', $self->authtoken, $user_id, $ws_id);
     }
-	return $stat;
+    return $stat;
 }
 
 # -----------------------------------------------------------------------------
 # Commits a storage transaction
 # -----------------------------------------------------------------------------
 sub xact_commit {
-	my $self = shift;
-	$self->log(D, "comitting db session");
-	my $stat = $self->request('open-ils.storage.transaction.commit');
-	$self->log(E, "error comitting database transaction") unless $stat;
-	return $stat;
+    my $self = shift;
+    $self->log(D, "comitting db session");
+    my $stat = $self->request('open-ils.storage.transaction.commit');
+    $self->log(E, "error comitting database transaction") unless $stat;
+    return $stat;
 }
 
 # -----------------------------------------------------------------------------
 # Rolls back a storage stransaction
 # -----------------------------------------------------------------------------
 sub xact_rollback {
-	my $self = shift;
-	$self->log(I, "rolling back db session");
-	return $self->request("open-ils.storage.transaction.rollback");
+    my $self = shift;
+    $self->log(I, "rolling back db session");
+    return $self->request("open-ils.storage.transaction.rollback");
 }
 
 
@@ -175,20 +175,20 @@ sub xact_rollback {
 # commits the db session and destroys the session
 # -----------------------------------------------------------------------------
 sub commit {
-	my $self = shift;
-	return unless $self->{xact};
-	$self->xact_commit;
-	$self->session->disconnect;
-	$self->{session} = undef;
+    my $self = shift;
+    return unless $self->{xact};
+    $self->xact_commit;
+    $self->session->disconnect;
+    $self->{session} = undef;
 }
 
 # -----------------------------------------------------------------------------
 # clears all object data. Does not commit the db transaction.
 # -----------------------------------------------------------------------------
 sub reset {
-	my $self = shift;
-	$self->session->disconnect if $self->{session};
-	$$self{$_} = undef for (keys %$self);
+    my $self = shift;
+    $self->session->disconnect if $self->{session};
+    $$self{$_} = undef for (keys %$self);
 }
 
 
@@ -196,9 +196,9 @@ sub reset {
 # commits and resets
 # -----------------------------------------------------------------------------
 sub finish {
-	my $self = shift;
-	$self->commit;
-	$self->reset;
+    my $self = shift;
+    $self->commit;
+    $self->reset;
 }
 
 
@@ -207,24 +207,24 @@ sub finish {
 # Does a simple storage request
 # -----------------------------------------------------------------------------
 sub request {
-	my( $self, $method, @params ) = @_;
+    my( $self, $method, @params ) = @_;
 
-	my $val;
-	my $err;
-	my $argstr = __arg_to_string( (scalar(@params)) == 1 ? $params[0] : \@params);
+    my $val;
+    my $err;
+    my $argstr = __arg_to_string( (scalar(@params)) == 1 ? $params[0] : \@params);
 
-	$self->log(I, "request $method : $argstr");
-	
-	try {
-		$val = $self->session->request($method, @params)->gather(1);
+    $self->log(I, "request $method : $argstr");
+    
+    try {
+        $val = $self->session->request($method, @params)->gather(1);
 
-	} catch Error with {
-		$err = shift;
-		$self->log(E, "request error $method : $argstr : $err");
-	};
+    } catch Error with {
+        $err = shift;
+        $self->log(E, "request error $method : $argstr : $err");
+    };
 
-	throw $err if $err;
-	return $val;
+    throw $err if $err;
+    return $val;
 }
 
 
@@ -232,9 +232,9 @@ sub request {
 # Sets / Returns the requstor object.  This is set when checkauth succeeds.
 # -----------------------------------------------------------------------------
 sub requestor {
-	my($self, $requestor) = @_;
-	$self->{requestor} = $requestor if $requestor;
-	return $self->{requestor};
+    my($self, $requestor) = @_;
+    $self->{requestor} = $requestor if $requestor;
+    return $self->{requestor};
 }
 
 
@@ -243,9 +243,9 @@ sub requestor {
 # Holds the last data received from a storage call
 # -----------------------------------------------------------------------------
 sub data {
-	my( $self, $data ) = @_;
-	$self->{data} = $data if defined $data;
-	return $self->{data};
+    my( $self, $data ) = @_;
+    $self->{data} = $data if defined $data;
+    return $self->{data};
 }
 
 
@@ -253,15 +253,15 @@ sub data {
 # True if this perm has already been checked at this org
 # -----------------------------------------------------------------------------
 sub perm_checked {
-	my( $self, $perm, $org ) = @_;
-	$self->{checked_perms}->{$org} = {}
-		unless $self->{checked_perms}->{$org};
-	my $checked = $self->{checked_perms}->{$org}->{$perm};
-	if(!$checked) {
-		$self->{checked_perms}->{$org}->{$perm} = 1;
-		return 0;
-	}
-	return 1;
+    my( $self, $perm, $org ) = @_;
+    $self->{checked_perms}->{$org} = {}
+        unless $self->{checked_perms}->{$org};
+    my $checked = $self->{checked_perms}->{$org}->{$perm};
+    if(!$checked) {
+        $self->{checked_perms}->{$org}->{$perm} = 1;
+        return 0;
+    }
+    return 1;
 }
 
 
@@ -275,26 +275,26 @@ sub perm_checked {
 # and the perm is not re-checked
 # -----------------------------------------------------------------------------
 sub allowed {
-	my( $self, $perm, $org ) = @_;
-	my $uid = $self->requestor->id;
-	$org ||= $self->requestor->ws_ou;
-	$self->log(I, "checking perms user=$uid, org=$org, perm=$perm");
-	return 1 if $self->perm_checked($perm, $org); 
-	return $self->checkperm($uid, $org, $perm);
+    my( $self, $perm, $org ) = @_;
+    my $uid = $self->requestor->id;
+    $org ||= $self->requestor->ws_ou;
+    $self->log(I, "checking perms user=$uid, org=$org, perm=$perm");
+    return 1 if $self->perm_checked($perm, $org); 
+    return $self->checkperm($uid, $org, $perm);
 }
 
 sub checkperm {
-	my($self, $userid, $org, $perm) = @_;
-	my $s = $self->request(
-		"open-ils.storage.permission.user_has_perm", $userid, $perm, $org );
-
-	if(!$s) {
-		my $e = OpenILS::Event->new('PERM_FAILURE', ilsperm => $perm, ilspermloc => $org);
-		$self->event($e);
-		return undef;
-	}
+    my($self, $userid, $org, $perm) = @_;
+    my $s = $self->request(
+        "open-ils.storage.permission.user_has_perm", $userid, $perm, $org );
+
+    if(!$s) {
+        my $e = OpenILS::Event->new('PERM_FAILURE', ilsperm => $perm, ilspermloc => $org);
+        $self->event($e);
+        return undef;
+    }
 
-	return 1;
+    return 1;
 }
 
 
@@ -303,16 +303,16 @@ sub checkperm {
 # checks the appropriate perm for the operation
 # -----------------------------------------------------------------------------
 sub _checkperm {
-	my( $self, $ptype, $action, $org ) = @_;
-	$org ||= $self->requestor->ws_ou;
-	my $perm = $PERMS{$ptype}{$action};
-	if( $perm ) {
-		return undef if $self->perm_checked($perm, $org);
-		return $self->event unless $self->allowed($perm, $org);
-	} else {
-		$self->log(E, "no perm provided for $ptype.$action");
-	}
-	return undef;
+    my( $self, $ptype, $action, $org ) = @_;
+    $org ||= $self->requestor->ws_ou;
+    my $perm = $PERMS{$ptype}{$action};
+    if( $perm ) {
+        return undef if $self->perm_checked($perm, $org);
+        return $self->event unless $self->allowed($perm, $org);
+    } else {
+        $self->log(E, "no perm provided for $ptype.$action");
+    }
+    return undef;
 }
 
 
@@ -321,32 +321,32 @@ sub _checkperm {
 # Logs update actions to the activity log
 # -----------------------------------------------------------------------------
 sub log_activity {
-	my( $self, $type, $action, $arg ) = @_;
-	my $str = "$type.$action";
-	$str .= _prop_string($arg);
-	$self->log(A, $str);
+    my( $self, $type, $action, $arg ) = @_;
+    my $str = "$type.$action";
+    $str .= _prop_string($arg);
+    $self->log(A, $str);
 }
 
 
 
 sub _prop_string {
-	my $obj = shift;
-	my @props = $obj->properties;
-	my $str = "";
-	for(@props) {
-		my $prop = $obj->$_() || "";
-		$prop = substr($prop, 0, 128) . "..." if length $prop > 131;
-		$str .= " $_=$prop";
-	}
-	return $str;
+    my $obj = shift;
+    my @props = $obj->properties;
+    my $str = "";
+    for(@props) {
+        my $prop = $obj->$_() || "";
+        $prop = substr($prop, 0, 128) . "..." if length $prop > 131;
+        $str .= " $_=$prop";
+    }
+    return $str;
 }
 
 
 sub __arg_to_string {
-	my $arg = shift;
-	return "" unless defined $arg;
-	return $arg->id if UNIVERSAL::isa($arg, "Fieldmapper");
-	return OpenSRF::Utils::JSON->perl2JSON($arg);
+    my $arg = shift;
+    return "" unless defined $arg;
+    return $arg->id if UNIVERSAL::isa($arg, "Fieldmapper");
+    return OpenSRF::Utils::JSON->perl2JSON($arg);
 }
 
 
@@ -377,117 +377,117 @@ sub __arg_to_string {
 # return $e->event unless @$results; 
 # -----------------------------------------------------------------------------
 sub runmethod {
-	my( $self, $action, $type, $arg, $options ) = @_;
-
-	my @arg = ($arg);
-	my $method = "open-ils.storage.direct.$type.$action";
-
-	if( $action eq 'search' ) {
-		$method =~ s/search/search_where/o;
-		$method =~ s/direct/id_list/o if $options->{idlist};
-		$method = "$method.atomic";
-		@arg = @$arg if ref($arg) eq 'ARRAY';
-
-	} elsif( $action eq 'batch_retrieve' ) {
-		$method =~ s/batch_retrieve/batch.retrieve/o;
-		$method = "$method.atomic";
-		@arg = @$arg if ref($arg) eq 'ARRAY';
-
-	} elsif( $action eq 'retrieve_all' ) {
-		$method =~ s/retrieve_all/retrieve.all.atomic/o;
-	}
-
-	# remove any stale events
-	$self->clear_event;
-
-	if( $action eq 'update' or $action eq 'delete' or $action eq 'create' ) {
-		$self->log_activity($type, $action, $arg);
-	}
-
-	if($$options{checkperm}) {
-		my $a = ($action eq 'search' or 
-			$action eq 'batch_retrieve' or $action eq 'retrieve_all') ? 'retrieve' : $action;
-		my $e = $self->_checkperm($type, $a, $$options{permorg});
-		if($e) {
-			$self->event($e);
-			return undef;
-		}
-	}
-
-	my $obj; 
-	my $err;
-
-	try {
-		$obj = $self->request($method, @arg);
-	} catch Error with { $err = shift; };
-	
-
-	if(!defined $obj) {
-		$self->log(I, "request returned no data");
-
-		if( $action eq 'retrieve' ) {
-			$self->event(_mk_not_found($type, $arg));
-
-		} elsif( $action eq 'update' or 
-				$action eq 'delete' or $action eq 'create' ) {
-			my $evt = OpenILS::Event->new(
-				'DATABASE_UPDATE_FAILED', payload => $arg, debug => "$err" );
-			$self->event($evt);
-		}
-
-		if( $err ) {
-			$self->event( 
-				OpenILS::Event->new( 'DATABASE_QUERY_FAILED', 
-					payload => $arg, debug => "$err" ));
-			return undef;
-		}
-
-		return undef;
-	}
-
-	if( $action eq 'create' and $obj == 0 ) {
-		my $evt = OpenILS::Event->new(
-			'DATABASE_UPDATE_FAILED', payload => $arg, debug => "$err" );
-		$self->event($evt);
-		return undef;
-	}
-
-	# If we havn't dealt with the error in a nice way, go ahead and throw it
-	if( $err ) {
-		$self->event( 
-			OpenILS::Event->new( 'DATABASE_QUERY_FAILED', 
-				payload => $arg, debug => "$err" ));
-		return undef;
-	}
-
-	if( $action eq 'search' or $action eq 'batch_retrieve' or $action eq 'retrieve_all') {
-		$self->log(I, "$type.$action : returned ".scalar(@$obj). " result(s)");
-		$self->event(_mk_not_found($type, $arg)) unless @$obj;
-	}
-
-	$arg->id($obj) if $action eq 'create'; # grabs the id on create
-	$self->data($obj); # cache the data for convenience
-
-	return ($obj) ? $obj : 1;
+    my( $self, $action, $type, $arg, $options ) = @_;
+
+    my @arg = ($arg);
+    my $method = "open-ils.storage.direct.$type.$action";
+
+    if( $action eq 'search' ) {
+        $method =~ s/search/search_where/o;
+        $method =~ s/direct/id_list/o if $options->{idlist};
+        $method = "$method.atomic";
+        @arg = @$arg if ref($arg) eq 'ARRAY';
+
+    } elsif( $action eq 'batch_retrieve' ) {
+        $method =~ s/batch_retrieve/batch.retrieve/o;
+        $method = "$method.atomic";
+        @arg = @$arg if ref($arg) eq 'ARRAY';
+
+    } elsif( $action eq 'retrieve_all' ) {
+        $method =~ s/retrieve_all/retrieve.all.atomic/o;
+    }
+
+    # remove any stale events
+    $self->clear_event;
+
+    if( $action eq 'update' or $action eq 'delete' or $action eq 'create' ) {
+        $self->log_activity($type, $action, $arg);
+    }
+
+    if($$options{checkperm}) {
+        my $a = ($action eq 'search' or 
+            $action eq 'batch_retrieve' or $action eq 'retrieve_all') ? 'retrieve' : $action;
+        my $e = $self->_checkperm($type, $a, $$options{permorg});
+        if($e) {
+            $self->event($e);
+            return undef;
+        }
+    }
+
+    my $obj; 
+    my $err;
+
+    try {
+        $obj = $self->request($method, @arg);
+    } catch Error with { $err = shift; };
+    
+
+    if(!defined $obj) {
+        $self->log(I, "request returned no data");
+
+        if( $action eq 'retrieve' ) {
+            $self->event(_mk_not_found($type, $arg));
+
+        } elsif( $action eq 'update' or 
+                $action eq 'delete' or $action eq 'create' ) {
+            my $evt = OpenILS::Event->new(
+                'DATABASE_UPDATE_FAILED', payload => $arg, debug => "$err" );
+            $self->event($evt);
+        }
+
+        if( $err ) {
+            $self->event( 
+                OpenILS::Event->new( 'DATABASE_QUERY_FAILED', 
+                    payload => $arg, debug => "$err" ));
+            return undef;
+        }
+
+        return undef;
+    }
+
+    if( $action eq 'create' and $obj == 0 ) {
+        my $evt = OpenILS::Event->new(
+            'DATABASE_UPDATE_FAILED', payload => $arg, debug => "$err" );
+        $self->event($evt);
+        return undef;
+    }
+
+    # If we havn't dealt with the error in a nice way, go ahead and throw it
+    if( $err ) {
+        $self->event( 
+            OpenILS::Event->new( 'DATABASE_QUERY_FAILED', 
+                payload => $arg, debug => "$err" ));
+        return undef;
+    }
+
+    if( $action eq 'search' or $action eq 'batch_retrieve' or $action eq 'retrieve_all') {
+        $self->log(I, "$type.$action : returned ".scalar(@$obj). " result(s)");
+        $self->event(_mk_not_found($type, $arg)) unless @$obj;
+    }
+
+    $arg->id($obj) if $action eq 'create'; # grabs the id on create
+    $self->data($obj); # cache the data for convenience
+
+    return ($obj) ? $obj : 1;
 }
 
 
 sub _mk_not_found {
-	my( $type, $arg ) = @_;
-	(my $t = $type) =~ s/\./_/og;
-	$t = uc($t);
-	return OpenILS::Event->new("${t}_NOT_FOUND", payload => $arg);
+    my( $type, $arg ) = @_;
+    (my $t = $type) =~ s/\./_/og;
+    $t = uc($t);
+    return OpenILS::Event->new("${t}_NOT_FOUND", payload => $arg);
 }
 
 
 
 # utility method for loading
 sub __fm2meth { 
-	my $str = shift;
-	my $sep = shift;
-	$str =~ s/Fieldmapper:://o;
-	$str =~ s/::/$sep/g;
-	return $str;
+    my $str = shift;
+    my $sep = shift;
+    $str =~ s/Fieldmapper:://o;
+    $str =~ s/::/$sep/g;
+    return $str;
 }
 
 
@@ -496,43 +496,43 @@ sub __fm2meth {
 # -------------------------------------------------------------
 my $map = $Fieldmapper::fieldmap;
 for my $object (keys %$map) {
-	my $obj = __fm2meth($object,'_');
-	my $type = __fm2meth($object, '.');
-
-	my $update = "update_$obj";
-	my $updatef = 
-		"sub $update {return shift()->runmethod('update', '$type', \@_);}";
-	eval $updatef;
-
-	my $retrieve = "retrieve_$obj";
-	my $retrievef = 
-		"sub $retrieve {return shift()->runmethod('retrieve', '$type', \@_);}";
-	eval $retrievef;
-
-	my $search = "search_$obj";
-	my $searchf = 
-		"sub $search {return shift()->runmethod('search', '$type', \@_);}";
-	eval $searchf;
-
-	my $create = "create_$obj";
-	my $createf = 
-		"sub $create {return shift()->runmethod('create', '$type', \@_);}";
-	eval $createf;
-
-	my $delete = "delete_$obj";
-	my $deletef = 
-		"sub $delete {return shift()->runmethod('delete', '$type', \@_);}";
-	eval $deletef;
-
-	my $bretrieve = "batch_retrieve_$obj";
-	my $bretrievef = 
-		"sub $bretrieve {return shift()->runmethod('batch_retrieve', '$type', \@_);}";
-	eval $bretrievef;
-
-	my $retrieveall = "retrieve_all_$obj";
-	my $retrieveallf = 
-		"sub $retrieveall {return shift()->runmethod('retrieve_all', '$type', \@_);}";
-	eval $retrieveallf;
+    my $obj = __fm2meth($object,'_');
+    my $type = __fm2meth($object, '.');
+
+    my $update = "update_$obj";
+    my $updatef = 
+        "sub $update {return shift()->runmethod('update', '$type', \@_);}";
+    eval $updatef;
+
+    my $retrieve = "retrieve_$obj";
+    my $retrievef = 
+        "sub $retrieve {return shift()->runmethod('retrieve', '$type', \@_);}";
+    eval $retrievef;
+
+    my $search = "search_$obj";
+    my $searchf = 
+        "sub $search {return shift()->runmethod('search', '$type', \@_);}";
+    eval $searchf;
+
+    my $create = "create_$obj";
+    my $createf = 
+        "sub $create {return shift()->runmethod('create', '$type', \@_);}";
+    eval $createf;
+
+    my $delete = "delete_$obj";
+    my $deletef = 
+        "sub $delete {return shift()->runmethod('delete', '$type', \@_);}";
+    eval $deletef;
+
+    my $bretrieve = "batch_retrieve_$obj";
+    my $bretrievef = 
+        "sub $bretrieve {return shift()->runmethod('batch_retrieve', '$type', \@_);}";
+    eval $bretrievef;
+
+    my $retrieveall = "retrieve_all_$obj";
+    my $retrieveallf = 
+        "sub $retrieveall {return shift()->runmethod('retrieve_all', '$type', \@_);}";
+    eval $retrieveallf;
 
 
 }
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm
index 709ad5c..0a89824 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm
@@ -14,14 +14,14 @@ use vars qw/$fieldmap $VERSION/;
 #
 # To dump the Javascript version of the fieldmapper struct use the command:
 #
-#	PERL5LIB=:~/vcs/ILS/Open-ILS/src/perlmods/lib/ GEN_JS=1 perl -MOpenILS::Utils::Fieldmapper -e 'print "\n";'
+#   PERL5LIB=:~/vcs/ILS/Open-ILS/src/perlmods/lib/ GEN_JS=1 perl -MOpenILS::Utils::Fieldmapper -e 'print "\n";'
 #
 # ... adjusted for your VCS sandbox of choice, of course.
 #
 
 sub classes {
-	return () unless (defined $fieldmap);
-	return keys %$fieldmap;
+    return () unless (defined $fieldmap);
+    return keys %$fieldmap;
 }
 
 # Find a Fieldmapper class given the json hint.
@@ -34,289 +34,289 @@ sub class_for_hint {
 }
 
 sub get_attribute {
-	my $attr_list = shift;
-	my $attr_name = shift;
-
-	my $attr = $attr_list->getNamedItem( $attr_name );
-	if( defined( $attr ) ) {
-		return $attr->getValue();
-	}
-	return undef;
+    my $attr_list = shift;
+    my $attr_name = shift;
+
+    my $attr = $attr_list->getNamedItem( $attr_name );
+    if( defined( $attr ) ) {
+        return $attr->getValue();
+    }
+    return undef;
 }
 
 sub load_fields {
-	my $field_list = shift;
-	my $fm = shift;
-
-	# Get attributes of the field list.  Since there is only one
-	# <field> per class, these attributes logically belong to the
-	# enclosing class, and that's where we load them.
-
-	my $field_attr_list = $field_list->attributes();
-
-	my $sequence  = get_attribute( $field_attr_list, 'oils_persist:sequence' );
-	if( ! defined( $sequence ) ) {
-		$sequence = '';
-	}
-	my $primary   = get_attribute( $field_attr_list, 'oils_persist:primary' );
-
-	# Load attributes into the Fieldmapper ----------------------
-
-	$$fieldmap{$fm}{ sequence } = $sequence;
-	$$fieldmap{$fm}{ identity } = $primary;
-
-	# Load each field -------------------------------------------
-
-	my $array_position = 0;
-	for my $field ( $field_list->childNodes() ) {    # For each <field>
-		if( $field->nodeName eq 'field' ) {
-	
-			my $attribute_list = $field->attributes();
-			
-			my $name     = get_attribute( $attribute_list, 'name' );
-			next if( $name eq 'isnew' || $name eq 'ischanged' || $name eq 'isdeleted' );
-			my $required  = get_attribute( $attribute_list, 'oils_obj:required' );
-			my $validate  = get_attribute( $attribute_list, 'oils_obj:validate' );
-			my $virtual  = get_attribute( $attribute_list, 'oils_persist:virtual' );
-			if( ! defined( $virtual ) ) {
-				$virtual = "false";
-			}
-			my $selector = get_attribute( $attribute_list, 'reporter:selector' );
-
-			$$fieldmap{$fm}{fields}{ $name } =
-				{ virtual => ( $virtual eq 'true' ) ? 1 : 0,
-				  required => ( $required eq 'true' ) ? 1 : 0,
-				  position => $array_position,
-				};
-
-			$$fieldmap{$fm}{fields}{ $name }{validate} = qr/$validate/ if (defined($validate));
-
-			# The selector attribute, if present at all, attaches to only one
-			# of the fields in a given class.  So if we see it, we store it at
-			# the level of the enclosing class.
-
-			if( defined( $selector ) ) {
-				$$fieldmap{$fm}{selector} = $selector;
-			}
-
-			++$array_position;
-		}
-	}
-
-	# Load the standard 3 virtual fields ------------------------
-
-	for my $vfield ( qw/isnew ischanged isdeleted/ ) {
-		$$fieldmap{$fm}{fields}{ $vfield } =
-			{ position => $array_position,
-			  virtual => 1
-			};
-		++$array_position;
-	}
+    my $field_list = shift;
+    my $fm = shift;
+
+    # Get attributes of the field list.  Since there is only one
+    # <field> per class, these attributes logically belong to the
+    # enclosing class, and that's where we load them.
+
+    my $field_attr_list = $field_list->attributes();
+
+    my $sequence  = get_attribute( $field_attr_list, 'oils_persist:sequence' );
+    if( ! defined( $sequence ) ) {
+        $sequence = '';
+    }
+    my $primary   = get_attribute( $field_attr_list, 'oils_persist:primary' );
+
+    # Load attributes into the Fieldmapper ----------------------
+
+    $$fieldmap{$fm}{ sequence } = $sequence;
+    $$fieldmap{$fm}{ identity } = $primary;
+
+    # Load each field -------------------------------------------
+
+    my $array_position = 0;
+    for my $field ( $field_list->childNodes() ) {    # For each <field>
+        if( $field->nodeName eq 'field' ) {
+    
+            my $attribute_list = $field->attributes();
+            
+            my $name     = get_attribute( $attribute_list, 'name' );
+            next if( $name eq 'isnew' || $name eq 'ischanged' || $name eq 'isdeleted' );
+            my $required  = get_attribute( $attribute_list, 'oils_obj:required' );
+            my $validate  = get_attribute( $attribute_list, 'oils_obj:validate' );
+            my $virtual  = get_attribute( $attribute_list, 'oils_persist:virtual' );
+            if( ! defined( $virtual ) ) {
+                $virtual = "false";
+            }
+            my $selector = get_attribute( $attribute_list, 'reporter:selector' );
+
+            $$fieldmap{$fm}{fields}{ $name } =
+                { virtual => ( $virtual eq 'true' ) ? 1 : 0,
+                  required => ( $required eq 'true' ) ? 1 : 0,
+                  position => $array_position,
+                };
+
+            $$fieldmap{$fm}{fields}{ $name }{validate} = qr/$validate/ if (defined($validate));
+
+            # The selector attribute, if present at all, attaches to only one
+            # of the fields in a given class.  So if we see it, we store it at
+            # the level of the enclosing class.
+
+            if( defined( $selector ) ) {
+                $$fieldmap{$fm}{selector} = $selector;
+            }
+
+            ++$array_position;
+        }
+    }
+
+    # Load the standard 3 virtual fields ------------------------
+
+    for my $vfield ( qw/isnew ischanged isdeleted/ ) {
+        $$fieldmap{$fm}{fields}{ $vfield } =
+            { position => $array_position,
+              virtual => 1
+            };
+        ++$array_position;
+    }
 }
 
 sub load_links {
-	my $link_list = shift;
-	my $fm = shift;
-
-	for my $link ( $link_list->childNodes() ) {    # For each <link>
-		if( $link->nodeName eq 'link' ) {
-			my $attribute_list = $link->attributes();
-			
-			my $field   = get_attribute( $attribute_list, 'field' );
-			my $reltype = get_attribute( $attribute_list, 'reltype' );
-			my $key     = get_attribute( $attribute_list, 'key' );
-			my $class   = get_attribute( $attribute_list, 'class' );
-			my $map	    = get_attribute( $attribute_list, 'map' );
-
-			$$fieldmap{$fm}{links}{ $field } =
-				{ class   => $class,
-				  reltype => $reltype,
-				  key     => $key,
-				  map     => $map
-				};
-		}
-	}
+    my $link_list = shift;
+    my $fm = shift;
+
+    for my $link ( $link_list->childNodes() ) {    # For each <link>
+        if( $link->nodeName eq 'link' ) {
+            my $attribute_list = $link->attributes();
+            
+            my $field   = get_attribute( $attribute_list, 'field' );
+            my $reltype = get_attribute( $attribute_list, 'reltype' );
+            my $key     = get_attribute( $attribute_list, 'key' );
+            my $class   = get_attribute( $attribute_list, 'class' );
+            my $map     = get_attribute( $attribute_list, 'map' );
+
+            $$fieldmap{$fm}{links}{ $field } =
+                { class   => $class,
+                  reltype => $reltype,
+                  key     => $key,
+                  map     => $map
+                };
+        }
+    }
 }
 
 sub load_class {
-	my $class_node = shift;
-
-	# Get attributes ---------------------------------------------
-
-	my $attribute_list = $class_node->attributes();
-
-	my $fm               = get_attribute( $attribute_list, 'oils_obj:fieldmapper' );
-	$fm                  = 'Fieldmapper::' . $fm;
-	my $id               = get_attribute( $attribute_list, 'id' );
-	my $controller       = get_attribute( $attribute_list, 'controller' );
-	my $virtual          = get_attribute( $attribute_list, 'virtual' );
-	if( ! defined( $virtual ) ) {
-		$virtual = 'false';
-	}
-	my $tablename        = get_attribute( $attribute_list, 'oils_persist:tablename' );
-	if( ! defined( $tablename ) ) {
-		$tablename = '';
-	}
-	my $restrict_primary = get_attribute( $attribute_list, 'oils_persist:restrict_primary' );
-	my $field_safe = get_attribute( $attribute_list, 'oils_persist:field_safe' );
-
-	# Load the attributes into the Fieldmapper --------------------
-
-	$log->debug("Building Fieldmapper class for [$fm] from IDL");
-
-	$$fieldmap{$fm}{ hint }             = $id;
-	$$fieldmap{$fm}{ virtual }          = ( $virtual eq 'true' ) ? 1 : 0;
-	$$fieldmap{$fm}{ table }            = $tablename;
-	$$fieldmap{$fm}{ controller }       = [ split ' ', $controller ];
-	$$fieldmap{$fm}{ restrict_primary } = $restrict_primary;
-	$$fieldmap{$fm}{ field_safe }       = $field_safe;
-
-	# Load fields and links
-
-	for my $child ( $class_node->childNodes() ) {
-		my $nodeName = $child->nodeName;
-		if( $nodeName eq 'fields' ) {
-			load_fields( $child, $fm );
-		} elsif( $nodeName eq 'links' ) {
-			load_links( $child, $fm );
-		}
-	}
+    my $class_node = shift;
+
+    # Get attributes ---------------------------------------------
+
+    my $attribute_list = $class_node->attributes();
+
+    my $fm               = get_attribute( $attribute_list, 'oils_obj:fieldmapper' );
+    $fm                  = 'Fieldmapper::' . $fm;
+    my $id               = get_attribute( $attribute_list, 'id' );
+    my $controller       = get_attribute( $attribute_list, 'controller' );
+    my $virtual          = get_attribute( $attribute_list, 'virtual' );
+    if( ! defined( $virtual ) ) {
+        $virtual = 'false';
+    }
+    my $tablename        = get_attribute( $attribute_list, 'oils_persist:tablename' );
+    if( ! defined( $tablename ) ) {
+        $tablename = '';
+    }
+    my $restrict_primary = get_attribute( $attribute_list, 'oils_persist:restrict_primary' );
+    my $field_safe = get_attribute( $attribute_list, 'oils_persist:field_safe' );
+
+    # Load the attributes into the Fieldmapper --------------------
+
+    $log->debug("Building Fieldmapper class for [$fm] from IDL");
+
+    $$fieldmap{$fm}{ hint }             = $id;
+    $$fieldmap{$fm}{ virtual }          = ( $virtual eq 'true' ) ? 1 : 0;
+    $$fieldmap{$fm}{ table }            = $tablename;
+    $$fieldmap{$fm}{ controller }       = [ split ' ', $controller ];
+    $$fieldmap{$fm}{ restrict_primary } = $restrict_primary;
+    $$fieldmap{$fm}{ field_safe }       = $field_safe;
+
+    # Load fields and links
+
+    for my $child ( $class_node->childNodes() ) {
+        my $nodeName = $child->nodeName;
+        if( $nodeName eq 'fields' ) {
+            load_fields( $child, $fm );
+        } elsif( $nodeName eq 'links' ) {
+            load_links( $child, $fm );
+        }
+    }
 }
 
 import();
 sub import {
-	my $class = shift;
-	my %args = @_;
-
-	return if (keys %$fieldmap);
-	return if (!OpenSRF::System->connected && !$args{IDL});
-
-	# parse the IDL ...
-	my $parser = XML::LibXML->new();
-	my $file = $args{IDL} || OpenSRF::Utils::SettingsClient->new->config_value( 'IDL' );
-	my $fmdoc = $parser->parse_file( $file );
-	my $rootnode = $fmdoc->documentElement();
-
-	for my $child ( $rootnode->childNodes() ) {    # For each <class>
-		my $nodeName = $child->nodeName;
-		if( $nodeName eq 'class' ) {
-			load_class( $child );
-		}
-	}
-
-	#-------------------------------------------------------------------------------
-	# Now comes the evil!  Generate classes
-
-	for my $pkg ( __PACKAGE__->classes ) {
-		(my $cdbi = $pkg) =~ s/^Fieldmapper:://o;
-
-		eval <<"		PERL";
-			package $pkg;
-			use base 'Fieldmapper';
-		PERL
-
-		if (exists $$fieldmap{$pkg}{proto_fields}) {
-			for my $pfield ( sort keys %{ $$fieldmap{$pkg}{proto_fields} } ) {
-				$$fieldmap{$pkg}{fields}{$pfield} = { position => $pos, virtual => $$fieldmap{$pkg}{proto_fields}{$pfield} };
-				$pos++;
-			}
-		}
-
-		OpenSRF::Utils::JSON->register_class_hint(
-			hint => $pkg->json_hint,
-			name => $pkg,
-			type => 'array',
-		);
-
-	}
+    my $class = shift;
+    my %args = @_;
+
+    return if (keys %$fieldmap);
+    return if (!OpenSRF::System->connected && !$args{IDL});
+
+    # parse the IDL ...
+    my $parser = XML::LibXML->new();
+    my $file = $args{IDL} || OpenSRF::Utils::SettingsClient->new->config_value( 'IDL' );
+    my $fmdoc = $parser->parse_file( $file );
+    my $rootnode = $fmdoc->documentElement();
+
+    for my $child ( $rootnode->childNodes() ) {    # For each <class>
+        my $nodeName = $child->nodeName;
+        if( $nodeName eq 'class' ) {
+            load_class( $child );
+        }
+    }
+
+    #-------------------------------------------------------------------------------
+    # Now comes the evil!  Generate classes
+
+    for my $pkg ( __PACKAGE__->classes ) {
+        (my $cdbi = $pkg) =~ s/^Fieldmapper:://o;
+
+        eval <<"        PERL";
+            package $pkg;
+            use base 'Fieldmapper';
+        PERL
+
+        if (exists $$fieldmap{$pkg}{proto_fields}) {
+            for my $pfield ( sort keys %{ $$fieldmap{$pkg}{proto_fields} } ) {
+                $$fieldmap{$pkg}{fields}{$pfield} = { position => $pos, virtual => $$fieldmap{$pkg}{proto_fields}{$pfield} };
+                $pos++;
+            }
+        }
+
+        OpenSRF::Utils::JSON->register_class_hint(
+            hint => $pkg->json_hint,
+            name => $pkg,
+            type => 'array',
+        );
+
+    }
 }
 
 sub new {
-	my $self = shift;
-	my $value = shift;
-	$value = [] unless (defined $value);
-	return bless $value => $self->class_name;
+    my $self = shift;
+    my $value = shift;
+    $value = [] unless (defined $value);
+    return bless $value => $self->class_name;
 }
 
 sub decast {
-	my $self = shift;
-	return [ @$self ];
+    my $self = shift;
+    return [ @$self ];
 }
 
 sub DESTROY {}
 
 sub AUTOLOAD {
-	my $obj = shift;
-	my $value = shift;
-	(my $field = $AUTOLOAD) =~ s/^.*://o;
-	my $class_name = $obj->class_name;
-
-	my $fpos = $field;
-	$fpos  =~ s/^clear_//og ;
-
-	my $pos = $$fieldmap{$class_name}{fields}{$fpos}{position};
-
-	if ($field =~ /^clear_/o) {
-		{	no strict 'subs';
-			*{$obj->class_name."::$field"} = sub {
-				my $self = shift;
-				$self->[$pos] = undef;
-				return 1;
-			};
-		}
-		return $obj->$field();
-	}
-
-	die "No field by the name $field in $class_name!"
-		unless (exists $$fieldmap{$class_name}{fields}{$field} && defined($pos));
-
-
-	{	no strict 'subs';
-		*{$obj->class_name."::$field"} = sub {
-			my $self = shift;
-			my $new_val = shift;
-			$self->[$pos] = $new_val if (defined $new_val);
-			return $self->[$pos];
-		};
-	}
-	return $obj->$field($value);
+    my $obj = shift;
+    my $value = shift;
+    (my $field = $AUTOLOAD) =~ s/^.*://o;
+    my $class_name = $obj->class_name;
+
+    my $fpos = $field;
+    $fpos  =~ s/^clear_//og ;
+
+    my $pos = $$fieldmap{$class_name}{fields}{$fpos}{position};
+
+    if ($field =~ /^clear_/o) {
+        {   no strict 'subs';
+            *{$obj->class_name."::$field"} = sub {
+                my $self = shift;
+                $self->[$pos] = undef;
+                return 1;
+            };
+        }
+        return $obj->$field();
+    }
+
+    die "No field by the name $field in $class_name!"
+        unless (exists $$fieldmap{$class_name}{fields}{$field} && defined($pos));
+
+
+    {   no strict 'subs';
+        *{$obj->class_name."::$field"} = sub {
+            my $self = shift;
+            my $new_val = shift;
+            $self->[$pos] = $new_val if (defined $new_val);
+            return $self->[$pos];
+        };
+    }
+    return $obj->$field($value);
 }
 
 sub Selector {
-	my $self = shift;
-	return $$fieldmap{$self->class_name}{selector};
+    my $self = shift;
+    return $$fieldmap{$self->class_name}{selector};
 }
 
 sub Identity {
-	my $self = shift;
-	return $$fieldmap{$self->class_name}{identity};
+    my $self = shift;
+    return $$fieldmap{$self->class_name}{identity};
 }
 
 sub RestrictPrimary {
-	my $self = shift;
-	return $$fieldmap{$self->class_name}{restrict_primary};
+    my $self = shift;
+    return $$fieldmap{$self->class_name}{restrict_primary};
 }
 
 sub Sequence {
-	my $self = shift;
-	return $$fieldmap{$self->class_name}{sequence};
+    my $self = shift;
+    return $$fieldmap{$self->class_name}{sequence};
 }
 
 sub Table {
-	my $self = shift;
-	return $$fieldmap{$self->class_name}{table};
+    my $self = shift;
+    return $$fieldmap{$self->class_name}{table};
 }
 
 sub Controller {
-	my $self = shift;
-	return $$fieldmap{$self->class_name}{controller};
+    my $self = shift;
+    return $$fieldmap{$self->class_name}{controller};
 }
 
 sub RequiredField {
-	my $self = shift;
-	my $f = shift;
+    my $self = shift;
+    my $f = shift;
     return undef unless ($f);
-	return $$fieldmap{$self->class_name}{fields}{$f}{required};
+    return $$fieldmap{$self->class_name}{fields}{$f}{required};
 }
 
 sub toXML {
@@ -371,87 +371,87 @@ sub toXML {
 }
 
 sub ValidateField {
-	my $self = shift;
-	my $f = shift;
+    my $self = shift;
+    my $f = shift;
     return undef unless ($f);
-	return 1 if (!exists($$fieldmap{$self->class_name}{fields}{$f}{validate}));
-	return $self->$f =~ $$fieldmap{$self->class_name}{fields}{$f}{validate};
+    return 1 if (!exists($$fieldmap{$self->class_name}{fields}{$f}{validate}));
+    return $self->$f =~ $$fieldmap{$self->class_name}{fields}{$f}{validate};
 }
 
 sub class_name {
-	my $class_name = shift;
-	return ref($class_name) || $class_name;
+    my $class_name = shift;
+    return ref($class_name) || $class_name;
 }
 
 sub real_fields {
-	my $self = shift;
-	my $class_name = $self->class_name;
-	my $fields = $$fieldmap{$class_name}{fields};
+    my $self = shift;
+    my $class_name = $self->class_name;
+    my $fields = $$fieldmap{$class_name}{fields};
 
-	my @f = grep {
-			!$$fields{$_}{virtual}
-		} sort {$$fields{$a}{position} <=> $$fields{$b}{position}} keys %$fields;
+    my @f = grep {
+            !$$fields{$_}{virtual}
+        } sort {$$fields{$a}{position} <=> $$fields{$b}{position}} keys %$fields;
 
-	return @f;
+    return @f;
 }
 
 sub has_field {
-	my $self = shift;
-	my $field = shift;
-	my $class_name = $self->class_name;
-	return 1 if grep { $_ eq $field } keys %{$$fieldmap{$class_name}{fields}};
-	return 0;
+    my $self = shift;
+    my $field = shift;
+    my $class_name = $self->class_name;
+    return 1 if grep { $_ eq $field } keys %{$$fieldmap{$class_name}{fields}};
+    return 0;
 }
 
 sub properties {
-	my $self = shift;
-	my $class_name = $self->class_name;
-	return keys %{$$fieldmap{$class_name}{fields}};
+    my $self = shift;
+    my $class_name = $self->class_name;
+    return keys %{$$fieldmap{$class_name}{fields}};
 }
 
 sub to_bare_hash {
-	my $self = shift;
+    my $self = shift;
 
-	my %hash = ();
-	for my $f ($self->properties) {
-		my $val = $self->$f;
-		$hash{$f} = $val;
-	}
+    my %hash = ();
+    for my $f ($self->properties) {
+        my $val = $self->$f;
+        $hash{$f} = $val;
+    }
 
-	return \%hash;
+    return \%hash;
 }
 
 sub clone {
-	my $self = shift;
-	return $self->new( [@$self] );
+    my $self = shift;
+    return $self->new( [@$self] );
 }
 
 sub api_level {
-	my $self = shift;
-	return $fieldmap->{$self->class_name}->{api_level};
+    my $self = shift;
+    return $fieldmap->{$self->class_name}->{api_level};
 }
 
 sub cdbi {
-	my $self = shift;
-	return $fieldmap->{$self->class_name}->{cdbi};
+    my $self = shift;
+    return $fieldmap->{$self->class_name}->{cdbi};
 }
 
 sub is_virtual {
-	my $self = shift;
-	my $field = shift;
-	return $fieldmap->{$self->class_name}->{proto_fields}->{$field} if ($field);
-	return $fieldmap->{$self->class_name}->{virtual};
+    my $self = shift;
+    my $field = shift;
+    return $fieldmap->{$self->class_name}->{proto_fields}->{$field} if ($field);
+    return $fieldmap->{$self->class_name}->{virtual};
 }
 
 sub is_readonly {
-	my $self = shift;
-	my $field = shift;
-	return $fieldmap->{$self->class_name}->{readonly};
+    my $self = shift;
+    my $field = shift;
+    return $fieldmap->{$self->class_name}->{readonly};
 }
 
 sub json_hint {
-	my $self = shift;
-	return $fieldmap->{$self->class_name}->{hint};
+    my $self = shift;
+    return $fieldmap->{$self->class_name}->{hint};
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/Caption.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/Caption.pm
index a873372..a1c9e1b 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/Caption.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/Caption.pm
@@ -45,19 +45,19 @@ sub new {
         } elsif ($key eq 'u') {
             # Bib units per next higher enumeration level
 
-	    # Some files seem to have "empty" $u subfields,
-	    # especially for top level of enumeration. Just drop them
-	    next if (!defined($val) || !$val);
+        # Some files seem to have "empty" $u subfields,
+        # especially for top level of enumeration. Just drop them
+        next if (!defined($val) || !$val);
 
             carp('$u specified for top-level enumeration')
               unless defined($last_enum);
             $self->{_mfhdc_ENUMS}->{$last_enum}->{COUNT} = $val;
         } elsif ($key eq 'v') {
-	    # Is this level of enumeration continuous, or does it restart?
+        # Is this level of enumeration continuous, or does it restart?
 
-	    # Some files seem to have "empty" $v subfields,
-	    # especially for top level of enumeration. Just drop them
-	    next if (!defined($val) || !$val);
+        # Some files seem to have "empty" $v subfields,
+        # especially for top level of enumeration. Just drop them
+        next if (!defined($val) || !$val);
 
             carp '$v specified for top-level enumeration'
               unless defined($last_enum);
@@ -256,7 +256,7 @@ sub is_omitted {
     my @date = @_;
 
     #     printf("# is_omitted: testing date %s: %d\n", join('/', @date),
-    # 	   $self->regularity_match('o', @date));
+    #      $self->regularity_match('o', @date));
     return $self->regularity_match('o', @date);
 }
 
@@ -307,11 +307,11 @@ sub on_or_after {
 
     foreach my $i (0..(scalar(@{$dt2}) - 1)) {
         if ($dt1->[$i] > $dt2->[$i]) {
-            # 	    printf("after - pass\n");
+            #       printf("after - pass\n");
             # $dt1 occurs AFTER $dt2
             return 1;
         } elsif ($dt1->[$i] < $dt2->[$i]) {
-            # 	    printf("before - fail\n");
+            #       printf("before - fail\n");
             # $dt1 occurs BEFORE $dt2
             return 0;
         }
@@ -348,9 +348,9 @@ sub calendar_increment {
             ($month, $day) = unpack("a2a2", $change);
         }
 
-        # 	printf("# calendar_increment('%s', '%s'): change on '%s/%s'\n",
-        # 	       join('/', @{$cur}), join('/', @{$new}),
-        # 	       $month, defined($day) ? $day : 'UNDEF');
+        #   printf("# calendar_increment('%s', '%s'): change on '%s/%s'\n",
+        #          join('/', @{$cur}), join('/', @{$new}),
+        #          $month, defined($day) ? $day : 'UNDEF');
 
         if ($cur->[0] == $new->[0]) {
             # Same year, so a 'simple' month/day comparison will be fine
@@ -422,7 +422,7 @@ sub next_chron {
                 my ($start, $end);
                 my @candidate;
 
-                # 		printf("# next_date: generating with pattern '%s'\n", $pat);
+                #       printf("# next_date: generating with pattern '%s'\n", $pat);
 
                 if ($combined) {
                     ($start, $end) = split('/', $pat, 2);
@@ -433,13 +433,13 @@ sub next_chron {
                 @candidate = $genfunc->($start || $pat, \@cur, $self);
 
                 while ($self->is_omitted(@candidate)) {
-                    # 		    printf("# pubpat omitting date '%s'\n",
-                    # 			   join('/', @candidate));
+                    #           printf("# pubpat omitting date '%s'\n",
+                    #              join('/', @candidate));
                     @candidate = $genfunc->($start || $pat, \@candidate, $self);
                 }
 
-                # 		printf("# testing new candidate '%s' against '%s'\n",
-                # 		       join('/', @candidate), join('/', @new));
+                #       printf("# testing new candidate '%s' against '%s'\n",
+                #              join('/', @candidate), join('/', @new));
 
                 if (!defined($new[0]) || !on_or_after(\@candidate, \@new)) {
                     # first time through the loop
@@ -452,7 +452,7 @@ sub next_chron {
                         $newend[0] = undef;
                     }
 
-           # 		    printf("# selecting candidate date '%s'\n", join('/', @new));
+           #            printf("# selecting candidate date '%s'\n", join('/', @new));
                 }
             }
         }
@@ -639,8 +639,8 @@ sub next_enum {
         $pubpat = $self->enum_pubpat($level);
 
         if ($pubpat) {
-            # 	    printf("# next_enum: found pubpat '%s' for subfield '%s'\n",
-            # 		   $pubpat, $key);
+            #       printf("# next_enum: found pubpat '%s' for subfield '%s'\n",
+            #          $pubpat, $key);
             my @pats = split(/,/, $pubpat);
 
             # If we fall out the bottom of the loop, then $carry
@@ -653,8 +653,8 @@ sub next_enum {
                 my $combined = $pat =~ m|/|;
                 my $end;
 
-             # 		printf("# next_enum: checking current '%s' against pat '%s'\n",
-             # 		       $next->{$key}, $pat);
+             #      printf("# next_enum: checking current '%s' against pat '%s'\n",
+             #             $next->{$key}, $pat);
 
                 if ($combined) {
                     ($pat, $end) = split('/', $pat, 2);
@@ -666,7 +666,7 @@ sub next_enum {
                     $carry = 0;
                     $next->{$key} = $pat;
                     $next->{$key} .= '/' . $end if $end;
-     # 		    printf("# next_enum: selecting new issue no. %s\n", $next->{$key});
+     #          printf("# next_enum: selecting new issue no. %s\n", $next->{$key});
                     last;    # We've found the correct next issue number
                 }
             }
@@ -688,7 +688,7 @@ sub next_enum {
                 last;
             }
 
-        # 	    printf("# next_enum: no publication pattern, using frequency\n");
+        #       printf("# next_enum: no publication pattern, using frequency\n");
 
             my $cap = $self->capfield($key);
             if (   $cap->{RESTART}
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/Date.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/Date.pm
index e442347..b084777 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/Date.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/MFHD/Date.pm
@@ -303,8 +303,8 @@ sub subsequent_week {
         # WWdd: published on given weekday of given week of every month
         my ($week, $day) = ($1, $2);
 
-        # 	printf("# subsequent_week: matched /WWdd/: week='%s', day='%s'\n",
-        # 	       $week, $day);
+        #   printf("# subsequent_week: matched /WWdd/: week='%s', day='%s'\n",
+        #          $week, $day);
 
         if ($week eq '00') {
             # Every week
@@ -327,9 +327,9 @@ sub subsequent_week {
 # current issue, then the next issue is published next
 # month, otherwise, it's published this month.
 # This will never happen for the "00: every week" pattern
-# 	    printf("# subsequent_week: candidate (%s) occurs on or before current date (%s)\n",
-# 		   join('/', $candidate->year, $candidate->month, $candidate->day),
-# 		   join('/', $dt->year, $dt->month, $dt->day));
+#       printf("# subsequent_week: candidate (%s) occurs on or before current date (%s)\n",
+#          join('/', $candidate->year, $candidate->month, $candidate->day),
+#          join('/', $dt->year, $dt->month, $dt->day));
             $candidate->set(day => 1);
             $candidate->add(months => 1);
             $candidate = nth_week_of_month($candidate, $week, $day);
@@ -338,8 +338,8 @@ sub subsequent_week {
         # MMWWdd: published on given weekday of given week of given month
         my ($month, $week, $day) = ($1, $2, $3);
 
-# 	printf("# subsequent_week: matched /MMWWdd/: month='%s', week='%s', day='%s'\n",
-# 	       $month, $week, $day);
+#   printf("# subsequent_week: matched /MMWWdd/: month='%s', week='%s', day='%s'\n",
+#          $month, $week, $day);
 
         $candidate = DateTime->new(
             year  => $dt->year,
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/ModsParser.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/ModsParser.pm
index 1ab2c86..d2e92aa 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/ModsParser.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/ModsParser.pm
@@ -10,97 +10,97 @@ use OpenSRF::Utils::SettingsClient;
 use OpenSRF::Utils::Logger qw/$logger/;
 use Data::Dumper;
 
-my $parser		= XML::LibXML->new();
-my $xslt			= XML::LibXSLT->new();
+my $parser      = XML::LibXML->new();
+my $xslt            = XML::LibXSLT->new();
 my $mods_sheet;
 
 # ----------------------------------------------------------------------------------------
 # XPATH for extracting info from a MODS doc
-my $isbn_xpath			= "//mods:mods/mods:identifier[\@type='isbn' and not(\@invalid)]";
-my $resource_xpath	= "//mods:mods/mods:typeOfResource";
-my $pub_xpath			= "//mods:mods/mods:originInfo//mods:dateIssued[\@encoding='marc']|" . 
-								"//mods:mods/mods:originInfo//mods:dateIssued[1]";
-my $tcn_xpath			= "//mods:mods/mods:recordInfo/mods:recordIdentifier";
-my $publisher_xpath	= "//mods:mods/mods:originInfo//mods:publisher[1]";
-my $edition_xpath		= "//mods:mods/mods:originInfo//mods:edition[1]";
-my $abstract_xpath	= "//mods:mods/mods:abstract";
-my $related_xpath		= "";
+my $isbn_xpath          = "//mods:mods/mods:identifier[\@type='isbn' and not(\@invalid)]";
+my $resource_xpath  = "//mods:mods/mods:typeOfResource";
+my $pub_xpath           = "//mods:mods/mods:originInfo//mods:dateIssued[\@encoding='marc']|" . 
+                                "//mods:mods/mods:originInfo//mods:dateIssued[1]";
+my $tcn_xpath           = "//mods:mods/mods:recordInfo/mods:recordIdentifier";
+my $publisher_xpath = "//mods:mods/mods:originInfo//mods:publisher[1]";
+my $edition_xpath       = "//mods:mods/mods:originInfo//mods:edition[1]";
+my $abstract_xpath  = "//mods:mods/mods:abstract";
+my $related_xpath       = "";
 my $online_loc_xpath = "//mods:location/mods:url";
-my $physical_desc		= "(//mods:mods/mods:physicalDescription/mods:form|//mods:mods/mods:physicalDescription/mods:extent|".
-	"//mods:mods/mods:physicalDescription/mods:reformattingQuality|//mods:mods/mods:physicalDescription/mods:internetMediaType|".
-	"//mods:mods/mods:physicalDescription/mods:digitalOrigin)";
-my $toc_xpath			= "//mods:tableOfContents";
+my $physical_desc       = "(//mods:mods/mods:physicalDescription/mods:form|//mods:mods/mods:physicalDescription/mods:extent|".
+    "//mods:mods/mods:physicalDescription/mods:reformattingQuality|//mods:mods/mods:physicalDescription/mods:internetMediaType|".
+    "//mods:mods/mods:physicalDescription/mods:digitalOrigin)";
+my $toc_xpath           = "//mods:tableOfContents";
 
 my $xpathset = {
 
-	title => {
-		abbreviated => 
-			"//mods:mods/mods:titleInfo[mods:title and (\@type='abbreviated')]",
-		translated =>
-			"//mods:mods/mods:titleInfo[mods:title and (\@type='translated')]",
-		uniform =>
-			"//mods:mods/mods:titleInfo[mods:title and (\@type='uniform')]",
-		proper =>
-			"//mods:mods/mods:titleInfo[mods:title and not (\@type)]",
-		any =>
-			"//mods:mods/mods:titleInfo",
-	},
-
-	author => {
-		corporate => 
-			"//mods:mods/mods:name[\@type='corporate']/*[local-name()='namePart']".
-				"[../mods:role/mods:text[text()='creator']".
-				" or ../mods:role/mods:roleTerm[".
-				"        \@type='text'".
-				"        and \@authority='marcrelator'".
-				"        and text()='creator']".
-				"][1]",
-		personal => 
-			"//mods:mods/mods:name[\@type='personal']/*[local-name()='namePart']".
-				"[../mods:role/mods:text[text()='creator']".
-				" or ../mods:role/mods:roleTerm[".
-				"        \@type='text'".
-				"        and \@authority='marcrelator'".
-				"        and text()='creator']".
-				"][1]",
-		conference => 
-			"//mods:mods/mods:name[\@type='conference']/*[local-name()='namePart']".
-				"[../mods:role/mods:text[text()='creator']".
-				" or ../mods:role/mods:roleTerm[".
-				"        \@type='text'".
-				"        and \@authority='marcrelator'".
-				"        and text()='creator']".
-				"][1]",
-		other => 
-			"//mods:mods/mods:name[\@type='personal']/*[local-name()='namePart']",
-		any => 
-			"//mods:mods/mods:name/*[local-name()='namePart'][1]",
-	},
-
-	subject => {
-
-		topic => 
-			"//mods:mods/mods:subject/*[".
-			"   local-name()='geographic'".
-			"   or local-name()='name'".
-			"   or local-name()='temporal'".
-			"   or local-name()='topic'".
-			"]/parent::mods:subject",
-
-#		geographic => 
-#			"//mods:mods/*[local-name()='subject']/*[local-name()='geographic']",
-#		name => 
-#			"//mods:mods/*[local-name()='subject']/*[local-name()='name']",
-#		temporal => 
-#			"//mods:mods/*[local-name()='subject']/*[local-name()='temporal']",
-#		topic => 
-#			"//mods:mods/*[local-name()='subject']/*[local-name()='topic']",
-	},
-	#keyword => { keyword => "//mods:mods/*[not(local-name()='originInfo')]", },
-
-	series => {
-		series => "//mods:mods/mods:relatedItem[\@type='series']/mods:titleInfo"
-	}
+    title => {
+        abbreviated => 
+            "//mods:mods/mods:titleInfo[mods:title and (\@type='abbreviated')]",
+        translated =>
+            "//mods:mods/mods:titleInfo[mods:title and (\@type='translated')]",
+        uniform =>
+            "//mods:mods/mods:titleInfo[mods:title and (\@type='uniform')]",
+        proper =>
+            "//mods:mods/mods:titleInfo[mods:title and not (\@type)]",
+        any =>
+            "//mods:mods/mods:titleInfo",
+    },
+
+    author => {
+        corporate => 
+            "//mods:mods/mods:name[\@type='corporate']/*[local-name()='namePart']".
+                "[../mods:role/mods:text[text()='creator']".
+                " or ../mods:role/mods:roleTerm[".
+                "        \@type='text'".
+                "        and \@authority='marcrelator'".
+                "        and text()='creator']".
+                "][1]",
+        personal => 
+            "//mods:mods/mods:name[\@type='personal']/*[local-name()='namePart']".
+                "[../mods:role/mods:text[text()='creator']".
+                " or ../mods:role/mods:roleTerm[".
+                "        \@type='text'".
+                "        and \@authority='marcrelator'".
+                "        and text()='creator']".
+                "][1]",
+        conference => 
+            "//mods:mods/mods:name[\@type='conference']/*[local-name()='namePart']".
+                "[../mods:role/mods:text[text()='creator']".
+                " or ../mods:role/mods:roleTerm[".
+                "        \@type='text'".
+                "        and \@authority='marcrelator'".
+                "        and text()='creator']".
+                "][1]",
+        other => 
+            "//mods:mods/mods:name[\@type='personal']/*[local-name()='namePart']",
+        any => 
+            "//mods:mods/mods:name/*[local-name()='namePart'][1]",
+    },
+
+    subject => {
+
+        topic => 
+            "//mods:mods/mods:subject/*[".
+            "   local-name()='geographic'".
+            "   or local-name()='name'".
+            "   or local-name()='temporal'".
+            "   or local-name()='topic'".
+            "]/parent::mods:subject",
+
+#       geographic => 
+#           "//mods:mods/*[local-name()='subject']/*[local-name()='geographic']",
+#       name => 
+#           "//mods:mods/*[local-name()='subject']/*[local-name()='name']",
+#       temporal => 
+#           "//mods:mods/*[local-name()='subject']/*[local-name()='temporal']",
+#       topic => 
+#           "//mods:mods/*[local-name()='subject']/*[local-name()='topic']",
+    },
+    #keyword => { keyword => "//mods:mods/*[not(local-name()='originInfo')]", },
+
+    series => {
+        series => "//mods:mods/mods:relatedItem[\@type='series']/mods:titleInfo"
+    }
 };
 # ----------------------------------------------------------------------------------------
 
@@ -110,147 +110,147 @@ sub new { return bless( {}, shift() ); }
 
 sub get_field_value {
 
-	my( $self, $mods, $xpath, $type) = @_;
-
-	my @string;
-
-	my $root = $mods->documentElement;
-	$root->setNamespace( "http://www.loc.gov/mods/v3", "mods", 1 );
-
-	try {
-		# grab the set of matching nodes
-		my @nodes = $root->findnodes( $xpath );
-		for my $value (@nodes) {
-
-			# grab all children of the node
-			my @children = $value->childNodes();
-			my @child_text;
-			for my $child (@children) {
-				# MODS strips the punctuation from 245abc, which often
-				# results in "title subtitle" rather than "title : subtitle";
-				# this hack gets it back for us
-				if ($type && $type eq 'title' && $child->nodeName =~ m/subTitle/) {
-					push(@child_text, " : "); 
-				}
-				next unless( $child->nodeType != 3 );
-
-				if($child->childNodes) {
-					my @a;
-					for my $c (@{$child->childNodes}){
-						push @a, $c->textContent;
-					}
-					push(@child_text, join(' ', @a));
-
-				} else {
-					push(@child_text, $child->textContent); 
-				}
-
-			}
-			if(@child_text) {
-				push(@string, \@child_text);
-			}
-
-			if( !@child_text  ) {
-				push(@string, $value->textContent );
-			}
-		}
-	} otherwise {
-		$logger->info("MODS-izing failure: ".shift());
-		$logger->info("Failed MODS xml: ".$root->toString);
-		$logger->info("Failed MODS xpath: $xpath");
-	};
-	return @string;
+    my( $self, $mods, $xpath, $type) = @_;
+
+    my @string;
+
+    my $root = $mods->documentElement;
+    $root->setNamespace( "http://www.loc.gov/mods/v3", "mods", 1 );
+
+    try {
+        # grab the set of matching nodes
+        my @nodes = $root->findnodes( $xpath );
+        for my $value (@nodes) {
+
+            # grab all children of the node
+            my @children = $value->childNodes();
+            my @child_text;
+            for my $child (@children) {
+                # MODS strips the punctuation from 245abc, which often
+                # results in "title subtitle" rather than "title : subtitle";
+                # this hack gets it back for us
+                if ($type && $type eq 'title' && $child->nodeName =~ m/subTitle/) {
+                    push(@child_text, " : "); 
+                }
+                next unless( $child->nodeType != 3 );
+
+                if($child->childNodes) {
+                    my @a;
+                    for my $c (@{$child->childNodes}){
+                        push @a, $c->textContent;
+                    }
+                    push(@child_text, join(' ', @a));
+
+                } else {
+                    push(@child_text, $child->textContent); 
+                }
+
+            }
+            if(@child_text) {
+                push(@string, \@child_text);
+            }
+
+            if( !@child_text  ) {
+                push(@string, $value->textContent );
+            }
+        }
+    } otherwise {
+        $logger->info("MODS-izing failure: ".shift());
+        $logger->info("Failed MODS xml: ".$root->toString);
+        $logger->info("Failed MODS xpath: $xpath");
+    };
+    return @string;
 }
 
 =head1 old implementation
 
 sub _modsdoc_to_values {
-	my( $self, $mods ) = @_;
-	my $data = {};
-	for my $class (keys %$xpathset) {
-		$data->{$class} = {};
-		for my $type(keys %{$xpathset->{$class}}) {
-			my @value = $self->get_field_value( $mods, $xpathset->{$class}->{$type} );
-			if( $class eq "subject" ) {
-				push( @{$data->{$class}->{$type}},  @value );
-			} else {
-				$data->{$class}->{$type} = $value[0];
-			}
-		}
-	}
-	return $data;
+    my( $self, $mods ) = @_;
+    my $data = {};
+    for my $class (keys %$xpathset) {
+        $data->{$class} = {};
+        for my $type(keys %{$xpathset->{$class}}) {
+            my @value = $self->get_field_value( $mods, $xpathset->{$class}->{$type} );
+            if( $class eq "subject" ) {
+                push( @{$data->{$class}->{$type}},  @value );
+            } else {
+                $data->{$class}->{$type} = $value[0];
+            }
+        }
+    }
+    return $data;
 }
 
 =cut
 
 sub modsdoc_to_values {
-	my( $self, $mods ) = @_;
-	my $data = {};
-
-	{
-		my $class = "subject";
-		$data->{$class} = {};
-		for my $type(keys %{$xpathset->{$class}}) {
-			my @value = $self->get_field_value( $mods, $xpathset->{$class}->{$type} );
-			for my $arr (@value) {
-				push( @{$data->{$class}->{$type}},  $arr);
-			}
-		}
-	}
-
-	{
-		my $class = "title";
-		$data->{$class} = {};
-		for my $type(keys %{$xpathset->{$class}}) {
-			my @value = $self->get_field_value( $mods, $xpathset->{$class}->{$type}, "title" );
-			for my $arr (@value) {
-				if( ref($arr) ) {
-					$data->{$class}->{$type} = shift @$arr;
-
-					my $t = lc($data->{$class}->{$type});
-					if($t and $t =~ /^l[eoa]s|l[ae]|el|the|un[ae]?|an?\s?$/o ) {
-						my $val = shift @$arr || "";
-						$data->{$class}->{$type} .= " $val" if $data->{$class}->{$type};
-						$data->{$class}->{$type} = " $val" unless $data->{$class}->{$type};
-					}
-
-					for my $t (@$arr) {
-						$data->{$class}->{$type} .= " $t";
-					}
-				} else {
-					$data->{$class}->{$type} = $arr;
-				}
-			}
-			$data->{$class}->{$type} =~ s/\s+/ /go if ($data->{$class}->{$type});
-		}
-	}
-
-	{
-		my $class = "author";
-		$data->{$class} = {};
-		for my $type(keys %{$xpathset->{$class}}) {
-			my @value = $self->get_field_value( $mods, $xpathset->{$class}->{$type} );
-			$data->{$class}->{$type} = $value[0];
-		}
-	}
-
-	{
-		my $class = "series";
-		$data->{$class} = {};
-		for my $type(keys %{$xpathset->{$class}}) {
-			my @value = $self->get_field_value( $mods, $xpathset->{$class}->{$type} );
-			for my $arr (@value) {
-				if( ref($arr) ) {
-					push(@{$data->{$class}->{$type}}, join(" ", @$arr));
-				} else {
-					push( @{$data->{$class}->{$type}}, $arr );
-				}
-			}
-		}
-
-	}
-
-	return $data;
+    my( $self, $mods ) = @_;
+    my $data = {};
+
+    {
+        my $class = "subject";
+        $data->{$class} = {};
+        for my $type(keys %{$xpathset->{$class}}) {
+            my @value = $self->get_field_value( $mods, $xpathset->{$class}->{$type} );
+            for my $arr (@value) {
+                push( @{$data->{$class}->{$type}},  $arr);
+            }
+        }
+    }
+
+    {
+        my $class = "title";
+        $data->{$class} = {};
+        for my $type(keys %{$xpathset->{$class}}) {
+            my @value = $self->get_field_value( $mods, $xpathset->{$class}->{$type}, "title" );
+            for my $arr (@value) {
+                if( ref($arr) ) {
+                    $data->{$class}->{$type} = shift @$arr;
+
+                    my $t = lc($data->{$class}->{$type});
+                    if($t and $t =~ /^l[eoa]s|l[ae]|el|the|un[ae]?|an?\s?$/o ) {
+                        my $val = shift @$arr || "";
+                        $data->{$class}->{$type} .= " $val" if $data->{$class}->{$type};
+                        $data->{$class}->{$type} = " $val" unless $data->{$class}->{$type};
+                    }
+
+                    for my $t (@$arr) {
+                        $data->{$class}->{$type} .= " $t";
+                    }
+                } else {
+                    $data->{$class}->{$type} = $arr;
+                }
+            }
+            $data->{$class}->{$type} =~ s/\s+/ /go if ($data->{$class}->{$type});
+        }
+    }
+
+    {
+        my $class = "author";
+        $data->{$class} = {};
+        for my $type(keys %{$xpathset->{$class}}) {
+            my @value = $self->get_field_value( $mods, $xpathset->{$class}->{$type} );
+            $data->{$class}->{$type} = $value[0];
+        }
+    }
+
+    {
+        my $class = "series";
+        $data->{$class} = {};
+        for my $type(keys %{$xpathset->{$class}}) {
+            my @value = $self->get_field_value( $mods, $xpathset->{$class}->{$type} );
+            for my $arr (@value) {
+                if( ref($arr) ) {
+                    push(@{$data->{$class}->{$type}}, join(" ", @$arr));
+                } else {
+                    push( @{$data->{$class}->{$type}}, $arr );
+                }
+            }
+        }
+
+    }
+
+    return $data;
 }
 
 
@@ -260,55 +260,55 @@ sub modsdoc_to_values {
 # Grabs the data 'we want' from the MODS doc and returns it in hash form
 # ---------------------------------------------------------------------------
 sub mods_values_to_mods_slim {
-	my( $self, $modsperl ) = @_;
-
-	my $title = "";
-	my $author = "";
-	my $subject = [];
-	my $series	= [];
-
-	my $tmp = $modsperl->{title};
-
-
-	if(!$tmp) { $title = ""; }
-	else {
-		($title = $tmp->{proper}) ||
-		($title = $tmp->{translated}) ||
-		($title = $tmp->{abbreviated}) ||
-		($title = $tmp->{uniform}) ||
-		($title = $tmp->{any});
-	}
-
-	$tmp = $modsperl->{author};
-	if(!$tmp) { $author = ""; }
-	else {
-		($author = $tmp->{personal}) ||
-		($author = $tmp->{corporate}) ||
-		($author = $tmp->{conference}) ||
-		($author = $tmp->{other}) ||
-		($author = $tmp->{any}); 
-	}
-
-	$tmp = $modsperl->{subject};
-	if(!$tmp) { $subject = {}; } 
-	else {
-		for my $key( keys %{$tmp}) {
-			push(@$subject, @{$tmp->{$key}}) if ($tmp->{$key});
-		}
-		my $subh = {};
-		for my $s (@$subject) {
-			if(defined($subh->{$s})) { $subh->{$s->[0]}++ } else { $subh->{$s->[0]} = 1;}
-		}
-		$subject = $subh
-	}
-
-	$tmp = $modsperl->{'series'};
-	if(!$tmp) { $series = []; }
-	else { $series = $tmp->{'series'}; }
-
-
-	return { series => $series, title => $title, 
-			author => $author, subject => $subject };
+    my( $self, $modsperl ) = @_;
+
+    my $title = "";
+    my $author = "";
+    my $subject = [];
+    my $series  = [];
+
+    my $tmp = $modsperl->{title};
+
+
+    if(!$tmp) { $title = ""; }
+    else {
+        ($title = $tmp->{proper}) ||
+        ($title = $tmp->{translated}) ||
+        ($title = $tmp->{abbreviated}) ||
+        ($title = $tmp->{uniform}) ||
+        ($title = $tmp->{any});
+    }
+
+    $tmp = $modsperl->{author};
+    if(!$tmp) { $author = ""; }
+    else {
+        ($author = $tmp->{personal}) ||
+        ($author = $tmp->{corporate}) ||
+        ($author = $tmp->{conference}) ||
+        ($author = $tmp->{other}) ||
+        ($author = $tmp->{any}); 
+    }
+
+    $tmp = $modsperl->{subject};
+    if(!$tmp) { $subject = {}; } 
+    else {
+        for my $key( keys %{$tmp}) {
+            push(@$subject, @{$tmp->{$key}}) if ($tmp->{$key});
+        }
+        my $subh = {};
+        for my $s (@$subject) {
+            if(defined($subh->{$s})) { $subh->{$s->[0]}++ } else { $subh->{$s->[0]} = 1;}
+        }
+        $subject = $subh
+    }
+
+    $tmp = $modsperl->{'series'};
+    if(!$tmp) { $series = []; }
+    else { $series = $tmp->{'series'}; }
+
+
+    return { series => $series, title => $title, 
+            author => $author, subject => $subject };
 }
 
 
@@ -319,65 +319,65 @@ sub mods_values_to_mods_slim {
 
 sub start_mods_batch {
 
-	my( $self, $master_doc ) = @_;
+    my( $self, $master_doc ) = @_;
 
-	if(!$master_doc) {
-		$self->{master_doc} = undef;
-		return;
-	}
+    if(!$master_doc) {
+        $self->{master_doc} = undef;
+        return;
+    }
 
-	if(!$mods_sheet) {
-		 my $xslt_doc = $parser->parse_file(
-			OpenSRF::Utils::SettingsClient->new->config_value(dirs => 'xsl') .  "/MARC21slim2MODS32.xsl");
-		$mods_sheet = $xslt->parse_stylesheet( $xslt_doc );
-	}
+    if(!$mods_sheet) {
+         my $xslt_doc = $parser->parse_file(
+            OpenSRF::Utils::SettingsClient->new->config_value(dirs => 'xsl') .  "/MARC21slim2MODS32.xsl");
+        $mods_sheet = $xslt->parse_stylesheet( $xslt_doc );
+    }
 
 
-	my $xmldoc = $parser->parse_string($master_doc);
-	my $mods = $mods_sheet->transform($xmldoc);
+    my $xmldoc = $parser->parse_string($master_doc);
+    my $mods = $mods_sheet->transform($xmldoc);
 
-	$self->{master_doc} = $self->modsdoc_to_values( $mods );
-	$self->{master_doc} = $self->mods_values_to_mods_slim( $self->{master_doc} );
+    $self->{master_doc} = $self->modsdoc_to_values( $mods );
+    $self->{master_doc} = $self->mods_values_to_mods_slim( $self->{master_doc} );
 
-	($self->{master_doc}->{isbn}) = 
-		$self->get_field_value( $mods, $isbn_xpath );
+    ($self->{master_doc}->{isbn}) = 
+        $self->get_field_value( $mods, $isbn_xpath );
 
-	$self->{master_doc}->{type_of_resource} = 
-		[ $self->get_field_value( $mods, $resource_xpath ) ];
+    $self->{master_doc}->{type_of_resource} = 
+        [ $self->get_field_value( $mods, $resource_xpath ) ];
 
-	($self->{master_doc}->{tcn}) = 
-		$self->get_field_value( $mods, $tcn_xpath );
+    ($self->{master_doc}->{tcn}) = 
+        $self->get_field_value( $mods, $tcn_xpath );
 
-	($self->{master_doc}->{pubdate}) = 
-		$self->get_field_value( $mods, $pub_xpath );
+    ($self->{master_doc}->{pubdate}) = 
+        $self->get_field_value( $mods, $pub_xpath );
 
-	($self->{master_doc}->{publisher}) = 
-		$self->get_field_value( $mods, $publisher_xpath );
+    ($self->{master_doc}->{publisher}) = 
+        $self->get_field_value( $mods, $publisher_xpath );
 
-	($self->{master_doc}->{edition}) =
-		$self->get_field_value( $mods, $edition_xpath );
+    ($self->{master_doc}->{edition}) =
+        $self->get_field_value( $mods, $edition_xpath );
 
 
 
 # ------------------------------
-	# holds an array of [ link, title, link, title, ... ]
-	$self->{master_doc}->{online_loc} = [];
-	for my $url ($mods->findnodes($online_loc_xpath)) {
-		push(@{$self->{master_doc}->{online_loc}}, $url->textContent);
-		push(@{$self->{master_doc}->{online_loc}}, $url->getAttribute('displayLabel') || '');
-		push(@{$self->{master_doc}->{online_loc}}, $url->getAttribute('note') || '');
-	}
+    # holds an array of [ link, title, link, title, ... ]
+    $self->{master_doc}->{online_loc} = [];
+    for my $url ($mods->findnodes($online_loc_xpath)) {
+        push(@{$self->{master_doc}->{online_loc}}, $url->textContent);
+        push(@{$self->{master_doc}->{online_loc}}, $url->getAttribute('displayLabel') || '');
+        push(@{$self->{master_doc}->{online_loc}}, $url->getAttribute('note') || '');
+    }
 
-	($self->{master_doc}->{synopsis}) = 
-		$self->get_field_value( $mods, $abstract_xpath );
+    ($self->{master_doc}->{synopsis}) = 
+        $self->get_field_value( $mods, $abstract_xpath );
 
-	$self->{master_doc}->{physical_description} = [];
-	push(@{$self->{master_doc}->{physical_description}},
-		$self->get_field_value( $mods, $physical_desc ) );
-	$self->{master_doc}->{physical_description} = 
-		join( ' ', @{$self->{master_doc}->{physical_description}});
+    $self->{master_doc}->{physical_description} = [];
+    push(@{$self->{master_doc}->{physical_description}},
+        $self->get_field_value( $mods, $physical_desc ) );
+    $self->{master_doc}->{physical_description} = 
+        join( ' ', @{$self->{master_doc}->{physical_description}});
 
-	($self->{master_doc}->{toc}) = $self->get_field_value($mods, $toc_xpath);
+    ($self->{master_doc}->{toc}) = $self->get_field_value($mods, $toc_xpath);
 
 }
 
@@ -387,33 +387,33 @@ sub start_mods_batch {
 # Takes a MARCXML string and adds it to the growing MODS doc
 # ---------------------------------------------------------------------------
 sub push_mods_batch {
-	my( $self, $marcxml ) = @_;
-
-	my $xmldoc = $parser->parse_string($marcxml);
-	my $mods = $mods_sheet->transform($xmldoc);
-
-	my $xmlperl = $self->modsdoc_to_values( $mods );
-	$xmlperl = $self->mods_values_to_mods_slim( $xmlperl );
-
-	# for backwards compatibility, remove the array part when all is decided
-	if(ref($xmlperl->{subject}) eq 'ARRAY' ) {
-		for my $subject( @{$xmlperl->{subject}} ) {
-			push @{$self->{master_doc}->{subject}}, $subject;
-		}
-	} else {
-		for my $subject ( keys %{$xmlperl->{subject}} ) {
-			my $s = $self->{master_doc}->{subject};
-			if(defined($s->{$subject})) { $s->{$subject}++; } else { $s->{$subject} = 1; }
-		}
-	}
-
-	push( @{$self->{master_doc}->{type_of_resource}}, 
-		$self->get_field_value( $mods, $resource_xpath ));
-
-	if(!($self->{master_doc}->{isbn}) ) {
-		($self->{master_doc}->{isbn}) = 
-			$self->get_field_value( $mods, $isbn_xpath );
-	}
+    my( $self, $marcxml ) = @_;
+
+    my $xmldoc = $parser->parse_string($marcxml);
+    my $mods = $mods_sheet->transform($xmldoc);
+
+    my $xmlperl = $self->modsdoc_to_values( $mods );
+    $xmlperl = $self->mods_values_to_mods_slim( $xmlperl );
+
+    # for backwards compatibility, remove the array part when all is decided
+    if(ref($xmlperl->{subject}) eq 'ARRAY' ) {
+        for my $subject( @{$xmlperl->{subject}} ) {
+            push @{$self->{master_doc}->{subject}}, $subject;
+        }
+    } else {
+        for my $subject ( keys %{$xmlperl->{subject}} ) {
+            my $s = $self->{master_doc}->{subject};
+            if(defined($s->{$subject})) { $s->{$subject}++; } else { $s->{$subject} = 1; }
+        }
+    }
+
+    push( @{$self->{master_doc}->{type_of_resource}}, 
+        $self->get_field_value( $mods, $resource_xpath ));
+
+    if(!($self->{master_doc}->{isbn}) ) {
+        ($self->{master_doc}->{isbn}) = 
+            $self->get_field_value( $mods, $isbn_xpath );
+    }
 }
 
 
@@ -421,59 +421,59 @@ sub push_mods_batch {
 # Completes a MARC -> Unified MODS batch process and returns the perl hash
 # ---------------------------------------------------------------------------
 sub init_virtual_record {
-	my $record = Fieldmapper::metabib::virtual_record->new;
-	$record->subject([]);
-	$record->types_of_resource([]);
-	$record->call_numbers([]);
-	return $record;
+    my $record = Fieldmapper::metabib::virtual_record->new;
+    $record->subject([]);
+    $record->types_of_resource([]);
+    $record->call_numbers([]);
+    return $record;
 }
 
 sub finish_mods_batch {
-	my $self = shift;
+    my $self = shift;
 
-	return undef unless $self->{master_doc};
+    return undef unless $self->{master_doc};
 
-	my $perl = $self->{master_doc};
-	my $record = init_virtual_record();
+    my $perl = $self->{master_doc};
+    my $record = init_virtual_record();
 
-	# turn the hash into a fieldmapper object
-	#(my $title = $perl->{title}) =~ s/\[.*?\]//og;
-	#(my $author = $perl->{author}) =~ s/\(.*?\)//og;
-	my $title = $perl->{title};
-	my $author = $perl->{author};
+    # turn the hash into a fieldmapper object
+    #(my $title = $perl->{title}) =~ s/\[.*?\]//og;
+    #(my $author = $perl->{author}) =~ s/\(.*?\)//og;
+    my $title = $perl->{title};
+    my $author = $perl->{author};
 
-	my @series;
-	for my $s (@{$perl->{series}}) {
-		push @series, (split( /\s*;/, $s ))[0];
-	}
+    my @series;
+    for my $s (@{$perl->{series}}) {
+        push @series, (split( /\s*;/, $s ))[0];
+    }
 
-	# uniquify the types of resource
-	my $rtypes = $perl->{type_of_resource};
-	my %hash = map { ($_ => 1) } @$rtypes;
-	$rtypes = [ keys %hash ];
+    # uniquify the types of resource
+    my $rtypes = $perl->{type_of_resource};
+    my %hash = map { ($_ => 1) } @$rtypes;
+    $rtypes = [ keys %hash ];
 
-	$record->title($title);
-	$record->author($author);
+    $record->title($title);
+    $record->author($author);
 
-	$record->doc_id($perl->{doc_id});
-	$record->isbn($perl->{isbn});
-	$record->pubdate($perl->{pubdate});
-	$record->publisher($perl->{publisher});
-	$record->tcn($perl->{tcn});
+    $record->doc_id($perl->{doc_id});
+    $record->isbn($perl->{isbn});
+    $record->pubdate($perl->{pubdate});
+    $record->publisher($perl->{publisher});
+    $record->tcn($perl->{tcn});
 
-	$record->edition($perl->{edition});
+    $record->edition($perl->{edition});
 
-	$record->subject($perl->{subject});
-	$record->types_of_resource($rtypes);
-	$record->series(\@series);
+    $record->subject($perl->{subject});
+    $record->types_of_resource($rtypes);
+    $record->series(\@series);
 
-	$record->online_loc($perl->{online_loc});
-	$record->synopsis($perl->{synopsis});
-	$record->physical_description($perl->{physical_description});
-	$record->toc($perl->{toc});
+    $record->online_loc($perl->{online_loc});
+    $record->synopsis($perl->{synopsis});
+    $record->physical_description($perl->{physical_description});
+    $record->toc($perl->{toc});
 
-	$self->{master_doc} = undef;
-	return $record;
+    $self->{master_doc} = undef;
+    return $record;
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/Normalize.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/Normalize.pm
index 0823e56..e147f8e 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/Normalize.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/Normalize.pm
@@ -72,14 +72,14 @@ sub _normalize_codes {
     # transformations based on Unicode category codes
     $str =~ s/[\p{Cc}\p{Cf}\p{Co}\p{Cs}\p{Lm}\p{Mc}\p{Me}\p{Mn}]//g;
 
-	if ($sf && $sf =~ /^a/o) {
-		my $commapos = index($str, ',');
-		if ($commapos > -1) {
-			if ($commapos != length($str) - 1) {
+    if ($sf && $sf =~ /^a/o) {
+        my $commapos = index($str, ',');
+        if ($commapos > -1) {
+            if ($commapos != length($str) - 1) {
                 $str =~ s/,/\x07/; # preserve first comma
-			}
-		}
-	}
+            }
+        }
+    }
 
     # since we've stripped out the control characters, we can now
     # use a few as placeholders temporarily
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/OfflineStore.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/OfflineStore.pm
index 5bf0141..8bcc060 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/OfflineStore.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/OfflineStore.pm
@@ -3,11 +3,11 @@ use strict; use warnings;
 
 use UNIVERSAL::require;
 if ('Class::DBI::Frozen::301'->use) {
-	use parent 'Class::DBI::Frozen::301';
+    use parent 'Class::DBI::Frozen::301';
 } elsif ('Class::DBI'->use) {
-	use parent 'Class::DBI';
+    use parent 'Class::DBI';
 } else {
-	die $@;
+    die $@;
 }
 
 use DBI;
@@ -15,36 +15,36 @@ use OpenSRF::Utils::Config;
 
 our ($_dsn,$_u,$_p);
 sub DBFile {
-	my $class = shift;
-	my $dsn = shift;
-	my $u = shift;
-	my $p = shift;
-	if ($dsn) {
-		$_dsn = $dsn;
-		$_u = $u;
-		$_p = $p;
-	}
-	return $_dsn;
+    my $class = shift;
+    my $dsn = shift;
+    my $u = shift;
+    my $p = shift;
+    if ($dsn) {
+        $_dsn = $dsn;
+        $_u = $u;
+        $_p = $p;
+    }
+    return $_dsn;
 }
 
 our $_dbh;
 sub db_Main {
-	my $self = shift;
-	return $_dbh if ($_dbh);
+    my $self = shift;
+    return $_dbh if ($_dbh);
 
-	$_dbh = DBI->connect($_dsn,$_u,$_p,
-		{
-			RootClass => 'DBIx::ContextualFetch' 
-		}
-	);
+    $_dbh = DBI->connect($_dsn,$_u,$_p,
+        {
+            RootClass => 'DBIx::ContextualFetch' 
+        }
+    );
 
-	return $_dbh;
+    return $_dbh;
 }
 
 
 sub disconnect {
-	$_dbh->disconnect;
-	$_dbh = undef;
+    $_dbh->disconnect;
+    $_dbh = undef;
 }
 
 
@@ -52,30 +52,30 @@ package OpenILS::Utils::OfflineStore::Session;
 use parent 'OpenILS::Utils::OfflineStore';
 
 sub _create_table {
-	my $self = shift;
-	$self->db_Main->do( <<"	SQL" );
+    my $self = shift;
+    $self->db_Main->do( <<"    SQL" );
 
 CREATE TABLE session (
-	key				TEXT	UNIQUE PRIMARY KEY,
-	org				INTEGER	NOT NULL,
-	description		TEXT,
-	creator			INTEGER NOT NULL,
-	create_time		INTEGER NOT NULL,
-	in_process		INTEGER NOT NULL DEFAULT 0,
-	start_time		INTEGER,
-	end_time			INTEGER,
-	num_complete	INTEGER NOT NULL DEFAULT 0
+    key             TEXT    UNIQUE PRIMARY KEY,
+    org             INTEGER NOT NULL,
+    description     TEXT,
+    creator         INTEGER NOT NULL,
+    create_time     INTEGER NOT NULL,
+    in_process      INTEGER NOT NULL DEFAULT 0,
+    start_time      INTEGER,
+    end_time            INTEGER,
+    num_complete    INTEGER NOT NULL DEFAULT 0
 );
 CREATE INDEX IF NOT EXISTS session_pkey ON session (key);
 CREATE INDEX IF NOT EXISTS session_org ON session (org);
 CREATE INDEX IF NOT EXISTS session_creation ON session (create_time);
 
-	SQL
+    SQL
 }
 
 __PACKAGE__->table('offline.session');
 __PACKAGE__->columns( Essential => qw/key org description 
-		creator create_time in_process start_time end_time num_complete/);
+        creator create_time in_process start_time end_time num_complete/);
 __PACKAGE__->has_many(scripts => 'OpenILS::Utils::OfflineStore::Script');
 
 
@@ -83,24 +83,24 @@ package OpenILS::Utils::OfflineStore::Script;
 use parent 'OpenILS::Utils::OfflineStore';
 
 sub _create_table {
-	my $self = shift;
-	$self->db_Main->do( <<"	SQL" );
+    my $self = shift;
+    $self->db_Main->do( <<"    SQL" );
 
 CREATE TABLE script (
-	id		INTEGER	UNIQUE PRIMARY KEY AUTOINCREMENT,
-	session		TEXT	NOT NULL,
-	requestor	INTEGER	NOT NULL,
-	create_time	INTEGER	NOT NULL,
-	workstation	TEXT	NOT NULL,
-	logfile		TEXT	NOT NULL,
-	time_delta	INTEGER	NOT NULL DEFAULT 0,
-	count			INTEGER	NOT NULL DEFAULT 0
+    id      INTEGER UNIQUE PRIMARY KEY AUTOINCREMENT,
+    session     TEXT    NOT NULL,
+    requestor   INTEGER NOT NULL,
+    create_time INTEGER NOT NULL,
+    workstation TEXT    NOT NULL,
+    logfile     TEXT    NOT NULL,
+    time_delta  INTEGER NOT NULL DEFAULT 0,
+    count           INTEGER NOT NULL DEFAULT 0
 );
 CREATE INDEX IF NOT EXISTS script_pkey ON script (id);
 CREATE INDEX IF NOT EXISTS script_ws ON script (workstation);
 CREATE INDEX IF NOT EXISTS script_session ON script (session);
 
-	SQL
+    SQL
 }
 
 __PACKAGE__->table('offline.script');
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/PermitHold.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/PermitHold.pm
index c453019..39e59be 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/PermitHold.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/PermitHold.pm
@@ -10,10 +10,10 @@ use OpenILS::Application::Circ::ScriptBuilder;
 use OpenSRF::Utils::Logger qw(:logger);
 use OpenILS::Event;
 use OpenILS::Utils::CStoreEditor qw/:funcs/;
-my $U	= "OpenILS::Application::AppUtils";
+my $U   = "OpenILS::Application::AppUtils";
 
-my $script;			# - the permit script
-my $script_libs;	# - extra script libs
+my $script;         # - the permit script
+my $script_libs;    # - extra script libs
 my $legacy_script_support;
 
 # mental note:  open-ils.storage.biblio.record_entry.ranged_tree
@@ -22,8 +22,8 @@ my $legacy_script_support;
 # params within a hash are: copy, patron, 
 # requestor, request_lib, title, title_descriptor
 sub permit_copy_hold {
-	my $params	= shift;
-	my @allevents;
+    my $params  = shift;
+    my @allevents;
 
     unless(defined $legacy_script_support) {
         my $conf = OpenSRF::Utils::SettingsClient->new;
@@ -35,132 +35,132 @@ sub permit_copy_hold {
 
     return indb_hold_permit($params) unless $legacy_script_support;
 
-	my $ctx = {
-		patron_id	=> $$params{patron_id},
-		patron		=> $$params{patron},
-		copy			=> $$params{copy},
-		requestor	=> $$params{requestor},
-		title			=> $$params{title},
-		volume		=> $$params{volume},
-		flesh_age_protect => 1,
-		_direct	=> {
-			requestLib	=> $$params{request_lib},
-			pickupLib	=> $$params{pickup_lib},
+    my $ctx = {
+        patron_id   => $$params{patron_id},
+        patron      => $$params{patron},
+        copy            => $$params{copy},
+        requestor   => $$params{requestor},
+        title           => $$params{title},
+        volume      => $$params{volume},
+        flesh_age_protect => 1,
+        _direct => {
+            requestLib  => $$params{request_lib},
+            pickupLib   => $$params{pickup_lib},
             newHold    => $$params{new_hold},
-		}
-	};
-
-	my $runner = OpenILS::Application::Circ::ScriptBuilder->build($ctx);
-
-	my $ets = $ctx->{_events};
-
-	# --------------------------------------------------------------
-	# Strip the expired event since holds are still allowed to be
-	# captured on expired patrons.  
-	# --------------------------------------------------------------
-	if( $ets and @$ets ) {
-		$ets = [ grep { $_->{textcode} ne 'PATRON_ACCOUNT_EXPIRED' } @$ets ];
-	} else { $ets = []; }
-
-	if( @$ets ) {
-		push( @allevents, @$ets);
-
-		# --------------------------------------------------------------
-		# If scriptbuilder returned any events, then the script context
-		# is undefined and should not be used
-		# --------------------------------------------------------------
-
-	} else {
-
-		# check the various holdable flags
-		push( @allevents, OpenILS::Event->new('ITEM_NOT_HOLDABLE') )
-			unless $U->is_true($ctx->{copy}->holdable);
-	
-		push( @allevents, OpenILS::Event->new('ITEM_NOT_HOLDABLE') )
-			unless $U->is_true($ctx->{copy}->location->holdable);
-	
-		push( @allevents, OpenILS::Event->new('ITEM_NOT_HOLDABLE') )
-			unless $U->is_true($ctx->{copy}->status->holdable);
-	
+        }
+    };
+
+    my $runner = OpenILS::Application::Circ::ScriptBuilder->build($ctx);
+
+    my $ets = $ctx->{_events};
+
+    # --------------------------------------------------------------
+    # Strip the expired event since holds are still allowed to be
+    # captured on expired patrons.  
+    # --------------------------------------------------------------
+    if( $ets and @$ets ) {
+        $ets = [ grep { $_->{textcode} ne 'PATRON_ACCOUNT_EXPIRED' } @$ets ];
+    } else { $ets = []; }
+
+    if( @$ets ) {
+        push( @allevents, @$ets);
+
+        # --------------------------------------------------------------
+        # If scriptbuilder returned any events, then the script context
+        # is undefined and should not be used
+        # --------------------------------------------------------------
+
+    } else {
+
+        # check the various holdable flags
+        push( @allevents, OpenILS::Event->new('ITEM_NOT_HOLDABLE') )
+            unless $U->is_true($ctx->{copy}->holdable);
+    
+        push( @allevents, OpenILS::Event->new('ITEM_NOT_HOLDABLE') )
+            unless $U->is_true($ctx->{copy}->location->holdable);
+    
+        push( @allevents, OpenILS::Event->new('ITEM_NOT_HOLDABLE') )
+            unless $U->is_true($ctx->{copy}->status->holdable);
+    
       my $evt;
 
       # grab the data safely
       my $rlib = ref($$params{request_lib}) ? $$params{request_lib}->id : $$params{request_lib};
       my $olib = ref($ctx->{volume}) ? $ctx->{volume}->owning_lib : -1;
       my $rid  = ref($ctx->{requestor}) ? $ctx->{requestor}->id : -2;
-		my $pid  = ($params->{patron}) ? $params->{patron}->id : $params->{patron_id};
+        my $pid  = ($params->{patron}) ? $params->{patron}->id : $params->{patron_id};
 
       if( ($rid ne $pid) and ($olib eq $rlib) ) {
          $logger->info("Item owning lib $olib is the same as the request lib.  No age_protection will be checked");
       } else {
          $logger->info("item owning lib = $olib, request lib = $rlib, requestor=$rid, patron=$pid. checking age_protection");
-		   $evt = check_age_protect($ctx->{patron}, $ctx->{copy});
-		   push( @allevents, $evt ) if $evt;
+           $evt = check_age_protect($ctx->{patron}, $ctx->{copy});
+           push( @allevents, $evt ) if $evt;
       }
-	
-		$logger->debug("Running permit_copy_hold on copy " . $$params{copy}->id);
-	
-		load_scripts($runner);
-		my $result = $runner->run or 
-			throw OpenSRF::EX::ERROR ("Hold Copy Permit Script Died: $@");
-
-		# --------------------------------------------------------------
-		# Extract and uniquify the event list
-		# --------------------------------------------------------------
-		my $events = $result->{events};
-		$logger->debug("circ_permit_hold for user $pid returned events: [@$events]");
-	
-		push( @allevents, OpenILS::Event->new($_)) for @$events;
-	}
-
-	my %hash = map { ($_->{ilsevent} => $_) } @allevents;
-	@allevents = values %hash;
-
-	$runner->cleanup;
-
-	return \@allevents if $$params{show_event_list};
-	return 1 unless @allevents;
-	return 0;
+    
+        $logger->debug("Running permit_copy_hold on copy " . $$params{copy}->id);
+    
+        load_scripts($runner);
+        my $result = $runner->run or 
+            throw OpenSRF::EX::ERROR ("Hold Copy Permit Script Died: $@");
+
+        # --------------------------------------------------------------
+        # Extract and uniquify the event list
+        # --------------------------------------------------------------
+        my $events = $result->{events};
+        $logger->debug("circ_permit_hold for user $pid returned events: [@$events]");
+    
+        push( @allevents, OpenILS::Event->new($_)) for @$events;
+    }
+
+    my %hash = map { ($_->{ilsevent} => $_) } @allevents;
+    @allevents = values %hash;
+
+    $runner->cleanup;
+
+    return \@allevents if $$params{show_event_list};
+    return 1 unless @allevents;
+    return 0;
 }
 
 
 sub load_scripts {
-	my $runner = shift;
-
-	if(!$script) {
-		my $conf = OpenSRF::Utils::SettingsClient->new;
-		my @pfx	= ( "apps", "open-ils.circ","app_settings" );
-		my $libs	= $conf->config_value(@pfx, 'script_path');
-		$script	= $conf->config_value(@pfx, 'scripts', 'circ_permit_hold');
-		$script_libs = (ref($libs)) ? $libs : [$libs];
-	}
-
-	$runner->add_path($_) for(@$script_libs);
-	$runner->load($script);
+    my $runner = shift;
+
+    if(!$script) {
+        my $conf = OpenSRF::Utils::SettingsClient->new;
+        my @pfx = ( "apps", "open-ils.circ","app_settings" );
+        my $libs    = $conf->config_value(@pfx, 'script_path');
+        $script = $conf->config_value(@pfx, 'scripts', 'circ_permit_hold');
+        $script_libs = (ref($libs)) ? $libs : [$libs];
+    }
+
+    $runner->add_path($_) for(@$script_libs);
+    $runner->load($script);
 }
 
 
 sub check_age_protect {
-	my( $patron, $copy ) = @_;
+    my( $patron, $copy ) = @_;
 
-	return undef unless $copy and $copy->age_protect and $patron;
+    return undef unless $copy and $copy->age_protect and $patron;
 
-	my $hou = (ref $patron->home_ou) ? $patron->home_ou->id : $patron->home_ou;
+    my $hou = (ref $patron->home_ou) ? $patron->home_ou->id : $patron->home_ou;
 
-	my $prox = $U->storagereq(
-		'open-ils.storage.asset.copy.proximity', $copy->id, $hou );
+    my $prox = $U->storagereq(
+        'open-ils.storage.asset.copy.proximity', $copy->id, $hou );
 
-	# If this copy is within the appropriate proximity, 
-	# age protect does not apply
-	return undef if $prox <= $copy->age_protect->prox;
+    # If this copy is within the appropriate proximity, 
+    # age protect does not apply
+    return undef if $prox <= $copy->age_protect->prox;
 
-	my $protection_list = $U->storagereq(
-		'open-ils.storage.direct.config.rules.age_hold_protect.search_where.atomic', 
-		{ age  => { '>=' => $copy->age_protect->age  },
-		  prox => { '>=' => $copy->age_protect->prox },
-		},
-		{ order_by => 'age' }
-	);
+    my $protection_list = $U->storagereq(
+        'open-ils.storage.direct.config.rules.age_hold_protect.search_where.atomic', 
+        { age  => { '>=' => $copy->age_protect->age  },
+          prox => { '>=' => $copy->age_protect->prox },
+        },
+        { order_by => 'age' }
+    );
 
     # circ_lib may be fleshed
     my $context_org = ref $copy->circ_lib ? $copy->circ_lib->id : $copy->circ_lib;
@@ -170,35 +170,35 @@ sub check_age_protect {
     my $age = 0;
     my $age_protect_parsed;
     if($age_protect_date) {
-    	# Now, now many seconds old is this copy
-	    $age_protect_parsed = DateTime::Format::ISO8601
-		    ->new
-    		->parse_datetime( OpenSRF::Utils::cleanse_ISO8601($age_protect_date) )
-	    	->epoch;
-	    $age = time - $age_protect_parsed;
+        # Now, now many seconds old is this copy
+        $age_protect_parsed = DateTime::Format::ISO8601
+            ->new
+            ->parse_datetime( OpenSRF::Utils::cleanse_ISO8601($age_protect_date) )
+            ->epoch;
+        $age = time - $age_protect_parsed;
     }
 
-	for my $protection ( @$protection_list ) {
+    for my $protection ( @$protection_list ) {
 
-		$logger->info("analyzing age protect ".$protection->name);
+        $logger->info("analyzing age protect ".$protection->name);
 
-		# age protect does not apply if within the proximity
-		last if $prox <= $protection->prox;
+        # age protect does not apply if within the proximity
+        last if $prox <= $protection->prox;
 
-		# How many seconds old does the copy have to be to escape age protection
-		my $interval = OpenSRF::Utils::interval_to_seconds($protection->age);
+        # How many seconds old does the copy have to be to escape age protection
+        my $interval = OpenSRF::Utils::interval_to_seconds($protection->age);
 
-		$logger->info("age_protect interval=$interval, age_protect_date=$age_protect_parsed, age=$age");
+        $logger->info("age_protect interval=$interval, age_protect_date=$age_protect_parsed, age=$age");
 
-		if( $interval > $age ) { 
-			# if age of the item is less than the protection interval, 
-			# the item falls within the age protect range
-			$logger->info("age_protect prevents copy from having a hold placed on it: ".$copy->id);
-			return OpenILS::Event->new('ITEM_AGE_PROTECTED', copy => $copy->id );
-		}
-	}
-		
-	return undef;
+        if( $interval > $age ) { 
+            # if age of the item is less than the protection interval, 
+            # the item falls within the age protect range
+            $logger->info("age_protect prevents copy from having a hold placed on it: ".$copy->id);
+            return OpenILS::Event->new('ITEM_AGE_PROTECTED', copy => $copy->id );
+        }
+    }
+        
+    return undef;
 }
 
 my $LEGACY_HOLD_EVENT_MAP = {
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/RemoteAccount.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/RemoteAccount.pm
index 34a7257..8c7682d 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/RemoteAccount.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/RemoteAccount.pm
@@ -712,35 +712,35 @@ sub new {
     my ($class, %args) = @_;
     my $self = { _permitted => \%fields, %fields };
 
-	bless $self, $class;
+    bless $self, $class;
 
     $self->init(\%args); # or croak "Initialization error caused by bad args";
     return $self;
 }
 
 sub DESTROY { 
-	# in order to create, we must first ...
-	my $self  = shift;
+    # in order to create, we must first ...
+    my $self  = shift;
     $self->{ssh2} and $self->{ssh2}->disconnect();  # let the other end know we're done.
     $self->{ftp} and $self->{ftp}->quit();  # let the other end know we're done.
 }
 
 sub AUTOLOAD {
-	my $self  = shift;
-	my $class = ref($self) or croak "AUTOLOAD error: $self is not an object";
-	my $name  = $AUTOLOAD;
+    my $self  = shift;
+    my $class = ref($self) or croak "AUTOLOAD error: $self is not an object";
+    my $name  = $AUTOLOAD;
 
-	$name =~ s/.*://;   #   strip leading package stuff
+    $name =~ s/.*://;   #   strip leading package stuff
 
-	unless (exists $self->{_permitted}->{$name}) {
-		croak "AUTOLOAD error: Cannot access '$name' field of class '$class'";
-	}
+    unless (exists $self->{_permitted}->{$name}) {
+        croak "AUTOLOAD error: Cannot access '$name' field of class '$class'";
+    }
 
-	if (@_) {
-		return $self->{$name} = shift;
-	} else {
-		return $self->{$name};
-	}
+    if (@_) {
+        return $self->{$name} = shift;
+    } else {
+        return $self->{$name};
+    }
 }
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/ScriptRunner.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/ScriptRunner.pm
index 72265f6..80a4459 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/ScriptRunner.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/ScriptRunner.pm
@@ -10,588 +10,588 @@ use Time::HiRes qw/time/;
 use vars qw/%_paths/;
 
 sub DESTROY {
-	my $self = shift;
-	$logger->info("script_runner: destroying self: $self");
+    my $self = shift;
+    $logger->info("script_runner: destroying self: $self");
 }
 
 sub cleanup {
-	my $runner = shift;
-	$logger->info("script_runner: destroying context...");
-	$runner->context->destroy;
-	delete($$runner{$_}) for (keys %$runner);
+    my $runner = shift;
+    $logger->info("script_runner: destroying context...");
+    $runner->context->destroy;
+    delete($$runner{$_}) for (keys %$runner);
 }
 
 sub new {
-	my $class = shift;
-	my %params = @_;
-	$class = ref($class) || $class;
-	$params{paths} ||= [];
-	$params{reset_count} ||= 0;
-
-	my $self = bless {	file => $params{file},
-				libs => $params{libs},
-				reset_count => $params{reset_count},
-				_runs => 0,
-				_path => {%_paths} } => $class;
-
-	$self->add_path($_) for @{$params{paths}};
-	return $self->init; 
+    my $class = shift;
+    my %params = @_;
+    $class = ref($class) || $class;
+    $params{paths} ||= [];
+    $params{reset_count} ||= 0;
+
+    my $self = bless {  file => $params{file},
+                libs => $params{libs},
+                reset_count => $params{reset_count},
+                _runs => 0,
+                _path => {%_paths} } => $class;
+
+    $self->add_path($_) for @{$params{paths}};
+    return $self->init; 
 }
 
 sub context {
-	my( $self, $context ) = @_;
-	$self->{ctx} = $context if $context;
-	return $self->{ctx};
+    my( $self, $context ) = @_;
+    $self->{ctx} = $context if $context;
+    return $self->{ctx};
 }
 
 sub init {
-	my $self = shift;
-	$self->context( new JavaScript::SpiderMonkey );
-	$self->context->init();
-
-	$self->{_runs} = 0;
-
-	# eating our own dog food with insert
-	$self->insert(log_stdout	=> sub { print "@_\n"; } );
-	$self->insert(log_stderr	=> sub { warn "@_\n"; } );
-	$self->insert(log_activity	=> sub { $logger->activity("script_runner: @_"); return 1;} );
-	$self->insert(log_error		=> sub { $logger->error("script_runner: @_"); return 1;} );
-	$self->insert(log_warn		=> sub { $logger->warn("script_runner: @_"); return 1;} );
-	$self->insert(log_info		=> sub { $logger->info("script_runner: @_"); return 1;} );
-	$self->insert(log_debug		=> sub { $logger->debug("script_runner: @_"); return 1;} );
-	$self->insert(log_internal	=> sub { $logger->internal("script_runner: @_"); return 1;} );
-	$self->insert(debug		=> sub { $logger->debug("script_runner: @_"); return 1;} );
-	$self->insert(alert		=> sub { $logger->warn("script_runner: @_"); return 1;} );
-	$self->insert(load_lib		=> sub { $self->load_lib(@_); return 1;});
-
-	# OpenSRF support functions
-	$self->insert(
-		_OILS_FUNC_jsonopensrfrequest_send =>
-			sub { $self->_jsonopensrfrequest_send(@_); }
-	);
-	$self->insert(
-		_OILS_FUNC_jsonopensrfrequest_connect =>
-			sub { $self->_jsonopensrfrequest_connect(@_); }
-	);
-	$self->insert(
-		_OILS_FUNC_jsonopensrfrequest_disconnect =>
-			sub { $self->_jsonopensrfrequest_disconnect(@_); }
-	);
-	$self->insert(
-		_OILS_FUNC_jsonopensrfrequest_finish =>
-			sub { $self->_jsonopensrfrequest_finish(@_); }
-	);
-
-	# XML support functions
-	$self->insert(
-		_OILS_FUNC_xmlhttprequest_send	=>
-			sub { $self->_xmlhttprequest_send(@_); }
-	);
-	$self->insert(
-		_OILS_FUNC_xml_parse_string	=>
-			sub { $self->_parse_xml_string(@_); }
-	);
-	
-	while ( my $e = shift @{$self->{_env}} ) {
-		$self->insert( @$e{ qw/key value readonly/ } => 1 );
-	}
-
-	while ( my $e = shift @{$self->{_methods}} ) {
-		$self->insert_method( @$e{ qw/key name meth/ } => 1 );
-	}
-
-	$self->load_lib($_) for @{$self->{libs}};
-
-	return $self;
+    my $self = shift;
+    $self->context( new JavaScript::SpiderMonkey );
+    $self->context->init();
+
+    $self->{_runs} = 0;
+
+    # eating our own dog food with insert
+    $self->insert(log_stdout    => sub { print "@_\n"; } );
+    $self->insert(log_stderr    => sub { warn "@_\n"; } );
+    $self->insert(log_activity  => sub { $logger->activity("script_runner: @_"); return 1;} );
+    $self->insert(log_error     => sub { $logger->error("script_runner: @_"); return 1;} );
+    $self->insert(log_warn      => sub { $logger->warn("script_runner: @_"); return 1;} );
+    $self->insert(log_info      => sub { $logger->info("script_runner: @_"); return 1;} );
+    $self->insert(log_debug     => sub { $logger->debug("script_runner: @_"); return 1;} );
+    $self->insert(log_internal  => sub { $logger->internal("script_runner: @_"); return 1;} );
+    $self->insert(debug     => sub { $logger->debug("script_runner: @_"); return 1;} );
+    $self->insert(alert     => sub { $logger->warn("script_runner: @_"); return 1;} );
+    $self->insert(load_lib      => sub { $self->load_lib(@_); return 1;});
+
+    # OpenSRF support functions
+    $self->insert(
+        _OILS_FUNC_jsonopensrfrequest_send =>
+            sub { $self->_jsonopensrfrequest_send(@_); }
+    );
+    $self->insert(
+        _OILS_FUNC_jsonopensrfrequest_connect =>
+            sub { $self->_jsonopensrfrequest_connect(@_); }
+    );
+    $self->insert(
+        _OILS_FUNC_jsonopensrfrequest_disconnect =>
+            sub { $self->_jsonopensrfrequest_disconnect(@_); }
+    );
+    $self->insert(
+        _OILS_FUNC_jsonopensrfrequest_finish =>
+            sub { $self->_jsonopensrfrequest_finish(@_); }
+    );
+
+    # XML support functions
+    $self->insert(
+        _OILS_FUNC_xmlhttprequest_send  =>
+            sub { $self->_xmlhttprequest_send(@_); }
+    );
+    $self->insert(
+        _OILS_FUNC_xml_parse_string =>
+            sub { $self->_parse_xml_string(@_); }
+    );
+    
+    while ( my $e = shift @{$self->{_env}} ) {
+        $self->insert( @$e{ qw/key value readonly/ } => 1 );
+    }
+
+    while ( my $e = shift @{$self->{_methods}} ) {
+        $self->insert_method( @$e{ qw/key name meth/ } => 1 );
+    }
+
+    $self->load_lib($_) for @{$self->{libs}};
+
+    return $self;
 }
 
 sub refresh_context {
-	my $self = shift;
-	$logger->debug("Refreshing JavaScript Context...");
-	$self->context->destroy;
-	$logger->debug("Context destroyed");
-	$self->{_loaded} = {};
-	$logger->debug("Loaded scripts removed");
-	$self->init;
-	$logger->debug("New Context initialized");
-	return $self;
+    my $self = shift;
+    $logger->debug("Refreshing JavaScript Context...");
+    $self->context->destroy;
+    $logger->debug("Context destroyed");
+    $self->{_loaded} = {};
+    $logger->debug("Loaded scripts removed");
+    $self->init;
+    $logger->debug("New Context initialized");
+    return $self;
 }
 
 sub load {
-	my( $self, $filename ) = @_;
-	$self->{file} = $filename;
+    my( $self, $filename ) = @_;
+    $self->{file} = $filename;
 }
 
 sub runs { shift()->{_runs} }
 
 sub reset_count {
-	my $self = shift;
-	my $count = shift;
+    my $self = shift;
+    my $count = shift;
 
-	$self->{reset_count} = $count if ($count);
-	return $self->{reset_count};
+    $self->{reset_count} = $count if ($count);
+    return $self->{reset_count};
 }
 
 sub run {
-	my $self = shift;
-	my $file = shift();
+    my $self = shift;
+    my $file = shift();
 
-	my $_real = 0;
-	if(!$file) {
-		$_real = 1;
-		$file = $self->{file};
-	}
+    my $_real = 0;
+    if(!$file) {
+        $_real = 1;
+        $file = $self->{file};
+    }
 
-	$self->refresh_context
-		if ($self->reset_count && $self->runs > $self->reset_count);
+    $self->refresh_context
+        if ($self->reset_count && $self->runs > $self->reset_count);
 
-	$self->{_runs}++ if ($_real);
+    $self->{_runs}++ if ($_real);
 
-	$file = $self->_find_file($file);
-	$logger->debug("full script file path: $file");
+    $file = $self->_find_file($file);
+    $logger->debug("full script file path: $file");
 
-	if( ! open(F, $file) ) {
-		$logger->error("Error opening script file: $file");
-		return 0;
-	}
+    if( ! open(F, $file) ) {
+        $logger->error("Error opening script file: $file");
+        return 0;
+    }
 
-	my $js = $self->context;
+    my $js = $self->context;
 
-	my $res = '';
-	{	local $/ = undef;
+    my $res = '';
+    {   local $/ = undef;
 
-		$self->insert('environment.result' => {});
+        $self->insert('environment.result' => {});
 
-		my $content = <F>;
-		#print ( "full script is [$content]" );
+        my $content = <F>;
+        #print ( "full script is [$content]" );
 
-		my $s = time();
-		if( !$js || !$content || !$js->eval($content) ) {
-			$logger->error("$file Eval failed: $@");  
-			return 0;
-		}
-		$logger->debug("eval of $file took ". sprintf('%0.3f', time - $s) . " seconds");
+        my $s = time();
+        if( !$js || !$content || !$js->eval($content) ) {
+            $logger->error("$file Eval failed: $@");  
+            return 0;
+        }
+        $logger->debug("eval of $file took ". sprintf('%0.3f', time - $s) . " seconds");
 
-		if ($_real) {
-			$self->insert('__' => {'OILS_RESULT' => ''});
-			$js->eval("__.OILS_RESULT = js2JSON(environment.result);");
-			$res = $self->retrieve('__.OILS_RESULT');
-		}
-	}
+        if ($_real) {
+            $self->insert('__' => {'OILS_RESULT' => ''});
+            $js->eval("__.OILS_RESULT = js2JSON(environment.result);");
+            $res = $self->retrieve('__.OILS_RESULT');
+        }
+    }
 
-	close(F);
-	$logger->debug( "script result is [$res]" );
-	return OpenSRF::Utils::JSON->JSON2perl( $res );
+    close(F);
+    $logger->debug( "script result is [$res]" );
+    return OpenSRF::Utils::JSON->JSON2perl( $res );
 }
 
 sub remove_path { 
-	my( $self, $path ) = @_;
-	if (ref($self)) {
-		if ($self->{_path}{$path}) {
-			$self->{_path}{$path} = 0;
-		}
-		return $self->{_path}{$path};
-	} else {
-		if ($_paths{$path}) {
-			$_paths{$path} = 0;
-		}
-		return $_paths{$path};
-	}
+    my( $self, $path ) = @_;
+    if (ref($self)) {
+        if ($self->{_path}{$path}) {
+            $self->{_path}{$path} = 0;
+        }
+        return $self->{_path}{$path};
+    } else {
+        if ($_paths{$path}) {
+            $_paths{$path} = 0;
+        }
+        return $_paths{$path};
+    }
 }
 
 sub add_path { 
-	my( $self, $path ) = @_;
-	if (ref($self)) {
-		if (!$self->{_path}{$path}) {
-			$self->{_path}{$path} = 1;
-		}
-	} else {
-		if (!$_paths{$path}) {
-			$_paths{$path} = 1;
-		}
-	}
-	return $self;
+    my( $self, $path ) = @_;
+    if (ref($self)) {
+        if (!$self->{_path}{$path}) {
+            $self->{_path}{$path} = 1;
+        }
+    } else {
+        if (!$_paths{$path}) {
+            $_paths{$path} = 1;
+        }
+    }
+    return $self;
 }
 
 sub _find_file {
-	my $self = shift;
-	my $file = shift;
-	for my $p ( keys %{ $self->{_path} } ) {
-		next unless ($self->{_path}{$p});
-		my $full = join('/',$p,$file);
-		return $full if (-e $full);
-	}
+    my $self = shift;
+    my $file = shift;
+    for my $p ( keys %{ $self->{_path} } ) {
+        next unless ($self->{_path}{$p});
+        my $full = join('/',$p,$file);
+        return $full if (-e $full);
+    }
 }
 
 sub load_lib { 
-	my( $self, $file ) = @_;
+    my( $self, $file ) = @_;
 
-	my @paths = keys %{$self->{_path}};
-	$logger->debug("script_runner: Loading lib file $file : paths=[@paths]");
+    my @paths = keys %{$self->{_path}};
+    $logger->debug("script_runner: Loading lib file $file : paths=[@paths]");
 
-	push @{ $self->{libs} }, $file
-		if (! grep {$_ eq $file} @{ $self->{libs} });
+    push @{ $self->{libs} }, $file
+        if (! grep {$_ eq $file} @{ $self->{libs} });
 
-	if (!$self->{_loaded}{$file}) {
-		$self->run( $file );
-		$self->{_loaded}{$file} = 1;
-	}
-	return $self->{_loaded}{$file};
+    if (!$self->{_loaded}{$file}) {
+        $self->run( $file );
+        $self->{_loaded}{$file} = 1;
+    }
+    return $self->{_loaded}{$file};
 }
 
 sub _js_prop_name {
-	my $name = shift;
-	$name =~ s/^.*\.//o;
-	return $name;
+    my $name = shift;
+    $name =~ s/^.*\.//o;
+    return $name;
 }
 
 sub retrieve {
-	my( $self, $key ) = @_;
-	return $self->context->property_get($key);
+    my( $self, $key ) = @_;
+    return $self->context->property_get($key);
 }
 
 sub insert_method {
-	my( $self, $obj_key, $meth_name, $sub, $stop) = @_;
+    my( $self, $obj_key, $meth_name, $sub, $stop) = @_;
 
-	push @{$self->{_methods}}, { key => $obj_key => name => $meth_name, meth => $sub } unless ($stop);
-	
-	my $obj = $self->context->object_by_path( $obj_key );
-	$self->context->function_set( $meth_name, $sub, $obj ) if $obj;
+    push @{$self->{_methods}}, { key => $obj_key => name => $meth_name, meth => $sub } unless ($stop);
+    
+    my $obj = $self->context->object_by_path( $obj_key );
+    $self->context->function_set( $meth_name, $sub, $obj ) if $obj;
 }
 
 
 sub insert {
-	my( $self, $key, $val, $RO, $stop ) = @_;
-	return unless defined($key);
-
-	push @{$self->{_env}}, { key => $key => value => $val, readonly => $RO } unless ($stop);
-
-	if (ref($val) =~ /^Fieldmapper/o) {
-		$self->insert_fm($key, $val, $RO);
-	} elsif (ref($val) and $val =~ /ARRAY/o) {
-		$self->insert_array($key, $val, $RO);
-	} elsif (ref($val) and $val =~ /HASH/o) {
-		$self->insert_hash($key, $val, $RO);
-	} elsif (ref($val) and $val =~ /CODE/o) {
-		$self->context->function_set( $key, $val );
-	} elsif (!ref($val)) {
-		if( defined($val) ) {
-			$self->context->property_by_path(
-				$key, $val,
-				( !$RO ?  (sub { $val }, sub { my( $k, $v ) = @_; $val = $v; }) : () )
-			);
-		} else {
-			$self->context->property_by_path($key, "");
-		}
-
-	} else {
-		return 0;
-	}
-
-	return 1;
+    my( $self, $key, $val, $RO, $stop ) = @_;
+    return unless defined($key);
+
+    push @{$self->{_env}}, { key => $key => value => $val, readonly => $RO } unless ($stop);
+
+    if (ref($val) =~ /^Fieldmapper/o) {
+        $self->insert_fm($key, $val, $RO);
+    } elsif (ref($val) and $val =~ /ARRAY/o) {
+        $self->insert_array($key, $val, $RO);
+    } elsif (ref($val) and $val =~ /HASH/o) {
+        $self->insert_hash($key, $val, $RO);
+    } elsif (ref($val) and $val =~ /CODE/o) {
+        $self->context->function_set( $key, $val );
+    } elsif (!ref($val)) {
+        if( defined($val) ) {
+            $self->context->property_by_path(
+                $key, $val,
+                ( !$RO ?  (sub { $val }, sub { my( $k, $v ) = @_; $val = $v; }) : () )
+            );
+        } else {
+            $self->context->property_by_path($key, "");
+        }
+
+    } else {
+        return 0;
+    }
+
+    return 1;
 }
 
 sub insert_fm {
 
-	my( $self, $key, $fm, $RO ) = @_;
-	my $ctx = $self->context;
-	return undef unless ($ctx and $key and $fm);
-	my $o = $ctx->object_by_path($key);
-	
-	for my $f ( $fm->properties ) {
-		my $val = $fm->$f();
-		if (ref $val) {
-			$self->insert("$key.$f", $val);
-		} else {
-			$ctx->property_by_path(
-				"$key.$f",
-				$val,
-				( !$RO ? 
-					(sub {
-						my $k = _js_prop_name(shift());
-						$fm->$k();
-					}, 
-					sub {
-						my $k = _js_prop_name(shift());
-						$fm->ischanged(1);
-						$fm->$k(@_);
-					}) :
-					()
-				)
-			);
-		}
-	}
+    my( $self, $key, $fm, $RO ) = @_;
+    my $ctx = $self->context;
+    return undef unless ($ctx and $key and $fm);
+    my $o = $ctx->object_by_path($key);
+    
+    for my $f ( $fm->properties ) {
+        my $val = $fm->$f();
+        if (ref $val) {
+            $self->insert("$key.$f", $val);
+        } else {
+            $ctx->property_by_path(
+                "$key.$f",
+                $val,
+                ( !$RO ? 
+                    (sub {
+                        my $k = _js_prop_name(shift());
+                        $fm->$k();
+                    }, 
+                    sub {
+                        my $k = _js_prop_name(shift());
+                        $fm->ischanged(1);
+                        $fm->$k(@_);
+                    }) :
+                    ()
+                )
+            );
+        }
+    }
 }
 
 sub insert_hash {
 
-	my( $self, $key, $hash, $RO ) = @_;
-	my $ctx = $self->context;
-	return undef unless ($ctx and $key and $hash);
-	$ctx->object_by_path($key);
-	
-	for my $k ( keys %$hash ) {
-		my $v = $hash->{$k};
-		if (ref $v) {
-			$self->insert("$key.$k", $v);
-		} else {
-			$ctx->property_by_path(
-				"$key.$k", $v,
-				( !$RO ? 
-					(sub { $hash->{_js_prop_name(shift())} },
-					sub {
-						my( $hashkey, $val ) = @_;
-						$hash->{_js_prop_name($hashkey)} = $val;
-					}) :
-					()
-				)
-			);
-		}
-	}
+    my( $self, $key, $hash, $RO ) = @_;
+    my $ctx = $self->context;
+    return undef unless ($ctx and $key and $hash);
+    $ctx->object_by_path($key);
+    
+    for my $k ( keys %$hash ) {
+        my $v = $hash->{$k};
+        if (ref $v) {
+            $self->insert("$key.$k", $v);
+        } else {
+            $ctx->property_by_path(
+                "$key.$k", $v,
+                ( !$RO ? 
+                    (sub { $hash->{_js_prop_name(shift())} },
+                    sub {
+                        my( $hashkey, $val ) = @_;
+                        $hash->{_js_prop_name($hashkey)} = $val;
+                    }) :
+                    ()
+                )
+            );
+        }
+    }
 }
 
 my $__array_id = 0;
 sub insert_array {
 
-	my( $self, $key, $array ) = @_;
-	my $ctx = $self->context;
-	return undef unless ($ctx and $key and $array);
-
-	my $a = $ctx->array_by_path($key);
-	
-	my $ind = 0;
-	for my $v ( @$array ) {
-		if (ref $v) {
-			my $tmp_index = $__array_id++;
-			my $elobj = $ctx->object_by_path('__tmp_arr_el'.$tmp_index);
-			$self->insert('__tmp_arr_el'.$tmp_index, $v);
-			$ctx->array_set_element_as_object( $a, $ind, $elobj );
-		} else {
-			$ctx->array_set_element( $a, $ind, $v ) if defined($v);
-		}
-		$ind++;
-	}
+    my( $self, $key, $array ) = @_;
+    my $ctx = $self->context;
+    return undef unless ($ctx and $key and $array);
+
+    my $a = $ctx->array_by_path($key);
+    
+    my $ind = 0;
+    for my $v ( @$array ) {
+        if (ref $v) {
+            my $tmp_index = $__array_id++;
+            my $elobj = $ctx->object_by_path('__tmp_arr_el'.$tmp_index);
+            $self->insert('__tmp_arr_el'.$tmp_index, $v);
+            $ctx->array_set_element_as_object( $a, $ind, $elobj );
+        } else {
+            $ctx->array_set_element( $a, $ind, $v ) if defined($v);
+        }
+        $ind++;
+    }
 }
 
 sub _xmlhttprequest_send {
-	my $self = shift;
-	my $id = shift;
-	my $method = shift;
-	my $url = shift;
-	my $blocking = shift;
-	my $headerlist = shift;
-	my $data = shift;
-
-	my $ctx = $self->context;
-
-	# just so perl has access to it...
-	$ctx->object_by_path('__xmlhttpreq_hash.id'.$id);
-
-	my $headers = new HTTP::Headers;
-	my @lines = split(/\n/so, $headerlist);
-	for my $line (@lines) {
-		if ($line =~ /^(.+?)|(.+)$/o) {
-			$headers->header($1 => $2);
-		}
-	}
-
-	my $ua = LWP::UserAgent->new;
-	$ua->agent("OpenILS/0.1");
-
-	my $req = HTTP::Request->new($method => $url => $headers => $data);
-	my $res = $ua->request($req);
-
-	if ($res->is_success) {
-		
-		$ctx->property_by_path('__xmlhttpreq_hash.id'.$id.'.responseText', $res->content);
-		$ctx->property_by_path('__xmlhttpreq_hash.id'.$id.'.readyState', 4);
-		$ctx->property_by_path('__xmlhttpreq_hash.id'.$id.'.statusText', $res->status_line);
-		$ctx->property_by_path('__xmlhttpreq_hash.id'.$id.'.status', $res->code);
-
-	}
-		
+    my $self = shift;
+    my $id = shift;
+    my $method = shift;
+    my $url = shift;
+    my $blocking = shift;
+    my $headerlist = shift;
+    my $data = shift;
+
+    my $ctx = $self->context;
+
+    # just so perl has access to it...
+    $ctx->object_by_path('__xmlhttpreq_hash.id'.$id);
+
+    my $headers = new HTTP::Headers;
+    my @lines = split(/\n/so, $headerlist);
+    for my $line (@lines) {
+        if ($line =~ /^(.+?)|(.+)$/o) {
+            $headers->header($1 => $2);
+        }
+    }
+
+    my $ua = LWP::UserAgent->new;
+    $ua->agent("OpenILS/0.1");
+
+    my $req = HTTP::Request->new($method => $url => $headers => $data);
+    my $res = $ua->request($req);
+
+    if ($res->is_success) {
+        
+        $ctx->property_by_path('__xmlhttpreq_hash.id'.$id.'.responseText', $res->content);
+        $ctx->property_by_path('__xmlhttpreq_hash.id'.$id.'.readyState', 4);
+        $ctx->property_by_path('__xmlhttpreq_hash.id'.$id.'.statusText', $res->status_line);
+        $ctx->property_by_path('__xmlhttpreq_hash.id'.$id.'.status', $res->code);
+
+    }
+        
 }
 
 our %_jsonopensrfrequest_cache = ();
 
 sub _jsonopensrfrequest_connect {
-	my $self = shift;
-	my $id = shift;
-	my $service = shift;
+    my $self = shift;
+    my $id = shift;
+    my $service = shift;
 
-	my $ctx = $self->context;
-	$ctx->object_by_path('__jsonopensrfreq_hash.id'.$id);
+    my $ctx = $self->context;
+    $ctx->object_by_path('__jsonopensrfreq_hash.id'.$id);
 
-	my $ses = $_jsonopensrfrequest_cache{$id} ||
-			do { $_jsonopensrfrequest_cache{$id} = OpenSRF::AppSession->create($service) };
+    my $ses = $_jsonopensrfrequest_cache{$id} ||
+            do { $_jsonopensrfrequest_cache{$id} = OpenSRF::AppSession->create($service) };
 
-	if($ses->connect) {
-		$ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.connected', 1);
-	} else {
-		$ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.connected', 0);
-	}
+    if($ses->connect) {
+        $ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.connected', 1);
+    } else {
+        $ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.connected', 0);
+    }
 }
 
 sub _jsonopensrfrequest_disconnect {
-	my $self = shift;
-	my $id = shift;
+    my $self = shift;
+    my $id = shift;
 
-	my $ctx = $self->context;
-	$ctx->object_by_path('__jsonopensrfreq_hash.id'.$id);
+    my $ctx = $self->context;
+    $ctx->object_by_path('__jsonopensrfreq_hash.id'.$id);
 
-	my $ses = $_jsonopensrfrequest_cache{$id};
-	return unless $ses;
+    my $ses = $_jsonopensrfrequest_cache{$id};
+    return unless $ses;
 
-	$ses->disconnect;
+    $ses->disconnect;
 }
 
 sub _jsonopensrfrequest_finish {
-	my $self = shift;
-	my $id = shift;
+    my $self = shift;
+    my $id = shift;
 
-	my $ctx = $self->context;
-	$ctx->object_by_path('__jsonopensrfreq_hash.id'.$id);
+    my $ctx = $self->context;
+    $ctx->object_by_path('__jsonopensrfreq_hash.id'.$id);
 
-	my $ses = $_jsonopensrfrequest_cache{$id};
-	return unless $ses;
+    my $ses = $_jsonopensrfrequest_cache{$id};
+    return unless $ses;
 
-	$ses->finish;
-	delete $_jsonopensrfrequest_cache{$id};
+    $ses->finish;
+    delete $_jsonopensrfrequest_cache{$id};
 }
 
 sub _jsonopensrfrequest_send {
-	my $self = shift;
-	my $id = shift;
-	my $service = shift;
-	my $method = shift;
-	my $blocking = shift;
-	my $params = shift;
-
-	my @p = @{ OpenSRF::Utils::JSON->JSON2perl($params) };
-
-	my $ctx = $self->context;
-
-	# just so perl has access to it...
-	$ctx->object_by_path('__jsonopensrfreq_hash.id'.$id);
-
-	my $ses = $_jsonopensrfrequest_cache{$id} ||
-			do { $_jsonopensrfrequest_cache{$id} = OpenSRF::AppSession->create($service) };
-	my $req = $ses->request($method, at p);
-
-	$req->wait_complete;
-	if (!$req->failed) {
-		my $res = $req->recv->content;
-		
-		$ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.responseText', OpenSRF::Utils::JSON->perl2JSON($res));
-		$ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.readyState', 4);
-		$ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.statusText', 'OK');
-		$ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.status', '200');
-
-	} else {
-		$ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.responseText', '');
-		$ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.readyState', 4);
-		$ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.statusText', $req->failed->status );
-		$ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.status', $req->failed->statusCode );
-	}
-
-	$req->finish;
-		
+    my $self = shift;
+    my $id = shift;
+    my $service = shift;
+    my $method = shift;
+    my $blocking = shift;
+    my $params = shift;
+
+    my @p = @{ OpenSRF::Utils::JSON->JSON2perl($params) };
+
+    my $ctx = $self->context;
+
+    # just so perl has access to it...
+    $ctx->object_by_path('__jsonopensrfreq_hash.id'.$id);
+
+    my $ses = $_jsonopensrfrequest_cache{$id} ||
+            do { $_jsonopensrfrequest_cache{$id} = OpenSRF::AppSession->create($service) };
+    my $req = $ses->request($method, at p);
+
+    $req->wait_complete;
+    if (!$req->failed) {
+        my $res = $req->recv->content;
+        
+        $ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.responseText', OpenSRF::Utils::JSON->perl2JSON($res));
+        $ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.readyState', 4);
+        $ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.statusText', 'OK');
+        $ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.status', '200');
+
+    } else {
+        $ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.responseText', '');
+        $ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.readyState', 4);
+        $ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.statusText', $req->failed->status );
+        $ctx->property_by_path('__jsonopensrfreq_hash.id'.$id.'.status', $req->failed->statusCode );
+    }
+
+    $req->finish;
+        
 }
 
 sub _parse_xml_string {
-	my $self = shift;
-	my $string = shift;
-	my $key = shift;
-
-
-	my $doc;
-	my $s = 0;
-	try {
-		$doc = XML::LibXML->new->parse_string( $string );
-		$s = 1;
-	} catch Error with {
-		my $e = shift;
-		warn "Could not parse document: $e\n";
-	};
-	return unless ($s);
-
-	_JS_DOM($self->context, $key, $doc);
+    my $self = shift;
+    my $string = shift;
+    my $key = shift;
+
+
+    my $doc;
+    my $s = 0;
+    try {
+        $doc = XML::LibXML->new->parse_string( $string );
+        $s = 1;
+    } catch Error with {
+        my $e = shift;
+        warn "Could not parse document: $e\n";
+    };
+    return unless ($s);
+
+    _JS_DOM($self->context, $key, $doc);
 }
 
 sub _JS_DOM {
-	my $ctx = shift;
-	my $key = shift;
-	my $node = shift;
-
-	if ($node->nodeType == 9) {
-		$node = $node->documentElement;
-
-		my $n = $node->nodeName;
-		my $ns = $node->namespaceURI;
-		$ns =~ s/'/\'/gso if ($ns);
-		$ns = "'$ns'" if ($ns);
-		$ns = 'null' unless ($ns);
-		$n =~ s/'/\'/gso;
-
-		#warn("$key = DOMImplementation().createDocument($ns,'$n');");
-		$ctx->eval("$key = new DOMImplementation().createDocument($ns,'$n');");
-
-		$key = $key.'.documentElement';
-	}
-
-	for my $a ($node->attributes) {
-		my $n = $a->nodeName;
-		my $v = $a->value;
-		$n =~ s/'/\'/gso;
-		$v =~ s/'/\'/gso;
-		#warn("$key.setAttribute('$n','$v');");
-		$ctx->eval("$key.setAttribute('$n','$v');");
-
-	}
-
-	my $k = 0;
-	for my $c ($node->childNodes) {
-		if ($c->nodeType == 1) {
-			my $n = $c->nodeName;
-			my $ns = $node->namespaceURI;
-
-			$n =~ s/'/\'/gso;
-			$ns =~ s/'/\'/gso if ($ns);
-			$ns = "'$ns'" if ($ns);
-			$ns = 'null' unless ($ns);
-
-			#warn("$key.appendChild($key.ownerDocument.createElementNS($ns,'$n'));");
-			$ctx->eval("$key.appendChild($key.ownerDocument.createElementNS($ns,'$n'));");
-			_JS_DOM($ctx, "$key.childNodes.item($k)",$c);
-
-		} elsif ($c->nodeType == 3) {
-			my $n = $c->data;
-			$n =~ s/'/\'/gso;
-			#warn("$key.appendChild($key.ownerDocument.createTextNode('$n'));");
-			#warn("path is $key.item($k);");
-			$ctx->eval("$key.appendChild($key.ownerDocument.createTextNode('$n'));");
-
-		} elsif ($c->nodeType == 4) {
-			my $n = $c->data;
-			$n =~ s/'/\'/gso;
-			#warn("$key.appendChild($key.ownerDocument.createCDATASection('$n'));");
-			$ctx->eval("$key.appendChild($key.ownerDocument.createCDATASection('$n'));");
-
-		} elsif ($c->nodeType == 8) {
-			my $n = $c->data;
-			$n =~ s/'/\'/gso;
-			#warn("$key.appendChild($key.ownerDocument.createComment('$n'));");
-			$ctx->eval("$key.appendChild($key.ownerDocument.createComment('$n'));");
-
-		} else {
-			warn "ACK! I don't know how to handle node type ".$c->nodeType;
-		}
-		
-
-		$k++;
-	}
-
-	return 1;
+    my $ctx = shift;
+    my $key = shift;
+    my $node = shift;
+
+    if ($node->nodeType == 9) {
+        $node = $node->documentElement;
+
+        my $n = $node->nodeName;
+        my $ns = $node->namespaceURI;
+        $ns =~ s/'/\'/gso if ($ns);
+        $ns = "'$ns'" if ($ns);
+        $ns = 'null' unless ($ns);
+        $n =~ s/'/\'/gso;
+
+        #warn("$key = DOMImplementation().createDocument($ns,'$n');");
+        $ctx->eval("$key = new DOMImplementation().createDocument($ns,'$n');");
+
+        $key = $key.'.documentElement';
+    }
+
+    for my $a ($node->attributes) {
+        my $n = $a->nodeName;
+        my $v = $a->value;
+        $n =~ s/'/\'/gso;
+        $v =~ s/'/\'/gso;
+        #warn("$key.setAttribute('$n','$v');");
+        $ctx->eval("$key.setAttribute('$n','$v');");
+
+    }
+
+    my $k = 0;
+    for my $c ($node->childNodes) {
+        if ($c->nodeType == 1) {
+            my $n = $c->nodeName;
+            my $ns = $node->namespaceURI;
+
+            $n =~ s/'/\'/gso;
+            $ns =~ s/'/\'/gso if ($ns);
+            $ns = "'$ns'" if ($ns);
+            $ns = 'null' unless ($ns);
+
+            #warn("$key.appendChild($key.ownerDocument.createElementNS($ns,'$n'));");
+            $ctx->eval("$key.appendChild($key.ownerDocument.createElementNS($ns,'$n'));");
+            _JS_DOM($ctx, "$key.childNodes.item($k)",$c);
+
+        } elsif ($c->nodeType == 3) {
+            my $n = $c->data;
+            $n =~ s/'/\'/gso;
+            #warn("$key.appendChild($key.ownerDocument.createTextNode('$n'));");
+            #warn("path is $key.item($k);");
+            $ctx->eval("$key.appendChild($key.ownerDocument.createTextNode('$n'));");
+
+        } elsif ($c->nodeType == 4) {
+            my $n = $c->data;
+            $n =~ s/'/\'/gso;
+            #warn("$key.appendChild($key.ownerDocument.createCDATASection('$n'));");
+            $ctx->eval("$key.appendChild($key.ownerDocument.createCDATASection('$n'));");
+
+        } elsif ($c->nodeType == 8) {
+            my $n = $c->data;
+            $n =~ s/'/\'/gso;
+            #warn("$key.appendChild($key.ownerDocument.createComment('$n'));");
+            $ctx->eval("$key.appendChild($key.ownerDocument.createComment('$n'));");
+
+        } else {
+            warn "ACK! I don't know how to handle node type ".$c->nodeType;
+        }
+        
+
+        $k++;
+    }
+
+    return 1;
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/SpiderMonkey.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/SpiderMonkey.pm
index 88d0a96..8c0684f 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/SpiderMonkey.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/SpiderMonkey.pm
@@ -11,389 +11,389 @@ use Time::HiRes qw/time/;
 use vars qw/%_paths/;
 
 sub new {
-	my ( $class, %params ) = @_;
-	$class = ref($class) || $class;
-	$params{paths} ||= [];
+    my ( $class, %params ) = @_;
+    $class = ref($class) || $class;
+    $params{paths} ||= [];
 
-	my $self = { file => $params{file}, libs => $params{libs}, _path => {%_paths} };
-	bless( $self, $class );
+    my $self = { file => $params{file}, libs => $params{libs}, _path => {%_paths} };
+    bless( $self, $class );
 
-	$self->add_path($_) for @{$params{paths}};
-	return $self;
+    $self->add_path($_) for @{$params{paths}};
+    return $self;
 }
 
 sub context {
-	my( $self, $context ) = @_;
-	$self->{ctx} = $context if $context;
-	return $self->{ctx};
+    my( $self, $context ) = @_;
+    $self->{ctx} = $context if $context;
+    return $self->{ctx};
 }
 
 sub init {
-	my $self = shift;
-	my $js = JavaScript::SpiderMonkey->new();
-	$js->init();
-
-	$js->function_set(perl_print	=> sub { print "@_\n"; } );
-	$js->function_set(perl_warn	=> sub { warn @_; } );
-	$js->function_set(log_activity	=> sub { $logger->activity(@_); return 1;} );
-	$js->function_set(log_error	=> sub { $logger->error(@_); return 1;} );
-	$js->function_set(log_warn	=> sub { $logger->warn(@_); return 1;} );
-	$js->function_set(log_info	=> sub { $logger->info(@_); return 1;} );
-	$js->function_set(log_debug	=> sub { $logger->debug(@_); return 1;} );
-	$js->function_set(log_internal	=> sub { $logger->internal(@_); return 1;} );
-	$js->function_set(debug		=> sub { $logger->debug(@_); return 1;} );
-	$js->function_set(alert		=> sub { $logger->warn(@_); return 1;} );
-	
-	$js->function_set(load_lib	=> sub { $self->load_lib(@_); });
-
-	# XML support functions
-	$js->function_set(
-		_OILS_FUNC_xmlhttprequest_send	=> sub { $self->_xmlhttprequest_send(@_); });
-	$js->function_set(
-		_OILS_FUNC_xml_parse_string	=> sub { $self->_parse_xml_string(@_); });
-	
-	$self->context($js);
-	$self->load_lib($_) for @{$self->{libs}};
-
-	return $self;
+    my $self = shift;
+    my $js = JavaScript::SpiderMonkey->new();
+    $js->init();
+
+    $js->function_set(perl_print    => sub { print "@_\n"; } );
+    $js->function_set(perl_warn => sub { warn @_; } );
+    $js->function_set(log_activity  => sub { $logger->activity(@_); return 1;} );
+    $js->function_set(log_error => sub { $logger->error(@_); return 1;} );
+    $js->function_set(log_warn  => sub { $logger->warn(@_); return 1;} );
+    $js->function_set(log_info  => sub { $logger->info(@_); return 1;} );
+    $js->function_set(log_debug => sub { $logger->debug(@_); return 1;} );
+    $js->function_set(log_internal  => sub { $logger->internal(@_); return 1;} );
+    $js->function_set(debug     => sub { $logger->debug(@_); return 1;} );
+    $js->function_set(alert     => sub { $logger->warn(@_); return 1;} );
+    
+    $js->function_set(load_lib  => sub { $self->load_lib(@_); });
+
+    # XML support functions
+    $js->function_set(
+        _OILS_FUNC_xmlhttprequest_send  => sub { $self->_xmlhttprequest_send(@_); });
+    $js->function_set(
+        _OILS_FUNC_xml_parse_string => sub { $self->_parse_xml_string(@_); });
+    
+    $self->context($js);
+    $self->load_lib($_) for @{$self->{libs}};
+
+    return $self;
 }
 
 
 sub load {
-	my( $self, $filename ) = @_;
-	$self->{file} = $filename;
+    my( $self, $filename ) = @_;
+    $self->{file} = $filename;
 }
 
 sub run {
-	my $self = shift;
-	my $file = shift() || $self->{file};
-	my $js = $self->context;
-
-	$file = $self->_find_file($file);
-
-	if( ! open(F, $file) ) {
-		$logger->error("Error opening script file: $file");
-		return 0;
-	}
-
-	{	local $/ = undef;
-		my $content = <F>;
-		my $s = time();
-		if( !$js || !$content || !$js->eval($content) ) {
-			$logger->error("$file Eval failed: $@");  
-			return 0;
-		}
-		$logger->debug("eval of $file took ". sprintf('%0.3f', time - $s) . " seconds");
-	}
-
-	close(F);
-	return 1;
+    my $self = shift;
+    my $file = shift() || $self->{file};
+    my $js = $self->context;
+
+    $file = $self->_find_file($file);
+
+    if( ! open(F, $file) ) {
+        $logger->error("Error opening script file: $file");
+        return 0;
+    }
+
+    {   local $/ = undef;
+        my $content = <F>;
+        my $s = time();
+        if( !$js || !$content || !$js->eval($content) ) {
+            $logger->error("$file Eval failed: $@");  
+            return 0;
+        }
+        $logger->debug("eval of $file took ". sprintf('%0.3f', time - $s) . " seconds");
+    }
+
+    close(F);
+    return 1;
 }
 
 sub remove_path { 
-	my( $self, $path ) = @_;
-	if (ref($self)) {
-		if ($self->{_path}{$path}) {
-			$self->{_path}{$path} = 0;
-		}
-		return $self->{_path}{$path};
-	} else {
-		if ($_paths{$path}) {
-			$_paths{$path} = 0;
-		}
-		return $_paths{$path};
-	}
+    my( $self, $path ) = @_;
+    if (ref($self)) {
+        if ($self->{_path}{$path}) {
+            $self->{_path}{$path} = 0;
+        }
+        return $self->{_path}{$path};
+    } else {
+        if ($_paths{$path}) {
+            $_paths{$path} = 0;
+        }
+        return $_paths{$path};
+    }
 }
 
 sub add_path { 
-	my( $self, $path ) = @_;
-	if (ref($self)) {
-		if (!$self->{_path}{$path}) {
-			$self->{_path}{$path} = 1;
-		}
-	} else {
-		if (!$_paths{$path}) {
-			$_paths{$path} = 1;
-		}
-	}
-	return $self;
+    my( $self, $path ) = @_;
+    if (ref($self)) {
+        if (!$self->{_path}{$path}) {
+            $self->{_path}{$path} = 1;
+        }
+    } else {
+        if (!$_paths{$path}) {
+            $_paths{$path} = 1;
+        }
+    }
+    return $self;
 }
 
 sub _find_file {
-	my $self = shift;
-	my $file = shift;
-	for my $p ( keys %{ $self->{_path} } ) {
-		next unless ($self->{_path}{$p});
-		my $full = join('/',$p,$file);
-		return $full if (-e $full);
-	}
+    my $self = shift;
+    my $file = shift;
+    for my $p ( keys %{ $self->{_path} } ) {
+        next unless ($self->{_path}{$p});
+        my $full = join('/',$p,$file);
+        return $full if (-e $full);
+    }
 }
 
 sub load_lib { 
-	my( $self, $file ) = @_;
-	if (!$self->{_loaded}{$file} && $self->run( $file )) {
-		$self->{_loaded}{$file} = 1;
-	}
-	return $self->{_loaded}{$file};
+    my( $self, $file ) = @_;
+    if (!$self->{_loaded}{$file} && $self->run( $file )) {
+        $self->{_loaded}{$file} = 1;
+    }
+    return $self->{_loaded}{$file};
 }
 
 sub _js_prop_name {
-	my $name = shift;
-	$name =~ s/^.*\.//o;
-	return $name;
+    my $name = shift;
+    $name =~ s/^.*\.//o;
+    return $name;
 }
 
 sub retrieve {
-	my( $self, $key ) = @_;
-	return $self->context->property_get($key);
+    my( $self, $key ) = @_;
+    return $self->context->property_get($key);
 }
 
 sub insert_method {
-	my( $self, $obj_key, $meth_name, $sub ) = @_;
-	my $obj = $self->context->object_by_path( $obj_key );
-	$self->context->function_set( $meth_name, $sub, $obj ) if $obj;
+    my( $self, $obj_key, $meth_name, $sub ) = @_;
+    my $obj = $self->context->object_by_path( $obj_key );
+    $self->context->function_set( $meth_name, $sub, $obj ) if $obj;
 }
 
 
 sub insert {
-	my( $self, $key, $val ) = @_;
-	return unless defined($key);
-
-	if (ref($val) =~ /^Fieldmapper/o) {
-		$self->insert_fm($key, $val);
-	} elsif (ref($val) and $val =~ /ARRAY/o) {
-		$self->insert_array($key, $val);
-	} elsif (ref($val) and $val =~ /HASH/o) {
-		$self->insert_hash($key, $val);
-	} elsif (ref($val) and $val =~ /CODE/o) {
-		$self->context->function_set( $key, $val );
-	} elsif (!ref($val)) {
-		if( defined($val) ) {
-			$self->context->property_by_path(
-				$key, $val,
-				sub { $val },
-				sub { my( $k, $v ) = @_; $val = $v; }
-			);
-		} else {
-			$self->context->property_by_path($key);
-		}
-
-	} else {
-		return 0;
-	}
-
-	return 1;
+    my( $self, $key, $val ) = @_;
+    return unless defined($key);
+
+    if (ref($val) =~ /^Fieldmapper/o) {
+        $self->insert_fm($key, $val);
+    } elsif (ref($val) and $val =~ /ARRAY/o) {
+        $self->insert_array($key, $val);
+    } elsif (ref($val) and $val =~ /HASH/o) {
+        $self->insert_hash($key, $val);
+    } elsif (ref($val) and $val =~ /CODE/o) {
+        $self->context->function_set( $key, $val );
+    } elsif (!ref($val)) {
+        if( defined($val) ) {
+            $self->context->property_by_path(
+                $key, $val,
+                sub { $val },
+                sub { my( $k, $v ) = @_; $val = $v; }
+            );
+        } else {
+            $self->context->property_by_path($key);
+        }
+
+    } else {
+        return 0;
+    }
+
+    return 1;
 }
 
 sub insert_fm {
 
-	my( $self, $key, $fm ) = @_;
-	my $ctx = $self->context;
-	return undef unless ($ctx and $key and $fm);
-	my $o = $ctx->object_by_path($key);
-	
-	for my $f ( $fm->properties ) {
-		my $val = $fm->$f();
-		if (ref $val) {
-			$self->insert("$key.$f", $val);
-		} else {
-			$ctx->property_by_path(
-				"$key.$f",
-				$val,
-				sub {
-					my $k = _js_prop_name(shift());
-					$fm->$k();
-				}, 
-
-				sub {
-					my $k = _js_prop_name(shift());
-					$fm->ischanged(1);
-					$fm->$k(@_);
-				}
-			);
-		}
-	}
+    my( $self, $key, $fm ) = @_;
+    my $ctx = $self->context;
+    return undef unless ($ctx and $key and $fm);
+    my $o = $ctx->object_by_path($key);
+    
+    for my $f ( $fm->properties ) {
+        my $val = $fm->$f();
+        if (ref $val) {
+            $self->insert("$key.$f", $val);
+        } else {
+            $ctx->property_by_path(
+                "$key.$f",
+                $val,
+                sub {
+                    my $k = _js_prop_name(shift());
+                    $fm->$k();
+                }, 
+
+                sub {
+                    my $k = _js_prop_name(shift());
+                    $fm->ischanged(1);
+                    $fm->$k(@_);
+                }
+            );
+        }
+    }
 }
 
 sub insert_hash {
 
-	my( $self, $key, $hash ) = @_;
-	my $ctx = $self->context;
-	return undef unless ($ctx and $key and $hash);
-	$ctx->object_by_path($key);
-	
-	for my $k ( keys %$hash ) {
-		my $v = $hash->{$k};
-		if (ref $v) {
-			$self->insert("$key.$k", $v);
-		} else {
-			$ctx->property_by_path(
-				"$key.$k", $v,
-				sub { $hash->{_js_prop_name(shift())} },
-				sub { 
-					my( $key, $val ) = @_;
-					$hash->{_js_prop_name($key)} = $val; }
-			);
-		}
-	}
+    my( $self, $key, $hash ) = @_;
+    my $ctx = $self->context;
+    return undef unless ($ctx and $key and $hash);
+    $ctx->object_by_path($key);
+    
+    for my $k ( keys %$hash ) {
+        my $v = $hash->{$k};
+        if (ref $v) {
+            $self->insert("$key.$k", $v);
+        } else {
+            $ctx->property_by_path(
+                "$key.$k", $v,
+                sub { $hash->{_js_prop_name(shift())} },
+                sub { 
+                    my( $key, $val ) = @_;
+                    $hash->{_js_prop_name($key)} = $val; }
+            );
+        }
+    }
 }
 
 my $__array_id = 0;
 sub insert_array {
 
-	my( $self, $key, $array ) = @_;
-	my $ctx = $self->context;
-	return undef unless ($ctx and $key and $array);
-
-	my $a = $ctx->array_by_path($key);
-	
-	my $ind = 0;
-	for my $v ( @$array ) {
-		if (ref $v) {
-			my $elobj = $ctx->object_by_path('__tmp_arr_el'.$__array_id);
-			$self->insert('__tmp_arr_el'.$__array_id, $v);
-			$ctx->array_set_element_as_object( $a, $ind, $elobj );
-			$__array_id++;
-		} else {
-			$ctx->array_set_element( $a, $ind, $v ) if defined($v);
-		}
-		$ind++;
-	}
+    my( $self, $key, $array ) = @_;
+    my $ctx = $self->context;
+    return undef unless ($ctx and $key and $array);
+
+    my $a = $ctx->array_by_path($key);
+    
+    my $ind = 0;
+    for my $v ( @$array ) {
+        if (ref $v) {
+            my $elobj = $ctx->object_by_path('__tmp_arr_el'.$__array_id);
+            $self->insert('__tmp_arr_el'.$__array_id, $v);
+            $ctx->array_set_element_as_object( $a, $ind, $elobj );
+            $__array_id++;
+        } else {
+            $ctx->array_set_element( $a, $ind, $v ) if defined($v);
+        }
+        $ind++;
+    }
 }
 
 sub _xmlhttprequest_send {
-	my $self = shift;
-	my $id = shift;
-	my $method = shift;
-	my $url = shift;
-	my $blocking = shift;
-	my $headerlist = shift;
-	my $data = shift;
-
-	my $ctx = $self->context;
-
-	# just so perl has access to it...
-	$ctx->object_by_path('__xmlhttpreq_hash.id'.$id);
-
-	my $headers = new HTTP::Headers;
-	my @lines = split(/\n/so, $headerlist);
-	for my $line (@lines) {
-		if ($line =~ /^(.+?)|(.+)$/o) {
-			$headers->header($1 => $2);
-		}
-	}
-
-	my $ua = LWP::UserAgent->new;
-	$ua->agent("OpenILS/0.1");
-
-	my $req = HTTP::Request->new($method => $url => $headers => $data);
-	my $res = $ua->request($req);
-
-	if ($res->is_success) {
-		
-		$ctx->property_by_path('__xmlhttpreq_hash.id'.$id.'.responseText', $res->content);
-		$ctx->property_by_path('__xmlhttpreq_hash.id'.$id.'.readyState', 4);
-		$ctx->property_by_path('__xmlhttpreq_hash.id'.$id.'.statusText', $res->status_line);
-		$ctx->property_by_path('__xmlhttpreq_hash.id'.$id.'.status', $res->code);
-
-	}
-		
+    my $self = shift;
+    my $id = shift;
+    my $method = shift;
+    my $url = shift;
+    my $blocking = shift;
+    my $headerlist = shift;
+    my $data = shift;
+
+    my $ctx = $self->context;
+
+    # just so perl has access to it...
+    $ctx->object_by_path('__xmlhttpreq_hash.id'.$id);
+
+    my $headers = new HTTP::Headers;
+    my @lines = split(/\n/so, $headerlist);
+    for my $line (@lines) {
+        if ($line =~ /^(.+?)|(.+)$/o) {
+            $headers->header($1 => $2);
+        }
+    }
+
+    my $ua = LWP::UserAgent->new;
+    $ua->agent("OpenILS/0.1");
+
+    my $req = HTTP::Request->new($method => $url => $headers => $data);
+    my $res = $ua->request($req);
+
+    if ($res->is_success) {
+        
+        $ctx->property_by_path('__xmlhttpreq_hash.id'.$id.'.responseText', $res->content);
+        $ctx->property_by_path('__xmlhttpreq_hash.id'.$id.'.readyState', 4);
+        $ctx->property_by_path('__xmlhttpreq_hash.id'.$id.'.statusText', $res->status_line);
+        $ctx->property_by_path('__xmlhttpreq_hash.id'.$id.'.status', $res->code);
+
+    }
+        
 }
 
 sub _parse_xml_string {
-	my $self = shift;
-	my $string = shift;
-	my $key = shift;
-
-
-	my $doc;
-	my $s = 0;
-	try {
-		$doc = XML::LibXML->new->parse_string( $string );
-		$s = 1;
-	} catch Error with {
-		my $e = shift;
-		warn "Could not parse document: $e\n";
-	};
-	return unless ($s);
-
-	_JS_DOM($self->context, $key, $doc);
+    my $self = shift;
+    my $string = shift;
+    my $key = shift;
+
+
+    my $doc;
+    my $s = 0;
+    try {
+        $doc = XML::LibXML->new->parse_string( $string );
+        $s = 1;
+    } catch Error with {
+        my $e = shift;
+        warn "Could not parse document: $e\n";
+    };
+    return unless ($s);
+
+    _JS_DOM($self->context, $key, $doc);
 }
 
 sub _JS_DOM {
-	my $ctx = shift;
-	my $key = shift;
-	my $node = shift;
-
-	if ($node->nodeType == 9) {
-		$node = $node->documentElement;
-
-		my $n = $node->nodeName;
-		my $ns = $node->namespaceURI;
-		$ns =~ s/'/\'/gso if ($ns);
-		$ns = "'$ns'" if ($ns);
-		$ns = 'null' unless ($ns);
-		$n =~ s/'/\'/gso;
-
-		#warn("$key = DOMImplementation().createDocument($ns,'$n');");
-		$ctx->eval("$key = new DOMImplementation().createDocument($ns,'$n');");
-
-		$key = $key.'.documentElement';
-	}
-
-	for my $a ($node->attributes) {
-		my $n = $a->nodeName;
-		my $v = $a->value;
-		$n =~ s/'/\'/gso;
-		$v =~ s/'/\'/gso;
-		#warn("$key.setAttribute('$n','$v');");
-		$ctx->eval("$key.setAttribute('$n','$v');");
-
-	}
-
-	my $k = 0;
-	for my $c ($node->childNodes) {
-		if ($c->nodeType == 1) {
-			my $n = $c->nodeName;
-			my $ns = $node->namespaceURI;
-
-			$n =~ s/'/\'/gso;
-			$ns =~ s/'/\'/gso if ($ns);
-			$ns = "'$ns'" if ($ns);
-			$ns = 'null' unless ($ns);
-
-			#warn("$key.appendChild($key.ownerDocument.createElementNS($ns,'$n'));");
-			$ctx->eval("$key.appendChild($key.ownerDocument.createElementNS($ns,'$n'));");
-			_JS_DOM($ctx, "$key.childNodes.item($k)",$c);
-
-		} elsif ($c->nodeType == 3) {
-			my $n = $c->data;
-			$n =~ s/'/\'/gso;
-			#warn("$key.appendChild($key.ownerDocument.createTextNode('$n'));");
-			#warn("path is $key.item($k);");
-			$ctx->eval("$key.appendChild($key.ownerDocument.createTextNode('$n'));");
-
-		} elsif ($c->nodeType == 4) {
-			my $n = $c->data;
-			$n =~ s/'/\'/gso;
-			#warn("$key.appendChild($key.ownerDocument.createCDATASection('$n'));");
-			$ctx->eval("$key.appendChild($key.ownerDocument.createCDATASection('$n'));");
-
-		} elsif ($c->nodeType == 8) {
-			my $n = $c->data;
-			$n =~ s/'/\'/gso;
-			#warn("$key.appendChild($key.ownerDocument.createComment('$n'));");
-			$ctx->eval("$key.appendChild($key.ownerDocument.createComment('$n'));");
-
-		} else {
-			warn "ACK! I don't know how to handle node type ".$c->nodeType;
-		}
-		
-
-		$k++;
-	}
-
-	return 1;
+    my $ctx = shift;
+    my $key = shift;
+    my $node = shift;
+
+    if ($node->nodeType == 9) {
+        $node = $node->documentElement;
+
+        my $n = $node->nodeName;
+        my $ns = $node->namespaceURI;
+        $ns =~ s/'/\'/gso if ($ns);
+        $ns = "'$ns'" if ($ns);
+        $ns = 'null' unless ($ns);
+        $n =~ s/'/\'/gso;
+
+        #warn("$key = DOMImplementation().createDocument($ns,'$n');");
+        $ctx->eval("$key = new DOMImplementation().createDocument($ns,'$n');");
+
+        $key = $key.'.documentElement';
+    }
+
+    for my $a ($node->attributes) {
+        my $n = $a->nodeName;
+        my $v = $a->value;
+        $n =~ s/'/\'/gso;
+        $v =~ s/'/\'/gso;
+        #warn("$key.setAttribute('$n','$v');");
+        $ctx->eval("$key.setAttribute('$n','$v');");
+
+    }
+
+    my $k = 0;
+    for my $c ($node->childNodes) {
+        if ($c->nodeType == 1) {
+            my $n = $c->nodeName;
+            my $ns = $node->namespaceURI;
+
+            $n =~ s/'/\'/gso;
+            $ns =~ s/'/\'/gso if ($ns);
+            $ns = "'$ns'" if ($ns);
+            $ns = 'null' unless ($ns);
+
+            #warn("$key.appendChild($key.ownerDocument.createElementNS($ns,'$n'));");
+            $ctx->eval("$key.appendChild($key.ownerDocument.createElementNS($ns,'$n'));");
+            _JS_DOM($ctx, "$key.childNodes.item($k)",$c);
+
+        } elsif ($c->nodeType == 3) {
+            my $n = $c->data;
+            $n =~ s/'/\'/gso;
+            #warn("$key.appendChild($key.ownerDocument.createTextNode('$n'));");
+            #warn("path is $key.item($k);");
+            $ctx->eval("$key.appendChild($key.ownerDocument.createTextNode('$n'));");
+
+        } elsif ($c->nodeType == 4) {
+            my $n = $c->data;
+            $n =~ s/'/\'/gso;
+            #warn("$key.appendChild($key.ownerDocument.createCDATASection('$n'));");
+            $ctx->eval("$key.appendChild($key.ownerDocument.createCDATASection('$n'));");
+
+        } elsif ($c->nodeType == 8) {
+            my $n = $c->data;
+            $n =~ s/'/\'/gso;
+            #warn("$key.appendChild($key.ownerDocument.createComment('$n'));");
+            $ctx->eval("$key.appendChild($key.ownerDocument.createComment('$n'));");
+
+        } else {
+            warn "ACK! I don't know how to handle node type ".$c->nodeType;
+        }
+        
+
+        $k++;
+    }
+
+    return 1;
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/ZClient.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/ZClient.pm
index 10080de..83a8b6b 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/ZClient.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/ZClient.pm
@@ -24,64 +24,64 @@ our $AUTOLOAD;
 # Detect the installed z client, prefering ZOOM.
 if (!$imp_class->use()) {
 
-	$imp_class = 'Net::Z3950';  # Try Net::Z3950
-	if ($imp_class->use()) {
-
-		# Tell 'new' how to build the connection
-		$conn_class = 'Net::Z3950::Connection';
-		
-	} else {
-		die "Cannot load a z39.50 client implementation!  Please install either ZOOM or Net::Z3950.\n";
-	}
+    $imp_class = 'Net::Z3950';  # Try Net::Z3950
+    if ($imp_class->use()) {
+
+        # Tell 'new' how to build the connection
+        $conn_class = 'Net::Z3950::Connection';
+        
+    } else {
+        die "Cannot load a z39.50 client implementation!  Please install either ZOOM or Net::Z3950.\n";
+    }
 }
 
 # 'new' is called thusly:
 #  my $conn = OpenILS::Utils::ZClient->new( $host, $port, databaseName => $db, user => $username )
 
 sub new {
-	my $class = shift();
-	my @args = @_;
+    my $class = shift();
+    my @args = @_;
 
-	if ($class ne __PACKAGE__) { # NOT called OO-ishly
-		# put the first param back if called like OpenILS::Utils::ZClient::new()
-		unshift @args, $class;
-	}
+    if ($class ne __PACKAGE__) { # NOT called OO-ishly
+        # put the first param back if called like OpenILS::Utils::ZClient::new()
+        unshift @args, $class;
+    }
 
-	return bless { connection => $conn_class->new(@_) } => __PACKAGE__;
+    return bless { connection => $conn_class->new(@_) } => __PACKAGE__;
 }
 
 sub search {
-	my $self = shift;
-	my $r =  $imp_class eq 'Net::Z3950' ?
-		$self->{connection}->search( @_ ) :
-		$self->{connection}->search_pqf( @_ );
+    my $self = shift;
+    my $r =  $imp_class eq 'Net::Z3950' ?
+        $self->{connection}->search( @_ ) :
+        $self->{connection}->search_pqf( @_ );
 
-	return OpenILS::Utils::ZClient::ResultSet->new( $r );
+    return OpenILS::Utils::ZClient::ResultSet->new( $r );
 }
 
 sub event {
-	my $list = shift;
-	if ($imp_class eq 'Net::Z3950') {
-		if (defined $$list[0]{_async_index}) {	
-			return 0 if ($$list[0]{_async_index} == @$list);
-			return ++$$list[0]{_async_index};
-		} else {
-			return $$list[0]{_async_index} = 1;
-		}
-	}
-
-	return ZOOM::event([map { ($_->{connection}) } @$list]);
+    my $list = shift;
+    if ($imp_class eq 'Net::Z3950') {
+        if (defined $$list[0]{_async_index}) {  
+            return 0 if ($$list[0]{_async_index} == @$list);
+            return ++$$list[0]{_async_index};
+        } else {
+            return $$list[0]{_async_index} = 1;
+        }
+    }
+
+    return ZOOM::event([map { ($_->{connection}) } @$list]);
 }
 
 *{__PACKAGE__ . '::search_pqf'} = \&search; 
 
 sub AUTOLOAD {
-	my $self = shift;
+    my $self = shift;
 
-	my $method = $AUTOLOAD;
-	$method =~ s/.*://;   # strip fully-qualified portion
+    my $method = $AUTOLOAD;
+    $method =~ s/.*://;   # strip fully-qualified portion
 
-	return $self->{connection}->$method( @_ );
+    return $self->{connection}->$method( @_ );
 }
 
 #-------------------------------------------------------------------------------
@@ -91,41 +91,41 @@ sub DESTROY {};
 our $AUTOLOAD;
 
 sub new {
-	my $class = shift;
-	my @args = @_;
+    my $class = shift;
+    my @args = @_;
 
-	if ($class ne __PACKAGE__) { # NOT called OO-ishly
-		# put the first param back if called like OpenILS::Utils::ZClient::ResultSet::new()
-		unshift @args, $class;
-	}
+    if ($class ne __PACKAGE__) { # NOT called OO-ishly
+        # put the first param back if called like OpenILS::Utils::ZClient::ResultSet::new()
+        unshift @args, $class;
+    }
 
 
-	return bless { result => $args[0] } => __PACKAGE__;
+    return bless { result => $args[0] } => __PACKAGE__;
 }
 
 sub record {
-	my $self = shift;
-	my $offset = shift;
-	my $r = $imp_class eq 'Net::Z3950' ?
-		$self->{result}->record( ++$offset ) :
-		$self->{result}->record( $offset );
+    my $self = shift;
+    my $offset = shift;
+    my $r = $imp_class eq 'Net::Z3950' ?
+        $self->{result}->record( ++$offset ) :
+        $self->{result}->record( $offset );
 
-	return  OpenILS::Utils::ZClient::Record->new( $r );
+    return  OpenILS::Utils::ZClient::Record->new( $r );
 }
 
 sub last_event {
-	my $self = shift;
-	return OpenILS::Utils::ZClient::EVENT_END() if ($imp_class eq 'Net::Z3950');
-	$self->{result}->last_event();
+    my $self = shift;
+    return OpenILS::Utils::ZClient::EVENT_END() if ($imp_class eq 'Net::Z3950');
+    $self->{result}->last_event();
 }
 
 sub AUTOLOAD {
-	my $self = shift;
+    my $self = shift;
 
-	my $method = $AUTOLOAD;
-	$method =~ s/.*://;   # strip fully-qualified portion
+    my $method = $AUTOLOAD;
+    $method =~ s/.*://;   # strip fully-qualified portion
 
-	return $self->{result}->$method( @_ );
+    return $self->{result}->$method( @_ );
 }
 
 #-------------------------------------------------------------------------------
@@ -135,34 +135,34 @@ sub DESTROY {};
 our $AUTOLOAD;
 
 sub new {
-	my $class = shift;
-	my @args = @_;
+    my $class = shift;
+    my @args = @_;
 
-	if ($class ne __PACKAGE__) { # NOT called OO-ishly
-		# put the first param back if called like OpenILS::Utils::ZClient::ResultSet::new()
-		unshift @args, $class;
-	}
+    if ($class ne __PACKAGE__) { # NOT called OO-ishly
+        # put the first param back if called like OpenILS::Utils::ZClient::ResultSet::new()
+        unshift @args, $class;
+    }
 
 
-	return bless { record => shift() } => __PACKAGE__;
+    return bless { record => shift() } => __PACKAGE__;
 }
 
 sub rawdata {
-	my $self = shift;
-	return $OpenILS::Utils::ZClient::imp_class eq 'Net::Z3950' ?
-		$self->{record}->rawdata( @_ ) :
-		$self->{record}->raw( @_ );
+    my $self = shift;
+    return $OpenILS::Utils::ZClient::imp_class eq 'Net::Z3950' ?
+        $self->{record}->rawdata( @_ ) :
+        $self->{record}->raw( @_ );
 }
 
 *{__PACKAGE__ . '::raw'} = \&rawdata; 
 
 sub AUTOLOAD {
-	my $self = shift;
+    my $self = shift;
 
-	my $method = $AUTOLOAD;
-	$method =~ s/.*://;   # strip fully-qualified portion
+    my $method = $AUTOLOAD;
+    $method =~ s/.*://;   # strip fully-qualified portion
 
-	return $self->{record}->$method( @_ );
+    return $self->{record}->$method( @_ );
 }
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/BadDebt.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/BadDebt.pm
index dbed38e..523b6d4 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/BadDebt.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/BadDebt.pm
@@ -41,40 +41,40 @@ sub child_init {
 }
 
 sub handler {
-	my $r = shift;
-	my $cgi = new CGI;
+    my $r = shift;
+    my $cgi = new CGI;
     my $auth_ses = $cgi->cookie('ses') || $cgi->param('ses');
 
-	# find some IDs ...
-	my @xacts;
+    # find some IDs ...
+    my @xacts;
 
     my $user = verify_login($auth_ses);
     return 403 unless $user;
 
-	my $mark_bad = $cgi->param('action') eq 'unmark' ? 'f' : 't';
-	my $format = $cgi->param('format') || 'csv';
-
-	my $file = $cgi->param('idfile');
-	if ($file) {
-		my $col = $cgi->param('idcolumn') || 0;
-		my $csv = new Text::CSV;
-
-		while (<$file>) {
-			$csv->parse($_);
-			my @data = $csv->fields;
-			my $id = $data[$col];
-			$id =~ s/\D+//o;
-			next unless ($id);
-			push @xacts, $id;
-		}
-	}
-
-	if (!@xacts) { # try pathinfo
-		my $path_rec = $cgi->path_info();
-		if ($path_rec) {
-			@xacts = map { $_ ? ($_) : () } split '/', $path_rec;
-		}
-	}
+    my $mark_bad = $cgi->param('action') eq 'unmark' ? 'f' : 't';
+    my $format = $cgi->param('format') || 'csv';
+
+    my $file = $cgi->param('idfile');
+    if ($file) {
+        my $col = $cgi->param('idcolumn') || 0;
+        my $csv = new Text::CSV;
+
+        while (<$file>) {
+            $csv->parse($_);
+            my @data = $csv->fields;
+            my $id = $data[$col];
+            $id =~ s/\D+//o;
+            next unless ($id);
+            push @xacts, $id;
+        }
+    }
+
+    if (!@xacts) { # try pathinfo
+        my $path_rec = $cgi->path_info();
+        if ($path_rec) {
+            @xacts = map { $_ ? ($_) : () } split '/', $path_rec;
+        }
+    }
 
     return 404 unless @xacts;
 
@@ -85,7 +85,7 @@ sub handler {
 
     my @header = ( '"Transaction ID"', '"Message"', '"Amount Owed"', '"Transaction Start Date"', '"User Barcode"' );
 
-	my $cstore = OpenSRF::AppSession->create('open-ils.cstore');
+    my $cstore = OpenSRF::AppSession->create('open-ils.cstore');
     my $actor = OpenSRF::AppSession->create('open-ils.actor');
 
     $cstore->connect();
@@ -142,14 +142,14 @@ sub handler {
 
     if ($format eq 'csv') {
         $r->headers_out->set("Content-Disposition" => "inline; filename=bad_debt_$date.csv");
-	    $r->content_type('application/octet-stream');
+        $r->content_type('application/octet-stream');
 
         $r->print( join(',', @header) . "\n" );
         $r->print( join(',', @$_    ) . "\n" ) for (@lines);
 
     } elsif ($format eq 'json') {
 
-	    $r->content_type('application/json');
+        $r->content_type('application/json');
 
         $r->print( '[' );
 
@@ -169,7 +169,7 @@ sub handler {
         $r->print( ']' );
     }
 
-	return Apache2::Const::OK;
+    return Apache2::Const::OK;
 
 }
 
@@ -191,27 +191,27 @@ sub verify_login {
 }
 
 sub show_template {
-	my $r = shift;
+    my $r = shift;
 
-	$r->content_type('text/html');
-	$r->print(<<HTML);
+    $r->content_type('text/html');
+    $r->print(<<HTML);
 
 <html>
-	<head>
-		<title>Record Export</title>
-	</head>
-	<body>
-		<form method="POST" enctype="multipart/form-data">
-			Use field number <input type="text" size="2" maxlength="2" name="idcolumn" value="0"/> (starting from 0)
-			from CSV file <input type="file" name="idfile"/>
-			<input type="submit" value="Mark Transactions Unrecoverable"/>
-		</form>
-	</body>
+    <head>
+        <title>Record Export</title>
+    </head>
+    <body>
+        <form method="POST" enctype="multipart/form-data">
+            Use field number <input type="text" size="2" maxlength="2" name="idcolumn" value="0"/> (starting from 0)
+            from CSV file <input type="file" name="idfile"/>
+            <input type="submit" value="Mark Transactions Unrecoverable"/>
+        </form>
+    </body>
 </html>
 
 HTML
 
-	return Apache2::Const::OK;
+    return Apache2::Const::OK;
 }
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm
index fa6b473..781b561 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm
@@ -98,12 +98,12 @@ sub init_ro_object_cache {
         # fetch the org unit tree
         unless($cache{aou_tree}{$ctx->{locale}}) {
             my $tree = $e->search_actor_org_unit([
-			    {   parent_ou => undef},
-			    {   flesh            => -1,
-				    flesh_fields    => {aou =>  ['children']},
-				    order_by        => {aou => 'name'}
-			    }
-		    ])->[0];
+                {   parent_ou => undef},
+                {   flesh            => -1,
+                    flesh_fields    => {aou =>  ['children']},
+                    order_by        => {aou => 'name'}
+                }
+            ])->[0];
 
             # flesh the org unit type for each org unit
             # and simultaneously set the id => aou map cache
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm
index 8787ee5..e5d5bb2 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm
@@ -120,7 +120,7 @@ sub parse_as_xml {
         $data = $ctx->{final_dtd} . "\n" . $data;
         $success = 1;
     } otherwise {
-	    my $e = shift;
+        my $e = shift;
         my $err = "Invalid XML: $e";
         $r->log->error("egweb: $err");
         $r->content_type('text/plain; encoding=utf8');
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Exporter.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Exporter.pm
index b9fea03..058f7a3 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Exporter.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Exporter.pm
@@ -51,236 +51,236 @@ sub child_init {
 }
 
 sub handler {
-	my $r = shift;
-	my $cgi = new CGI;
-
-	# find some IDs ...
-	my @records;
-
-	@records = map { $_ ? ($_) : () } $cgi->param('id');
-
-	if (!@records) { # try for a file
-		my $file = $cgi->param('idfile');
-		if ($file) {
-			my $col = $cgi->param('idcolumn') || 0;
-			my $csv = new Text::CSV;
-
-			while (<$file>) {
-				$csv->parse($_);
-				my @data = $csv->fields;
-				my $id = $data[$col];
-				$id =~ s/\D+//o;
-				next unless ($id);
-				push @records, $id;
-			}
-		}
-	}
-
-	if (!@records) { # try pathinfo
-		my $path_rec = $cgi->path_info();
-		if ($path_rec) {
-			@records = map { $_ ? ($_) : () } split '/', $path_rec;
-		}
-	}
-
-	my $ses = OpenSRF::AppSession->create('open-ils.cstore');
-
-	# still no records ...
-	my $container = $cgi->param('containerid');
-	if ($container) {
-		my $bucket = $ses->request( 'open-ils.cstore.direct.container.biblio_record_entry_bucket.retrieve', $container )->gather(1);
+    my $r = shift;
+    my $cgi = new CGI;
+
+    # find some IDs ...
+    my @records;
+
+    @records = map { $_ ? ($_) : () } $cgi->param('id');
+
+    if (!@records) { # try for a file
+        my $file = $cgi->param('idfile');
+        if ($file) {
+            my $col = $cgi->param('idcolumn') || 0;
+            my $csv = new Text::CSV;
+
+            while (<$file>) {
+                $csv->parse($_);
+                my @data = $csv->fields;
+                my $id = $data[$col];
+                $id =~ s/\D+//o;
+                next unless ($id);
+                push @records, $id;
+            }
+        }
+    }
+
+    if (!@records) { # try pathinfo
+        my $path_rec = $cgi->path_info();
+        if ($path_rec) {
+            @records = map { $_ ? ($_) : () } split '/', $path_rec;
+        }
+    }
+
+    my $ses = OpenSRF::AppSession->create('open-ils.cstore');
+
+    # still no records ...
+    my $container = $cgi->param('containerid');
+    if ($container) {
+        my $bucket = $ses->request( 'open-ils.cstore.direct.container.biblio_record_entry_bucket.retrieve', $container )->gather(1);
         unless($bucket) {
             $r->log->error("No such bucket $container"); 
             $logger->error("No such bucket $container"); 
             return Apache2::Const::NOT_FOUND;
         }
         if ($bucket->pub !~ /t|1/oi) {
-    		my $authid = $cgi->cookie('ses') || $cgi->param('ses');
-	    	my $auth = verify_login($authid);
-		    if (!$auth) {
-			    return 403;
-    		}
+            my $authid = $cgi->cookie('ses') || $cgi->param('ses');
+            my $auth = verify_login($authid);
+            if (!$auth) {
+                return 403;
+            }
         }
-		my $recs = $ses->request( 'open-ils.cstore.direct.container.biblio_record_entry_bucket_item.search.atomic', { bucket => $container } )->gather(1);
-		@records = map { ($_->target_biblio_record_entry) } @$recs;
-	}
+        my $recs = $ses->request( 'open-ils.cstore.direct.container.biblio_record_entry_bucket_item.search.atomic', { bucket => $container } )->gather(1);
+        @records = map { ($_->target_biblio_record_entry) } @$recs;
+    }
 
-	return show_template($r) unless (@records);
+    return show_template($r) unless (@records);
 
-	my $type = $cgi->param('rectype') || 'biblio';
-	if ($type ne 'biblio' && $type ne 'authority') {
-		return 400;
-	}
+    my $type = $cgi->param('rectype') || 'biblio';
+    if ($type ne 'biblio' && $type ne 'authority') {
+        return 400;
+    }
 
-	my $tcn_v = 'tcn_value';
-	my $tcn_s = 'tcn_source';
+    my $tcn_v = 'tcn_value';
+    my $tcn_s = 'tcn_source';
 
-	my $holdings = $cgi->param('holdings') if ($type eq 'biblio');
-	my $location = $cgi->param('location') || 'gaaagpl'; # just because...
+    my $holdings = $cgi->param('holdings') if ($type eq 'biblio');
+    my $location = $cgi->param('location') || 'gaaagpl'; # just because...
 
-	my $format = $cgi->param('format') || 'USMARC';
-	$format = uc($format);
+    my $format = $cgi->param('format') || 'USMARC';
+    $format = uc($format);
 
-	my $encoding = $cgi->param('encoding') || 'UTF-8';
-	$encoding = uc($encoding);
+    my $encoding = $cgi->param('encoding') || 'UTF-8';
+    $encoding = uc($encoding);
 
-	my $filename = $cgi->param('filename') || "export.$type.$encoding.$format";
+    my $filename = $cgi->param('filename') || "export.$type.$encoding.$format";
 
-	binmode(STDOUT, ':raw') if ($encoding ne 'UTF-8');
-	binmode(STDOUT, ':utf8') if ($encoding eq 'UTF-8');
+    binmode(STDOUT, ':raw') if ($encoding ne 'UTF-8');
+    binmode(STDOUT, ':utf8') if ($encoding eq 'UTF-8');
 
-	if (!grep { uc($format) eq $_ } @formats) {
-		return 400;
-	}
+    if (!grep { uc($format) eq $_ } @formats) {
+        return 400;
+    }
 
-	if ($format ne 'XML') {
-		my $ftype = 'MARC::File::' . $format;
-		$ftype->require;
-	}
+    if ($format ne 'XML') {
+        my $ftype = 'MARC::File::' . $format;
+        $ftype->require;
+    }
 
 
-	$r->headers_out->set("Content-Disposition" => "inline; filename=$filename");
+    $r->headers_out->set("Content-Disposition" => "inline; filename=$filename");
 
-	if (uc($format) eq 'XML') {
-		$r->content_type('application/xml');
-	} else {
-		$r->content_type('application/octet-stream');
-	}
+    if (uc($format) eq 'XML') {
+        $r->content_type('application/xml');
+    } else {
+        $r->content_type('application/octet-stream');
+    }
 
-	$r->print( <<"	HEADER" ) if (uc($format) eq 'XML');
+    $r->print( <<"    HEADER" ) if (uc($format) eq 'XML');
 <?xml version="1.0" encoding="$encoding"?>
 <collection xmlns='http://www.loc.gov/MARC21/slim'>
-	HEADER
-
-	my %orgs;
-	my %shelves;
-	my %statuses;
-
-	my $flesh = {};
-	if ($holdings) {
-
-		my $req = $ses->request( 'open-ils.cstore.direct.actor.org_unit.search', { id => { '!=' => undef } } );
-
-    		while (my $o = $req->recv) {
-        		next if ($req->failed);
-        		$o = $o->content;
-        		last unless ($o);
-	    		$orgs{$o->id} = $o;
-    		}
-    		$req->finish;
-
-		$req = $ses->request( 'open-ils.cstore.direct.asset.copy_location.search', { id => { '!=' => undef } } );
-
-    		while (my $s = $req->recv) {
-        		next if ($req->failed);
-        		$s = $s->content;
-        		last unless ($s);
-	    		$shelves{$s->id} = $s;
-    		}
-    		$req->finish;
-
-		$req = $ses->request( 'open-ils.cstore.direct.config.copy_status.search', { id => { '!=' => undef } } );
-
-    		while (my $s = $req->recv) {
-        		next if ($req->failed);
-        		$s = $s->content;
-        		last unless ($s);
-	    		$statuses{$s->id} = $s;
-    		}
-    		$req->finish;
-
-    		$flesh = { flesh => 2, flesh_fields => { bre => [ 'call_numbers' ], acn => [ 'copies' ] } };
-	}
-
-	for my $i ( @records ) {
-    		my $bib;
-    		try {
-        		local $SIG{ALRM} = sub { die "TIMEOUT\n" };
-        		alarm(1);
-	    		$bib = $ses->request( "open-ils.cstore.direct.$type.record_entry.retrieve", $i, $flesh )->gather(1);
-        		alarm(0);
-    		} otherwise {
-        		warn "\n!!!!!! Timed out trying to read record $i\n";
-    		};
-    		alarm(0);
-
-		next unless $bib;
-
-    		if (uc($format) eq 'BRE') {
-        		$r->print( OpenSRF::Utils::JSON->perl2JSON($bib) . "\n" );
-        		next;
-    		}
-
-		try {
-
-			my $req = MARC::Record->new_from_xml( $bib->marc, $encoding, $format );
-			$req->encoding($encoding) if ($encoding eq 'UTF-8');
-
-			if ($holdings) {
-				$req->delete_field( $_ ) for ($req->field('852')); # remove any legacy 852s
-
-        			my $cn_list = $bib->call_numbers;
-        			if ($cn_list && @$cn_list) {
-							$cn_list = [ grep { $_->deleted eq 'f' } @$cn_list ];
-            				my $cp_list = [ grep { $_->deleted eq 'f' } map { @{ $_->copies } } @$cn_list ];
-            				if ($cp_list && @$cp_list) {
-
-	            				my %cn_map;
-	            				push @{$cn_map{$_->call_number}}, $_ for (@$cp_list);
-		                        
-	            				for my $cn ( @$cn_list ) {
-	                				my $cn_map_list = $cn_map{$cn->id};
-	
-	                				for my $cp ( @$cn_map_list ) {
-		                        
-								$req->append_fields(
-									MARC::Field->new(
-										852, '4', '', 
-										a => $location,
-										b => $orgs{$cn->owning_lib}->shortname,
-										b => $orgs{$cp->circ_lib}->shortname,
-										c => $shelves{$cp->location}->name,
-										j => $cn->label,
-										($cp->circ_modifier ? ( g => $cp->circ_modifier ) : ()),
-										p => $cp->barcode,
-										($cp->price ? ( y => $cp->price ) : ()),
-										($cp->copy_number ? ( t => $cp->copy_number ) : ()),
-										($cp->ref eq 't' ? ( x => 'reference' ) : ( x => 'nonreference' )),
-										($cp->holdable eq 'f' ? ( x => 'unholdable' ) : ( x => 'holdable' )),
-										($cp->circulate eq 'f' ? ( x => 'noncirculating' ) : ( x => 'circulating' )),
-										($cp->opac_visible eq 'f' ? ( x => 'hidden' ) : ( x => 'visible' )),
-										z => $statuses{$cp->status}->name,
-									)
-								);
-
-							}
-						}
-					}
-        			}
-			}
-
-			if (uc($format) eq 'XML') {
-				my $x = $req->as_xml_record;
-				$x =~ s/^<\?xml version="1.0" encoding="UTF-8"\?>//o;
-				$r->print($x);
-			} elsif (uc($format) eq 'UNIMARC') {
-				$r->print($req->as_usmarc);
-			} elsif (uc($format) eq 'USMARC') {
-				$r->print($req->as_usmarc);
-			}
+    HEADER
+
+    my %orgs;
+    my %shelves;
+    my %statuses;
+
+    my $flesh = {};
+    if ($holdings) {
+
+        my $req = $ses->request( 'open-ils.cstore.direct.actor.org_unit.search', { id => { '!=' => undef } } );
+
+            while (my $o = $req->recv) {
+                next if ($req->failed);
+                $o = $o->content;
+                last unless ($o);
+                $orgs{$o->id} = $o;
+            }
+            $req->finish;
+
+        $req = $ses->request( 'open-ils.cstore.direct.asset.copy_location.search', { id => { '!=' => undef } } );
+
+            while (my $s = $req->recv) {
+                next if ($req->failed);
+                $s = $s->content;
+                last unless ($s);
+                $shelves{$s->id} = $s;
+            }
+            $req->finish;
+
+        $req = $ses->request( 'open-ils.cstore.direct.config.copy_status.search', { id => { '!=' => undef } } );
+
+            while (my $s = $req->recv) {
+                next if ($req->failed);
+                $s = $s->content;
+                last unless ($s);
+                $statuses{$s->id} = $s;
+            }
+            $req->finish;
+
+            $flesh = { flesh => 2, flesh_fields => { bre => [ 'call_numbers' ], acn => [ 'copies' ] } };
+    }
+
+    for my $i ( @records ) {
+            my $bib;
+            try {
+                local $SIG{ALRM} = sub { die "TIMEOUT\n" };
+                alarm(1);
+                $bib = $ses->request( "open-ils.cstore.direct.$type.record_entry.retrieve", $i, $flesh )->gather(1);
+                alarm(0);
+            } otherwise {
+                warn "\n!!!!!! Timed out trying to read record $i\n";
+            };
+            alarm(0);
+
+        next unless $bib;
+
+            if (uc($format) eq 'BRE') {
+                $r->print( OpenSRF::Utils::JSON->perl2JSON($bib) . "\n" );
+                next;
+            }
+
+        try {
+
+            my $req = MARC::Record->new_from_xml( $bib->marc, $encoding, $format );
+            $req->encoding($encoding) if ($encoding eq 'UTF-8');
+
+            if ($holdings) {
+                $req->delete_field( $_ ) for ($req->field('852')); # remove any legacy 852s
+
+                    my $cn_list = $bib->call_numbers;
+                    if ($cn_list && @$cn_list) {
+                            $cn_list = [ grep { $_->deleted eq 'f' } @$cn_list ];
+                            my $cp_list = [ grep { $_->deleted eq 'f' } map { @{ $_->copies } } @$cn_list ];
+                            if ($cp_list && @$cp_list) {
+
+                                my %cn_map;
+                                push @{$cn_map{$_->call_number}}, $_ for (@$cp_list);
+                                
+                                for my $cn ( @$cn_list ) {
+                                    my $cn_map_list = $cn_map{$cn->id};
+    
+                                    for my $cp ( @$cn_map_list ) {
+                                
+                                $req->append_fields(
+                                    MARC::Field->new(
+                                        852, '4', '', 
+                                        a => $location,
+                                        b => $orgs{$cn->owning_lib}->shortname,
+                                        b => $orgs{$cp->circ_lib}->shortname,
+                                        c => $shelves{$cp->location}->name,
+                                        j => $cn->label,
+                                        ($cp->circ_modifier ? ( g => $cp->circ_modifier ) : ()),
+                                        p => $cp->barcode,
+                                        ($cp->price ? ( y => $cp->price ) : ()),
+                                        ($cp->copy_number ? ( t => $cp->copy_number ) : ()),
+                                        ($cp->ref eq 't' ? ( x => 'reference' ) : ( x => 'nonreference' )),
+                                        ($cp->holdable eq 'f' ? ( x => 'unholdable' ) : ( x => 'holdable' )),
+                                        ($cp->circulate eq 'f' ? ( x => 'noncirculating' ) : ( x => 'circulating' )),
+                                        ($cp->opac_visible eq 'f' ? ( x => 'hidden' ) : ( x => 'visible' )),
+                                        z => $statuses{$cp->status}->name,
+                                    )
+                                );
+
+                            }
+                        }
+                    }
+                    }
+            }
+
+            if (uc($format) eq 'XML') {
+                my $x = $req->as_xml_record;
+                $x =~ s/^<\?xml version="1.0" encoding="UTF-8"\?>//o;
+                $r->print($x);
+            } elsif (uc($format) eq 'UNIMARC') {
+                $r->print($req->as_usmarc);
+            } elsif (uc($format) eq 'USMARC') {
+                $r->print($req->as_usmarc);
+            }
 
             $r->rflush();
 
-		} otherwise {
-			my $e = shift;
-			warn "\n$e\n";
-		};
+        } otherwise {
+            my $e = shift;
+            warn "\n$e\n";
+        };
 
-	}
+    }
 
-	$r->print("</collection>\n") if ($format eq 'XML');
+    $r->print("</collection>\n") if ($format eq 'XML');
 
-	return Apache2::Const::OK;
+    return Apache2::Const::OK;
 
 }
 
@@ -302,48 +302,48 @@ sub verify_login {
 }
 
 sub show_template {
-	my $r = shift;
+    my $r = shift;
 
-	$r->content_type('text/html');
-	$r->print(<<HTML);
+    $r->content_type('text/html');
+    $r->print(<<HTML);
 
 <html>
-	<head>
-		<title>Record Export</title>
-	</head>
-	<body>
-		<form method="POST" enctype="multipart/form-data">
-			Use field number <input type="text" size="2" maxlength="2" name="idcolumn" value="0"/> (starting from 0)
-			from CSV file <input type="file" name="idfile"/>
-			<br/><br/> <b>or</b> <br/><br/>
-			Record ID <input type="text" size="12" maxlength="12" name="id"/>
-			<br/><br/> Record Type:
-			<select name="rectype">
-				<option value="biblio">Bibliographic Records</option>
-				<option value="authority">Authority Records</option>
-			</select>
-			<br/> Record Format:
-			<select name="format">
-				<option value="USMARC">MARC21</option>
-				<option value="UNIMARC">UNIMARC</option>
-				<option value="XML">MARC XML</option>
-				<option value="BRE">Evergreen BRE</option>
-			</select>
-			<br/> Record Encoding:
-			<select name="encoding">
-				<option value="UTF-8">UTF-8</option>
-				<option value="MARC8">MARC8</option>
-			</select>
-			<br/> Include holdings in Bibliographic Records:
-			<input type="checkbox" name="holdings" value="1">
-			<br/><br/><input type="submit" value="Retrieve Records"/>
-		</form>
-	</body>
+    <head>
+        <title>Record Export</title>
+    </head>
+    <body>
+        <form method="POST" enctype="multipart/form-data">
+            Use field number <input type="text" size="2" maxlength="2" name="idcolumn" value="0"/> (starting from 0)
+            from CSV file <input type="file" name="idfile"/>
+            <br/><br/> <b>or</b> <br/><br/>
+            Record ID <input type="text" size="12" maxlength="12" name="id"/>
+            <br/><br/> Record Type:
+            <select name="rectype">
+                <option value="biblio">Bibliographic Records</option>
+                <option value="authority">Authority Records</option>
+            </select>
+            <br/> Record Format:
+            <select name="format">
+                <option value="USMARC">MARC21</option>
+                <option value="UNIMARC">UNIMARC</option>
+                <option value="XML">MARC XML</option>
+                <option value="BRE">Evergreen BRE</option>
+            </select>
+            <br/> Record Encoding:
+            <select name="encoding">
+                <option value="UTF-8">UTF-8</option>
+                <option value="MARC8">MARC8</option>
+            </select>
+            <br/> Include holdings in Bibliographic Records:
+            <input type="checkbox" name="holdings" value="1">
+            <br/><br/><input type="submit" value="Retrieve Records"/>
+        </form>
+    </body>
 </html>
 
 HTML
 
-	return Apache2::Const::OK;
+    return Apache2::Const::OK;
 }
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/PasswordReset.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/PasswordReset.pm
index 60297e1..150a586 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/PasswordReset.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/PasswordReset.pm
@@ -73,7 +73,7 @@ sub password_reset {
 
     $apache->content_type('text/html');
 
-	my $cgi = new CGI;
+    my $cgi = new CGI;
     my $ctx = {};
 
     $ctx->{'uri'} = $apache->uri;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Proxy.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Proxy.pm
index 04c43b3..ed6cdf9 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Proxy.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Proxy.pm
@@ -19,123 +19,123 @@ my $ssl_off;
 
 my $default_template = <<HTML;
 <html>
-	<head>
-		<title>TITLE</title>
-	</head>
-	<body>
-		<br/><br/><br/>
-		<center>
-		<form method='POST'>
-			<table style='border-collapse: collapse; border: 1px solid black;'>
-				<tr>
-					<th colspan='2' align='center'><u>DESCRIPTION</u></th>
-				</tr>
-				<tr>
-					<th align="right">Username or barcode:</th>
-					<td><input type="text" name="user"/></td>
-				</tr>
-				<tr>
-					<th align="right">Password:</th>
-					<td><input type="password" name="passwd"/></td>
-				</tr>
-			</table>
-			<input type="submit" value="Log in"/>
-		</form>
-		</center>
-	</body>
+    <head>
+        <title>TITLE</title>
+    </head>
+    <body>
+        <br/><br/><br/>
+        <center>
+        <form method='POST'>
+            <table style='border-collapse: collapse; border: 1px solid black;'>
+                <tr>
+                    <th colspan='2' align='center'><u>DESCRIPTION</u></th>
+                </tr>
+                <tr>
+                    <th align="right">Username or barcode:</th>
+                    <td><input type="text" name="user"/></td>
+                </tr>
+                <tr>
+                    <th align="right">Password:</th>
+                    <td><input type="password" name="passwd"/></td>
+                </tr>
+            </table>
+            <input type="submit" value="Log in"/>
+        </form>
+        </center>
+    </body>
 </html>
 HTML
 
 sub import {
-	my $self = shift;
-	$bootstrap = shift;
-	$ssl_off = shift;
+    my $self = shift;
+    $bootstrap = shift;
+    $ssl_off = shift;
 }
 
 
 sub child_init {
-	OpenSRF::System->bootstrap_client( config_file => $bootstrap );
-	return Apache2::Const::OK;
+    OpenSRF::System->bootstrap_client( config_file => $bootstrap );
+    return Apache2::Const::OK;
 }
 
 sub handler {
-	my $apache = shift;
+    my $apache = shift;
 
-	my $proxyhtml = $apache->dir_config('OILSProxyHTML');
-	my $title = $apache->dir_config('OILSProxyTitle');
-	my $desc = $apache->dir_config('OILSProxyDescription');
-	my $ltype = $apache->dir_config('OILSProxyLoginType');
-	my $perms = [ split ' ', $apache->dir_config('OILSProxyPermissions') ];
+    my $proxyhtml = $apache->dir_config('OILSProxyHTML');
+    my $title = $apache->dir_config('OILSProxyTitle');
+    my $desc = $apache->dir_config('OILSProxyDescription');
+    my $ltype = $apache->dir_config('OILSProxyLoginType');
+    my $perms = [ split ' ', $apache->dir_config('OILSProxyPermissions') ];
 
-	return Apache2::Const::NOT_FOUND unless ($title || $proxyhtml);
-	return Apache2::Const::NOT_FOUND unless (@$perms);
+    return Apache2::Const::NOT_FOUND unless ($title || $proxyhtml);
+    return Apache2::Const::NOT_FOUND unless (@$perms);
 
-	my $cgi = new CGI;
-	my $auth_ses = $cgi->cookie('ses') || $cgi->param('ses');
-	my $ws_ou = $apache->dir_config('OILSProxyLoginOU') || $cgi->cookie('ws_ou') || $cgi->param('ws_ou');
+    my $cgi = new CGI;
+    my $auth_ses = $cgi->cookie('ses') || $cgi->param('ses');
+    my $ws_ou = $apache->dir_config('OILSProxyLoginOU') || $cgi->cookie('ws_ou') || $cgi->param('ws_ou');
 
-	my $url = $cgi->url;
+    my $url = $cgi->url;
 
-	# push everyone to the secure site
-	if (!$ssl_off && $url =~ /^http:/o) {
+    # push everyone to the secure site
+    if (!$ssl_off && $url =~ /^http:/o) {
         my $base = $cgi->url(-base=>1);
-		$base =~ s/^http:/https:/o;
-		print "Location: $base".$apache->unparsed_uri."\n\n";
-		return Apache2::Const::REDIRECT;
-	}
-
-	if (!$auth_ses) {
-		my $u = $cgi->param('user');
-		my $p = $cgi->param('passwd');
-
-		if (!$u) {
-
-			print $cgi->header(-type=>'text/html', -expires=>'-1d');
-			if (!$proxyhtml) {
-				$proxyhtml = $default_template;
-				$proxyhtml =~ s/TITLE/$title/gso;
-				$proxyhtml =~ s/DESCRIPTION/$desc/gso;
-			} else {
-				# XXX template toolkit??
-			}
-
-			print $proxyhtml;
-			return Apache2::Const::OK;
-		}
-
-		$auth_ses = oils_login($u, $p, $ltype);
-		if ($auth_ses) {
-			print $cgi->redirect(
-				-uri=> $apache->unparsed_uri,
-				-cookie=>$cgi->cookie(
-					-name=>'ses',
-					-value=>$auth_ses,
-					-path=>'/',
-					-secure=>1
-				)
-			);
-			return Apache2::Const::REDIRECT;
-		} else {
+        $base =~ s/^http:/https:/o;
+        print "Location: $base".$apache->unparsed_uri."\n\n";
+        return Apache2::Const::REDIRECT;
+    }
+
+    if (!$auth_ses) {
+        my $u = $cgi->param('user');
+        my $p = $cgi->param('passwd');
+
+        if (!$u) {
+
+            print $cgi->header(-type=>'text/html', -expires=>'-1d');
+            if (!$proxyhtml) {
+                $proxyhtml = $default_template;
+                $proxyhtml =~ s/TITLE/$title/gso;
+                $proxyhtml =~ s/DESCRIPTION/$desc/gso;
+            } else {
+                # XXX template toolkit??
+            }
+
+            print $proxyhtml;
+            return Apache2::Const::OK;
+        }
+
+        $auth_ses = oils_login($u, $p, $ltype);
+        if ($auth_ses) {
+            print $cgi->redirect(
+                -uri=> $apache->unparsed_uri,
+                -cookie=>$cgi->cookie(
+                    -name=>'ses',
+                    -value=>$auth_ses,
+                    -path=>'/',
+                    -secure=>1
+                )
+            );
+            return Apache2::Const::REDIRECT;
+        } else {
             return back_to_login($apache, $cgi);
         }
-	}
+    }
 
-	my $user = verify_login($auth_ses);
+    my $user = verify_login($auth_ses);
     return back_to_login($apache, $cgi) unless $user;
 
-	$ws_ou ||= $user->home_ou;
+    $ws_ou ||= $user->home_ou;
 
-	warn "Checking perms " . join(',', @$perms) . " for user " . $user->id . " at location $ws_ou\n";
+    warn "Checking perms " . join(',', @$perms) . " for user " . $user->id . " at location $ws_ou\n";
 
-	my $failures = OpenSRF::AppSession
-		->create('open-ils.actor')
-		->request('open-ils.actor.user.perm.check', $auth_ses, $user->id, $ws_ou, $perms)
-		->gather(1);
+    my $failures = OpenSRF::AppSession
+        ->create('open-ils.actor')
+        ->request('open-ils.actor.user.perm.check', $auth_ses, $user->id, $ws_ou, $perms)
+        ->gather(1);
 
-	return back_to_login($apache, $cgi) if (@$failures > 0);
+    return back_to_login($apache, $cgi) if (@$failures > 0);
 
-	# they're good, let 'em through
-	return Apache2::Const::DECLINED;
+    # they're good, let 'em through
+    return Apache2::Const::DECLINED;
 }
 
 sub back_to_login {
@@ -154,43 +154,43 @@ sub back_to_login {
 
 # returns the user object if the session is valid, 0 otherwise
 sub verify_login {
-	my $auth_token = shift;
-	return undef unless $auth_token;
+    my $auth_token = shift;
+    return undef unless $auth_token;
 
-	my $user = OpenSRF::AppSession
-		->create("open-ils.auth")
-		->request( "open-ils.auth.session.retrieve", $auth_token )
-		->gather(1);
+    my $user = OpenSRF::AppSession
+        ->create("open-ils.auth")
+        ->request( "open-ils.auth.session.retrieve", $auth_token )
+        ->gather(1);
 
-	if (ref($user) eq 'HASH' && $user->{ilsevent} == 1001) {
-		return undef;
-	}
+    if (ref($user) eq 'HASH' && $user->{ilsevent} == 1001) {
+        return undef;
+    }
 
-	return $user if ref($user);
-	return undef;
+    return $user if ref($user);
+    return undef;
 }
 
 sub oils_login {
         my( $username, $password, $type ) = @_;
 
         $type |= "staff";
-	my $nametype = 'username';
-	$nametype = 'barcode' if ($username =~ /^\d+$/o);
+    my $nametype = 'username';
+    $nametype = 'barcode' if ($username =~ /^\d+$/o);
 
         my $seed = OpenSRF::AppSession
-		->create("open-ils.auth")
-		->request( 'open-ils.auth.authenticate.init', $username )
-		->gather(1);
+        ->create("open-ils.auth")
+        ->request( 'open-ils.auth.authenticate.init', $username )
+        ->gather(1);
 
         return undef unless $seed;
 
         my $response = OpenSRF::AppSession
-		->create("open-ils.auth")
-		->request( 'open-ils.auth.authenticate.complete',
-			{ $nametype => $username, agent => 'authproxy',
-			  password => md5_hex($seed . md5_hex($password)),
-			  type => $type })
-		->gather(1);
+        ->create("open-ils.auth")
+        ->request( 'open-ils.auth.authenticate.complete',
+            { $nametype => $username, agent => 'authproxy',
+              password => md5_hex($seed . md5_hex($password)),
+              type => $type })
+        ->gather(1);
 
         return undef unless $response;
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Proxy/Authen.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Proxy/Authen.pm
index dcf596e..2e33aa1 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Proxy/Authen.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Proxy/Authen.pm
@@ -132,43 +132,43 @@ sub handler {
 
 # returns the user object if the session is valid, 0 otherwise
 sub verify_login {
-	my $auth_token = shift;
-	return undef unless $auth_token;
+    my $auth_token = shift;
+    return undef unless $auth_token;
 
-	my $user = OpenSRF::AppSession
-		->create("open-ils.auth")
-		->request( "open-ils.auth.session.retrieve", $auth_token )
-		->gather(1);
+    my $user = OpenSRF::AppSession
+        ->create("open-ils.auth")
+        ->request( "open-ils.auth.session.retrieve", $auth_token )
+        ->gather(1);
 
-	if (ref($user) eq 'HASH' && $user->{ilsevent} == 1001) {
-		return undef;
-	}
+    if (ref($user) eq 'HASH' && $user->{ilsevent} == 1001) {
+        return undef;
+    }
 
-	return $user if ref($user);
-	return undef;
+    return $user if ref($user);
+    return undef;
 }
 
 sub oils_login {
         my( $username, $password, $type ) = @_;
 
         $type |= "staff";
-	my $nametype = 'username';
-	$nametype = 'barcode' if ($username =~ /^\d+$/o);
+    my $nametype = 'username';
+    $nametype = 'barcode' if ($username =~ /^\d+$/o);
 
         my $seed = OpenSRF::AppSession
-		->create("open-ils.auth")
-		->request( 'open-ils.auth.authenticate.init', $username )
-		->gather(1);
+        ->create("open-ils.auth")
+        ->request( 'open-ils.auth.authenticate.init', $username )
+        ->gather(1);
 
         return undef unless $seed;
 
         my $response = OpenSRF::AppSession
-		->create("open-ils.auth")
-		->request( 'open-ils.auth.authenticate.complete',
-			{ $nametype => $username, agent => 'authproxy',
-			  password => md5_hex($seed . md5_hex($password)),
-			  type => $type })
-		->gather(1);
+        ->create("open-ils.auth")
+        ->request( 'open-ils.auth.authenticate.complete',
+            { $nametype => $username, agent => 'authproxy',
+              password => md5_hex($seed . md5_hex($password)),
+              type => $type })
+        ->gather(1);
 
         return undef unless $response;
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Redirect.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Redirect.pm
index 01d57f4..d55c01f 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Redirect.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Redirect.pm
@@ -19,12 +19,12 @@ my $lib_ips_hash;
 
 my $bootstrap_config_file;
 sub import {
-	my( $self, $config ) = @_;
-	$bootstrap_config_file = $config;
+    my( $self, $config ) = @_;
+    $bootstrap_config_file = $config;
 }
 
 sub init {
-	OpenSRF::System->bootstrap_client( config_file => $bootstrap_config_file );
+    OpenSRF::System->bootstrap_client( config_file => $bootstrap_config_file );
 }
 
 sub parse_ips_file {
@@ -53,45 +53,45 @@ sub parse_ips_file {
 
 my %org_cache;
 sub handler {
-	my $apache = shift;
+    my $apache = shift;
 
-	my $cgi = CGI->new( $apache );
-	my $port = $cgi->server_port();
-	my $hostname = $cgi->server_name();
+    my $cgi = CGI->new( $apache );
+    my $port = $cgi->server_port();
+    my $hostname = $cgi->server_name();
     my $proto = ($cgi->https) ? 'https' : 'http';
-	my $user_ip = $ENV{REMOTE_ADDR};
+    my $user_ip = $ENV{REMOTE_ADDR};
 
     # Apache config values
-	my $skin = $apache->dir_config('OILSRedirectSkin') || 'default';
-	my $depth = $apache->dir_config('OILSRedirectDepth');
-	my $locale = $apache->dir_config('OILSRedirectLocale') || 'en-US';
+    my $skin = $apache->dir_config('OILSRedirectSkin') || 'default';
+    my $depth = $apache->dir_config('OILSRedirectDepth');
+    my $locale = $apache->dir_config('OILSRedirectLocale') || 'en-US';
     my $use_tt = ($apache->dir_config('OILSRedirectTpac') || '') =~ /true/i;
     my $physical_loc;
 
     $apache->log->debug("Redirector sees client frim $user_ip");
 
     # parse the IP file
-	my ($shortname, $nskin, $nhostname) = redirect_libs($user_ip);
+    my ($shortname, $nskin, $nhostname) = redirect_libs($user_ip);
 
-	if ($shortname) { # we have a config
+    if ($shortname) { # we have a config
 
         # Read any override vars from the ips txt file
-		if ($nskin =~ m/[^\s]/) { $skin = $nskin; }
-		if ($nhostname =~ m/[^\s]/) { $hostname = $nhostname; }
+        if ($nskin =~ m/[^\s]/) { $skin = $nskin; }
+        if ($nhostname =~ m/[^\s]/) { $hostname = $nhostname; }
 
         if($org_cache{$shortname}) {
             $physical_loc = $org_cache{$shortname};
 
         } else {
 
-		    my $session = OpenSRF::AppSession->create("open-ils.actor");
-		    my $org = $session->request(
+            my $session = OpenSRF::AppSession->create("open-ils.actor");
+            my $org = $session->request(
                 'open-ils.actor.org_unit.retrieve_by_shortname',
-			    $shortname)->gather(1);
+                $shortname)->gather(1);
 
             $org_cache{$shortname} = $physical_loc = $org->id if $org;
         }
-	}
+    }
 
     my $url = "$proto://$hostname:$port";
 
@@ -135,14 +135,14 @@ sub handler {
 
     $logger->info("Apache redirecting $user_ip to $url");
     $apache->headers_out->add('Location' => "$url");
-	return Apache2::Const::REDIRECT;
+    return Apache2::Const::REDIRECT;
 }
 
 sub redirect_libs {
-	my $source_ip = new Net::IP (shift) or return 0;
+    my $source_ip = new Net::IP (shift) or return 0;
 
-	# do this the linear way for now...
-	for my $shortname (keys %$lib_ips_hash) {
+    # do this the linear way for now...
+    for my $shortname (keys %$lib_ips_hash) {
 
         for my $block (@{$lib_ips_hash->{$shortname}}) {
 
@@ -155,8 +155,8 @@ sub redirect_libs {
                 }
             }
         }
-	}
-	return 0;
+    }
+    return 0;
 }
 
 1;
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Reporter.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Reporter.pm
index 0c1eca7..882c12d 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Reporter.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Reporter.pm
@@ -31,10 +31,10 @@ my $base_xml;
 #my $base_xml_doc;
 
 sub import {
-	my( $self, $bs_config, $core_xml, @incs ) = @_;
-	$bootstrap = $bs_config;
-	$base_xml = $core_xml;
-	$includes = [ @incs ];
+    my( $self, $bs_config, $core_xml, @incs ) = @_;
+    $bootstrap = $bs_config;
+    $base_xml = $core_xml;
+    $includes = [ @incs ];
 }
 
 
@@ -42,116 +42,116 @@ sub import {
 my $plugin_base = 'OpenILS::Template::Plugin';
 
 sub child_init {
-	OpenSRF::System->bootstrap_client( config_file => $bootstrap );
+    OpenSRF::System->bootstrap_client( config_file => $bootstrap );
 
-	#parse the base xml file
-	#my $parser = XML::LibXML->new;
-	#$parser->expand_xinclude(1);
+    #parse the base xml file
+    #my $parser = XML::LibXML->new;
+    #$parser->expand_xinclude(1);
 
-	#$base_xml_doc = $parser->parse_file($base_xml);
-	return Apache2::Const::OK;
+    #$base_xml_doc = $parser->parse_file($base_xml);
+    return Apache2::Const::OK;
 }
 
 sub handler {
 
-	my $apache = shift;
-	return Apache2::Const::DECLINED if (-e $apache->filename);
+    my $apache = shift;
+    return Apache2::Const::DECLINED if (-e $apache->filename);
 
-	my $cgi = CGI->new;
+    my $cgi = CGI->new;
 
-	my $path = $apache->path_info;
-	(my $ttk = $path) =~ s{^/?([a-zA-Z0-9_]+).*?$}{$1}o;
+    my $path = $apache->path_info;
+    (my $ttk = $path) =~ s{^/?([a-zA-Z0-9_]+).*?$}{$1}o;
 
-	$ttk = $apache->filename unless $ttk;
-	$ttk = "dashboard" unless $ttk;
+    $ttk = $apache->filename unless $ttk;
+    $ttk = "dashboard" unless $ttk;
 
-	$ttk = (split '/', $ttk)[-1];
-	
-	my $user;
+    $ttk = (split '/', $ttk)[-1];
+    
+    my $user;
 
-	# if the user is not logged in via cookie, route them to the login page
-	if(! ($user = verify_login($cgi->cookie("ses"))) ) {
-		$ttk = "login";
-	}
+    # if the user is not logged in via cookie, route them to the login page
+    if(! ($user = verify_login($cgi->cookie("ses"))) ) {
+        $ttk = "login";
+    }
 
 
-	print "Content-type: text/html; charset=utf-8\n\n";
-	#print "Content-type: text/html\n\n";
+    print "Content-type: text/html; charset=utf-8\n\n";
+    #print "Content-type: text/html\n\n";
 
-	_process_template(
-			apache		=> $apache,
-			template		=> "$ttk.ttk",
-			params		=> { 
-				user => $user, 
-				stage_dir => $ttk, 
-				config_xml => $base_xml, 
-				},
-			);
+    _process_template(
+            apache      => $apache,
+            template        => "$ttk.ttk",
+            params      => { 
+                user => $user, 
+                stage_dir => $ttk, 
+                config_xml => $base_xml, 
+                },
+            );
 
-	return Apache2::Const::OK;
+    return Apache2::Const::OK;
 }
 
 
 sub _process_template {
 
-	my %params = @_;
-	my $ttk				= $params{template}		|| return undef;
-	my $apache			= $params{apache}			|| undef;
-	my $param_hash		= $params{params}			|| {};
-	$$param_hash{dtype_xform_map} = $OpenILS::WWW::Reporter::dtype_xform_map;
-	$$param_hash{dtype_xforms} = $OpenILS::WWW::Reporter::dtype_xforms;
-
-	my $template;
-
-	$template = Template->new( { 
-		OUTPUT			=> $apache, 
-		ABSOLUTE		=> 1, 
-		RELATIVE		=> 1,
-		PLUGIN_BASE		=> $plugin_base,
-		INCLUDE_PATH	=> $includes, 
-		PRE_CHOMP		=> 1,
-		POST_CHOMP		=> 1,
-		#LOAD_PERL		=> 1,
-		} 
-	);
-
-	try {
-
-		if( ! $template->process( $ttk, $param_hash ) ) { 
-			warn  "Error Processing Template: " . $template->error();
-			my $err = $template->error();
-			$err =~ s/\n/\<br\/\>/g;
-			warn "Error processing template $ttk\n";	
-			my $string =  "<br><b>Unable to process template:<br/><br/> " . $err . "</b>";
-			print "ERROR: $string";
-			#$template->process( $error_ttk , { error => $string } );
-		}
-
-	} catch Error with {
-		my $e = shift;
-		warn "Error processing template $ttk:  $e - $@ \n";	
-		print "<center><br/><br/><b>Error<br/><br/> $e <br/><br/> $@ </b><br/></center>";
-		return;
-	};
+    my %params = @_;
+    my $ttk             = $params{template}     || return undef;
+    my $apache          = $params{apache}           || undef;
+    my $param_hash      = $params{params}           || {};
+    $$param_hash{dtype_xform_map} = $OpenILS::WWW::Reporter::dtype_xform_map;
+    $$param_hash{dtype_xforms} = $OpenILS::WWW::Reporter::dtype_xforms;
+
+    my $template;
+
+    $template = Template->new( { 
+        OUTPUT          => $apache, 
+        ABSOLUTE        => 1, 
+        RELATIVE        => 1,
+        PLUGIN_BASE     => $plugin_base,
+        INCLUDE_PATH    => $includes, 
+        PRE_CHOMP       => 1,
+        POST_CHOMP      => 1,
+        #LOAD_PERL      => 1,
+        } 
+    );
+
+    try {
+
+        if( ! $template->process( $ttk, $param_hash ) ) { 
+            warn  "Error Processing Template: " . $template->error();
+            my $err = $template->error();
+            $err =~ s/\n/\<br\/\>/g;
+            warn "Error processing template $ttk\n";    
+            my $string =  "<br><b>Unable to process template:<br/><br/> " . $err . "</b>";
+            print "ERROR: $string";
+            #$template->process( $error_ttk , { error => $string } );
+        }
+
+    } catch Error with {
+        my $e = shift;
+        warn "Error processing template $ttk:  $e - $@ \n"; 
+        print "<center><br/><br/><b>Error<br/><br/> $e <br/><br/> $@ </b><br/></center>";
+        return;
+    };
 
 }
 
 # returns the user object if the session is valid, 0 otherwise
 sub verify_login {
-	my $auth_token = shift;
-	return 0 unless $auth_token;
+    my $auth_token = shift;
+    return 0 unless $auth_token;
 
-	my $session = OpenSRF::AppSession->create("open-ils.auth");
-	my $req = $session->request(
-		"open-ils.auth.session.retrieve", $auth_token );
-	my $user = $req->gather(1);
+    my $session = OpenSRF::AppSession->create("open-ils.auth");
+    my $req = $session->request(
+        "open-ils.auth.session.retrieve", $auth_token );
+    my $user = $req->gather(1);
 
-	if (ref($user) eq 'HASH' && $user->{ilsevent} == 1001) {
-		return 0;
-	}
+    if (ref($user) eq 'HASH' && $user->{ilsevent} == 1001) {
+        return 0;
+    }
 
-	return $user if ref($user);
-	return 0;
+    return $user if ref($user);
+    return 0;
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat/Feed.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat/Feed.pm
index d4cd14c..2cb401f 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat/Feed.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat/Feed.pm
@@ -11,211 +11,211 @@ use DateTime::Format::Mail;
 
 
 sub exists {
-	my $class = shift;
-	my $type = shift;
+    my $class = shift;
+    my $type = shift;
 
-	return 1 if UNIVERSAL::can("OpenILS::WWW::SuperCat::Feed::$type" => 'new');
-	return 0;
+    return 1 if UNIVERSAL::can("OpenILS::WWW::SuperCat::Feed::$type" => 'new');
+    return 0;
 }
 
 sub new {
-	my $class = shift;
-	my $type = shift;
-	if ($type) {
-		$class .= '::'.$type;
-		return $class->new;
-	}
-	throw OpenSRF::EX::ERROR ("I need a feed type!") ;
+    my $class = shift;
+    my $type = shift;
+    if ($type) {
+        $class .= '::'.$type;
+        return $class->new;
+    }
+    throw OpenSRF::EX::ERROR ("I need a feed type!") ;
 }
 
 sub build {
-	my $class = shift;
-	my $xml = shift;
-	return undef unless $xml;
+    my $class = shift;
+    my $xml = shift;
+    return undef unless $xml;
 
-	$parser = new XML::LibXML if (!$parser);
+    $parser = new XML::LibXML if (!$parser);
 
-	my $self = { doc => $parser->parse_string($xml), items => [] };
+    my $self = { doc => $parser->parse_string($xml), items => [] };
 
-	$self = bless $self => $class;
-	$self->{count} = 0;
-	return $self;
+    $self = bless $self => $class;
+    $self->{count} = 0;
+    return $self;
 }
 
 sub type {
-	my $self = shift;
-	my $type = shift;
-	$self->{type} = $type if ($type);
-	return $self->{type};
+    my $self = shift;
+    my $type = shift;
+    $self->{type} = $type if ($type);
+    return $self->{type};
 }
 
 sub count {
-	my $self = shift;
-	return $self->{count};
+    my $self = shift;
+    return $self->{count};
 }
 
 sub search {
-	my $self = shift;
-	my $search = shift;
-	$self->{search} = $search if ($search);
-	return $self->{search};
+    my $self = shift;
+    my $search = shift;
+    $self->{search} = $search if ($search);
+    return $self->{search};
 }
 
 sub class {
-	my $self = shift;
-	my $search = shift;
-	$self->{class} = $search if ($search);
-	return $self->{class};
+    my $self = shift;
+    my $search = shift;
+    $self->{class} = $search if ($search);
+    return $self->{class};
 }
 
 sub Sort {
-	my $self = shift;
-	my $search = shift;
-	$self->{sort} = $search if ($search);
-	return $self->{sort};
+    my $self = shift;
+    my $search = shift;
+    $self->{sort} = $search if ($search);
+    return $self->{sort};
 }
 
 sub SortDir {
-	my $self = shift;
-	my $search = shift;
-	$self->{sort_dir} = $search if ($search);
-	return $self->{sort_dir};
+    my $self = shift;
+    my $search = shift;
+    $self->{sort_dir} = $search if ($search);
+    return $self->{sort_dir};
 }
 
 sub lang {
-	my $self = shift;
-	my $search = shift;
-	$self->{lang} = $search if ($search);
-	return $self->{lang};
+    my $self = shift;
+    my $search = shift;
+    $self->{lang} = $search if ($search);
+    return $self->{lang};
 }
 
 sub lib {
-	my $self = shift;
-	my $lib = shift;
-	$self->{lib} = $lib if ($lib);
-	return $self->{lib};
+    my $self = shift;
+    my $lib = shift;
+    $self->{lib} = $lib if ($lib);
+    return $self->{lib};
 }
 
 sub base {
-	my $self = shift;
-	my $base = shift;
-	$self->{base} = $base if ($base);
-	return $self->{base};
+    my $self = shift;
+    my $base = shift;
+    $self->{base} = $base if ($base);
+    return $self->{base};
 }
 
 sub root {
-	my $self = shift;
-	my $root = shift;
-	$self->{root} = $root if ($root);
-	return $self->{root};
+    my $self = shift;
+    my $root = shift;
+    $self->{root} = $root if ($root);
+    return $self->{root};
 }
 
 sub unapi {
-	my $self = shift;
-	my $unapi = shift;
-	$self->{unapi} = $unapi if ($unapi);
-	return $self->{unapi};
+    my $self = shift;
+    my $unapi = shift;
+    $self->{unapi} = $unapi if ($unapi);
+    return $self->{unapi};
 }
 
 sub push_item {
-	my $self = shift;
-	$self->{count} += scalar(@_);
-	push @{ $self->{items} }, @_;
+    my $self = shift;
+    $self->{count} += scalar(@_);
+    push @{ $self->{items} }, @_;
 }
 
 sub items {
-	my $self = shift;
-	return @{ $self->{items} } if (wantarray);
-	return $self->{items};
+    my $self = shift;
+    return @{ $self->{items} } if (wantarray);
+    return $self->{items};
 }
 
 sub _add_node {
-	my $self = shift;
+    my $self = shift;
 
-	my $xpath = shift;
-	my $new = shift;
+    my $xpath = shift;
+    my $new = shift;
 
-	for my $node ($self->{doc}->findnodes($xpath)) {
-		$node->appendChild($new);
-		last;
-	}
+    for my $node ($self->{doc}->findnodes($xpath)) {
+        $node->appendChild($new);
+        last;
+    }
 }
 
 sub _create_node {
-	my $self = shift;
+    my $self = shift;
 
-	my $xpath = shift;
-	my $ns = shift;
-	my $name = shift;
-	my $text = shift;
-	my $attrs = shift;
+    my $xpath = shift;
+    my $ns = shift;
+    my $name = shift;
+    my $text = shift;
+    my $attrs = shift;
 
-	for my $node ($self->{doc}->findnodes($xpath)) {
-		my $new = $self->{doc}->createElement($name) if (!$ns);
-		$new = $self->{doc}->createElementNS($ns,$name) if ($ns);
+    for my $node ($self->{doc}->findnodes($xpath)) {
+        my $new = $self->{doc}->createElement($name) if (!$ns);
+        $new = $self->{doc}->createElementNS($ns,$name) if ($ns);
 
-		$new->appendChild( $self->{doc}->createTextNode( $text ) )
-			if (defined $text);
+        $new->appendChild( $self->{doc}->createTextNode( $text ) )
+            if (defined $text);
 
-		if (ref($attrs)) {
-			for my $key (keys %$attrs) {
-				next unless $$attrs{$key};
-				$new->setAttribute( $key => $$attrs{$key} );
-			}
-		}
+        if (ref($attrs)) {
+            for my $key (keys %$attrs) {
+                next unless $$attrs{$key};
+                $new->setAttribute( $key => $$attrs{$key} );
+            }
+        }
 
-		$node->appendChild( $new );
+        $node->appendChild( $new );
 
-		return $new;
-	}
+        return $new;
+    }
 }
 
 sub add_item {
-	my $self = shift;
-	my $class = ref($self) || $self;
-	$class .= '::item';
+    my $self = shift;
+    my $class = ref($self) || $self;
+    $class .= '::item';
 
-	my $item_xml = shift;
-	my $entry = $class->new($item_xml);
-	return undef unless $entry;
+    my $item_xml = shift;
+    my $entry = $class->new($item_xml);
+    return undef unless $entry;
 
-	$entry->base($self->base);
-	$entry->unapi($self->unapi);
+    $entry->base($self->base);
+    $entry->unapi($self->unapi);
 
-	$self->push_item($entry);
-	return $entry;
+    $self->push_item($entry);
+    return $entry;
 }
 
 sub add_holdings {
-	my $self = shift;
-	my $holdings_xml = shift;
+    my $self = shift;
+    my $holdings_xml = shift;
 
-	return $self unless ($holdings_xml);
+    return $self unless ($holdings_xml);
 
-	$parser = new XML::LibXML if (!$parser);
-	my $new_doc = $parser->parse_string($holdings_xml);
+    $parser = new XML::LibXML if (!$parser);
+    my $new_doc = $parser->parse_string($holdings_xml);
 
-	for my $root ( $self->{doc}->findnodes($self->{holdings_xpath}) ) {
-		$root->appendChild($new_doc->documentElement);
-		last;
-	}
-	return $self;
+    for my $root ( $self->{doc}->findnodes($self->{holdings_xpath}) ) {
+        $root->appendChild($new_doc->documentElement);
+        last;
+    }
+    return $self;
 }
 
 sub composeDoc {
-	my $self = shift;
-	for my $root ( $self->{doc}->findnodes($self->{item_xpath}) ) {
-		for my $item ( $self->items ) {
-			$root->appendChild( $item->{doc}->documentElement );
-		}
-		last;
-	}
+    my $self = shift;
+    for my $root ( $self->{doc}->findnodes($self->{item_xpath}) ) {
+        for my $item ( $self->items ) {
+            $root->appendChild( $item->{doc}->documentElement );
+        }
+        last;
+    }
 }
 
 sub toString {
-	my $self = shift;
-	$self->composeDoc;
-	return $self->{doc}->toString(1);
+    my $self = shift;
+    $self->composeDoc;
+    return $self->{doc}->toString(1);
 }
 
 sub id {};
@@ -232,77 +232,77 @@ use base 'OpenILS::WWW::SuperCat::Feed';
 use OpenSRF::Utils qw/:datetime/;
 
 sub new {
-	my $class = shift;
-	my $self = $class->SUPER::build('<feed xmlns:atom="http://www.w3.org/2005/Atom"/>');
-	$self->{doc}->documentElement->setNamespace('http://www.w3.org/2005/Atom', undef);
-	$self->{doc}->documentElement->setNamespace('http://www.w3.org/2005/Atom', 'atom');
-	$self->{type} = 'application/atom+xml';
-	$self->{item_xpath} = '/atom:feed';
-	return $self;
+    my $class = shift;
+    my $self = $class->SUPER::build('<feed xmlns:atom="http://www.w3.org/2005/Atom"/>');
+    $self->{doc}->documentElement->setNamespace('http://www.w3.org/2005/Atom', undef);
+    $self->{doc}->documentElement->setNamespace('http://www.w3.org/2005/Atom', 'atom');
+    $self->{type} = 'application/atom+xml';
+    $self->{item_xpath} = '/atom:feed';
+    return $self;
 }
 
 sub title {
-	my $self = shift;
-	my $text = shift;
-	$self->_create_node('/atom:feed','http://www.w3.org/2005/Atom','title', $text);
+    my $self = shift;
+    my $text = shift;
+    $self->_create_node('/atom:feed','http://www.w3.org/2005/Atom','title', $text);
 }
 
 sub update_ts {
-	my $self = shift;
-	# ATOM demands RFC-3339 compliant datetime formats
-	my $text = shift || gmtime_ISO8601();
-	$self->_create_node($self->{item_xpath},'http://www.w3.org/2005/Atom','updated', $text);
+    my $self = shift;
+    # ATOM demands RFC-3339 compliant datetime formats
+    my $text = shift || gmtime_ISO8601();
+    $self->_create_node($self->{item_xpath},'http://www.w3.org/2005/Atom','updated', $text);
 }
 
 sub creator {
-	my $self = shift;
-	my $text = shift;
-	$self->_create_node('/atom:feed','http://www.w3.org/2005/Atom','author');
-	$self->_create_node('/atom:feed/atom:author', 'http://www.w3.org/2005/Atom','name', $text);
+    my $self = shift;
+    my $text = shift;
+    $self->_create_node('/atom:feed','http://www.w3.org/2005/Atom','author');
+    $self->_create_node('/atom:feed/atom:author', 'http://www.w3.org/2005/Atom','name', $text);
 }
 
 sub link {
-	my $self = shift;
-	my $type = shift;
-	my $id = shift;
-	my $mime = shift || "application/x-$type+xml";
-	my $title = shift;
-
-	$type = 'self' if ($type eq 'atom');
-
-	$self->_create_node(
-		$self->{item_xpath},
-		'http://www.w3.org/2005/Atom',
-		'link',
-		undef,
-		{ rel => $type,
-		  href => $id,
-		  title => $title,
-		  type => $mime,
-		}
-	);
+    my $self = shift;
+    my $type = shift;
+    my $id = shift;
+    my $mime = shift || "application/x-$type+xml";
+    my $title = shift;
+
+    $type = 'self' if ($type eq 'atom');
+
+    $self->_create_node(
+        $self->{item_xpath},
+        'http://www.w3.org/2005/Atom',
+        'link',
+        undef,
+        { rel => $type,
+          href => $id,
+          title => $title,
+          type => $mime,
+        }
+    );
 }
 
 sub id {
-	my $self = shift;
-	my $id = shift;
+    my $self = shift;
+    my $id = shift;
 
-	$self->_create_node( $self->{item_xpath}, 'http://www.w3.org/2005/Atom', 'id', $id );
+    $self->_create_node( $self->{item_xpath}, 'http://www.w3.org/2005/Atom', 'id', $id );
 }
 
 package OpenILS::WWW::SuperCat::Feed::atom::item;
 use base 'OpenILS::WWW::SuperCat::Feed::atom';
 
 sub new {
-	my $class = shift;
-	my $xml = shift;
-	my $self = $class->SUPER::build($xml);
-	$self->{doc}->documentElement->setNamespace('http://www.w3.org/2005/Atom', undef);
-	$self->{doc}->documentElement->setNamespace('http://www.w3.org/2005/Atom', 'atom');
-	$self->{item_xpath} = '/atom:entry';
-	$self->{holdings_xpath} = '/atom:entry';
-	$self->{type} = 'application/atom+xml';
-	return $self;
+    my $class = shift;
+    my $xml = shift;
+    my $self = $class->SUPER::build($xml);
+    $self->{doc}->documentElement->setNamespace('http://www.w3.org/2005/Atom', undef);
+    $self->{doc}->documentElement->setNamespace('http://www.w3.org/2005/Atom', 'atom');
+    $self->{item_xpath} = '/atom:entry';
+    $self->{holdings_xpath} = '/atom:entry';
+    $self->{type} = 'application/atom+xml';
+    return $self;
 }
 
 
@@ -312,115 +312,115 @@ package OpenILS::WWW::SuperCat::Feed::rss2;
 use base 'OpenILS::WWW::SuperCat::Feed';
 
 sub new {
-	my $class = shift;
-	my $self = $class->SUPER::build('<rss version="2.0"><channel/></rss>');
-	$self->{type} = 'application/rss+xml';
-	$self->{item_xpath} = '/rss/channel';
-	return $self;
+    my $class = shift;
+    my $self = $class->SUPER::build('<rss version="2.0"><channel/></rss>');
+    $self->{type} = 'application/rss+xml';
+    $self->{item_xpath} = '/rss/channel';
+    return $self;
 }
 
 sub title {
-	my $self = shift;
-	my $text = shift;
-	$self->_create_node('/rss/channel',undef,'title', $text);
+    my $self = shift;
+    my $text = shift;
+    $self->_create_node('/rss/channel',undef,'title', $text);
 }
 
 sub description {
-	my $self = shift;
-	my $text = shift;
-	$self->_create_node('/rss/channel',undef,'description', $text);
+    my $self = shift;
+    my $text = shift;
+    $self->_create_node('/rss/channel',undef,'description', $text);
 }
 
 sub update_ts {
-	my $self = shift;
-	# RSS2 demands RFC-822 compliant datetime formats
-	my $text = shift || DateTime::Format::Mail->format_datetime(DateTime->now());
-	$self->_create_node($self->{item_xpath},undef,'lastBuildDate', $text);
+    my $self = shift;
+    # RSS2 demands RFC-822 compliant datetime formats
+    my $text = shift || DateTime::Format::Mail->format_datetime(DateTime->now());
+    $self->_create_node($self->{item_xpath},undef,'lastBuildDate', $text);
 }
 
 sub creator {
-	my $self = shift;
-	my $text = shift;
-	$self->_create_node('/rss/channel', undef,'generator', $text);
+    my $self = shift;
+    my $text = shift;
+    $self->_create_node('/rss/channel', undef,'generator', $text);
 }
 
 sub link {
-	my $self = shift;
-	my $type = shift;
-	my $id = shift;
-	my $mime = shift || "application/x-$type+xml";
-
-	if ($type eq 'rss2' or $type eq 'alternate') {
-		# Just link to ourself using standard RSS2 link element
-		$self->_create_node(
-			$self->{item_xpath},
-			undef,
-			'link',
-			$id,
-			undef
-		);
-	} else {
-		# Alternate link: use XHTML link element
-		$self->_create_node(
-			$self->{item_xpath},
-			'http://www.w3.org/1999/xhtml',
-			'xhtml:link',
-			$id,
-			{ rel => $type,
-			  type => $mime,
-			}
-		);
-	}
+    my $self = shift;
+    my $type = shift;
+    my $id = shift;
+    my $mime = shift || "application/x-$type+xml";
+
+    if ($type eq 'rss2' or $type eq 'alternate') {
+        # Just link to ourself using standard RSS2 link element
+        $self->_create_node(
+            $self->{item_xpath},
+            undef,
+            'link',
+            $id,
+            undef
+        );
+    } else {
+        # Alternate link: use XHTML link element
+        $self->_create_node(
+            $self->{item_xpath},
+            'http://www.w3.org/1999/xhtml',
+            'xhtml:link',
+            $id,
+            { rel => $type,
+              type => $mime,
+            }
+        );
+    }
 }
 
 sub id {
-	my $self = shift;
-	my $id = shift;
+    my $self = shift;
+    my $id = shift;
 
-	$self->_create_node($self->{item_xpath}, undef,'guid', $id);
+    $self->_create_node($self->{item_xpath}, undef,'guid', $id);
 }
 
 package OpenILS::WWW::SuperCat::Feed::rss2::item;
 use base 'OpenILS::WWW::SuperCat::Feed::rss2';
 
 sub new {
-	my $class = shift;
-	my $xml = shift;
-	my $self = $class->SUPER::build($xml);
-	$self->{type} = 'application/rss+xml';
-	$self->{item_xpath} = '/item';
-	$self->{holdings_xpath} = '/item';
-	return $self;
+    my $class = shift;
+    my $xml = shift;
+    my $self = $class->SUPER::build($xml);
+    $self->{type} = 'application/rss+xml';
+    $self->{item_xpath} = '/item';
+    $self->{holdings_xpath} = '/item';
+    return $self;
 }
 
 sub update_ts {
-	my $self = shift;
-	# RSS2 demands RFC-822 compliant datetime formats
-	my $text = shift;
-	if (!$text) {
-		# No date passed in, default to now
-		$text = DateTime::Format::Mail->format_datetime(DateTime->now());
-	} elsif ($text =~ m/^\s*(\d{4})\.?\s*$/o) {
-		# Publication date is just a year, convert accordingly
-		my $year = DateTime->new(year=>$1);
-		$text = DateTime::Format::Mail->format_datetime($year);
-	}
-	$self->_create_node($self->{item_xpath},undef,'pubDate', $text);
+    my $self = shift;
+    # RSS2 demands RFC-822 compliant datetime formats
+    my $text = shift;
+    if (!$text) {
+        # No date passed in, default to now
+        $text = DateTime::Format::Mail->format_datetime(DateTime->now());
+    } elsif ($text =~ m/^\s*(\d{4})\.?\s*$/o) {
+        # Publication date is just a year, convert accordingly
+        my $year = DateTime->new(year=>$1);
+        $text = DateTime::Format::Mail->format_datetime($year);
+    }
+    $self->_create_node($self->{item_xpath},undef,'pubDate', $text);
 }
 
 sub id {
-	my $self = shift;
-	my $id = shift;
+    my $self = shift;
+    my $id = shift;
 
-	$self->_create_node(
-		$self->{item_xpath},
-		undef,
-		'guid',
-		$id,
-		{
-			isPermaLink=>"false"
-		}
-	);
+    $self->_create_node(
+        $self->{item_xpath},
+        undef,
+        'guid',
+        $id,
+        {
+            isPermaLink=>"false"
+        }
+    );
 }
 
 #----------------------------------------------------------
@@ -429,50 +429,50 @@ package OpenILS::WWW::SuperCat::Feed::mods;
 use base 'OpenILS::WWW::SuperCat::Feed';
 
 sub new {
-	my $class = shift;
-	my $self = $class->SUPER::build('<modsCollection version="3.0" xmlns="http://www.loc.gov/mods/" xmlns:mods="http://www.loc.gov/mods/"/>');
-	$self->{type} = 'application/xml';
-	$self->{item_xpath} = '/mods:modsCollection';
-	return $self;
+    my $class = shift;
+    my $self = $class->SUPER::build('<modsCollection version="3.0" xmlns="http://www.loc.gov/mods/" xmlns:mods="http://www.loc.gov/mods/"/>');
+    $self->{type} = 'application/xml';
+    $self->{item_xpath} = '/mods:modsCollection';
+    return $self;
 }
 
 package OpenILS::WWW::SuperCat::Feed::mods::item;
 use base 'OpenILS::WWW::SuperCat::Feed::mods';
 
 sub new {
-	my $class = shift;
-	my $xml = shift;
-	my $self = $class->SUPER::build($xml);
-	$self->{doc}->documentElement->setNamespace('http://www.loc.gov/mods/', 'mods');
-	$self->{doc}->documentElement->setNamespace('http://www.loc.gov/mods/', undef, 1);
-	$self->{type} = 'application/xml';
-	$self->{holdings_xpath} = '/mods:mods';
-	return $self;
+    my $class = shift;
+    my $xml = shift;
+    my $self = $class->SUPER::build($xml);
+    $self->{doc}->documentElement->setNamespace('http://www.loc.gov/mods/', 'mods');
+    $self->{doc}->documentElement->setNamespace('http://www.loc.gov/mods/', undef, 1);
+    $self->{type} = 'application/xml';
+    $self->{holdings_xpath} = '/mods:mods';
+    return $self;
 }
 
 my $linkid = 1;
 
 sub link {
-	my $self = shift;
-	my $type = shift;
-	my $id = shift;
+    my $self = shift;
+    my $type = shift;
+    my $id = shift;
 
-	if ($type eq 'unapi' || $type eq 'opac') {
-		$self->_create_node(
-			'mods:mods',
+    if ($type eq 'unapi' || $type eq 'opac') {
+        $self->_create_node(
+            'mods:mods',
             undef,
-			'relatedItem',
-			undef,
-			{ type => 'otherFormat', id => 'link-'.$linkid }
-		);
-		$self->_create_node(
-			"mods:mods/relatedItem[\@id='link-$linkid']",
+            'relatedItem',
             undef,
-			'recordIdentifier',
-			$id
-		);
-		$linkid++;
-	}
+            { type => 'otherFormat', id => 'link-'.$linkid }
+        );
+        $self->_create_node(
+            "mods:mods/relatedItem[\@id='link-$linkid']",
+            undef,
+            'recordIdentifier',
+            $id
+        );
+        $linkid++;
+    }
 }
 
 #----------------------------------------------------------
@@ -481,48 +481,48 @@ package OpenILS::WWW::SuperCat::Feed::mods3;
 use base 'OpenILS::WWW::SuperCat::Feed::mods';
 
 sub new {
-	my $class = shift;
-	my $self = $class->SUPER::build('<modsCollection version="3.0" xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3"/>');
-	$self->{type} = 'application/xml';
-	$self->{item_xpath} = '/mods:modsCollection';
-	return $self;
+    my $class = shift;
+    my $self = $class->SUPER::build('<modsCollection version="3.0" xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3"/>');
+    $self->{type} = 'application/xml';
+    $self->{item_xpath} = '/mods:modsCollection';
+    return $self;
 }
 
 package OpenILS::WWW::SuperCat::Feed::mods3::item;
 use base 'OpenILS::WWW::SuperCat::Feed::mods::item';
 
 sub new {
-	my $class = shift;
-	my $xml = shift;
-	my $self = $class->SUPER::build($xml);
-	$self->{doc}->documentElement->setNamespace('http://www.loc.gov/mods/v3', 'mods');
-	$self->{doc}->documentElement->setNamespace('http://www.loc.gov/mods/v3', undef, 1);
-	$self->{type} = 'application/xml';
-	$self->{holdings_xpath} = '/mods:mods';
-	return $self;
+    my $class = shift;
+    my $xml = shift;
+    my $self = $class->SUPER::build($xml);
+    $self->{doc}->documentElement->setNamespace('http://www.loc.gov/mods/v3', 'mods');
+    $self->{doc}->documentElement->setNamespace('http://www.loc.gov/mods/v3', undef, 1);
+    $self->{type} = 'application/xml';
+    $self->{holdings_xpath} = '/mods:mods';
+    return $self;
 }
 
 sub link {
-	my $self = shift;
-	my $type = shift;
-	my $id = shift;
-
-	if ($type eq 'unapi' || $type eq 'opac') {
-		$self->_create_node(
-			'mods:mods',
-			undef,
-			'relatedItem',
-			undef,
-			{ type => 'otherFormat', id => 'link-'.$linkid }
-		);
-		$self->_create_node(
-			"mods:mods/relatedItem[\@id='link-$linkid']",
-			undef,
-			'recordIdentifier',
-			$id
-		);
-		$linkid++;
-	}
+    my $self = shift;
+    my $type = shift;
+    my $id = shift;
+
+    if ($type eq 'unapi' || $type eq 'opac') {
+        $self->_create_node(
+            'mods:mods',
+            undef,
+            'relatedItem',
+            undef,
+            { type => 'otherFormat', id => 'link-'.$linkid }
+        );
+        $self->_create_node(
+            "mods:mods/relatedItem[\@id='link-$linkid']",
+            undef,
+            'recordIdentifier',
+            $id
+        );
+        $linkid++;
+    }
 }
 
 
@@ -532,11 +532,11 @@ package OpenILS::WWW::SuperCat::Feed::mods32;
 use base 'OpenILS::WWW::SuperCat::Feed::mods3';
 
 sub new {
-	my $class = shift;
-	my $self = $class->SUPER::build('<modsCollection version="3.2" xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3"/>');
-	$self->{type} = 'application/xml';
-	$self->{item_xpath} = '/mods:modsCollection';
-	return $self;
+    my $class = shift;
+    my $self = $class->SUPER::build('<modsCollection version="3.2" xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3"/>');
+    $self->{type} = 'application/xml';
+    $self->{item_xpath} = '/mods:modsCollection';
+    return $self;
 }
 
 package OpenILS::WWW::SuperCat::Feed::mods32::item;
@@ -548,11 +548,11 @@ package OpenILS::WWW::SuperCat::Feed::mods33;
 use base 'OpenILS::WWW::SuperCat::Feed::mods3';
 
 sub new {
-	my $class = shift;
-	my $self = $class->SUPER::build('<modsCollection version="3.3" xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3"/>');
-	$self->{type} = 'application/xml';
-	$self->{item_xpath} = '/mods:modsCollection';
-	return $self;
+    my $class = shift;
+    my $self = $class->SUPER::build('<modsCollection version="3.3" xmlns="http://www.loc.gov/mods/v3" xmlns:mods="http://www.loc.gov/mods/v3"/>');
+    $self->{type} = 'application/xml';
+    $self->{item_xpath} = '/mods:modsCollection';
+    return $self;
 }
 
 package OpenILS::WWW::SuperCat::Feed::mods33::item;
@@ -565,27 +565,27 @@ package OpenILS::WWW::SuperCat::Feed::marcxml;
 use base 'OpenILS::WWW::SuperCat::Feed';
 
 sub new {
-	my $class = shift;
-	my $self = $class->SUPER::build('<collection xmlns="http://www.loc.gov/MARC21/slim" xmlns:marc="http://www.loc.gov/MARC21/slim"/>');
-	$self->{type} = 'application/xml';
-	$self->{item_xpath} = '/marc:collection';
-	return $self;
+    my $class = shift;
+    my $self = $class->SUPER::build('<collection xmlns="http://www.loc.gov/MARC21/slim" xmlns:marc="http://www.loc.gov/MARC21/slim"/>');
+    $self->{type} = 'application/xml';
+    $self->{item_xpath} = '/marc:collection';
+    return $self;
 }
 sub link {
-	my $self = shift;
-	my $type = shift;
-	my $id = shift;
-
-	if ($type eq 'unapi') {
-		$self->_create_node(
-			'marc:collection',
-			'http://www.w3.org/1999/xhtml',
-			'xhtml:link',
-			undef,
-			{ rel => 'unapi-server', href => $id, title => "unapi" }
-		);
-		$linkid++;
-	}
+    my $self = shift;
+    my $type = shift;
+    my $id = shift;
+
+    if ($type eq 'unapi') {
+        $self->_create_node(
+            'marc:collection',
+            'http://www.w3.org/1999/xhtml',
+            'xhtml:link',
+            undef,
+            { rel => 'unapi-server', href => $id, title => "unapi" }
+        );
+        $linkid++;
+    }
 }
 
 
@@ -593,40 +593,40 @@ package OpenILS::WWW::SuperCat::Feed::marcxml::item;
 use base 'OpenILS::WWW::SuperCat::Feed::marcxml';
 
 sub new {
-	my $class = shift;
-	my $xml = shift;
-	my $self = $class->SUPER::build($xml);
-	return undef unless $self;
-	$self->{doc}->documentElement->setNamespace('http://www.loc.gov/MARC21/slim', undef);
-	$self->{type} = 'application/xml';
-	$self->{holdings_xpath} = '/*[local-name()="record"]';
-	return $self;
+    my $class = shift;
+    my $xml = shift;
+    my $self = $class->SUPER::build($xml);
+    return undef unless $self;
+    $self->{doc}->documentElement->setNamespace('http://www.loc.gov/MARC21/slim', undef);
+    $self->{type} = 'application/xml';
+    $self->{holdings_xpath} = '/*[local-name()="record"]';
+    return $self;
 }
 
 sub link {
-	my $self = shift;
-	my $type = shift;
-	my $id = shift;
-
-	if ($type eq 'opac') {
-		$self->_create_node(
-			'*[local-name()="record"]',
-			'http://www.w3.org/1999/xhtml',
-			'xhtml:link',
-			undef,
-			{ rel => 'otherFormat', href => $id, title => "Dynamic Details" }
-		);
-		$linkid++;
-	} elsif ($type eq 'unapi-id') {
-		$self->_create_node(
-			'*[local-name()="record"]',
-			'http://www.w3.org/1999/xhtml',
-			'xhtml:abbr',
-			undef,
-			{  title => $id, class => "unapi-id" }
-		);
-		$linkid++;
-	}
+    my $self = shift;
+    my $type = shift;
+    my $id = shift;
+
+    if ($type eq 'opac') {
+        $self->_create_node(
+            '*[local-name()="record"]',
+            'http://www.w3.org/1999/xhtml',
+            'xhtml:link',
+            undef,
+            { rel => 'otherFormat', href => $id, title => "Dynamic Details" }
+        );
+        $linkid++;
+    } elsif ($type eq 'unapi-id') {
+        $self->_create_node(
+            '*[local-name()="record"]',
+            'http://www.w3.org/1999/xhtml',
+            'xhtml:abbr',
+            undef,
+            {  title => $id, class => "unapi-id" }
+        );
+        $linkid++;
+    }
 }
 
 
@@ -636,45 +636,45 @@ package OpenILS::WWW::SuperCat::Feed::html;
 use base 'OpenILS::WWW::SuperCat::Feed::atom';
 
 sub new {
-	my $class = shift;
-	my $self = $class->SUPER::new;
-	$self->type('text/html');
-	return $self;
+    my $class = shift;
+    my $self = $class->SUPER::new;
+    $self->type('text/html');
+    return $self;
 }
 
 our ($_parser, $_xslt, $xslt_file);
 
 sub toString {
-	my $self = shift;
-	my $base = $self->base || '';
-	my $root = $self->root || '';
-	my $search = $self->search || '';
-	my $class = $self->class || '';
-	my $lib = $self->lib || '-';
+    my $self = shift;
+    my $base = $self->base || '';
+    my $root = $self->root || '';
+    my $search = $self->search || '';
+    my $class = $self->class || '';
+    my $lib = $self->lib || '-';
 
-	$self->composeDoc;
+    $self->composeDoc;
 
         $_parser ||= new XML::LibXML;
         $_xslt ||= new XML::LibXSLT;
 
-	$xslt_file ||=
+    $xslt_file ||=
                 OpenSRF::Utils::SettingsClient
-       	                ->new
-               	        ->config_value( dirs => 'xsl' ).
+                        ->new
+                        ->config_value( dirs => 'xsl' ).
                 "/ATOM2XHTML.xsl";
 
         # parse the MODS xslt ...
         my $atom2html_xslt = $_xslt->parse_stylesheet( $_parser->parse_file($xslt_file) );
 
-	my $new_doc = $atom2html_xslt->transform(
-		$self->{doc},
-		base_dir => "'$root'",
-		lib => "'$lib'",
-		searchTerms => "'$search'",
-		searchClass => "'$class'",
-	);
+    my $new_doc = $atom2html_xslt->transform(
+        $self->{doc},
+        base_dir => "'$root'",
+        lib => "'$lib'",
+        searchTerms => "'$search'",
+        searchClass => "'$class'",
+    );
 
-	return $new_doc->toString(1); 
+    return $new_doc->toString(1); 
 }
 
 
@@ -687,49 +687,49 @@ package OpenILS::WWW::SuperCat::Feed::htmlcard;
 use base 'OpenILS::WWW::SuperCat::Feed::marcxml';
 
 sub new {
-	my $class = shift;
-	my $self = $class->SUPER::new;
-	$self->type('text/html');
-	$self->{xsl} = "/MARC21slim2HTMLCard.xsl";
-	return $self;
+    my $class = shift;
+    my $self = $class->SUPER::new;
+    $self->type('text/html');
+    $self->{xsl} = "/MARC21slim2HTMLCard.xsl";
+    return $self;
 }
 
 our ($_parser, $_xslt, $xslt_file);
 
 sub toString {
-	my $self = shift;
-	my $base = $self->base || '';
-	my $root = $self->root || '';
-	my $search = $self->search || '';
-	my $sort = $self->Sort || '';
-	my $sort_dir = $self->SortDir || '';
-	my $lang = $self->lang || '';
-	my $lib = $self->lib || '-';
+    my $self = shift;
+    my $base = $self->base || '';
+    my $root = $self->root || '';
+    my $search = $self->search || '';
+    my $sort = $self->Sort || '';
+    my $sort_dir = $self->SortDir || '';
+    my $lang = $self->lang || '';
+    my $lib = $self->lib || '-';
 
-	$self->composeDoc;
+    $self->composeDoc;
 
         $_parser ||= new XML::LibXML;
         $_xslt ||= new XML::LibXSLT;
 
-	$xslt_file =
+    $xslt_file =
                 OpenSRF::Utils::SettingsClient
-       	                ->new
-               	        ->config_value( dirs => 'xsl' ).$self->{xsl};
+                        ->new
+                        ->config_value( dirs => 'xsl' ).$self->{xsl};
 
         # parse the MODS xslt ...
         my $atom2html_xslt = $_xslt->parse_stylesheet( $_parser->parse_file($xslt_file) );
 
-	my $new_doc = $atom2html_xslt->transform(
-		$self->{doc},
-		base_dir => "'$root'",
-		lib => "'$lib'",
-		searchTerms => "'$search'",
-		searchSort => "'$sort'",
-		searchSortDir => "'$sort_dir'",
-		searchLang => "'$lang'",
-	);
+    my $new_doc = $atom2html_xslt->transform(
+        $self->{doc},
+        base_dir => "'$root'",
+        lib => "'$lib'",
+        searchTerms => "'$search'",
+        searchSort => "'$sort'",
+        searchSortDir => "'$sort_dir'",
+        searchLang => "'$lang'",
+    );
 
-	return $new_doc->toString(1); 
+    return $new_doc->toString(1); 
 }
 
 package OpenILS::WWW::SuperCat::Feed::htmlcard::item;
@@ -739,10 +739,10 @@ package OpenILS::WWW::SuperCat::Feed::htmlholdings;
 use base 'OpenILS::WWW::SuperCat::Feed::htmlcard';
 
 sub new {
-	my $class = shift;
-	my $self = $class->SUPER::new;
-	$self->{xsl} = "/MARC21slim2HTMLCard-holdings.xsl";
-	return $self;
+    my $class = shift;
+    my $self = $class->SUPER::new;
+    $self->{xsl} = "/MARC21slim2HTMLCard-holdings.xsl";
+    return $self;
 }
 
 package OpenILS::WWW::SuperCat::Feed::htmlholdings::item;
@@ -753,47 +753,47 @@ package OpenILS::WWW::SuperCat::Feed::marctxt;
 use base 'OpenILS::WWW::SuperCat::Feed::marcxml';
 
 sub new {
-	my $class = shift;
-	my $self = $class->SUPER::new;
-	$self->{type} = 'text/plain';
-	$self->{xsl} = "/MARC21slim2MARCtxt.xsl";
-	return $self;
+    my $class = shift;
+    my $self = $class->SUPER::new;
+    $self->{type} = 'text/plain';
+    $self->{xsl} = "/MARC21slim2MARCtxt.xsl";
+    return $self;
 }
 
 
 our ($_parser, $_xslt, $xslt_file);
 
 sub toString {
-	my $self = shift;
-	my $base = $self->base || '';
-	my $root = $self->root || '';
-	my $search = $self->search || '';
-	my $class = $self->class || '';
-	my $lib = $self->lib || '-';
+    my $self = shift;
+    my $base = $self->base || '';
+    my $root = $self->root || '';
+    my $search = $self->search || '';
+    my $class = $self->class || '';
+    my $lib = $self->lib || '-';
 
-	$self->composeDoc;
+    $self->composeDoc;
 
         $_parser ||= new XML::LibXML;
         $_xslt ||= new XML::LibXSLT;
 
-	$xslt_file ||=
+    $xslt_file ||=
                 OpenSRF::Utils::SettingsClient
-       	                ->new
-               	        ->config_value( dirs => 'xsl' ).
+                        ->new
+                        ->config_value( dirs => 'xsl' ).
                 $self->{xsl};
 
         # parse the MARC text xslt ...
         my $marctxt_xslt = $_xslt->parse_stylesheet( $_parser->parse_file($xslt_file) );
 
-	my $new_doc = $marctxt_xslt->transform(
-		$self->{doc},
-		base_dir => "'$root'",
-		lib => "'$lib'",
-		searchTerms => "'$search'",
-		searchClass => "'$class'",
-	);
+    my $new_doc = $marctxt_xslt->transform(
+        $self->{doc},
+        base_dir => "'$root'",
+        lib => "'$lib'",
+        searchTerms => "'$search'",
+        searchClass => "'$class'",
+    );
 
-	return $marctxt_xslt->output_string($new_doc); 
+    return $marctxt_xslt->output_string($new_doc); 
 }
 
 
@@ -805,47 +805,47 @@ package OpenILS::WWW::SuperCat::Feed::ris;
 use base 'OpenILS::WWW::SuperCat::Feed::marcxml';
 
 sub new {
-	my $class = shift;
-	my $self = $class->SUPER::new;
-	$self->{type} = 'text/plain';
-	$self->{xsl} = "/MARC21slim2RIS.xsl";
-	return $self;
+    my $class = shift;
+    my $self = $class->SUPER::new;
+    $self->{type} = 'text/plain';
+    $self->{xsl} = "/MARC21slim2RIS.xsl";
+    return $self;
 }
 
 
 our ($_parser, $_xslt, $xslt_file);
 
 sub toString {
-	my $self = shift;
-	my $base = $self->base || '';
-	my $root = $self->root || '';
-	my $search = $self->search || '';
-	my $class = $self->class || '';
-	my $lib = $self->lib || '-';
+    my $self = shift;
+    my $base = $self->base || '';
+    my $root = $self->root || '';
+    my $search = $self->search || '';
+    my $class = $self->class || '';
+    my $lib = $self->lib || '-';
 
-	$self->composeDoc;
+    $self->composeDoc;
 
         $_parser ||= new XML::LibXML;
         $_xslt ||= new XML::LibXSLT;
 
-	$xslt_file ||=
+    $xslt_file ||=
                 OpenSRF::Utils::SettingsClient
-       	                ->new
-               	        ->config_value( dirs => 'xsl' ).
+                        ->new
+                        ->config_value( dirs => 'xsl' ).
                 $self->{xsl};
 
         # parse the MARC text xslt ...
         my $ris_xslt = $_xslt->parse_stylesheet( $_parser->parse_file($xslt_file) );
 
-	my $new_doc = $ris_xslt->transform(
-		$self->{doc},
-		base_dir => "'$root'",
-		lib => "'$lib'",
-		searchTerms => "'$search'",
-		searchClass => "'$class'",
-	);
+    my $new_doc = $ris_xslt->transform(
+        $self->{doc},
+        base_dir => "'$root'",
+        lib => "'$lib'",
+        searchTerms => "'$search'",
+        searchClass => "'$class'",
+    );
 
-	return $ris_xslt->output_string($new_doc); 
+    return $ris_xslt->output_string($new_doc); 
 }
 
 
@@ -857,10 +857,10 @@ use base 'OpenILS::WWW::SuperCat::Feed::marcxml';
 use MARC::File::XML ( BinaryEncoding => 'utf8', RecordFormat => 'USMARC' );
 
 sub new {
-	my $class = shift;
-	my $self = $class->SUPER::new;
-	$self->{type} = 'application/octet-stream';
-	return $self;
+    my $class = shift;
+    my $self = $class->SUPER::new;
+    $self->{type} = 'application/octet-stream';
+    return $self;
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Vandelay.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Vandelay.pm
index 72e4f38..c46b380 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/Vandelay.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/Vandelay.pm
@@ -53,40 +53,40 @@ sub child_init {
 }
 
 sub spool_marc {
-	my $r = shift;
-	my $cgi = new CGI;
+    my $r = shift;
+    my $cgi = new CGI;
 
-	my $auth = $cgi->param('ses') || $cgi->cookie('ses');
+    my $auth = $cgi->param('ses') || $cgi->cookie('ses');
 
-	unless(verify_login($auth)) {
+    unless(verify_login($auth)) {
         $logger->error("authentication failed on vandelay record import: $auth");
-	    return Apache2::Const::FORBIDDEN;
+        return Apache2::Const::FORBIDDEN;
     }
 
     my $data_fingerprint = '';
-	my $purpose = $cgi->param('purpose') || '';
-	my $infile = $cgi->param('marc_upload') || '';
+    my $purpose = $cgi->param('purpose') || '';
+    my $infile = $cgi->param('marc_upload') || '';
     my $bib_source = $cgi->param('bib_source') || '';
 
     $logger->debug("purpose = $purpose, infile = $infile, bib_source = $bib_source");
 
-	my $conf = OpenSRF::Utils::SettingsClient->new;
-	my $dir = $conf->config_value(
+    my $conf = OpenSRF::Utils::SettingsClient->new;
+    my $dir = $conf->config_value(
         apps => 'open-ils.vandelay' => app_settings => databases => 'importer');
 
     unless(-w $dir) {
         $logger->error("We need some place to store our MARC files");
-	    return Apache2::Const::FORBIDDEN;
+        return Apache2::Const::FORBIDDEN;
     }
 
     if($infile and -e $infile) {
         my ($total_bytes, $buf, $bytes) = (0);
-	    $data_fingerprint = md5_hex(time."$$".rand());
+        $data_fingerprint = md5_hex(time."$$".rand());
         my $outfile = "$dir/$data_fingerprint.mrc";
 
         unless(open(OUTFILE, ">$outfile")) {
             $logger->error("unable to open MARC file [$outfile] for writing: $@");
-	        return Apache2::Const::FORBIDDEN;
+            return Apache2::Const::FORBIDDEN;
         }
 
         while($bytes = sysread($infile, $buf, $FILE_READ_SIZE)) {
@@ -95,26 +95,26 @@ sub spool_marc {
                 close(OUTFILE);
                 unlink $outfile;
                 $logger->error("import exceeded upload size: $MAX_FILE_SIZE");
-	            return Apache2::Const::FORBIDDEN;
+                return Apache2::Const::FORBIDDEN;
             }
             print OUTFILE $buf;
         }
 
         close(OUTFILE);
 
-	    OpenSRF::Utils::Cache->new->put_cache(
-		    'vandelay_import_spool_' . $data_fingerprint,
-		    {   purpose => $purpose, 
+        OpenSRF::Utils::Cache->new->put_cache(
+            'vandelay_import_spool_' . $data_fingerprint,
+            {   purpose => $purpose, 
                 path => $outfile,
                 bib_source => $bib_source,
             }
-	    );
+        );
     }
 
     $logger->info("uploaded MARC batch with key $data_fingerprint");
     $r->content_type('text/plain; charset=utf-8');
-	print "$data_fingerprint";
-	return Apache2::Const::OK;
+    print "$data_fingerprint";
+    return Apache2::Const::OK;
 }
 
 sub verify_login {
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/XMLRPCGateway.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/XMLRPCGateway.pm
index b159fe4..43e99e4 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/XMLRPCGateway.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/XMLRPCGateway.pm
@@ -24,11 +24,11 @@ use RPC::XML::Procedure;
 
 $RPC::XML::ENCODING = 'utf-8';
 
-my $services; 						# allowed services
-my $CLASS_KEY = '__class__';	# object wrapper class key
-my $PAYLOAD_KEY = '__data__';	# object wrapper payload key
-my $bs_config; 					# bootstrap config
-my $__inited = 0; 				# has child_init run?
+my $services;                       # allowed services
+my $CLASS_KEY = '__class__';    # object wrapper class key
+my $PAYLOAD_KEY = '__data__';   # object wrapper payload key
+my $bs_config;                  # bootstrap config
+my $__inited = 0;               # has child_init run?
 
 
 # set the bootstrap config when this module is loaded
@@ -37,47 +37,47 @@ sub import { $bs_config = $_[1]; }
 
 # Bootstrap and load config settings
 sub child_init {
-	$__inited = 1;
-	OpenSRF::AppSession->ingress('xmlrpc');
-	OpenSRF::System->bootstrap_client( config_file => $bs_config );
-	my $sclient	= OpenSRF::Utils::SettingsClient->new();
-	my $idl = $sclient->config_value("IDL");
-	$services = $sclient->config_value("xml-rpc", "allowed_services", "service");
-	$services = ref $services ? $services : [ $services ];
-	$logger->debug("XML-RPC: allowed services @$services");
-	OpenILS::Utils::Fieldmapper->require;
-	Fieldmapper->import(IDL => $idl);
-	OpenSRF::AppSession->ingress('apache');
-	return Apache2::Const::OK;
+    $__inited = 1;
+    OpenSRF::AppSession->ingress('xmlrpc');
+    OpenSRF::System->bootstrap_client( config_file => $bs_config );
+    my $sclient = OpenSRF::Utils::SettingsClient->new();
+    my $idl = $sclient->config_value("IDL");
+    $services = $sclient->config_value("xml-rpc", "allowed_services", "service");
+    $services = ref $services ? $services : [ $services ];
+    $logger->debug("XML-RPC: allowed services @$services");
+    OpenILS::Utils::Fieldmapper->require;
+    Fieldmapper->import(IDL => $idl);
+    OpenSRF::AppSession->ingress('apache');
+    return Apache2::Const::OK;
 }
 
 
 sub handler {
 
-	my $r		= shift;
-	my $cgi	= CGI->new;
-	my $service = $r->path_info;
-	$service =~ s#^/##;
+    my $r       = shift;
+    my $cgi = CGI->new;
+    my $service = $r->path_info;
+    $service =~ s#^/##;
 
-	child_init() unless $__inited; # ?
+    child_init() unless $__inited; # ?
 
-	return Apache2::Const::NOT_FOUND unless grep { $_ eq $service } @$services;
+    return Apache2::Const::NOT_FOUND unless grep { $_ eq $service } @$services;
 
-	my $request = RPC::XML::Parser->new->parse($cgi->param('POSTDATA'));
+    my $request = RPC::XML::Parser->new->parse($cgi->param('POSTDATA'));
 
-	my @args;
-	push( @args, unwrap_perl($_->value) ) for @{$request->args};
-	my $method = $request->name;
+    my @args;
+    push( @args, unwrap_perl($_->value) ) for @{$request->args};
+    my $method = $request->name;
 
-	warn "XML-RPC: service=$service, method=$method, args=@args\n";
-	$logger->debug("XML-RPC: service=$service, method=$method, args=@args");
+    warn "XML-RPC: service=$service, method=$method, args=@args\n";
+    $logger->debug("XML-RPC: service=$service, method=$method, args=@args");
 
-	my $perl = run_request( $service, $method, @args );
-	my $resp = RPC::XML::response->new(smart_encode($perl));
+    my $perl = run_request( $service, $method, @args );
+    my $resp = RPC::XML::response->new(smart_encode($perl));
 
-	print "Content-type: application/xml; charset=utf-8\n\n";
-	print $resp->as_string;
-	return Apache2::Const::OK;
+    print "Content-type: application/xml; charset=utf-8\n\n";
+    print $resp->as_string;
+    return Apache2::Const::OK;
 }
 
 
diff --git a/Open-ILS/src/perlmods/lib/Template/Plugin/ResolverResolver.pm b/Open-ILS/src/perlmods/lib/Template/Plugin/ResolverResolver.pm
index b81b77f..6cdc190 100644
--- a/Open-ILS/src/perlmods/lib/Template/Plugin/ResolverResolver.pm
+++ b/Open-ILS/src/perlmods/lib/Template/Plugin/ResolverResolver.pm
@@ -66,14 +66,14 @@ sub resolve_issn
 
     if (length($issn) <= 9) {
            my $session = OpenSRF::AppSession->create("open-ils.resolver");
-	
+    
            my $request = $session->request("open-ils.resolver.resolve_holdings.raw", "issn", $issn, $baseurl, $timeout)->gather();
            if ($request) {
                  return $request;
            }
            $session->disconnect();
     }
-    	
+        
     return "";
 }
 
@@ -82,14 +82,14 @@ sub resolve_isbn
     my ($class, $isbn, $baseurl, $timeout) = @_;
 
     my $session = OpenSRF::AppSession->create("open-ils.resolver");
-	
+    
     my $request = $session->request("open-ils.resolver.resolve_holdings.raw", "isbn", $isbn, $baseurl, $timeout)->gather();
-	
+    
     if ($request) {
             return $request;
     }
     $session->disconnect();
-    	
+        
     return "";
 }
 

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/src/perlmods/lib/OpenILS/Application.pm   |   14 +-
 .../perlmods/lib/OpenILS/Application/Acq/Claims.pm |   12 +-
 .../perlmods/lib/OpenILS/Application/Acq/EDI.pm    |    6 +-
 .../lib/OpenILS/Application/Acq/Financials.pm      |  154 +-
 .../lib/OpenILS/Application/Acq/Invoice.pm         |   18 +-
 .../lib/OpenILS/Application/Acq/Lineitem.pm        |   12 +-
 .../perlmods/lib/OpenILS/Application/Acq/Order.pm  |  110 +-
 .../lib/OpenILS/Application/Acq/Picklist.pm        |   54 +-
 .../lib/OpenILS/Application/Acq/Provider.pm        |   36 +-
 .../src/perlmods/lib/OpenILS/Application/Actor.pm  | 2216 +++++-----
 .../lib/OpenILS/Application/Actor/ClosedDates.pm   |  186 +-
 .../lib/OpenILS/Application/Actor/Container.pm     |  502 +-
 .../lib/OpenILS/Application/Actor/Stage.pm         |   24 +-
 .../lib/OpenILS/Application/Actor/UserGroups.pm    |  148 +-
 .../perlmods/lib/OpenILS/Application/AppUtils.pm   | 1666 ++++----
 .../lib/OpenILS/Application/Cat/AssetCommon.pm     |  500 +-
 .../lib/OpenILS/Application/Cat/AuthCommon.pm      |   30 +-
 .../lib/OpenILS/Application/Cat/Authority.pm       |   46 +-
 .../lib/OpenILS/Application/Cat/BibCommon.pm       |  404 +-
 .../perlmods/lib/OpenILS/Application/Cat/Merge.pm  |  348 +-
 .../src/perlmods/lib/OpenILS/Application/Circ.pm   | 1286 +++---
 .../lib/OpenILS/Application/Circ/CircCommon.pm     |   20 +-
 .../lib/OpenILS/Application/Circ/Circulate.pm      |   80 +-
 .../lib/OpenILS/Application/Circ/CopyLocations.pm  |  106 +-
 .../lib/OpenILS/Application/Circ/HoldNotify.pm     |  474 +-
 .../perlmods/lib/OpenILS/Application/Circ/Holds.pm |    6 +-
 .../lib/OpenILS/Application/Circ/NonCat.pm         |  232 +-
 .../lib/OpenILS/Application/Circ/ScriptBuilder.pm  |  534 ++--
 .../lib/OpenILS/Application/Circ/StatCat.pm        |  862 ++--
 .../lib/OpenILS/Application/Circ/Survey.pm         |  452 +-
 .../lib/OpenILS/Application/Circ/Transit.pm        |  466 +-
 .../perlmods/lib/OpenILS/Application/Penalty.pm    |   32 +-
 .../perlmods/lib/OpenILS/Application/PermaCrud.pm  |    2 +-
 .../src/perlmods/lib/OpenILS/Application/Proxy.pm  |   56 +-
 .../perlmods/lib/OpenILS/Application/Reporter.pm   |  702 ++--
 .../src/perlmods/lib/OpenILS/Application/Search.pm |   44 +-
 .../lib/OpenILS/Application/Search/AddedContent.pm |   82 +-
 .../lib/OpenILS/Application/Search/Authority.pm    |  424 +-
 .../lib/OpenILS/Application/Search/Biblio.pm       | 1196 +++---
 .../lib/OpenILS/Application/Search/CNBrowse.pm     |  104 +-
 .../lib/OpenILS/Application/Search/Serial.pm       |  112 +-
 .../lib/OpenILS/Application/Search/Zips.pm         |   78 +-
 .../src/perlmods/lib/OpenILS/Application/Serial.pm |  102 +-
 .../perlmods/lib/OpenILS/Application/Storage.pm    |  218 +-
 .../lib/OpenILS/Application/Storage/CDBI.pm        | 1408 +++---
 .../lib/OpenILS/Application/Storage/CDBI/action.pm |   56 +-
 .../lib/OpenILS/Application/Storage/CDBI/actor.pm  |   30 +-
 .../lib/OpenILS/Application/Storage/CDBI/asset.pm  |   12 +-
 .../OpenILS/Application/Storage/CDBI/authority.pm  |    8 +-
 .../lib/OpenILS/Application/Storage/CDBI/biblio.pm |    6 +-
 .../OpenILS/Application/Storage/CDBI/booking.pm    |    4 +-
 .../OpenILS/Application/Storage/CDBI/metabib.pm    |    4 +-
 .../lib/OpenILS/Application/Storage/CDBI/money.pm  |   18 +-
 .../OpenILS/Application/Storage/CDBI/permission.pm |    2 +-
 .../lib/OpenILS/Application/Storage/CDBI/serial.pm |   12 +-
 .../lib/OpenILS/Application/Storage/Driver/Pg.pm   |  412 +-
 .../OpenILS/Application/Storage/Driver/Pg/cdbi.pm  |   54 +-
 .../OpenILS/Application/Storage/Driver/Pg/dbi.pm   | 1456 +++---
 .../OpenILS/Application/Storage/Driver/Pg/fts.pm   |  166 +-
 .../Application/Storage/Driver/Pg/storage.pm       |  734 ++--
 .../lib/OpenILS/Application/Storage/FTS.pm         |  314 +-
 .../lib/OpenILS/Application/Storage/Publisher.pm   | 1286 +++---
 .../Application/Storage/Publisher/action.pm        | 2976 ++++++------
 .../OpenILS/Application/Storage/Publisher/actor.pm | 1066 +++---
 .../OpenILS/Application/Storage/Publisher/asset.pm | 1018 ++--
 .../Application/Storage/Publisher/authority.pm     |  410 +-
 .../Application/Storage/Publisher/biblio.pm        |  812 ++--
 .../Application/Storage/Publisher/config.pm        |  102 +-
 .../Application/Storage/Publisher/metabib.pm       | 4846 ++++++++++----------
 .../OpenILS/Application/Storage/Publisher/money.pm |  460 +-
 .../Application/Storage/Publisher/permission.pm    |  134 +-
 .../perlmods/lib/OpenILS/Application/SuperCat.pm   | 4520 +++++++++---------
 .../lib/OpenILS/Application/Trigger/Reactor.pm     |    2 +-
 .../OpenILS/Application/Trigger/Reactor/AstCall.pm |    4 +-
 .../perlmods/lib/OpenILS/Application/Vandelay.pm   |    4 +-
 Open-ILS/src/perlmods/lib/OpenILS/Const.pm         |    4 +-
 Open-ILS/src/perlmods/lib/OpenILS/Event.pm         |   72 +-
 Open-ILS/src/perlmods/lib/OpenILS/Perm.pm          |    6 +-
 .../src/perlmods/lib/OpenILS/Reporter/Proxy.pm     |  198 +-
 .../perlmods/lib/OpenILS/Reporter/SQLBuilder.pm    | 1150 +++---
 Open-ILS/src/perlmods/lib/OpenILS/SIP/Item.pm      |   40 +-
 .../src/perlmods/lib/OpenILS/SIP/Transaction.pm    |   38 +-
 .../lib/OpenILS/SIP/Transaction/Checkout.pm        |   10 +-
 .../perlmods/lib/OpenILS/SIP/Transaction/Renew.pm  |   46 +-
 .../lib/OpenILS/Template/Plugin/WebSession.pm      |   26 +-
 .../lib/OpenILS/Template/Plugin/WebUtils.pm        |   38 +-
 .../src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm |  626 ++--
 .../src/perlmods/lib/OpenILS/Utils/Configure.pm    |   32 +-
 Open-ILS/src/perlmods/lib/OpenILS/Utils/Editor.pm  |  556 ++--
 .../src/perlmods/lib/OpenILS/Utils/Fieldmapper.pm  |  566 ++--
 .../src/perlmods/lib/OpenILS/Utils/MFHD/Caption.pm |   50 +-
 .../src/perlmods/lib/OpenILS/Utils/MFHD/Date.pm    |   14 +-
 .../src/perlmods/lib/OpenILS/Utils/ModsParser.pm   |  740 ++--
 .../src/perlmods/lib/OpenILS/Utils/Normalize.pm    |   14 +-
 .../src/perlmods/lib/OpenILS/Utils/OfflineStore.pm |   94 +-
 .../src/perlmods/lib/OpenILS/Utils/PermitHold.pm   |  254 +-
 .../perlmods/lib/OpenILS/Utils/RemoteAccount.pm    |   30 +-
 .../src/perlmods/lib/OpenILS/Utils/ScriptRunner.pm |  938 ++--
 .../src/perlmods/lib/OpenILS/Utils/SpiderMonkey.pm |  642 ++--
 Open-ILS/src/perlmods/lib/OpenILS/Utils/ZClient.pm |  142 +-
 Open-ILS/src/perlmods/lib/OpenILS/WWW/BadDebt.pm   |   92 +-
 .../perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm   |   12 +-
 Open-ILS/src/perlmods/lib/OpenILS/WWW/EGWeb.pm     |    2 +-
 Open-ILS/src/perlmods/lib/OpenILS/WWW/Exporter.pm  |  472 +-
 .../src/perlmods/lib/OpenILS/WWW/PasswordReset.pm  |    2 +-
 Open-ILS/src/perlmods/lib/OpenILS/WWW/Proxy.pm     |  226 +-
 .../src/perlmods/lib/OpenILS/WWW/Proxy/Authen.pm   |   44 +-
 Open-ILS/src/perlmods/lib/OpenILS/WWW/Redirect.pm  |   50 +-
 Open-ILS/src/perlmods/lib/OpenILS/WWW/Reporter.pm  |  172 +-
 .../src/perlmods/lib/OpenILS/WWW/SuperCat/Feed.pm  |  952 ++--
 Open-ILS/src/perlmods/lib/OpenILS/WWW/Vandelay.pm  |   38 +-
 .../src/perlmods/lib/OpenILS/WWW/XMLRPCGateway.pm  |   68 +-
 .../lib/Template/Plugin/ResolverResolver.pm        |   10 +-
 113 files changed, 22479 insertions(+), 22479 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list