Bug 21137: Replace BORROWER_INFO with logged_in_user
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 1 Aug 2018 13:03:42 +0000 (10:03 -0300)
committerNick Clemens <nick@bywatersolutions.com>
Tue, 14 Aug 2018 12:43:12 +0000 (12:43 +0000)
it also removes 'category_type' and 'description' from a couple of
opac scripts, they are not needed.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
17 files changed:
koha-tmpl/opac-tmpl/bootstrap/en/includes/patron-title.inc
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account-pay-error.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-account.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-issue-note.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry-update-submitted.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-passwd.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-privacy.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-routing-lists.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
opac/opac-account.pl
opac/opac-messaging.pl
opac/opac-routing-lists.pl
opac/opac-user.pl

index 265125d..81a4e72 100644 (file)
@@ -1,5 +1,8 @@
-[% IF category_type == 'I' %]
-    [% surname %] [% IF othernames %] ([% othernames %]) [% END %]
-[% ELSE %]
-    [% firstname %] [% surname %]
-[% END %]
+[%- IF patron.category.category_type == 'I' -%]
+    [% patron.surname %][% IF patron.othernames %] ([% patron.othernames %]) [%- END -%]
+[%- ELSE -%]
+    [%- IF patron.title -%]
+        <span class="patron-title">[% patron.title %]</span>
+    [%- END -%]
+    [% patron.firstname %] [% patron.surname %]
+[%- END -%]
index d4fb5b5..712f7bc 100644 (file)
@@ -9,7 +9,7 @@
 <div class="main">
     <ul class="breadcrumb">
         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
-        <li><a href="/cgi-bin/koha/opac-user.pl">[% borrower.firstname %] [% borrower.surname %]</a> <span class="divider">&rsaquo;</span></li>
+        <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
         <li><a href="#">Your payment</a></li>
     </ul>
 
index 2ea8607..f381668 100644 (file)
@@ -19,7 +19,7 @@
 <div class="main">
     <ul class="breadcrumb">
         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
-        <li>[% IF BORROWER_INFO %]<a href="/cgi-bin/koha/opac-user.pl">[% BORROWER_INFO.firstname %] [% BORROWER_INFO.surname %]</a>[% END %] <span class="divider">&rsaquo;</span></li>
+        <li>[% IF logged_in_user %]<a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a>[% END %] <span class="divider">&rsaquo;</span></li>
         <li><a href="#">Your fines and charges</a></li>
     </ul>
 
index 67cc39a..2ad7d56 100644 (file)
@@ -17,7 +17,7 @@
     <ul class="breadcrumb noprint">
         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
         [% IF ( logged_in_user ) %]
-            <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE patron-title.inc patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
+            <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
         [% END %]
 
         [% IF method != 'list' %]
index 03a6a7b..f8ecf55 100644 (file)
@@ -12,7 +12,7 @@
 <div class="main">
     <ul class="breadcrumb">
         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
-        <li><a href="/cgi-bin/koha/opac-user.pl">[% firstname %] [% surname %]</a><span class="divider">&rsaquo;</span></li>
+        <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a><span class="divider">&rsaquo;</span></li>
         <li><a href="#">Editing issue note for [% ISSUE.title %] - [% ISSUE.author %]</a></li>
     </ul>
 
index 30714e0..a92a01e 100644 (file)
@@ -10,7 +10,7 @@
     <div class="main">
         <ul class="breadcrumb">
             <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
-            <li><a href="/cgi-bin/koha/opac-user.pl">[% borrower.firstname %] [% borrower.surname %]</a> <span class="divider">&rsaquo;</span></li>
+            <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
             <li><a href="#">Updates to your record</a></li>
         </ul>
 
index 7b39196..f72274a 100644 (file)
@@ -24,7 +24,7 @@
     <ul class="breadcrumb">
         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
         [% IF action == 'edit' %]
-            <li><a href="/cgi-bin/koha/opac-user.pl">[% borrower.firstname %] [% borrower.surname %]</a> <span class="divider">&rsaquo;</span></li>
+            <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
             <li><a href="#">Your personal details</a></li>
         [% ELSE %]
             <li><a href="#">Register a new account</a></li>
index 6adfc97..c12b0f8 100644 (file)
@@ -10,7 +10,7 @@
 <div class="main">
     <ul class="breadcrumb">
         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
-        <li><a href="/cgi-bin/koha/opac-user.pl">[% BORROWER_INFO.firstname %] [% BORROWER_INFO.surname %]</a> <span class="divider">&rsaquo;</span></li>
+        <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
         <li><a href="#">Your messaging settings</a></li>
     </ul>
 
