From 69dcb22d81e58331e5f4d1975f23516b01fd8ffe Mon Sep 17 00:00:00 2001
From: Aleisha Amohia <aleishaamohia@hotmail.com>
Date: Mon, 20 Nov 2017 02:12:08 +0000
Subject: [PATCH] Bug 19532: UseRecalls syspref

This patch adds a syspref to control the usability of the recalls
feature

Test the following:

Staff side
/includes/circ-menu.inc
/includes/circ-nav.inc
/includes/members-menu.inc
/admin/preferences/circulation.pref
/circ/circulation-home.tt
/circ/circulation.tt
/circ/recalls_overdue.tt
/circ/recalls_queue.tt
/circ/recalls_waiting.tt
/members/moremember.tt
/members/recallshistory.tt

OPAC
/includes/usermenu.inc
/opac-recall.tt
/opac-recalls.tt
/opac-user.tt
/members/recallshistory.pl
/opac/opac-detail.pl
---
 .../bug_19532_-_add_Recalls_syspref.sql            |  1 +
 installer/data/mysql/sysprefs.sql                  |  1 +
 .../intranet-tmpl/prog/en/includes/circ-menu.inc   |  4 ++-
 .../intranet-tmpl/prog/en/includes/circ-nav.inc    |  8 +++---
 .../prog/en/includes/members-menu.inc              |  3 +++
 .../en/modules/admin/preferences/circulation.pref  | 17 +++++++++----
 .../prog/en/modules/circ/circulation-home.tt       |  8 +++---
 .../prog/en/modules/circ/circulation.tt            |  4 +--
 .../prog/en/modules/circ/recalls_overdue.tt        |  8 ++++++
 .../prog/en/modules/circ/recalls_queue.tt          | 29 ++++++++++++++--------
 .../prog/en/modules/circ/recalls_waiting.tt        |  7 ++++++
 .../prog/en/modules/members/moremember.tt          |  4 +--
 .../prog/en/modules/members/recallshistory.tt      | 15 ++++++++---
 .../opac-tmpl/bootstrap/en/includes/usermenu.inc   | 12 +++++----
 .../opac-tmpl/bootstrap/en/modules/opac-recall.tt  | 10 ++++++++
 .../opac-tmpl/bootstrap/en/modules/opac-recalls.tt |  8 ++++++
 .../opac-tmpl/bootstrap/en/modules/opac-user.tt    |  4 +--
 members/recallshistory.pl                          | 26 ++++++++++++++++---
 opac/opac-detail.pl                                |  2 +-
 19 files changed, 129 insertions(+), 42 deletions(-)
 create mode 100644 installer/data/mysql/atomicupdate/bug_19532_-_add_Recalls_syspref.sql

diff --git a/installer/data/mysql/atomicupdate/bug_19532_-_add_Recalls_syspref.sql b/installer/data/mysql/atomicupdate/bug_19532_-_add_Recalls_syspref.sql
new file mode 100644
index 0000000..4381395
--- /dev/null
+++ b/installer/data/mysql/atomicupdate/bug_19532_-_add_Recalls_syspref.sql
@@ -0,0 +1 @@
+INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('UseRecalls','1',NULL,'Enable or disable recalls','YesNo');
diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index 3d98dfc..3ff55f9 100644
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -586,6 +586,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('UseICU','0','1','Tell Koha if ICU indexing is in use for Zebra or not.','YesNo'),
 ('UseKohaPlugins','0','','Enable or disable the ability to use Koha Plugins.','YesNo'),
 ('UseQueryParser','0',NULL,'If enabled, try to use QueryParser for queries.','YesNo'),
+('UseRecalls', '1', NULL, 'Enable or disable recalls', 'YesNo'),
 ('UseTransportCostMatrix','0','','Use Transport Cost Matrix when filling holds','YesNo'),
 ('UseWYSIWYGinSystemPreferences','0','','Show WYSIWYG editor when editing certain HTML system preferences.','YesNo'),
 ('viewISBD','1','','Allow display of ISBD view of bibiographic records','YesNo'),
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 871fc6e..b03d1cc 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
@@ -120,6 +120,8 @@
     [% IF Koha.Preference('ILLModule') %]
         <li><a href="/cgi-bin/koha/ill/ill-requests.pl?borrowernumber=[% borrowernumber %]">Interlibrary loans</a></li>
     [% END %]
