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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt (-5 / +10 lines)
Lines 575-586 Link Here
575
        }, null, 1);
575
        }, null, 1);
576
576
577
        $(document).ready(function() {
577
        $(document).ready(function() {
578
            [% IF cashup_id %]
578
            // Check for cashup hash in URL
579
            let $button = $('[data-cashup="[% cashup_id | html %]"]');
579
            let hash = window.location.hash;
580
            if ($button.length) {
580
            if (hash && hash.startsWith('#cashup-')) {
581
                $button[0].click();
581
                let cashup_id = hash.substring(8); // Remove '#cashup-' prefix
582
                let $button = $('[data-cashup="' + cashup_id + '"]');
583
                if ($button.length) {
584
                    $button[0].click();
585
                    // Clean up URL without page reload
586
                    history.replaceState(null, null, window.location.pathname + window.location.search);
587
                }
582
            }
588
            }
583
            [% END %]
584
        });
589
        });
585
    </script>
590
    </script>
586
[% END %]
591
[% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt (-5 / +10 lines)
Lines 241-252 Link Here
241
               $('#cashup_registerid').val(rid);
241
               $('#cashup_registerid').val(rid);
242
            });
242
            });
243
243
244
            [% IF cashup_id %]
244
            // Check for cashup hash in URL
245
            let $button = $('[data-cashup="[% cashup_id | html %]"]');
245
            let hash = window.location.hash;
246
            if ($button.length) {
246
            if (hash && hash.startsWith('#cashup-')) {
247
                $button[0].click();
247
                let cashup_id = hash.substring(8); // Remove '#cashup-' prefix
248
                let $button = $('[data-cashup="' + cashup_id + '"]');
249
                if ($button.length) {
250
                    $button[0].click();
251
                    // Clean up URL without page reload
252
                    history.replaceState(null, null, window.location.pathname + window.location.search);
253
                }
248
            }
254
            }
249
            [% END %]
250
        });
255
        });
251
    </script>
256
    </script>
252
[% END %]
257
[% END %]
(-)a/pos/register.pl (-1 / +2 lines)
Lines 112-118 if ( !$registers->count ) { Link Here
112
            );
112
            );
113
113
114
            # Redirect to prevent duplicate submissions (POST/REDIRECT/GET pattern)
114
            # Redirect to prevent duplicate submissions (POST/REDIRECT/GET pattern)
115
            print $input->redirect( "/cgi-bin/koha/pos/register.pl?registerid=" . $registerid  . "&cashup_id=" . $cashup->id );
115
            print $input->redirect(
116
                "/cgi-bin/koha/pos/register.pl?registerid=" . $registerid . "#cashup-" . $cashup->id );
116
            exit;
117
            exit;
117
        } else {
118
        } else {
118
            $template->param( error_cashup_permission => 1 );
119
            $template->param( error_cashup_permission => 1 );
(-)a/pos/registers.pl (-5 / +5 lines)
Lines 56-71 if ( !$registers->count ) { Link Here
56
my $op = $input->param('op') // '';
56
my $op = $input->param('op') // '';
57
if ( $op eq 'cud-cashup' ) {
57
if ( $op eq 'cud-cashup' ) {
58
    if ( $logged_in_user->has_permission( { cash_management => 'cashup' } ) ) {
58
    if ( $logged_in_user->has_permission( { cash_management => 'cashup' } ) ) {
59
        my $registerid = $input->param('registerid');
59
        my $registerid   = $input->param('registerid');
60
        my $redirect_url = "/cgi-bin/koha/pos/registers.pl";
60
        if ($registerid) {
61
        if ($registerid) {
61
            my $register = Koha::Cash::Registers->find( { id => $registerid } );
62
            my $register = Koha::Cash::Registers->find( { id => $registerid } );
62
            my $cashup = $register->add_cashup(
63
            my $cashup   = $register->add_cashup(
63
                {
64
                {
64
                    manager_id => $logged_in_user->id,
65
                    manager_id => $logged_in_user->id,
65
                    amount     => $register->outstanding_accountlines->total
66
                    amount     => $register->outstanding_accountlines->total
66
                }
67
                }
67
            );
68
            );
68
            $template->param( cashup_id => $cashup->id );
69
            $redirect_url .= "#cashup-" . $cashup->id;
69
        } else {
70
        } else {
70
            for my $register ( $registers->as_list ) {
71
            for my $register ( $registers->as_list ) {
71
                $register->add_cashup(
72
                $register->add_cashup(
Lines 78-84 if ( $op eq 'cud-cashup' ) { Link Here
78
        }
79
        }
79
80
80
        # Redirect to prevent duplicate submissions (POST/REDIRECT/GET pattern)
81
        # Redirect to prevent duplicate submissions (POST/REDIRECT/GET pattern)
81
        print $input->redirect("/cgi-bin/koha/pos/registers.pl");
82
        print $input->redirect($redirect_url);
82
        exit;
83
        exit;
83
    } else {
84
    } else {
84
        $template->param( error_cashup_permission => 1 );
85
        $template->param( error_cashup_permission => 1 );
85
- 

Return to bug 38728