index f34b919..07ba100 100644 (file)
@@ -11,7 +11,7 @@
 <div class="main">
     <ul class="breadcrumb">
         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
-        <li><a href="/cgi-bin/koha/opac-user.pl">[% firstname %] [% surname %]</a> <span class="divider">&rsaquo;</span></li>
+        <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
         <li><a href="#">Change your password</a></li>
     </ul>
 
index 143f4e0..b776289 100644 (file)
@@ -10,7 +10,7 @@
 <div class="main">
     <ul class="breadcrumb">
         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
-        <li><a href="/cgi-bin/koha/opac-user.pl">[% firstname %] [% surname %]</a> <span class="divider">&rsaquo;</span></li>
+        <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
         <li><a href="#">Your privacy management</a></li>
     </ul>
 
index 3fcd3fc..bf7f413 100644 (file)
@@ -19,7 +19,7 @@
 <div class="main">
     <ul class="breadcrumb">
         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
-        <li><a href="/cgi-bin/koha/opac-user.pl">[% firstname %] [% surname %]</a> <span class="divider">&rsaquo;</span></li>
+        <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
         <li><a href="#">Your checkout history</a></li>
     </ul>
 
index 189b307..c2b42ee 100644 (file)
@@ -15,7 +15,7 @@
 <div class="main">
     <ul class="breadcrumb">
         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
-        <li><a href="/cgi-bin/koha/opac-routing-lists.pl">[% INCLUDE 'patron-title.inc' category_type = BORROWER_INFO.category_type firstname = BORROWER_INFO.firstname surname = BORROWER_INFO.surname othernames = BORROWER_INFO.othernames cardnumber = BORROWER_INFO.cardnumber %]</a> <span class="divider">&rsaquo;</span></li>
+        <li><a href="/cgi-bin/koha/opac-routing-lists.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
         <li><a href="#">Your routing lists</a></li>
     </ul>
 
index 3185ba1..5fc9a1a 100644 (file)
@@ -25,7 +25,7 @@
 <div class="main">
     <ul class="breadcrumb">
         <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
-        <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' category_type = BORROWER_INFO.category_type firstname = BORROWER_INFO.firstname surname = BORROWER_INFO.surname othernames = BORROWER_INFO.othernames cardnumber = BORROWER_INFO.cardnumber %]</a> <span class="divider">&rsaquo;</span></li>
+        <li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
         <li><a href="#">Your summary</a></li>
     </ul>
 
 
                     [% INCLUDE 'opac-note.inc' %]
 
-                    <h2>Hello, [% INCLUDE 'patron-title.inc' category_type = BORROWER_INFO.category_type firstname = BORROWER_INFO.firstname surname = BORROWER_INFO.surname othernames = BORROWER_INFO.othernames cardnumber = BORROWER_INFO.cardnumber %]
+                    <h2>Hello, [% INCLUDE 'patron-title.inc' patron = logged_in_user %]
                     </h2>
 
-                    <p><a href="/cgi-bin/koha/opac-main.pl?logout.x=1">Click here if you're not [% BORROWER_INFO.title %] [% INCLUDE 'patron-title.inc' category_type = BORROWER_INFO.category_type firstname = BORROWER_INFO.firstname surname = BORROWER_INFO.surname othernames = BORROWER_INFO.othernames cardnumber = BORROWER_INFO.cardnumber %]</a></p>
+                    <p><a href="/cgi-bin/koha/opac-main.pl?logout.x=1">Click here if you're not [% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a></p>
 
                     [% IF ( patronupdate ) %]<div class="alert alert-info"><h3>Thank you!</h3><p>Your corrections have been submitted to the library, and a staff member will update your record as soon as possible.</p></div>[% END %]
 
                         </div>
                     [% END %]
 
-                    [% IF ( BORROWER_INFO.warndeparture ) %]
+                    [% IF ( borrower.warndeparture ) %]
                         <div class="alert" id="warndeparture">
-                            <strong>Please note:</strong><span> Your card will expire on <span id="warndeparture_date">[% BORROWER_INFO.warndeparture | $KohaDates %]</span>. Please contact the library for more information.</span>
-                                [% IF ( BORROWER_INFO.returnbeforeexpiry ) %]<span id="warndeparture_returnbeforeexpiry"> Also note that you must return all checked out items before your card expires.</span>[% END %]
+                            <strong>Please note:</strong><span> Your card will expire on <span id="warndeparture_date">[% borrower.warndeparture | $KohaDates %]</span>. Please contact the library for more information.</span>
+                                [% IF ( borrower.returnbeforeexpiry ) %]<span id="warndeparture_returnbeforeexpiry"> Also note that you must return all checked out items before your card expires.</span>[% END %]
                         </div>
                     [% END %]
 
