# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
=head1 member-search.pl
my @categories=C4::Category->all;
my $branches=(defined $$patron{branchcode}?GetBranchesLoop($$patron{branchcode}):GetBranchesLoop());
+my $subscriptionid = $cgi->param('subscriptionid');
+my $searchstring = $cgi->param('member');
my %categories_dislay;
my ($template, $loggedinuser, $cookie);
query => $cgi,
type => "intranet",
authnotrequired => 0,
- flagsrequired => {borrowers => 1},
+ flagsrequired => { serials => 'routing' },
});
foreach my $category (@categories){
my $member=$cgi->param('member');
my $orderby=$cgi->param('orderby');
$orderby = "surname,firstname" unless $orderby;
-$member =~ s/,//g; #remove any commas from search string
-$member =~ s/\*/%/g;
+if (defined $member) {
+ $member =~ s/,//g; #remove any commas from search string
+ $member =~ s/\*/%/g;
+}
my ($count,$results);
my @searchpatron;
push @searchpatron, $member if ($member);
-push @searchpatron, $patron if (keys %$patron);
-my $from= ($startfrom-1)*$resultsperpage;
-my $to=$from+$resultsperpage;
- #($results)=Search(\@searchpatron,{surname=>1,firstname=>1},[$from,$to],undef,["firstname","surname","email","othernames"] ) if (@searchpatron);
- ($results)=Search(\@searchpatron,{surname=>1,firstname=>1},undef,undef,["firstname","surname","email","othernames","cardnumber"],"start_with" ) if (@searchpatron);
-if ($results){
- $count =scalar(@$results);
+push @searchpatron, $patron if ( keys %$patron );
+my $from = ( $startfrom - 1 ) * $resultsperpage;
+my $to = $from + $resultsperpage;
+if (@searchpatron) {
+ ($results) = Search(
+ \@searchpatron,
+ [ { surname => 0 }, { firstname => 0 } ],
+ undef,
+ undef,
+ [ "firstname", "surname", "email", "othernames", "cardnumber" ],
+ "start_with"
+ );
+}
+if ($results) {
+ $count = scalar(@$results);
}
my @resultsdata;
$to=($count>$to?$to:$count);