Bug 29385: Catch register_id for payments against fees
This patch refactors the pay method in SIP FeePayment such that we consistently pass parameters to both invocations of Koha::Account->pay. It ensure the missing cash_register definition is passed when a set of account lines to pay is defined. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> (cherry picked from commite8b1bc8850) Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> (cherry picked from commitbbb22c061a) Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
This commit is contained in:
parent
97a59bd8d3
commit
960f317462
|
|
@ -59,22 +59,18 @@ sub pay {
|
|||
return { ok => 0 } if $account->balance < $amt;
|
||||
}
|
||||
|
||||
my $pay_options = {
|
||||
amount => $amt,
|
||||
type => $type,
|
||||
payment_type => 'SIP' . $sip_type,
|
||||
interface => C4::Context->interface,
|
||||
cash_register => $register_id,
|
||||
};
|
||||
|
||||
if ($fee_id) {
|
||||
my $fee = Koha::Account::Lines->find($fee_id);
|
||||
if ( $fee ) {
|
||||
my $pay_response = $account->pay(
|
||||
{
|
||||
amount => $amt,
|
||||
type => $type,
|
||||
payment_type => 'SIP' . $sip_type,
|
||||
lines => [$fee],
|
||||
interface => C4::Context->interface
|
||||
}
|
||||
);
|
||||
return {
|
||||
ok => 1,
|
||||
pay_response => $pay_response
|
||||
};
|
||||
$pay_options->{lines} = [$fee];
|
||||
}
|
||||
else {
|
||||
return {
|
||||
|
|
@ -82,21 +78,11 @@ sub pay {
|
|||
};
|
||||
}
|
||||
}
|
||||
else {
|
||||
my $pay_response = $account->pay(
|
||||
{
|
||||
amount => $amt,
|
||||
type => $type,
|
||||
payment_type => 'SIP' . $sip_type,
|
||||
interface => C4::Context->interface,
|
||||
cash_register => $register_id
|
||||
}
|
||||
);
|
||||
return {
|
||||
ok => 1,
|
||||
pay_response => $pay_response
|
||||
};
|
||||
}
|
||||
my $pay_response = $account->pay($pay_options);
|
||||
return {
|
||||
ok => 1,
|
||||
pay_response => $pay_response
|
||||
};
|
||||
}
|
||||
|
||||
#sub DESTROY {
|
||||
|
|
|
|||
Loading…
Reference in New Issue