Bugzilla – Attachment 41003 Details for
Bug 14354
Only superlibrarian should see edit links for other branches' items in staff detail
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14354: Prevent edition of items from other branches if IndependentBranches is on
Bug-14354-Prevent-edition-of-items-from-other-bran.patch (text/plain), 4.30 KB, created by
Jonathan Druart
on 2015-07-14 17:15:04 UTC
(
hide
)
Description:
Bug 14354: Prevent edition of items from other branches if IndependentBranches is on
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-07-14 17:15:04 UTC
Size:
4.30 KB
patch
obsolete
>From a9f9c6577eea9448c0788d41f3bd8be2c9ff6421 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 14 Jul 2015 18:07:37 +0100 >Subject: [PATCH] Bug 14354: Prevent edition of items from other branches if > IndependentBranches is on > >If IdependentBranches is ON, to edit/delete items from other branches >you need to be superlibrarian. >Currently a "simple" staff user cannot edit them from the edit item page >but from the catalogue detail page. > >The edit links should not be displayed on this table. > >Test plan: >O/ Set IndependentBranches to "Prevent". >Create a record and add 2 items: > Set homebranch to L1 for item I1. > Set homebranch to L2 for item I2. >1/ With a superlibrarian user, you should be able to edit both items. >2/ With a "simple" user attached to L1, you should only be able to edit >I1. The edit links should not be displayed for I2. > >Note that the checkbox is displayed on the catalogue detail page (item >list), but on the batch tools, it won't be possible to select non-modifiable >items. > >TODO: Add a server-side check. Indeed it is still possible to edit an >item if the user know the url. >--- > catalogue/detail.pl | 9 ++++++++- > koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt | 7 +++++-- > 2 files changed, 13 insertions(+), 3 deletions(-) > >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index b7ba9a4..2a6dddb 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -199,7 +199,6 @@ if ($currentbranch and C4::Context->preference('SeparateHoldings')) { > my $separatebranch = C4::Context->preference('SeparateHoldingsBranch') || 'homebranch'; > foreach my $item (@items) { > my $itembranchcode = $item->{$separatebranch}; >- $item->{homebranch} = GetBranchName($item->{homebranch}); > > # can place holds defaults to yes > $norequests = 0 unless ( ( $item->{'notforloan'} > 0 ) || ( $item->{'itemnotforloan'} > 0 ) ); >@@ -279,6 +278,14 @@ foreach my $item (@items) { > $item->{'course_reserves'} = GetItemCourseReservesInfo( itemnumber => $item->{'itemnumber'} ); > } > >+ if ( C4::Context->preference('IndependentBranches') ) { >+ my $userenv = C4::Context->userenv(); >+ if ( not C4::Context->IsSuperLibrarian() >+ and $userenv->{branch} ne $item->{homebranch} ) { >+ $item->{cannot_be_edited} = 1; >+ } >+ } >+ > if ($currentbranch and $currentbranch ne "NO_LIBRARY_SET" > and C4::Context->preference('SeparateHoldings')) { > if ($itembranchcode and $itembranchcode eq $currentbranch) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index 41730f5..73a97a9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -1,6 +1,7 @@ > [% USE Koha %] > [% USE KohaDates %] > [% USE AuthorisedValues %] >+[% USE Branches %] > > [% ShowCourseReserves = 0 %] > [% IF UseCourseReserves %] >@@ -624,7 +625,7 @@ function verify_images() { > </td> > [% END %] > <td class="location">[% UNLESS ( singlebranchmode ) %][% item.branchname %] [% END %]</td> >- <td class="homebranch">[% item.homebranch %]<span class="shelvingloc">[% item.location %]</span> </td> >+ <td class="homebranch">[% Branches.GetName(item.homebranch) %]<span class="shelvingloc">[% item.location %]</span> </td> > [% IF ( itemdata_ccode ) %]<td>[% item.ccode %]</td>[% END %] > <td class="itemcallnumber">[% IF ( item.itemcallnumber ) %] [% item.itemcallnumber %][% END %]</td> > <td class="status"> >@@ -806,8 +807,10 @@ function verify_images() { > [% END %] > </td> > [% END %] >- [% IF ( CAN_user_editcatalogue_edit_items ) %] >+ [% IF CAN_user_editcatalogue_edit_items and not item.cannot_be_edited %] > <td><a href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=[% item.biblionumber %]&itemnumber=[% item.itemnumber %]#edititem">Edit</a></td> >+ [% ELSE %] >+ <td></td> > [% END %] > </tr> > [% END %] >-- >2.1.0
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 14354
:
41003
|
42334
|
42362