Browse Source

More fixes for patron images

Added GetPatronImage function to Members.pm
Added code to circulation.pl, boraccount.pl, readingrec.pl, and moremember.pl to grab patron image and pass it off to the template
Corrected code in circ-menu.inc to properly display patron image.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
3.0.x
Chris Nighswonger 16 years ago
committed by Joshua Ferraro
parent
commit
c6d6f60013
  1. 22
      C4/Members.pm
  2. 4
      circ/circulation.pl
  3. 2
      koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc
  4. 40
      members/boraccount.pl
  5. 12
      members/moremember.pl
  6. 5
      members/readingrec.pl

22
C4/Members.pm

@ -56,7 +56,8 @@ BEGIN {
&GetRoadTypes
&GetRoadTypeDetails
&GetSortDetails
&GetTitles
&GetTitles
&GetPatronImage
&GetMemberAccountRecords
&GetBorNotifyAcctRecord
@ -1695,7 +1696,26 @@ sub GetTitles {
}
}
=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)

4
circ/circulation.pl

@ -700,6 +700,10 @@ if ($stickyduedate) {
#$cookie=[$cookie, $branchcookie, $printercookie];
#}
# grab patron's image if available
my $picture = GetPatronImage($borrower->{'cardnumber'});
$template->param( picture => $picture );
$template->param(
SpecifyDueDate => C4::Context->preference("SpecifyDueDate"),
CircAutocompl => C4::Context->preference("CircAutocompl") ,

2
koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc

@ -1,7 +1,7 @@
<!-- TMPL_IF NAME="borrowernumber" -->
<div class="patroninfo"><h5><!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)</h5>
<ul>
<!-- TMPL_IF NAME="patronimages" --><li><img src="/intranet-tmpl/patronimages/<!-- TMPL_VAR NAME="cardnumber" -->.jpg" alt="" border="0" style="margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC;" /></li><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="picture" --><li><img src="<!-- TMPL_VAR NAME="picture" -->" alt="<!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)" border="0" style="margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC;" width="100" /></li><!-- /TMPL_IF -->
<li><!-- TMPL_IF NAME="address"-->
<!-- TMPL_VAR NAME="address" -->
<!-- TMPL_ELSE -->

40
members/boraccount.pl

@ -90,24 +90,28 @@ my $borrowercategory = GetBorrowercategory( $data->{'categorycode'} );
my $category_type = $borrowercategory->{'category_type'};
( $template->param( adultborrower => 1 ) ) if ( $category_type eq 'A' );
# grab patron's image if available
my $picture = GetPatronImage($data->{'cardnumber'});
$template->param( picture => $picture );
$template->param(
finesview => 1,
firstname => $data->{'firstname'},
surname => $data->{'surname'},
borrowernumber => $borrowernumber,
cardnumber => $data->{'cardnumber'},
categorycode => $data->{'categorycode'},
category_type => $data->{'category_type'},
category_description => $data->{'description'},
address => $data->{'address'},
address2 => $data->{'address2'},
city => $data->{'city'},
zipcode => $data->{'zipcode'},
phone => $data->{'phone'},
email => $data->{'email'},
branchcode => $data->{'branchcode'},
total => sprintf("%.2f",$total),
totalcredit => $totalcredit,
accounts => \@accountrows );
finesview => 1,
firstname => $data->{'firstname'},
surname => $data->{'surname'},
borrowernumber => $borrowernumber,
cardnumber => $data->{'cardnumber'},
categorycode => $data->{'categorycode'},
category_type => $data->{'category_type'},
category_description => $data->{'description'},
address => $data->{'address'},
address2 => $data->{'address2'},
city => $data->{'city'},
zipcode => $data->{'zipcode'},
phone => $data->{'phone'},
email => $data->{'email'},
branchcode => $data->{'branchcode'},
total => sprintf("%.2f",$total),
totalcredit => $totalcredit,
accounts => \@accountrows );
output_html_with_http_headers $input, $cookie, $template->output;

12
members/moremember.pl

@ -324,12 +324,12 @@ foreach (@$alerts) {
$_->{ $_->{type} } = 1;
$_->{relatedto} = findrelatedto( $_->{type}, $_->{externalid} );
}
my $picture;
my $htdocs = C4::Context->config('intrahtdocs');
$picture = "patronimages/" . $data->{'cardnumber'} . ".jpg";
if ( -e "$htdocs/$picture" ) {
$template->param( picture => "/intranet-tmpl/$picture" ); # FIXME: This is a real hack and should be handled better, but I'm in a hurry... -fbcit
}
# grab patron's image if available
my $picture = GetPatronImage($data->{'cardnumber'});
$template->param( picture => $picture );
my $branch=C4::Context->userenv->{'branch'};
$template->param($data);

5
members/readingrec.pl

@ -82,6 +82,11 @@ for (my $i=0;$i<$count;$i++){
if (! $limit){
$limit = 'full';
}
# grab patron's image if available
my $picture = GetPatronImage($data->{'cardnumber'});
$template->param( picture => $picture );
$template->param(
readingrecordview => 1,
biblionumber => $data->{'biblionumber'},

Loading…
Cancel
Save