fixed thinko in delete
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 16 Nov 2005 16:36:17 +0000 (16:36 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 16 Nov 2005 16:36:17 +0000 (16:36 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2042 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm

index 54dbbca..fed6a6a 100644 (file)
@@ -135,7 +135,9 @@ sub fast_fieldmapper {
 sub retrieve {
        my $self = shift;
        my $arg = shift;
-       if (ref($arg) and UNIVERSAL::isa($arg => 'Fieldmapper')) {
+       if (ref($arg) &&
+               (UNIVERSAL::isa($arg => 'Fieldmapper') ||
+                UNIVERSAL::isa($arg => 'Class::DBI')) ) {
                my ($col) = $self->primary_column;
                $log->debug("Using field $col as the primary key", INTERNAL);
                $arg = $arg->$col;
@@ -277,11 +279,7 @@ sub delete {
 
        my $class = ref($self) || $self;
 
-       if (ref($arg) and UNIVERSAL::isa($arg => 'Fieldmapper')) {
-               $arg = $arg->id;
-       }
-
-       $self = $self->retrieve($arg);
+       $self = $self->retrieve($arg) if (!ref($self));
        unless (defined $self) {
                $log->debug("ARG! Couldn't retrieve record ".$arg->id, DEBUG);
                throw OpenSRF::EX::WARN ("ARG! Couldn't retrieve record ");