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

(-)a/admin/library_groups.pl (-15 / +22 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 56-75 if ( $action eq 'add' ) { Link Here
56
        $template->param( error_duplicate_title => $title );
57
        $template->param( error_duplicate_title => $title );
57
    }
58
    }
58
    else {
59
    else {
59
        my $group = Koha::Library::Group->new(
60
        my $group = eval {
60
            {
61
            Koha::Library::Group->new(
61
                parent_id   => $parent_id,
62
                {
62
                title       => $title,
63
                    parent_id              => $parent_id,
63
                description => $description,
64
                    title                  => $title,
64
                ft_hide_patron_info    => $ft_hide_patron_info,
65
                    description            => $description,
65
                ft_search_groups_opac  => $ft_search_groups_opac,
66
                    ft_hide_patron_info    => $ft_hide_patron_info,
66
                ft_search_groups_staff => $ft_search_groups_staff,
67
                    ft_search_groups_opac  => $ft_search_groups_opac,
67
                ft_local_hold_group => $ft_local_hold_group,
68
                    ft_search_groups_staff => $ft_search_groups_staff,
68
                branchcode  => $branchcode,
69
                    ft_local_hold_group    => $ft_local_hold_group,
69
            }
70
                    branchcode             => $branchcode,
70
        )->store();
71
                }
71
72
            )->store();
72
        $template->param( added => $group );
73
        };
74
        if ($@) {
75
            push @messages, { type => 'alert', code => 'error_on_insert' };
76
        }
77
        else {
78
            $template->param( added => $group );
79
        }
73
    }
80
    }
74
}
81
}
75
elsif ( $action eq 'edit' ) {
82
elsif ( $action eq 'edit' ) {
Lines 118-123 elsif ( $action eq 'delete' ) { Link Here
118
125
119
my $root_groups = Koha::Library::Groups->get_root_groups();
126
my $root_groups = Koha::Library::Groups->get_root_groups();
120
127
121
$template->param( root_groups => $root_groups, );
128
$template->param( root_groups => $root_groups, messages => \@messages, );
122
129
123
output_html_with_http_headers $cgi, $cookie, $template->output;
130
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