&GetSortDetails
&GetTitles
- &GetPatronImage
-
&GetHideLostItemsPreference
&IsMemberBlocked
$sth->execute($data{'address'},$data{'fax'},$data{'B_city'},$data{'mobile'},$data{'city'},$data{'phone'},$guarantee->{'borrowernumber'});
}
}
+
=head2 GetPendingIssues
my $issues = &GetPendingIssues(@borrowernumber);
=cut
-#'
sub GetPendingIssues {
my @borrowernumbers = @_;
}
}
-=head2 GetPatronImage
-
- my ($imagedata, $dberror) = GetPatronImage($borrowernumber);
-
-Returns the mimetype and binary image data of the image for the patron with the supplied borrowernumber.
-
-=cut
-
-sub GetPatronImage {
- my ($borrowernumber) = @_;
- warn "Borrowernumber passed to GetPatronImage is $borrowernumber" if $debug;
- my $dbh = C4::Context->dbh;
- my $query = 'SELECT mimetype, imagefile FROM patronimage WHERE borrowernumber = ?';
- my $sth = $dbh->prepare($query);
- $sth->execute($borrowernumber);
- my $imagedata = $sth->fetchrow_hashref;
- warn "Database error!" if $sth->errstr;
- return $imagedata, $sth->errstr;
-}
-
=head2 GetHideLostItemsPreference
$hidelostitemspref = &GetHideLostItemsPreference($borrowernumber);
use Carp;
use Koha::Database;
+use Koha::Patron::Images;
use base qw(Koha::Object);
return Koha::Patrons->find( $self->guarantorid() );
}
+sub image {
+ my ( $self ) = @_;
+
+ return Koha::Patron::Images->find( $self->borrowernumber )
+}
+
=head3 type
=cut
use Koha::DateUtils;
use Koha::Database;
use Koha::Patron::Messages;
+use Koha::Patron::Images;
use Date::Calc qw(
Today
relatives_borrowernumbers => \@relatives,
);
-my ($picture, $dberror) = GetPatronImage($borrower->{'borrowernumber'});
-$template->param( picture => 1 ) if $picture;
+my $patron_image = Koha::Patron::Images->find($borrower->{borrowernumber});
+$template->param( picture => 1 ) if $patron_image;
# get authorised values with type of BOR_NOTES
use C4::Branch;
use C4::Accounts;
use C4::Members::Attributes qw(GetBorrowerAttributes);
+use Koha::Patron::Images;
my $input=new CGI;
$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' );
-my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'});
-$template->param( picture => 1 ) if $picture;
+my $patron_image = Koha::Patron::Images->find($data->{borrowernumber});
+$template->param( picture => 1 ) if $patron_image;
if (C4::Context->preference('ExtendedPatronAttributes')) {
my $attributes = GetBorrowerAttributes($borrowernumber);
use C4::Members;
use C4::Branch; # GetBranches
use Module::Load;
+use Koha::Patron::Images;
if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) {
load Koha::NorwegianPatronDB, qw( NLMarkForDeletion NLSync );
}
if ($countissues > 0 or $flags->{'CHARGES'} or $data->{'borrowernumber'} or $deletelocal == 0){
# print $input->header;
- my ($picture, $dberror) = GetPatronImage($bor->{'borrowernumber'});
- $template->param( picture => 1 ) if $picture;
+ my $patron_image = Koha::Patron::Images->find($bor->{borrowernumber});
+ $template->param( picture => 1 ) if $patron_image;
$template->param(borrowernumber => $member,
surname => $bor->{'surname'},
use C4::Reserves;
use C4::Letters;
use Koha::Patron::Discharge;
+use Koha::Patron::Images;
use Koha::DateUtils;
borrowernumber => $borrowernumber,
});
- my ($picture, $dberror) = GetPatronImage($borrowernumber);
- $template->param( picture => 1 ) if $picture;
+ my $patron_image = Koha::Patron::Images->find($borrowernumber);
+ $template->param( picture => 1 ) if $patron_image;
$template->param(
borrowernumber => $borrowernumber,
use Koha::DateUtils;
use Koha::Patron::Files;
+use Koha::Patron::Images;
my $cgi = CGI->new;
);
}
- my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'});
- $template->param( picture => 1 ) if $picture;
+ my $patron_image = Koha::Patron::Images->find($data->{borrowernumber});
+ $template->param( picture => 1 ) if $patron_image;
$template->param(
files => Koha::Patron::Files->new( borrowernumber => $borrowernumber )
use C4::Accounts;
use C4::Items;
use C4::Members::Attributes qw(GetBorrowerAttributes);
+use Koha::Patron::Images;
my $input=new CGI;
my $flagsrequired = { borrowers => 1, updatecharges => 1 };
}
$template->param( adultborrower => 1 ) if ( $data->{category_type} eq 'A' );
- my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'});
- $template->param( picture => 1 ) if $picture;
+ my $patron_image = Koha::Patron::Images->find($data->{borrowernumber});
+ $template->param( picture => 1 ) if $patron_image;
if (C4::Context->preference('ExtendedPatronAttributes')) {
my $attributes = GetBorrowerAttributes($borrowernumber);
use C4::Items;
use C4::Branch;
use C4::Members::Attributes qw(GetBorrowerAttributes);
+use Koha::Patron::Images;
my $input=new CGI;
my $flagsrequired = { borrowers => 1 };
}
$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' );
- my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'});
- $template->param( picture => 1 ) if $picture;
+ my $patron_image = Koha::Patron::Images->find($data->{borrowernumber});
+ $template->param( picture => 1 ) if $patron_image;
if (C4::Context->preference('ExtendedPatronAttributes')) {
my $attributes = GetBorrowerAttributes($borrowernumber);
#use C4::Acquisitions;
use C4::Output;
+use Koha::Patron::Images;
my $input = new CGI;
}
$template->param( adultborrower => 1 ) if ( $bor->{'category_type'} eq 'A' );
- my ($picture, $dberror) = GetPatronImage($bor->{'borrowernumber'});
- $template->param( picture => 1 ) if $picture;
+ my $patron_image = Koha::Patron::Images->find($bor->{borrowernumber});
+ $template->param( picture => 1 ) if $patron_image;
if (C4::Context->preference('ExtendedPatronAttributes')) {
my $attributes = GetBorrowerAttributes($bor->{'borrowernumber'});
use C4::Circulation;
use CGI qw ( -utf8 );
use C4::Members::Attributes qw(GetBorrowerAttributes);
+use Koha::Patron::Images;
use Digest::MD5 qw(md5_base64);
$template->param( adultborrower => 1 ) if ( $bor->{'category_type'} eq 'A' );
-my ( $picture, $dberror ) = GetPatronImage( $bor->{'borrowernumber'} );
-$template->param( picture => 1 ) if $picture;
+my $patron_image = Koha::Patron::Images->find($bor->{borrowernumber});
+$template->param( picture => 1 ) if $patron_image;
if ( C4::Context->preference('ExtendedPatronAttributes') ) {
my $attributes = GetBorrowerAttributes( $bor->{'borrowernumber'} );
use List::MoreUtils qw/uniq/;
use C4::Members::Attributes qw(GetBorrowerAttributes);
use Koha::Patron::Debarments qw(GetDebarments IsDebarred);
+use Koha::Patron::Images;
use Module::Load;
if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preference('NorwegianPatronDBEnable') == 1 ) {
load Koha::NorwegianPatronDB, qw( NLGetSyncDataFromBorrowernumber );
# check to see if patron's image exists in the database
# basically this gives us a template var to condition the display of
# patronimage related interface on
-my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'});
-$template->param( picture => 1 ) if $picture;
+my $patron_image = Koha::Patron::Images->find($data->{borrowernumber});
+$template->param( picture => 1 ) if $patron_image;
my $branch=C4::Context->userenv->{'branch'};
use C4::Branch;
use C4::Letters;
use C4::Members::Attributes qw(GetBorrowerAttributes);
+use Koha::Patron::Images;
my $input=new CGI;
});
$template->param( $borrower );
-my ($picture, $dberror) = GetPatronImage($borrower->{'borrowernumber'});
-$template->param( picture => 1 ) if $picture;
+my $patron_image = Koha::Patron::Images->find($borrower->{borrowernumber});
+$template->param( picture => 1 ) if $patron_image;
# Allow resending of messages in Notices tab
my $op = $input->param('op') || q{};
use C4::Auth qw( check_api_auth );
use C4::Context;
use C4::Members;
+use Koha::Patron::Images;
$|=1;
warn "Borrowernumber passed in: $borrowernumber" if $DEBUG;
-my ($imagedata, $dberror) = GetPatronImage($borrowernumber);
-
-if ($dberror) {
- warn "Database Error!";
- exit;
-}
+my $patron_image = Koha::Patron::Images->find($borrowernumber);
# NOTE: Never dump the contents of $imagedata->{'patronimage'} via a warn to a log or nasty
# things will result... you have been warned!
-if ($imagedata) {
- print $query->header (-type => $imagedata->{'mimetype'}, -'Cache-Control' => 'no-store', -Content_Length => length ($imagedata->{'imagefile'})), $imagedata->{'imagefile'};
+if ($patron_image) {
+ print $query->header (-type => $patron_image->mimetype, -'Cache-Control' => 'no-store', -Content_Length => length ($patron_image->imagefile)), $patron_image->imagefile;
exit;
} else {
warn "No image exists for $borrowernumber";
use C4::Overdues;
use C4::Branch;
use C4::Members::Attributes qw(GetBorrowerAttributes);
+use Koha::Patron::Images;
our $input = CGI->new;
$template->param(%$borrower);
- my ($picture, $dberror) = GetPatronImage($borrower->{'borrowernumber'});
- $template->param( picture => 1 ) if $picture;
+ my $patron_image = Koha::Patron::Images->find($borrower->{borrowernumber});
+ $template->param( picture => 1 ) if $patron_image;
$template->param(
accounts => $accounts,
borrower => $borrower,
$b_ref->{adultborrower} = 1;
}
- my ( $picture, $dberror ) = GetPatronImage( $b_ref->{borrowernumber} );
- if ($picture) {
- $b_ref->{has_picture} = 1;
- }
-
if (C4::Context->preference('ExtendedPatronAttributes')) {
$b_ref->{extendedattributes} = GetBorrowerAttributes($borrowernumber);
$template->param(
use C4::Accounts;
use C4::Koha;
use C4::Branch;
+use Koha::Patron::Images;
my $input = CGI->new();
$b_ref->{adultborrower} = 1;
}
- my ($picture, $dberror) = GetPatronImage($borrower->{'borrowernumber'});
- $template->param( picture => 1 ) if $picture;
+ my $patron_image = Koha::Patron::Images->find($borrower->{borrowernumber});
+ $template->param( picture => 1 ) if $patron_image;
if (C4::Context->preference('ExtendedPatronAttributes')) {
$b_ref->{extendedattributes} = GetBorrowerAttributes($borrowernumber);
use C4::Branch;
use C4::Accounts;
use Koha::DateUtils;
+use Koha::Patron::Images;
my $input=new CGI;
$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' );
-my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'});
-$template->param( picture => 1 ) if $picture;
+my $patron_image = Koha::Patron::Images->find($data->{borrowernumber});
+$template->param( picture => 1 ) if $patron_image;
$template->param(
finesview => 1,
use C4::Members;
use C4::Branch;
use C4::Accounts;
+use Koha::Patron::Images;
my $input = new CGI;
$template->param( adultborrower => 1 ) if ( $data->{'category_type'} eq 'A' );
-my ( $picture, $dberror ) = GetPatronImage( $data->{'borrowernumber'} );
-$template->param( picture => 1 ) if $picture;
+my $patron_image = Koha::Patron::Images->find($data->{borrowernumber});
+$template->param( picture => 1 ) if $patron_image;
$template->param(
finesview => 1,
use C4::Members;
use C4::Members::Attributes qw(GetBorrowerAttributes);
use C4::Suggestions;
+use Koha::Patron::Images;
my $input = new CGI;
);
}
-my ($picture, $dberror) = GetPatronImage($borrowernumber);
-$template->param( picture => 1 ) if $picture;
+my $patron_image = Koha::Patron::Images->find($borrowernumber);
+$template->param( picture => 1 ) if $patron_image;
my $suggestions = SearchSuggestion( { suggestedby => $borrowernumber } );
use List::MoreUtils qw/any uniq/;
use Koha::DateUtils;
use C4::Members::Attributes qw(GetBorrowerAttributes);
+use Koha::Patron::Images;
my $input = CGI->new;
$limit = 'full';
}
-
-my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'});
-$template->param( picture => 1 ) if $picture;
+my $patron_image = Koha::Patron::Images->find($data->{borrowernumber});
+$template->param( picture => 1 ) if $patron_image;
if (C4::Context->preference('ExtendedPatronAttributes')) {
my $attributes = GetBorrowerAttributes($borrowernumber);
use C4::Members::Attributes qw(GetBorrowerAttributes);
use C4::Context;
use C4::Serials;
+use Koha::Patron::Images;
use CGI::Session;
my $query = new CGI;
);
}
-my ($picture, $dberror) = GetPatronImage($borrower->{'borrowernumber'});
-$template->param( picture => 1 ) if $picture;
+my $patron_image = Koha::Patron::Images->find($borrower->{borrowernumber});
+$template->param( picture => 1 ) if $patron_image;
output_html_with_http_headers $query, $cookie, $template->output;
use C4::Members::Statistics;
use C4::Members::Attributes qw(GetBorrowerAttributes);
use C4::Output;
+use Koha::Patron::Images;
my $input = new CGI;
);
}
-my ($picture, $dberror) = GetPatronImage($borrower->{'borrowernumber'});
-$template->param( picture => 1 ) if $picture;
+my $patron_image = Koha::Patron::Images->find($borrower->{borrowernumber});
+$template->param( picture => 1 ) if $patron_image;
$template->param(%$borrower);
use C4::Scrubber;
use Email::Valid;
use Koha::DateUtils;
+use Koha::Patron::Images;
my $cgi = new CGI;
my $dbh = C4::Context->dbh;
);
if (C4::Context->preference('OPACpatronimages')) {
- my ($image, $dberror) = GetPatronImage($borrower->{borrowernumber});
- if ($image) {
- $template->param(
- display_patron_image => 1
- );
- }
+ my $patron_image = Koha::Patron::Images->find($borrower->{borrowernumber});
+ $template->param( display_patron_image => 1 ) if $patron_image;
}
}
use CGI qw ( -utf8 );
use CGI::Cookie; # need to check cookies before having CGI parse the POST request
use C4::Auth qw(:DEFAULT check_cookie_auth);
+use Koha::Patron::Images;
my $query = new CGI;
my ($auth_status, $auth_sessid) = check_cookie_auth($sessid, $needed_flags);
my $borrowernumber = C4::Context->userenv->{'number'};
-my ($imagedata, $dberror) = GetPatronImage($borrowernumber);
+my $patron_image = Koha::Patron::Images->find($borrowernumber);
-if ($dberror) {
- print $query->header(status => '500 internal error');
-}
-
-if ($imagedata) {
- print $query->header(-type => $imagedata->{'mimetype'},
- -Content_Length => length ($imagedata->{'imagefile'})),
- $imagedata->{'imagefile'};
+if ($patron_image) {
+ print $query->header(
+ -type => $patron_image->mimetype,
+ -Content_Length => length( $patron_image->imagefile )
+ ),
+ $patron_image->imagefile;
} else {
print $query->header(status => '404 patron image not found');
}
use C4::Biblio;
use C4::Items;
use Koha::Acquisition::Currencies;
+use Koha::Patron::Images;
my $query = new CGI;
);
if (C4::Context->preference('ShowPatronImageInWebBasedSelfCheck')) {
- my ($image, $dberror) = GetPatronImage($borrower->{borrowernumber});
- if ($image) {
- $template->param(
- display_patron_image => 1,
- cardnumber => $borrower->{cardnumber},
- );
- }
+ my $patron_image = Koha::Patron::Images->find($borrower->{borrowernumber});
+ $template->param(
+ display_patron_image => 1,
+ cardnumber => $borrower->{cardnumber},
+ ) if $patron_image;
}
} else {
$template->param(
use warnings;
use C4::Service;
use C4::Members;
+use Koha::Patron::Images;
my ($query, $response) = C4::Service->init(circulate => 'self_checkout');
my ($borrowernumber) = C4::Service->require_params('borrowernumber');
-my ($imagedata, $dberror) = GetPatronImage($borrowernumber);
+my $patron_image = Koha::Patron::Images->find($borrowernumber);
-if ($dberror) {
- print $query->header(status => '500 internal error');
-}
-
-if ($imagedata) {
- print $query->header(-type => $imagedata->{'mimetype'},
- -Content_Length => length ($imagedata->{'imagefile'})),
- $imagedata->{'imagefile'};
+if ($patron_image) {
+ print $query->header(
+ -type => $patron_image->mimetype,
+ -Content_Length => length( $patron_image->imagefile )
+ ),
+ $patron_image->imagefile;
} else {
print $query->header(status => '404 patron image not found');
}
use C4::Debug;
use C4::Context;
-use autouse 'C4::Members' => qw(GetPatronImage GetMember);
+use autouse 'C4::Members' => qw(GetMember);
use C4::Creators;
use C4::Patroncards;
use Koha::List::Patron;
+use Koha::Patron::Images;
my $cgi = new CGI;
next PROCESS_IMAGES;
}
elsif ($images->{$_}->{'data_source'}->[0]->{'image_source'} eq 'patronimages') {
- ($image_data, $error) = GetPatronImage($borrower_number);
- warn sprintf('No image exists for borrower number %s.', $borrower_number) if !$image_data;
- next PROCESS_IMAGES if !$image_data;
+ my $patron_image = Koha::Patron::Images->find($borrower_number);
+ warn sprintf('No image exists for borrower number %s.', $borrower_number) unless $patron_image;
+ next PROCESS_IMAGES unless $patron_image;
}
elsif ($images->{$_}->{'data_source'}->[0]->{'image_source'} eq 'creator_images') {
my $dbh = C4::Context->dbh();
use Koha::Patrons;
use Koha::Patron::Image;
+use Koha::Patron::Images;
my $input = new CGI;
use C4::Branch;
use C4::Debug;
use C4::Search; # enabled_staff_search_views
+use Koha::Patron::Images;
use vars qw($debug $cgi_debug);
use C4::Members::Attributes qw(GetBorrowerAttributes);
my $borrowernumber = $object;
my $data = GetMember( 'borrowernumber' => $borrowernumber );
- my ( $picture, $dberror ) = GetPatronImage( $data->{'borrowernumber'} );
- $template->param( picture => 1 ) if $picture;
+ my $patron_image = Koha::Patron::Images->find($data->{borrowernumber});
+ $template->param( picture => 1 ) if $patron_image;
if ( C4::Context->preference('ExtendedPatronAttributes') ) {
my $attributes = GetBorrowerAttributes( $data->{'borrowernumber'} );