|
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 |
- |
|
|