From 1c59d49a3bfeee626a722a2231efda2971aeaecb Mon Sep 17 00:00:00 2001 From: Robin Sheat Date: Fri, 27 Aug 2010 15:27:56 +1200 Subject: [PATCH 1/1] Bug 5172 - use the 'othernames' field when referring to the user In the OPAC, the 'other name' field should be used in place of the user's first name when referring to them. --- C4/Members.pm | 9 ++++++++- koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc | 2 +- .../opac-tmpl/prog/en/modules/opac-account.tmpl | 6 +++--- .../opac-tmpl/prog/en/modules/opac-messaging.tmpl | 4 ++-- .../opac-tmpl/prog/en/modules/opac-passwd.tmpl | 4 ++-- .../prog/en/modules/opac-readingrecord.tmpl | 4 ++-- .../opac-tmpl/prog/en/modules/opac-reserve.tmpl | 4 ++-- .../opac-tmpl/prog/en/modules/opac-sendbasket.tmpl | 2 +- .../opac-tmpl/prog/en/modules/opac-sendshelf.tmpl | 2 +- koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl | 4 ++-- .../prog/en/modules/opac-userdetails.tmpl | 9 ++++++--- .../opac-tmpl/prog/en/modules/opac-userupdate.tmpl | 4 ++-- opac/opac-passwd.pl | 10 ++++++---- opac/opac-sendbasket.pl | 1 + opac/opac-sendshelf.pl | 1 + 15 files changed, 40 insertions(+), 26 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index cddbf41..9d54e90 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -367,6 +367,11 @@ sub GetMemberDetails { $sth->execute( $borrower->{'categorycode'} ); my $enrolment = $sth->fetchrow; $borrower->{'enrolmentperiod'} = $enrolment; + # For the purposes of making templates easier, we'll define a + # 'showname' which is the alternate form the user's first name if + # 'other name' is defined. + $borrower->{'showname'} = $borrower->{'othernames'} || $borrower->{'firstname'}; + return ($borrower); #, $flags, $accessflagshash); } @@ -564,7 +569,9 @@ sub GetMember { #FIXME interface to this routine now allows generation of a result set #so whole array should be returned but bowhere in the current code expects this if (@{$data} ) { - return $data->[0]; + my $user = $data->[0]; + $user->{showname} = $user->{othernames} || $user->{firstname}; + return $user; } return; diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc index 878a412..1b3212a 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc @@ -4,7 +4,7 @@
  • Log in to Your Account
  • -
  • Welcome,
  • +
  • Welcome,
  • diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tmpl index 0b7f220..eb2a20e 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-account.tmpl @@ -1,4 +1,4 @@ -Koha Online Catalog › Account for +Koha Online Catalog › Account for @@ -11,7 +11,7 @@
    -

    's account ../../images/caret.gif" width="16" height="16" alt=">" border="0" /> Fines and Charges

    +

    's account ../../images/caret.gif" width="16" height="16" alt=">" border="0" /> Fines and Charges

    @@ -59,4 +59,4 @@
    - \ No newline at end of file + diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-messaging.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-messaging.tmpl index 0e0543c..3800d10 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-messaging.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-messaging.tmpl @@ -1,4 +1,4 @@ -Koha OnlineKoha Online Catalog › Updating Details for +Koha OnlineKoha Online Catalog › Updating Details for @@ -93,7 +93,7 @@ $.tablesorter.addParser({ -

    Hello, (Click here if you're not )

    +

    Hello, (Click here if you're not )

    Thank you!

    Your corrections have been submitted to the library, and a staff member will update your record as soon as possible.

    diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-userdetails.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-userdetails.tmpl index 174b8bd..ec88242 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-userdetails.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-userdetails.tmpl @@ -1,4 +1,4 @@ -Koha Online Catalog › Personal Details for +Koha Online Catalog › Personal Details for @@ -9,10 +9,13 @@
    -

    's account ../../images/caret.gif" width="16" height="16" alt=">" border="0" /> Personal Details

    +

    's account ../../images/caret.gif" width="16" height="16" alt=">" border="0" /> Personal Details

    + + +
    Name:
    Other Name:
    Card Number:
    @@ -84,4 +87,4 @@ Card Number:
    - \ No newline at end of file + diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tmpl index bb0a473..1655c11 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tmpl @@ -1,4 +1,4 @@ -Koha OnlineKoha Online Catalog › Updating Details for +Koha OnlineKoha Online Catalog › Updating Details for @@ -11,7 +11,7 @@
    -

    's account ../../images/caret.gif" width="16" height="16" alt=">" border="0" /> Your Personal Details

    +

    's account ../../images/caret.gif" width="16" height="16" alt=">" border="0" /> Your Personal Details

    diff --git a/opac/opac-passwd.pl b/opac/opac-passwd.pl index ca502ab..cc518d5 100755 --- a/opac/opac-passwd.pl +++ b/opac/opac-passwd.pl @@ -97,10 +97,12 @@ else { } } -$template->param(firstname => $borr->{'firstname'}, - surname => $borr->{'surname'}, - minpasslen => $minpasslen, - passwdview => 1, +$template->param( + firstname => $borr->{'firstname'}, + surname => $borr->{'surname'}, + showname => $borr->{'showname'}, + minpasslen => $minpasslen, + passwdview => 1, ); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl index 76400a5..90b1f12 100755 --- a/opac/opac-sendbasket.pl +++ b/opac/opac-sendbasket.pl @@ -110,6 +110,7 @@ if ( $email_add ) { comment => $comment, firstname => $user->{firstname}, surname => $user->{surname}, + showname => $user->{showname}, ); # Getting template result diff --git a/opac/opac-sendshelf.pl b/opac/opac-sendshelf.pl index b535616..b9aa468 100755 --- a/opac/opac-sendshelf.pl +++ b/opac/opac-sendshelf.pl @@ -107,6 +107,7 @@ if ( $email ) { shelfname => $shelf[1], firstname => $user->{firstname}, surname => $user->{surname}, + showname => $user->{showname}, ); # Getting template result -- 1.7.0.4