From d338b911e9b7372063b87c86eee913ea1ab83a30 Mon Sep 17 00:00:00 2001 From: erickson Date: Fri, 27 Jan 2006 16:56:46 +0000 Subject: [PATCH] checking all non-cat types in my orgs for an existing type git-svn-id: svn://svn.open-ils.org/ILS/trunk@2860 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../perlmods/OpenILS/Application/Circ/NonCat.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm index 3966dfaa54..577ca0f019 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/NonCat.pm @@ -28,16 +28,19 @@ sub create_noncat_type { my( $staff, $evt ) = $U->checkses($authtoken); return $evt if $evt; - my $type; - - # first, see if the exact type already exists XXX this needs to be ranged - ($type, $evt) = $U->fetch_non_cat_type_by_name_and_org($name, $orgId); - return OpenILS::Event->new('NON_CAT_TYPE_EXISTS') if $type; + # grab all of "my" non-cat types and see if one with + # the requested name already exists + my $types = $self->retrieve_noncat_types_all($client, $orgId); + if(ref($types)) { + for(@$types) { + return OpenILS::Event->new('NON_CAT_TYPE_EXISTS') if $_->name eq $name; + } + } $evt = $U->check_perms( $staff->id, $orgId, 'CREATE_NON_CAT_TYPE' ); return $evt if $evt; - $type = Fieldmapper::config::non_cataloged_type->new; + my $type = Fieldmapper::config::non_cataloged_type->new; $type->name($name); $type->owning_lib($orgId); -- 2.43.2