Bug 8262: explicitly warn that database admin account cannot create lists
Since kohaadmin has no borrower number, it cannot create lists. A database error is logged, but the user is not notified. This patch alerts the user. In the incidental case that a normal user gets a database error, they are notified too that the list could not be created. Test plan (for prog and bootstrap): * This patch should be applied on top of 9032 patches. * Login as as the database admin user * Create a list in opac and staff. Check the message. * Login as a normal user. * Force a database error on list creation (I renamed category in the table with alter table change column..) * You should have a different error message. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Works as described, passes tests and QA script. Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
parent
1931d2d22f
commit
080c05eee2
5 changed files with 8 additions and 2 deletions
|
@ -334,6 +334,7 @@ sub AddShelf {
|
|||
$hashref->{allow_add}//0,
|
||||
$hashref->{allow_delete_own}//1,
|
||||
$hashref->{allow_delete_other}//0 );
|
||||
return if $sth->err;
|
||||
my $shelfnumber = $dbh->{'mysql_insertid'};
|
||||
return $shelfnumber;
|
||||
}
|
||||
|
|
|
@ -337,7 +337,7 @@ sub shelfpage {
|
|||
#Add a shelf
|
||||
if ( my $newshelf = $query->param('addshelf') ) {
|
||||
|
||||
# note: a user can always add a new shelf
|
||||
# note: a user can always add a new shelf (except kohaadmin)
|
||||
my $shelfnumber = AddShelf( {
|
||||
shelfname => $newshelf,
|
||||
sortfield => $query->param('sortfield'),
|
||||
|
@ -348,7 +348,9 @@ sub shelfpage {
|
|||
},
|
||||
$query->param('owner') );
|
||||
$stay = 1;
|
||||
if ( $shelfnumber == -1 ) { #shelf already exists.
|
||||
if( !$shelfnumber ) {
|
||||
push @paramsloop, { addshelf_failed => 1 };
|
||||
} elsif ( $shelfnumber == -1 ) { #shelf already exists.
|
||||
$showadd = 1;
|
||||
push @paramsloop, { already => $newshelf };
|
||||
$template->param( shelfnumber => $shelfnumber );
|
||||
|
|
|
@ -228,6 +228,7 @@ function placeHold () {
|
|||
<div class="yui-ge">
|
||||
<div class="yui-u first">
|
||||
[% IF ( paramsloo.already ) %]<div class="dialog alert">A List named [% paramsloo.already %] already exists!</div>[% END %]
|
||||
[% IF ( paramsloo.addshelf_failed ) %]<div class="dialog alert">List could not be created. [% IF loggedinuser==0 %](Do not use the database administrator account.)[% END %]</div>[% END %]
|
||||
[% IF ( paramsloo.status ) %]<div class="dialog alert">[% paramsloo.string %]</div>[% END %]
|
||||
[% IF ( paramsloo.nobarcode ) %]<div class="dialog alert">ERROR: No barcode given.</div>[% END %]
|
||||
[% IF ( paramsloo.noshelfnumber ) %]<div class="dialog alert">ERROR: No list number given.</div>[% END %]
|
||||
|
|
|
@ -109,6 +109,7 @@
|
|||
[% IF ( paramsloop ) %]
|
||||
[% FOREACH paramsloo IN paramsloop %]
|
||||
[% IF ( paramsloo.already ) %]<div class="alert">A list named <b>[% paramsloo.already %]</b> already exists!</div>[% END %]
|
||||
[% IF ( paramsloo.addshelf_failed ) %]<div class="dialog alert">List could not be created. [% IF loggedinuser==0 %](Do not use the database administrator account.)[% END %]</div>[% END %]
|
||||
[% IF ( paramsloo.status ) %]<div class="alert">[% paramsloo.string %]</div>[% END %]
|
||||
[% IF ( paramsloo.nobarcode ) %]<div class="alert">ERROR: No barcode given.</div>[% END %]
|
||||
[% IF ( paramsloo.noshelfnumber ) %]<div class="alert">ERROR: No shelfnumber given.</div>[% END %]
|
||||
|
|
|
@ -261,6 +261,7 @@ $(document).ready(function() {
|
|||
<div class="yui-ge">
|
||||
<div class="yui-u first">
|
||||
[% IF ( paramsloo.already ) %]<div class="dialog alert">A list named <b>[% paramsloo.already %]</b> already exists!</div>[% END %]
|
||||
[% IF ( paramsloo.addshelf_failed ) %]<div class="dialog alert">List could not be created. [% IF loggedinuser==0 %](Do not use the database administrator account.)[% END %]</div>[% END %]
|
||||
[% IF ( paramsloo.status ) %]<div class="dialog alert">[% paramsloo.string %]</div>[% END %]
|
||||
[% IF ( paramsloo.nobarcode ) %]<div class="dialog alert">ERROR: No barcode given.</div>[% END %]
|
||||
[% IF ( paramsloo.noshelfnumber ) %]<div class="dialog alert">ERROR: No shelfnumber given.</div>[% END %]
|
||||
|
|
Loading…
Reference in a new issue