[Patches] [PATCH] [SIGNED-OFF] Bug 6190: BorrowerUnwantedField syspref and removing fields from the patron entry

koha-patchbot at kohaaloha.com koha-patchbot at kohaaloha.com
Tue Nov 15 01:45:02 NZDT 2011


From: Srdjan Jankovic <srdjan at catalyst.net.nz>
Date: Mon, 10 Oct 2011 13:12:27 +1300
Subject: [PATCH] [SIGNED-OFF] Bug 6190: BorrowerUnwantedField syspref and removing fields from the patron entry
Content-Type: text/plain; charset="utf-8"

Signed-off-by: Katrin Fischer <Katrin.Fischer.83 at web.de>
Tested with example from bug and by deleting parts of it:
cardnumber|surname|firstname|title|othernames|initials|streetnumber|streettype|address|address2|city|state|zipcode|country|email|phone|mobile|fax|emailpro|phonepro|B_streetnumber|B_streettype|B_address|B_address2|B_city|B_state|B_zipcode|B_country|B_email|B_phone|dateofbirth|branchcode|categorycode|dateenrolled|dateexpiry|gonenoaddress|lost|debarred|contactname|contactfirstname|contacttitle|borrowernotes|relationship|sex|password|userid|opacnote|contactnote|sort1|sort2|altcontactfirstname|altcontactsurname|altcontactaddress1|altcontactaddress2|altcontactaddress3|altcontactstate|altcontactzipcode|altcontactcountry|altcontactphone

Note: This only affects the edit screen, not the patron detail tab.
A nice enhancement would be to make this page follow the system preference too.

Signed-off-by: Marcel de Rooy <m.de.rooy at rijksmuseum.nl>
QA comments on Bugzilla. Passing QA.
---
 admin/systempreferences.pl                         |    1 +
 installer/data/mysql/sysprefs.sql                  |    1 +
 installer/data/mysql/updatedatabase.pl             |    7 +
 .../prog/en/modules/admin/preferences/patrons.pref |    5 +
 .../prog/en/modules/help/members/memberentry.tt    |    1 +
 .../prog/en/modules/members/memberentrygen.tt      |  124 +++++++++++++++++++-
 members/memberentry.pl                             |    7 +
 7 files changed, 142 insertions(+), 4 deletions(-)

diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl
index 78d0768..f4069ae 100755
--- a/admin/systempreferences.pl
+++ b/admin/systempreferences.pl
@@ -224,6 +224,7 @@ $tabsysprefs{intranetreadinghistory}       = "Patrons";
 $tabsysprefs{NotifyBorrowerDeparture}      = "Patrons";
 $tabsysprefs{memberofinstitution}          = "Patrons";
 $tabsysprefs{BorrowerMandatoryField}       = "Patrons";
+$tabsysprefs{BorrowerUnwantedField}        = "Patrons";
 $tabsysprefs{borrowerRelationship}         = "Patrons";
 $tabsysprefs{BorrowersTitles}              = "Patrons";
 $tabsysprefs{patronimages}                 = "Patrons";
diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql
index ae2c1cb..67f0d26 100755
--- a/installer/data/mysql/sysprefs.sql
+++ b/installer/data/mysql/sysprefs.sql
@@ -325,6 +325,7 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES (
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('BasketConfirmations', '1', 'When closing or reopening a basket,', 'always ask for confirmation.|do not ask for confirmation.', 'Choice');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('MARCAuthorityControlField008', '|| aca||aabn           | a|a     d', NULL, NULL, 'Textarea');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpenLibraryCovers',0,'If ON Openlibrary book covers will be show',NULL,'YesNo');
+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');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OpacKohaUrl','1',"Show 'Powered by Koha' text on OPAC footer.",NULL,NULL);
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo');
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 815a71d..42c2e10 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -4550,6 +4550,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = "3.06.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')");
+    print "Upgrade to $DBversion done (BorrowerUnwantedField syspref)\n";
+    SetVersion ($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 DropAllForeignKeys($table)
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
index ac3e1d2..6bfa0df 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
@@ -32,6 +32,11 @@ Patrons:
            class: multi
          - (separate columns with |)
      -
+         - "The following database columns will not appear on the patron entry screen:"
+         - pref: BorrowerUnwantedField
+           class: multi
+         - (separate columns with |)
+     -
          - "Guarantors can be the following of those they guarantee:"
          - pref: borrowerRelationship
            class: multi
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/memberentry.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/memberentry.tt
index f61f5c1..fb91651 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/memberentry.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/members/memberentry.tt
@@ -22,6 +22,7 @@
 	<li>Enter the identifying information regarding your patron
 <ul>
 	<li>Required fields are defined in the BorrowerMandatoryField system preference</li>
+	<li>Unwanted fields are defined in the BorrowerUnwantedField system preference</li>
 	<li>Salutation is populated by the BorrowersTitles system preference</li>
 </ul>
 </li>
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 47ea6c9..57771b4 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
@@ -178,10 +178,12 @@
 [% 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>
 		[% UNLESS ( I ) %]
+        [% UNLESS notitle %]
 		[% IF ( title_cgipopup ) %]
             <li>
             [% IF ( mandatorytitle ) %]
@@ -195,6 +197,8 @@
             </li>
 		[% END %]
         [% END %]
+		[% END %]
+        [% UNLESS nosurname %]
 		<li>
 		[% IF ( mandatorysurname ) %]
 		<label for="surname" class="required">
@@ -217,7 +221,9 @@
 		[% END %]
 		[% IF ( mandatorysurname ) %]<span class="required">Required</span>[% END %]
 		</li>
+        [% END %]
 		[% UNLESS ( I ) %]
+        [% UNLESS nofirstname %]
             <li>
                 [% IF ( mandatoryfirstname ) %]
                 <label for="firstname" class="required">
@@ -228,6 +234,8 @@
                 <input type="text" id="firstname" name="firstname" size="20"  value="[% IF ( opduplicate ) %][% ELSE %][% firstname %][% END %]" />
                 [% IF ( mandatoryfirstname ) %]<span class="required">Required</span>[% END %]
             </li>
+        [% END %]
+        [% UNLESS nodateofbirth %]
             <li>
                 [% IF ( mandatorydateofbirth ) %]
                 <label for="dateofbirth" class="required">
@@ -256,6 +264,8 @@
         [% IF ( ERROR_dateofbirth ) %]<span class="required">(Error)</span>[% END %]
 		<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
             </li>
+        [% END %]
+        [% UNLESS noinitials %]
             <li>
                 [% IF ( mandatoryinitials ) %]
                     <label for="initials" class="required">
@@ -271,6 +281,8 @@
                 [% IF ( mandatoryinitials ) %]<span class="required">Required</span>[% END %]
             </li>
         [% END %]
+        [% END %]
+        [% UNLESS noothernames %]
 		<li>
 			[% IF ( mandatoryothernames ) %]
 			<label for="othernames" class="required">
@@ -286,7 +298,9 @@
 [% IF ( mandatoryothernames ) %]<span class="required">Required</span>[% END %]
 		[% IF ( I ) %]<input type="hidden" name="sex" value="N" />[% END %]
 		</li>
+        [% END %]
     [% UNLESS ( I ) %]
+        [% UNLESS nosex %]
 		<li class="radio">
 		
 		[% IF ( female ) %]
@@ -305,9 +319,11 @@
 				<label for="sex-none">N/A </label><input type="radio" name="sex" id="sex-none" value="" />
 [% END %]
        	</li>
+        [% END %]
     [% END %]
 		</ol>
 	</fieldset>
+[% END # hide fieldset %]    
 	
 [% IF ( showguarantor ) %]<input type="hidden" id="guarantorid" name="guarantorid"   value="[% guarantorid %]" />
     <fieldset class="rows">
@@ -343,6 +359,7 @@
  [% END %]
      <span class="label">Patron #:</span> [% IF ( guarantorid ) %] <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantorid %]" target="blank">[% guarantorid %]</a>[% END %]
  </li>
+        [% UNLESS nocontactname %]
  <li>
      <label for="contactname">Surname: </label>
      [% IF ( guarantorid ) %]
@@ -356,6 +373,8 @@
 		[% END %]
      [% END %]
  </li>
+        [% END %]
+        [% UNLESS nocontactfirstname %]
  <li>
      <label for="contactfirstname">First name: </label>
      [% IF ( guarantorid ) %]
@@ -369,6 +388,7 @@
 	     [% END %]
      [% END %]
  </li>
+        [% END %]
  [% IF ( relshiploop ) %]
  <li>
      <label for="relationship">Relationship: </label>
@@ -398,8 +418,10 @@
     </fieldset>
 
 [% END %]
+[% UNLESS noaddress && noaddress2 && nocity && nostate && nozipcode && nocountry %]
 <fieldset class="rows">
     <legend>Main address</legend><ol>
+        [% UNLESS nostreetnumber %]
     <li>
       [% IF ( mandatorystreetnumber ) %]
       <label for="streetnumber" class="required">
@@ -414,6 +436,8 @@
       [% END %]
 [% IF ( mandatorystreetnumber ) %]<span class="required">Required</span>[% END %]
     </li>
+        [% END %]
+        [% UNLESS nostreettype %]
     [% IF ( road_cgipopup ) %]
       <li>
       [% IF ( mandatorystreettype ) %]
@@ -426,6 +450,8 @@
 	  [% IF ( mandatorystreettype ) %]<span class="required">Required</span>[% END %]
       </li>
     [% END %] 
+        [% END %]
+        [% UNLESS noaddress %]
     <li>
       [% IF ( mandatoryaddress ) %]
       <label for="address" class="required">
@@ -440,6 +466,8 @@
       [% END %]
 	  [% IF ( mandatoryaddress ) %]<span class="required">Required</span>[% END %]
     </li>
+        [% END %]
+        [% UNLESS noaddress2 %]
     <li>
       [% IF ( mandatoryaddress2 ) %]
       <label for="address2" class="required">
@@ -454,6 +482,8 @@
       [% END %]
 	  [% IF ( mandatoryaddress2 ) %]<span class="required">Required</span>[% END %]
     </li>  
+        [% END %]
+        [% UNLESS nocity %]
     <li>
       [% IF ( mandatorycity ) %]
         <label for="city" class="required">
@@ -481,6 +511,8 @@
         [% END %]
 	  [% IF ( mandatorycity ) %]<span class="required">Required</span>[% END %]
     </li>
+        [% END %]
+        [% UNLESS nostate %]
     <li> 
       [% IF ( mandatorystate ) %]
         <label for="state" class="required">
@@ -491,6 +523,8 @@
       <input type="text" name="state" id="state" size="20" value="[% state %]" />
 	  [% IF ( mandatorystate ) %]<span class="required">Required</span>[% END %]
     </li>
+        [% END %]
+        [% UNLESS nozipcode %]
     <li> 
       [% IF ( mandatoryzipcode ) %]
         <label for="zipcode" class="required">
@@ -505,7 +539,8 @@
       [% END %]
 	  [% IF ( mandatoryzipcode ) %]<span class="required">Required</span>[% END %]
     </li>
-    
+        [% END %]
+        [% UNLESS nocountry %]
     <li> 
       [% IF ( mandatorycountry ) %]
         <label for="country" class="required">
@@ -520,11 +555,15 @@
       [% END %]
 	  [% IF ( mandatorycountry ) %]<span class="required">Required</span>[% END %]
     </li>    
-  
+        [% END %]
 	</ol>
     </fieldset>
+[% END # nostreet && nocity etc group%]
+
+[% UNLESS nophone && nophonepro && nomobile && noemail && noemailpro && nofax %]
   <fieldset class="rows" id="memberentry_contact">
     <legend>Contact</legend><ol>
+        [% UNLESS nophone %]
       <li>
       [% IF ( mandatoryphone ) %] 
       <label for="phone" class="required">
@@ -540,6 +579,8 @@
 	  [% IF ( mandatoryphone ) %]<span class="required">Required</span>[% END %]<div class="hint">Shows on transit slips</div>
 
     </li>
+        [% END %]
+        [% UNLESS nophonepro %]
     <li>
       [% IF ( mandatoryphonepro ) %]
       <label for="phonepro" class="required">
@@ -554,6 +595,8 @@
       [% END %]
 	  [% IF ( mandatoryphonepro ) %]<span class="required">Required</span>[% END %]
     </li>
+        [% END %]
+        [% UNLESS nomobile %]
     <li>
       [% IF ( mandatorymobile ) %]
       <label for="mobile" class="required">
@@ -568,6 +611,8 @@
       [% END %]
 	  [% IF ( mandatorymobile ) %]<span class="required">Required</span>[% END %]
     </li>
+        [% END %]
+        [% UNLESS noemail %]
     <li>
       [% IF ( mandatoryemail ) %]
       <label for="email" class="required">
@@ -583,6 +628,8 @@
 	  [% IF ( mandatoryemail ) %]<span class="required">Required</span>[% END %]<div class="hint">Shows on transit slips</div>
 
     </li>
+        [% END %]
+        [% UNLESS noemailpro %]
     <li>
       [% IF ( mandatoryemailpro ) %] 
       <label for="emailpro" class="required">
@@ -597,6 +644,8 @@
       [% END %]
 	  [% IF ( mandatoryemailpro ) %]<span class="required">Required</span>[% END %]
     </li>
+        [% END %]
+        [% UNLESS nofax %]
     <li>
       [% IF ( mandatoryfax ) %]
       <label for="fax" class="required">
@@ -611,16 +660,19 @@
       [% END %]
 	  [% IF ( mandatoryfax ) %]<span class="required">Required</span>[% END %]
     </li>
+        [% END %]
 	</ol>
   </fieldset>
-
+[%END # hide fieldset %]  
 
 <!-- ************************ STEP_1 *********************** -->
 [% END %]
 [% IF ( step_6 ) %]
 
+    [% 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 %]
 			<li>
 				[% IF ( mandatoryB_address ) %]
 					<label for="B_address" class="required">
@@ -635,6 +687,8 @@
 				[% END %]
 	  [% IF ( mandatoryB_address ) %]<span class="required">Required</span>[% END %]
 			</li>
+        [% END %]
+        [% UNLESS noB_address2 %]
 			<li>
 				[% IF ( mandatoryB_address2 ) %]
 					<label for="B_address2" class="required">
@@ -649,6 +703,8 @@
 				[% END %]
 	  [% IF ( mandatoryB_address2 ) %]<span class="required">Required</span>[% END %]
 			</li>
+        [% END %]
+        [% UNLESS noB_city %]
 			<li>
 				[% IF ( mandatoryB_city ) %]
 					<label for="B_city" class="required" >
@@ -659,6 +715,8 @@
 				<input type="text" id="B_city" name="B_city" size="20" value="[% B_city %]" />
 	  [% IF ( mandatoryB_city ) %]<span class="required">Required</span>[% END %]
 			</li>
+        [% END %]
+        [% UNLESS noB_state %]
 			<li>
 				[% IF ( mandatoryB_state ) %]
 					<label for="B_state" class="required" >
@@ -669,6 +727,8 @@
 				<input type="text" id="B_state" name="B_state" size="20" value="[% B_state %]" />
 	  [% IF ( mandatoryB_state ) %]<span class="required">Required</span>[% END %]
 			</li>
+        [% END %]
+        [% UNLESS noB_zipcode %]
 			<li>
 				[% IF ( mandatoryB_zipcode ) %]
 					<label for="B_zipcode" class="required">
@@ -683,6 +743,8 @@
 				[% END %]
 	  [% IF ( mandatoryB_zipcode ) %]<span class="required">Required</span>[% END %]
 			</li>
+        [% END %]
+        [% UNLESS noB_country %]
 			<li>
 				[% IF ( mandatoryB_country ) %]
 					<label for="B_country" class="required">
@@ -697,6 +759,8 @@
 				[% END %]
 	  [% IF ( mandatoryB_country ) %]<span class="required">Required</span>[% END %]
 			</li>
+        [% END %]
+        [% UNLESS noB_phone %]
             <li>
                 [% IF ( mandatoryB_phone ) %]
                 <label for="B_phone" class="required">
@@ -711,6 +775,8 @@
                 [% END %]
                 [% IF ( mandatoryB_phone ) %]<span class="required">Required</span>[% END %]
             </li>
+        [% END %]
+        [% UNLESS noB_email %]
 			<li> 
         [% IF ( mandatoryB_email ) %]
           <label for="B_email" class="required">
@@ -724,6 +790,8 @@
 			<input type="text" id="B_email" name="B_email" size="45" value="[% B_email %]" />
 		[% END %]
 		[% IF ( mandatoryB_email ) %]<span class="required">Required</span>[% END %] </li>
+        [% END %]
+        [% UNLESS nocontactnote %]
             <li>
                 [% IF ( mandatorycontactnote ) %]
                 <label for="contactnote" class="required">
@@ -734,12 +802,16 @@
                 <textarea id="contactnote" name="contactnote" cols="40" rows="2">[% contactnote %]</textarea>
         [% IF ( mandatorycontactnote ) %]<span class="required">Required</span>[% END %]
             </li>
+        [% END %]
 			</ol>
 		</fieldset>
+    [% END # UNLESS noB_address && noB_city && noB_state && noB_phone && noB_email %]
 [% END %]		
 [% IF ( step_2 ) %]
+    [% UNLESS noaltcontactsurname && noaltcontactfirstname && noaltcontactaddress1 && noaltcontactaddress2 && noaltcontactaddress3 && noaltcontactstate && noaltcontactzipcode && noaltcontactcountry && noaltcontactphone %]
 		<fieldset class="rows" id="memberentry_altaddress">       
 		    <legend>Alternate Contact</legend><ol>
+        [% UNLESS noaltcontactsurname %]
 			<li>
 			    [% IF ( mandatoryaltcontactsurname ) %]
 				<label for="altcontactsurname" class="required">
@@ -754,6 +826,8 @@
 				[% END %]
 				[% IF ( mandatoryaltcontactsurname ) %]<span class="required">Required</span>[% END %]
 			</li>
+        [% END %]
+        [% UNLESS noaltcontactfirstname %]
 			<li>
 			    [% IF ( mandatoryaltcontactfirstname ) %]
 				<label for="altcontactfirstname" class="required">
@@ -768,6 +842,8 @@
 				[% END %]
 				[% IF ( mandatoryaltcontactfirstname ) %]<span class="required">Required</span>[% END %]
 			</li>
+        [% END %]
+        [% UNLESS noaltcontactaddress1 %]
 			<li>
 			    [% IF ( mandatoryaltcontactaddress1 ) %]
 				<label for="altcontactaddress1" class="required">
@@ -782,6 +858,8 @@
 				[% END %]
 				[% IF ( mandatoryaltcontactaddress1 ) %]<span class="required">Required</span>[% END %]
 			</li>
+        [% END %]
+        [% UNLESS noaltcontactaddress2 %]
 			<li>
 			    [% IF ( mandatoryaltcontactaddress2 ) %]
 				<label for="altcontactaddress2" class="required">
@@ -796,6 +874,8 @@
 				[% END %]
 				[% IF ( mandatoryaltcontactaddress2 ) %]<span class="required">Required</span>[% END %]
 			</li>
+        [% END %]
+        [% UNLESS noaltcontactaddress3 %]
 			<li>
 			    [% IF ( mandatoryaltcontactaddress3 ) %]
 				<label for="altcontactaddress3" class="required">
@@ -806,6 +886,8 @@
 				<input type="text" name="altcontactaddress3" id="altcontactaddress3" value="[% altcontactaddress3 %]" size="20" />
 				[% IF ( mandatoryaltcontactaddress3 ) %]<span class="required">Required</span>[% END %]
 			</li>
+        [% END %]
+        [% UNLESS noaltcontactstate %]
 			<li>
 			    [% IF ( mandatoryaltcontactstate ) %]
 				<label for="altcontactstate" class="required">
@@ -816,6 +898,8 @@
 				<input type="text" name="altcontactstate" id="altcontactstate" value="[% altcontactstate %]" size="20" />
 				[% IF ( mandatoryaltcontactstate ) %]<span class="required">Required</span>[% END %]
 			</li>
+        [% END %]
+        [% UNLESS noaltcontactzipcode %]
 			<li>
 			    [% IF ( mandatoryaltcontactzipcode ) %]
 				<label for="altcontactzipcode" class="required">
@@ -830,6 +914,8 @@
 				[% END %]
 				[% IF ( mandatoryaltcontactzipcode ) %]<span class="required">Required</span>[% END %]
 			</li>
+        [% END %]
+        [% UNLESS noaltcontactcountry %]
 			<li>
 			    [% IF ( mandatoryaltcontactcountry ) %]
 				<label for="altcontactcountry" class="required">
@@ -844,6 +930,8 @@
 				[% END %]
 				[% IF ( mandatoryaltcontactcountry ) %]<span class="required">Required</span>[% END %]
 			</li>			
+        [% END %]
+        [% UNLESS noaltcontactphone %]
 			<li>
 			    [% IF ( mandatoryaltcontactphone ) %]
 				<label for="altcontactphone" class="required">
@@ -858,14 +946,17 @@
 				[% END %]
 				[% IF ( mandatoryaltcontactphone ) %]<span class="required">Required</span>[% END %]
 			</li>
+        [% END %]
             </ol>
         </fieldset>
+    [% END # UNLESS noaltcontactsurname && noaltcontactfirstname etc %]
 
 [% END %]
 [% IF ( step_3 ) %]
 
   <fieldset class="rows" id="memberentry_library_management">
     <legend>Library Management</legend><ol>
+        [% UNLESS nocardnumber %]
    <li> [% IF ( mandatorycardnumber ) %]
       <label for="cardnumber" class="required">
     [% ELSE %]
@@ -878,6 +969,8 @@
 		<input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber %]" />
     [% END %]
 	  [% IF ( mandatorycardnumber ) %]<span class="required">Required</span>[% END %]</li>
+        [% END %]
+        [% UNLESS nobranchcode %]
     <li>
       [% IF ( mandatorybranchcode ) %]
         <label for="branchcode" class="required">
@@ -888,6 +981,7 @@
       [% CGIbranch %]
 	  [% IF ( mandatorybranchcode ) %]<span class="required">Required</span>[% END %]
     </li>
+        [% END %]
     <li>
         <label for="categorycode">Category: </label>
         <select id="categorycode" name="categorycode">
@@ -913,6 +1007,7 @@
        [% END %]
        </select>
     </li>
+        [% UNLESS nosort1 %]
     <li>
       [% IF ( mandatorysort1 ) %]
         <label for="sort1" class="required">
@@ -927,6 +1022,8 @@
 	  [% IF ( mandatorysort1 ) %]<span class="required">Required</span>[% END %]
       [% END %]   
     </li>
+        [% END %]
+        [% UNLESS nosort2 %]
     <li>
     [% IF ( mandatorysort2 ) %]
     <label for="sort2" class="required">
@@ -945,10 +1042,13 @@
 	  [% IF ( mandatorysort2 ) %]<span class="required">Required</span>[% END %]
     [% END %] 
     </li>
+        [% END %]
 	</ol>
   </fieldset>
+    [% UNLESS nodateenrolled && nodateexpiry &&  noopacnote && noborrowernotes %]
 	<fieldset class="rows" id="memberentry_subscription">
 	<legend>Library set-up</legend><ol>
+        [% UNLESS nodateenrolled %]
 		<li>
 			[% IF ( mandatorydateenrolled ) %]
 			<label for="dateenrolled" class="required">
@@ -975,6 +1075,8 @@
 		[% IF ( ERROR_dateenrolled ) %]<span class="required">(Error)</span>[% END %]
 		<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
 		</li>
+        [% END %]
+        [% UNLESS nodateexpiry %]
 		<li>
 			[% IF ( mandatorydateexpiry ) %]
 			<label for="dateexpiry" class="required">
@@ -1009,6 +1111,8 @@
 		[% IF ( ERROR_dateexpiry ) %]<span class="required">(Error)</span>[% END %]
 		<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
 		</li>
+        [% END %]
+        [% UNLESS noopacnote %]
 		<li>
 			[% IF ( mandatoryopacnote ) %]
 				<label for="opacnote" class="required">
@@ -1020,6 +1124,8 @@
 			<div class="hint">This message appears on this patron's user page in the OPAC</div>
 	  [% IF ( mandatoryopacnote ) %]<span class="required">Required</span>[% END %]
 		</li>
+        [% END %]
+        [% UNLESS noborrowernotes %]
 		<li>
 			[% IF ( mandatoryborrowernotes ) %]	
 				<label for="borrowernotes" class="required">
@@ -1031,10 +1137,15 @@
 			<div class="hint">This message displays when checking out to this patron</div>
 	  [% IF ( mandatoryborrowernotes ) %]<span class="required">Required</span>[% END %]
 		</li>
+        [% END %]
 		</ol>
 	</fieldset>
+    [% END # hide fieldset %]
+
+    [% UNLESS nouserid && nopassword %]
 	<fieldset class="rows" id="memberentry_userid">
 		<legend>OPAC/Staff Login</legend><ol>
+        [% UNLESS nouserid %]
 		<li>
 			[% IF ( mandatoryuserid ) %]
 			<label for="userid" class="required">
@@ -1059,6 +1170,8 @@
 
 	  [% IF ( mandatoryuserid ) %]<span class="required">Required</span>[% END %]
 		</li>
+        [%END %]
+        [% UNLESS nopassword %]
 		<li>
 			[% IF ( mandatorypassword ) %]
 			<label for="password" class="required">
@@ -1101,8 +1214,11 @@
 			[% END %]
 	  [% IF ( mandatorypassword ) %]<span class="required">Required</span>[% END %][% IF ( ERROR_short_password ) %]<span class="required">Password is too short</span>[% END %]
 [% IF ( minPasswordLength ) %]<div class="hint">Minimum password length: [% minPasswordLength %]</div>[% END %]
-		</li></ol>
+		</li>
+        [% END %]
+    </ol>
 		</fieldset>
+        [% END # hide fieldset %]
 		<!--this zones are not necessary in modif mode -->
 		[% UNLESS ( opadd ) %]
 		<fieldset class="rows">
diff --git a/members/memberentry.pl b/members/memberentry.pl
index f01261e..0c8d984 100755
--- a/members/memberentry.pl
+++ b/members/memberentry.pl
@@ -100,6 +100,13 @@ my @field_check=split(/\|/,$check_BorrowerMandatoryField);
 foreach (@field_check) {
 	$template->param( "mandatory$_" => 1);    
 }
+# function to designate unwanted fields
+my $check_BorrowerUnwantedField=C4::Context->preference("BorrowerUnwantedField");
+ at field_check=split(/\|/,$check_BorrowerUnwantedField);
+foreach (@field_check) {
+    next unless m/\w/o;
+	$template->param( "no$_" => 1);    
+}
 $template->param( "add" => 1 ) if ( $op eq 'add' );
 $template->param( "duplicate" => 1 ) if ( $op eq 'duplicate' );
 $template->param( "checked" => 1 ) if ( defined($nodouble) && $nodouble eq 1 );
-- 
1.6.0.6




More information about the Patches mailing list