@@ -, +, @@
members-update.pl
---
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(-)
--- a/koha-tmpl/intranet-tmpl/prog/css/staff-global.css
+++ a/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");
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt
+++ a/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 %]
- [% attr.code %]: [% IF pending %][% attr.value %][% ELSE %][% attr.attribute %][% END %]
+ [% IF attrs and attrs.size > 1 %]
+
+ [% FOREACH attr IN attrs %]
+ - [% PROCESS display_attribute attr=attr type=type %]
+ [% END %]
+
+ [% 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 @@
| Patron details
+ [% IF !pm.extended_attributes and pm.size > 3 or
+ pm.extended_attributes and pm.size > 4 %]
+ [%# timestamp+verification_token+borrowernumber=3 %]
+
Field |
@@ -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 ) ) %]
[% PROCESS display_names field = key %] |
@@ -118,9 +137,6 @@
[% ELSIF key == 'branchcode' %]
[% Branches.GetName( borrowers.$borrowernumber.$key ) %] |
[% Branches.GetName( pm.$key ) %] |
- [% ELSIF ( key == 'extended_attributes' ) %]
- [% PROCESS display_extended_attributes attributes=borrowers.$borrowernumber.$key %] |
- [% PROCESS display_extended_attributes attributes=pm.$key pending=1 %] |
[% ELSE %]
[% borrowers.$borrowernumber.$key %] |
[% pm.$key %] |
@@ -130,6 +146,27 @@
[% END %]
[% END %]
+
+ [% END %]
+ [% IF borrowers.$borrowernumber.modified_attributes %]
+
+
[% PROCESS display_names field='extended_attributes' %]
+
+
+ Field |
+ Old value |
+ New value |
+
+ [% FOREACH attribute_group IN borrowers.$borrowernumber.modified_attributes %]
+
+ [% attribute_group.type.description %] |
+ [% PROCESS display_extended_attributes attrs=attribute_group.before type=attribute_group.type %] |
+ [% PROCESS display_extended_attributes attrs=attribute_group.after type=attribute_group.type %] |
+
+ [% END %]
+
+
+ [% END %]
[% END %]
--- a/members/members-update.pl
+++ a/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(
--