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 {
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 ?