X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=members%2Fmoremember.pl;h=c477100658e234603e236e24ed6a402b898bfc60;hb=906aff23cad65bffe15b3901657a845757b47d08;hp=c11073f461ed259d21ce01699a4be4b66a070537;hpb=21727e00f5238903edf94e2efc56d62aa42bed4c;p=koha_gimpoz diff --git a/members/moremember.pl b/members/moremember.pl index c11073f461..c477100658 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -49,9 +49,11 @@ 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 +133,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 +147,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 address2 city state B_address B_address2 B_city B_state phone mobile zipcode B_zipcode country B_country)) { - $data->{$_} = $data2->{$_}; - } - } my ( $catcodes, $labels ) = GetborCatFromCatType( 'A', 'WHERE category_type = ?' ); my $cnt = scalar(@$catcodes); @@ -242,9 +244,12 @@ 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; @@ -262,15 +267,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 +310,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 +318,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 +429,14 @@ $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 = GetBorrowerAttributes($borrowernumber); + $template->param( + ExtendedPatronAttributes => 1, + extendedattributes => $attributes + ); my @types = C4::Members::AttributeTypes::GetAttributeTypes(); if (scalar(@types) == 0) { $template->param(no_patron_attribute_types => 1); @@ -445,6 +450,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 +459,7 @@ $template->param( CANDELETEUSER => $candeleteuser, roaddetails => $roaddetails, borrowernumber => $borrowernumber, + othernames => $data->{'othernames'}, categoryname => $data->{'description'}, reregistration => $reregistration, branch => $branch, @@ -473,6 +481,7 @@ $template->param( "dateformat_" . (C4::Context->preference("dateformat") || '') => 1, samebranch => $samebranch, quickslip => $quickslip, + activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''), ); #Get the slip news items