followup on Owen's patron attributes patch
authorGalen Charlton <galen.charlton@liblime.com>
Thu, 16 Oct 2008 15:10:09 +0000 (10:10 -0500)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Wed, 12 Nov 2008 13:48:54 +0000 (14:48 +0100)
Hide the display of the patron attributes only if
no types are defined; the patron attributes section
(and more importantly, the edit link), should still
be displayed if an attribute type is defined, even
if the patron has no attributes currently set.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl
members/moremember.pl

index 6f52ed7..f42fcaf 100644 (file)
@@ -231,7 +231,7 @@ if (nodename =="barcodes[]"){
 <!-- End Upload Patron Image Section -->
 
 <!-- TMPL_IF NAME="ExtendedPatronAttributes" -->
-<!-- TMPL_IF NAME="patron_attributes" -->
+<!-- TMPL_UNLESS NAME="no_patron_attribute_types" -->
 <div id="patron-extended-attributes" style="padding-top: 1em;">
 <h3>Additional attributes and identifiers</h3>
 <table>
@@ -252,7 +252,7 @@ if (nodename =="barcodes[]"){
 </table>
 </div>
 <div class="action"><a href="memberentry.pl?op=modify&amp;borrowernumber=<!-- TMPL_VAR NAME="borrowernumber" -->&amp;step=4">Edit</a></div>
-<!-- /TMPL_IF -->
+<!-- /TMPL_UNLESS -->
 <!-- /TMPL_IF -->
 </div>
  <div class="yui-u"> 
index ae3f82d..b0299f2 100755 (executable)
@@ -38,6 +38,7 @@ use C4::Auth;
 use C4::Output;
 use C4::Members;
 use C4::Members::Attributes;
+use C4::Members::AttributeTypes;
 use C4::Dates;
 use C4::Reserves;
 use C4::Circulation;
@@ -340,6 +341,10 @@ $template->param($data);
 if (C4::Context->preference('ExtendedPatronAttributes')) {
     $template->param(ExtendedPatronAttributes => 1);
     $template->param(patron_attributes => C4::Members::Attributes::GetBorrowerAttributes($borrowernumber));
+    my @types = C4::Members::AttributeTypes::GetAttributeTypes();
+    if (scalar(@types) == 0) {
+        $template->param(no_patron_attribute_types => 1);
+    }
 }
 
 $template->param(