[Koha-patches] Bugs: 1172 3579 3596 fixes to patron detail in opac

Nicole Engard nengard at gmail.com
Fri Sep 11 16:27:20 CEST 2009


>From 9f23739669a08e019b9acb7b3dff6b2a01447c0d Mon Sep 17 00:00:00 2001
From: Nicole Engard <nengard at gmail.com>
Date: Thu, 10 Sep 2009 19:46:50 -0400
Subject: [PATCH] Bugs: 1172 3579 3596 fixes to patron detail in opac
Content-Type: text/plain; charset="utf-8"

This patch makes it so that the patron can see their
details even if the OPACPatronDetails sys pref is OFF.

It also removed the messaging options from the patron
details and leaves them on the messaging tab.

Finally it adds in address fields that were missing
previously on the update patron form.
---
 koha-tmpl/opac-tmpl/prog/en/includes/usermenu.inc  |    2 -
 .../opac-tmpl/prog/en/modules/opac-messaging.tmpl  |    2 +-
 .../opac-tmpl/prog/en/modules/opac-userupdate.tmpl |  143 ++++++++++++--------
 opac/opac-userupdate.pl                            |   19 ++-
 4 files changed, 102 insertions(+), 64 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/usermenu.inc
b/koha-tmpl/opac-tmpl/prog/en/includes/usermenu.inc
index a8fc320..d4df7c2 100644
--- a/koha-tmpl/opac-tmpl/prog/en/includes/usermenu.inc
+++ b/koha-tmpl/opac-tmpl/prog/en/includes/usermenu.inc
@@ -5,9 +5,7 @@
   <!-- TMPL_IF NAME="OPACFinesTab" -->
   <!-- TMPL_IF NAME="accountview" --><li class="active"><!--
TMPL_ELSE --><li><!-- /TMPL_IF --><a
href="/cgi-bin/koha/opac-account.pl">my fines</a></li>
   <!-- /TMPL_IF -->
-  <!-- TMPL_IF NAME="OPACPatronDetails" -->
   <!-- TMPL_IF NAME="userupdateview" --><li class="active"><!--
TMPL_ELSE --><li><!-- /TMPL_IF --><a
href="/cgi-bin/koha/opac-userupdate.pl">my personal details</a></li>
-    <!-- /TMPL_IF -->
   <!-- TMPL_IF NAME="TagsEnabled" -->
     <!-- TMPL_IF NAME="tagsview" --><li class="active"><!-- TMPL_ELSE
--><li><!-- /TMPL_IF --><a href="/cgi-bin/koha/opac-tags.pl">my
tags</a></li>
   <!-- /TMPL_IF -->
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 53df177..f1532e2 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-messaging.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-messaging.tmpl
@@ -100,11 +100,11 @@

 </fieldset>

-
 <fieldset class="action">
   <input type="submit" value="Submit Changes" /> <a class="cancel"
href="/cgi-bin/koha/opac-user.pl">Cancel</a>
 </fieldset>

+
 </form>
 </div>
 </div>
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 4ae620c..62ec6be 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-userupdate.tmpl
@@ -9,24 +9,25 @@
 	<div id="yui-main">
 	<div class="yui-b"><div class="yui-g" id="userupdate">

-<div class="container" style="overflow:auto;">
+<div class="container">
 <!-- TMPL_LOOP name="BORROWER_INFO" -->
 <h3><a href="/cgi-bin/koha/opac-user.pl"><!-- TMPL_VAR
NAME="firstname" --> <!-- TMPL_VAR NAME="surname" -->'s account</a>
<img src="<!-- TMPL_VAR NAME="themelang" -->../../images/caret.gif"
width="16" height="16" alt="&gt;" border="0" /> Your Personal
Details</h3>

+<!-- TMPL_IF NAME="OPACPatronDetails" -->
 <form action="/cgi-bin/koha/opac-userupdate.pl" method="get">
 <div class="yui-u first">
-
 <input type="hidden" name="modify" value="yes" />
 <fieldset class="brief"><legend>Name</legend><ol>
 <li><label for="firstname">First Name:</label> <input id="firstname"
type="text" value="<!-- TMPL_VAR name="firstname" -->"
name="firstname" /></li>
+<li><label for="othernames">Other Name:</label> <input
id="othernames" type="text" value="<!-- TMPL_VAR name="othernames"
-->"  name="othernames" /></li>
 <li><label for="surname">Last Name:</label> <input id="surname"
type="text" value="<!-- TMPL_VAR name="surname" -->"  name="surname"
/></li>
 </ol>
 </fieldset>

 <fieldset class="brief"><legend>Contact Information</legend>
 <ol>
