@@ -, +, @@
---
.../opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 15 ++++++--
opac/opac-shelves.pl | 45 ++++++++++++----------
2 files changed, 37 insertions(+), 23 deletions(-)
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt
+++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt
@@ -132,6 +132,8 @@
This item does not exist.
[% CASE 'unauthorized_on_view' %]
You do not have permission to view this list.
+ [% CASE 'unauthorized_on_insert' %]
+ You do not have permission to insert a new list.
[% CASE 'unauthorized_on_update' %]
You do not have permission to update this list.
[% CASE 'unauthorized_on_delete' %]
@@ -638,8 +640,15 @@
[% END %]
-
- [% IF shelves %]
+ [% IF loggedinusername %]
+
+ [% ELSE %]
+ [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
+
+ [% END %]
+ [% END %]
+
+ [% IF shelves.count %]
@@ -702,7 +711,7 @@
[% ELSE %]
[% IF category == PUBLIC %]
No public lists.
- [% ELSE %]
+ [% ELSIF loggedinusernumber %]
No private lists.
[% END %]
[% END %]
--- a/opac/opac-shelves.pl
+++ a/opac/opac-shelves.pl
@@ -63,27 +63,32 @@ if ( $op eq 'add_form' ) {
push @messages, { type => 'error', code => 'does_not_exist' };
}
} elsif ( $op eq 'add' ) {
- eval {
- $shelf = Koha::Virtualshelf->new(
- { shelfname => $query->param('shelfname'),
- sortfield => $query->param('sortfield'),
- category => $query->param('category') || 1,
- allow_add => $query->param('allow_add'),
- allow_delete_own => $query->param('allow_delete_own'),
- allow_delete_other => $query->param('allow_delete_other'),
- owner => $query->param('owner'),
- }
- );
- $shelf->store;
- $shelfnumber = $shelf->shelfnumber;
- };
- if ($@) {
- push @messages, { type => 'error', code => ref($@), msg => $@ };
- } elsif ( not $shelf ) {
- push @messages, { type => 'error', code => 'error_on_insert' };
+ if ( $loggedinuser ) {
+ eval {
+ $shelf = Koha::Virtualshelf->new(
+ { shelfname => $query->param('shelfname'),
+ sortfield => $query->param('sortfield'),
+ category => $query->param('category') || 1,
+ allow_add => $query->param('allow_add'),
+ allow_delete_own => $query->param('allow_delete_own'),
+ allow_delete_other => $query->param('allow_delete_other'),
+ owner => $loggedinuser,
+ }
+ );
+ $shelf->store;
+ $shelfnumber = $shelf->shelfnumber;
+ };
+ if ($@) {
+ push @messages, { type => 'error', code => ref($@), msg => $@ };
+ } elsif ( not $shelf ) {
+ push @messages, { type => 'error', code => 'error_on_insert' };
+ } else {
+ push @messages, { type => 'message', code => 'success_on_insert' };
+ $op = 'view';
+ }
} else {
- push @messages, { type => 'message', code => 'success_on_insert' };
- $op = 'view';
+ push @messages, { type => 'error', code => 'unauthorized_on_insert' };
+ $op = 'list';
}
} elsif ( $op eq 'edit' ) {
$shelfnumber = $query->param('shelfnumber');
--