@@ -, +, @@ --- C4/Accounts.pm | 18 ++++++------------ C4/Circulation.pm | 21 +++++++++++---------- 2 files changed, 17 insertions(+), 22 deletions(-) --- a/C4/Accounts.pm +++ a/C4/Accounts.pm @@ -158,6 +158,8 @@ sub makepayment { # from their card, and put a note on the item record my ( $borrowernumber, $accountno, $amount, $user, $branch ) = @_; my $dbh = C4::Context->dbh; + my $manager_id = 0; + $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; # begin transaction my $nextaccntno = getnextacctno($borrowernumber); @@ -175,21 +177,13 @@ sub makepayment { AND accountno = ?"); $sth->execute($borrowernumber, $accountno); - # print $updquery; -# $dbh->do( " -# INSERT INTO accountoffsets -# (borrowernumber, accountno, offsetaccount, -# offsetamount) -# VALUES ($borrowernumber, $accountno, $nextaccntno, $newamtos) -# " ); - # create new line my $payment = 0 - $amount; $sth = $dbh->prepare("INSERT INTO accountlines - (borrowernumber, accountno, date, amount, - description, accounttype, amountoutstanding) - VALUES (?,?,now(),?,?,'Pay',0)"); - $sth->execute($borrowernumber, $nextaccntno, $payment, "Payment,thanks - $user"); + (borrowernumber, accountno, date, amount,itemnumber, + description, accounttype, amountoutstanding, manager_id) + VALUES (?,?,now(),?,?,?,'Pay',0,?)"); + $sth->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'},"Payment,thanks - $user", $manager_id); # FIXME - The second argument to &UpdateStats is supposed to be the # branch code. --- a/C4/Circulation.pm +++ a/C4/Circulation.pm @@ -2283,16 +2283,15 @@ sub AddRenewal { if ( $charge > 0 ) { my $accountno = getnextacctno( $borrowernumber ); my $item = GetBiblioFromItemNumber($itemnumber); + my $manager_id = 0; + $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; $sth = $dbh->prepare( "INSERT INTO accountlines - (date, - borrowernumber, accountno, amount, - description, - accounttype, amountoutstanding, itemnumber - ) - VALUES (now(),?,?,?,?,?,?,?)" + (date, borrowernumber, accountno, amount, manager_id, + description,accounttype, amountoutstanding, itemnumber) + VALUES (now(),?,?,?,?,?,?,?,?)" ); - $sth->execute( $borrowernumber, $accountno, $charge, + $sth->execute( $borrowernumber, $accountno, $charge, $manager_id, "Renewal of Rental Item $item->{'title'} $item->{'barcode'}", 'Rent', $charge, $itemnumber ); $sth->finish; @@ -2445,15 +2444,17 @@ sub AddIssuingCharge { my ( $itemnumber, $borrowernumber, $charge ) = @_; my $dbh = C4::Context->dbh; my $nextaccntno = getnextacctno( $borrowernumber ); + my $manager_id = 0; + $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; my $query =" INSERT INTO accountlines (borrowernumber, itemnumber, accountno, date, amount, description, accounttype, - amountoutstanding) - VALUES (?, ?, ?,now(), ?, 'Rental', 'Rent',?) + amountoutstanding, manager_id) + VALUES (?, ?, ?,now(), ?, 'Rental', 'Rent',?,?) "; my $sth = $dbh->prepare($query); - $sth->execute( $borrowernumber, $itemnumber, $nextaccntno, $charge, $charge ); + $sth->execute( $borrowernumber, $itemnumber, $nextaccntno, $charge, $charge, $manager_id ); $sth->finish; } --