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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt (-3 / +12 lines)
Lines 132-137 Link Here
132
                        This item does not exist.
132
                        This item does not exist.
133
                    [% CASE 'unauthorized_on_view' %]
133
                    [% CASE 'unauthorized_on_view' %]
134
                        You do not have permission to view this list.
134
                        You do not have permission to view this list.
135
                    [% CASE 'unauthorized_on_insert' %]
136
                        You do not have permission to insert a new list.
135
                    [% CASE 'unauthorized_on_update' %]
137
                    [% CASE 'unauthorized_on_update' %]
136
                        You do not have permission to update this list.
138
                        You do not have permission to update this list.
137
                    [% CASE 'unauthorized_on_delete' %]
139
                    [% CASE 'unauthorized_on_delete' %]
Lines 637-644 Link Here
637
                            <div id="publicshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
639
                            <div id="publicshelves" class="ui-tabs-panel ui-widget-content ui-corner-bottom" style="display:block;">
638
                        [% END %]
640
                        [% END %]
639
641
640
                            <div id="toolbar" class="toolbar"><a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?op=add_form">New list</a></div>
642
                            [% IF loggedinusername %]
641
                            [% IF shelves %]
643
                                <div id="toolbar" class="toolbar"><a class="newshelf" href="/cgi-bin/koha/opac-shelves.pl?op=add_form">New list</a></div>
644
                            [% ELSE %]
645
                                [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
646
                                    <div class="alert alert-info"><a href="/cgi-bin/koha/opac-user.pl">Log in</a> to create new lists.</div>
647
                                [% END %]
648
                            [% END %]
649
650
                            [% IF shelves.count %]
642
                                <table class="table">
651
                                <table class="table">
643
                                    <thead>
652
                                    <thead>
644
                                        <tr>
653
                                        <tr>
Lines 701-707 Link Here
701
                            [% ELSE %]
710
                            [% ELSE %]
702
                                [% IF category == PUBLIC %]
711
                                [% IF category == PUBLIC %]
703
                                    <p>No public lists.</p>
712
                                    <p>No public lists.</p>
704
                                [% ELSE %]
713
                                [% ELSIF loggedinusernumber %]
705
                                    <p>No private lists.</p>
714
                                    <p>No private lists.</p>
706
                                [% END %]
715
                                [% END %]
707
                            [% END %]
716
                            [% END %]
(-)a/opac/opac-shelves.pl (-21 / +25 lines)
Lines 63-89 if ( $op eq 'add_form' ) { Link Here
63
        push @messages, { type => 'error', code => 'does_not_exist' };
63
        push @messages, { type => 'error', code => 'does_not_exist' };
64
    }
64
    }
65
} elsif ( $op eq 'add' ) {
65
} elsif ( $op eq 'add' ) {
66
    eval {
66
    if ( $loggedinuser ) {
67
        $shelf = Koha::Virtualshelf->new(
67
        eval {
68
            {   shelfname          => $query->param('shelfname'),
68
            $shelf = Koha::Virtualshelf->new(
69
                sortfield          => $query->param('sortfield'),
69
                {   shelfname          => $query->param('shelfname'),
70
                category           => $query->param('category') || 1,
70
                    sortfield          => $query->param('sortfield'),
71
                allow_add          => $query->param('allow_add'),
71
                    category           => $query->param('category') || 1,
72
                allow_delete_own   => $query->param('allow_delete_own'),
72
                    allow_add          => $query->param('allow_add'),
73
                allow_delete_other => $query->param('allow_delete_other'),
73
                    allow_delete_own   => $query->param('allow_delete_own'),
74
                owner              => $query->param('owner'),
74
                    allow_delete_other => $query->param('allow_delete_other'),
75
            }
75
                    owner              => $loggedinuser,
76
        );
76
                }
77
        $shelf->store;
77
            );
78
        $shelfnumber = $shelf->shelfnumber;
78
            $shelf->store;
79
    };
79
            $shelfnumber = $shelf->shelfnumber;
80
    if ($@) {
80
        };
81
        push @messages, { type => 'error', code => ref($@), msg => $@ };
81
        if ($@) {
82
    } elsif ( not $shelf ) {
82
            push @messages, { type => 'error', code => ref($@), msg => $@ };
83
        push @messages, { type => 'error', code => 'error_on_insert' };
83
        } elsif ( not $shelf ) {
84
            push @messages, { type => 'error', code => 'error_on_insert' };
85
        } else {
86
            push @messages, { type => 'message', code => 'success_on_insert' };
87
            $op = 'view';
88
        }
84
    } else {
89
    } else {
85
        push @messages, { type => 'message', code => 'success_on_insert' };
90
        push @messages, { type => 'error', code => 'unauthorized_on_insert' };
86
        $op = 'view';
91
        $op = 'list';
87
    }
92
    }
88
} elsif ( $op eq 'edit' ) {
93
} elsif ( $op eq 'edit' ) {
89
    $shelfnumber = $query->param('shelfnumber');
94
    $shelfnumber = $query->param('shelfnumber');
90
- 

Return to bug 14544