-    <li><a href="/cgi-bin/koha/members/recallshistory.pl">Recalls history</a></li>
+    [% IF Koha.Preference('UseRecalls') %]
+        <li><a href="/cgi-bin/koha/members/recallshistory.pl">Recalls history</a></li>
+    [% END %]
 </ul></div>
 [% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc
index 9835d13..5e6b177 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-nav.inc
@@ -49,9 +49,11 @@
             [% IF Koha.Preference('OnSiteCheckouts') %]
                 <li><a href="/cgi-bin/koha/circ/on-site_checkouts.pl">Pending on-site checkouts</a></li>
             [% END %]
-            <li><a href="/cgi-bin/koha/circ/recalls_queue.pl">Recalls queue</a></li>
-            <li><a href="/cgi-bin/koha/circ/recalls_overdue.pl">Overdue recalls</a></li>
-            <li><a href="/cgi-bin/koha/circ/recalls_waiting.pl">Recalls awaiting pickup</a></li>
+            [% IF Koha.Preference('UseRecalls') %]
+                <li><a href="/cgi-bin/koha/circ/recalls_queue.pl">Recalls queue</a></li>
+                <li><a href="/cgi-bin/koha/circ/recalls_overdue.pl">Overdue recalls</a></li>
+                <li><a href="/cgi-bin/koha/circ/recalls_waiting.pl">Recalls awaiting pickup</a></li>
+            [% END %]
         </ul>
 
     </div>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-menu.inc
index 43d0e5a..fbd6987 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-menu.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-menu.inc
@@ -23,6 +23,9 @@
     [% IF Koha.Preference('HouseboundModule') %]
         [% IF houseboundview %]<li class="active">[% ELSE %]<li>[% END %]<a href="/cgi-bin/koha/members/housebound.pl?borrowernumber=[% borrowernumber %]">Housebound</a></li>
     [% END %]
+    [% IF Koha.Preference('UseRecalls') %]
+        <li><a href="/cgi-bin/koha/members/recallshistory.pl">Recalls history</a></li>
+    [% END %]
   </ul>
 </div>
 [% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
index 78d4834..9c5f9e9 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
@@ -160,11 +160,6 @@ Circulation:
 
     Checkout Policy:
         -
-            - Mark a recall as problematic if it has been waiting to be picked up for
-            - pref: RecallsMaxPickUpDelay
-            - class: integer
-            - days.
-        -
             - pref: AllowTooManyOverride
               choices:
                   yes: Allow
@@ -880,6 +875,18 @@ Circulation:
                   yes: Enable
                   no: Disable
             - "housebound module"
+    Recalls:
+        -
+            - pref: UseRecalls
+              choices:
+                  yes: Use
+                  no: "Don't use"
+            - recalls
+        -
+            - Mark a recall as problematic if it has been waiting to be picked up for
+            - pref: RecallsMaxPickUpDelay
+            - class: integer
+            - days.
     Article Requests:
         -
             - pref: ArticleRequests
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt
index c212257..a18443a 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation-home.tt
@@ -55,9 +55,11 @@
     [% IF Koha.Preference('OnSiteCheckouts') %]
         <li><a href="/cgi-bin/koha/circ/on-site_checkouts.pl">Pending on-site checkouts</a></li>
     [% END %]
-    <li><a href="/cgi-bin/koha/circ/recalls_queue.pl">Recalls queue</a></li>
-    <li><a href="/cgi-bin/koha/circ/recalls_overdue.pl">Overdue recalls</a></li>
-    <li><a href="/cgi-bin/koha/circ/recalls_waiting.pl">Recalls awaiting pickup</a></li>
+    [% IF Koha.Preference('UseRecalls') %]
+        <li><a href="/cgi-bin/koha/circ/recalls_queue.pl">Recalls queue</a></li>
+        <li><a href="/cgi-bin/koha/circ/recalls_overdue.pl">Overdue recalls</a></li>
+        <li><a href="/cgi-bin/koha/circ/recalls_waiting.pl">Recalls awaiting pickup</a></li>
+    [% END %]
 </ul>
 	
 	</div>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
index 7bbe493..15722e3 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
@@ -948,7 +948,7 @@ No patron matched <span class="ex">[% message | html %]</span>
         [% END %]
     </li>
 
-    [% IF recalls.count %]
+    [% IF Koha.Preference('UseRecalls') && recalls.count %]
         <li><a href="#recalls" id+"recalls-tab">[% recalls.count %] Recall(s)</a></li>
     [% END %]
 
@@ -1062,7 +1062,7 @@ No patron matched <span class="ex">[% message | html %]</span>
 [% END %]
 </div> <!-- reservesloop -->
 
-[% IF recalls.count %]
+[% IF Koha.Preference('UseRecalls') && recalls.count %]
     [% INCLUDE 'recalls.inc' %]
 [% END %]
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_overdue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_overdue.tt
index 494cfdc..dc7bc16 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_overdue.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_overdue.tt
@@ -28,6 +28,8 @@
 
                 <h1>Overdue recalls</h1>
 
+                [% IF Koha.Preference('UseRecalls') %]
+
                 [% IF recalls.count %]
 
                     <form method="post" action="/cgi-bin/koha/circ/recalls_queue.pl">
@@ -103,6 +105,12 @@
 
                 [% END %]
 
+                [% ELSE %]
+
+                    <div class="dialog message">Recalls have not been enabled. Enable the <a href="/cgi-bin/koha/admin/preferences.pl?tab=circulation">UseRecalls</a> system preference to use recalls.</div>
+
+                [% END %]
+
             </div>
         </div>
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_queue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_queue.tt
index 5d28ac1..f51d149 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_queue.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_queue.tt
@@ -28,24 +28,31 @@
 
                 <h1>Recalls queue</h1>
 
-                [% IF recalls.count %]
+                [% IF Koha.Preference('UseRecalls') %]
 
-                    <form method="post" action="/cgi-bin/koha/circ/recalls_queue.pl">
-                        <input type="hidden" name="op" value="cancel_multiple_recalls">
+                    [% IF recalls.count %]
 
-                        <input type="checkbox" id="select_all"> <span id="select_all_text">Select all</span>
+                        <form method="post" action="/cgi-bin/koha/circ/recalls_queue.pl">
+                            <input type="hidden" name="op" value="cancel_multiple_recalls">
 
-                        [% INCLUDE 'recalls-reports.inc' %]
+                            <input type="checkbox" id="select_all"> <span id="select_all_text">Select all</span>
 
-                        <fieldset class="action">
-                            <button type="submit" id="cancel_selected" class="btn btn-default btn-sm">Cancel selected recalls</button>
-                        </fieldset>
-                    </form>
+                            [% INCLUDE 'recalls-reports.inc' %]
 
-                [% ELSE %]
+                            <fieldset class="action">
+                                <button type="submit" id="cancel_selected" class="btn btn-default btn-sm">Cancel selected recalls</button>
+                            </fieldset>
+                        </form>
+
+                    [% ELSE %]
+
+                        <div class="dialog message">No recalls have been made.</div>
 
-                    <div class="dialog message">No recalls have been made.</div>
+                    [% END %]
+
+                [% ELSE %]
 
+                    <div class="dialog message">Recalls have not been enabled. Enable the <a href="/cgi-bin/koha/admin/preferences.pl?tab=circulation">UseRecalls</a> system preference to use recalls.</div>
                 [% END %]
 
             </div>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_waiting.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_waiting.tt
index ddd0bd2..4cb2983 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_waiting.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/recalls_waiting.tt
@@ -40,6 +40,8 @@
 
                 <h1>Recalls awaiting pickup</h1>
 
+                [% IF Koha.Preference('UseRecalls') %]
+
                 [% IF recalls.size > 0 %]
 
                 <div id="results" class="toptabs">
@@ -152,6 +154,11 @@
 
                 [% END %]
 
+                [% ELSE %]
+
+                    <div class="dialog message">Recalls have not been enabled. Enable the <a href="/cgi-bin/koha/admin/preferences.pl?tab=circulation">UseRecalls</a> system preference to use recalls.</div>
+                [% END %]
+
             </div>
         </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 3956c11..c6031c6 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
@@ -537,7 +537,7 @@ function validate1(date) {
                 <a href="#reserves" id="holds-tab">0 Holds</a>
             [% END %]
         </li>
-        [% IF recalls.count %]
+        [% IF Koha.Preference('UseRecalls') && recalls.count %]
             <li><a href="#recalls" id+"recalls-tab">[% recalls.count %] Recall(s)</a></li>
         [% END %]
         [% IF Koha.Preference('ArticleRequests') %]
@@ -652,7 +652,7 @@ function validate1(date) {
     [% ELSE %]<p>Patron has nothing on hold.</p>[% END %]
 	</div>
 
-[% IF recalls %]
+[% IF Koha.Preference('UseRecalls') && recalls %]
     [% INCLUDE 'recalls.inc' %]
 [% END %]
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/recallshistory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/recallshistory.tt
index a7ee266..e87c37d 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/recallshistory.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/recallshistory.tt
@@ -1,7 +1,7 @@
 [% USE KohaDates %]
 [% USE Koha %]
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Recalls history for [% patron.firstname %] [% patron.surname %]</title>
+<title>Recalls history for [% INCLUDE 'patron-title.inc' %]</title>
 [% INCLUDE 'doc-head-close.inc' %]
 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
 [% INCLUDE 'datatables.inc' %]
@@ -14,19 +14,26 @@
 <div id="breadcrumbs">
     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
     <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo;
-    Recalls history for [% patron.firstname %] [% patron.surname %]
+    Recalls history for [% INCLUDE 'patron-title.inc' %]
 </div>
 
 <div id="doc3" class="yui-t2">
     <div id="bd">
         <div id="yui-main">
             <div class="yui-b">
-
             [% INCLUDE 'members-toolbar.inc' %]
 
             <h1>Recalls history</h1>
 
-             [% INCLUDE 'recalls.inc' %]
+            [% IF Koha.Preference('UseRecalls') %]
+
+                [% INCLUDE 'recalls.inc' %]
+
+            [% ELSE %]
+
+                <div class="dialog message">Recalls have not been enabled. Enable the <a href="/cgi-bin/koha/admin/preferences.pl?tab=circulation">UseRecalls</a> system preference to use recalls.</div>
+
+            [% END %]
 
             </div>
         </div>
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc
index 02f6f29..a37ad89 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc
@@ -114,12 +114,14 @@
                 <a href="/cgi-bin/koha/opac-illrequests.pl">your interlibrary loan requests</a></li>
             [% END %]
 
-            [% IF ( recallsview ) %]
-                <li class="active">
-            [% ELSE %]
-                <li>
+            [% IF Koha.Preference('UseRecalls') %]
+                [% IF ( recallsview ) %]
+                    <li class="active">
+                [% ELSE %]
+                    <li>
+                [% END %]
+                <a href="/cgi-bin/koha/opac-recalls.pl">your recalls history</a></li>
             [% END %]
-            <a href="/cgi-bin/koha/opac-recalls.pl">your recalls history</a></li>
 
         </ul>
     </div>
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recall.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recall.tt
index e5c5805..43a84e9 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recall.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recall.tt
@@ -24,6 +24,9 @@
             <div class="span10">
                 <div id="discharge" class="maincontainer">
                     <h1>Recall an item</h1>
+
+                    [% IF Koha.Preference('UseRecalls') %]
+
                     [% IF error %]
                         <div class="dialog alert">
                             [% IF error == 'notloggedin' %]
@@ -52,6 +55,13 @@
                         [% END %]
 
                     [% END %]
+
+                    [% ELSE %]
+
+                        Recalls have not been enabled. Please contact your library.
+
+                    [% END %]
+
                 </div> <!-- / #discharge -->
             </div> <!-- / .span10 -->
         </div> <!-- / .row-fluid -->
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recalls.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recalls.tt
index cb6e382..0243be8 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recalls.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recalls.tt
@@ -27,6 +27,8 @@
 
                 <h2>Recalls history</h2>
 
+                [% IF Koha.Preference('UseRecalls') %]
+
                     [% IF RECALLS.count %]
                         <div id="opac-user-recalls">
                             <table id="recalls-table" class="table table-bordered table-striped">
@@ -114,6 +116,12 @@
                         </div>
                     [% END # / # RECALLS.count %]
 
+                [% ELSE %]
+
+                    Recalls have not been enabled. Please contact your library.
+
+                [% END %]
+
                 </div> <!-- /#recalls -->
             </div> <!-- /.span10 -->
         </div> <!-- /.row-fluid -->
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
index e4f3b63..0a9c801 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt
@@ -154,7 +154,7 @@ Using this account is not recommended because some parts of Koha will not functi
                             [% END %]
 
                             [% IF ( RESERVES.count ) %]<li><a href="#opac-user-holds">Holds ([% RESERVES.count %])</a></li>[% END %]
-                            [% IF ( RECALLS.count ) %]<li><a href="#opac-user-recalls">Recalls ([% RECALLS.count %])</a></li>[% END %]
+                            [% IF ( Koha.Preference('UseRecalls') && RECALLS.count ) %]<li><a href="#opac-user-recalls">Recalls ([% RECALLS.count %])</a></li>[% END %]
                             [% IF Koha.Preference('ArticleRequests') && borrower.article_requests_current %]<li><a href="#opac-user-article-requests">Article requests ([% borrower.article_requests_current.count %])</a></li>[% END %]
                             [% IF ( OverDriveCirculation ) %]
                             <li><a href="#opac-user-overdrive">OverDrive Account</a></li>
@@ -778,7 +778,7 @@ Using this account is not recommended because some parts of Koha will not functi
                         </div> <!-- / #opac-user-holds -->
                         [% END # / #RESERVES.count %]
 
-                        [% IF RECALLS.count %]
+                        [% IF Koha.Preference('UseRecalls') && RECALLS.count %]
                             <div id="opac-user-recalls">
                                 <table id="recalls-table" class="table table-bordered table-striped">
                                     <caption>Recalls <span class="count">([% RECALLS.count %])</span></caption>
diff --git a/members/recallshistory.pl b/members/recallshistory.pl
index 3a6bc2f..0559a2f 100755
--- a/members/recallshistory.pl
+++ b/members/recallshistory.pl
@@ -44,10 +44,30 @@ my $recalls = Koha::Recalls->search({ borrowernumber => $loggedinuser });
 
 my $patron = Koha::Patrons->find($loggedinuser);
 
+$template->param( picture => 1 ) if $patron->image;
+
 $template->param(
-    recalls => $recalls,
-    patron => $patron,
-    recallsview => 1
+    recalls         => $recalls,
+    recallsview     => 1,
+    borrowernumber  => $loggedinuser,
+    title           => $patron->title,
+    initials        => $patron->initials,
+    surname         => $patron->surname,
+    firstname       => $patron->firstname,
+    cardnumber      => $patron->cardnumber,
+    categorycode    => $patron->categorycode,
+    category_type   => $patron->category->category_type,
+    categoryname    => $patron->category->description,
+    address         => $patron->address,
+    streetnumber    => $patron->streetnumber,
+    streettype      => $patron->streettype,
+    address2        => $patron->address2,
+    city            => $patron->city,
+    zipcode         => $patron->zipcode,
+    country         => $patron->country,
+    phone           => $patron->phone,
+    email           => $patron->email,
+    branchcode      => $patron->branchcode
 );
 
 output_html_with_http_headers $input, $cookie, $template->output;
diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl
index cd38b6b..fd4c6ae 100755
--- a/opac/opac-detail.pl
+++ b/opac/opac-detail.pl
@@ -709,7 +709,7 @@ if ( not $viewallitems and @items > $max_items_to_display ) {
           if grep /^$itm->{itemnumber}$/, @itemnumbers_on_order;
     }
 
-    if ( $itm->{datedue} && $borrowernumber && $itm->{borrowernumber} != $borrowernumber ) {
+    if ( $itm->{datedue} && $borrowernumber && $itm->{borrowernumber} != $borrowernumber && C4::Context->preference('UseRecalls') ) {
         $itm->{avail_for_recall} = 1;
     }
 
-- 
2.1.4