From c6d6f60013356b7f7665fbe70c7e30aa8897e4f6 Mon Sep 17 00:00:00 2001 From: Chris Nighswonger Date: Fri, 1 Feb 2008 23:23:48 -0600 Subject: [PATCH] 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 Signed-off-by: Joshua Ferraro --- C4/Members.pm | 22 +++++++++- circ/circulation.pl | 4 ++ .../prog/en/includes/circ-menu.inc | 2 +- members/boraccount.pl | 40 ++++++++++--------- members/moremember.pl | 12 +++--- members/readingrec.pl | 5 +++ 6 files changed, 59 insertions(+), 26 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index d09512bf7c..ec32bc507a 100644 --- a/C4/Members.pm +++ b/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) diff --git a/circ/circulation.pl b/circ/circulation.pl index 004bd37de5..e36f911069 100755 --- a/circ/circulation.pl +++ b/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") , diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc index 078833f4c9..fd21e8c07b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -1,7 +1,7 @@
()
    -
  • .jpg" alt="" border="0" style="margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC;" />
  • +
  • " alt=" ()" border="0" style="margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC;" width="100" />
  • diff --git a/members/boraccount.pl b/members/boraccount.pl index 59b62ca747..0492f6203c 100755 --- a/members/boraccount.pl +++ b/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; diff --git a/members/moremember.pl b/members/moremember.pl index f0f3b01faa..0014177e7e 100755 --- a/members/moremember.pl +++ b/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); diff --git a/members/readingrec.pl b/members/readingrec.pl index 3eac89c277..2bf921d912 100755 --- a/members/readingrec.pl +++ b/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'}, -- 2.39.5