-<li>
-    <label for="address">Address:</label>
+<li><label for="address">Address:</label>
+	<input id="streetnumber" size ="7" type="text" value="<!-- TMPL_VAR
name="streetnumber" -->"  name="streetnumber" />
 	<input type="text" name="address" value="<!-- TMPL_VAR
NAME="address" -->" id="address" />
 	<input type="text" name="address2" value="<!-- TMPL_VAR
NAME="address2" -->" id="address2" /></li>
 <li><label for="city">City, State:</label> <input id="city"
type="text" value="<!-- TMPL_VAR name="city" -->"  name="city" /></li>
@@ -34,71 +35,30 @@
 <li><label for="country">Country: </label><input id="country"
name="country" value="<!-- TMPL_VAR NAME="country" -->" name="country"
/></li>
 <li><label for="phone">Home Phone:</label> <input id="phone"
type="text" value="<!-- TMPL_VAR name="phone" -->"  name="phone"
/></li>
 <li><label for="mobile">Mobile Phone:</label> <input id="mobile"
type="text" value="<!-- TMPL_VAR name="mobile" -->"  name="mobile"
/></li>
-<li><label for="fax">Fax:</label> <input id="fax" type="text"
value="<!-- TMPL_VAR name="fax" -->"  name="fax" /></li>
-
 <li><label for="phonepro">Work phone:</label> <input id="phonepro"
type="text" value="<!-- TMPL_VAR name="phonepro" -->"  name="phonepro"
/></li>
-
+<li><label for="fax">Fax:</label> <input id="fax" type="text"
value="<!-- TMPL_VAR name="fax" -->"  name="fax" /></li>
 <li><label for="emailaddress">Email:</label> <input id="emailaddress"
type="text" value="<!-- TMPL_VAR name="email" -->"
name="emailaddress" /></li>
-</ol>
-</fieldset>
-
-<fieldset class="brief">
-<legend>Items Borrowed Notifications</legend>
-<ol>
-<li>
-  <label for="items_borrowed_email">Email:</label>
-  <!-- TMPL_IF items_borrowed_email -->
-  <input type="checkbox" id="items_borrowed_email"
name="items_borrowed_email" value="1" checked="checked" />
-  <!-- TMPL_ELSE -->
-  <input type="checkbox" id="items_borrowed_email"
name="items_borrowed_email" value="1" />
-  <!-- /TMPL_IF -->
-</li>
-<li>
-  <label for="items_borrowed_sms">Text Message:</label>
-  <!-- TMPL_IF items_borrowed_sms -->
-  <input type="checkbox" id="items_borrowed_sms"
name="items_borrowed_sms" value="1" checked="checked" />
-  <!-- TMPL_ELSE -->
-  <input type="checkbox" id="items_borrowed_sms"
name="items_borrowed_sms" value="1" />
-  <!-- /TMPL_IF -->
-</li>
-</ol>
-</fieldset>
-
-<fieldset class="brief">
-<legend>Items Returned Notifications</legend>
-<ol>
-<li>
-  <label for="items_returned_email">Email:</label>
-  <!-- TMPL_IF items_returned_email -->
-  <input type="checkbox" id="items_returned_email"
name="items_returned_email" value="1" checked="checked" />
-  <!-- TMPL_ELSE -->
-  <input type="checkbox" id="items_returned_email"
name="items_returned_email" value="1" />
-  <!-- /TMPL_IF -->
-</li>
-<li>
-  <label for="items_returned_sms">Text Message:</label>
-  <!-- TMPL_IF items_returned_sms -->
-  <input type="checkbox" id="items_returned_sms"
name="items_returned_sms" value="1" checked="checked" />
-  <!-- TMPL_ELSE -->
-  <input type="checkbox" id="items_returned_sms"
name="items_returned_sms" value="1" />
-  <!-- /TMPL_IF -->
-</li>
+<li><label for="emailpro">Work Email:</label> <input id="emailpro"
type="text" value="<!-- TMPL_VAR name="emailpro" -->"  name="emailpro"
/></li>
 </ol>
 </fieldset>

 </div>
 <div class="yui-u">
 <fieldset class="brief">
-<legend>Permanent Address</legend>
+<legend>Alternate Contact Information</legend>
 <ol>
 <li>
-    <label for="B_streetaddress">Permanent or Alternate Address:</label>
-        <textarea id="B_streetaddress" cols="25" rows="3"
name="B_streetaddress"><!--TMPL_VAR NAME="B_streetnumber"--> <!--
TMPL_VAR name="B_address" --> <!-- TMPL_VAR name="B_address2"
--></textarea>
+    <label for="B_streetaddress">Alternate Address:</label>
+    <input id="B_streetnumber" size ="7" type="text" value="<!--
TMPL_VAR name="B_streetnumber" -->"  name="B_streetnumber" />
+    <input id="B_address" type="text" value="<!-- TMPL_VAR
name="B_address" -->"  name="B_address" />
+    <input id="B_address2" type="text" value="<!-- TMPL_VAR
name="B_address2" -->"  name="B_address2" />
 </li>

 <li><label for="B_city">City, State:</label> <input id="B_city"
