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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt (+19 lines)
Lines 638-643 Link Here
638
                $("#returned, #refund_type").focus();
638
                $("#returned, #refund_type").focus();
639
            });
639
            });
640
640
641
            // Validate cash register requirement for refunds
642
            [% IF Koha.Preference('UseCashRegisters') %]
643
                $("#refund_form").on("submit", function(e) {
644
                    var refund_type = $("#refund_type").val();
645
                    var register = $("#refund_registerid").val();
646
647
                    // Only require register for non-AC refunds with CASH or SIP00 payment types
648
                    if (refund_type && refund_type !== 'AC' && (refund_type === 'CASH' || refund_type.match(/^SIP\d{2}$/))) {
649
                        if (!register || register === '') {
650
                            e.preventDefault();
651
                            alert(_("Cash register is required for cash refunds"));
652
                            $("#refund_registerid").focus();
653
                            return false;
654
                        }
655
                    }
656
                    return true;
657
                });
658
            [% END %]
659
641
            $("#applyDiscountModal").on("shown.bs.modal", function(e){
660
            $("#applyDiscountModal").on("shown.bs.modal", function(e){
642
                var button = $(e.relatedTarget);
661
                var button = $(e.relatedTarget);
643
                var item = button.data('item');
662
                var item = button.data('item');
(-)a/pos/register.pl (-12 / +16 lines)
Lines 138-156 if ( !$registers->count ) { Link Here
138
                            amount         => $amount
138
                            amount         => $amount
139
                        }
139
                        }
140
                    );
140
                    );
141
                    my $payout = $refund->payout(
141
                    unless ( $refund_type eq 'AC' ) {
142
                        {
142
                        my $payout = $refund->payout(
143
                            payout_type   => $refund_type,
143
                            {
144
                            branch        => $library_id,
144
                                payout_type   => $refund_type,
145
                            staff_id      => $logged_in_user->id,
145
                                branch        => $library_id,
146
                            cash_register => $cash_register->id,
146
                                staff_id      => $logged_in_user->id,
147
                            interface     => 'intranet',
147
                                cash_register => $registerid,
148
                            amount        => $amount
148
                                interface     => 'intranet',
149
                        }
149
                                amount        => $amount
150
                    );
150
                            }
151
151
                        );
152
                    }
152
                }
153
                }
153
            );
154
            );
155
156
            # Redirect to prevent duplicate submissions (POST/REDIRECT/GET pattern)
157
            print $input->redirect( "/cgi-bin/koha/pos/register.pl?registerid=" . $registerid );
158
            exit;
154
        } else {
159
        } else {
155
            $template->param( error_refund_permission => 1 );
160
            $template->param( error_refund_permission => 1 );
156
        }
161
        }
157
- 

Return to bug 41585