$kill = 1;
}
- # grab the user with the given card
+ # grab the user with the given id
my $ureq = $session->request(
- "open-ils.storage.direct.actor.user.retrieve",
- $id);
+ "open-ils.storage.direct.actor.user.retrieve", $id);
my $user = $ureq->gather(1);
# grab the cards
$user->id() );
$user->cards( $cards_req->gather(1) );
+ for my $c(@{$user->cards}) {
+ if($c->id == $user->card || $c->id eq $user->card ) {
+ warn "Setting my card to " . $c->id . "\n";
+ $user->card($c);
+ }
+ }
+
my $add_req = $session->request(
"open-ils.storage.direct.actor.user_address.search.usr",
$user->id() );
$user->addresses( $add_req->gather(1) );
+ for my $c(@{$user->addresses}) {
+ if($c->id == $user->billing_address || $c->id eq $user->billing_address ) {
+ warn "Setting my address to " . $c->id . "\n";
+ $user->billing_address($c);
+ }
+ }
+
+ for my $c(@{$user->addresses}) {
+ if($c->id == $user->mailing_address || $c->id eq $user->mailing_address ) {
+ warn "Setting my address to " . $c->id . "\n";
+ $user->mailing_address($c);
+ }
+ }
+
my $stat_req = $session->request(
"open-ils.storage.direct.actor.stat_cat_entry_user_map.search.target_usr",
$user->id() );
my( $self, $client, $user_session, $org_id ) = @_;
- my $user_obj =
- OpenILS::Application::AppUtils->check_user_session( $user_session ); #throws EX on error
-
- if(!$org_id) {
- $org_id = $user_obj->home_ou;
+ if(defined($user_session) && !defined($org_id)) {
+ my $user_obj =
+ OpenILS::Application::AppUtils->check_user_session( $user_session ); #throws EX on error
+ if(!defined($org_id)) {
+ $org_id = $user_obj->home_ou;
+ }
}
+
my $home_ou = OpenILS::Application::AppUtils->simple_scalar_request(
"open-ils.storage",
"open-ils.storage.direct.actor.org_unit.retrieve",
sub update_password {
my( $self, $client, $user_session, $new_value, $current_password ) = @_;
- my $user_obj = $apputils->check_user_session($user_session);
warn "Updating user with method " .$self->api_name . "\n";
+ my $user_obj = $apputils->check_user_session($user_session);
if($self->api_name =~ /password/) {
}
elsif($self->api_name =~ /email/) {
+ warn "Updating email to $new_value\n";
$user_obj->email($new_value);
}
__PACKAGE__->register_method(
method => "check_user_perms",
- api_name => "open-ils.actor.user.email.update");
+ api_name => "open-ils.actor.user.perm.check");
sub check_user_perms {
my( $self, $client, $user_id, $org_id, @perm_types ) = @_;
my $name = "open-ils.storage.direct.actor.user.search.usrname";
+ warn "Completing Authentication\n";
+
+ warn "Retrieving user from storage..\n";
my $user_list = OpenILS::Application::AppUtils->simple_scalar_request(
"open-ils.storage", $name, $username );
("No user info returned from storage for $username");
}
+ warn "We have the user from storage with usrname $username\n";
+
my $user = $user_list->[0];
}
my $password = $user->passwd();
+ warn "user passwd is $password\n";
if(!$password) {
throw OpenSRF::EX::ERROR ("No password exists for $username", ERROR);
}
+ warn "we have a password\n";
+
my $current_seed = $cache_handle->get_cache("_open-ils_seed_$username");
$cache_handle->delete_cache( "_open-ils_seed_$username" );
+ warn "Removed tmp data from cache\n";
+
unless($current_seed) {
throw OpenSRF::EX::User
("User must call open-ils.auth.init_authenticate first (or respond faster)");
} else {
+ warn "User password is incorrect...\n"; # send exception
return 0;
}
}
use OpenILS::Application::Circ::Rules;
use OpenILS::Application::Circ::Survey;
use OpenILS::Application::Circ::StatCat;
-#use OpenILS::Application::Circ::Actor;
+use OpenILS::Application::Circ::Holds;
use OpenILS::Application::AppUtils;
my $apputils = "OpenILS::Application::AppUtils";
my $req = $session->request( $method, $hold );
my $resp = $req->gather(1);
+ $session->disconnect();
if(!$resp) { return OpenILS::EX->new("UNKNOWN")->ex(); }
# $apputils->commit_db_session($session);
}
}
+__PACKAGE__->register_method(
+ method => "retrieve_holds",
+ api_name => "open-ils.circ.holds.retrieve",
+ notes => <<NOTE);
+Retrieves all the holds for the specified user id. The login session
+is the requestor and if the requestor is different from the user, then
+the requestor must have VIEW_HOLDS permissions.
+NOTE
+
+sub retrieve_holds {
+ my($self, $client, $login_session, $user_id) = @_;
+ my $user = $apputils->check_user_session($login_session);
+
+ if($user->id ne $user_id) {
+ if($apputils->check_user_perms($user_id, $user->home_ou, "VIEW_HOLDS")) {
+ return OpenILS::Perm->new("VIEW_HOLDS");
+ }
+ }
+
+ my $session = OpenSRF::AppSession->create("open-ils.storage");
+ my $req = $session->request(
+ "open-ils.storage.direct.action.hold_request.search.usr",
+ $user_id );
+ my $h = $req->gather(1);
+ $session->disconnect();
+ return $h;
+}
+
+
+
+
1;
+# ---------------------------------------------------------------
+# Copyright (C) 2005 Georgia Public Library Service
+# Bill Erickson <highfalutin@gmail.com>
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# ---------------------------------------------------------------
+
package OpenILS::Application::Circ::Rules;
use base qw/OpenSRF::Application/;
use strict; use warnings;
+# ---------------------------------------------------------------
+# Copyright (C) 2005 Georgia Public Library Service
+# Bill Erickson <highfalutin@gmail.com>
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# ---------------------------------------------------------------
+
package OpenILS::Application::Circ::StatCat;
use base qw/OpenSRF::Application/;
use strict; use warnings;
+# ---------------------------------------------------------------
+# Copyright (C) 2005 Georgia Public Library Service
+# Bill Erickson <highfalutin@gmail.com>
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# ---------------------------------------------------------------
+
package OpenILS::Application::Circ::Survey;
use base qw/OpenSRF::Application/;
use strict; use warnings;
my $apputils = "OpenILS::Application::AppUtils";
-#open-ils.storage.direct.action.survey.search.*
-
-
-
-
# - 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");
__PACKAGE__->register_method(
- method => "fleshed_copy_retrieve",
+ method => "fleshed_copy_retrieve_batch",
api_name => "open-ils.search.asset.copy.fleshed.batch.retrieve",
);
-# turns a barcode into a copy object
-sub fleshed_copy_retrieve {
+sub fleshed_copy_retrieve_batch {
my( $self, $client, $ids ) = @_;
throw OpenSRF::EX::InvalidArg
return $copy;
}
+__PACKAGE__->register_method(
+ method => "fleshed_copy_retrieve",
+ api_name => "open-ils.search.asset.copy.fleshed.retrieve",
+);
+
+sub fleshed_copy_retrieve_batch {
+ my( $self, $client, $id ) = @_;
+
+ return undef unless defined $id;
+ warn "copy retrieve for id $id\n";
+ return OpenILS::Application::AppUtils->simple_scalar_request(
+ "open-ils.storage",
+ "open-ils.storage.fleshed.asset.copy.retrieve.atomic",
+ $id );
+}
+
__PACKAGE__->register_method(
warn "Searching for record for MR $mrid\n";
- my $mrmaps = OpenILS::Application::AppUtils->simple_scalar_request( "open-ils.storage",
- "open-ils.storage.direct.metabib.metarecord_source_map.search.metarecord", $mrid );
+ my $mrmaps = OpenILS::Application::AppUtils->simple_scalar_request(
+ "open-ils.storage",
+ #"open-ils.storage.direct.metabib.metarecord_source_map.search.metarecord", $mrid );
+ "open-ils.storage.ordered.metabib.metarecord.records.atomic",
+ $mrid );
- my @ids;
- for my $map (@$mrmaps) { push @ids, $map->source(); }
- warn "Recovered id's [@ids] for mr $mrid\n";
+ #my @ids;
+ #for my $map (@$mrmaps) { push @ids, $map->source(); }
+ #warn "Recovered id's [@ids] for mr $mrid\n";
+ #my $size = @ids;
- my $size = @ids;
+ my $size = @$mrmaps;
- return { count => $size, ids => \@ids };
+ return { count => $size, ids => $mrmaps };
}
}
+__PACKAGE__->register_method(
+ method => "copy_counts_per_org",
+ api_name => "open-ils.search.biblio.copy_counts.retrieve");
+
+sub copy_counts_per_org {
+ my( $self, $client, $record_id ) = @_;
+ my $counts = $apputils->simple_scalar_request(
+ "open-ils.storage",
+ "open-ils.storage.biblio.record_entry.global_copy_count.atomic",
+ $record_id );
+ $counts = [ sort {$a->[0] <=> $b->[0]} @$counts ];
+ return $counts;
+}
+
+
+
1;
subject => {
topic =>
- "//mods:mods/*[local-name()='subject']",
+ "//mods:mods/mods:subject/*[local-name()!='geographicCode']/parent::mods:subject",
# geographic =>
# "//mods:mods/*[local-name()='subject']/*[local-name()='geographic']",