type="text" value="<!-- TMPL_VAR name="B_city" -->"  name="B_city"
/></li>
-<li><label for="B_zipcode">Zip Code</label> <input type="text"
id="B_zipcode" name="B_zipcode" value="<!-- TMPL_VAR NAME="B_zipcode"
-->" name="B_zipcode" /></li>
-<li><label for="B_country">Country</label> <input type="text"
id="B_country" name="B_country" value="<!-- TMPL_VAR NAME="B_country"
-->" name="B_country" /></li>
+<li><label for="B_zipcode">Zip Code:</label> <input type="text"
id="B_zipcode" name="B_zipcode" value="<!-- TMPL_VAR NAME="B_zipcode"
-->" name="B_zipcode" /></li>
+<li><label for="B_country">Country:</label> <input type="text"
id="B_country" name="B_country" value="<!-- TMPL_VAR NAME="B_country"
-->" name="B_country" /></li>
+<li><label for="B_phone">Phone:</label> <input type="text"
id="B_phone" name="B_phone" value="<!-- TMPL_VAR NAME="B_phone" -->"
name="B_phone" /></li>
+<li><label for="B_email">Email:</label> <input type="text"
id="B_email" name="B_email" value="<!-- TMPL_VAR NAME="B_email" -->"
name="B_email" /></li>
 </ol>
 </fieldset>
 <fieldset class="brief">
@@ -136,6 +96,77 @@
 </div>

 </form>
+<!-- TMPL_ELSE -->
+<p style="clear:left;padding:1em 0">To make changes to your record
please contact the library.</p>
+<div class="yui-u first">
+<fieldset class="rows">
+<legend>Contact Information</legend>
+<ol>
+<li><span class="label">Name:</span> <!-- TMPL_VAR NAME="firstname"
--> <!-- TMPL_VAR NAME="surname" --></li>
+<li><span class="label">Other Name:</span> <!-- TMPL_VAR
NAME="othernames" --></li>
+<li><span class="label">Address:</span> <!-- TMPL_VAR
NAME="streetnumber" --> <!-- TMPL_VAR NAME="address" --></li>
+<li><span class="label">&nbsp;</span><!-- TMPL_VAR NAME="address2" --></li>
+<li><span class="label">City, State:</span>  <!-- TMPL_VAR name="city" --></li>
+<li><span class="label">Zip Code:</span>  <!-- TMPL_VAR NAME="zipcode" --></li>
+<li><span class="label">Country:</span>  <!-- TMPL_VAR NAME="country" --></li>
+<li><span class="label">Home Phone:</span>  <!-- TMPL_VAR name="phone" --></li>
+<li><span class="label">Mobile Phone:</span>  <!-- TMPL_VAR
name="mobile" --></li>
+<li><span class="label">Work phone:</span>  <!-- TMPL_VAR
name="phonepro" --></li>
+<li><span class="label">Fax:</span>  <!-- TMPL_VAR name="fax" --></li>
+<li><span class="label">Email:</span>  <!-- TMPL_VAR name="email" --></li>
+<li><span class="label">Work Email:</span>  <!-- TMPL_VAR
name="emailpro" --></li>
+</ol>
+</fieldset>
+
+<fieldset class="rows">
+<legend>Personal Information</legend>
+<ol>
+<li><span class="label">Date of Birth:</span> <!-- TMPL_VAR
NAME="dateofbirth" --></li>
+<li><span class="label">Sex:</span>
+<!-- TMPL_IF EXPR="sex eq 'F'" -->Female<!-- /TMPL_IF -->
+<!-- TMPL_IF EXPR="sex eq 'M'" -->Male<!-- /TMPL_IF -->
+</li>
+</ol>
+</fieldset>
+</div>
+
+<div class="yui-u">
+<fieldset class="rows">
+<legend>Alternate Contact Information</legend>
+<ol>
+<li><span class="label">Alternate Address:</span> <!--TMPL_VAR
NAME="B_streetnumber"--> <!-- TMPL_VAR name="B_address" --> </li>
+<li><span class="label">&nbsp;</span><!-- TMPL_VAR NAME="B_address2" --></li>
+<li><span class="label">City, State:</span> <!-- TMPL_VAR
name="B_city" --></li>
+<li><span class="label">Zip Code:</span> <!-- TMPL_VAR
NAME="B_zipcode" --></li>
+<li><span class="label">Country:</span> <!-- TMPL_VAR NAME="B_country" --></li>
+<li><span class="label">Phone:</span> <!-- TMPL_VAR NAME="B_phone" --></li>
+<li><span class="label">Email:</span> <!-- TMPL_VAR NAME="B_email" --></li>
+</ol>
+</fieldset>
+
+<fieldset class="rows">
+<legend>Library Use:</legend>
+<ol>
+<li><span class="label">Card number:</span> <!-- TMPL_VAR
NAME="cardnumber" --></li>
+<li><span class="label">Patron Number:</span> <!-- TMPL_VAR
NAME="borrowernumber" --></li>
+<li><span class="label">Patron Category:</span> <!-- TMPL_VAR
NAME="description" --> (<!-- TMPL_VAR NAME="categorycode" -->)</li>
+<li><span class="label">Joined:</span> <!-- TMPL_VAR
NAME="dateenrolled" --></li>
+<li><span class="label">Expires:</span> <!-- TMPL_VAR
NAME="dateexpiry" --></li>
+   <!-- TMPL_IF NAME="ExtendedPatronAttributes" -->
+    <!-- TMPL_LOOP NAME="patron_attributes" -->
+        <li><span class="label"><!-- TMPL_VAR NAME="description" --></span>
+        <!-- TMPL_IF NAME="value_description" -->
+            <!-- TMPL_VAR NAME="value_description" -->
+        <!-- TMPL_ELSE -->
+            <!-- TMPL_VAR NAME="value" -->
+        <!-- /TMPL_IF -->
+        </li>
+    <!-- /TMPL_LOOP -->
+   <!-- /TMPL_IF  -->
+</ol>
+</fieldset>
+</div>
+<!-- /TMPL_IF  -->
 <!-- /TMPL_LOOP -->
 </div>
 </div>
