fix for 191, code reindenting & some query improvment
This commit is contained in:
parent
95dde50470
commit
3c4012d4de
2 changed files with 645 additions and 674 deletions
|
@ -31,16 +31,9 @@ use strict;
|
|||
require Exporter;
|
||||
use DBI;
|
||||
use C4::Context;
|
||||
#use C4::Accounts;
|
||||
#use C4::InterfaceCDK;
|
||||
#use C4::Circulation::Main;
|
||||
#use C4::Circulation::Renewals;
|
||||
#use C4::Scan;
|
||||
use C4::Stats;
|
||||
use C4::Reserves2;
|
||||
use C4::Koha;
|
||||
#use C4::Search;
|
||||
#use C4::Print;
|
||||
|
||||
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
|
||||
|
||||
|
@ -494,19 +487,10 @@ sub dotransfer {
|
|||
$fbr = $dbh->quote($fbr);
|
||||
$tbr = $dbh->quote($tbr);
|
||||
#new entry in branchtransfers....
|
||||
$dbh->do(<<EOT);
|
||||
INSERT INTO branchtransfers
|
||||
(itemnumber, frombranch, datearrived, tobranch)
|
||||
VALUES ($itm, $fbr, now(), $tbr)
|
||||
EOT
|
||||
|
||||
$dbh->do("INSERT INTO branchtransfers (itemnumber, frombranch, datearrived, tobranch)
|
||||
VALUES ($itm, $fbr, now(), $tbr)");
|
||||
#update holdingbranch in items .....
|
||||
$dbh->do(<<EOT);
|
||||
UPDATE items
|
||||
SET datelastseen = now(),
|
||||
holdingbranch = $tbr
|
||||
WHERE items.itemnumber = $itm
|
||||
EOT
|
||||
$dbh->do("UPDATE items SET datelastseen = now(), holdingbranch = $tbr WHERE items.itemnumber = $itm);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -687,7 +671,7 @@ sub issuebook {
|
|||
$defaultanswer = 'Y';
|
||||
last SWITCH;
|
||||
} elsif ($responses->{4} eq 'Y') {
|
||||
my $charge = calc_charges($env, $dbh, $iteminformation->{'itemnumber'}, $patroninformation->{'borrowernumber'});
|
||||
my ($charge,$itemtype) = calc_charges($env, $dbh, $iteminformation->{'itemnumber'}, $patroninformation->{'borrowernumber'});
|
||||
if ($charge > 0) {
|
||||
createcharge($env, $dbh, $iteminformation->{'itemnumber'}, $patroninformation->{'borrowernumber'}, $charge);
|
||||
$iteminformation->{'charge'} = $charge;
|
||||
|
@ -818,7 +802,7 @@ sub issuebook {
|
|||
$sth->execute;
|
||||
$sth->finish;
|
||||
# If it costs to borrow this book, charge it to the patron's account.
|
||||
my $charge=calc_charges($env, $dbh, $iteminformation->{'itemnumber'}, $patroninformation->{'borrowernumber'});
|
||||
my ($charge,$itemtype)=calc_charges($env, $dbh, $iteminformation->{'itemnumber'}, $patroninformation->{'borrowernumber'});
|
||||
if ($charge > 0) {
|
||||
createcharge($env, $dbh, $iteminformation->{'itemnumber'}, $patroninformation->{'borrowernumber'}, $charge);
|
||||
$iteminformation->{'charge'}=$charge;
|
||||
|
@ -993,11 +977,7 @@ sub updateitemlost{
|
|||
my ($itemno)=@_;
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
$dbh->do(<<EOT);
|
||||
UPDATE items
|
||||
SET itemlost = 0
|
||||
WHERE itemnumber = $itemno
|
||||
EOT
|
||||
$dbh->do("UPDATE items SET itemlost = 0 WHERE itemnumber = $itemno");
|
||||
}
|
||||
|
||||
# Not exported
|
||||
|
@ -1384,8 +1364,7 @@ sub currentissues {
|
|||
# Either way, the date should be be formatted outside of the
|
||||
# loop.
|
||||
my @datearr = localtime(time());
|
||||
my $todaysdate = (1900+$datearr[5]).sprintf ("%0.2d", ($datearr[4]
|
||||
+1)).sprintf ("%0.2d", $datearr[3]);
|
||||
my $todaysdate = (1900+$datearr[5]).sprintf ("%0.2d", ($datearr[4]+1)).sprintf ("%0.2d", $datearr[3]);
|
||||
my $datedue=$data->{'date_due'};
|
||||
$datedue=~s/-//g;
|
||||
if ($datedue < $todaysdate) {
|
||||
|
@ -1483,9 +1462,7 @@ sub checkwaiting {
|
|||
# check for reserves waiting
|
||||
my ($env,$dbh,$bornum)=@_;
|
||||
my @itemswaiting;
|
||||
my $query = "select * from reserves
|
||||
where (borrowernumber = '$bornum')
|
||||
and (reserves.found='W') and cancellationdate is NULL";
|
||||
my $query = "select * from reserves where (borrowernumber = '$bornum') and (reserves.found='W') and cancellationdate is NULL";
|
||||
my $sth = $dbh->prepare($query);
|
||||
$sth->execute();
|
||||
my $cnt=0;
|
||||
|
|
|
@ -221,13 +221,9 @@ sub renewbook {
|
|||
if ($charge > 0){
|
||||
my $accountno=getnextacctno($env,$bornum,$dbh);
|
||||
my $item=getiteminformation($env, $itemno);
|
||||
my $account="Insert into accountlines
|
||||
(borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding,itemnumber)
|
||||
values
|
||||
(?,?,now(),?,?,?,?,?)";
|
||||
$sth=$dbh->prepare($account);
|
||||
$sth->execute($bornum,$accountno,$charge,"Renewal of Rental Item $item->{'title'} $item->{'barcode'}",
|
||||
'Rent',$charge,$itemno)";
|
||||
$sth=$dbh->prepare("Insert into accountlines (borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding,itemnumber)
|
||||
values (?,?,now(),?,?,?,?,?)");
|
||||
$sth->execute($bornum,$accountno,$charge,"Renewal of Rental Item $item->{'title'} $item->{'barcode'}",'Rent',$charge,$itemno);
|
||||
$sth->finish;
|
||||
# print $account;
|
||||
}
|
||||
|
@ -266,13 +262,11 @@ sub calc_charges {
|
|||
my $item_type;
|
||||
|
||||
# Get the book's item type and rental charge (via its biblioitem).
|
||||
my $q1 = "select itemtypes.itemtype,rentalcharge from
|
||||
items,biblioitems,itemtypes
|
||||
where (items.itemnumber ='$itemno')
|
||||
my $sth1= $dbh->prepare("select itemtypes.itemtype,rentalcharge from items,biblioitems,itemtypes
|
||||
where (items.itemnumber =?)
|
||||
and (biblioitems.biblioitemnumber = items.biblioitemnumber)
|
||||
and (biblioitems.itemtype = itemtypes.itemtype)";
|
||||
my $sth1= $dbh->prepare($q1);
|
||||
$sth1->execute;
|
||||
and (biblioitems.itemtype = itemtypes.itemtype)");
|
||||
$sth1->execute($itemno);
|
||||
# FIXME - Why not just use fetchrow_array?
|
||||
if (my $data1=$sth1->fetchrow_hashref) {
|
||||
$item_type = $data1->{'itemtype'};
|
||||
|
|
Loading…
Reference in a new issue