open-ils be gone!
authorMike Rylander <mrylander@gmail.com>
Sun, 7 Apr 2013 02:46:26 +0000 (22:46 -0400)
committerMike Rylander <mrylander@gmail.com>
Sun, 7 Apr 2013 02:46:26 +0000 (22:46 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>

src/perl/lib/ShareStuff/Actor.pm
src/perl/lib/ShareStuff/AppUtils.pm
src/perl/lib/ShareStuff/CStoreEditor.pm

index 122f2d3..0f92bce 100644 (file)
@@ -43,7 +43,7 @@ my $set_ou_settings;
 
 #__PACKAGE__->register_method(
 #      method  => "allowed_test",
-#      api_name        => "open-ils.actor.allowed_test",
+#      api_name        => "sharestuff.actor.allowed_test",
 #);
 #sub allowed_test {
 #    my($self, $conn, $auth, $orgid, $permcode) = @_;
@@ -59,7 +59,7 @@ my $set_ou_settings;
 
 __PACKAGE__->register_method(
        method  => "update_user_setting",
-       api_name        => "open-ils.actor.patron.settings.update",
+       api_name        => "sharestuff.actor.patron.settings.update",
 );
 sub update_user_setting {
        my($self, $conn, $auth, $user_id, $settings) = @_;
@@ -101,7 +101,7 @@ sub update_user_setting {
 
 __PACKAGE__->register_method(
     method    => "set_ou_settings",
-    api_name  => "open-ils.actor.org_unit.settings.update",
+    api_name  => "sharestuff.actor.org_unit.settings.update",
     signature => {
         desc => "Updates the value for a given org unit setting.  The permission to update "          .
                 "an org unit setting is either the UPDATE_ORG_UNIT_SETTING_ALL, or a specific "       .
@@ -162,7 +162,7 @@ sub set_ou_settings {
 __PACKAGE__->register_method(
     method   => "user_settings",
     authoritative => 1,
-    api_name => "open-ils.actor.patron.settings.retrieve",
+    api_name => "sharestuff.actor.patron.settings.retrieve",
 );
 sub user_settings {
        my( $self, $client, $auth, $user_id, $setting ) = @_;
@@ -200,7 +200,7 @@ sub user_settings {
 
 __PACKAGE__->register_method(
     method    => "ranged_ou_settings",
-    api_name  => "open-ils.actor.org_unit_setting.values.ranged.retrieve",
+    api_name  => "sharestuff.actor.org_unit_setting.values.ranged.retrieve",
     signature => {
         desc   => "Retrieves all org unit settings for the given org_id, up to whatever limit " .
                   "is implied for retrieving OU settings by the authenticated users' permissions.",
@@ -251,7 +251,7 @@ sub ranged_ou_settings {
 
 
 __PACKAGE__->register_method(
-    api_name  => 'open-ils.actor.ou_setting.ancestor_default',
+    api_name  => 'sharestuff.actor.ou_setting.ancestor_default',
     method    => 'ou_ancestor_setting',
     signature => {
         desc => 'Get the org unit setting value associated with the setting name as seen from the specified org unit.  ' .
@@ -279,7 +279,7 @@ sub ou_ancestor_setting {
 }
 
 __PACKAGE__->register_method(
-    api_name  => 'open-ils.actor.ou_setting.ancestor_default.batch',
+    api_name  => 'sharestuff.actor.ou_setting.ancestor_default.batch',
     method    => 'ou_ancestor_setting_batch',
     signature => {
         desc => 'Get org unit setting name => value pairs for a list of names, as seen from the specified org unit.  ' .
@@ -304,7 +304,7 @@ sub ou_ancestor_setting_batch {
 
 __PACKAGE__->register_method(
     method   => "update_patron",
-    api_name => "open-ils.actor.patron.update",
+    api_name => "sharestuff.actor.patron.update",
     signature => {
         desc   => q/
             Update an existing user, or create a new one.  Related objects,
@@ -438,7 +438,7 @@ sub _add_patron {
        return (undef, $evt) if $evt;
 
        my $ex = $session->request(
-               'open-ils.cstore.direct.actor.user.search', { 'usrname' => $patron->usrname() })->gather(1);
+               'sharestuff.cstore.direct.actor.user.search', { 'usrname' => $patron->usrname() })->gather(1);
        if( $ex and @$ex ) {
                return (undef, ShareStuff::Event->new('USERNAME_EXISTS'));
        }
@@ -446,7 +446,7 @@ sub _add_patron {
        $logger->info("Creating new user in the DB with username: ".$patron->usrname());
 
        my $usr = $session->request(
-               "open-ils.cstore.direct.actor.user.create", $patron)->gather(1);
+               "sharestuff.cstore.direct.actor.user.create", $patron)->gather(1);
        return (undef, $U->DB_UPDATE_FAILED($patron)) unless $id;
 
        $logger->info("Successfully created new user [".$usr->id."] in DB");
@@ -463,7 +463,7 @@ sub check_group_perm {
        # priveleges to update this user in any way
        if( ! $patron->isnew ) {
                my $p = $session->request(
-                       'open-ils.cstore.direct.actor.user.retrieve', $patron->id )->gather(1);
+                       'sharestuff.cstore.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
@@ -496,7 +496,7 @@ sub group_perm_failed {
 
                $logger->debug("user update looking for group perm for group $grpid");
                $grp = $session->request(
-                       'open-ils.cstore.direct.permission.grp_tree.retrieve', $grpid )->gather(1);
+                       'sharestuff.cstore.direct.permission.grp_tree.retrieve', $grpid )->gather(1);
                return ShareStuff::Event->new('PERMISSION_GRP_TREE_NOT_FOUND') unless $grp;
 
        } while( !($perm = $grp->application_perm) and ($grpid = $grp->parent) );
@@ -529,7 +529,7 @@ sub _update_patron {
        }
 
        my $stat = $session->request(
-               "open-ils.cstore.direct.actor.user.update",$patron )->gather(1);
+               "sharestuff.cstore.direct.actor.user.update",$patron )->gather(1);
        return (undef, $U->DB_UPDATE_FAILED($patron)) unless defined($stat);
 
        return ($patron);
@@ -539,7 +539,7 @@ sub verify_last_xact {
     my( $session, $patron ) = @_;
     return undef unless $patron->id and $patron->id > 0;
     my $p = $session->request(
-        'open-ils.cstore.direct.actor.user.retrieve', $patron->id)->gather(1);
+        'sharestuff.cstore.direct.actor.user.retrieve', $patron->id)->gather(1);
     my $xact = $p->last_xact_id;
     return undef unless $xact;
     $logger->info("user xact = $xact, saving with xact " . $patron->last_xact_id);
@@ -558,13 +558,13 @@ sub _create_stat_maps {
 
        for my $map (@$maps) {
 
-               my $method = "open-ils.cstore.direct.actor.stat_cat_entry_user_map.update";
+               my $method = "sharestuff.cstore.direct.actor.stat_cat_entry_user_map.update";
 
                if ($map->isdeleted()) {
-                       $method = "open-ils.cstore.direct.actor.stat_cat_entry_user_map.delete";
+                       $method = "sharestuff.cstore.direct.actor.stat_cat_entry_user_map.delete";
 
                } elsif ($map->isnew()) {
-                       $method = "open-ils.cstore.direct.actor.stat_cat_entry_user_map.create";
+                       $method = "sharestuff.cstore.direct.actor.stat_cat_entry_user_map.create";
                        $map->clear_id;
                }
 
@@ -590,11 +590,11 @@ sub _create_perm_maps {
 
        for my $map (@$maps) {
 
-               my $method = "open-ils.cstore.direct.permission.usr_perm_map.update";
+               my $method = "sharestuff.cstore.direct.permission.usr_perm_map.update";
                if ($map->isdeleted()) {
-                       $method = "open-ils.cstore.direct.permission.usr_perm_map.delete";
+                       $method = "sharestuff.cstore.direct.permission.usr_perm_map.delete";
                } elsif ($map->isnew()) {
-                       $method = "open-ils.cstore.direct.permission.usr_perm_map.create";
+                       $method = "sharestuff.cstore.direct.permission.usr_perm_map.create";
                        $map->clear_id;
                }
 
@@ -615,7 +615,7 @@ sub _create_perm_maps {
 
 __PACKAGE__->register_method(
     method   => "set_user_perms",
-    api_name => "open-ils.actor.user.permissions.update",
+    api_name => "sharestuff.actor.user.permissions.update",
 );
 
 sub set_user_perms {
@@ -635,11 +635,11 @@ sub set_user_perms {
 
        for my $map (@$maps) {
 
-               my $method = "open-ils.cstore.direct.permission.usr_perm_map.update";
+               my $method = "sharestuff.cstore.direct.permission.usr_perm_map.update";
                if ($map->isdeleted()) {
-                       $method = "open-ils.cstore.direct.permission.usr_perm_map.delete";
+                       $method = "sharestuff.cstore.direct.permission.usr_perm_map.delete";
                } elsif ($map->isnew()) {
-                       $method = "open-ils.cstore.direct.permission.usr_perm_map.create";
+                       $method = "sharestuff.cstore.direct.permission.usr_perm_map.create";
                        $map->clear_id;
                }
 
@@ -661,7 +661,7 @@ sub set_user_perms {
 __PACKAGE__->register_method(
        method  => "user_retrieve_by_barcode",
     authoritative => 1,
-       api_name        => "open-ils.actor.user.fleshed.retrieve_by_barcode",);
+       api_name        => "sharestuff.actor.user.fleshed.retrieve_by_barcode",);
 
 sub user_retrieve_by_barcode {
        my($self, $client, $auth, $barcode, $flesh_home_ou) = @_;
@@ -684,7 +684,7 @@ sub user_retrieve_by_barcode {
 __PACKAGE__->register_method(
     method        => "get_user_by_id",
     authoritative => 1,
-    api_name      => "open-ils.actor.user.retrieve",
+    api_name      => "sharestuff.actor.user.retrieve",
 );
 
 sub get_user_by_id {
@@ -699,7 +699,7 @@ sub get_user_by_id {
 
 __PACKAGE__->register_method(
     method   => "get_org_types",
-    api_name => "open-ils.actor.org_types.retrieve",
+    api_name => "sharestuff.actor.org_types.retrieve",
 );
 sub get_org_types {
     return $U->get_org_types();
@@ -708,7 +708,7 @@ sub get_org_types {
 
 __PACKAGE__->register_method(
     method   => "get_user_ident_types",
-    api_name => "open-ils.actor.user.ident_types.retrieve",
+    api_name => "sharestuff.actor.user.ident_types.retrieve",
 );
 my $ident_types;
 sub get_user_ident_types {
@@ -720,7 +720,7 @@ sub get_user_ident_types {
 
 __PACKAGE__->register_method(
     method   => "get_org_unit",
-    api_name => "open-ils.actor.org_unit.retrieve",
+    api_name => "sharestuff.actor.org_unit.retrieve",
 );
 
 sub get_org_unit {
@@ -737,7 +737,7 @@ sub get_org_unit {
 
 __PACKAGE__->register_method(
     method   => "search_org_unit",
-    api_name => "open-ils.actor.org_unit_list.search",
+    api_name => "sharestuff.actor.org_unit_list.search",
 );
 
 sub search_org_unit {
@@ -745,8 +745,8 @@ sub search_org_unit {
        my( $self, $client, $field, $value ) = @_;
 
        my $list = ShareStuff::AppUtils->simple_scalar_request(
-               "open-ils.cstore",
-               "open-ils.cstore.direct.actor.org_unit.search.atomic", 
+               "sharestuff.cstore",
+               "sharestuff.cstore.direct.actor.org_unit.search.atomic", 
                { $field => $value } );
 
        return $list;
@@ -757,7 +757,7 @@ sub search_org_unit {
 
 __PACKAGE__->register_method(
        method  => "get_org_tree",
-       api_name        => "open-ils.actor.org_tree.retrieve",
+       api_name        => "sharestuff.actor.org_tree.retrieve",
        argc            => 0, 
        note            => "Returns the entire org tree structure",
 );
@@ -771,7 +771,7 @@ sub get_org_tree {
 
 __PACKAGE__->register_method(
     method    => "update_passwd",
-    api_name  => "open-ils.actor.user.password.update",
+    api_name  => "sharestuff.actor.user.password.update",
     signature => {
         desc   => "Update the operator's password", 
         params => [
@@ -785,7 +785,7 @@ __PACKAGE__->register_method(
 
 __PACKAGE__->register_method(
     method    => "update_passwd",
-    api_name  => "open-ils.actor.user.username.update",
+    api_name  => "sharestuff.actor.user.username.update",
     signature => {
         desc   => "Update the operator's username", 
         params => [
@@ -799,7 +799,7 @@ __PACKAGE__->register_method(
 
 __PACKAGE__->register_method(
     method    => "update_passwd",
-    api_name  => "open-ils.actor.user.email.update",
+    api_name  => "sharestuff.actor.user.email.update",
     signature => {
         desc   => "Update the operator's email address", 
         params => [
@@ -855,7 +855,7 @@ sub update_passwd {
     $e->commit;
 
     # update the cached user to pick up these changes
-    $U->simplereq('open-ils.auth', 'open-ils.auth.session.reset_timeout', $auth, 1);
+    $U->simplereq('sharestuff.auth', 'sharestuff.auth.session.reset_timeout', $auth, 1);
     return 1;
 }
 
@@ -863,7 +863,7 @@ sub update_passwd {
 
 __PACKAGE__->register_method(
     method   => "check_user_perms",
-    api_name => "open-ils.actor.user.perm.check",
+    api_name => "sharestuff.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
@@ -898,7 +898,7 @@ sub check_user_perms {
 
 __PACKAGE__->register_method(
        method  => "check_user_perms2",
-       api_name        => "open-ils.actor.user.perm.check.multi_org",
+       api_name        => "sharestuff.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
@@ -932,7 +932,7 @@ sub check_user_perms2 {
 
 __PACKAGE__->register_method(
        method => 'check_user_perms3',
-       api_name        => 'open-ils.actor.user.perm.highest_org',
+       api_name        => 'sharestuff.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
@@ -963,7 +963,7 @@ sub check_user_perms3 {
 
 __PACKAGE__->register_method(
        method => 'user_has_work_perm_at',
-       api_name        => 'open-ils.actor.user.has_work_perm_at',
+       api_name        => 'sharestuff.actor.user.has_work_perm_at',
     authoritative => 1,
     signature => {
         desc => q/
@@ -996,7 +996,7 @@ 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',
+       api_name        => 'sharestuff.actor.user.has_work_perm_at.batch',
     authoritative => 1,
 );
 
@@ -1017,7 +1017,7 @@ sub user_has_work_perm_at_batch {
 
 __PACKAGE__->register_method(
        method => 'check_user_perms4',
-       api_name        => 'open-ils.actor.user.perm.highest_org.batch',
+       api_name        => 'sharestuff.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
@@ -1052,7 +1052,7 @@ sub check_user_perms4 {
 
 __PACKAGE__->register_method(
     method        => "user_fines_summary",
-    api_name      => "open-ils.actor.user.fines.summary",
+    api_name      => "sharestuff.actor.user.fines.summary",
     authoritative => 1,
     signature     => {
         desc   => 'Returns a short summary of the users total open fines, '  .
@@ -1085,7 +1085,7 @@ sub user_fines_summary {
 
 __PACKAGE__->register_method(
     method        => "user_opac_vitals",
-    api_name      => "open-ils.actor.user.opac.vital_stats",
+    api_name      => "sharestuff.actor.user.opac.vital_stats",
     argc          => 1,
     authoritative => 1,
     signature     => {
@@ -1113,7 +1113,7 @@ sub user_opac_vitals {
     my $user = $e->retrieve_actor_user( $user_id );
 
     my ($fines) = $self
-        ->method_lookup('open-ils.actor.user.fines.summary')
+        ->method_lookup('sharestuff.actor.user.fines.summary')
         ->run($auth => $user_id);
     return $fines if (defined($U->event_code($fines)));
 
@@ -1126,12 +1126,12 @@ sub user_opac_vitals {
     }
 
     my ($holds) = $self
-        ->method_lookup('open-ils.actor.user.hold_requests.count')
+        ->method_lookup('sharestuff.actor.user.hold_requests.count')
         ->run($auth => $user_id);
     return $holds if (defined($U->event_code($holds)));
 
     my ($out) = $self
-        ->method_lookup('open-ils.actor.user.checked_out.count')
+        ->method_lookup('sharestuff.actor.user.checked_out.count')
         ->run($auth => $user_id);
     return $out if (defined($U->event_code($out)));
 
@@ -1160,12 +1160,12 @@ my $common_params = [
     { desc => 'Options hash.  May contain limit and offset for paged results.', type => 'object' },
 ];
 my %methods = (
-    'open-ils.actor.user.transactions'                      => '',
-    'open-ils.actor.user.transactions.fleshed'              => '',
-    'open-ils.actor.user.transactions.have_charge'          => ' that have an initial charge',
-    'open-ils.actor.user.transactions.have_charge.fleshed'  => ' that have an initial charge',
-    'open-ils.actor.user.transactions.have_balance'         => ' that have an outstanding balance',
-    'open-ils.actor.user.transactions.have_balance.fleshed' => ' that have an outstanding balance',
+    'sharestuff.actor.user.transactions'                      => '',
+    'sharestuff.actor.user.transactions.fleshed'              => '',
+    'sharestuff.actor.user.transactions.have_charge'          => ' that have an initial charge',
+    'sharestuff.actor.user.transactions.have_charge.fleshed'  => ' that have an initial charge',
+    'sharestuff.actor.user.transactions.have_balance'         => ' that have an outstanding balance',
+    'sharestuff.actor.user.transactions.have_balance.fleshed' => ' that have an outstanding balance',
 );
 
 foreach (keys %methods) {
@@ -1190,9 +1190,9 @@ foreach (keys %methods) {
 
 # Now for the counts
 %methods = (
-    'open-ils.actor.user.transactions.count'              => '',
-    'open-ils.actor.user.transactions.have_charge.count'  => ' that have an initial charge',
-    'open-ils.actor.user.transactions.have_balance.count' => ' that have an outstanding balance',
+    'sharestuff.actor.user.transactions.count'              => '',
+    'sharestuff.actor.user.transactions.have_charge.count'  => ' that have an initial charge',
+    'sharestuff.actor.user.transactions.have_balance.count' => ' that have an outstanding balance',
 );
 
 foreach (keys %methods) {
@@ -1213,7 +1213,7 @@ foreach (keys %methods) {
 
 __PACKAGE__->register_method(
     method        => "user_transactions",
-    api_name      => "open-ils.actor.user.transactions.have_balance.total",
+    api_name      => "sharestuff.actor.user.transactions.have_balance.total",
     authoritative => 1,
     signature     => {
         desc   => 'For a given user, retrieve the total balance owed for open transactions,'
@@ -1243,7 +1243,7 @@ sub user_transactions {
         { 'balance_owed' => { '<>' => 0 } }:
         { 'total_owed' => { '>' => 0 } };
 
-    my $method = 'open-ils.actor.user.transactions.history.still_open';
+    my $method = 'sharestuff.actor.user.transactions.history.still_open';
     $method = "$method.authoritative" if $api =~ /authoritative/;
     my ($trans) = $self->method_lookup($method)->run($auth, $user_id, $type, $filter, $options);
 
@@ -1274,7 +1274,7 @@ sub user_transactions {
 
 __PACKAGE__->register_method(
     method   => "user_transaction_retrieve",
-    api_name => "open-ils.actor.user.transaction.fleshed.retrieve",
+    api_name => "sharestuff.actor.user.transaction.fleshed.retrieve",
     argc     => 1,
     authoritative => 1,
     notes    => "Returns a fleshed transaction record"
@@ -1282,7 +1282,7 @@ __PACKAGE__->register_method(
 
 __PACKAGE__->register_method(
     method   => "user_transaction_retrieve",
-    api_name => "open-ils.actor.user.transaction.retrieve",
+    api_name => "sharestuff.actor.user.transaction.retrieve",
     argc     => 1,
     authoritative => 1,
     notes    => "Returns a transaction record"
@@ -1348,7 +1348,7 @@ sub flesh_circ {
 
 __PACKAGE__->register_method(
     method        => "hold_request_count",
-    api_name      => "open-ils.actor.user.hold_requests.count",
+    api_name      => "sharestuff.actor.user.hold_requests.count",
     authoritative => 1,
     argc          => 1,
     notes         => 'Returns hold ready/total counts'
@@ -1389,7 +1389,7 @@ sub hold_request_count {
 
 __PACKAGE__->register_method(
     method        => "checked_out",
-    api_name      => "open-ils.actor.user.checked_out",
+    api_name      => "sharestuff.actor.user.checked_out",
     authoritative => 1,
     argc          => 2,
        signature     => {
@@ -1410,10 +1410,10 @@ __PACKAGE__->register_method(
 
 __PACKAGE__->register_method(
     method        => "checked_out",
-    api_name      => "open-ils.actor.user.checked_out.count",
+    api_name      => "sharestuff.actor.user.checked_out.count",
     authoritative => 1,
     argc          => 2,
-    signature     => q/@see open-ils.actor.user.checked_out/
+    signature     => q/@see sharestuff.actor.user.checked_out/
 );
 
 sub checked_out {
@@ -1476,10 +1476,10 @@ sub _checked_out {
 
 __PACKAGE__->register_method(
     method        => "checked_in_with_fines",
-    api_name      => "open-ils.actor.user.checked_in_with_fines",
+    api_name      => "sharestuff.actor.user.checked_in_with_fines",
     authoritative => 1,
     argc          => 2,
-    signature     => q/@see open-ils.actor.user.checked_out/
+    signature     => q/@see sharestuff.actor.user.checked_out/
 );
 
 sub checked_in_with_fines {
@@ -1524,7 +1524,7 @@ sub _sigmaker {
     my @sig = (
         argc      => 1,
         method    => "user_transaction_history",
-        api_name  => "open-ils.actor.user.transactions.$api",
+        api_name  => "sharestuff.actor.user.transactions.$api",
         signature => {
             desc   => "For a given User ID, returns a list of billable transaction" .
                       ($ids ? " id" : '') .
@@ -1640,21 +1640,21 @@ sub user_transaction_history {
 
 __PACKAGE__->register_method(
     method   => "retrieve_perms",
-    api_name => "open-ils.actor.permissions.retrieve",
+    api_name => "sharestuff.actor.permissions.retrieve",
     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",
+               "sharestuff.cstore",
+               "sharestuff.cstore.direct.permission.perm_list.search.atomic",
                { id => { '!=' => undef } }
        );
 }
 
 __PACKAGE__->register_method(
     method   => "retrieve_groups",
-    api_name => "open-ils.actor.groups.retrieve",
+    api_name => "sharestuff.actor.groups.retrieve",
     notes    => "Returns a list of user groups"
 );
 sub retrieve_groups {
@@ -1664,7 +1664,7 @@ sub retrieve_groups {
 
 __PACKAGE__->register_method(
     method   => "retrieve_groups_tree",
-    api_name => "open-ils.actor.groups.tree.retrieve",
+    api_name => "sharestuff.actor.groups.tree.retrieve",
     notes    => "Returns a list of user groups"
 );
        
@@ -1685,7 +1685,7 @@ sub retrieve_groups_tree {
 
 __PACKAGE__->register_method(
     method   => "add_user_to_groups",
-    api_name => "open-ils.actor.user.set_groups",
+    api_name => "sharestuff.actor.user.set_groups",
     notes    => "Adds a user to one or more permission groups"
 );
        
@@ -1701,12 +1701,12 @@ sub add_user_to_groups {
        return $evt if $evt;
 
        my $perms = $apputils->simplereq(
-               'open-ils.cstore',
-               'open-ils.cstore.direct.permission.usr_grp_map.search.atomic', { usr => $userid } );
+               'sharestuff.cstore',
+               'sharestuff.cstore.direct.permission.usr_grp_map.search.atomic', { usr => $userid } );
     for my $p (@$perms) {
                $apputils->simplereq(
-               'open-ils.cstore',
-               'open-ils.cstore.direct.permission.usr_grp_map.delete', $p );
+               'sharestuff.cstore',
+               'sharestuff.cstore.direct.permission.usr_grp_map.delete', $p );
     }
                
        for my $group (@$groups) {
@@ -1715,8 +1715,8 @@ sub add_user_to_groups {
                $link->usr($userid);
 
                my $id = $apputils->simplereq(
-                       'open-ils.cstore',
-                       'open-ils.cstore.direct.permission.usr_grp_map.create', $link );
+                       'sharestuff.cstore',
+                       'sharestuff.cstore.direct.permission.usr_grp_map.create', $link );
        }
 
        return 1;
@@ -1724,7 +1724,7 @@ sub add_user_to_groups {
 
 __PACKAGE__->register_method(
     method   => "get_user_perm_groups",
-    api_name => "open-ils.actor.user.get_groups",
+    api_name => "sharestuff.actor.user.get_groups",
     notes    => "Retrieve a user's permission groups."
 );
 
@@ -1737,13 +1737,13 @@ sub get_user_perm_groups {
        return $evt if $evt;
 
        return $apputils->simplereq(
-               'open-ils.cstore',
-               'open-ils.cstore.direct.permission.usr_grp_map.search.atomic', { usr => $userid } );
+               'sharestuff.cstore',
+               'sharestuff.cstore.direct.permission.usr_grp_map.search.atomic', { usr => $userid } );
 }      
 
 __PACKAGE__->register_method(
     method        => 'fetch_patron_note',
-    api_name      => 'open-ils.actor.note.retrieve.all',
+    api_name      => 'sharestuff.actor.note.retrieve.all',
     authoritative => 1,
     signature     => q/
                Returns a list of notes for a given user
@@ -1772,7 +1772,7 @@ sub fetch_patron_note {
                        return $evt if $evt;
                }
                return $U->cstorereq(
-                       'open-ils.cstore.direct.actor.usr_note.search.atomic', 
+                       'sharestuff.cstore.direct.actor.usr_note.search.atomic', 
                        { usr => $patronid, pub => 't' } );
        }
 
@@ -1780,12 +1780,12 @@ sub fetch_patron_note {
        return $evt if $evt;
 
        return $U->cstorereq(
-               'open-ils.cstore.direct.actor.usr_note.search.atomic', { usr => $patronid } );
+               'sharestuff.cstore.direct.actor.usr_note.search.atomic', { usr => $patronid } );
 }
 
 __PACKAGE__->register_method(
     method    => 'create_user_note',
-    api_name  => 'open-ils.actor.note.create',
+    api_name  => 'sharestuff.actor.note.create',
     signature => q/
                Creates a new note for the given user
                @param authtoken The login session key
@@ -1812,7 +1812,7 @@ sub create_user_note {
 
 __PACKAGE__->register_method(
     method    => 'delete_user_note',
-    api_name  => 'open-ils.actor.note.delete',
+    api_name  => 'sharestuff.actor.note.delete',
     signature => q/
                Deletes a note for the given user
                @param authtoken The login session key
@@ -1839,7 +1839,7 @@ sub delete_user_note {
 
 __PACKAGE__->register_method(
     method    => 'update_user_note',
-    api_name  => 'open-ils.actor.note.update',
+    api_name  => 'sharestuff.actor.note.update',
     signature => q/
                @param authtoken The login session key
                @param note The note
@@ -1862,7 +1862,7 @@ sub update_user_note {
 
 __PACKAGE__->register_method(
     method    => 'usrname_exists',
-    api_name  => 'open-ils.actor.username.exists',
+    api_name  => 'sharestuff.actor.username.exists',
     signature => {
         desc  => 'Check if a username is already taken (by an undeleted patron)',
         param => [
@@ -1887,11 +1887,11 @@ sub usrname_exists {
 # Retain the old typo API name just in case
 __PACKAGE__->register_method(
     method   => 'fetch_org_by_shortname',
-    api_name => 'open-ils.actor.org_unit.retrieve_by_shorname',
+    api_name => 'sharestuff.actor.org_unit.retrieve_by_shorname',
 );
 __PACKAGE__->register_method(
     method   => 'fetch_org_by_shortname',
-    api_name => 'open-ils.actor.org_unit.retrieve_by_shortname',
+    api_name => 'sharestuff.actor.org_unit.retrieve_by_shortname',
 );
 sub fetch_org_by_shortname {
        my( $self, $conn, $sname ) = @_;
@@ -1904,7 +1904,7 @@ sub fetch_org_by_shortname {
 
 __PACKAGE__->register_method(
     method   => 'session_home_lib',
-    api_name => 'open-ils.actor.session.home_lib',
+    api_name => 'sharestuff.actor.session.home_lib',
 );
 
 sub session_home_lib {
@@ -1917,7 +1917,7 @@ sub session_home_lib {
 
 __PACKAGE__->register_method(
     method    => 'session_safe_token',
-    api_name  => 'open-ils.actor.session.safe_token',
+    api_name  => 'sharestuff.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.
@@ -1949,11 +1949,11 @@ sub session_safe_token {
 
 __PACKAGE__->register_method(
     method    => 'safe_token_home_lib',
-    api_name  => 'open-ils.actor.safe_token.home_lib.shortname',
+    api_name  => 'sharestuff.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.
+               sharestuff.actor.session.safe_token.
                @param safe_token Active safe token
        /
 );
@@ -1968,7 +1968,7 @@ sub safe_token_home_lib {
 
 __PACKAGE__->register_method(
     method   => "user_retrieve_parts",
-    api_name => "open-ils.actor.user.retrieve.parts",
+    api_name => "sharestuff.actor.user.retrieve.parts",
 );
 
 sub user_retrieve_parts {
@@ -1988,7 +1988,7 @@ sub user_retrieve_parts {
 
 __PACKAGE__->register_method (
        method          => 'verify_user_password',
-       api_name        => 'open-ils.actor.verify_user_password',
+       api_name        => 'sharestuff.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.
index a17329c..003f809 100644 (file)
@@ -29,8 +29,8 @@ my $cache_client = "OpenSRF::Utils::Cache";
 sub start_db_session {
 
        my $self = shift;
-       my $session = OpenSRF::AppSession->connect( "open-ils.cstore" );
-       my $trans_req = $session->request( "open-ils.cstore.transaction.begin" );
+       my $session = OpenSRF::AppSession->connect( "sharestuff.cstore" );
+       my $trans_req = $session->request( "sharestuff.cstore.transaction.begin" );
 
        my $trans_resp = $trans_req->recv();
        if(ref($trans_resp) and UNIVERSAL::isa($trans_resp,"Error")) { throw $trans_resp; }
@@ -90,7 +90,7 @@ sub check_perms {
 sub commit_db_session {
        my( $self, $session ) = @_;
 
-       my $req = $session->request( "open-ils.cstore.transaction.commit" );
+       my $req = $session->request( "sharestuff.cstore.transaction.commit" );
        my $resp = $req->recv();
 
        if(!$resp) {
@@ -113,7 +113,7 @@ sub commit_db_session {
 sub rollback_db_session {
        my( $self, $session ) = @_;
 
-       my $req = $session->request("open-ils.cstore.transaction.rollback");
+       my $req = $session->request("sharestuff.cstore.transaction.rollback");
        my $resp = $req->recv();
        if(UNIVERSAL::isa($resp,"Error")) { throw $resp;  }
 
@@ -151,8 +151,8 @@ sub check_user_session {
        my( $self, $user_session ) = @_;
 
        my $content = $self->simplereq( 
-               'open-ils.auth', 
-               'open-ils.auth.session.retrieve', $user_session);
+               'sharestuff.auth', 
+               'sharestuff.auth.session.retrieve', $user_session);
 
     return undef if (!$content) or $self->event_code($content);
        return $content;
@@ -221,8 +221,8 @@ sub fetch_user {
        $logger->debug("Fetching user $userid from cstore");
 
        $user = $self->simplereq(
-               'open-ils.cstore',
-               'open-ils.cstore.direct.actor.user.retrieve', $userid );
+               'sharestuff.cstore',
+               'sharestuff.cstore.direct.actor.user.retrieve', $userid );
 
        if(!$user) {
                $logger->info("User $userid not found in the db");
@@ -287,8 +287,8 @@ 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 } });
+               'sharestuff.cstore', 
+               'sharestuff.cstore.direct.config.standing.search.atomic', { id => { '!=' => undef } });
 }
 
 
@@ -296,8 +296,8 @@ 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' );
+               'sharestuff.actor', 
+               'sharestuff.actor.groups.tree.retrieve' );
 }
 
 sub fetch_permission_group_descendants {
@@ -332,8 +332,8 @@ sub fetch_org_unit {
        my $evt = undef;
 
        my $org = $self->simplereq(
-               'open-ils.cstore', 
-               'open-ils.cstore.direct.actor.org_unit.retrieve', $id );
+               'sharestuff.cstore', 
+               'sharestuff.cstore.direct.actor.org_unit.retrieve', $id );
        $evt = ShareStuff::Event->new( 'ACTOR_ORG_UNIT_NOT_FOUND', id => $id ) unless $org;
        $ORG_CACHE{$id}  = $org;
 
@@ -345,8 +345,8 @@ sub fetch_stat_cat {
        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 );
+               'sharestuff.cstore', 
+               "sharestuff.cstore.direct.$type.stat_cat.retrieve", $id );
 
        my $e = 'ASSET_STAT_CAT_NOT_FOUND';
        $e = 'ACTOR_STAT_CAT_NOT_FOUND' if $type eq 'actor';
@@ -360,8 +360,8 @@ sub fetch_stat_cat_entry {
        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 );
+               'sharestuff.cstore', 
+               "sharestuff.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';
@@ -375,8 +375,8 @@ sub fetch_stat_cat_entry_default {
     my( $entry_default, $evt );
     $logger->debug("Fetching $type stat cat entry default: $id");
     $entry_default = $self->simplereq(
-        'open-ils.cstore', 
-        "open-ils.cstore.direct.$type.stat_cat_entry_default.retrieve", $id );
+        'sharestuff.cstore', 
+        "sharestuff.cstore.direct.$type.stat_cat_entry_default.retrieve", $id );
 
     my $e = 'ASSET_STAT_CAT_ENTRY_DEFAULT_NOT_FOUND';
     $e = 'ACTOR_STAT_CAT_ENTRY_DEFAULT_NOT_FOUND' if $type eq 'actor';
@@ -390,8 +390,8 @@ sub fetch_stat_cat_entry_default_by_stat_cat_and_org {
     my $entry_default;
     $logger->info("### Fetching $type stat cat entry default with stat_cat $stat_cat owned by org_unit $orgId");
     $entry_default = $self->simplereq(
-        'open-ils.cstore', 
-        "open-ils.cstore.direct.$type.stat_cat_entry_default.search.atomic", 
+        'sharestuff.cstore', 
+        "sharestuff.cstore.direct.$type.stat_cat_entry_default.search.atomic", 
         { stat_cat => $stat_cat, owner => $orgId } );
 
     $entry_default = $entry_default->[0];
@@ -423,7 +423,7 @@ sub DB_UPDATE_FAILED {
 sub storagereq {
        my( $self, $method, @params ) = @_;
        return $self->simplereq(
-               'open-ils.cstore', $method, @params );
+               'sharestuff.cstore', $method, @params );
 }
 
 sub storagereq_xact {
@@ -437,7 +437,7 @@ sub storagereq_xact {
 sub cstorereq {
        my( $self, $method, @params ) = @_;
        return $self->simplereq(
-               'open-ils.cstore', $method, @params );
+               'sharestuff.cstore', $method, @params );
 }
 
 sub event_equals {
@@ -782,366 +782,10 @@ sub strip_ctrl_chars {
        return $string;
 }
 
-sub get_copy_price {
-       my($self, $e, $copy, $volume) = @_;
-
-       $copy->price(0) 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 $default_price = $self->ou_ancestor_setting_value(
-               $owner, OILS_SETTING_DEF_ITEM_PRICE, $e) || 0;
-
-       return $default_price unless defined $copy->price;
-
-       # 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;
-}
-
-# given a transaction ID, this returns the context org_unit for the transaction
-sub xact_org {
-    my($self, $xact_id, $e) = @_;
-    $e ||= ShareStuff::CStoreEditor->new;
-    
-    my $loc = $e->json_query({
-        "select" => {circ => ["circ_lib"]},
-        from     => "circ",
-        "where"  => {id => $xact_id},
-    });
-
-    return $loc->[0]->{circ_lib} if @$loc;
-
-    $loc = $e->json_query({
-        "select" => {bresv => ["request_lib"]},
-        from     => "bresv",
-        "where"  => {id => $xact_id},
-    });
-
-    return $loc->[0]->{request_lib} if @$loc;
-
-    $loc = $e->json_query({
-        "select" => {mg => ["billing_location"]},
-        from     => "mg",
-        "where"  => {id => $xact_id},
-    });
-
-    return $loc->[0]->{billing_location};
-}
-
-
-sub find_event_def_by_hook {
-    my($self, $hook, $context_org, $e) = @_;
-
-    $e ||= ShareStuff::CStoreEditor->new;
-
-    my $orgs = $self->get_org_ancestors($context_org);
-
-    # search from the context org up
-    for my $org_id (reverse @$orgs) {
-
-        my $def = $e->search_action_trigger_event_definition(
-            {hook => $hook, owner => $org_id})->[0];
-
-        return $def if $def;
-    }
-
-    return undef;
-}
-
-
-
-# If an event_def ID is not provided, use the hook and context org to find the 
-# most appropriate event.  create the event, fire it, then return the resulting
-# event with fleshed template_output and error_output
-sub fire_object_event {
-    my($self, $event_def, $hook, $object, $context_org, $granularity, $user_data, $client) = @_;
-
-    my $e = ShareStuff::CStoreEditor->new;
-    my $def;
-
-    my $auto_method = "open-ils.trigger.event.autocreate.by_definition";
-
-    if($event_def) {
-        $def = $e->retrieve_action_trigger_event_definition($event_def)
-            or return $e->event;
-
-        $auto_method .= '.include_inactive';
-
-    } else {
-
-        # find the most appropriate event def depending on context org
-        $def = $self->find_event_def_by_hook($hook, $context_org, $e) 
-            or return $e->event;
-    }
-
-    my $final_resp;
-
-    if($def->group_field) {
-        # we have a list of objects
-        $object = [$object] unless ref $object eq 'ARRAY';
-
-        my @event_ids;
-        $user_data ||= [];
-        for my $i (0..$#$object) {
-            my $obj = $$object[$i];
-            my $udata = $$user_data[$i];
-            my $event_id = $self->simplereq(
-                'open-ils.trigger', $auto_method, $def->id, $obj, $context_org, $udata);
-            push(@event_ids, $event_id);
-        }
-
-        $logger->info("EVENTS = " . OpenSRF::Utils::JSON->perl2JSON(\@event_ids));
-
-        my $resp;
-        if (not defined $client) {
-            $resp = $self->simplereq(
-                'open-ils.trigger',
-                'open-ils.trigger.event_group.fire',
-                \@event_ids);
-        } else {
-            $resp = $self->patientreq(
-                $client,
-                "open-ils.trigger", "open-ils.trigger.event_group.fire",
-                \@event_ids
-            );
-        }
-
-        if($resp and $resp->{events} and @{$resp->{events}}) {
-
-            $e->xact_begin;
-            $final_resp = $e->retrieve_action_trigger_event([
-                $resp->{events}->[0]->id,
-                {flesh => 1, flesh_fields => {atev => ['template_output', 'error_output']}}
-            ]);
-            $e->rollback;
-        }
-
-    } else {
-
-        $object = $$object[0] if ref $object eq 'ARRAY';
-
-        my $event_id;
-        my $resp;
-
-        if (not defined $client) {
-            $event_id = $self->simplereq(
-                'open-ils.trigger',
-                $auto_method, $def->id, $object, $context_org, $user_data
-            );
-
-            $resp = $self->simplereq(
-                'open-ils.trigger',
-                'open-ils.trigger.event.fire',
-                $event_id
-            );
-        } else {
-            $event_id = $self->patientreq(
-                $client,
-                'open-ils.trigger',
-                $auto_method, $def->id, $object, $context_org, $user_data
-            );
-
-            $resp = $self->patientreq(
-                $client,
-                'open-ils.trigger',
-                'open-ils.trigger.event.fire',
-                $event_id
-            );
-        }
-        
-        if($resp and $resp->{event}) {
-            $e->xact_begin;
-            $final_resp = $e->retrieve_action_trigger_event([
-                $resp->{event}->id,
-                {flesh => 1, flesh_fields => {atev => ['template_output', 'error_output']}}
-            ]);
-            $e->rollback;
-        }
-    }
-
-    return $final_resp;
-}
-
-
-sub create_events_for_hook {
-    my($self, $hook, $obj, $org_id, $granularity, $user_data, $wait) = @_;
-    my $ses = OpenSRF::AppSession->create('open-ils.trigger');
-    my $req = $ses->request('open-ils.trigger.event.autocreate', 
-        $hook, $obj, $org_id, $granularity, $user_data);
-    return undef unless $wait;
-    my $resp = $req->recv;
-    return $resp->content if $resp;
-}
-
 sub create_uuid_string {
     return create_UUID_as_string();
 }
 
-sub create_circ_chain_summary {
-    my($class, $e, $circ_id) = @_;
-    my $sum = $e->json_query({from => ['action.summarize_circ_chain', $circ_id]})->[0];
-    return undef unless $sum;
-    my $obj = Fieldmapper::action::circ_chain_summary->new;
-    $obj->$_($sum->{$_}) for keys %$sum;
-    return $obj;
-}
-
-
-# Returns "mra" attribute key/value pairs for a set of bre's
-# Takes a list of bre IDs, returns a hash of hashes,
-# {bre_id1 => {key1 => {code => value1, label => label1}, ...}...}
-my $ccvm_cache;
-sub get_bre_attrs {
-    my ($class, $bre_ids, $e) = @_;
-    $e = $e || ShareStuff::CStoreEditor->new;
-
-    my $attrs = {};
-    return $attrs unless defined $bre_ids;
-    $bre_ids = [$bre_ids] unless ref $bre_ids;
-
-    my $mra = $e->json_query({
-        select => {
-            mra => [
-                {
-                    column => 'id',
-                    alias => 'bre'
-                }, {
-                    column => 'attrs',
-                    transform => 'each',
-                    result_field => 'key',
-                    alias => 'key'
-                },{
-                    column => 'attrs',
-                    transform => 'each',
-                    result_field => 'value',
-                    alias => 'value'
-                }
-            ]
-        },
-        from => 'mra',
-        where => {id => $bre_ids}
-    });
-
-    return $attrs unless $mra;
-
-    $ccvm_cache = $ccvm_cache || $e->search_config_coded_value_map({id => {'!=' => undef}});
-
-    for my $id (@$bre_ids) {
-        $attrs->{$id} = {};
-        for my $mra (grep { $_->{bre} eq $id } @$mra) {
-            my $ctype = $mra->{key};
-            my $code = $mra->{value};
-            $attrs->{$id}->{$ctype} = {code => $code};
-            if($code) {
-                my ($ccvm) = grep { $_->ctype eq $ctype and $_->code eq $code } @$ccvm_cache;
-                $attrs->{$id}->{$ctype}->{label} = $ccvm->value if $ccvm;
-            }
-        }
-    }
-
-    return $attrs;
-}
-
-# Shorter version of bib_container_items_via_search() below, only using
-# the queryparser record_list filter instead of the container filter.
-sub bib_record_list_via_search {
-    my ($class, $search_query, $search_args) = @_;
-
-    # First, Use search API to get container items sorted in any way that crad
-    # sorters support.
-    my $search_result = $class->simplereq(
-        "open-ils.search", "open-ils.search.biblio.multiclass.query",
-        $search_args, $search_query
-    );
-
-    unless ($search_result) {
-        # empty result sets won't cause this, but actual errors should.
-        $logger->warn("bib_record_list_via_search() got nothing from search");
-        return;
-    }
-
-    # Throw away other junk from search, keeping only bib IDs.
-    return [ map { pop @$_ } @{$search_result->{ids}} ];
-}
-
-# 'no_flesh' avoids fleshing the target_biblio_record_entry
-sub bib_container_items_via_search {
-    my ($class, $container_id, $search_query, $search_args, $no_flesh) = @_;
-
-    # First, Use search API to get container items sorted in any way that crad
-    # sorters support.
-    my $search_result = $class->simplereq(
-        "open-ils.search", "open-ils.search.biblio.multiclass.query",
-        $search_args, $search_query
-    );
-    unless ($search_result) {
-        # empty result sets won't cause this, but actual errors should.
-        $logger->warn("bib_container_items_via_search() got nothing from search");
-        return;
-    }
-
-    # Throw away other junk from search, keeping only bib IDs.
-    my $id_list = [ map { pop @$_ } @{$search_result->{ids}} ];
-
-    return [] unless @$id_list;
-
-    # Now get the bib container items themselves...
-    my $e = new ShareStuff::CStoreEditor;
-    unless ($e) {
-        $logger->warn("bib_container_items_via_search() couldn't get cstoreeditor");
-        return;
-    }
-
-    my @flesh_fields = qw/notes/;
-    push(@flesh_fields, 'target_biblio_record_entry') unless $no_flesh;
-
-    my $items = $e->search_container_biblio_record_entry_bucket_item([
-        {
-            "target_biblio_record_entry" => $id_list,
-            "bucket" => $container_id
-        }, {
-            flesh => 1,
-            flesh_fields => {"cbrebi" => \@flesh_fields}
-        }
-    ]);
-    unless ($items) {
-        $logger->warn(
-            "bib_container_items_via_search() couldn't get bucket items: " .
-            $e->die_event->{textcode}
-        );
-        return;
-    }
-
-    # ... and put them in the same order that the search API said they
-    # should be in.
-    my %ordering_hash = map { 
-        ($no_flesh) ? $_->target_biblio_record_entry : $_->target_biblio_record_entry->id, 
-        $_ 
-    } @$items;
-
-    return [map { $ordering_hash{$_} } @$id_list];
-}
-
 # returns undef on success, Event on error
 sub log_user_activity {
     my ($class, $user_id, $who, $what, $e, $async) = @_;
@@ -1171,119 +815,6 @@ sub log_user_activity {
     return undef;
 }
 
-# I hate to put this here exactly, but this code needs to be shared between
-# the TPAC's mod_perl module and open-ils.serial.
-#
-# There is a reason every part of the query *except* those parts dealing
-# with scope are moved here from the code's origin in TPAC.  The serials
-# use case does *not* want the same scoping logic.
-#
-# Also, note that for the serials uses case, we may filter in OPAC visible
-# status and copy/call_number deletedness, but we don't filter on any
-# particular values for serial.item.status or serial.item.date_received.
-# Since we're only using this *after* winnowing down the set of issuances
-# that copies should be related to, I'm not sure we need any such serial.item
-# filters.
-
-sub basic_opac_copy_query {
-    ######################################################################
-    # Pass a defined value for either $rec_id OR ($iss_id AND $dist_id), #
-    # not both.                                                          #
-    ######################################################################
-    my ($self,$rec_id,$iss_id,$dist_id,$copy_limit,$copy_offset,$staff) = @_;
-
-    return {
-        select => {
-            acp => ['id', 'barcode', 'circ_lib', 'create_date',
-                    'age_protect', 'holdable'],
-            acpl => [
-                {column => 'name', alias => 'copy_location'},
-                {column => 'holdable', alias => 'location_holdable'}
-            ],
-            ccs => [
-                {column => 'name', alias => 'copy_status'},
-                {column => 'holdable', alias => 'status_holdable'}
-            ],
-            acn => [
-                {column => 'label', alias => 'call_number_label'},
-                {column => 'id', alias => 'call_number'}
-            ],
-            circ => ['due_date'],
-            acnp => [
-                {column => 'label', alias => 'call_number_prefix_label'},
-                {column => 'id', alias => 'call_number_prefix'}
-            ],
-            acns => [
-                {column => 'label', alias => 'call_number_suffix_label'},
-                {column => 'id', alias => 'call_number_suffix'}
-            ],
-            bmp => [
-                {column => 'label', alias => 'part_label'},
-            ],
-            ($iss_id ? (sitem => ["issuance"]) : ())
-        },
-
-        from => {
-            acp => {
-                ($iss_id ? (
-                    sitem => {
-                        fkey => 'id',
-                        field => 'unit',
-                        filter => {issuance => $iss_id},
-                        join => {
-                            sstr => { }
-                        }
-                    }
-                ) : ()),
-                acn => {
-                    join => {
-                        acnp => { fkey => 'prefix' },
-                        acns => { fkey => 'suffix' }
-                    },
-                    filter => [
-                        {deleted => 'f'},
-                        ($rec_id ? {record => $rec_id} : ())
-                    ],
-                },
-                circ => { # If the copy is circulating, retrieve the open circ
-                    type => 'left',
-                    filter => {checkin_time => undef}
-                },
-                acpl => {
-                    ($staff ? () : (filter => { opac_visible => 't' }))
-                },
-                ccs => {
-                    ($staff ? () : (filter => { opac_visible => 't' }))
-                },
-                aou => {},
-                acpm => {
-                    type => 'left',
-                    join => {
-                        bmp => { type => 'left' }
-                    }
-                }
-            }
-        },
-
-        where => {
-            '+acp' => {
-                deleted => 'f',
-                ($staff ? () : (opac_visible => 't'))
-            },
-            ($dist_id ? ( '+sstr' => { distribution => $dist_id } ) : ()),
-            ($staff ? () : ( '+aou' => { opac_visible => 't' } ))
-        },
-
-        order_by => [
-            {class => 'aou', field => 'name'},
-            {class => 'acn', field => 'label'}
-        ],
-
-        limit => $copy_limit,
-        offset => $copy_offset
-    };
-}
-
 # Compare two dates, date1 and date2. If date2 is not defined, then
 # DateTime->now will be used. Assumes dates are in ISO8601 format as
 # supported by DateTime::Format::ISO8601. (A future enhancement might
@@ -1322,44 +853,5 @@ sub datecmp {
     return DateTime->compare($date1, $date2);
 }
 
-
-# marcdoc is an XML::LibXML document
-# updates the doc and returns the entityized MARC string
-sub strip_marc_fields {
-    my ($class, $e, $marcdoc, $grps) = @_;
-    
-    my $orgs = $class->get_org_ancestors($e->requestor->ws_ou);
-
-    my $query = {
-        select  => {vibtf => ['field']},
-        from    => {vibtf => 'vibtg'},
-        where   => {'+vibtg' => {owner => $orgs}},
-        distinct => 1
-    };
-
-    # give me always-apply groups plus any selected groups
-    if ($grps and @$grps) {
-        $query->{where}->{'+vibtg'}->{'-or'} = [
-            {id => $grps},
-            {always_apply => 't'}
-        ];
-
-    } else {
-        $query->{where}->{'+vibtg'}->{always_apply} = 't';
-    }
-
-    my $fields = $e->json_query($query);
-
-    for my $field (@$fields) {
-        my $tag = $field->{field};
-        for my $node ($marcdoc->findnodes('//*[@tag="'.$tag.'"]')) {
-            $node->parentNode->removeChild($node);
-        }
-    }
-
-       return $class->entityize($marcdoc->documentElement->toString);
-}
-
-
 1;
 
index 392cc74..86e044d 100644 (file)
@@ -52,7 +52,7 @@ sub new_editor { return ShareStuff::CStoreEditor->new(@_); }
 
 sub new_rstore_editor { 
        my $e = ShareStuff::CStoreEditor->new(@_); 
-       $e->app('open-ils.reporter-store');
+       $e->app('sharestuff.reporter-store');
        return $e;
 }
 
@@ -90,7 +90,7 @@ sub DESTROY {
 sub app {
        my( $self, $app ) = @_;
        $self->{app} = $app if $app;
-       $self->{app} = 'open-ils.cstore' unless $self->{app};
+       $self->{app} = 'sharestuff.cstore' unless $self->{app};
        return $self->{app};
 }
 
@@ -122,8 +122,8 @@ sub checkauth {
        $self->log(D, "checking auth token ".$self->authtoken);
 
        my $content = $U->simplereq( 
-               'open-ils.auth', 
-               'open-ils.auth.session.retrieve', $self->authtoken, 1);
+               'sharestuff.auth', 
+               'sharestuff.auth.session.retrieve', $self->authtoken, 1);
 
     if(!$content or $U->event_code($content)) {
         $self->event( ($content) ? $content : ShareStuff::Event->new('NO_SESSION'));