From 0934f348c75b19af94f44de80d78a752f5b8b161 Mon Sep 17 00:00:00 2001 From: erickson Date: Fri, 2 Feb 2007 16:03:48 +0000 Subject: [PATCH] added event for duplicate bucket creation errors git-svn-id: svn://svn.open-ils.org/ILS/trunk@6848 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/extras/ils_events.xml | 3 +++ .../OpenILS/Application/Actor/Container.pm | 20 ++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) 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; } -- 2.43.2