+++ /dev/null
-[% USE Koha %]
-[% USE KohaDates %]
-[% SET footerjs = 1 %]
-[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha › Check duplicate patron</title>
-[% INCLUDE 'doc-head-close.inc' %]
-</head>
-
-<body id="pat_moremember-brief" class="pat">
- <div class="container-fluid">
- <div class="row">
-
- <div class="col-xs-12">
- <h3>[% UNLESS ( I ) %]
- [% title | html %] [% firstname | html %] [% END %] [% surname | html %] ([% cardnumber | html %])</h3>
- </div>
- </div>
- <div class="row">
- <div class="col-xs-6">
- <div id="patron-information">
-
- [% UNLESS ( I ) %][% IF ( othernames ) %]“[% othernames | html %]”[% END %]
- <div class = "address">
- <ul>
- [% IF Koha.Preference( 'AddressFormat' ) %]
- [% INCLUDE "member-display-address-style-${ Koha.Preference( 'AddressFormat' ) }.inc" %]
- [% ELSE %]
- [% INCLUDE 'member-display-address-style-us.inc' %]
- [% END %]
- </ul>
- </div>
- <div class="rows">
- <ol>
- [% IF ( phone ) %]<li><span class="label">Primary phone: </span>[% phone | html %]</li>[% END %]
- [% IF ( phonepro ) %]<li><span class="label">Secondary phone: </span>[% phonepro | html %]</li>[% END %]
- [% IF ( mobile ) %]<li><span class="label">Other phone: </span>[% mobile | html %]</li>[% END %]
- [% IF ( fax ) %]<li><span class="label">Fax: </span>[% fax | html %]</li>[% END %]
- [% IF ( email ) %]<li class="email"><span class="label">Primary email:</span><a href="mailto:[% email | uri %]">[% email | html %]</a></li>[% END %]
- [% IF ( emailpro ) %]<li class="email"><span class="label">Secondary email: </span><a href="mailto:[% emailpro | uri %]">[% emailpro | html %]</a></li>[% END %]
- [% UNLESS ( I ) %]
- [% IF ( inititals ) %]<li><span class="label">Initials: </span>[% initials | html %]</li>[% END %]
- [% IF ( dateofbirth ) %]<li><span class="label">Date of birth:</span>[% dateofbirth | $KohaDates %]</li>[% END %]
- [% IF ( sex ) %]<li><span class="label">Gender:</span>[% IF ( sex == 'F' ) %]Female[% ELSIF ( sex == 'M' ) %]Male[% ELSE %][% sex | html %][% END %]</li>[% END %][% END %]
- [% END %]
- [% IF ( isguarantee ) %]
- [% IF ( guaranteeloop ) %]
- <li><span class="label">Guarantees:</span><ul>[% FOREACH guaranteeloo IN guaranteeloop %]<li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guaranteeloo.borrowernumber | uri %]">[% guaranteeloo.name | html %] </a></li>[% END %]</ul></li>
- [% END %]
- [% ELSE %]
- [% IF ( guarantor.borrowernumber ) %]
- <li><span class="label">Guarantor:</span><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantor.borrowernumber | uri %]">[% guarantor.surname | html %], [% guarantor.firstname | html %]</a></li>
- [% END %]
- [% END %]
- </ol>
- </div>
- </div>
- </div>
-
- <div class="col-xs-6">
- <div id="patron-library-details">
- <h3>Library use</h3>
- <div class="rows">
- <ol>
- <li><span class="label">Card number: </span>[% cardnumber | html %]</li>
- <li><span class="label">Borrowernumber: </span> [% borrowernumber | html %]</li>
- <li><span class="label">Category: </span>[% categoryname | html %] ([% categorycode | html %])</li>
- <li><span class="label">Registration date: </span>[% dateenrolled | $KohaDates %]</li>
- <li><span class="label">Expiration date: </span>
- [% IF ( was_renewed ) %]
- <strong class="reregistrinfo">[% dateexpiry | $KohaDates %]</strong>
- [% ELSE %]
- [% dateexpiry | $KohaDates %]
- [% END %]
- </li>
- <li><span class="label">Library: </span>[% branchname | html %]</li>
-
- [% IF ( sort1 ) %]<li><span class="label">Sort field 1:</span>[% lib1 | html %]</li>[% END %]
- [% IF ( sort2 ) %]<li><span class="label">Sort field 2:</span>[% lib2 | html %]</li>[% END %]
- </ol>
- </div>
- </div>
- </div>
-</div>
-<div class="row">
- <div class="col-xs-12">
- <fieldset class="action"><input type="button" class="close" value="Close window" /></fieldset>
- </div>
-</div>
-
-[% INCLUDE 'intranet-bottom.inc' popup_window=1 %]
+++ /dev/null
-[% USE raw %]
-[% USE Asset %]
-[% USE Koha %]
-[% SET footerjs = 1 %]
-[% INCLUDE 'doc-head-open.inc' %]
-<title>Print Receipt for [% cardnumber | html %]</title>
-[% INCLUDE 'doc-head-close.inc' %]
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon | html %][% ELSE %][% interface | html %]/[% theme | html %]/img/favicon.ico[% END %]" type="image/x-icon" />
-[% Asset.css("css/print.css") | $raw %]
-</head>
-
-<body id="pat_moremember-receipt" class="pat">
-
-<div id="receipt">
-
-<h3>[% LibraryName | html %]</h3>
-[% IF ( branchname ) %][% branchname | html %]<br />[% END %]
-Checked out to [% firstname | html %] [% surname | html %] <br />
-(<a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% cardnumber | uri %]">[% cardnumber | html %]</a>)<br />
-
-[% todaysdate | html %]<br />
-
-[% IF ( quickslip ) %]
-<h4>Checked out today</h4>
-[% FOREACH issueloo IN issueloop %]
-[% IF ( issueloo.red ) %][% ELSE %]
-[% IF ( issueloo.today ) %]
-<p><a href="/cgi-bin/koha/catalogue/detail.pl?item=[% issueloo.itemnumber | uri %]&biblionumber=[% issueloo.biblionumber | uri %]&bi=[% issueloo.biblioitemnumber | uri %]">[% issueloo.title | html %]</a><br />
-Barcode: [% issueloo.barcode | html %]<br />
-Date due: [% issueloo.date_due | html %]<br /></p>
- [% END %]
- [% END %]
- [% END %]
-
-[% ELSE %]
-<h4>Checked out</h4>
-[% FOREACH issueloo IN issueloop %]
-[% IF ( issueloo.red ) %][% ELSE %]
-<p><a href="/cgi-bin/koha/catalogue/detail.pl?item=[% issueloo.itemnumber | uri %]&biblionumber=[% issueloo.biblionumber | uri %]&bi=[% issueloo.biblioitemnumber | uri %]">[% issueloo.title | html %]</a><br />
-Barcode: [% issueloo.barcode | html %]<br />
-Date due: [% issueloo.date_due | html %]<br /></p>
- [% END %]
- [% END %]
-
-[% END %]
-
-[% IF ( quickslip ) %]
-[% ELSE %]
-[% IF ( overdues_exist ) %]
-<h4>Overdues</h4>
- [% FOREACH issueloo IN issueloop %]
- [% IF ( issueloo.red ) %]
-<p><a href="/cgi-bin/koha/catalogue/detail.pl?item=[% issueloo.itemnumber | uri %]&biblionumber=[% issueloo.biblionumber | uri %]&bi=[% issueloo.biblioitemnumber | uri %]">[% issueloo.title | html %]</a><br />
-Barcode: [% issueloo.barcode | html %]<br />
-Date due: [% issueloo.date_due | html %]</p>
-[% END %]
-[% END %]
-[% END %]
-[% END %]
-
-[% IF ( koha_news_count ) %]
- <hr><h4 style="text-align: center; font-style:italic;">News</h4>
- <!-- [% koha_news_count | html %] recent news item(s) -->
- [% FOREACH koha_new IN koha_news %]
- <div class="newsitem" id="news[% koha_new.idnew | html %]"><h5 style="margin-bottom: 1px; margin-top: 1px"><b>[% koha_new.title | html %]</b></h5>
- <p style="margin-bottom: 1px; margin-top: 1px">[% koha_new.content | $raw %]</p>
- <p class="newsfooter" style="font-size: 8pt; font-style:italic; margin-bottom: 1px; margin-top: 1px"> Posted on [% koha_new.newdate | html %]
-
-</p><hr /></div>
- [% END %]
-[% END %]
-
-[% MACRO jsinclude BLOCK %]
- [% INCLUDE 'slip-print.inc' #printThenClose %]
-[% END %]
-
-[% INCLUDE 'intranet-bottom.inc' %]
[% USE KohaDates %]
[% USE AuthorisedValues %]
[% USE ColumnsSettings %]
+[% USE Price %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Patrons ›
[% END %]
<i>"[% patron_message.message | html %]"</i>
</span>
- [% IF patron_message.branchcode == branchcode OR Koha.Preference('AllowAllMessageDeletion') %]
+ [% IF patron_message.branchcode == patron.branchcode OR Koha.Preference('AllowAllMessageDeletion') %]
<a class="btn btn-link" href="/cgi-bin/koha/circ/del_message.pl?message_id=[% patron_message.message_id | html %]&borrowernumber=[% patron_message.borrowernumber | html %]&from=moremember" onclick="return confirm(MSG_CONFIRM_DELETE_MESSAGE);"><i class="fa fa-trash"></i> Delete</a>
[% END %]
</li>
[% IF ( flagged ) %]
<div id="circmessages" class="circmessage attention">
<ul>
- [% IF ( userdebarred ) %]
+ [% IF ( patron.is_debarred ) %]
<li class="blocker">Patron's account is restricted
[% IF ( userdebarreddate ) %]
- until [% userdebarreddate | html %]
+ until [% userdebarreddate | $KohaDates %]
[% END %]
- [% IF ( debarredcomment ) %]
+ [% IF ( patron.debarredcomment ) %]
with the explanation: <i>
- [% IF debarredcomment.search('OVERDUES_PROCESS') %]
- Restriction added by overdues process [% debarredcomment.remove('OVERDUES_PROCESS ') | html_line_break %]
+ [% IF patron.debarredcomment.search('OVERDUES_PROCESS') %]
+ Restriction added by overdues process [% patron.debarredcomment.remove('OVERDUES_PROCESS ') | html_line_break %]
[% ELSE %]
- [% debarredcomment | html_line_break %]
+ [% patron.debarredcomment | html_line_break %]
[% END %]
</i>
[% END %]
[% IF ( patron.gonenoaddress ) %]
<li class="blocker">Patron's address is in doubt.</li>
[% END %]
- [% IF ( lost ) %]
+ [% IF ( patron.lost ) %]
<li class="blocker">Patron's card has been reported lost.</li>
[% END %]
[% IF ( patron.is_expired ) %]
[% IF ( patron.dateofbirth ) %]
<li>
<span class="label">Date of birth:</span>
- [% patron.dateofbirth | $KohaDates %] ([% age | html %] years)
+ [% patron.dateofbirth | $KohaDates %] ([% patron.get_age | html %] years)
</li>
[% END %]
[% IF ( patron.sex ) %]
<a class="btn btn-default btn-xs" href="memberentry.pl?op=modify&borrowernumber=[% patron.borrowernumber | html %]&step=5"><i class="fa fa-pencil"></i> Edit</a>
</div>
[% INCLUDE 'messaging-preference-form.inc' %]
- [% IF ( SMSSendDriver ) %]
+ [% IF Koha.Preference('SMSSendDriver') %]
<div class="rows">
<ol>
<li>
</li>
<li id="patron-branchname">
<span class="label">Library: </span>
- [% branchname | html %]
+ [% Branches.GetName( patron.branchcode ) | html %]
</li>
- [% IF ( OPACPrivacy ) %]
+ [% IF Koha.Preference( 'OPACPrivacy') %]
<li id="patron-privacypref">
<span class="label">Privacy Pref:</span>
- [% IF ( privacy0 ) %]Forever[% END %]
- [% IF ( privacy1 ) %]Default[% END %]
- [% IF ( privacy2 ) %]Never[% END %]
+ [% IF ( patron.privacy == 0 ) %]Forever[% END %]
+ [% IF ( patron.privacy == 1 ) %]Default[% END %]
+ [% IF ( patron.privacy == 2 ) %]Never[% END %]
</li>
[% END %]
</li>
[% IF relatives_issues_count %]
<li>
- <a href="#relatives-issues" id="relatives-issues-tab">Relatives' checkouts</a>
+ <a href="#relatives-issues" id="relatives-issues-tab">[% relatives_issues_count | html %] Relatives' checkouts</a>
</li>
[% END %]
<li>
[% END %]
<div id="finesandcharges">
- [% IF ( totaldue_raw ) %]
- <p>Total due: [% totaldue | html %]</p>
+ [% IF ( fines ) %]
+ <p>Total due: [% fines | $Price %]</p>
[% ELSE %]
<p>No outstanding charges</p>
[% END %]
=head1 moremember.pl
- script to do a borrower enquiry/bring up borrower details etc
- Displays all the details about a borrower
- written 20/12/99 by chris@katipo.co.nz
- last modified 21/1/2000 by chris@katipo.co.nz
- modified 31/1/2001 by chris@katipo.co.nz
- to not allow items on request to be renewed
-
- needs html removed and to use the C4::Output more, but its tricky
+ script to do a borrower enquiry/bring up patron details etc
+ Displays all the details about a patron
=cut
use Modern::Perl;
use CGI qw ( -utf8 );
-use HTML::Entities;
use C4::Context;
use C4::Auth;
use C4::Output;
-use C4::Members;
-use C4::Members::Attributes;
use C4::Members::AttributeTypes;
-use C4::Reserves;
-use C4::Circulation;
-use C4::Koha;
-use C4::Letters;
-use C4::Biblio;
use C4::Form::MessagingPreferences;
use List::MoreUtils qw/uniq/;
use C4::Members::Attributes qw(GetBorrowerAttributes);
-use Koha::Account::Lines;
-use Koha::AuthorisedValues;
-use Koha::CsvProfiles;
use Koha::Patron::Debarments qw(GetDebarments);
use Koha::Patron::Messages;
-#use Smart::Comments;
-#use Data::Dumper;
-use DateTime;
use Koha::DateUtils;
-use Koha::Database;
+use Koha::CsvProfiles;
use Koha::Patrons;
-use Koha::Patron::Categories;
use Koha::Token;
+use Koha::Checkouts;
use vars qw($debug);
BEGIN {
- $debug = $ENV{DEBUG} || 0;
+ $debug = $ENV{DEBUG} || 0;
}
-my $dbh = C4::Context->dbh;
-
my $input = CGI->new;
$debug or $debug = $input->param('debug') || 0;
-my $print = $input->param('print');
-
-my $template_name;
-my $quickslip = 0;
-
-my $flagsrequired;
-if (defined $print and $print eq "page") {
- $template_name = "members/moremember-print.tt";
- # 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 (defined $print and $print eq "slip") {
- $template_name = "members/moremember-receipt.tt";
- # circ staff who process checkouts but can't edit
- # patrons still need to be able to print receipts
- $flagsrequired = { circulate => "circulate_remaining_permissions" };
-} elsif (defined $print and $print eq "qslip") {
- $template_name = "members/moremember-receipt.tt";
- $quickslip = 1;
- $flagsrequired = { circulate => "circulate_remaining_permissions" };
-} elsif (defined $print and $print eq "brief") {
- $template_name = "members/moremember-brief.tt";
- $flagsrequired = { borrowers => 'edit_borrowers' };
-} else {
- $template_name = "members/moremember.tt";
- $flagsrequired = { borrowers => 'edit_borrowers' };
-}
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
- template_name => $template_name,
+ template_name => "members/moremember.tt",
query => $input,
type => "intranet",
authnotrequired => 0,
- flagsrequired => $flagsrequired,
+ flagsrequired => { borrowers => 'edit_borrowers' },
debug => 1,
}
);
my $borrowernumber = $input->param('borrowernumber');
-$borrowernumber = HTML::Entities::encode($borrowernumber);
my $error = $input->param('error');
$template->param( error => $error ) if ( $error );
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
-my $issues = $patron->checkouts;
-my $balance = $patron->account->balance;
-$template->param(
- issuecount => $issues->count,
- fines => $balance,
-);
-
my $category_type = $patron->category->category_type;
-my $data = $patron->unblessed;
-
-$debug and printf STDERR "dates (enrolled,expiry,birthdate) raw: (%s, %s, %s)\n", map {$data->{$_}} qw(dateenrolled dateexpiry dateofbirth);
-foreach (qw(dateenrolled dateexpiry dateofbirth)) { # FIXME This should be removed
- my $userdate = $data->{$_};
- unless ($userdate) {
- $debug and warn sprintf "Empty \$data{%12s}", $_;
- $data->{$_} = '';
- next;
- }
- $data->{$_} = dt_from_string( $userdate );
-}
-for (qw(gonenoaddress lost borrowernotes)) {
- $data->{$_} and $template->param(flagged => 1) and last;
+for (qw(gonenoaddress lost borrowernotes is_debarred)) {
+ $patron->$_ and $template->param(flagged => 1) and last;
}
if ( $patron->is_debarred ) {
$template->param(
- userdebarred => 1, # FIXME Template should use patron->is_debarred
- flagged => 1,
debarments => scalar GetDebarments({ borrowernumber => $borrowernumber }),
);
- my $debar = $data->{'debarred'};
- if ( $debar ne "9999-12-31" ) {
- $template->param( 'userdebarreddate' => output_pref( { dt => dt_from_string( $debar ), dateonly => 1 } ) );
- $template->param( 'debarredcomment' => $data->{debarredcomment} );
+ if ( $patron->debarred ne "9999-12-31" ) {
+ $template->param( 'userdebarreddate' => $patron->debarred );
}
}
-$data->{ "sex_".$data->{'sex'}."_p" } = 1 if defined $data->{sex};
-
my @relatives;
if ( my $guarantor = $patron->guarantor ) {
$template->param( guarantor => $guarantor );
}
my $relatives_issues_count =
- Koha::Database->new()->schema()->resultset('Issue')
- ->count( { borrowernumber => \@relatives } );
-
-my %bor;
-$bor{'borrowernumber'} = $borrowernumber;
-
-# Converts the branchcode to the branch name
-my $samebranch;
-if ( C4::Context->preference("IndependentBranches") ) {
- if ( C4::Context->IsSuperLibrarian() ) {
- $samebranch = 1;
- }
- else {
- my $userenv = C4::Context->userenv;
- $samebranch = ( $data->{'branchcode'} eq $userenv->{branch} );
- }
-}
-else {
- $samebranch = 1;
-}
-my $library = Koha::Libraries->find( $data->{branchcode})->unblessed;
-@{$data}{keys %$library} = values %$library; # merge in all branch columns # FIXME This is really ugly, we should pass the library instead
-
-# If printing a page, send the account informations to the template
-if (defined $print and $print eq "page") {
- my $accts = Koha::Account::Lines->search(
- { borrowernumber => $patron->borrowernumber, amountoutstanding => { '>' => 0 } },
- { order_by => { -desc => 'accountlines_id' } }
- );
- $template->param( accounts => $accts );
-}
-
-# Show OPAC privacy preference is system preference is set
-if ( C4::Context->preference('OPACPrivacy') ) { # FIXME Should be moved the the template
- $template->param( OPACPrivacy => 1);
- $template->param( "privacy".$data->{'privacy'} => 1);
-}
-
-my $today = DateTime->now( time_zone => C4::Context->tz);
-$today->truncate(to => 'day');
-my $overdues_exist = 0;
-my $totalprice = 0;
-
-# Calculate and display patron's age
-if ( $data->{dateofbirth} ) {
- $template->param( age => Koha::Patron->new({ dateofbirth => $data->{dateofbirth} })->get_age );
-}
-
-### ###############################################################################
-# BUILD HTML
-# show all reserves of this borrower, and the position of the reservation ....
-if ($borrowernumber) {
- $template->param(
- holds_count => Koha::Database->new()->schema()->resultset('Reserve')
- ->count( { borrowernumber => $borrowernumber } ) );
-}
+ Koha::Checkouts->count({ borrowernumber => \@relatives });
# Generate CSRF token for upload and delete image buttons
$template->param(
csrf_token => Koha::Token->new->generate_csrf({ session_id => $input->cookie('CGISESSID'),}),
);
-
-$template->param(%$data); # FIXME This should be removed and used $patron instead, but too many things are processed above
-
if (C4::Context->preference('ExtendedPatronAttributes')) {
my $attributes = C4::Members::Attributes::GetBorrowerAttributes($borrowernumber);
my @classes = uniq( map {$_->{class}} @$attributes );
if (C4::Context->preference('EnhancedMessagingPreferences')) {
C4::Form::MessagingPreferences::set_form_values({ borrowernumber => $borrowernumber }, $template);
$template->param(messaging_form_inactive => 1);
- $template->param(SMSSendDriver => C4::Context->preference("SMSSendDriver"));
- $template->param(TalkingTechItivaPhone => C4::Context->preference("TalkingTechItivaPhoneNotification"));
}
if ( C4::Context->preference("ExportCircHistory") ) {
my $patron_messages = Koha::Patron::Messages->search(
{
- 'me.borrowernumber' => $borrowernumber,
+ 'me.borrowernumber' => $patron->borrowernumber,
},
{
join => 'manager',
);
}
-my $total = $patron->account->balance;
$template->param(
patron => $patron,
+ issuecount => $patron->checkouts->count,
+ holds_count => $patron->holds->count,
+ fines => $patron->account->balance,
translated_language => $translated_language,
detailview => 1,
was_renewed => scalar $input->param('was_renewed') ? 1 : 0,
- todaysdate => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }),
- totalprice => sprintf("%.2f", $totalprice),
- totaldue => sprintf("%.2f", $total),
- totaldue_raw => $total,
- overdues_exist => $overdues_exist,
- StaffMember => $category_type eq 'S',
$category_type => 1, # [% IF ( I ) %] = institutional/organisation
- samebranch => $samebranch,
- quickslip => $quickslip,
housebound_role => scalar $patron->housebound_role,
- PatronsPerPage => C4::Context->preference("PatronsPerPage") || 20,
relatives_issues_count => $relatives_issues_count,
relatives_borrowernumbers => \@relatives,
);