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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt (-15 / +22 lines)
Lines 366-388 Link Here
366
366
367
<!-- Confirm cashup modal -->
367
<!-- Confirm cashup modal -->
368
<div class="modal" id="confirmCashupModal" tabindex="-1" role="dialog" aria-labelledby="confirmCashupLabel">
368
<div class="modal" id="confirmCashupModal" tabindex="-1" role="dialog" aria-labelledby="confirmCashupLabel">
369
    <div class="modal-dialog">
369
    <form id="cashup_form" method="post" enctype="multipart/form-data">
370
        <div class="modal-content">
370
        [% INCLUDE 'csrf-token.inc' %]
371
            <div class="modal-header">
371
        <div class="modal-dialog">
372
                <h1 class="modal-title" id="confirmCashupLabel">Confirm cashup of <em>[% register.description | html %]</em></h1>
372
            <div class="modal-content">
373
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
373
                <div class="modal-header">
374
            </div>
374
                    <h1 class="modal-title" id="confirmCashupLabel">Confirm cashup of <em>[% register.description | html %]</em></h1>
375
            <div class="modal-body"> Please confirm that you have removed [% accountlines.total( payment_type => [ 'CASH', 'SIP00' ]) * -1 | $Price %] from the cash register and left a float of [% register.starting_float | $Price %]. </div>
375
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
376
            <!-- /.modal-body -->
376
                </div>
377
            <div class="modal-footer">
377
                <div class="modal-body">
378
                <a href="/cgi-bin/koha/pos/register.pl?op=cashup" class="btn btn-primary" id="pos_cashup_confirm">Confirm</a>
378
                    Please confirm that you have removed [% accountlines.total( payment_type => [ 'CASH', 'SIP00' ]) * -1 | $Price %] from the cash register and left a float of [% register.starting_float | $Price %].
379
                <button type="button" class="btn btn-default" data-bs-dismiss="modal">Cancel</button>
379
                </div>
380
                <!-- /.modal-body -->
381
                <div class="modal-footer">
382
                    <input type="hidden" name="registerid" value="[% register.id | html %]" />
383
                    <input type="hidden" name="op" value="cud-cashup" />
384
                    <button type="submit" class="btn btn-primary" id="pos_cashup_confirm">Confirm</button>
385
                    <button type="button" class="btn btn-default" data-bs-dismiss="modal">Cancel</button>
386
                </div>
387
                <!-- /.modal-footer -->
380
            </div>
388
            </div>
381
            <!-- /.modal-footer -->
389
            <!-- /.modal-content -->
382
        </div>
390
        </div>
383
        <!-- /.modal-content -->
391
        <!-- /.modal-dialog -->
384
    </div>
392
    </form>
385
    <!-- /.modal-dialog -->
386
</div>
393
</div>
387
<!-- /#confirmCashupModal -->
394
<!-- /#confirmCashupModal -->
388
395
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt (-39 / +48 lines)
Lines 149-201 Link Here
149
149
150
<!-- Confirm cashup modal -->
150
<!-- Confirm cashup modal -->
151
<div class="modal" id="confirmCashupModal" tabindex="-1" role="dialog" aria-labelledby="confirmCashupLabel">
151
<div class="modal" id="confirmCashupModal" tabindex="-1" role="dialog" aria-labelledby="confirmCashupLabel">
152
    <div class="modal-dialog">
152
    <form id="cashup_individual_form" method="post" enctype="multipart/form-data">
153
        <div class="modal-content">
153
        [% INCLUDE 'csrf-token.inc' %]
154
            <div class="modal-header">
154
        <div class="modal-dialog">
155
                <h1 class="modal-title" id="confirmCashupLabel"
155
            <div class="modal-content">
156
                    >Confirm cashup of <em><span id="registerc"></span></em
156
                <div class="modal-header">
157
                ></h1>
157
                    <h1 class="modal-title" id="confirmCashupLabel"
158
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
158
                        >Confirm cashup of <em><span id="registerc"></span></em
159
                    ></h1>
160
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
161
                </div>
162
                <div class="modal-body"> Please confirm that you have removed <span id="cashc"></span> from the cash register and left a float of <span id="floatc"></span>. </div>
163
                <!-- /.modal-body -->
164
                <div class="modal-footer">
165
                    <input type="hidden" name="registerid" id="cashup_registerid" value="" />
166
                    <input type="hidden" name="op" value="cud-cashup" />
167
                    <button type="submit" class="btn btn-primary" id="cashup_confirm">Confirm</button>
168
                    <button type="button" class="btn btn-default" data-bs-dismiss="modal">Cancel</button>
169
                </div>
170
                <!-- /.modal-footer -->
159
            </div>
171
            </div>
160
            <div class="modal-body"> Please confirm that you have removed <span id="cashc"></span> from the cash register and left a float of <span id="floatc"></span>. </div>
172
            <!-- /.modal-content -->
161
            <!-- /.modal-body -->
162
            <div class="modal-footer">
163
                <a id="cashup_confirm" href="" class="btn btn-primary">Confirm</a>
164
                <button type="button" class="btn btn-default" data-bs-dismiss="modal">Cancel</button>
165
            </div>
166
            <!-- /.modal-footer -->
167
        </div>
173
        </div>
168
        <!-- /.modal-content -->
174
        <!-- /.modal-dialog -->
169
    </div>
175
    </form>
170
    <!-- /.modal-dialog -->
171
</div>
176
</div>
172
<!-- /#confirmCashupModal -->
177
<!-- /#confirmCashupModal -->
173
178
174
<!-- Confirm cashupall modal -->
179
<!-- Confirm cashupall modal -->
175
<div class="modal" id="confirmCashupAllModal" tabindex="-1" role="dialog" aria-labelledby="confirmCashupAllLabel">
180
<div class="modal" id="confirmCashupAllModal" tabindex="-1" role="dialog" aria-labelledby="confirmCashupAllLabel">
176
    <div class="modal-dialog">
