use strict;
-require Exporter;
use C4::Context;
use C4::Dates qw(format_date_in_iso);
use Digest::MD5 qw(md5_base64);
our ($VERSION,@ISA,@EXPORT,@EXPORT_OK,$debug);
BEGIN {
- $VERSION = 3.02;
- $debug = $ENV{DEBUG} || 0;
+ $VERSION = 3.02;
+ $debug = $ENV{DEBUG} || 0;
+ require Exporter;
+ @ISA = qw(Exporter);
+ #Get data
+ push @EXPORT, qw(
+ &SearchMember
+ &GetMemberDetails
+ &GetMember
+
+ &GetGuarantees
+
+ &GetMemberIssuesAndFines
+ &GetPendingIssues
+ &GetAllIssues
+
+ &get_institutions
+ &getzipnamecity
+ &getidcity
+
+ &GetAge
+ &GetCities
+ &GetRoadTypes
+ &GetRoadTypeDetails
+ &GetSortDetails
+ &GetTitles
+ &GetPatronImage
+
+ &GetMemberAccountRecords
+ &GetBorNotifyAcctRecord
+
+ &GetborCatFromCatType
+ &GetBorrowercategory
+
+ &GetBorrowersWhoHaveNotBorrowedSince
+ &GetBorrowersWhoHaveNeverBorrowed
+ &GetBorrowersWithIssuesHistoryOlderThan
+
+ &GetExpiryDate
+ );
+
+ #Modify data
+ push @EXPORT, qw(
+ &ModMember
+ &changepassword
+ );
+
+ #Delete data
+ push @EXPORT, qw(
+ &DelMember
+ );
+
+ #Insert data
+ push @EXPORT, qw(
+ &AddMember
+ &add_member_orgs
+ &MoveMemberToDeleted
+ &ExtendMemberSubscriptionTo
+ );
+
+ #Check data
+ push @EXPORT, qw(
+ &checkuniquemember
+ &checkuserpassword
+ &Check_Userid
+ &fixEthnicity
+ ðnicitycategories
+ &fixup_cardnumber
+ &checkcardnumber
+ );
}
=head1 NAME
=over 2
-=cut
-
-@ISA = qw(Exporter);
-
-#Get data
-push @EXPORT, qw(
- &SearchMember
- &GetMemberDetails
- &GetMember
-
- &GetGuarantees
-
- &GetMemberIssuesAndFines
- &GetPendingIssues
- &GetAllIssues
-
- &get_institutions
- &getzipnamecity
- &getidcity
-
- &GetAge
- &GetCities
- &GetRoadTypes
- &GetRoadTypeDetails
- &GetSortDetails
- &GetTitles
-
- &GetMemberAccountRecords
- &GetBorNotifyAcctRecord
-
- &GetborCatFromCatType
- &GetBorrowercategory
-
-
- &GetBorrowersWhoHaveNotBorrowedSince
- &GetBorrowersWhoHaveNeverBorrowed
- &GetBorrowersWithIssuesHistoryOlderThan
-
- &GetExpiryDate
-);
-
-#Modify data
-push @EXPORT, qw(
- &ModMember
- &changepassword
-);
-
-#Delete data
-push @EXPORT, qw(
- &DelMember
-);
-
-#Insert data
-push @EXPORT, qw(
- &AddMember
- &add_member_orgs
- &MoveMemberToDeleted
- &ExtendMemberSubscriptionTo
-);
-
-#Check data
-push @EXPORT, qw(
- &checkuniquemember
- &checkuserpassword
- &Check_Userid
- &fixEthnicity
- ðnicitycategories
- &fixup_cardnumber
- &checkcardnumber
-);
-
=item SearchMember
($count, $borrowers) = &SearchMember($searchstring, $type,$category_type,$filter,$showallbranches);
$sth->execute($information);
$data = $sth->fetchrow_hashref;
$sth->finish;
- return ($data);
+ ($data) and return ($data);
}
return undef;
}
"Select count(*) from issues where borrowernumber='$borrowernumber' and
returndate is NULL";
- $debug and print $query, "\n";
+ $debug and warn $query."\n";
my $sth = $dbh->prepare($query);
$sth->execute;
my $data = $sth->fetchrow_hashref;
my $sth = $dbh->prepare($query);
$sth->execute( $category, $sortvalue );
my $lib = $sth->fetchrow;
- return ($lib);
+ return ($lib) if ($lib);
+ return ($sortvalue) unless ($lib);
}
=head2 DeleteBorrower
}
}
+=head2 GetPatronImage
+
+ $patronimage = &GetPatronImage('cardnumber');
+
+Returns the path/filename.jpg of the image for the patron with the supplied cardnumber.
+
+=cut
+sub GetPatronImage {
+ my $cardnumber = shift;
+ warn "Cardnumber passed to GetPatronImage is $cardnumber" if $debug;
+ my $htdocs = C4::Context->config('intrahtdocs');
+ my $picture = "patronimages/" . $cardnumber . ".jpg";
+ if ( -e "$htdocs/$picture" ) {
+ return ( "/intranet-tmpl/$picture" ); # FIXME: This is a real hack and should be handled better, but I'm in a hurry... -fbcit
+ }
+ else {
+ return ();
+ }
+}
=head2 GetRoadTypeDetails (OUEST-PROVENCE)