View | Details | Raw Unified | Return to bug 21674
Collapse All | Expand All

(-)a/admin/library_groups.pl (-14 / +21 lines)
Lines 41-46 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
41
);
41
);
42
42
43
my $action = $cgi->param('action') || q{};
43
my $action = $cgi->param('action') || q{};
44
my @messages;
44
45
45
if ( $action eq 'add' ) {
46
if ( $action eq 'add' ) {
46
    my $parent_id   = $cgi->param('parent_id')   || undef;
47
    my $parent_id   = $cgi->param('parent_id')   || undef;
Lines 55-73 if ( $action eq 'add' ) { Link Here
55
        $template->param( error_duplicate_title => $title );
56
        $template->param( error_duplicate_title => $title );
56
    }
57
    }
57
    else {
58
    else {
58
        my $group = Koha::Library::Group->new(
59
        my $group = eval {
59
            {
60
            Koha::Library::Group->new(
60
                parent_id   => $parent_id,
61
                {
61
                title       => $title,
62
                    parent_id              => $parent_id,
62
                description => $description,
63
                    title                  => $title,
63
                ft_hide_patron_info    => $ft_hide_patron_info,
64
                    description            => $description,
64
                ft_search_groups_opac  => $ft_search_groups_opac,
65
                    ft_hide_patron_info    => $ft_hide_patron_info,
65
                ft_search_groups_staff => $ft_search_groups_staff,
66
                    ft_search_groups_opac  => $ft_search_groups_opac,
66
                branchcode  => $branchcode,
67
                    ft_search_groups_staff => $ft_search_groups_staff,
67
            }
68
                    branchcode             => $branchcode,
68
        )->store();
69
                }
69
70
            )->store();
70
        $template->param( added => $group );
71
        };
72
        if ($@) {
73
            push @messages, { type => 'alert', code => 'error_on_insert' };
74
        }
75
        else {
76
            $template->param( added => $group );
77
        }
71
    }
78
    }
72
}
79
}
73
elsif ( $action eq 'edit' ) {
80
elsif ( $action eq 'edit' ) {
Lines 114-119 elsif ( $action eq 'delete' ) { Link Here
114
121
115
my $root_groups = Koha::Library::Groups->get_root_groups();
122
my $root_groups = Koha::Library::Groups->get_root_groups();
116
123
117
$template->param( root_groups => $root_groups, );
124
$template->param( root_groups => $root_groups, messages => \@messages, );
118
125
119
output_html_with_http_headers $cgi, $cookie, $template->output;
126
output_html_with_http_headers $cgi, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/library_groups.tt (-1 / +11 lines)
Lines 18-23 Link Here
18
    &rsaquo; <a href="/cgi-bin/koha/admin/library_groups.pl">Library groups</a>
18
    &rsaquo; <a href="/cgi-bin/koha/admin/library_groups.pl">Library groups</a>
19
</div>
19
</div>
20
20
21
[% FOR m IN messages %]
22
    <div class="dialog [% m.type | html %]">
23
        [% SWITCH m.code %]
24
        [% CASE 'error_on_insert' %]
25
            An error occurred when adding this library. The library id might already exist in this group.
26
        [% CASE %]
27
            [% m.code | html %]
28
        [% END %]
29
    </div>
30
[% END %]
31
21
[% IF added %]
32
[% IF added %]
22
    <div class="dialog message group-added">
33
    <div class="dialog message group-added">
23
        [% IF added.branchcode %]
34
        [% IF added.branchcode %]
24
- 

Return to bug 21674