From: Bill Erickson Date: Fri, 1 Aug 2014 19:24:30 +0000 (-0400) Subject: LP#1347774 CStoreEditor pcrud needs object 'type' and 'hint' info at rumtime X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=8e95a19d3d7c3780e791dedd26feeb6f21cd63e5;p=working%2FEvergreen.git LP#1347774 CStoreEditor pcrud needs object 'type' and 'hint' info at rumtime Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm index 87f11d0f50..e04c686203 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Utils/CStoreEditor.pm @@ -743,7 +743,7 @@ sub __arg_to_string { # return $e->event unless @$results; # ----------------------------------------------------------------------------- sub runmethod { - my( $self, $action, $type, $arg, $options ) = @_; + my( $self, $action, $type, $hint, $arg, $options ) = @_; $options ||= {}; @@ -762,7 +762,7 @@ sub runmethod { my @arg = ( ref($arg) eq 'ARRAY' ) ? @$arg : ($arg); my $method = ''; if ($self->personality eq 'open-ils.pcrud') { - $method = $self->app.".$action.$type"; + $method = $self->app.".$action.$hint"; } else { $method = $self->app.".direct.$type.$action"; } @@ -919,14 +919,10 @@ sub init { my $map = $Fieldmapper::fieldmap; for my $object (keys %$map) { my $obj = __fm2meth($object, '_'); - my $type; - if (__PACKAGE__->personality eq 'open-ils.pcrud') { - $type = $object->json_hint; - } else { - $type = __fm2meth($object, '.'); - } + my $type = __fm2meth($object, '.'); + my $hint = $object->json_hint; foreach my $command (qw/ update retrieve search create delete batch_retrieve retrieve_all /) { - eval "sub ${command}_$obj {return shift()->runmethod('$command', '$type', \@_);}\n"; + eval "sub ${command}_$obj {return shift()->runmethod('$command', '$type', '$hint', \@_);}\n"; } # TODO: performance test against concatenating a big string of all the subs and eval'ing only ONCE. }