Merge changes from trunk to fix workstation registration and the like
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 10 Mar 2008 02:08:11 +0000 (02:08 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 10 Mar 2008 02:08:11 +0000 (02:08 +0000)
svn merge -r8766:8767 svn://svn.open-ils.org/ILS/trunk
svn merge -r8704:8705 svn://svn.open-ils.org/ILS/trunk
svn merge -r8807:8808 svn://svn.open-ils.org/ILS/trunk
svn merge -r8664:8666 svn://svn.open-ils.org/ILS/trunk

git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@8947 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Open-ILS/src/perlmods/OpenILS/Application/Actor/UserGroups.pm
Open-ILS/src/perlmods/OpenILS/Application/Cat.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ/CopyLocations.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm
Open-ILS/src/perlmods/OpenILS/Application/Collections.pm
Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm

index ae19436..cf521ef 100644 (file)
@@ -914,6 +914,7 @@ sub search_username {
 
 __PACKAGE__->register_method(
        method  => "user_retrieve_by_barcode",
+    authoritative => 1,
        api_name        => "open-ils.actor.user.fleshed.retrieve_by_barcode",);
 
 sub user_retrieve_by_barcode {
@@ -1036,33 +1037,6 @@ sub get_org_tree {
 }
 
 
-# turns an org list into an org tree
-sub build_org_tree {
-
-       my( $self, $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;
-
-       for my $org (@list) {
-
-               next unless ($org and defined($org->parent_ou));
-               my ($parent) = grep { $_->id == $org->parent_ou } @list;
-               next unless $parent;
-
-               $parent->children([]) unless defined($parent->children); 
-               push( @{$parent->children}, $org );
-       }
-
-       return $list[0];
-
-}
-
-
 __PACKAGE__->register_method(
        method  => "get_org_descendants",
        api_name        => "open-ils.actor.org_tree.descendants.retrieve"
@@ -1075,7 +1049,7 @@ sub get_org_descendants {
                        "open-ils.storage", 
                        "open-ils.storage.actor.org_unit.descendants.atomic",
                        $org_unit, $depth );
-       return $self->build_org_tree($orglist);
+       return $U->build_org_tree($orglist);
 }
 
 
@@ -1091,7 +1065,7 @@ sub get_org_ancestors {
                        "open-ils.storage", 
                        "open-ils.storage.actor.org_unit.ancestors.atomic",
                        $org_unit, $depth );
-       return $self->build_org_tree($orglist);
+       return $U->build_org_tree($orglist);
 }
 
 
@@ -1294,23 +1268,8 @@ sub check_user_perms3 {
                $authtoken, $userid, 'VIEW_PERMISSION' );
        return $evt if $evt;
 
-       my $tree = $self->get_org_tree();
-       return _find_highest_perm_org( $perm, $userid, $target->ws_ou, $tree );
-}
-
-
-sub _find_highest_perm_org {
-       my ( $perm, $userid, $start_org, $org_tree ) = @_;
-       my $org = $apputils->find_org($org_tree, $start_org );
-
-       my $lastid = -1;
-       while( $org ) {
-               last if ($apputils->check_perms( $userid, $org->id, $perm )); # perm failed
-               $lastid = $org->id;
-               $org = $apputils->find_org( $org_tree, $org->parent_ou() );
-       }
-
-       return $lastid;
+       my $tree = $U->get_org_tree();
+       return $U->find_highest_perm_org( $perm, $userid, $target->ws_ou, $tree );
 }
 
 
@@ -1368,10 +1327,10 @@ sub check_user_perms4 {
 
        my @arr;
        return [] unless ref($perms);
-       my $tree = $self->get_org_tree();
+       my $tree = $U->get_org_tree();
 
        for my $p (@$perms) {
-               push( @arr, _find_highest_perm_org( $p, $userid, $target->home_ou, $tree ) );
+               push( @arr, $U->find_highest_perm_org( $p, $userid, $target->home_ou, $tree ) );
        }
        return \@arr;
 }
@@ -1382,6 +1341,7 @@ sub check_user_perms4 {
 __PACKAGE__->register_method(
        method  => "user_fines_summary",
        api_name        => "open-ils.actor.user.fines.summary",
+    authoritative => 1,
        notes           => <<"  NOTES");
        Returns a short summary of the users total open fines, excluding voided fines
        Params are login_session, user_id
@@ -1678,6 +1638,7 @@ sub user_transaction_retrieve {
 __PACKAGE__->register_method(
        method  => "hold_request_count",
        api_name        => "open-ils.actor.user.hold_requests.count",
+    authoritative => 1,
        argc            => 1,
        notes           => <<"  NOTES");
        Returns hold ready/total counts
@@ -1761,6 +1722,7 @@ sub checkedout_count {
 __PACKAGE__->register_method(
        method          => "checked_out",
        api_name                => "open-ils.actor.user.checked_out",
+    authoritative => 1,
        argc                    => 2,
        signature       => q/
                Returns a structure of circulations objects sorted by
@@ -1778,6 +1740,7 @@ __PACKAGE__->register_method(
 __PACKAGE__->register_method(
        method          => "checked_out",
        api_name                => "open-ils.actor.user.checked_out.count",
+    authoritative => 1,
        argc                    => 2,
        signature       => q/@see open-ils.actor.user.checked_out/
 );
@@ -1949,6 +1912,7 @@ sub _checked_out_WHAT {
 __PACKAGE__->register_method(
        method          => "checked_in_with_fines",
        api_name                => "open-ils.actor.user.checked_in_with_fines",
+    authoritative => 1,
        argc                    => 2,
        signature       => q/@see open-ils.actor.user.checked_out/
 );
@@ -2011,6 +1975,7 @@ __PACKAGE__->register_method(
 __PACKAGE__->register_method(
        method  => "user_transaction_history",
        api_name        => "open-ils.actor.user.transactions.history.have_balance",
+    authoritative => 1,
        argc            => 1,
        notes           => <<"  NOTES");
        Returns a list of billable transaction ids for a user that have a balance, optionally by type
@@ -2025,6 +1990,7 @@ __PACKAGE__->register_method(
 __PACKAGE__->register_method(
        method  => "user_transaction_history",
        api_name        => "open-ils.actor.user.transactions.history.have_bill",
+    authoritative => 1,
        argc            => 1,
        notes           => <<"  NOTES");
        Returns a list of billable transaction ids for a user that has billings
@@ -2473,6 +2439,7 @@ sub workstation_list {
 __PACKAGE__->register_method (
        method          => 'fetch_patron_note',
        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
@@ -2657,20 +2624,19 @@ __PACKAGE__->register_method(
        /
 );
 
-# XXX Make me retun undef if no user has the ID 
-
 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, deleted=>'f'}, {idlist=>1});
        return $$a[0] if $a and @$a;
-       return 0;
+       return undef;
 }
 
 __PACKAGE__->register_method(
        method => 'barcode_exists',
        api_name        => 'open-ils.actor.barcode.exists',
+    authoritative => 1,
        signature => q/
                Returns 1 if the requested barcode exists, returns 0 otherwise
        /
@@ -2681,7 +2647,7 @@ sub barcode_exists {
        my $e = new_editor(authtoken=>$auth);
        return $e->event unless $e->checkauth;
        my $card = $e->search_actor_card({barcode => $barcode});
-    return 0 unless @$card;
+    return undef unless @$card;
     return $card->[0]->usr;
 }
 
@@ -2945,7 +2911,7 @@ sub user_opt_in_at_org {
     my($self, $conn, $auth, $user_id) = @_;
 
     # see if we even need to enforce the opt-in value
-    return 1 unless $self->user_opt_in_enabled;
+    return 1 unless user_opt_in_enabled($self);
 
        my $e = new_editor(authtoken => $auth);
        return $e->event unless $e->checkauth;
index 7ab395a..b2ec498 100644 (file)
@@ -13,6 +13,7 @@ sub initialize { return 1; }
 __PACKAGE__->register_method(
        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
        /
index 4d97e14..326c1c3 100644 (file)
@@ -495,6 +495,7 @@ sub _tcn_exists {
 __PACKAGE__->register_method(
        method  => "biblio_record_record_metadata",
        api_name        => "open-ils.cat.biblio.record.metadata.retrieve",
+    authoritative => 1,
        argc            => 1, #(session_id, biblio_tree ) 
        notes           => "Walks the tree and commits any changed nodes " .
                                        "adds any new nodes, and deletes any deleted nodes",
@@ -625,6 +626,7 @@ sub _update_record_metadata {
 
 __PACKAGE__->register_method(
        method  => "orgs_for_title",
+    authoritative => 1,
        api_name        => "open-ils.cat.actor.org_unit.retrieve_by_title"
 );
 
@@ -643,6 +645,7 @@ sub orgs_for_title {
 
 __PACKAGE__->register_method(
        method  => "retrieve_copies",
+    authoritative => 1,
        api_name        => "open-ils.cat.asset.copy_tree.retrieve");
 
 __PACKAGE__->register_method(
index b06fc5f..3bf9ff1 100644 (file)
@@ -881,6 +881,7 @@ sub age_hold_rules {
 
 __PACKAGE__->register_method(
        method => 'copy_details_barcode',
+    authoritative => 1,
        api_name => 'open-ils.circ.copy_details.retrieve.barcode');
 sub copy_details_barcode {
        my( $self, $conn, $auth, $barcode ) = @_;
@@ -1051,6 +1052,7 @@ sub magic_fetch {
 
 __PACKAGE__->register_method(
        method  => "fleshed_circ_retrieve",
+    authoritative => 1,
        api_name        => "open-ils.circ.fleshed.retrieve",);
 
 sub fleshed_circ_retrieve {
index ab572bf..f5c5dd2 100644 (file)
@@ -139,6 +139,7 @@ sub cl_update {
 
 __PACKAGE__->register_method(
        method => 'fetch_loc',
+    authoritative => 1,
        api_name => 'open-ils.circ.copy_location.retrieve',
 );
 
index 4bceb62..608d993 100644 (file)
@@ -301,6 +301,7 @@ NOTE
 
 __PACKAGE__->register_method(
        method  => "retrieve_holds",
+    authoritative => 1,
        api_name        => "open-ils.circ.holds.id_list.retrieve",
        notes           => <<NOTE);
 Retrieves all the hold ids for the specified
@@ -1518,6 +1519,7 @@ sub all_rec_holds {
 
 __PACKAGE__->register_method(
        method => 'uber_hold',
+    authoritative => 1,
        api_name => 'open-ils.circ.hold.details.retrieve'
 );
 
index 4956fe0..a0525b2 100644 (file)
@@ -256,6 +256,7 @@ sub retrieve_payments {
 
 __PACKAGE__->register_method(
        method  => "retrieve_payments2",
+    authoritative => 1,
        api_name        => "open-ils.circ.money.payment.retrieve.all",
        notes           => "Returns a list of payments attached to a given transaction"
        );
@@ -337,6 +338,7 @@ sub fetch_grocery {
 
 __PACKAGE__->register_method(
        method  => "billing_items",
+    authoritative => 1,
        api_name        => "open-ils.circ.money.billing.retrieve.all",
        notes           =><<"   NOTE");
        Returns a list of billing items for the given transaction.
@@ -499,6 +501,7 @@ sub _check_open_xact {
 
 __PACKAGE__->register_method (
        method => 'fetch_mbts',
+    authoritative => 1,
        api_name => 'open-ils.circ.money.billable_xact_summary.retrieve'
 );
 sub fetch_mbts {
index 94779cf..ea3b8f0 100644 (file)
@@ -194,6 +194,7 @@ sub fetch_noncat {
 
 __PACKAGE__->register_method(
        method => 'fetch_open_noncats',
+    authoritative => 1,
        api_name        => 'open-ils.circ.open_non_cataloged_circulation.user',
        signature => q/
                Returns an id-list of non-cataloged circulations that are considered
index 2930b47..e1cd9b4 100644 (file)
@@ -120,8 +120,8 @@ sub users_of_interest {
     # let the client know we're still here
     $conn->status( new OpenSRF::DomainObject::oilsContinueStatus );
 
-    return $self->process_users_of_interest_results(
-        $conn, $e, $req, $start, $age, $fine_level, $location);
+    return process_users_of_interest_results(
+        $self, $conn, $e, $req, $start, $age, $fine_level, $location);
 }
 
 
@@ -234,8 +234,8 @@ sub users_owing_money {
     # let the client know we're still here
     $conn->status( new OpenSRF::DomainObject::oilsContinueStatus );
 
-    return $self->process_users_of_interest_results(
-        $conn, $e, $req, $start, $start_date, $end_date, $fine_level, @locations);
+    return process_users_of_interest_results(
+        $self, $conn, $e, $req, $start, $start_date, $end_date, $fine_level, @locations);
 }
 
 
index aceec3c..61baf74 100644 (file)
@@ -102,6 +102,7 @@ sub record_id_to_mods {
 
 __PACKAGE__->register_method(
        method  => "record_id_to_mods_slim",
+    authoritative => 1,
        api_name        => "open-ils.search.biblio.record.mods_slim.retrieve",
        argc            => 1, 
        note            => "Provide ID, we provide the mods"
@@ -130,6 +131,7 @@ __PACKAGE__->register_method(
 
 __PACKAGE__->register_method(
        method  => "record_id_to_copy_count",
+    authoritative => 1,
        api_name        => "open-ils.search.biblio.record.copy_count.staff",
 );
 
@@ -234,6 +236,7 @@ sub volume_retrieve {
 
 __PACKAGE__->register_method(
        method  => "fleshed_copy_retrieve_batch",
+    authoritative => 1,
        api_name        => "open-ils.search.asset.copy.fleshed.batch.retrieve");
 
 sub fleshed_copy_retrieve_batch { 
@@ -1323,6 +1326,7 @@ sub cn_browse {
 
 __PACKAGE__->register_method(
        method => "fetch_cn",
+    authoritative => 1,
        api_name => "open-ils.search.callnumber.retrieve",
        notes           => "retrieves a callnumber based on ID",
        );