X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=members%2Fmoremember.pl;h=b9d0c8f8cd555d58bc697e2433d9ae59f3101bfc;hb=bb35b608282e670e1bb07bf4cea324fc16b6ec90;hp=9dcfa3ad219820adc9d18f4bab214ea4be396462;hpb=f098258e8cf2d616c6bbc35e44c6a1df47be8517;p=koha_gimpoz diff --git a/members/moremember.pl b/members/moremember.pl index 9dcfa3ad21..b9d0c8f8cd 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -49,9 +49,10 @@ use C4::Letters; use C4::Biblio; use C4::Reserves; use C4::Branch; # GetBranchName +use C4::Overdues qw/CheckBorrowerDebarred/; use C4::Form::MessagingPreferences; -use C4::NewsChannels; #get slip news use List::MoreUtils qw/uniq/; +use C4::Members::Attributes qw(GetBorrowerAttributes); #use Smart::Comments; #use Data::Dumper; @@ -131,9 +132,6 @@ my $category_type = $data->{'category_type'}; ### $category_type -# in template => instutitional (A for Adult& C for children) -$template->param( $data->{'categorycode'} => 1 ); - $debug and printf STDERR "dates (enrolled,expiry,birthdate) raw: (%s, %s, %s)\n", map {$data->{$_}} qw(dateenrolled dateexpiry dateofbirth); foreach (qw(dateenrolled dateexpiry dateofbirth)) { my $userdate = $data->{$_}; @@ -148,21 +146,24 @@ foreach (qw(dateenrolled dateexpiry dateofbirth)) { } $data->{'IS_ADULT'} = ( $data->{'categorycode'} ne 'I' ); -for (qw(debarred gonenoaddress lost borrowernotes)) { +for (qw(gonenoaddress lost borrowernotes)) { $data->{$_} and $template->param(flagged => 1) and last; } +my $debar = CheckBorrowerDebarred($borrowernumber); +if ($debar) { + $template->param( 'userdebarred' => 1, 'flagged' => 1 ); + if ( $debar ne "9999-12-31" ) { + $template->param( 'userdebarreddate' => C4::Dates::format_date($debar) ); + $template->param( 'debarredcomment' => $data->{debarredcomment} ); + } +} + $data->{'ethnicity'} = fixEthnicity( $data->{'ethnicity'} ); $data->{ "sex_".$data->{'sex'}."_p" } = 1; my $catcode; if ( $category_type eq 'C') { - if ($data->{guarantorid} ) { - my $data2 = GetMember( 'borrowernumber' => $data->{'guarantorid'} ); - foreach (qw(address city B_address B_city phone mobile zipcode country B_country)) { - $data->{$_} = $data2->{$_}; - } - } my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); my $cnt = scalar(@$catcodes); @@ -242,12 +243,14 @@ if ( C4::Context->preference('OPACPrivacy') ) { # my @borrowernumbers = GetMemberRelatives($borrowernumber); my $issue = GetPendingIssues($borrowernumber); -my $relissue = GetPendingIssues(@borrowernumbers); -my $issuecount = scalar(@$issue); -my $relissuecount = scalar(@$relissue); +my $relissue = []; +if ( @borrowernumbers ) { + $relissue = GetPendingIssues(@borrowernumbers); +} +my $issuecount = @{$issue}; +my $relissuecount = @{$relissue}; my $roaddetails = &GetRoadTypeDetails( $data->{'streettype'} ); my $today = POSIX::strftime("%Y-%m-%d", localtime); # iso format -my @issuedata; my @borrowers_with_issues; my $overdues_exist = 0; my $totalprice = 0; @@ -262,15 +265,12 @@ sub build_issue_data { my $localissue; for ( my $i = 0 ; $i < $issuecount ; $i++ ) { - # Getting borrower details - my $memberdetails = GetMemberDetails($issue->[$i]{'borrowernumber'}); - $issue->[$i]{'borrowername'} = $memberdetails->{'firstname'} . " " . $memberdetails->{'surname'}; - my $datedue = $issue->[$i]{'date_due'}; my $issuedate = $issue->[$i]{'issuedate'}; $issue->[$i]{'date_due'} = C4::Dates->new($issue->[$i]{'date_due'}, 'iso')->output('syspref'); $issue->[$i]{'issuedate'} = C4::Dates->new($issue->[$i]{'issuedate'},'iso')->output('syspref'); my $biblionumber = $issue->[$i]{'biblionumber'}; + $issue->[$i]{'issuingbranchname'} = GetBranchName($issue->[$i]{'branchcode'}); my %row = %{ $issue->[$i] }; $totalprice += $issue->[$i]{'replacementprice'}; $row{'replacementprice'} = $issue->[$i]{'replacementprice'}; @@ -308,7 +308,7 @@ sub build_issue_data { #find the charge for an item my ( $charge, $itemtype ) = - GetIssuingCharges( $issue->[$i]{'itemnumber'}, $borrowernumber ); + GetIssuingCharges( $issue->[$i]{'itemnumber'}, $issue->[$i]{'borrowernumber'} ); my $itemtypeinfo = getitemtypeinfo($itemtype); $row{'itemtype_description'} = $itemtypeinfo->{description}; @@ -316,7 +316,7 @@ sub build_issue_data { $row{'charge'} = sprintf( "%.2f", $charge ); - my ( $renewokay,$renewerror ) = CanBookBeRenewed( $borrowernumber, $issue->[$i]{'itemnumber'}, $override_limit ); + my ( $renewokay,$renewerror ) = CanBookBeRenewed( $issue->[$i]{'borrowernumber'}, $issue->[$i]{'itemnumber'}, $override_limit ); $row{'norenew'} = !$renewokay; $row{'can_confirm'} = ( !$renewokay && $renewerror ne 'on_reserve' ); $row{"norenew_reason_$renewerror"} = 1 if $renewerror; @@ -427,11 +427,32 @@ $template->param( picture => 1 ) if $picture; my $branch=C4::Context->userenv->{'branch'}; -$template->param($data); +$template->param(%$data); if (C4::Context->preference('ExtendedPatronAttributes')) { - $template->param(ExtendedPatronAttributes => 1); - $template->param(patron_attributes => C4::Members::Attributes::GetBorrowerAttributes($borrowernumber)); + my $attributes = C4::Members::Attributes::GetBorrowerAttributes($borrowernumber); + my @classes = uniq( map {$_->{class}} @$attributes ); + @classes = sort @classes; + + my @attributes_loop; + for my $class (@classes) { + my @items; + for my $attr (@$attributes) { + push @items, $attr if $attr->{class} eq $class + } + my $lib = GetAuthorisedValueByCode( 'PA_CLASS', $class ) || $class; + push @attributes_loop, { + class => $class, + items => \@items, + lib => $lib, + }; + } + + $template->param( + ExtendedPatronAttributes => 1, + attributes_loop => \@attributes_loop + ); + my @types = C4::Members::AttributeTypes::GetAttributeTypes(); if (scalar(@types) == 0) { $template->param(no_patron_attribute_types => 1); @@ -445,6 +466,8 @@ if (C4::Context->preference('EnhancedMessagingPreferences')) { $template->param(SMSnumber => defined $data->{'smsalertnumber'} ? $data->{'smsalertnumber'} : $data->{'mobile'}); } +# in template => instutitional (A for Adult, C for children) +$template->param( $data->{'categorycode'} => 1 ); $template->param( detailview => 1, AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"), @@ -452,6 +475,7 @@ $template->param( CANDELETEUSER => $candeleteuser, roaddetails => $roaddetails, borrowernumber => $borrowernumber, + othernames => $data->{'othernames'}, categoryname => $data->{'description'}, reregistration => $reregistration, branch => $branch, @@ -473,15 +497,7 @@ $template->param( "dateformat_" . (C4::Context->preference("dateformat") || '') => 1, samebranch => $samebranch, quickslip => $quickslip, -); - -#Get the slip news items -my $all_koha_news = &GetNewsToDisplay("slip"); -my $koha_news_count = scalar @$all_koha_news; - -$template->param( - koha_news => $all_koha_news, - koha_news_count => $koha_news_count + activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), ); output_html_with_http_headers $input, $cookie, $template->output;