Bugzilla – Attachment 45259 Details for
Bug 15165
REST API routes to list, edit and pay borrower's accountlines
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15163: Do not erase patron attributes if limited to another library
Bug-15163-Do-not-erase-patron-attributes-if-limite.patch (text/plain), 5.28 KB, created by
Marc Véron
on 2015-12-01 12:55:30 UTC
(
hide
)
Description:
Bug 15163: Do not erase patron attributes if limited to another library
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2015-12-01 12:55:30 UTC
Size:
5.28 KB
patch
obsolete
>From a00d69d52f288663c35617d90f761b979e755aa8 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 1 Dec 2015 12:09:35 +0000 >Subject: [PATCH] Bug 15163: Do not erase patron attributes if limited to > another library >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >The patron attributes displayed on editing a patron are not displayed if >limited to another library. > >This is the easy but dirty way to fix this issue: It supposes that the >data are not sensitive as they are now displayed in the html document. >A better way to fix it would be to modify >C4::Members::Attributes::SetBorrowerAttributes to delete only attributes >we are editing. > >Test plan: >1/ Create 2 patron attributes, without branch limitations. >2/ Edit a patron and set a value for these attributes >3/ Limit a patron attributes to a library (one you are not logged in >with). >4/ Edit again the patron. >=> You should not see the limited attributes >5/ Edit the patron attributes and remove the branch limitation >=> Without this patch, it has been removed from the database and is not >displayed anymore. >=> With this patch, you should see it. > >Followed test plan, works as described. >Signed-off-by: Marc Véron <veron@veron.ch> > >http://bugs.koha-community.org/show_bug.cgi?id=15165 >--- > .../prog/en/modules/members/memberentrygen.tt | 14 +++++++++++--- > members/memberentry.pl | 8 +++++++- > 2 files changed, 18 insertions(+), 4 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index a3b7a9d..0dd9c2e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -1004,8 +1004,15 @@ > [% END %] > <ol class="attributes_table"> > [% FOREACH patron_attribute IN pa_loo.items %] >- <li data-category_code="[% patron_attribute.category_code %]"> >- <label for="[% patron_attribute.form_id %]">[% patron_attribute.description %]: </label> >+ [% IF patron_attribute.limited_to_another_branch %] >+ <input type="hidden" id="[% patron_attribute.form_id %]_code" name="[% patron_attribute.form_id %]_code" value="[% patron_attribute.code |html %]" /> >+ <input type="hidden" id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]" value="[% patron_attribute.value |html %]" /> >+ [% IF patron_attribute.password_allowed %] >+ <input type="hidden" name="[% patron_attribute.form_id%]_password" value="[% patron_attribute.password %]" /> >+ [% END %] >+ [% ELSE %] >+ <li data-category_code="[% patron_attribute.category_code %]"> >+ <label for="[% patron_attribute.form_id %]">[% patron_attribute.description %]: </label> > <input type="hidden" id="[% patron_attribute.form_id %]_code" name="[% patron_attribute.form_id %]_code" value="[% patron_attribute.code |html %]" /> > [% IF ( patron_attribute.use_dropdown ) %] > <select id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]"> >@@ -1033,7 +1040,8 @@ > [% IF ( patron_attribute.repeatable ) %] > <a href="#" class="clone-field" onclick="clone_entry(this); return false;">New</a> > [% END %] >- </li> >+ </li> >+ [% END %] > [% END %] > </ol> > [% IF pa_loo.class %]</fieldset>[% END %] >diff --git a/members/memberentry.pl b/members/memberentry.pl >index ae54383..2a7726e 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -745,7 +745,7 @@ sub patron_attributes_form { > my $template = shift; > my $borrowernumber = shift; > >- my @types = C4::Members::AttributeTypes::GetAttributeTypes(); >+ my @types = C4::Members::AttributeTypes::GetAttributeTypes(1, 1); > if (scalar(@types) == 0) { > $template->param(no_patron_attribute_types => 1); > return; >@@ -763,8 +763,13 @@ sub patron_attributes_form { > my @attribute_loop = (); > my $i = 0; > my %items_by_class; >+ my $user_branch = C4::Context->userenv->{"branch"}; > foreach my $type_code (map { $_->{code} } @types) { > my $attr_type = C4::Members::AttributeTypes->fetch($type_code); >+ my $limited_to_another_branch = 0; >+ if ( my $branch_limitations = $attr_type->branches ) { >+ $limited_to_another_branch = not grep { /^$user_branch$/ } @$branch_limitations; >+ } > my $entry = { > class => $attr_type->class(), > code => $attr_type->code(), >@@ -774,6 +779,7 @@ sub patron_attributes_form { > category => $attr_type->authorised_value_category(), > category_code => $attr_type->category_code(), > password => '', >+ limited_to_another_branch => $limited_to_another_branch, > }; > if (exists $attr_hash{$attr_type->code()}) { > foreach my $attr (@{ $attr_hash{$attr_type->code()} }) { >-- >1.7.10.4
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 15165
:
44804
|
44805
|
44806
|
45259
|
50189
|
50190
|
50191
|
50790
|
52681
|
52682
|
52683
|
55033
|
55034
|
55035
|
56694
|
56695
|
56696
|
57843
|
57844
|
57845
|
57846
|
59239
|
59240
|
59241
|
59242
|
59932
|
59933
|
59934
|
60180
|
62769
|
62770
|
62771
|
62772
|
62773
|
62774
|
62775