- Improved factory templates
- added the status() attribute, although it's not used in many places
yet
+ Maypole::Model::CDBI
+ - improved error messages in do_edit action
Bug fixes:
Fix to cgi_maypole.t (bug 11346)
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 ($self->{tt}->process($template_file, { $self->vars($r) }, \$output )) {
$r->{output} = $output;
return OK;
- }
- else {
+ } else {
$r->{error} = "TT error for template '$template_file'\n" . $self->{tt}->error;
return ERROR;
}