View | Details | Raw Unified | Return to bug 6634
Collapse All | Expand All

(-)a/C4/Accounts.pm (-12 / +6 lines)
Lines 158-163 sub makepayment { Link Here
158
    # from their card, and put a note on the item record
158
    # from their card, and put a note on the item record
159
    my ( $borrowernumber, $accountno, $amount, $user, $branch ) = @_;
159
    my ( $borrowernumber, $accountno, $amount, $user, $branch ) = @_;
160
    my $dbh = C4::Context->dbh;
160
    my $dbh = C4::Context->dbh;
161
    my $manager_id = 0;
162
    $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; 
161
163
162
    # begin transaction
164
    # begin transaction
163
    my $nextaccntno = getnextacctno($borrowernumber);
165
    my $nextaccntno = getnextacctno($borrowernumber);
Lines 175-195 sub makepayment { Link Here
175
				AND accountno = ?");
177
				AND accountno = ?");
176
    $sth->execute($borrowernumber, $accountno);
178
    $sth->execute($borrowernumber, $accountno);
177
179
178
    #  print $updquery;
179
#    $dbh->do( "
180
#        INSERT INTO     accountoffsets
181
#                        (borrowernumber, accountno, offsetaccount,
182
#                         offsetamount)
183
#        VALUES          ($borrowernumber, $accountno, $nextaccntno, $newamtos)
184
#        " );
185
186
    # create new line
180
    # create new line
187
    my $payment = 0 - $amount;
181
    my $payment = 0 - $amount;
188
    $sth = $dbh->prepare("INSERT INTO accountlines
182
    $sth = $dbh->prepare("INSERT INTO accountlines
189
					 (borrowernumber, accountno, date, amount,
183
					 (borrowernumber, accountno, date, amount,itemnumber,
190
					  description, accounttype, amountoutstanding)
184
					  description, accounttype, amountoutstanding, manager_id)
191
				  VALUES (?,?,now(),?,?,'Pay',0)");
185
				  VALUES (?,?,now(),?,?,?,'Pay',0,?)");
192
    $sth->execute($borrowernumber, $nextaccntno, $payment, "Payment,thanks - $user");
186
    $sth->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'},"Payment,thanks - $user", $manager_id);
193
187
194
    # FIXME - The second argument to &UpdateStats is supposed to be the
188
    # FIXME - The second argument to &UpdateStats is supposed to be the
195
    # branch code.
189
    # branch code.
(-)a/C4/Circulation.pm (-11 / +11 lines)
Lines 2283-2298 sub AddRenewal { Link Here
2283
    if ( $charge > 0 ) {
2283
    if ( $charge > 0 ) {
2284
        my $accountno = getnextacctno( $borrowernumber );
2284
        my $accountno = getnextacctno( $borrowernumber );
2285
        my $item = GetBiblioFromItemNumber($itemnumber);
2285
        my $item = GetBiblioFromItemNumber($itemnumber);
2286
        my $manager_id = 0;
2287
        $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; 
2286
        $sth = $dbh->prepare(
2288
        $sth = $dbh->prepare(
2287
                "INSERT INTO accountlines
2289
                "INSERT INTO accountlines
2288
                    (date,
2290
                    (date, borrowernumber, accountno, amount, manager_id,
2289
					borrowernumber, accountno, amount,
2291
                    description,accounttype, amountoutstanding, itemnumber)
2290
                    description,
2292
                    VALUES (now(),?,?,?,?,?,?,?,?)"
2291
					accounttype, amountoutstanding, itemnumber
2292
					)
2293
                    VALUES (now(),?,?,?,?,?,?,?)"
2294
        );
2293
        );
2295
        $sth->execute( $borrowernumber, $accountno, $charge,
2294
        $sth->execute( $borrowernumber, $accountno, $charge, $manager_id,
2296
            "Renewal of Rental Item $item->{'title'} $item->{'barcode'}",
2295
            "Renewal of Rental Item $item->{'title'} $item->{'barcode'}",
2297
            'Rent', $charge, $itemnumber );
2296
            'Rent', $charge, $itemnumber );
2298
        $sth->finish;
2297
        $sth->finish;
Lines 2445-2459 sub AddIssuingCharge { Link Here
2445
    my ( $itemnumber, $borrowernumber, $charge ) = @_;
2444
    my ( $itemnumber, $borrowernumber, $charge ) = @_;
2446
    my $dbh = C4::Context->dbh;
2445
    my $dbh = C4::Context->dbh;
2447
    my $nextaccntno = getnextacctno( $borrowernumber );
2446
    my $nextaccntno = getnextacctno( $borrowernumber );
2447
    my $manager_id = 0;
2448
    $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv;
2448
    my $query ="
2449
    my $query ="
2449
        INSERT INTO accountlines
2450
        INSERT INTO accountlines
2450
            (borrowernumber, itemnumber, accountno,
2451
            (borrowernumber, itemnumber, accountno,
2451
            date, amount, description, accounttype,
2452
            date, amount, description, accounttype,
2452
            amountoutstanding)
2453
            amountoutstanding, manager_id)
2453
        VALUES (?, ?, ?,now(), ?, 'Rental', 'Rent',?)
2454
        VALUES (?, ?, ?,now(), ?, 'Rental', 'Rent',?,?)
2454
    ";
2455
    ";
2455
    my $sth = $dbh->prepare($query);
2456
    my $sth = $dbh->prepare($query);
2456
    $sth->execute( $borrowernumber, $itemnumber, $nextaccntno, $charge, $charge );
2457
    $sth->execute( $borrowernumber, $itemnumber, $nextaccntno, $charge, $charge, $manager_id );
2457
    $sth->finish;
2458
    $sth->finish;
2458
}
2459
}
2459
2460
2460
- 

Return to bug 6634