-                    [% IF ( BORROWER_INFO.warnexpired ) %]
+                    [% IF ( borrower.warnexpired ) %]
                         <div class="alert" id="warnexpired">
-                            <strong>Please note: </strong><span>Your account has expired as of [% BORROWER_INFO.warnexpired | $KohaDates %]. Please contact the library if you wish to renew your account.</span>
+                            <strong>Please note: </strong><span>Your account has expired as of [% borrower.warnexpired | $KohaDates %]. Please contact the library if you wish to renew your account.</span>
                         </div>
                     [% END %]
 
                                         </li>
                                     [% ELSE %]
                                         <li id="userdebarred"><strong>Please note:</strong> Your account has been frozen.
-                                        [% IF ( BORROWER_INFO.debarredcomment ) %]
+                                        [% IF ( borrower.debarredcomment ) %]
                                             Comment:
                                             <span id="userdebarred_comment">
                                                 <strong>
-                                                    [% IF BORROWER_INFO.debarredcomment.search('OVERDUES_PROCESS') %]
-                                                        Restriction added by overdues process [% BORROWER_INFO.debarredcomment.remove('OVERDUES_PROCESS ') | html_line_break %]
+                                                    [% IF borrower.debarredcomment.search('OVERDUES_PROCESS') %]
+                                                        Restriction added by overdues process [% borrower.debarredcomment.remove('OVERDUES_PROCESS ') | html_line_break %]
                                                     [% ELSE %]
-                                                        [% BORROWER_INFO.debarredcomment | html_line_break %]
+                                                        [% borrower.debarredcomment | html_line_break %]
                                                     [% END %]
                                                 </strong>
                                             </span>
                                         [% END %]
-                                        [% IF ( BORROWER_INFO.userdebarreddate && debarred_date != '9999-12-31' ) %]
+                                        [% IF ( borrower.userdebarreddate && debarred_date != '9999-12-31' ) %]
                                             End date:
-                                            <span id="userdebarred_date">[% BORROWER_INFO.userdebarreddate | $KohaDates %]</span>
+                                            <span id="userdebarred_date">[% borrower.userdebarreddate | $KohaDates %]</span>
                                         [% END %]
 
                                         <em>Usually the reason for freezing an account is old overdues or damage fees. If your account shows to be clear, please contact the library.</em> <a href="/cgi-bin/koha/opac-account.pl">Go to your account page</a></li>
                                     [% END %]
                                 [% END %]
-                                [% IF ( BORROWER_INFO.gonenoaddress ) %]
+                                [% IF ( borrower.gonenoaddress ) %]
                                     <li id="gonenoaddress"><strong>Please note:</strong> According to our records, we don't have up-to-date contact information. Please contact the library.
                                 <a href="/cgi-bin/koha/opac-memberentry.pl">[% IF ( Koha.Preference('OPACPatronDetails') ) %]Update your contact information[% ELSE %]Go to your contact information[% END %]</a>
                                 [% IF ( Koha.Preference('OPACPatronDetails') ) %]<em>(Please note: there may be a delay in restoring your account if you submit online.)</em>[% END %]
                                     </li>
                                 [% END %]
-                                [% IF ( BORROWER_INFO.lost ) %]
+                                [% IF ( borrower.lost ) %]
                                     <li id="lost"><strong>Please note: </strong> Your library card has been marked as lost or stolen. <em>If this is an error, please contact the library.</em></li>
                                 [% END %]
                                 [% IF ( renewal_blocked_fines.defined ) && ( OpacRenewalAllowed ) %]
                             [% IF relatives %]<li><a href="#opac-user-relative-issues">Relatives' checkouts</a></li>[% END %]
                             [% IF ( overdues_count ) %]<li><a href="#opac-user-overdues">Overdue ([% overdues_count %])</a></li>[% END %]
                             [% IF ( OPACFinesTab ) %]
