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 $type unless $self->is_true(ShareStuff::CStoreEditor->new->json_query($PERM_QUERY)->[0]->{has_perm});
}
return undef;
}
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 ShareStuff::Event->new('PERM_FAILURE', ilsperm => $t, ilspermloc => $org_id ) if $t;
return undef;
}
if(!$cd_obj) {
$logger->info("closed_date $cd not found in the db");
- $evt = OpenILS::Event->new('ACTOR_USER_NOT_FOUND');
+ $evt = ShareStuff::Event->new('ACTOR_USER_NOT_FOUND');
}
return ($cd_obj, $evt);
if(!$user) {
$logger->info("User $userid not found in the db");
- $evt = OpenILS::Event->new('ACTOR_USER_NOT_FOUND');
+ $evt = ShareStuff::Event->new('ACTOR_USER_NOT_FOUND');
}
return ($user, $evt);
sub checkses {
my( $self, $session ) = @_;
my $user = $self->check_user_session($session) or
- return (undef, OpenILS::Event->new('NO_SESSION'));
+ return (undef, ShareStuff::Event->new('NO_SESSION'));
return ($user);
}
'open-ils.cstore',
'open-ils.cstore.direct.asset.copy.retrieve', $copyid );
- if(!$copy) { $evt = OpenILS::Event->new('ASSET_COPY_NOT_FOUND'); }
+ if(!$copy) { $evt = ShareStuff::Event->new('ASSET_COPY_NOT_FOUND'); }
return( $copy, $evt );
}
"open-ils.cstore.direct.action.circulation.retrieve", $circid );
if(!$circ) {
- $evt = OpenILS::Event->new('ACTION_CIRCULATION_NOT_FOUND', circid => $circid );
+ $evt = ShareStuff::Event->new('ACTION_CIRCULATION_NOT_FOUND', circid => $circid );
}
return ( $circ, $evt );
);
if(!$record) {
- $evt = OpenILS::Event->new('BIBLIO_RECORD_ENTRY_NOT_FOUND');
+ $evt = ShareStuff::Event->new('BIBLIO_RECORD_ENTRY_NOT_FOUND');
} else {
$record = $record->call_number->record;
}
'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 = ShareStuff::Event->new('ACTION_HOLD_REQUEST_NOT_FOUND', holdid => $holdid) unless $hold;
return ($hold, $evt);
}
'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 = ShareStuff::Event->new('ACTION_HOLD_TRANSIT_COPY_NOT_FOUND', holdid => $holdid) unless $transit;
return ($transit, $evt );
}
cancel_time => undef,
} );
- $evt = OpenILS::Event->new('ACTION_HOLD_REQUEST_NOT_FOUND', copyid => $copyid) unless $hold;
+ $evt = ShareStuff::Event->new('ACTION_HOLD_REQUEST_NOT_FOUND', copyid => $copyid) unless $hold;
return ($hold, $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;
+ $evt = ShareStuff::Event->new('ACTION_HOLD_TRANSIT_COPY_NOT_FOUND', id => $transid) unless $htransit;
return ($htransit, $evt);
}
'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 = ShareStuff::Event->new('ASSET_COPY_NOT_FOUND', barcode => $barcode) unless $copy;
return ($copy, $evt);
}
'open-ils.cstore',
'open-ils.cstore.direct.money.open_billable_transaction_summary.retrieve', $transid);
- $evt = OpenILS::Event->new(
+ $evt = ShareStuff::Event->new(
'MONEY_OPEN_BILLABLE_TRANSACTION_SUMMARY_NOT_FOUND', transid => $transid ) unless $transaction;
return ($transaction, $evt);
'open-ils.cstore',
"open-ils.cstore.direct.container.$meth.retrieve", $id );
- $evt = OpenILS::Event->new(
+ $evt = ShareStuff::Event->new(
$e, container => $id, container_type => $type ) unless $bucket;
return ($bucket, $evt);
$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(
+ $evt = ShareStuff::Event->new(
$e, itemid => $id, container_type => $type ) unless $bucket;
return ($bucket, $evt);
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;
+ $evt = ShareStuff::Event->new('ASSET_COPY_LOCATION_NOT_FOUND') unless $cl;
return ($cl, $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;
+ $evt = ShareStuff::Event->new('ASSET_COPY_LOCATION_NOT_FOUND') unless $cl;
return ($cl, $evt);
}
sub fetch_callnumber {
my( $self, $id, $flesh, $e ) = @_;
- $e ||= OpenILS::Utils::CStoreEditor->new;
+ $e ||= ShareStuff::CStoreEditor->new;
- my $evt = OpenILS::Event->new( 'ASSET_CALL_NUMBER_NOT_FOUND', id => $id );
+ my $evt = ShareStuff::Event->new( 'ASSET_CALL_NUMBER_NOT_FOUND', id => $id );
return( undef, $evt ) unless $id;
$logger->debug("Fetching callnumber $id");
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;
+ $evt = ShareStuff::Event->new( 'ACTOR_ORG_UNIT_NOT_FOUND', id => $id ) unless $org;
$ORG_CACHE{$id} = $org;
return ($org, $evt);
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;
+ $evt = ShareStuff::Event->new( $e, id => $id ) unless $cat;
return ( $cat, $evt );
}
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;
+ $evt = ShareStuff::Event->new( $e, id => $id ) unless $entry;
return ( $entry, $evt );
}
my $e = 'ASSET_STAT_CAT_ENTRY_DEFAULT_NOT_FOUND';
$e = 'ACTOR_STAT_CAT_ENTRY_DEFAULT_NOT_FOUND' if $type eq 'actor';
- $evt = OpenILS::Event->new( $e, id => $id ) unless $entry_default;
+ $evt = ShareStuff::Event->new( $e, id => $id ) unless $entry_default;
return ( $entry_default, $evt );
}
my $e = 'ASSET_STAT_CAT_ENTRY_DEFAULT_NOT_FOUND';
$e = 'ACTOR_STAT_CAT_ENTRY_DEFAULT_NOT_FOUND' if $type eq 'actor';
- return (undef, OpenILS::Event->new($e) );
+ return (undef, ShareStuff::Event->new($e) );
}
sub find_org {
'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') );
+ return (undef, ShareStuff::Event->new('CONFIG_NON_CATALOGED_TYPE_NOT_FOUND') );
}
sub fetch_non_cat_type {
$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;
+ $evt = ShareStuff::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',
+ return ShareStuff::Event->new('DATABASE_UPDATE_FAILED',
payload => ($payload) ? $payload : undef );
}
}
} else {
- $evt = OpenILS::Event->new('RESERVATION_NOT_FOUND');
+ $evt = ShareStuff::Event->new('RESERVATION_NOT_FOUND');
}
return ($res, $evt);
'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;
+ $evt = ShareStuff::Event->new('CONFIG_RULES_CIRC_DURATION_NOT_FOUND') unless $dur;
return ($dur, $evt);
}
'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;
+ $evt = ShareStuff::Event->new('CONFIG_RULES_RECURRING_FINE_NOT_FOUND') unless $obj;
return ($obj, $evt);
}
'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;
+ $evt = ShareStuff::Event->new('CONFIG_RULES_MAX_FINE_NOT_FOUND') unless $obj;
return ($obj, $evt);
}
'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;
+ $evt = ShareStuff::Event->new('CONFIG_RULES_HARD_DUE_DATE_NOT_FOUND') unless $obj;
return ($obj, $evt);
}
my( $self, $cid ) = @_;
$self->logmark;
- my $e = OpenILS::Utils::CStoreEditor->new;
+ my $e = ShareStuff::CStoreEditor->new;
my $circ = $e->search_action_circulation({
target_copy => $cid,
stop_fines_time => undef,
$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;
+ $evt = ShareStuff::Event->new('ACTION_TRANSIT_COPY_NOT_FOUND') unless $transit;
return ($transit, $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;
+ $evt = ShareStuff::Event->new('MONEY_BILLABLE_TRANSACTION_NOT_FOUND') unless $xact;
return ($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;
+ $evt = ShareStuff::Event->new('MONEY_BILLABLE_TRANSACTION_NOT_FOUND') unless $xact;
return ($xact, $evt);
}
flesh_fields => { acp => [ qw/ circ_lib location status stat_cat_entries / ] }
}
);
- $evt = OpenILS::Event->new('ASSET_COPY_NOT_FOUND', id => $id) unless $copy;
+ $evt = ShareStuff::Event->new('ASSET_COPY_NOT_FOUND', id => $id) unless $copy;
return ($copy, $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;
+ $evt = ShareStuff::Event->new('ASSET_COPY_NOTE_NOT_FOUND', id => $id ) unless $note;
return ($note, $evt);
}
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;
+ return (undef, ShareStuff::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 (undef, ShareStuff::Event->new('ACTOR_USER_NOT_FOUND', card => $cardid)) unless $user;
return ($user);
}
$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;
+ my $evt = ShareStuff::Event->new('MONEY_BILLING_NOT_FOUND') unless $bill;
return($bill, $evt);
}
sub fetch_mbts {
my $self = shift;
my $id = shift;
- my $e = shift || OpenILS::Utils::CStoreEditor->new;
+ my $e = shift || ShareStuff::CStoreEditor->new;
$id = $id->id if ref($id);
my $xact = $e->retrieve_money_billable_transaction_summary($id)
sub ou_ancestor_setting_value {
my($self, $org_id, $name, $e) = @_;
- $e = $e || OpenILS::Utils::CStoreEditor->new;
+ $e = $e || ShareStuff::CStoreEditor->new;
my $set = $self->ou_ancestor_setting($org_id, $name, $e);
return $set->{value} if $set;
return undef;
sub ou_ancestor_setting {
my( $self, $orgid, $name, $e, $auth ) = @_;
- $e = $e || OpenILS::Utils::CStoreEditor->new(
+ $e = $e || ShareStuff::CStoreEditor->new(
(defined $auth) ? (authtoken => $auth) : ()
);
my $coust = $e->retrieve_config_org_unit_setting_type([
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();
+ return $org_types = ShareStuff::CStoreEditor->new->retrieve_all_actor_org_unit_type();
}
my %ORG_TREE;
my $tree = $ORG_TREE{$locale} || $cache->get_cache("orgtree.$locale");
return $tree if $tree;
- my $ses = OpenILS::Utils::CStoreEditor->new;
+ my $ses = ShareStuff::CStoreEditor->new;
$ses->session->session_locale($locale);
$tree = $ses->search_actor_org_unit(
[
};
$select->{params} = [$depth] if defined $depth;
- my $org_list = OpenILS::Utils::CStoreEditor->new->json_query({
+ my $org_list = ShareStuff::CStoreEditor->new->json_query({
select => {aou => [$select]},
from => 'aou',
where => {id => $org_id}
return $orgs if $orgs;
}
- my $org_list = OpenILS::Utils::CStoreEditor->new->json_query({
+ my $org_list = ShareStuff::CStoreEditor->new->json_query({
select => {
aou => [{
transform => 'actor.org_unit_ancestors',
};
$query->{select}->{aou}->[0]->{params} = [$depth] if defined $depth;
- my $org_list = OpenILS::Utils::CStoreEditor->new->json_query($query);
+ my $org_list = ShareStuff::CStoreEditor->new->json_query($query);
return [ map {$_->{id}} @$org_list ];
}
# returns the ID of the org unit ancestor at the specified depth
sub org_unit_ancestor_at_depth {
my($class, $org_id, $depth) = @_;
- my $resp = OpenILS::Utils::CStoreEditor->new->json_query(
+ my $resp = ShareStuff::CStoreEditor->new->json_query(
{from => ['actor.org_unit_ancestor_at_depth', $org_id, $depth]})->[0];
return ($resp) ? $resp->{id} : undef;
}
# 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;
+ $e ||= ShareStuff::CStoreEditor->new;
# first, see if the user has an explicit locale set
my $setting = $e->search_actor_user_setting(
# returns org locale setting
sub get_org_locale {
my($self, $org_id, $e) = @_;
- $e ||= OpenILS::Utils::CStoreEditor->new;
+ $e ||= ShareStuff::CStoreEditor->new;
my $locale;
if(defined $org_id) {
# given a transaction ID, this returns the context org_unit for the transaction
sub xact_org {
my($self, $xact_id, $e) = @_;
- $e ||= OpenILS::Utils::CStoreEditor->new;
+ $e ||= ShareStuff::CStoreEditor->new;
my $loc = $e->json_query({
"select" => {circ => ["circ_lib"]},
sub find_event_def_by_hook {
my($self, $hook, $context_org, $e) = @_;
- $e ||= OpenILS::Utils::CStoreEditor->new;
+ $e ||= ShareStuff::CStoreEditor->new;
my $orgs = $self->get_org_ancestors($context_org);
sub fire_object_event {
my($self, $event_def, $hook, $object, $context_org, $granularity, $user_data, $client) = @_;
- my $e = OpenILS::Utils::CStoreEditor->new;
+ my $e = ShareStuff::CStoreEditor->new;
my $def;
my $auto_method = "open-ils.trigger.event.autocreate.by_definition";
my $ccvm_cache;
sub get_bre_attrs {
my ($class, $bre_ids, $e) = @_;
- $e = $e || OpenILS::Utils::CStoreEditor->new;
+ $e = $e || ShareStuff::CStoreEditor->new;
my $attrs = {};
return $attrs unless defined $bre_ids;
return [] unless @$id_list;
# Now get the bib container items themselves...
- my $e = new OpenILS::Utils::CStoreEditor;
+ my $e = new ShareStuff::CStoreEditor;
unless ($e) {
$logger->warn("bib_container_items_via_search() couldn't get cstoreeditor");
return;
my $commit = 0;
if (!$e) {
- $e = OpenILS::Utils::CStoreEditor->new(xact => 1);
+ $e = ShareStuff::CStoreEditor->new(xact => 1);
$commit = 1;
}