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

(-)a/circ/circulation.pl (-5 / +17 lines)
Lines 472-484 if (@$barcodes && $op eq 'cud-checkout') { Link Here
472
            $template_params->{ADDITIONAL_MATERIALS} = $materials;
472
            $template_params->{ADDITIONAL_MATERIALS} = $materials;
473
            $template_params->{itemhomebranch} = $item->homebranch;
473
            $template_params->{itemhomebranch} = $item->homebranch;
474
474
475
            my $patron_session_confirmation = $query->cookie('patronSessionConfirmation') || undef;
476
            my ( $patron_for_session, $session_confirmations ) = split( /:/, $patron_session_confirmation, 2 );
477
            my $patron_match = $borrowernumber == $patron_for_session;
478
            my @conf_keys    = split( /\|/, $session_confirmations );
479
            $template_params->{sessionConfirmationKeys} = ();
480
475
            # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed.
481
            # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed.
476
            foreach my $needsconfirmation_key ( keys %$needsconfirmation ) {
482
            foreach my $needsconfirmation_key ( keys %$needsconfirmation ) {
477
                $template_params->{$needsconfirmation_key} = $needsconfirmation->{$needsconfirmation_key};
478
                $template_params->{getTitleMessageIteminfo} = $biblio->title;
479
                $template_params->{getBarcodeMessageIteminfo} = $item->barcode;
480
                $template_params->{NEEDSCONFIRMATION} = 1;
481
                $confirm_required = 1;
482
                if ( $needsconfirmation_key eq 'BOOKED_TO_ANOTHER' ) {
483
                if ( $needsconfirmation_key eq 'BOOKED_TO_ANOTHER' ) {
483
                    my $rule = Koha::CirculationRules->get_effective_rule(
484
                    my $rule = Koha::CirculationRules->get_effective_rule(
484
                        {
485
                        {
Lines 493-498 if (@$barcodes && $op eq 'cud-checkout') { Link Here
493
                        ->subtract( days => $preparation_period );
494
                        ->subtract( days => $preparation_period );
494
                    $template_params->{reduceddue} = $reduceddue;
495
                    $template_params->{reduceddue} = $reduceddue;
495
                }
496
                }
497
                next
498
                    if $patron_match
499
                    && scalar(@conf_keys) > 0
500
                    && grep( { $needsconfirmation_key eq $_ } @conf_keys );
501
502
                $template_params->{$needsconfirmation_key}    = $needsconfirmation->{$needsconfirmation_key};
503
                $template_params->{getTitleMessageIteminfo}   = $biblio->title;
504
                $template_params->{getBarcodeMessageIteminfo} = $item->barcode;
505
                $template_params->{NEEDSCONFIRMATION}         = 1;
506
                $confirm_required                             = 1;
507
                push( @{ $template_params->{sessionConfirmationKeys} }, $needsconfirmation_key );
496
            }
508
            }
497
        }
509
        }
498
        unless ($confirm_required) {
510
        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 1286-1289 $(document).ready(function() { Link Here
1286
        $("#return-claims-table").DataTable().search("is_unresolved").draw();
1286
        $("#return-claims-table").DataTable().search("is_unresolved").draw();
1287
    });
1287
    });
1288
1288
1289
    $(".confirmation-required-form").on("submit", function (e) {
1290
1291
        var currentCookieValue = Cookies.get("patronSessionConfirmation") || '';
1292
        var currentPatron = currentCookieValue.split(':')[0] || null;
1293
1294
        var rememberForSession = $('#patron_session_confirmation').is(":checked");
1295
        var sessionConfirmations = []
1296
        $('input[name^=session_confirmations]').each(function() {
1297
            sessionConfirmations.push($(this).val());
1298
        });
1299
1300
        if(currentPatron != borrowernumber && !rememberForSession) {
1301
            Cookies.set("patronSessionConfirmation", borrowernumber + ':', { sameSite: 'Lax' });
1302
            return true
1303
        }
1304
1305
        if(currentPatron == borrowernumber && rememberForSession) {
1306
            sessionConfirmations.forEach(function(sessionConfirmation) {
1307
                currentCookieValue += sessionConfirmation + '|';
1308
            })
1309
            Cookies.set("patronSessionConfirmation", currentCookieValue, { sameSite: 'Lax' });
1310
            return true
1311
        }
1312
1313
        if(currentPatron != borrowernumber && rememberForSession) {
1314
            var newCookieValue = borrowernumber + ':';
1315
            sessionConfirmations.forEach(function(sessionConfirmation) {
1316
                newCookieValue += sessionConfirmation + '|';
1317
            })
1318
            Cookies.set("patronSessionConfirmation", newCookieValue, { sameSite: 'Lax' });
1319
            return true
1320
        }
1321
        return true
1322
    });
1289
 });
1323
 });
1290
- 

Return to bug 14787