[Koha-patches] [PATCH 2/2] Bug 6190: Followup fixing empty groups

Katrin Fischer Katrin.Fischer.83 at web.de
Mon Aug 1 21:38:51 CEST 2011


- fixes quoting in database update
- fixes appearance/disappearance of groups with no fields to be shown

To test:
- Enter database field names separated by | into systempreference
  BorrowerUnwantedField
- Check if group/ box and heading are not displayed when all fields from that
  group are hidden using the system preference

Example:
othernames|initials|title|surname|firstname|sex|dateofbirth
= Patron identity should be hidden

othernames|initials|title|surname|firstname|sex
= Group heading and date of birth field are shown
---
 installer/data/mysql/updatedatabase.pl             |    2 +-
 .../prog/en/modules/members/memberentrygen.tt      |   28 +++++++++++++++-----
 2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 851c509..8383376 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -4372,7 +4372,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 
 $DBversion = "3.05.00.XXX";
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
-    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('BorrowerUnwantedField','','Name the fields you don\'t need to store for a patron\'s account',NULL,'free')");
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('BorrowerUnwantedField','','Name the fields you don''t need to store for a patron''s account',NULL,'free')");
     print "Upgrade to $DBversion done (BorrowerUnwantedField syspref)\n";
     SetVersion ($DBversion);
 }
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 9cf28a6..99d93f2 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
@@ -176,6 +176,7 @@
 [% END %]
 
 [% IF ( step_1 ) %]
+[%UNLESS notitle && nosurname && nofirstname && nodateofbirth && noinitials && noothernames &&nosex %]
 	<fieldset class="rows" id="memberentry_identity">
 		<legend>[% IF ( I ) %]Organization [% ELSE %]Patron [% END %]identity</legend>
 		<ol>
@@ -304,6 +305,7 @@
     [% END %]
 		</ol>
 	</fieldset>
+	[% END # hide fieldset %]
 	
 [% IF ( showguarantor ) %]<input type="hidden" id="guarantorid" name="guarantorid"   value="[% guarantorid %]" />
     <fieldset class="rows">
@@ -386,7 +388,8 @@
     </fieldset>
 
 [% END %]
-[% UNLESS noaddress && nocity && nostate %]
+
+[% UNLESS noaddress && noaddress2 && nocity && nostate && nozipcode && nocountry %]
 <fieldset class="rows">
     <legend>Main address</legend><ol>
         [% UNLESS nostreetnumber %]
@@ -503,7 +506,9 @@
         [% END %]
 	</ol>
     </fieldset>
-[% END # nostreet && nocity etc group%]
+[% END # hide fieldset %]
+
+[% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %]
   <fieldset class="rows" id="memberentry_contact">
     <legend>Contact</legend><ol>
         [% UNLESS nophone %]
@@ -582,13 +587,13 @@
         [% END %]
 	</ol>
   </fieldset>
-
+[%END # hide fieldset %]
 
 <!-- ************************ STEP_1 *********************** -->
 [% END %]
 [% IF ( step_6 ) %]
 
-    [% UNLESS noB_address && noB_city && noB_state && noB_phone && noB_email %]
+    [% UNLESS noB_address && noB_address2 && noB_city && noB_zipcode && noB_state && noB_country &&nocontactnote && noB_phone && noB_email %]
 		<fieldset class="rows" id="memberentry_address">
 		<legend>Alternate address</legend><ol>
         [% UNLESS noB_address %]
@@ -700,10 +705,10 @@
         [% END %]
 			</ol>
 		</fieldset>
-    [% END # UNLESS noB_address && noB_city && noB_state && noB_phone && noB_email %]
+    [% END # hide fieldset %]
 [% END %]		
 [% IF ( step_2 ) %]
-    [% UNLESS noaltcontactsurname && noaltcontactfirstname && noaltcontactaddress1 && noaltcontactphone %]
+    [% UNLESS noaltcontactsurname && noaltcontactfirstname && noaltcontactaddress1 && noaltcontactaddress2 && noaltcontactaddress3 && noaltcontactstate && noaltcontactzipcode && noaltcontactcountry && noaltcontactphone %]
 		<fieldset class="rows" id="memberentry_altaddress">       
 		    <legend>Alternate Contact</legend><ol>
         [% UNLESS noaltcontactsurname %]
@@ -816,7 +821,7 @@
         [% END %]
             </ol>
         </fieldset>
-    [% END # UNLESS noaltcontactsurname && noaltcontactfirstname etc %]
+    [% END # hide fieldset %]
 
 
   [% IF ( I ) %]
@@ -924,6 +929,8 @@
         [% END %]
 	</ol>
   </fieldset>
+    
+    [% UNLESS nodateenrolled && nodateexpiry &&  noopacnote && noborrowernotes %]
 	<fieldset class="rows" id="memberentry_subscription">
 	<legend>Library set-up</legend><ol>
         [% UNLESS nodateenrolled %]
@@ -1002,6 +1009,9 @@
         [% END %]
 		</ol>
 	</fieldset>
+    [% END # hide fieldset %]
+    
+    [% UNLESS nouserid && nopassword %]
 	<fieldset class="rows" id="memberentry_userid">
 		<legend>OPAC/Staff Login</legend><ol>
         [% UNLESS nouserid %]
@@ -1021,6 +1031,8 @@
 
 	  [% IF ( mandatoryuserid ) %]<span class="required">Required</span>[% END %]
 		</li>
+		[%END %]
+		[%UNLESS nopassword %]
 		<li>
 			[% IF ( mandatorypassword ) %]
 			<label for="password" class="required">
@@ -1055,6 +1067,8 @@
         [% END %]
     </ol>
 		</fieldset>
+		[%END # hide fieldset %]
+		
 		<!--this zones are not necessary in modif mode -->
 		[% UNLESS ( opadd ) %]
 		<fieldset class="rows">
-- 
1.7.4.1



More information about the Koha-patches mailing list