From 2b2e544f054acc5c220dfca035554e2d13b27cdf Mon Sep 17 00:00:00 2001 From: Srdjan Jankovic Date: Thu, 17 Nov 2011 12:45:47 +1300 Subject: [PATCH] Bug 6303: Display Organisation and Parent Organisation names when viewing a borrower of type organisation Signed-off-by: Katrin Fischer Works as advertised, doesn't affect display for non-organisational patrons. Note: Display change in OPAC only affects the summary tab. It would be a little bit more consistent to make the name show the same on all tabs in OPAC patron account. Signed-off-by: Marcel de Rooy I repeated Katrin's signoff here (with permission). The patch only changed for some minor rebasing and cosmetic QA requests. Passed QA now. Signed-off-by: Paul Poulain --- C4/Members.pm | 22 ++++++++++--------- circ/circulation.pl | 7 ++++-- .../prog/en/includes/circ-menu.inc | 2 +- .../prog/en/includes/patron-title.inc | 6 +++++ .../prog/en/modules/circ/circulation.tt | 21 +++++++++--------- .../prog/en/modules/members/boraccount.tt | 4 ++-- .../prog/en/modules/members/member.tt | 4 +++- .../prog/en/modules/members/moremember.tt | 10 +++++++-- .../prog/en/modules/members/notices.tt | 6 ++--- .../prog/en/modules/members/readingrec.tt | 4 ++-- .../prog/en/modules/tools/viewlog.tt | 17 ++++++++++---- .../prog/en/includes/patron-title.inc | 5 +++++ .../opac-tmpl/prog/en/modules/opac-user.tt | 7 ++++-- .../prog/en/modules/opac-userupdate.tt | 7 ++++-- members/boraccount.pl | 3 ++- members/moremember.pl | 6 ++--- members/readingrec.pl | 1 + opac/opac-user.pl | 2 ++ tools/viewlog.pl | 3 +++ 19 files changed, 92 insertions(+), 45 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc create mode 100644 koha-tmpl/opac-tmpl/prog/en/includes/patron-title.inc diff --git a/C4/Members.pm b/C4/Members.pm index 56718f08f4..4f5a299589 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -313,11 +313,11 @@ sub GetMemberDetails { my $query; my $sth; if ($borrowernumber) { - $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE borrowernumber=?"); + $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee,enrolmentperiod FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE borrowernumber=?"); $sth->execute($borrowernumber); } elsif ($cardnumber) { - $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE cardnumber=?"); + $sth = $dbh->prepare("SELECT borrowers.*,category_type,categories.description,reservefee,enrolmentperiod FROM borrowers LEFT JOIN categories ON borrowers.categorycode=categories.categorycode WHERE cardnumber=?"); $sth->execute($cardnumber); } else { @@ -340,14 +340,16 @@ sub GetMemberDetails { $borrower->{'flags'} = $flags; $borrower->{'authflags'} = $accessflagshash; - # find out how long the membership lasts - $sth = - $dbh->prepare( - "select enrolmentperiod from categories where categorycode = ?"); - $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. + if ($borrower->{category_type} eq 'I') { + $borrower->{'showname'} = $borrower->{'othernames'}; + $borrower->{'showname'} .= " $borrower->{'firstname'}" if $borrower->{'firstname'}; + } else { + $borrower->{'showname'} = $borrower->{'firstname'}; + } + return ($borrower); #, $flags, $accessflagshash); } diff --git a/circ/circulation.pl b/circ/circulation.pl index efb87da7c9..378956e654 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -629,9 +629,9 @@ my (undef, $roadttype_hashref) = &GetRoadTypes(); my $address = $borrower->{'streetnumber'}.' '.$roadttype_hashref->{$borrower->{'streettype'}}.' '.$borrower->{'address'}; my $fast_cataloging = 0; - if (defined getframeworkinfo('FA')) { +if (defined getframeworkinfo('FA')) { $fast_cataloging = 1 - } +} if (C4::Context->preference('ExtendedPatronAttributes')) { my $attributes = GetBorrowerAttributes($borrowernumber); @@ -654,6 +654,8 @@ $template->param( printername => $printer, firstname => $borrower->{'firstname'}, surname => $borrower->{'surname'}, + showname => $borrower->{'showname'}, + category_type => $borrower->{'category_type'}, dateexpiry => format_date($newexpiry), expiry => format_date($borrower->{'dateexpiry'}), categorycode => $borrower->{'categorycode'}, @@ -669,6 +671,7 @@ $template->param( country => $borrower->{'country'}, phone => $borrower->{'phone'} || $borrower->{'mobile'}, cardnumber => $borrower->{'cardnumber'}, + othernames => $borrower->{'othernames'}, amountold => $amountold, barcode => $barcode, stickyduedate => $stickyduedate, 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 67300d5af4..65565629e3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -1,5 +1,5 @@ [% IF ( borrowernumber ) %] -
[% firstname %] [% surname %] ([% cardnumber %])
+
[% INCLUDE 'patron-title.inc' %]