Lines 70-84
Koha::Account->new( { patron_id => $borrowernumber } )->pay(
Link Here
|
70 |
sub pay { |
70 |
sub pay { |
71 |
my ( $self, $params ) = @_; |
71 |
my ( $self, $params ) = @_; |
72 |
|
72 |
|
73 |
my $amount = $params->{amount}; |
73 |
my $amount = $params->{amount}; |
74 |
my $description = $params->{description}; |
74 |
my $description = $params->{description}; |
75 |
my $note = $params->{note} || q{}; |
75 |
my $note = $params->{note} || q{}; |
76 |
my $library_id = $params->{library_id}; |
76 |
my $library_id = $params->{library_id}; |
77 |
my $lines = $params->{lines}; |
77 |
my $lines = $params->{lines}; |
78 |
my $type = $params->{type} || 'payment'; |
78 |
my $type = $params->{type} || 'payment'; |
79 |
my $payment_type = $params->{payment_type} || undef; |
79 |
my $payment_type = $params->{payment_type} || undef; |
80 |
my $account_type = $params->{account_type}; |
80 |
my $account_type = $params->{account_type}; |
81 |
my $offset_type = $params->{offset_type} || $type eq 'writeoff' ? 'Writeoff' : 'Payment'; |
81 |
my $offset_type = $params->{offset_type} || $type eq 'writeoff' ? 'Writeoff' : 'Payment'; |
|
|
82 |
my $cash_register = $params->{cash_register}; |
82 |
|
83 |
|
83 |
my $userenv = C4::Context->userenv; |
84 |
my $userenv = C4::Context->userenv; |
84 |
|
85 |
|
Lines 86-91
sub pay {
Link Here
|
86 |
|
87 |
|
87 |
my $manager_id = $userenv ? $userenv->{number} : 0; |
88 |
my $manager_id = $userenv ? $userenv->{number} : 0; |
88 |
my $interface = $params ? ( $params->{interface} || C4::Context->interface ) : C4::Context->interface; |
89 |
my $interface = $params ? ( $params->{interface} || C4::Context->interface ) : C4::Context->interface; |
|
|
90 |
Koha::Exceptions::Account::RegisterRequired->throw() |
91 |
if ( C4::Context->preference("UseCashRegisters") |
92 |
&& !defined($cash_register) |
93 |
&& ( $interface ne 'opac' ) ); |
89 |
|
94 |
|
90 |
my @fines_paid; # List of account lines paid on with this payment |
95 |
my @fines_paid; # List of account lines paid on with this payment |
91 |
|
96 |
|
Lines 227-232
sub pay {
Link Here
|
227 |
manager_id => $manager_id, |
232 |
manager_id => $manager_id, |
228 |
interface => $interface, |
233 |
interface => $interface, |
229 |
branchcode => $library_id, |
234 |
branchcode => $library_id, |
|
|
235 |
register_id => $cash_register, |
230 |
note => $note, |
236 |
note => $note, |
231 |
} |
237 |
} |
232 |
)->store(); |
238 |
)->store(); |
Lines 327-341
sub add_credit {
Link Here
|
327 |
my ( $self, $params ) = @_; |
333 |
my ( $self, $params ) = @_; |
328 |
|
334 |
|
329 |
# amount is passed as a positive value, but we store credit as negative values |
335 |
# amount is passed as a positive value, but we store credit as negative values |
330 |
my $amount = $params->{amount} * -1; |
336 |
my $amount = $params->{amount} * -1; |
331 |
my $description = $params->{description} // q{}; |
337 |
my $description = $params->{description} // q{}; |
332 |
my $note = $params->{note} // q{}; |
338 |
my $note = $params->{note} // q{}; |
333 |
my $user_id = $params->{user_id}; |
339 |
my $user_id = $params->{user_id}; |
334 |
my $interface = $params->{interface}; |
340 |
my $interface = $params->{interface}; |
335 |
my $library_id = $params->{library_id}; |
341 |
my $library_id = $params->{library_id}; |
336 |
my $payment_type = $params->{payment_type}; |
342 |
my $cash_register = $params->{cash_register}; |
337 |
my $type = $params->{type} || 'payment'; |
343 |
my $payment_type = $params->{payment_type}; |
338 |
my $item_id = $params->{item_id}; |
344 |
my $type = $params->{type} || 'payment'; |
|
|
345 |
my $item_id = $params->{item_id}; |
339 |
|
346 |
|
340 |
unless ( $interface ) { |
347 |
unless ( $interface ) { |
341 |
Koha::Exceptions::MissingParameter->throw( |
348 |
Koha::Exceptions::MissingParameter->throw( |
Lines 343-348
sub add_credit {
Link Here
|
343 |
); |
350 |
); |
344 |
} |
351 |
} |
345 |
|
352 |
|
|
|
353 |
Koha::Exceptions::Account::RegisterRequired->throw() |
354 |
if ( C4::Context->preference("UseCashRegisters") |
355 |
&& !defined($cash_register) |
356 |
&& ( $payment_type eq 'CASH' ) ); |
357 |
|
346 |
my $schema = Koha::Database->new->schema; |
358 |
my $schema = Koha::Database->new->schema; |
347 |
|
359 |
|
348 |
my $account_type = $Koha::Account::account_type_credit->{$type}; |
360 |
my $account_type = $Koha::Account::account_type_credit->{$type}; |
Lines 364-369
sub add_credit {
Link Here
|
364 |
manager_id => $user_id, |
376 |
manager_id => $user_id, |
365 |
interface => $interface, |
377 |
interface => $interface, |
366 |
branchcode => $library_id, |
378 |
branchcode => $library_id, |
|
|
379 |
register_id => $cash_register, |
367 |
itemnumber => $item_id, |
380 |
itemnumber => $item_id, |
368 |
} |
381 |
} |
369 |
)->store(); |
382 |
)->store(); |