Bugzilla – Attachment 59898 Details for
Bug 13757
Make patron attributes editable in the opac if set to 'editable in OPAC'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13757: Better display for attr changes in members-update.pl
Bug-13757-Better-display-for-attr-changes-in-membe.patch (text/plain), 9.14 KB, created by
Tomás Cohen Arazi (tcohen)
on 2017-02-03 18:35:32 UTC
(
hide
)
Description:
Bug 13757: Better display for attr changes in members-update.pl
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2017-02-03 18:35:32 UTC
Size:
9.14 KB
patch
obsolete
>From 6ba62f70c2a68579833cadeb5a4174513f04c0b1 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 3 Feb 2017 15:22:57 -0300 >Subject: [PATCH] Bug 13757: Better display for attr changes in > members-update.pl > >This patch changes the way changed attributes are displayed for the >staff user to make the decision to approve (or not) the changes. > >Regards >--- > koha-tmpl/intranet-tmpl/prog/css/staff-global.css | 4 ++ > .../prog/en/modules/members/members-update.tt | 49 +++++++++++++++++++--- > members/members-update.pl | 44 +++++++++++-------- > 3 files changed, 73 insertions(+), 24 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/css/staff-global.css >index eb924101b6..8dec66201c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css >+++ b/koha-tmpl/intranet-tmpl/prog/css/staff-global.css >@@ -152,6 +152,10 @@ label input[type="radio"], > font-weight : bold; > } > >+.members-update-table { >+ padding-top: 10px; >+} >+ > #navmenulist li { > padding : .2em 0; > list-style-image : url("../img/arrow-bullet.gif"); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt >index 5e65ed7c15..0466490144 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt >@@ -1,3 +1,4 @@ >+[% USE AuthorisedValues %] > [% USE Branches %] > [% USE Categories %] > [% USE KohaDates %] >@@ -68,8 +69,22 @@ > [% END %] > > [% BLOCK display_extended_attributes %] >- [% FOREACH attr IN attributes %] >- <span>[% attr.code %]: [% IF pending %][% attr.value %][% ELSE %][% attr.attribute %][% END %]</span><br/> >+ [% IF attrs and attrs.size > 1 %] >+ <ul> >+ [% FOREACH attr IN attrs %] >+ <li>[% PROCESS display_attribute attr=attr type=type %]</li> >+ [% END %] >+ <ul> >+ [% ELSIF attrs %] >+ [% PROCESS display_attribute attr=attrs.0 type=type %] >+ [% END %] >+[% END %] >+ >+[% BLOCK display_attribute %] >+ [% IF type.authorised_value_category %] >+ [% AuthorisedValues.GetByCode(type.authorised_value_category,attr.attribute) %] >+ [% ELSE %] >+ [% attr.attribute %] > [% END %] > [% END %] > >@@ -99,6 +114,10 @@ > <label for="ignore_modify_[% pm.borrowernumber %]">Ignore</label> > | <a target="_blank" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% pm.borrowernumber %]" >Patron details</a> > </div> >+ [% IF !pm.extended_attributes and pm.size > 3 or >+ pm.extended_attributes and pm.size > 4 %] >+ [%# timestamp+verification_token+borrowernumber=3 %] >+ <div class="members-update-table"> > <table> > <tr> > <th>Field</th> >@@ -108,7 +127,7 @@ > > > [% FOREACH key IN pm.keys %] >- [% IF ( key != "timestamp" ) %] >+ [% IF ( key != "timestamp" and key != "extended_attributes" ) %] > [% IF ( ( pm.$key OR borrowers.$borrowernumber.$key ) && ( pm.$key != borrowers.$borrowernumber.$key ) ) %] > <tr> > <td>[% PROCESS display_names field = key %]</td> >@@ -118,9 +137,6 @@ > [% ELSIF key == 'branchcode' %] > <td>[% Branches.GetName( borrowers.$borrowernumber.$key ) %]</td> > <td>[% Branches.GetName( pm.$key ) %]</td> >- [% ELSIF ( key == 'extended_attributes' ) %] >- <td>[% PROCESS display_extended_attributes attributes=borrowers.$borrowernumber.$key %]</td> >- <td>[% PROCESS display_extended_attributes attributes=pm.$key pending=1 %]</td> > [% ELSE %] > <td>[% borrowers.$borrowernumber.$key %]</td> > <td>[% pm.$key %]</td> >@@ -130,6 +146,27 @@ > [% END %] > [% END %] > </table> >+ </div> >+ [% END %] >+ [% IF borrowers.$borrowernumber.modified_attributes %] >+ <div class="members-update-table"> >+ <h4>[% PROCESS display_names field='extended_attributes' %]</h4> >+ <table> >+ <tr> >+ <th>Field</th> >+ <th>Old value</th> >+ <th>New value</th> >+ </tr> >+ [% FOREACH attribute_group IN borrowers.$borrowernumber.modified_attributes %] >+ <tr> >+ <td>[% attribute_group.type.description %]</td> >+ <td>[% PROCESS display_extended_attributes attrs=attribute_group.before type=attribute_group.type %]</td> >+ <td>[% PROCESS display_extended_attributes attrs=attribute_group.after type=attribute_group.type %]</td> >+ </tr> >+ [% END %] >+ </table> >+ </div> >+ [% END %] > </div> > [% END %] > </div> >diff --git a/members/members-update.pl b/members/members-update.pl >index 851af14050..23d14c7c01 100755 >--- a/members/members-update.pl >+++ b/members/members-update.pl >@@ -24,14 +24,17 @@ use C4::Auth; > use C4::Output; > use C4::Context; > use C4::Members; >+use Koha::Patron::Attribute::Types; > use Koha::Patron::Attributes; > use Koha::Patron::Modifications; >+use Koha::Patrons; >+ >+use List::MoreUtils qw( uniq ); > > my $query = new CGI; > > my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( >- { >- template_name => "members/members-update.tt", >+ { template_name => "members/members-update.tt", > query => $query, > type => "intranet", > authnotrequired => 0, >@@ -40,26 +43,31 @@ my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( > } > ); > >-my $branch = >- ( C4::Context->preference("IndependentBranchesPatronModifications") >- || C4::Context->preference("IndependentBranches") ) >- && !$flags->{'superlibrarian'} >- ? C4::Context->userenv()->{'branch'} >- : undef; >+my $branch >+ = ( C4::Context->preference("IndependentBranchesPatronModifications") >+ || C4::Context->preference("IndependentBranches") ) >+ && !$flags->{'superlibrarian'} >+ ? C4::Context->userenv()->{'branch'} >+ : undef; > >-my $pending_modifications = >- Koha::Patron::Modifications->pending($branch); >+my $pending_modifications = Koha::Patron::Modifications->pending($branch); > > my $borrowers; > foreach my $pm (@$pending_modifications) { >- $borrowers->{ $pm->{borrowernumber} } >- = GetMember( borrowernumber => $pm->{borrowernumber} ); >- my @patron_attributes >- = grep { $_->opac_editable } >- Koha::Patron::Attributes->search( >- { borrowernumber => $pm->{borrowernumber} } ); >- $borrowers->{ $pm->{'borrowernumber'} }->{extended_attributes} >- = \@patron_attributes; >+ >+ my @modified_atypes = uniq( map { $_->code } @{ $pm->{extended_attributes} } ); >+ my $modified_attributes; >+ >+ foreach my $type (@modified_atypes) { >+ my $type_obj = Koha::Patron::Attribute::Types->find($type); >+ my @before = Koha::Patron::Attributes->search( >+ { borrowernumber => $pm->{borrowernumber}, code => $type } ); >+ my @after = grep { $_->code eq $type } @{ $pm->{extended_attributes} }; >+ push @{$modified_attributes}, { type => $type_obj, before => \@before, after => \@after }; >+ } >+ >+ $borrowers->{ $pm->{borrowernumber} } = Koha::Patrons->find($pm->{borrowernumber})->unblessed; >+ $borrowers->{ $pm->{borrowernumber} }->{modified_attributes} = $modified_attributes; > } > > $template->param( >-- >2.11.1
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 13757
:
42254
|
42626
|
42627
|
47625
|
48040
|
48041
|
48042
|
48043
|
48379
|
48380
|
48381
|
48382
|
56924
|
56925
|
56926
|
56927
|
56928
|
56929
|
57041
|
57042
|
57043
|
57044
|
57045
|
57046
|
58252
|
58253
|
58254
|
58255
|
58351
|
58352
|
58353
|
58354
|
58355
|
58356
|
58357
|
58428
|
58429
|
58581
|
58703
|
58706
|
58707
|
58708
|
58709
|
58710
|
58711
|
58712
|
58713
|
58714
|
58715
|
59376
|
59737
|
59738
|
59739
|
59813
|
59896
|
59897
|
59898
|
60359
|
60360
|
61132
|
61133
|
61134
|
61135
|
61136
|
61137
|
61138
|
61139
|
61140
|
61141
|
61142
|
61143
|
61144
|
61145
|
61146
|
61147
|
61148
|
61149
|
61150
|
61492
|
61493
|
61555
|
61556
|
61557
|
61558
|
61559
|
61560
|
61561
|
61562
|
61563
|
61564
|
61565
|
61566
|
61567
|
61568
|
61569
|
61570
|
61571
|
61572
|
61573
|
61574
|
61575