if (%errors) {
# Set it up as it was:
$r->template_args->{cgi_params} = $r->params;
- $r->template_args->{errors} = \%errors;
+
+ #
+ # replace user unfriendly error messages with something nicer
+
+ foreach (@{$config->{$table}->{required_cols}}) {
+ next unless ($errors{$_});
+ my $key = $_;
+ s/_/ /g;
+ $r->template_args->{errors}{ucfirst($_)} = 'This field is required, please provide a valid value';
+ $r->template_args->{errors}{$key} = 'This field is required, please provide a valid value';
+ delete $errors{$key};
+ }
+
+ foreach (keys %errors) {
+ my $key = $_;
+ s/_/ /g;
+ $r->template_args->{errors}{ucfirst($_)} = 'Please provide a valid value for this field';
+ $r->template_args->{errors}{$key} = 'Please provide a valid value for this field';
+ }
undef $obj if $creating;
$r->template("edit");
eval { $obj->update_from_cgi( $h => {
required => $required_cols,
ignore => $ignored_cols,
- } ) };
+ } );
+ $obj->update(); # pos fix for bug 17132 'autoupdate required by do_edit'
+ };
$fatal = $@;
} else {
eval {
}
+=head2 delete
+
+Deprecated method that calls do_delete or a given classes delete method, please
+use do_delete instead
+
=head2 do_delete
Unsuprisingly, this command causes a database record to be forever lost.
$self->list($r);
}
+=head2 search
+
+Deprecated searching method - use do_search instead.
=head2 do_search
if $namespace->debug;
}
+=head2 class_of
+
+ returns class for given table
+
+=cut
+
sub class_of {
my ( $self, $r, $table ) = @_;
return $r->config->loader->_table2class($table); # why not find_class ?
}
+=head2 fetch_objects
+
+Returns 1 or more objects of the given class when provided with the request
+
+=cut
+
sub fetch_objects {
my ($class, $r)=@_;
my @pcs = $class->primary_columns;