[Koha-patches] [PATCH] Fix for Bug 6698, Detail page for organisations should show only valid fields

Owen Leonard oleonard at myacpl.org
Wed Aug 10 21:03:56 CEST 2011


The output of moremember.pl is supposed to change if the patron
in question is an organization (has a category which is of type "I").
The script was checking borrowers.categorycode when it should have
been checking categories.category_type. With this correction the
right variable is passed to the template.

The template needed additional corrections to be sure the correct
fields were appearing. The patron entry form offers only phonepro
and emailpro, so moremember.pl should output those fields in
particular. This patch hides other fields as suggested by the Bug
report.
---
 .../prog/en/modules/members/memberentrygen.tt      |   14 +++++++++-----
 .../prog/en/modules/members/moremember.tt          |    5 +++--
 members/moremember.pl                              |    2 +-
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
index 236295d..fc54bac 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
@@ -201,7 +201,7 @@
 		[% ELSE %]
 		<label for="surname">
 		[% END %]
-		Surname: </label>
+		[% IF ( I ) %] Name: [% ELSE %] Surname: [% END %]</label>
 		[% IF ( uppercasesurnames ) %]
 		<input style="text-transform:uppercase;" type="text" id="surname" name="surname" size="20"  value="[% surname %]"[% IF ( opduplicate ) %] onclick="this.value=''"[% END %] />
 		[% ELSE %]
@@ -474,6 +474,7 @@
     </fieldset>
   <fieldset class="rows" id="memberentry_contact">
     <legend>Contact</legend><ol>
+    [% UNLESS ( I ) %]
       <li>
       [% IF ( mandatoryphone ) %] 
       <label for="phone" class="required">
@@ -483,18 +484,19 @@
       Phone (home): </label>
       <input type="text" id="phone" name="phone" value="[% phone %]"[% IF ( opduplicate ) %] onclick="this.value=''"[% END %] />
 	  [% IF ( mandatoryphone ) %]<span class="required">Required</span>[% END %]<div class="hint">Shows on transit slips</div>
-
     </li>
+    [% END %]
     <li>
       [% IF ( mandatoryphonepro ) %]
       <label for="phonepro" class="required">
       [% ELSE %]
       <label for="phonepro">
       [% END %]
-      Phone (work): </label>
+      [% IF ( I ) %]Phone: [% ELSE %]Phone (work):[% END %] </label>
       <input type="text" id="phonepro" name="phonepro" value="[% phonepro %]"[% IF ( opduplicate ) %] onclick="this.value=''"[% END %] />
 	  [% IF ( mandatoryphonepro ) %]<span class="required">Required</span>[% END %]
     </li>
+    [% UNLESS ( I ) %]
     <li>
       [% IF ( mandatorymobile ) %]
       <label for="mobile" class="required">
@@ -505,6 +507,8 @@
       <input type="text" id="mobile" name="mobile" value="[% mobile %]"[% IF ( opduplicate ) %] onclick="this.value=''"[% END %] />
 	  [% IF ( mandatorymobile ) %]<span class="required">Required</span>[% END %]
     </li>
+    [% END %]
+    [% UNLESS ( I ) %]
     <li>
       [% IF ( mandatoryemail ) %]
       <label for="email" class="required">
@@ -514,15 +518,15 @@
       Primary Email: </label>
       <input type="text" id="email" name="email" size="45" value="[% email %]"[% IF ( opduplicate ) %] onclick="this.value=''"[% END %] />  
 	  [% IF ( mandatoryemail ) %]<span class="required">Required</span>[% END %]<div class="hint">Shows on transit slips</div>
-
     </li>
+    [% END %]
     <li>
       [% IF ( mandatoryemailpro ) %] 
       <label for="emailpro" class="required">
       [% ELSE %]
       <label for="emailpro">
       [% END %]
-      Secondary Email: </label>
+      [% IF ( I ) %]Email: [% ELSE %]Secondary Email:[% END %] </label>
       <input type="text" id="emailpro" name="emailpro" size="45" value="[% emailpro %]"[% IF ( opduplicate ) %] onclick="this.value=''"[% END %] />
 	  [% IF ( mandatoryemailpro ) %]<span class="required">Required</span>[% END %]
     </li>
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 67286bf..43bc75b 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
@@ -177,7 +177,7 @@ function validate1(date) {
  <div class="yui-u first">
 <div id="patron-information" style="padding : .5em;">
 
-     [% UNLESS ( I ) %][% IF ( othernames ) %]&ldquo;[% othernames %]&rdquo;[% END %]
+     [% UNLESS ( I ) %][% IF ( othernames ) %]&ldquo;[% othernames %]&rdquo;[% END %][% END %]
 
 <p class="address">[% streetnumber %]
         [% IF ( roaddetails ) %]
@@ -188,7 +188,7 @@ function validate1(date) {
     	[% IF ( city ) %][% city %][% END %] 
     	[% IF ( state ) %][% state %][% END %]
     	[% IF ( zipcode ) %][% zipcode %]<br />[% END %]
-	[% IF ( country ) %][% country %][% END %]</p>
+	    [% IF ( country ) %][% country %][% END %]</p>
 		    
 	<div class="rows">
 		<ol>
@@ -210,6 +210,7 @@ function validate1(date) {
         [% IF ( email ) %]<li><span class="label">Email (home):</span><a href="mailto:[% email %]">[% email %]</a></li>[% END %]
         [% IF ( emailpro ) %]<li><span class="label">Email (work): </span><a href="mailto:[% emailpro %]">[% emailpro %]</a></li>[% END %]
     [% END %]
+    [% UNLESS ( I ) %]
     <li><span class="label">Initials: </span>[% initials %]</li>
     <li><span class="label">Date of birth:</span>[% dateofbirth %]</li>
     <li><span class="label">Gender:</span>
diff --git a/members/moremember.pl b/members/moremember.pl
index 9292fd0..f77137f 100755
--- a/members/moremember.pl
+++ b/members/moremember.pl
@@ -132,7 +132,7 @@ my $category_type = $data->{'category_type'};
 ### $category_type
 
 # in template <TMPL_IF name="I"> => instutitional (A for Adult& C for children) 
-$template->param( $data->{'categorycode'} => 1 ); 
+$template->param( $data->{'category_type'} => 1 );
 
 $debug and printf STDERR "dates (enrolled,expiry,birthdate) raw: (%s, %s, %s)\n", map {$data->{$_}} qw(dateenrolled dateexpiry dateofbirth);
 foreach (qw(dateenrolled dateexpiry dateofbirth)) {
-- 
1.7.3



More information about the Koha-patches mailing list