View | Details | Raw Unified | Return to bug 40445
Collapse All | Expand All

(-)a/Koha/Cash/Register.pm (+9 lines)
Lines 291-296 sub start_cashup { Link Here
291
291
292
    my $expected_amount = abs( $self->outstanding_accountlines->total( { payment_type => [ 'CASH', 'SIP00' ] } ) );
292
    my $expected_amount = abs( $self->outstanding_accountlines->total( { payment_type => [ 'CASH', 'SIP00' ] } ) );
293
293
294
    # Prevent starting a cashup when there are no cash transactions
295
    unless ( $expected_amount > 0 ) {
296
        Koha::Exceptions::Object::BadValue->throw(
297
            error => "Cannot start cashup with zero cash transactions",
298
            type  => 'amount',
299
            value => $expected_amount
300
        );
301
    }
302
294
    # Create the CASHUP_START action using centralized exception handling
303
    # Create the CASHUP_START action using centralized exception handling
295
    my $schema = $self->_result->result_source->schema;
304
    my $schema = $self->_result->result_source->schema;
296
    my $rs     = $schema->safe_do(
305
    my $rs     = $schema->safe_do(
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt (+4 lines)
Lines 56-61 Link Here
56
            <div id="error_message" class="alert alert-warning"> A cashup is already in progress for this register. </div>
56
            <div id="error_message" class="alert alert-warning"> A cashup is already in progress for this register. </div>
57
        [% END %]
57
        [% END %]
58
58
59
        [% IF ( error_cashup_no_transactions ) %]
60
            <div id="error_message" class="alert alert-info"> Cannot start cashup - there are no cash transactions in this register since the last cashup. </div>
61
        [% END %]
62
59
        [% IF ( error_no_cashup_start ) %]
63
        [% IF ( error_no_cashup_start ) %]
60
            <div id="error_message" class="alert alert-warning"> No cashup session has been started. Please start a cashup before attempting to complete it. </div>
64
            <div id="error_message" class="alert alert-warning"> No cashup session has been started. Please start a cashup before attempting to complete it. </div>
61
        [% END %]
65
        [% END %]
(-)a/pos/register.pl (+2 lines)
Lines 117-122 if ( !$registers->count ) { Link Here
117
            if ($@) {
117
            if ($@) {
118
                if ( $@->isa('Koha::Exceptions::Object::DuplicateID') ) {
118
                if ( $@->isa('Koha::Exceptions::Object::DuplicateID') ) {
119
                    $template->param( error_cashup_in_progress => 1 );
119
                    $template->param( error_cashup_in_progress => 1 );
120
                } elsif ( $@->isa('Koha::Exceptions::Object::BadValue') ) {
121
                    $template->param( error_cashup_no_transactions => 1 );
120
                } else {
122
                } else {
121
                    $template->param( error_cashup_start => 1 );
123
                    $template->param( error_cashup_start => 1 );
122
                }
124
                }
(-)a/pos/registers.pl (-1 / +2 lines)
Lines 98-103 if ( $op eq 'cud-cashup_start' ) { Link Here
98
            if ($@) {
98
            if ($@) {
99
                if ( $@->isa('Koha::Exceptions::Object::DuplicateID') ) {
99
                if ( $@->isa('Koha::Exceptions::Object::DuplicateID') ) {
100
                    push @errors, "Register " . $register->name . ": Cashup already in progress";
100
                    push @errors, "Register " . $register->name . ": Cashup already in progress";
101
                } elsif ( $@->isa('Koha::Exceptions::Object::BadValue') ) {
102
                    push @errors, "Register " . $register->name . ": No cash transactions to cashup";
101
                } else {
103
                } else {
102
                    push @errors, "Register " . $register->name . ": Failed to start cashup";
104
                    push @errors, "Register " . $register->name . ": Failed to start cashup";
103
                }
105
                }
104
- 

Return to bug 40445