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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt (-2 / +2 lines)
Lines 37-44 Link Here
37
<fieldset class="rows">
37
<fieldset class="rows">
38
<legend>Manual credit</legend><ol>
38
<legend>Manual credit</legend><ol>
39
	<li><label for="type">Credit type: </label><select name="type" id="type">
39
	<li><label for="type">Credit type: </label><select name="type" id="type">
40
<option value="C">Credit</option>
40
<option value="credit">Credit</option>
41
<option value="FOR">Forgiven</option>
41
<option value="forgiven">Forgiven</option>
42
</select></li>
42
</select></li>
43
	<li><label for="barcode">Barcode: </label><input type="text" name="barcode" id="barcode" /></li>
43
	<li><label for="barcode">Barcode: </label><input type="text" name="barcode" id="barcode" /></li>
44
	<li><label for="desc">Description: </label><input type="text" name="desc" size="50" id="desc" /></li>
44
	<li><label for="desc">Description: </label><input type="text" name="desc" size="50" id="desc" /></li>
(-)a/members/mancredit.pl (-11 / +22 lines)
Lines 32-39 use C4::Members; Link Here
32
use C4::Accounts;
32
use C4::Accounts;
33
use C4::Items;
33
use C4::Items;
34
use C4::Members::Attributes qw(GetBorrowerAttributes);
34
use C4::Members::Attributes qw(GetBorrowerAttributes);
35
use Koha::Patrons;
36
35
36
use Koha::Account;
37
use Koha::Patrons;
37
use Koha::Patron::Categories;
38
use Koha::Patron::Categories;
38
use Koha::Token;
39
use Koha::Token;
39
40
Lines 50-56 unless ( $patron ) { Link Here
50
my $add=$input->param('add');
51
my $add=$input->param('add');
51
52
52
if ($add){
53
if ($add){
53
    if ( checkauth( $input, 0, $flagsrequired, 'intranet' ) ) {
54
55
    my ( $user_id ) = checkauth( $input, 0, $flagsrequired, 'intranet' );
56
57
    if ( $user_id ) {
54
58
55
        die "Wrong CSRF token"
59
        die "Wrong CSRF token"
56
            unless Koha::Token->new->check_csrf( {
60
            unless Koha::Token->new->check_csrf( {
Lines 61-76 if ($add){ Link Here
61
        # Note: If the logged in user is not allowed to see this patron an invoice can be forced
65
        # Note: If the logged in user is not allowed to see this patron an invoice can be forced
62
        # Here we are trusting librarians not to hack the system
66
        # Here we are trusting librarians not to hack the system
63
        my $barcode = $input->param('barcode');
67
        my $barcode = $input->param('barcode');
64
        my $itemnum;
68
        my $item_id;
65
        if ($barcode) {
69
        if ($barcode) {
66
            $itemnum = GetItemnumberFromBarcode($barcode);
70
            $item_id = GetItemnumberFromBarcode($barcode);
67
        }
71
        }
68
        my $desc    = $input->param('desc');
72
        my $description = $input->param('desc');
69
        my $note    = $input->param('note');
73
        my $note        = $input->param('note');
70
        my $amount  = $input->param('amount') || 0;
74
        my $amount      = $input->param('amount') || 0;
71
        $amount = -$amount;
75
        my $type        = $input->param('type');
72
        my $type = $input->param('type');
76
73
        manualinvoice( $borrowernumber, $itemnum, $desc, $type, $amount, $note );
77
        Koha::Account->new({ patron_id => $borrowernumber })->add_credit({
78
            amount      => $amount,
79
            description => $description,
80
            item_id     => $item_id,
81
            note        => $note,
82
            type        => $type,
83
            user_id     => $user_id
84
        });
85
74
        print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber");
86
        print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber");
75
    }
87
    }
76
} else {
88
} else {
77
- 

Return to bug 20980