diff --git a/opac/opac-userupdate.pl b/opac/opac-userupdate.pl
index 8664316..b083779 100755
--- a/opac/opac-userupdate.pl
+++ b/opac/opac-userupdate.pl
@@ -53,13 +53,12 @@ my $lib = GetBranchDetail($borr->{'branchcode'});
 # handle the new information....
 # collect the form values and send an email.
 my @fields = (
-    'surname',       'firstname',
-    'address','address2','city','zipcode','phone','mobile','fax','phonepro',
'emailaddress','B_streetaddress','B_city','B_zipcode','dateofbirth','sex'
+    'surname','firstname','othernames','streetaddress','city','zipcode','country','phone','mobile','fax','phonepro',
'emailaddress','emailpro','B_streetnumber','B_streetaddress','B_city','B_zipcode','B_country','B_phone','B_email','dateofbirth','sex'
 );
 my $update;
 my $updateemailaddress = $lib->{'branchemail'};
 $updateemailaddress =
C4::Context->preference('KohaAdminEmailAddress') unless(
$updateemailaddress =~ /\w+@\w+/);
-if ( $updateemailaddress eq '' ) {
+if ( !$updateemailaddress || $updateemailaddress eq '' ) {
     warn
 "KohaAdminEmailAddress system preference not set.  Couldn't send
patron update information for $borr->{'firstname'} $borr->{'surname'}
(#$borrowernumber)\n";
     my ($template) = get_template_and_user(
@@ -91,8 +90,12 @@ has requested to change her/his personal details.
 Please check these new details and make the changes:
 EOF

+    my $streetnumber = $borr->{'streetnumber'} || '';
+    my $address = $borr->{'address'} || '';
+    my $address2 = $borr->{'address2'} || '';
     my $B_streetnumber = $borr->{'B_streetnumber'} || '';
     my $B_address = $borr->{'B_address'} || '';
+    my $B_address2 = $borr->{'B_address2'} || '';

     foreach my $field (@fields) {
         my $newfield = $query->param($field) || '';
@@ -100,11 +103,17 @@ EOF
         if($borr->{$field}) {
             $borrowerfield = $borr->{$field};
         }
+
+        # reconstruct the address
+        if($field eq "streetaddress") {
+            $borrowerfield = "$streetnumber $address, $address2";
+        }
+
         # reconstruct the alternate address
         if($field eq "B_streetaddress") {
-            $borrowerfield = "$B_streetnumber $B_address";
+            $borrowerfield = "$B_streetnumber $B_address, $B_address2";
         }
-
+
         if($field eq "dateofbirth") {
            $borrowerfield  = format_date( $borr->{'dateofbirth'} ) || '';
         }
-- 
1.5.6.5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Bugs-1172-3579-3596-fixes-to-patron-detail-in-opac.patch
Type: application/octet-stream
Size: 15126 bytes
Desc: not available
URL: </pipermail/koha-patches/attachments/20090911/013520bc/attachment-0001.obj>


More information about the Koha-patches mailing list