# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
=head1 moremember.pl
=cut
use strict;
+#use warnings; FIXME - Bug 2505
use CGI;
use C4::Context;
use C4::Auth;
for my $failedret (@failedreturns) { $return_failed{$failedret} = 1; }
my $template_name;
+my $quickslip = 0;
if ($print eq "page") { $template_name = "members/moremember-print.tmpl"; }
elsif ($print eq "slip") { $template_name = "members/moremember-receipt.tmpl"; }
+elsif ($print eq "qslip") { $template_name = "members/moremember-receipt.tmpl"; $quickslip = 1; }
else { $template_name = "members/moremember.tmpl"; }
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
my $borrowernumber = $input->param('borrowernumber');
#start the page and read in includes
-my $data = GetMember( $borrowernumber ,'borrowernumber');
+my $data = GetMember( 'borrowernumber' => $borrowernumber );
my $reregistration = $input->param('reregistration');
if ( not defined $data ) {
my $catcode;
if ( $category_type eq 'C') {
if ($data->{'guarantorid'} ne '0' ) {
- my $data2 = GetMember( $data->{'guarantorid'} ,'borrowernumber');
- foreach (qw(address city B_address B_city phone mobile zipcode)) {
+ my $data2 = GetMember( 'borrowernumber' => $data->{'guarantorid'} );
+ foreach (qw(address city B_address B_city phone mobile zipcode country B_country)) {
$data->{$_} = $data2->{$_};
}
}
}
else {
if ($data->{'guarantorid'}){
- my ($guarantor) = GetMember( $data->{'guarantorid'},'biblionumber');
+ my ($guarantor) = GetMember( 'borrowernumber' =>$data->{'guarantorid'});
$template->param(guarantor => 1);
foreach (qw(borrowernumber cardnumber firstname surname)) {
$template->param("guarantor$_" => $guarantor->{$_});
$samebranch = ( $data->{'branchcode'} eq $userenv->{branch} );
}
$samebranch = 1 if ( $userenv->{flags} % 2 == 1 );
+}else{
+ $samebranch = 1;
}
my $branchdetail = GetBranchDetail( $data->{'branchcode'});
$data->{'branchname'} = $branchdetail->{branchname};
# current issues
#
my $issue = GetPendingIssues($borrowernumber);
-my $count = scalar(@$issue);
+my $issuecount = scalar(@$issue);
my $roaddetails = &GetRoadTypeDetails( $data->{'streettype'} );
my $today = POSIX::strftime("%Y-%m-%d", localtime); # iso format
my @issuedata;
my $overdues_exist = 0;
my $totalprice = 0;
-for ( my $i = 0 ; $i < $count ; $i++ ) {
+for ( my $i = 0 ; $i < $issuecount ; $i++ ) {
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'};
my %row = %{ $issue->[$i] };
$totalprice += $issue->[$i]{'replacementprice'};
$row{'replacementprice'} = $issue->[$i]{'replacementprice'};
+ # item lost, damaged loops
+ if ($row{'itemlost'}) {
+ my $fw = GetFrameworkCode($issue->[$i]{'biblionumber'});
+ my $category = GetAuthValCode('items.itemlost',$fw);
+ my $lostdbh = C4::Context->dbh;
+ my $sth = $lostdbh->prepare("select lib from authorised_values where category=? and authorised_value =? ");
+ $sth->execute($category, $row{'itemlost'});
+ my $loststat = $sth->fetchrow;
+ if ($loststat) {
+ $row{'itemlost'} = $loststat;
+ }
+ }
+ if ($row{'damaged'}) {
+ my $fw = GetFrameworkCode($issue->[$i]{'biblionumber'});
+ my $category = GetAuthValCode('items.damaged',$fw);
+ my $damageddbh = C4::Context->dbh;
+ my $sth = $damageddbh->prepare("select lib from authorised_values where category=? and authorised_value =? ");
+ $sth->execute($category, $row{'damaged'});
+ my $damagedstat = $sth->fetchrow;
+ if ($damagedstat) {
+ $row{'itemdamaged'} = $damagedstat;
+ }
+ }
+ # end lost, damaged
if ( $datedue lt $today ) {
$overdues_exist = 1;
$row{'red'} = 1;
}
+ if ( $issuedate eq $today ) {
+ $row{'today'} = 1;
+ }
#find the charge for an item
my ( $charge, $itemtype ) =
}
# return result to the template
- $template->param( reservloop => \@reservloop );
+ $template->param( reservloop => \@reservloop,
+ countreserv => scalar @reservloop,
+ );
}
# current alert subscriptions
$_->{relatedto} = findrelatedto( $_->{type}, $_->{externalid} );
}
+my $candeleteuser;
+my $userenv = C4::Context->userenv;
+if($userenv->{flags} % 2 == 1){
+ $candeleteuser = 1;
+}elsif ( C4::Context->preference("IndependantBranches") ) {
+ $candeleteuser = ( $data->{'branchcode'} eq $userenv->{branch} );
+}else{
+ if( C4::Auth::getuserflags( $userenv->{flags},$userenv->{number})->{borrowers} ) {
+ $candeleteuser = 1;
+ }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
detailview => 1,
AllowRenewalLimitOverride => C4::Context->preference("AllowRenewalLimitOverride"),
DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
+ CANDELETEUSER => $candeleteuser,
roaddetails => $roaddetails,
borrowernumber => $borrowernumber,
categoryname => $data->{'description'},
totaldue => sprintf("%.2f", $total),
totaldue_raw => $total,
issueloop => \@issuedata,
+ issuecount => $issuecount,
overdues_exist => $overdues_exist,
error => $error,
$error => 1,
# reserveloop => \@reservedata,
dateformat => C4::Context->preference("dateformat"),
"dateformat_" . (C4::Context->preference("dateformat") || '') => 1,
+ samebranch => $samebranch,
+ quickslip => $quickslip,
);
output_html_with_http_headers $input, $cookie, $template->output;