- my $group = Koha::Library::Group->new(
- {
- parent_id => $parent_id,
- title => $title,
- description => $description,
- branchcode => $branchcode,
- }
- )->store();
-
- $template->param( added => $group );
+ my $group = eval {
+ Koha::Library::Group->new(
+ {
+ parent_id => $parent_id,
+ title => $title,
+ description => $description,
+ ft_hide_patron_info => $ft_hide_patron_info,
+ ft_search_groups_opac => $ft_search_groups_opac,
+ ft_search_groups_staff => $ft_search_groups_staff,
+ ft_local_hold_group => $ft_local_hold_group,
+ branchcode => $branchcode,
+ }
+ )->store();
+ };
+ if ($@) {
+ push @messages, { type => 'alert', code => 'error_on_insert' };
+ }
+ else {
+ $template->param( added => $group );
+ }