Lines 43-48
use Koha::Patron::Categories;
Link Here
|
43 |
use Koha::Account::DebitTypes; |
43 |
use Koha::Account::DebitTypes; |
44 |
use Koha::AdditionalFields; |
44 |
use Koha::AdditionalFields; |
45 |
use Koha::Number::Price; |
45 |
use Koha::Number::Price; |
|
|
46 |
use C4::Context; |
46 |
|
47 |
|
47 |
my $input = CGI->new; |
48 |
my $input = CGI->new; |
48 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( |
49 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user( |
Lines 82-95
my $amount = $input->param('amount');
Link Here
|
82 |
my $note = $input->param('note'); |
83 |
my $note = $input->param('note'); |
83 |
my $debit_type = $input->param('type'); |
84 |
my $debit_type = $input->param('type'); |
84 |
my $barcode = $input->param('barcode'); |
85 |
my $barcode = $input->param('barcode'); |
|
|
86 |
my $decimal_delimiter = |
87 |
C4::Context->preference('CurrencyFormat') eq 'FR' ? ',' : '.'; |
88 |
my $decimal_input_pattern = |
89 |
C4::Context->preference('CurrencyFormat') eq 'FR' |
90 |
? '^\d+(\,\d{2})?$' |
91 |
: '^\d+(\.\d{2})?$'; |
85 |
$template->param( |
92 |
$template->param( |
86 |
desc => $desc, |
93 |
desc => $desc, |
87 |
amount => $amount, |
94 |
amount => $amount, |
88 |
note => $note, |
95 |
note => $note, |
89 |
type => $debit_type, |
96 |
type => $debit_type, |
90 |
barcode => $barcode |
97 |
barcode => $barcode, |
|
|
98 |
decimal_delimiter => $decimal_delimiter, |
99 |
decimal_input_pattern => $decimal_input_pattern, |
91 |
); |
100 |
); |
92 |
|
101 |
|
|
|
102 |
|
93 |
my $add = $input->param('add'); |
103 |
my $add = $input->param('add'); |
94 |
if ($add) { |
104 |
if ($add) { |
95 |
output_and_exit( $input, $cookie, $template, 'wrong_csrf_token' ) |
105 |
output_and_exit( $input, $cookie, $template, 'wrong_csrf_token' ) |
Lines 102-112
if ($add) {
Link Here
|
102 |
|
112 |
|
103 |
# Note: If the logged in user is not allowed to see this patron an invoice can be forced |
113 |
# Note: If the logged in user is not allowed to see this patron an invoice can be forced |
104 |
# Here we are trusting librarians not to hack the system |
114 |
# Here we are trusting librarians not to hack the system |
105 |
my $desc = $input->param('desc'); |
115 |
my $desc = $input->param('desc'); |
106 |
my $amount = $input->param('amount'); |
116 |
my $amount = $input->param('amount'); |
107 |
$amount=Koha::Number::Price->new( $amount )->unformat(); |
117 |
$amount = Koha::Number::Price->new($amount)->unformat(); |
108 |
my $note = $input->param('note'); |
118 |
my $note = $input->param('note'); |
109 |
my $debit_type = $input->param('type'); |
119 |
my $debit_type = $input->param('type'); |
|
|
120 |
|
110 |
|
121 |
|
111 |
# If barcode is passed, attempt to find the associated item |
122 |
# If barcode is passed, attempt to find the associated item |
112 |
my $failed; |
123 |
my $failed; |
Lines 164-170
if ($add) {
Link Here
|
164 |
library_id => $library_id, |
175 |
library_id => $library_id, |
165 |
type => $debit_type, |
176 |
type => $debit_type, |
166 |
( $olditem ? () : ( item_id => $item_id ) ), |
177 |
( $olditem ? () : ( item_id => $item_id ) ), |
167 |
issue_id => $issue_id |
178 |
issue_id => $issue_id, |
168 |
} |
179 |
} |
169 |
); |
180 |
); |
170 |
|
181 |
|
171 |
- |
|
|