use C4::Koha;
use C4::Letters;
use C4::Biblio;
-use C4::Reserves;
use C4::Branch; # GetBranchName
-use C4::Overdues qw/CheckBorrowerDebarred/;
use C4::Form::MessagingPreferences;
use List::MoreUtils qw/uniq/;
use C4::Members::Attributes qw(GetBorrowerAttributes);
-
+use Koha::Borrower::Debarments qw(GetDebarments IsDebarred);
#use Smart::Comments;
#use Data::Dumper;
use DateTime;
my $quickslip = 0;
my $flagsrequired;
-if ($print eq "page") {
+if (defined $print and $print eq "page") {
$template_name = "members/moremember-print.tmpl";
# circ staff who process checkouts but can't edit
# patrons still need to be able to access print view
$flagsrequired = { circulate => "circulate_remaining_permissions" };
-} elsif ($print eq "slip") {
+} elsif (defined $print and $print eq "slip") {
$template_name = "members/moremember-receipt.tmpl";
# circ staff who process checkouts but can't edit
# patrons still need to be able to print receipts
$flagsrequired = { circulate => "circulate_remaining_permissions" };
-} elsif ($print eq "qslip") {
+} elsif (defined $print and $print eq "qslip") {
$template_name = "members/moremember-receipt.tmpl";
$quickslip = 1;
$flagsrequired = { circulate => "circulate_remaining_permissions" };
-} elsif ($print eq "brief") {
+} elsif (defined $print and $print eq "brief") {
$template_name = "members/moremember-brief.tmpl";
$flagsrequired = { borrowers => 1 };
} else {
#start the page and read in includes
my $data = GetMember( 'borrowernumber' => $borrowernumber );
-my $reregistration = $input->param('reregistration');
if ( not defined $data ) {
$template->param (unknowuser => 1);
exit;
}
-# re-reregistration function to automatic calcul of date expiry
-if ( $reregistration eq 'y' ) {
- $data->{'dateexpiry'} = ExtendMemberSubscriptionTo( $borrowernumber );
-}
-
my $category_type = $data->{'category_type'};
### $category_type
$data->{$_} and $template->param(flagged => 1) and last;
}
-my $debar = CheckBorrowerDebarred($borrowernumber);
-if ($debar) {
+if ( IsDebarred($borrowernumber) ) {
$template->param( 'userdebarred' => 1, 'flagged' => 1 );
+ my $debar = $data->{'debarred'};
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;
+$data->{ "sex_".$data->{'sex'}."_p" } = 1 if defined $data->{sex};
my $catcode;
if ( $category_type eq 'C') {
# Converts the branchcode to the branch name
my $samebranch;
-if ( C4::Context->preference("IndependantBranches") ) {
+if ( C4::Context->preference("IndependentBranches") ) {
my $userenv = C4::Context->userenv;
- unless ( $userenv->{flags} % 2 == 1 ) {
+ if ( C4::Context->IsSuperLibrarian() ) {
+ $samebranch = 1;
+ }
+ else {
$samebranch = ( $data->{'branchcode'} eq $userenv->{branch} );
}
- $samebranch = 1 if ( $userenv->{flags} % 2 == 1 );
-}else{
+}
+else {
$samebranch = 1;
}
my $branchdetail = GetBranchDetail( $data->{'branchcode'});
$template->param( lib1 => $lib1 ) if ($lib1);
$template->param( lib2 => $lib2 ) if ($lib2);
+# If printing a page, send the account informations to the template
+if ($print eq "page") {
+ foreach my $accountline (@$accts) {
+ $accountline->{amount} = sprintf '%.2f', $accountline->{amount};
+ $accountline->{amountoutstanding} = sprintf '%.2f', $accountline->{amountoutstanding};
+
+ if ($accountline->{accounttype} ne 'F' && $accountline->{accounttype} ne 'FU'){
+ $accountline->{printtitle} = 1;
+ }
+ }
+ $template->param( accounts => $accts );
+}
+
# Show OPAC privacy preference is system preference is set
if ( C4::Context->preference('OPACPrivacy') ) {
$template->param( OPACPrivacy => 1);
if ( @borrowernumbers ) {
$relissue = GetPendingIssues(@borrowernumbers);
}
-my $roaddetails = &GetRoadTypeDetails( $data->{'streettype'} );
+my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $data->{streettype} );
my $today = DateTime->now( time_zone => C4::Context->tz);
$today->truncate(to => 'day');
my @borrowers_with_issues;
foreach (qw(waiting transfered nottransfered)) {
$getreserv{$_} = 0;
}
- $getreserv{reservedate} = C4::Dates->new($num_res->{'reservedate'},'iso')->output('syspref');
+ $getreserv{reservedate} = $num_res->{'reservedate'};
foreach (qw(biblionumber title author itemcallnumber )) {
$getreserv{$_} = $getiteminfo->{$_};
}
$getreserv{barcodereserv} = $getiteminfo->{'barcode'};
$getreserv{itemtype} = $itemtypeinfo->{'description'};
- # check if we have a waitin status for reservations
- if ( $num_res->{'found'} eq 'W' ) {
+ # check if we have a waitin status for reservations
+ if ( defined $num_res->{found} and $num_res->{'found'} eq 'W' ) {
$getreserv{color} = 'reserved';
$getreserv{waiting} = 1;
}
- # check transfers with the itemnumber foud in th reservation loop
+ # check transfers with the itemnumber foud in th reservation loop
if ($transfertwhen) {
$getreserv{color} = 'transfered';
$getreserv{transfered} = 1;
$getreserv{nottransferedby} =
GetBranchName( $getiteminfo->{'holdingbranch'} );
}
+ $getreserv{title} = $getiteminfo->{'title'};
+ $getreserv{subtitle} = GetRecordValue('subtitle', GetMarcBiblio($getiteminfo->{biblionumber}), GetFrameworkCode($getiteminfo->{biblionumber}));
# if we don't have a reserv on item, we put the biblio infos and the waiting position
if ( $getiteminfo->{'title'} eq '' ) {
my $getbibtype = getitemtypeinfo( $getbibinfo->{'itemtype'} );
$getreserv{color} = 'inwait';
$getreserv{title} = $getbibinfo->{'title'};
+ $getreserv{subtitle} = GetRecordValue('subtitle', GetMarcBiblio($num_res->{biblionumber}), GetFrameworkCode($num_res->{biblionumber}));
$getreserv{nottransfered} = 0;
$getreserv{itemtype} = $getbibtype->{'description'};
$getreserv{author} = $getbibinfo->{'author'};
$getreserv{waitingposition} = $num_res->{'priority'};
$getreserv{suspend} = $num_res->{'suspend'};
$getreserv{suspend_until} = $num_res->{'suspend_until'};
+ $getreserv{expirationdate} = $num_res->{'expirationdate'};
+ $getreserv{reserve_id} = $num_res->{'reserve_id'};
push( @reservloop, \%getreserv );
}
my $candeleteuser;
my $userenv = C4::Context->userenv;
-if($userenv->{flags} % 2 == 1){
+if ( C4::Context->IsSuperLibrarian() ) {
$candeleteuser = 1;
-}elsif ( C4::Context->preference("IndependantBranches") ) {
+}
+elsif ( C4::Context->preference("IndependentBranches") ) {
$candeleteuser = ( $data->{'branchcode'} eq $userenv->{branch} );
-}else{
- if( C4::Auth::getuserflags( $userenv->{flags},$userenv->{number})->{borrowers} ) {
+}
+else {
+ if ( C4::Auth::getuserflags( $userenv->{flags}, $userenv->{number} )->{borrowers} ) {
$candeleteuser = 1;
- }else{
+ }
+ else {
$candeleteuser = 0;
}
}
# 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->{'cardnumber'});
+my ($picture, $dberror) = GetPatronImage($data->{'borrowernumber'});
$template->param( picture => 1 ) if $picture;
my $branch=C4::Context->userenv->{'branch'};
detailview => 1,
AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"),
CANDELETEUSER => $candeleteuser,
- roaddetails => $roaddetails,
+ roadtype => $roadtype,
borrowernumber => $borrowernumber,
othernames => $data->{'othernames'},
categoryname => $data->{'description'},
- reregistration => $reregistration,
+ was_renewed => $input->param('was_renewed') ? 1 : 0,
branch => $branch,
todaysdate => C4::Dates->today(),
totalprice => sprintf("%.2f", $totalprice),
activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
AutoResumeSuspendedHolds => C4::Context->preference('AutoResumeSuspendedHolds'),
SuspendHoldsIntranet => C4::Context->preference('SuspendHoldsIntranet'),
+ RoutingSerials => C4::Context->preference('RoutingSerials'),
+ debarments => GetDebarments({ borrowernumber => $borrowernumber }),
+ PatronsPerPage => C4::Context->preference("PatronsPerPage") || 20,
);
$template->param( $error => 1 ) if $error;
if ($issue->{issuedate} ) {
$issuedate = $issue->{issuedate}->clone();
}
-
- $issue->{date_due} = output_pref( $issue->{date_due} );
- $issue->{issuedate} = output_pref( $issue->{issuedate} ) if defined $issue->{issuedate};
- my $biblionumber = $issue->{biblionumber};
+ $issue->{subtitle} = GetRecordValue('subtitle', GetMarcBiblio($issue->{biblionumber}), GetFrameworkCode($issue->{biblionumber}));
$issue->{issuingbranchname} = GetBranchName($issue->{branchcode});
my %row = %{$issue};
$totalprice += $issue->{replacementprice};
$row{"norenew_reason_$renewerror"} = 1 if $renewerror;
$row{renew_failed} = $renew_failed{ $issue->{itemnumber} };
$row{return_failed} = $return_failed{ $issue->{barcode} };
+ ($row{'renewcount'},$row{'renewsallowed'},$row{'renewsleft'}) = C4::Circulation::GetRenewCount($issue->{'borrowernumber'},$issue->{'itemnumber'}); #Add renewal count to item data display
+
+ $row{'soonestrenewdate'} = output_pref(
+ C4::Circulation::GetSoonestRenewDate(
+ $issue->{borrowernumber},
+ $issue->{itemnumber}
+ )
+ );
+
push( @{$localissue}, \%row );
}
return $localissue;