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

(-)a/C4/Accounts.pm (-10 / +15 lines)
Lines 83-88 sub recordpayment { Link Here
83
    my $accdata    = "";
83
    my $accdata    = "";
84
    my $branch     = C4::Context->userenv->{'branch'};
84
    my $branch     = C4::Context->userenv->{'branch'};
85
    my $amountleft = $data;
85
    my $amountleft = $data;
86
    my $manager_id = 0;
87
    $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv;
86
88
87
    # begin transaction
89
    # begin transaction
88
    my $nextaccntno = getnextacctno($borrowernumber);
90
    my $nextaccntno = getnextacctno($borrowernumber);
Lines 125-134 sub recordpayment { Link Here
125
    # create new line
127
    # create new line
126
    my $usth = $dbh->prepare(
128
    my $usth = $dbh->prepare(
127
        "INSERT INTO accountlines
129
        "INSERT INTO accountlines
128
  (borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding)
130
  (borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id)
129
  VALUES (?,?,now(),?,'Payment,thanks','Pay',?)"
131
  VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?)"
130
    );
132
    );
131
    $usth->execute( $borrowernumber, $nextaccntno, 0 - $data, 0 - $amountleft );
133
    $usth->execute( $borrowernumber, $nextaccntno, 0 - $data, 0 - $amountleft, $manager_id );
132
    $usth->finish;
134
    $usth->finish;
133
    UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno );
135
    UpdateStats( $branch, 'payment', $data, '', '', '', $borrowernumber, $nextaccntno );
134
    $sth->finish;
136
    $sth->finish;
Lines 293-307 sub chargelostitem{ Link Here
293
295
294
    # OK, they haven't
296
    # OK, they haven't
295
    unless ($existing_charge_hashref) {
297
    unless ($existing_charge_hashref) {
298
        my $manager_id = 0;
299
        $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv;
296
        # This item is on issue ... add replacement cost to the borrower's record and mark it returned
300
        # This item is on issue ... add replacement cost to the borrower's record and mark it returned
297
        #  Note that we add this to the account even if there's no replacement price, allowing some other
301
        #  Note that we add this to the account even if there's no replacement price, allowing some other
298
        #  process (or person) to update it, since we don't handle any defaults for replacement prices.
302
        #  process (or person) to update it, since we don't handle any defaults for replacement prices.
299
        my $accountno = getnextacctno($borrowernumber);
303
        my $accountno = getnextacctno($borrowernumber);
300
        my $sth2=$dbh->prepare("INSERT INTO accountlines
304
        my $sth2=$dbh->prepare("INSERT INTO accountlines
301
        (borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding,itemnumber)
305
        (borrowernumber,accountno,date,amount,description,accounttype,amountoutstanding,itemnumber,manager_id)
302
        VALUES (?,?,now(),?,?,'L',?,?)");
306
        VALUES (?,?,now(),?,?,'L',?,?,?)");
303
        $sth2->execute($borrowernumber,$accountno,$amount,
307
        $sth2->execute($borrowernumber,$accountno,$amount,
304
        $description,$amount,$itemnumber);
308
        $description,$amount,$itemnumber,$manager_id);
305
        $sth2->finish;
309
        $sth2->finish;
306
    # FIXME: Log this ?
310
    # FIXME: Log this ?
307
    }
311
    }
Lines 680-685 sub recordpayment_selectaccts { Link Here
680
    my $accdata    = q{};
684
    my $accdata    = q{};
681
    my $branch     = C4::Context->userenv->{branch};
685
    my $branch     = C4::Context->userenv->{branch};
682
    my $amountleft = $amount;
686
    my $amountleft = $amount;
687
    my $manager_id = 0;
688
    $manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv;
683
    my $sql = 'SELECT * FROM accountlines WHERE (borrowernumber = ?) ' .
689
    my $sql = 'SELECT * FROM accountlines WHERE (borrowernumber = ?) ' .
684
    'AND (amountoutstanding<>0) ';
690
    'AND (amountoutstanding<>0) ';
685
    if (@{$accts} ) {
691
    if (@{$accts} ) {
Lines 714-722 sub recordpayment_selectaccts { Link Here
714
720
715
    # create new line
721
    # create new line
716
    $sql = 'INSERT INTO accountlines ' .
722
    $sql = 'INSERT INTO accountlines ' .
717
    '(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding) ' .
723
    '(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id) ' .
718
    q|VALUES (?,?,now(),?,'Payment,thanks','Pay',?)|;
724
    q|VALUES (?,?,now(),?,'Payment,thanks','Pay',?,?)|;
719
    $dbh->do($sql,{},$borrowernumber, $nextaccntno, 0 - $amount, 0 - $amountleft );
725
    $dbh->do($sql,{},$borrowernumber, $nextaccntno, 0 - $amount, 0 - $amountleft, $manager_id );
720
    UpdateStats( $branch, 'payment', $amount, '', '', '', $borrowernumber, $nextaccntno );
726
    UpdateStats( $branch, 'payment', $amount, '', '', '', $borrowernumber, $nextaccntno );
721
    return;
727
    return;
722
}
728
}
723
- 

Return to bug 6634