From 9d8be887d08f523171faa30b35ff86798c4b0115 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 24 Jun 2022 09:20:52 +0100 Subject: [PATCH] Bug 31036: Treat SIP00 that same as CASH SIP00 is the code for CASH transactions that have taken place on a SIP client. Cash management treats CASH type transactions as a special case for banking and register requirements. This patch brings SIP00 in line with the CASH handling code of cash management. Test plan 1) Enable cash management with 'EnablePointOfSale' 2) Enable cash registers with 'UseCashRegisters' 3) Add a cash register via 'Administration > Cash registers' 4) Make some payments against the ash register in the staff client 5) Attempt to make a payment via a SIP client without having associated a cash register to the SIP account config 5a) This should now fail 6) Attach the cash register to the SIP account used above 6a) Payment should now work again on SIP transactions 7) Look at the cash register details page for the cash register 7a) 'Bankale' should now include cash from both SIP and Staff client sales Signed-off-by: Martin Renvoize Signed-off-by: Sally Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- Koha/Account.pm | 8 ++++---- Koha/Account/Line.pm | 2 +- koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt | 8 ++++---- koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Koha/Account.pm b/Koha/Account.pm index c7cf9e58db..ad5d5c6040 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -209,7 +209,7 @@ sub add_credit { Koha::Exceptions::Account::RegisterRequired->throw() if ( C4::Context->preference("UseCashRegisters") && defined($payment_type) - && ( $payment_type eq 'CASH' ) + && ( $payment_type eq 'CASH' || $payment_type eq 'SIP00' ) && !defined($cash_register) ); my $line; @@ -338,7 +338,7 @@ sub payin_amount { Koha::Exceptions::Account::RegisterRequired->throw() if ( C4::Context->preference("UseCashRegisters") && defined( $params->{payment_type} ) - && ( $params->{payment_type} eq 'CASH' ) + && ( $params->{payment_type} eq 'CASH' || $params->{payment_type} eq 'SIP00' ) && !defined($params->{cash_register}) ); # amount should always be passed as a positive value @@ -436,7 +436,7 @@ sub add_debit { Koha::Exceptions::Account::RegisterRequired->throw() if ( C4::Context->preference("UseCashRegisters") && defined( $params->{transaction_type} ) - && ( $params->{transaction_type} eq 'CASH' ) + && ( $params->{transaction_type} eq 'CASH' || $params->{payment_type} eq 'SIP00' ) && !defined( $params->{cash_register} ) ); # amount should always be a positive value @@ -570,7 +570,7 @@ sub payout_amount { # Check for mandatory register Koha::Exceptions::Account::RegisterRequired->throw() if ( C4::Context->preference("UseCashRegisters") - && ( $params->{payout_type} eq 'CASH' ) + && ( $params->{payout_type} eq 'CASH' || $params->{payout_type} eq 'SIP00' ) && !defined($params->{cash_register}) ); # Amount should always be passed as a positive value diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index af93725d60..ceb73e7c3e 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -758,7 +758,7 @@ sub payout { Koha::Exceptions::Account::RegisterRequired->throw() if ( C4::Context->preference("UseCashRegisters") && defined( $params->{payout_type} ) - && ( $params->{payout_type} eq 'CASH' ) + && ( $params->{payout_type} eq 'CASH' || $params->{payout_type} eq 'SIP00' ) && !defined( $params->{cash_register} ) ); my $payout; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt index 59b561e1ce..a6fa3d6e38 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt @@ -76,9 +76,9 @@
  • Last cashup: [% register.last_cashup.timestamp | $KohaDates with_hours => 1 %] (Summary)
  • [% END %]
  • Float: [% register.starting_float | $Price %]
  • -
  • Total income (cash): [% accountlines.credits_total * -1 | $Price %] ([% accountlines.credits_total(payment_type => 'CASH') * -1 | $Price %])
  • -
  • Total outgoing (cash): [% accountlines.debits_total * -1 | $Price %] ([% accountlines.debits_total( payment_type => 'CASH') * -1 | $Price %])
  • -
  • Total bankable: [% accountlines.total( payment_type => 'CASH') * -1 | $Price %]
  • +
  • Total income (cash): [% accountlines.credits_total * -1 | $Price %] ([% accountlines.credits_total(payment_type => [ 'CASH', 'SIP00' ]) * -1 | $Price %])
  • +
  • Total outgoing (cash): [% accountlines.debits_total * -1 | $Price %] ([% accountlines.debits_total( payment_type => [ 'CASH', 'SIP00' ]) * -1 | $Price %])
  • +
  • Total bankable: [% accountlines.total( payment_type => [ 'CASH', 'SIP00' ]) * -1 | $Price %]
  • [% IF register.last_cashup %] @@ -278,7 +278,7 @@