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

(-)a/circ/circulation.pl (-5 / +17 lines)
Lines 475-487 if (@$barcodes && $op eq 'cud-checkout') { Link Here
475
            $template_params->{ADDITIONAL_MATERIALS} = $materials;
475
            $template_params->{ADDITIONAL_MATERIALS} = $materials;
476
            $template_params->{itemhomebranch} = $item->homebranch;
476
            $template_params->{itemhomebranch} = $item->homebranch;
477
477
478
            my $patron_session_confirmation = $query->cookie('patronSessionConfirmation') || undef;
479
            my ( $patron_for_session, $session_confirmations ) = split( /:/, $patron_session_confirmation, 2 );
480
            my $patron_match = $borrowernumber == $patron_for_session;
481
            my @conf_keys    = split( /\|/, $session_confirmations );
482
            $template_params->{sessionConfirmationKeys} = ();
483
478
            # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed.
484
            # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed.
479
            foreach my $needsconfirmation_key ( keys %$needsconfirmation ) {
485
            foreach my $needsconfirmation_key ( keys %$needsconfirmation ) {
480
                $template_params->{$needsconfirmation_key} = $needsconfirmation->{$needsconfirmation_key};
481
                $template_params->{getTitleMessageIteminfo} = $biblio->title;
482
                $template_params->{getBarcodeMessageIteminfo} = $item->barcode;
483
                $template_params->{NEEDSCONFIRMATION} = 1;
484
                $confirm_required = 1;
485
                if ( $needsconfirmation_key eq 'BOOKED_TO_ANOTHER' ) {
486
                if ( $needsconfirmation_key eq 'BOOKED_TO_ANOTHER' ) {
486
                    my $rule = Koha::CirculationRules->get_effective_rule(
487
                    my $rule = Koha::CirculationRules->get_effective_rule(
487
                        {
488
                        {
Lines 496-501 if (@$barcodes && $op eq 'cud-checkout') { Link Here
496
                        ->subtract( days => $preparation_period );
497
                        ->subtract( days => $preparation_period );
497
                    $template_params->{reduceddue} = $reduceddue;
498
                    $template_params->{reduceddue} = $reduceddue;
498
                }
499
                }
500
                next
501
                    if $patron_match
502
                    && scalar(@conf_keys) > 0
503
                    && grep( { $needsconfirmation_key eq $_ } @conf_keys );
504
505
                $template_params->{$needsconfirmation_key}    = $needsconfirmation->{$needsconfirmation_key};
506
                $template_params->{getTitleMessageIteminfo}   = $biblio->title;
507
                $template_params->{getBarcodeMessageIteminfo} = $item->barcode;
508
                $template_params->{NEEDSCONFIRMATION}         = 1;
509
                $confirm_required                             = 1;
510
                push( @{ $template_params->{sessionConfirmationKeys} }, $needsconfirmation_key );
499
            }
511
            }
500
        }
512
        }
501
        unless ($confirm_required) {
513
        unless ($confirm_required) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt (-2 / +16 lines)
Lines 277-287 Link Here
277
                            </ul>
277
                            </ul>
278
278
279
                            [% IF CAN_user_circulate_force_checkout or HIGHHOLDS %]
279
                            [% IF CAN_user_circulate_force_checkout or HIGHHOLDS %]
280
                                <form method="post" action="/cgi-bin/koha/circ/circulation.pl" autocomplete="off">
280
                                <form method="post" action="/cgi-bin/koha/circ/circulation.pl" autocomplete="off" class="confirmation-required-form">
281
                                    [% INCLUDE 'csrf-token.inc' %]
281
                                    [% INCLUDE 'csrf-token.inc' %]
282
                                    <fieldset>
282
                                    <fieldset>
283
                                    <input type="hidden" name="restoreduedatespec" />
283
                                    <input type="hidden" name="restoreduedatespec" />
284
                                    <input type="hidden" name="op" value="cud-checkout" />
284
                                    <input type="hidden" name="op" value="cud-checkout" />
285
                                    [% FOREACH conf IN sessionConfirmationKeys %]
286
                                        <input type="hidden" name="session_confirmations" id="session_confirmations" value="[% conf | html %]" />
287
                                    [% END %]
285
288
286
                                    [% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
289
                                    [% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
287
290
Lines 376-381 Link Here
376
                                    [% IF ( RENEW_ISSUE ) %]
379
                                    [% IF ( RENEW_ISSUE ) %]
377
                                        <button type="submit" class="btn btn-default approve" accesskey="y"><i class="fa fa-check"></i> Yes, renew (Y)</button>
380
                                        <button type="submit" class="btn btn-default approve" accesskey="y"><i class="fa fa-check"></i> Yes, renew (Y)</button>
378
                                    [% ELSE %]
381
                                    [% ELSE %]
382
                                        <p>
383
                                            <label for="patron_session_confirmation">Remember for the session for this patron</label>
384
                                            <input type="checkbox" id="patron_session_confirmation" name="patron_session_confirmation" />
385
                                        </p>
379
                                        <button type="submit" class="btn btn-default approve" accesskey="y"><i class="fa fa-check"></i> Yes, check out (Y)</button>
386
                                        <button type="submit" class="btn btn-default approve" accesskey="y"><i class="fa fa-check"></i> Yes, check out (Y)</button>
380
                                    [% END %]
387
                                    [% END %]
381
388
Lines 386-395 Link Here
386
                            [% END # /IF CAN_user_circulate_force_checkout or HIGHHOLDS %]
393
                            [% END # /IF CAN_user_circulate_force_checkout or HIGHHOLDS %]
387
394
388
                            [% IF ADDITIONAL_MATERIALS && !CAN_user_circulate_force_checkout %]
395
                            [% IF ADDITIONAL_MATERIALS && !CAN_user_circulate_force_checkout %]
389
                                <form method="post" action="/cgi-bin/koha/circ/circulation.pl" autocomplete="off">
396
                                <form method="post" action="/cgi-bin/koha/circ/circulation.pl" autocomplete="off" class="confirmation-required-form">
390
                                    [% INCLUDE 'csrf-token.inc' %]
397
                                    [% INCLUDE 'csrf-token.inc' %]
391
                                    <input type="hidden" name="op" value="cud-checkout" />
398
                                    <input type="hidden" name="op" value="cud-checkout" />
392
                                    <input type="hidden" name="restoreduedatespec" />
399
                                    <input type="hidden" name="restoreduedatespec" />
400
                                    [% FOREACH conf IN sessionConfirmationKeys %]
401
                                        <input type="hidden" name="session_confirmations" id="session_confirmations" value="[% conf | html %]" />
402
                                    [% END %]
393
403
394
                                    [% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
404
                                    [% IF (forceallow) %]<input type="hidden" name="forceallow" value="1">[% END %]
395
405
Lines 403-408 Link Here
403
                                    [% IF ( RENEW_ISSUE ) %]
413
                                    [% IF ( RENEW_ISSUE ) %]
404
                                        <button type="submit" class="btn btn-default approve" accesskey="y"><i class="fa fa-check"></i> Yes, renew (Y)</button>
414
                                        <button type="submit" class="btn btn-default approve" accesskey="y"><i class="fa fa-check"></i> Yes, renew (Y)</button>
405
                                    [% ELSE %]
415
                                    [% ELSE %]
416
                                        <p>
417
                                            <label for="patron_session_confirmation">Remember for the session for this patron</label>
418
                                            <input type="checkbox" id="patron_session_confirmation" name="patron_session_confirmation" />
419
                                        </p>
406
                                        <button type="submit" class="btn btn-default approve" accesskey="y"><i class="fa fa-check"></i> Yes, check out (Y)</button>
420
                                        <button type="submit" class="btn btn-default approve" accesskey="y"><i class="fa fa-check"></i> Yes, check out (Y)</button>
407
                                    [% END %]
421
                                    [% END %]
408
422
(-)a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js (-1 / +34 lines)
Lines 1283-1286 $(document).ready(function() { Link Here
1283
        $("#return-claims-table").DataTable().search("is_unresolved").draw();
1283
        $("#return-claims-table").DataTable().search("is_unresolved").draw();
1284
    });
1284
    });
1285
1285
1286
    $(".confirmation-required-form").on("submit", function (e) {
1287
1288
        var currentCookieValue = Cookies.get("patronSessionConfirmation") || '';
1289
        var currentPatron = currentCookieValue.split(':')[0] || null;
1290
1291
        var rememberForSession = $('#patron_session_confirmation').is(":checked");
1292
        var sessionConfirmations = []
1293
        $('input[name^=session_confirmations]').each(function() {
1294
            sessionConfirmations.push($(this).val());
1295
        });
1296
1297
        if(currentPatron != borrowernumber && !rememberForSession) {
1298
            Cookies.set("patronSessionConfirmation", borrowernumber + ':', { sameSite: 'Lax' });
1299
            return true
1300
        }
1301
1302
        if(currentPatron == borrowernumber && rememberForSession) {
1303
            sessionConfirmations.forEach(function(sessionConfirmation) {
1304
                currentCookieValue += sessionConfirmation + '|';
1305
            })
1306
            Cookies.set("patronSessionConfirmation", currentCookieValue, { sameSite: 'Lax' });
1307
            return true
1308
        }
1309
1310
        if(currentPatron != borrowernumber && rememberForSession) {
1311
            var newCookieValue = borrowernumber + ':';
1312
            sessionConfirmations.forEach(function(sessionConfirmation) {
1313
                newCookieValue += sessionConfirmation + '|';
1314
            })
1315
            Cookies.set("patronSessionConfirmation", newCookieValue, { sameSite: 'Lax' });
1316
            return true
1317
        }
1318
        return true
1319
    });
1286
 });
1320
 });
1287
- 

Return to bug 14787