[Koha-patches] [PATCH] C4::Members::SearchMember - support attributes

Galen Charlton galen.charlton at liblime.com
Sat May 10 01:08:18 CEST 2008


Modified SearchMember() so that if the patron attributes
feature is on (i.e., ExtendedPatronAttributes is ON), it
is possible to search for patrons on any attributes whose
type is set as staff searchable.
---
 C4/Members.pm |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/C4/Members.pm b/C4/Members.pm
index 72c8770..2de2a53 100644
--- a/C4/Members.pm
+++ b/C4/Members.pm
@@ -215,9 +215,19 @@ sub SearchMember {
 
             # FIXME - .= <<EOT;
         }
-        $query = $query . ") OR cardnumber LIKE ?
-        order by $orderby";
+        $query = $query . ") OR cardnumber LIKE ? ";
         push( @bind, $searchstring );
+        if (C4::Context->preference('ExtendedPatronAttributes')) {
+            $query .= "OR borrowernumber IN (
+SELECT borrowernumber
+FROM borrower_attributes
+JOIN borrower_attribute_types USING (code)
+WHERE staff_searchable = 1
+AND attribute like ?
+)";
+            push (@bind, $searchstring);
+        }
+        $query .= "order by $orderby";
 
         # FIXME - .= <<EOT;
     }
-- 
1.5.5.rc0.16.g02b00




More information about the Koha-patches mailing list