From 24321a98640f097d3f44e1e5231047ff51763e97 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 8 Aug 2025 13:17:50 +0100 Subject: [PATCH] Bug 40445: Add CASHUP_SURPLUS and CASHUP_DEFICIT account types This patch adds two new system account types to support cashup reconciliation: - CASHUP_SURPLUS (credit type): Used when actual cash found exceeds expected amount - CASHUP_DEFICIT (debit type): Used when actual cash found is less than expected amount Both types are system-managed and cannot be manually added by staff. They will be automatically created during cashup processes when discrepancies are detected. Changes include: - Atomicupdate script for existing installations - Mandatory YAML files for fresh installations --- .../data/mysql/atomicupdate/bug_40445.pl | 37 +++++++++++++++++++ .../en/mandatory/account_credit_types.yml | 6 +++ .../en/mandatory/account_debit_types.yml | 8 ++++ 3 files changed, 51 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_40445.pl diff --git a/installer/data/mysql/atomicupdate/bug_40445.pl b/installer/data/mysql/atomicupdate/bug_40445.pl new file mode 100755 index 00000000000..f6226eb4512 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_40445.pl @@ -0,0 +1,37 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "40445", + description => "Add cashup reconciliation support with surplus/deficit tracking", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + # Add CASHUP_SURPLUS credit type + $dbh->do( + q{ + INSERT IGNORE INTO account_credit_types + (code, description, can_be_added_manually, credit_number_enabled, is_system, archived) + VALUES ('CASHUP_SURPLUS', 'Cash register surplus found during cashup', 0, 0, 1, 0) + } + ); + + # Add CASHUP_DEFICIT debit type + $dbh->do( + q{ + INSERT IGNORE INTO account_debit_types + (code, description, can_be_invoiced, can_be_sold, default_amount, is_system, archived, restricts_checkouts) + VALUES ('CASHUP_DEFICIT', 'Cash register deficit found during cashup', 0, 0, NULL, 1, 0, 0) + } + ); + + say $out "Added new account credit type 'CASHUP_SURPLUS'"; + say $out "Added new account debit type 'CASHUP_DEFICIT'"; + say_success( $out, "Cashup reconciliation account types created successfully" ); + say_info( + $out, + "Staff can now record actual cash amounts during cashup with automatic surplus/deficit tracking" + ); + }, +}; diff --git a/installer/data/mysql/en/mandatory/account_credit_types.yml b/installer/data/mysql/en/mandatory/account_credit_types.yml index f73ef651765..d98475aeafd 100644 --- a/installer/data/mysql/en/mandatory/account_credit_types.yml +++ b/installer/data/mysql/en/mandatory/account_credit_types.yml @@ -79,3 +79,9 @@ tables: description: "Lost item processing fee refund" can_be_added_manually: "0" is_system: "1" + + - code: "CASHUP_SURPLUS" + description: "Cash register surplus found during cashup" + can_be_added_manually: "0" + credit_number_enabled: "0" + is_system: "1" diff --git a/installer/data/mysql/en/mandatory/account_debit_types.yml b/installer/data/mysql/en/mandatory/account_debit_types.yml index e2479faa245..b4d5100dd13 100644 --- a/installer/data/mysql/en/mandatory/account_debit_types.yml +++ b/installer/data/mysql/en/mandatory/account_debit_types.yml @@ -136,3 +136,11 @@ tables: can_be_sold: "0" default_amount: ~ is_system: "1" + + - code: "CASHUP_DEFICIT" + description: "Cash register deficit found during cashup" + can_be_invoiced: "0" + can_be_sold: "0" + default_amount: ~ + is_system: "1" + restricts_checkouts: "0" -- 2.50.1