Bugzilla – Attachment 25971 Details for
Bug 8262
Special kohaadmin cannot create lists
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8262: Special kohaadmin cannot create lists
Bug-8262-Special-kohaadmin-cannot-create-lists.patch (text/plain), 6.03 KB, created by
Marcel de Rooy
on 2014-03-10 07:54:56 UTC
(
hide
)
Description:
Bug 8262: Special kohaadmin cannot create lists
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2014-03-10 07:54:56 UTC
Size:
6.03 KB
patch
obsolete
>From 9bcb57e720d16810aa1d872ca5ab5bd792f2847b Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 3 Mar 2014 09:55:43 +0100 >Subject: [PATCH] Bug 8262: Special kohaadmin cannot create lists >Content-Type: text/plain; charset=utf-8 > >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 (kohaadmin). >In the incidental case that a normal user gets a database error, >he is 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 kohaadmin. >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> >--- > C4/VirtualShelves.pm | 1 + > C4/VirtualShelves/Page.pm | 6 ++++-- > .../prog/en/modules/virtualshelves/shelves.tt | 1 + > .../opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 1 + > .../opac-tmpl/prog/en/modules/opac-shelves.tt | 1 + > 5 files changed, 8 insertions(+), 2 deletions(-) > >diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm >index f5a6758..863ca37 100644 >--- a/C4/VirtualShelves.pm >+++ b/C4/VirtualShelves.pm >@@ -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; > } >diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm >index 609dcca..559bb15 100644 >--- a/C4/VirtualShelves/Page.pm >+++ b/C4/VirtualShelves/Page.pm >@@ -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 ); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >index b2db5e4..4d8253e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt >@@ -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 shelfnumber given.</div>[% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >index d5ce5d7..fa20932 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -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 %] >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt >index 5bbebca..658fe4e 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-shelves.tt >@@ -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 %] >-- >1.7.7.6
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8262
:
25756
|
25757
|
25971
|
26066
|
26526