various bugfixes

This commit is contained in:
tipaul 2004-08-18 16:05:14 +00:00
parent 19ae27fc49
commit 726c0565e8
5 changed files with 22 additions and 26 deletions

View File

@ -112,8 +112,8 @@ if ($op eq 'add_form') {
} elsif ($op eq 'add_validate') {
$template->param(add_validate => 1);
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("replace categories (categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,enrolmentfee,issuelimit,reservefee,overduenoticerequired) values (?,?,?,?,?,?,?,?,?)");
$sth->execute(map { $input->param($_) } ('categorycode','description','enrolmentperiod','upperagelimit','dateofbirthrequired','enrolmentfee','issuelimit','reservefee','overduenoticerequired'));
my $sth=$dbh->prepare("replace categories (categorycode,description,enrolmentperiod,upperagelimit,dateofbirthrequired,enrolmentfee,reservefee,overduenoticerequired) values (?,?,?,?,?,?,?,?)");
$sth->execute(map { $input->param($_) } ('categorycode','description','enrolmentperiod','upperagelimit','dateofbirthrequired','enrolmentfee','reservefee','overduenoticerequired'));
$sth->finish;
# END $OP eq ADD_VALIDATE
################## DELETE_CONFIRM ##################################

View File

@ -66,7 +66,7 @@ if ($op eq 'save') {
my $cat = $3; # item type
my $data=$input->param($key);
my ($issuelength,$maxissueqty)=split(',',$data);
if ($maxissueqty >0) {
# if ($maxissueqty >0) {
$sth_search->execute($br,$bor,$cat);
my $res = $sth_search->fetchrow_hashref();
if ($res->{total}) {
@ -74,9 +74,9 @@ if ($op eq 'save') {
} else {
$sth_Iinsert->execute($br,$bor,$cat,$maxissueqty,$issuelength);
}
} else {
$sth_Idelete->execute($br,$bor,$cat);
}
# } else {
# $sth_Idelete->execute($br,$bor,$cat);
# }
}
# FINES
if ($key =~ /F-(.*)-(.*)\.(.*)/) {
@ -85,7 +85,7 @@ if ($op eq 'save') {
my $cat = $3; # item type
my $data=$input->param($key);
my ($fine,$firstremind,$chargeperiod)=split(',',$data);
if ($fine >0) {
# if ($fine >0) {
$sth_search->execute($br,$bor,$cat);
my $res = $sth_search->fetchrow_hashref();
if ($res->{total}) {
@ -93,9 +93,9 @@ if ($op eq 'save') {
} else {
$sth_Finsert->execute($br,$bor,$cat,$fine,$firstremind,$chargeperiod);
}
} else {
$sth_Fdelete->execute($br,$bor,$cat);
}
# } else {
# $sth_Fdelete->execute($br,$bor,$cat);
# }
}
}
@ -159,15 +159,15 @@ foreach my $data (@itemtypes) {
my $maxissueqty = $dat->{'maxissueqty'}+0;
my $issuelength = $dat->{'issuelength'}+0;
my $finesvalue;
$finesvalue= "$fine,$dat->{'firstremind'},$dat->{'chargeperiod'}" if $fine>0;
$finesvalue= "$fine,$dat->{'firstremind'},$dat->{'chargeperiod'}" if $fine+$dat->{'firstremind'}+$dat->{'chargeperiod'}>0;
my $issuingvalue;
if ($maxissueqty>0) {
$issuingvalue = "$issuelength,$maxissueqty" ;
}
else {
$issuingvalue = "$issuelength, 5";
$maxissueqty = 5;
}
# if ($maxissueqty>0) {
$issuingvalue = "$issuelength,$maxissueqty" if $issuelength+$maxissueqty>0;
# }
# else {
# $issuingvalue = "$issuelength, 5";
# $maxissueqty = 5;
# }
my %row = (finesname=> "F-$branch-$trow3[$i].$$data->{'itemtype'}",
finesvalue => $finesvalue,
issuingname => "I-$branch-$trow3[$i].$$data->{itemtype}",

View File

@ -96,14 +96,13 @@ if ($op eq 'add_form') {
my $data;
if ($itemtype) {
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("select itemtype,description,loanlength,renewalsallowed,rentalcharge,notforloan from itemtypes where itemtype=?");
my $sth=$dbh->prepare("select itemtype,description,renewalsallowed,rentalcharge,notforloan from itemtypes where itemtype=?");
$sth->execute($itemtype);
$data=$sth->fetchrow_hashref;
$sth->finish;
}
$template->param(itemtype => $itemtype,
description => $data->{'description'},
loanlength => $data->{'loanlength'},
renewalsallowed => $data->{'renewalsallowed'},
rentalcharge => $data->{'rentalcharge'},
notforloan => $data->{'notforloan'}
@ -114,10 +113,9 @@ if ($op eq 'add_form') {
# called by add_form, used to insert/modify data in DB
} elsif ($op eq 'add_validate') {
my $dbh = C4::Context->dbh;
my $query = "replace itemtypes (itemtype,description,loanlength,renewalsallowed,rentalcharge,notforloan) values (";
my $query = "replace itemtypes (itemtype,description,renewalsallowed,rentalcharge,notforloan) values (";
$query.= $dbh->quote($input->param('itemtype')).",";
$query.= $dbh->quote($input->param('description')).",";
$query.= $dbh->quote($input->param('loanlength')).",";
if ($input->param('renewalsallowed') ne 1) {
$query.= "0,";
} else {
@ -150,14 +148,13 @@ if ($op eq 'add_form') {
$sth->finish;
}
my $sth=$dbh->prepare("select itemtype,description,loanlength,renewalsallowed,rentalcharge from itemtypes where itemtype=?");
my $sth=$dbh->prepare("select itemtype,description,renewalsallowed,rentalcharge from itemtypes where itemtype=?");
$sth->execute($itemtype);
my $data=$sth->fetchrow_hashref;
$sth->finish;
$template->param(itemtype => $itemtype,
description => $data->{'description'},
loanlength => $data->{'loanlength'},
renewalsallowed => $data->{'renewalsallowed'},
rentalcharge => $data->{'rentalcharge'},
total => $total);
@ -189,7 +186,6 @@ if ($op eq 'add_form') {
}
$row_data{itemtype} = $results->[$i]{'itemtype'};
$row_data{description} = $results->[$i]{'description'};
$row_data{loanlength} = $results->[$i]{'loanlength'};
$row_data{renewalsallowed} = $results->[$i]{'renewalsallowed'};
$row_data{rentalcharge} = $results->[$i]{'rentalcharge'};
push(@loop_data, \%row_data);

View File

@ -164,7 +164,6 @@ if ($op eq 'add_form') {
-size=>1,
-multiple=>0,
);
warn "ATTENTION ---+--- $data->{'link'}";
$row_data{tagsubfield} =$data->{'tagsubfield'}."<input type='hidden' name='tagsubfield' value='".$data->{'tagsubfield'}."'>";
$row_data{liblibrarian} = CGI::escapeHTML($data->{'liblibrarian'});
$row_data{libopac} = CGI::escapeHTML($data->{'libopac'});

View File

@ -41,6 +41,7 @@ use strict;
use CGI;
use C4::Auth;
use C4::Context;
use C4::Koha;
use C4::Output;
use C4::Interface::CGI::Output;
use C4::Search;