From: Chris W. <la...@us...> - 2004-10-02 22:07:00
|
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Action In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4741 Modified Files: Common.pm Log Message: OIN-43: apply slightly modified version of Salve's patch -- I had the field/alias order reversed...; also add docs Index: Common.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/Action/Common.pm,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Common.pm 27 Sep 2004 04:48:44 -0000 1.17 --- Common.pm 2 Oct 2004 22:05:05 -0000 1.18 *************** *** 170,177 **** my $object_class = $self->param( 'c_object_class' ); my $field_map = eval { $object_class->CONFIG->{field_map} } || {}; ! $alt_id_field = $field_map->{ $id_field }; if ( $alt_id_field ) { $id = $self->param( $alt_id_field ) || $request->param( $alt_id_field ); } } --- 170,181 ---- my $object_class = $self->param( 'c_object_class' ); my $field_map = eval { $object_class->CONFIG->{field_map} } || {}; ! my %reverse_map = map { $field_map->{ $_ } => $_ } keys %{ $field_map }; ! $alt_id_field = $reverse_map{ $id_field } || $field_map->{ $id_field }; if ( $alt_id_field ) { + $log->is_debug && + $log->debug( "Using mapped ID field '$alt_id_field'" ); $id = $self->param( $alt_id_field ) || $request->param( $alt_id_field ); + $self->param( c_id_field => $alt_id_field ); } } *************** *** 520,536 **** =over 4 ! =item * Is there an action parameter with the name C<c_id>? ! =item * Is there an action parameter with the same name as the ID field? ! =item * Is there a request parameter with the same name as the ID field? ! =item * Is there a request parameter with the name 'id'? --- 524,540 ---- =over 4 ! =item 1. Is there an action parameter with the name C<c_id>? ! =item 1. Is there an action parameter with the same name as the ID field? ! =item 1. Is there a request parameter with the same name as the ID field? ! =item 1. Is there a request parameter with the name 'id'? *************** *** 538,544 **** =back ! The first check that finds an ID is used. If no ID is found the check ! fails. If an ID is found it is set in the action parameter C<c_id> so ! you do not need to do the lookup. B<_common_check_template_specified( @template_parameters )> --- 542,550 ---- =back ! The first check that finds an ID is used. If no ID is found and there ! is a corresponding entry in an SPOPS object 'field_map' configuration ! we rerun checks 2 and 3 above with the new ID field. If no ID value is ! still found the check fails. If an ID is found its value is set in the ! action parameter C<c_id> so you do not need to do the lookup. B<_common_check_template_specified( @template_parameters )> |