From: erickson Date: Fri, 2 Feb 2007 16:03:48 +0000 (+0000) Subject: added event for duplicate bucket creation errors X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=251ce8cf66b4ccba9c66a953f3266f27183c8b3e;p=Evergreen.git added event for duplicate bucket creation errors git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_0@6848 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/extras/ils_events.xml b/Open-ILS/src/extras/ils_events.xml index f34d79cc49..46fc303bd7 100644 --- a/Open-ILS/src/extras/ils_events.xml +++ b/Open-ILS/src/extras/ils_events.xml @@ -574,6 +574,9 @@ User has reached the maximum number of holds + + User has already created a bucket with the requested name + diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Actor/Container.pm b/Open-ILS/src/perlmods/OpenILS/Application/Actor/Container.pm index 02bb79ecc3..56065860cc 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Actor/Container.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Actor/Container.pm @@ -194,31 +194,37 @@ sub bucket_create { $bucket->clear_id; - $logger->debug("creating bucket: " . Dumper($bucket)); + my $evt = OpenILS::Event->new('CONTAINER_EXISTS', + payload => [$class, $bucket->owner, $bucket->btype, $bucket->name]); + my $search = {name => $bucket->name, owner => $bucket->owner, btype => $bucket->btype}; - my $stat; + my $obj; if( $class eq 'copy' ) { + return $evt if $e->search_container_copy_bucket($search)->[0]; return $e->event unless - $stat = $e->create_container_copy_bucket($bucket); + $obj = $e->create_container_copy_bucket($bucket); } if( $class eq 'callnumber' ) { + return $evt if $e->search_container_call_number_bucket($search)->[0]; return $e->event unless - $stat = $e->create_container_call_number_bucket($bucket); + $obj = $e->create_container_call_number_bucket($bucket); } if( $class eq 'biblio' ) { + return $evt if $e->search_container_biblio_record_entry_bucket($search)->[0]; return $e->event unless - $stat = $e->create_container_biblio_record_entry_bucket($bucket); + $obj = $e->create_container_biblio_record_entry_bucket($bucket); } if( $class eq 'user') { + return $evt if $e->search_container_user_bucket($search)->[0]; return $e->event unless - $stat = $e->create_container_user_bucket($bucket); + $obj = $e->create_container_user_bucket($bucket); } $e->commit; - return $stat->id; + return $obj->id; }