Bugzilla – Attachment 5746 Details for
Bug 6980
Existing extended patron attributes are shown on patron screens even when ExtendedPatronAttributes is disabled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed fix
0001-Fix-for-Bug-6980-Patron-attributes-are-shown-when-Ex.patch (text/plain), 14.85 KB, created by
Owen Leonard
on 2011-10-06 18:33:02 UTC
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2011-10-06 18:33:02 UTC
Size:
14.85 KB
patch
obsolete
>From fee606b457ea33967bce70602bd08b0a9903fc5c Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 6 Oct 2011 14:27:16 -0400 >Subject: [PATCH] Fix for Bug 6980, Patron attributes are shown when ExtendedPatronAttributes is disabled >Content-Type: text/plain; charset="utf-8" > >This patch adds a check for the value of the ExtendedPatronAttributes >preference to the scripts and corresponding logic to the templates >controlling the sidebar menu. > >The patch also corrects a duplication of attributes code in moremember.pl >--- > circ/circulation.pl | 10 ++++++++-- > .../intranet-tmpl/prog/en/includes/circ-menu.inc | 4 ++-- > .../intranet-tmpl/prog/en/includes/circ-menu.tt | 4 ++-- > .../prog/en/modules/members/moremember.tt | 10 +++++----- > members/boraccount.pl | 10 ++++++++-- > members/mancredit.pl | 8 +++++++- > members/maninvoice.pl | 9 +++++++-- > members/member-flags.pl | 10 ++++++++-- > members/member-password.pl | 10 ++++++++-- > members/moremember.pl | 9 +++++---- > members/notices.pl | 10 ++++++++-- > members/pay.pl | 8 +++++++- > members/readingrec.pl | 10 ++++++++-- > 13 files changed, 83 insertions(+), 29 deletions(-) > >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 98fee97..7b7b270 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -632,7 +632,14 @@ my $fast_cataloging = 0; > if (defined getframeworkinfo('FA')) { > $fast_cataloging = 1 > } >-my $attributes = GetBorrowerAttributes($borrowernumber); >+ >+if (C4::Context->preference('ExtendedPatronAttributes')) { >+ my $attributes = GetBorrowerAttributes($borrowernumber); >+ $template->param( >+ ExtendedPatronAttributes => 1, >+ extendedattributes => $attributes >+ ); >+} > > $template->param( > lib_messages_loop => $lib_messages_loop, >@@ -682,7 +689,6 @@ $template->param( > circview => 1, > soundon => C4::Context->preference("SoundOn"), > fast_cataloging => $fast_cataloging, >- extendedattributes => $attributes, > ); > > # save stickyduedate to session >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc >index a9fd453..67300d5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc >@@ -48,13 +48,13 @@ > <li> <span class="empty">No email stored.</span> </li> > [% END %] > [% END %] >- [% FOREACH extendedattribute IN extendedattributes %] >+ [% IF ( ExtendedPatronAttributes ) %][% FOREACH extendedattribute IN extendedattributes %] > [% IF ( extendedattribute.display_checkout ) %] > [% IF ( extendedattribute.value ) %] > <li>[% extendedattribute.description %] : [% IF ( extendedattribute.value_description ) %][% extendedattribute.value_description %][% ELSE %][% extendedattribute.value %][% END %]</li> > [% END %] > [% END %] >- [% END %] >+ [% END %][% END %] > <li>Category: [% categoryname %] ([% categorycode %])</li> > <li>Home Library: [% IF ( branchname ) %][% branchname %][% ELSE %][% branch %][% END %]</li> > </ul></div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt >index 47c1290..fe04b63 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.tt >@@ -50,13 +50,13 @@ in the global namespace %] > <li> <span class="empty">No email stored.</span> </li> > [% END %] > [% END %] >- [% FOREACH extendedattribute IN borrower.extendedattributes %] >+ [% IF ( ExtendedPatronAttributes ) %][% FOREACH extendedattribute IN borrower.extendedattributes %] > [% IF ( extendedattribute.display_checkout ) %] > [% IF ( extendedattribute.value ) %] > <li>[% extendedattribute.description %] : [% IF ( extendedattribute.value_description ) %][% extendedattribute.value_description %][% ELSE %][% extendedattribute.value %][% END %]</li> > [% END %] > [% END %] >- [% END %] >+ [% END %][% END %] > <li>Category: [% borrower.description %] ([% borrower.categorycode %])</li> > <li>Home Library: [% IF ( borrower.branchname ) %][% borrower.branchname %][% ELSE %][% borrower.branch %][% END %]</li> > </ul></div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index 3eb42f3..49a56cf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -285,12 +285,12 @@ function validate1(date) { > <th>Type</th> > <th>Value</th> > </tr> >- [% FOREACH patron_attribute IN patron_attributes %] >+ [% FOREACH extendedattribute IN extendedattributes %] > <tr> >- <td>[% patron_attribute.code %] ([% patron_attribute.description %])</td> >- <td>[% patron_attribute.value %] >- [% IF ( patron_attribute.value_description ) %] >- ([% patron_attribute.value_description %]) >+ <td>[% extendedattribute.code %] ([% extendedattribute.description %])</td> >+ <td>[% extendedattribute.value %] >+ [% IF ( extendedattribute.value_description ) %] >+ ([% extendedattribute.value_description %]) > [% END %] > </td> > </tr> >diff --git a/members/boraccount.pl b/members/boraccount.pl >index b197b3f..e16405b 100755 >--- a/members/boraccount.pl >+++ b/members/boraccount.pl >@@ -94,7 +94,14 @@ $template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' ); > > my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'}); > $template->param( picture => 1 ) if $picture; >-my $attributes = GetBorrowerAttributes($borrowernumber); >+ >+if (C4::Context->preference('ExtendedPatronAttributes')) { >+ my $attributes = GetBorrowerAttributes($borrowernumber); >+ $template->param( >+ ExtendedPatronAttributes => 1, >+ extendedattributes => $attributes >+ ); >+} > > $template->param( > finesview => 1, >@@ -120,7 +127,6 @@ $template->param( > is_child => ($data->{'category_type'} eq 'C'), > reverse_col => $reverse_col, > accounts => $accts, >- extendedattributes => $attributes, > ); > > output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/members/mancredit.pl b/members/mancredit.pl >index 801fcc2..3c664c2 100755 >--- a/members/mancredit.pl >+++ b/members/mancredit.pl >@@ -78,7 +78,14 @@ if ($add){ > $template->param( adultborrower => 1 ) if ( $data->{category_type} eq 'A' ); > my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'}); > $template->param( picture => 1 ) if $picture; >+ >+if (C4::Context->preference('ExtendedPatronAttributes')) { > my $attributes = GetBorrowerAttributes($borrowernumber); >+ $template->param( >+ ExtendedPatronAttributes => 1, >+ extendedattributes => $attributes >+ ); >+} > > $template->param( > borrowernumber => $borrowernumber, >@@ -99,7 +106,6 @@ if ($add){ > branchcode => $data->{'branchcode'}, > branchname => GetBranchName($data->{'branchcode'}), > is_child => ($data->{'category_type'} eq 'C'), >- extendedattributes => $attributes, > ); > output_html_with_http_headers $input, $cookie, $template->output; > } >diff --git a/members/maninvoice.pl b/members/maninvoice.pl >index 9a040b6..1f42093 100755 >--- a/members/maninvoice.pl >+++ b/members/maninvoice.pl >@@ -106,8 +106,14 @@ if ($add){ > $template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' ); > my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'}); > $template->param( picture => 1 ) if $picture; >- my $attributes = GetBorrowerAttributes($borrowernumber); > >+if (C4::Context->preference('ExtendedPatronAttributes')) { >+ my $attributes = GetBorrowerAttributes($borrowernumber); >+ $template->param( >+ ExtendedPatronAttributes => 1, >+ extendedattributes => $attributes >+ ); >+} > $template->param( > borrowernumber => $borrowernumber, > firstname => $data->{'firstname'}, >@@ -127,7 +133,6 @@ if ($add){ > branchcode => $data->{'branchcode'}, > branchname => GetBranchName($data->{'branchcode'}), > is_child => ($data->{'category_type'} eq 'C'), >- extendedattributes => $attributes, > ); > output_html_with_http_headers $input, $cookie, $template->output; > } >diff --git a/members/member-flags.pl b/members/member-flags.pl >index 00a3268..76f300e 100755 >--- a/members/member-flags.pl >+++ b/members/member-flags.pl >@@ -162,7 +162,14 @@ if ($input->param('newflags')) { > $template->param( adultborrower => 1 ) if ( $bor->{'category_type'} eq 'A' ); > my ($picture, $dberror) = GetPatronImage($bor->{'cardnumber'}); > $template->param( picture => 1 ) if $picture; >-my $attributes = GetBorrowerAttributes($bor->{'borrowernumber'}); >+ >+if (C4::Context->preference('ExtendedPatronAttributes')) { >+ my $attributes = GetBorrowerAttributes($bor->{'borrowernumber'}); >+ $template->param( >+ ExtendedPatronAttributes => 1, >+ extendedattributes => $attributes >+ ); >+} > > $template->param( > borrowernumber => $bor->{'borrowernumber'}, >@@ -184,7 +191,6 @@ $template->param( > branchname => GetBranchName($bor->{'branchcode'}), > loop => \@loop, > is_child => ($bor->{'category_type'} eq 'C'), >- extendedattributes => $attributes, > ); > > output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/members/member-password.pl b/members/member-password.pl >index 03f5243..25e9551 100755 >--- a/members/member-password.pl >+++ b/members/member-password.pl >@@ -90,7 +90,14 @@ if ( $newpassword && ! $errormsg ) { > $template->param( adultborrower => 1 ) if ( $bor->{'category_type'} eq 'A' ); > my ($picture, $dberror) = GetPatronImage($bor->{'cardnumber'}); > $template->param( picture => 1 ) if $picture; >-my $attributes = GetBorrowerAttributes($bor->{'borrowernumber'}); >+ >+if (C4::Context->preference('ExtendedPatronAttributes')) { >+ my $attributes = GetBorrowerAttributes($bor->{'borrowernumber'}); >+ $template->param( >+ ExtendedPatronAttributes => 1, >+ extendedattributes => $attributes >+ ); >+} > > $template->param( othernames => $bor->{'othernames'}, > surname => $bor->{'surname'}, >@@ -114,7 +121,6 @@ my $attributes = GetBorrowerAttributes($bor->{'borrowernumber'}); > destination => $destination, > is_child => ($bor->{'category_type'} eq 'C'), > defaultnewpassword => $defaultnewpassword, >- extendedattributes => $attributes, > ); > > >diff --git a/members/moremember.pl b/members/moremember.pl >index 7f47dd6..9115dd1 100755 >--- a/members/moremember.pl >+++ b/members/moremember.pl >@@ -425,8 +425,11 @@ my $branch=C4::Context->userenv->{'branch'}; > $template->param(%$data); > > if (C4::Context->preference('ExtendedPatronAttributes')) { >- $template->param(ExtendedPatronAttributes => 1); >- $template->param(patron_attributes => C4::Members::Attributes::GetBorrowerAttributes($borrowernumber)); >+ my $attributes = GetBorrowerAttributes($borrowernumber); >+ $template->param( >+ ExtendedPatronAttributes => 1, >+ extendedattributes => $attributes >+ ); > my @types = C4::Members::AttributeTypes::GetAttributeTypes(); > if (scalar(@types) == 0) { > $template->param(no_patron_attribute_types => 1); >@@ -439,7 +442,6 @@ if (C4::Context->preference('EnhancedMessagingPreferences')) { > $template->param(SMSSendDriver => C4::Context->preference("SMSSendDriver")); > $template->param(SMSnumber => defined $data->{'smsalertnumber'} ? $data->{'smsalertnumber'} : $data->{'mobile'}); > } >-my $attributes = GetBorrowerAttributes($borrowernumber); > > $template->param( > detailview => 1, >@@ -469,7 +471,6 @@ $template->param( > "dateformat_" . (C4::Context->preference("dateformat") || '') => 1, > samebranch => $samebranch, > quickslip => $quickslip, >- extendedattributes => $attributes, > ); > > #Get the slip news items >diff --git a/members/notices.pl b/members/notices.pl >index a6e65c8..41f2a90 100755 >--- a/members/notices.pl >+++ b/members/notices.pl >@@ -53,7 +53,14 @@ $template->param( picture => 1 ) if $picture; > # Getting the messages > my $queued_messages = C4::Letters::GetQueuedMessages({borrowernumber => $borrowernumber}); > $template->param( %{$borrower} ); >-my $attributes = GetBorrowerAttributes($borrowernumber); >+ >+if (C4::Context->preference('ExtendedPatronAttributes')) { >+ my $attributes = GetBorrowerAttributes($borrowernumber); >+ $template->param( >+ ExtendedPatronAttributes => 1, >+ extendedattributes => $attributes >+ ); >+} > > $template->param( > QUEUED_MESSAGES => $queued_messages, >@@ -61,7 +68,6 @@ $template->param( > sentnotices => 1, > branchname => GetBranchName($borrower->{'branchcode'}), > categoryname => $borrower->{'description'}, >- extendedattributes => $attributes, > ); > output_html_with_http_headers $input, $cookie, $template->output; > >diff --git a/members/pay.pl b/members/pay.pl >index 9389f82..6bc18fc 100755 >--- a/members/pay.pl >+++ b/members/pay.pl >@@ -233,7 +233,13 @@ sub borrower_add_additional_fields { > if ($picture) { > $b_ref->{has_picture} = 1; > } >- $b_ref->{extendedattributes} = GetBorrowerAttributes($borrowernumber); >+ >+ if (C4::Context->preference('ExtendedPatronAttributes')) { >+ $b_ref->{extendedattributes} = GetBorrowerAttributes($borrowernumber); >+ $template->param( >+ ExtendedPatronAttributes => 1, >+ ); >+ } > > $b_ref->{branchname} = GetBranchName( $b_ref->{branchcode} ); > return; >diff --git a/members/readingrec.pl b/members/readingrec.pl >index 04414e3..8c0cd6f 100755 >--- a/members/readingrec.pl >+++ b/members/readingrec.pl >@@ -96,7 +96,14 @@ if (! $limit){ > > my ($picture, $dberror) = GetPatronImage($data->{'cardnumber'}); > $template->param( picture => 1 ) if $picture; >-my $attributes = GetBorrowerAttributes($borrowernumber); >+ >+if (C4::Context->preference('ExtendedPatronAttributes')) { >+ my $attributes = GetBorrowerAttributes($borrowernumber); >+ $template->param( >+ ExtendedPatronAttributes => 1, >+ extendedattributes => $attributes >+ ); >+} > > $template->param( > readingrecordview => 1, >@@ -125,7 +132,6 @@ $template->param( > branchname => GetBranchName($data->{'branchcode'}), > showfulllink => (scalar @loop_reading > 50), > loop_reading => \@loop_reading, >- extendedattributes => $attributes, > ); > output_html_with_http_headers $input, $cookie, $template->output; > >-- >1.7.3 >
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 6980
:
5746
|
5989