Bug 9406: ensure confirmation of patron renewal is displayed
[koha_fer] / members / member.pl
index 9b793f4..d705810 100755 (executable)
@@ -58,7 +58,8 @@ my $branches = GetBranches;
 my @branchloop;
 
 foreach (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
-  my $selected = 1 if $branches->{$_}->{branchcode} eq $$patron{branchcode};
+  my $selected;
+  $selected = 1 if $branches->{$_}->{branchcode} eq $$patron{branchcode};
   my %row = ( value => $_,
         selected => $selected,
         branchname => $branches->{$_}->{branchname},
@@ -100,13 +101,19 @@ my @searchfields = $searchfields ? split( ',', $searchfields ) : ( "firstname",
 $member =~ s/,//g;   #remove any commas from search string
 $member =~ s/\*/%/g;
 
+my $searchtype = $input->param('searchtype');
+my %searchtype_ok = ( 'contain' => 1 );
+if ( !defined($searchtype_ok{$searchtype}) ) {
+    undef $searchtype;
+}
+
 my $from = ( $startfrom - 1 ) * $resultsperpage;
 my $to   = $from + $resultsperpage;
 
 my ($count,$results);
 if ($member || keys %$patron) {
     #($results)=Search($member || $patron,{surname=>1,firstname=>1},[$from,$to],undef,["firstname","surname","email","othernames"]  );
-    my $search_scope = ( $quicksearch ? "field_start_with" : "start_with" );
+    my $search_scope = $searchtype || ( $quicksearch ? "field_start_with" : "start_with" );
     ($results) = Search( $member || $patron, \@orderby, undef, undef, \@searchfields, $search_scope );
 }
 
@@ -134,12 +141,13 @@ foreach my $borrower(@$results[$from..$to-1]){
 
   my %row = (
     count => $index++,
-       %$borrower,
-       %{$categories_dislay{$$borrower{categorycode}}},
+    %$borrower,
+    (defined $categories_dislay{ $borrower->{categorycode} }?   %{ $categories_dislay{ $borrower->{categorycode} } }:()),
     overdues => $od,
     issues => $issue,
     odissue => "$od/$issue",
     fines =>  sprintf("%.2f",$fines),
+    branchname => $branches->{$borrower->{branchcode}}->{branchname},
     );
   push(@resultsdata, \%row);
 }