181
    <form id="cashup_all_form" method="post" enctype="multipart/form-data">
177
        <div class="modal-content">
182
        [% INCLUDE 'csrf-token.inc' %]
178
            <div class="modal-header">
183
        <div class="modal-dialog">
179
                <h1 class="modal-title" id="confirmCashupAllLabel">Confirm cashup of <em>all</em> cash registers</h1>
184
            <div class="modal-content">
180
                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
185
                <div class="modal-header">
181
            </div>
186
                    <h1 class="modal-title" id="confirmCashupAllLabel">Confirm cashup of <em>all</em> cash registers</h1>
182
            <div class="modal-body">
187
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
183
                <p>Please confirm that you have received [% bankable | $Price %] to cashup.</p>
188
                </div>
184
                <ul>
189
                <div class="modal-body">
185
                    <li>Total income (cash): [% ctotal | $Price %] ([% cctotal | $Price %])</li>
190
                    <p>Please confirm that you have received [% bankable | $Price %] to cashup.</p>
186
                    <li>Total outgoing (cash): [% dtotal | $Price %] ([% cdtotal | $Price %])</li>
191
                    <ul>
187
                </ul>
192
                        <li>Total income (cash): [% ctotal | $Price %] ([% cctotal | $Price %])</li>
188
            </div>
193
                        <li>Total outgoing (cash): [% dtotal | $Price %] ([% cdtotal | $Price %])</li>
189
            <!-- /.modal-body -->
194
                    </ul>
190
            <div class="modal-footer">
195
                </div>
191
                <a id="cashup_all_confirm" href="/cgi-bin/koha/pos/registers.pl?op=cashup" class="btn btn-primary">Confirm</a>
196
                <!-- /.modal-body -->
192
                <button type="button" class="btn btn-default" data-bs-dismiss="modal">Cancel</button>
197
                <div class="modal-footer">
198
                    <input type="hidden" name="op" value="cud-cashup" />
199
                    <button type="submit" class="btn btn-primary" id="cashup_all_confirm">Confirm</button>
200
                    <button type="button" class="btn btn-default" data-bs-dismiss="modal">Cancel</button>
201
                </div>
202
                <!-- /.modal-footer -->
193
            </div>
203
            </div>
194
            <!-- /.modal-footer -->
204
            <!-- /.modal-content -->
195
        </div>
205
        </div>
196
        <!-- /.modal-content -->
206
        <!-- /.modal-dialog -->
197
    </div>
207
    </form>
198
    <!-- /.modal-dialog -->
199
</div>
208
</div>
200
<!-- /#confirmCashupAllModal -->
209
<!-- /#confirmCashupAllModal -->
201
210
Lines 229-235 Link Here
229
               var rfloat = button.data('float');
238
               var rfloat = button.data('float');
230
               $('#floatc').text(rfloat);
239
               $('#floatc').text(rfloat);
231
               var rid = button.data('registerid');
240
               var rid = button.data('registerid');
232
               $('#cashup_confirm').attr("href", '/cgi-bin/koha/pos/registers.pl?op=cashup&registerid='+rid);
241
               $('#cashup_registerid').val(rid);
233
            });
242
            });
234
        });
243
        });
235
    </script>
244
    </script>
(-)a/pos/register.pl (-1 / +5 lines)
Lines 102-108 if ( !$registers->count ) { Link Here
102
    $template->param( trange_t => $end, );
102
    $template->param( trange_t => $end, );
103
103
104
    my $op = $input->param('op') // '';
104
    my $op = $input->param('op') // '';
105
    if ( $op eq 'cashup' ) {
105
    if ( $op eq 'cud-cashup' ) {
106
        if ( $logged_in_user->has_permission( { cash_management => 'cashup' } ) ) {
106
        if ( $logged_in_user->has_permission( { cash_management => 'cashup' } ) ) {
107
            $cash_register->add_cashup(
107
            $cash_register->add_cashup(
108
                {
108
                {
Lines 110-115 if ( !$registers->count ) { Link Here
110
                    amount     => $cash_register->outstanding_accountlines->total
110
                    amount     => $cash_register->outstanding_accountlines->total
111
                }
111
                }
112
            );
112
            );
113
114
            # Redirect to prevent duplicate submissions (POST/REDIRECT/GET pattern)
115
            print $input->redirect( "/cgi-bin/koha/pos/register.pl?registerid=" . $registerid );
116
            exit;
113
        } else {
117
        } else {
114
            $template->param( error_cashup_permission => 1 );
118
            $template->param( error_cashup_permission => 1 );
115
        }
119
        }
(-)a/pos/registers.pl (-2 / +5 lines)
Lines 54-60 if ( !$registers->count ) { Link Here
54
}
54
}
55
55
56
my $op = $input->param('op') // '';
56
my $op = $input->param('op') // '';
57
if ( $op eq '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
        if ($registerid) {
60
        if ($registerid) {
Lines 75-80 if ( $op eq 'cashup' ) { Link Here
75
                );
75
                );
76
            }
76
            }
77
        }
77
        }
78
79
        # Redirect to prevent duplicate submissions (POST/REDIRECT/GET pattern)
80
        print $input->redirect("/cgi-bin/koha/pos/registers.pl");
81
        exit;
78
    } else {
82
    } else {
79
        $template->param( error_cashup_permission => 1 );
83
        $template->param( error_cashup_permission => 1 );
80
    }
84
    }
81
- 

Return to bug 40625