-                                [% IF ( BORROWER_INFO.amountoverfive ) %]<li><a href="#opac-user-fines">Fines ([% amountoutstanding | $Price %])</a></li>[% END %]
-                                [% IF ( BORROWER_INFO.amountoverzero ) %]<li><a href="#opac-user-fines">Fines ([% amountoutstanding | $Price %])</a></li>[% END %]
-                                [% IF ( BORROWER_INFO.amountlessthanzero ) %]<li><a href="#opac-user-fines">Credits ([% amountoutstanding | $Price %])</a></li>[% END %]
+                                [% IF ( borrower.amountoverfive ) %]<li><a href="#opac-user-fines">Fines ([% amountoutstanding | $Price %])</a></li>[% END %]
+                                [% IF ( borrower.amountoverzero ) %]<li><a href="#opac-user-fines">Fines ([% amountoutstanding | $Price %])</a></li>[% END %]
+                                [% IF ( borrower.amountlessthanzero ) %]<li><a href="#opac-user-fines">Credits ([% amountoutstanding | $Price %])</a></li>[% END %]
                             [% END %]
 
                             [% IF borrower_club_enrollments.count || borrower_enrollable_clubs.count %]
 
                         [% IF ( OPACFinesTab ) %]
                             <!-- FINES BOX -->
-                            [% IF BORROWER_INFO.amountoverfive %]
+                            [% IF borrower.amountoverfive %]
                                 <div id="opac-user-fines"> <h3>Fines and charges</h3>
                                     <table class="table table-bordered table-striped">
                                         <thead><tr><th colspan="2">Amount</th></tr></thead>
                                 </div>
                             [% END %]
 
-                            [% IF BORROWER_INFO.amountoverzero %]
+                            [% IF borrower.amountoverzero %]
                                <div id="opac-user-fines"> <h3>Fines and charges</h3>
                                     <table class="table table-bordered table-striped">
                                         <thead><tr><th colspan="2">Amount</th></tr></thead>
                                 </div>
                             [% END %]
 
-                            [% IF BORROWER_INFO.amountlessthanzero %]
+                            [% IF borrower.amountlessthanzero %]
                                 <div id="opac-user-fines">  <h3>Credits</h3>
                                     <table class="table table-bordered table-striped">
                                         <thead><tr><th colspan="2">Amount</th></tr></thead>
index 9611554..2cbbf4e 100755 (executable)
@@ -40,12 +40,6 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
 );
 
 my $patron = Koha::Patrons->find( $borrowernumber );
-my $category = $patron->category;
-my $borrower= $patron->unblessed;
-$borrower->{description} = $category->description;
-$borrower->{category_type} = $category->category_type;
-$template->param( BORROWER_INFO => $borrower );
-
 my $total = $patron->account->balance;
 my $accts = Koha::Account::Lines->search(
     { borrowernumber => $patron->borrowernumber },
index d2c4033..8189493 100755 (executable)
@@ -71,7 +71,7 @@ if ( defined $query->param('modify') && $query->param('modify') eq 'yes' ) {
 
 C4::Form::MessagingPreferences::set_form_values({ borrowernumber     => $patron->borrowernumber }, $template);
 
-$template->param( BORROWER_INFO         => $patron->unblessed,
+$template->param(
                   messagingview         => 1,
                   SMSnumber             => $patron->smsalertnumber, # FIXME This is already sent 2 lines above
                   SMSSendDriver                =>  C4::Context->preference("SMSSendDriver"),
index 67bb5fa..8c806e9 100755 (executable)
@@ -42,11 +42,6 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
 );
 
 my $patron = Koha::Patrons->find( $borrowernumber );
-my $category = $patron->category;
-my $borrower= $patron->unblessed;
-$borrower->{description} = $category->description;
-$borrower->{category_type} = $category->category_type;
-$template->param( BORROWER_INFO => $borrower );
 
 $template->param(
     routinglistsview => 1,
index 78bd30b..94b0614 100755 (executable)
@@ -163,7 +163,7 @@ if ( $borr->{'dateexpiry'} && C4::Context->preference('NotifyBorrowerDeparture')
 # pass on any renew errors to the template for displaying
 my $renew_error = $query->param('renew_error');
 
-$template->param(   BORROWER_INFO     => $borr,
+$template->param(
                     amountoutstanding => $amountoutstanding,
                     borrowernumber    => $borrowernumber,
                     patron_flagged    => $borr->{flagged},
@@ -350,7 +350,6 @@ if (   C4::Context->preference('AllowPatronToSetCheckoutsVisibilityForGuarantor'
 }
 
 $template->param(
-    borrower                 => scalar Koha::Patrons->find($borrowernumber),
     patron_messages          => $patron_messages,
     opacnote                 => $borr->{opacnote},
     patronupdate             => $patronupdate,