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

Owen Leonard oleonard at myacpl.org
Mon Aug 15 20:26:57 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      |   13 +++++++++----
 .../prog/en/modules/members/moremember.tt          |    3 ++-
 members/moremember.pl                              |    2 +-
 3 files changed, 12 insertions(+), 6 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 eea4d25..a95ab17 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">
@@ -485,16 +486,18 @@
 	  [% 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 %]
-      Secondary Phone: </label>
+      [% IF ( I ) %]Phone: [% ELSE %]Secondary Phone:[% 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 +508,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 +519,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 cfa75ca..4ff3bfa 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 ) %]
@@ -210,6 +210,7 @@ function validate1(date) {
         [% IF ( email ) %]<li><span class="label">Primary email:</span><a href="mailto:[% email %]">[% email %]</a></li>[% END %]
         [% IF ( emailpro ) %]<li><span class="label">Secondary email: </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 bfaa402..d5c6a5c 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