default("MESSAGE1",$template);
}
else {
- ModBranch($params);
- $template->param( else => 1 );
- default("MESSAGE2",$template);
+ my $error = ModBranch($params);
+ # if error saving, stay on edit and rise error
+ if ($error) {
+ # copy input parameters back to form
+ # FIXME - doing this doesn't preserve any branch group selections, but good enough for now
+ $template->param(%$params);
+ $template->param(branch_name => $params->{branchname});
+ $template->param( 'heading-branches-add-branch-p' => 1, 'add' => 1, "ERROR$error" => 1 );
+ } else {
+ $template->param( else => 1);
+ default("MESSAGE2",$template);
+ }
}
}
elsif ( $op eq 'delete' ) {