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

(-)a/circ/circulation.pl (-5 / +17 lines)
Lines 474-491 if (@$barcodes && $op eq 'cud-checkout') { Link Here
474
            $template_params->{ADDITIONAL_MATERIALS} = $materials;
474
            $template_params->{ADDITIONAL_MATERIALS} = $materials;
475
            $template_params->{itemhomebranch} = $item->homebranch;
475
            $template_params->{itemhomebranch} = $item->homebranch;
476
476
477
            my $patron_session_confirmation = $query->cookie('patronSessionConfirmation') || undef;
478
            my ( $patron_for_session, $session_confirmations ) = split( /:/, $patron_session_confirmation, 2 );
479
            my $patron_match = $borrowernumber == $patron_for_session;
480
            my @conf_keys    = split( /\|/, $session_confirmations );
481
            $template_params->{sessionConfirmationKeys} = ();
482
477
            # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed.
483
            # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed.
478
            foreach my $needsconfirmation_key ( keys %$needsconfirmation ) {
484
            foreach my $needsconfirmation_key ( keys %$needsconfirmation ) {
479
                $template_params->{$needsconfirmation_key} = $needsconfirmation->{$needsconfirmation_key};
480
                $template_params->{getTitleMessageIteminfo} = $biblio->title;
481
                $template_params->{getBarcodeMessageIteminfo} = $item->barcode;
482
                $template_params->{NEEDSCONFIRMATION} = 1;
483
                $confirm_required = 1;
484
                if ( $needsconfirmation_key eq 'BOOKED_TO_ANOTHER' ) {
485
                if ( $needsconfirmation_key eq 'BOOKED_TO_ANOTHER' ) {
485
                    my $reduceddue =
486
                    my $reduceddue =
486
                        dt_from_string( $$needsconfirmation{$needsconfirmation_key}->start_date )->subtract( days => 1 );
487
                        dt_from_string( $$needsconfirmation{$needsconfirmation_key}->start_date )->subtract( days => 1 );
487
                    $template_params->{reduceddue} = $reduceddue;
488
                    $template_params->{reduceddue} = $reduceddue;
488
                }
489
                }
490
                next
491
                    if $patron_match
492
                    && scalar(@conf_keys) > 0
493
                    && grep( { $needsconfirmation_key eq $_ } @conf_keys );
494
495
                $template_params->{$needsconfirmation_key}    = $needsconfirmation->{$needsconfirmation_key};
496
                $template_params->{getTitleMessageIteminfo}   = $biblio->title;
497
                $template_params->{getBarcodeMessageIteminfo} = $item->barcode;
498
                $template_params->{NEEDSCONFIRMATION}         = 1;
499
                $confirm_required                             = 1;
500
                push( @{ $template_params->{sessionConfirmationKeys} }, $needsconfirmation_key );
489
            }
501
            }
490
        }
502
        }
491
        unless ($confirm_required) {
503
        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="approve" accesskey="y"><i class="fa fa-check"></i> Yes, renew (Y)</button>
380
                                        <button type="submit" class="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="approve" accesskey="y"><i class="fa fa-check"></i> Yes, check out (Y)</button>
386
                                        <button type="submit" class="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="approve" accesskey="y"><i class="fa fa-check"></i> Yes, renew (Y)</button>
414
                                        <button type="submit" class="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="approve" accesskey="y"><i class="fa fa-check"></i> Yes, check out (Y)</button>
420
                                        <button type="submit" class="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 1276-1279 $(document).ready(function() { Link Here
1276
        $("#return-claims-table").DataTable().search("is_unresolved").draw();
1276
        $("#return-claims-table").DataTable().search("is_unresolved").draw();
1277
    });
1277
    });
1278
1278
1279
    $(".confirmation-required-form").on("submit", function (e) {
1280
1281
        var currentCookieValue = Cookies.get("patronSessionConfirmation") || '';
1282
        var currentPatron = currentCookieValue.split(':')[0] || null;
1283
1284
        var rememberForSession = $('#patron_session_confirmation').is(":checked");
1285
        var sessionConfirmations = []
1286
        $('input[name^=session_confirmations]').each(function() {
1287
            sessionConfirmations.push($(this).val());
1288
        });
1289
1290
        if(currentPatron != borrowernumber && !rememberForSession) {
1291
            Cookies.set("patronSessionConfirmation", borrowernumber + ':', { sameSite: 'Lax' });
1292
            return true
1293
        }
1294
1295
        if(currentPatron == borrowernumber && rememberForSession) {
1296
            sessionConfirmations.forEach(function(sessionConfirmation) {
1297
                currentCookieValue += sessionConfirmation + '|';
1298
            })
1299
            Cookies.set("patronSessionConfirmation", currentCookieValue, { sameSite: 'Lax' });
1300
            return true
1301
        }
1302
1303
        if(currentPatron != borrowernumber && rememberForSession) {
1304
            var newCookieValue = borrowernumber + ':';
1305
            sessionConfirmations.forEach(function(sessionConfirmation) {
1306
                newCookieValue += sessionConfirmation + '|';
1307
            })
1308
            Cookies.set("patronSessionConfirmation", newCookieValue, { sameSite: 'Lax' });
1309
            return true
1310
        }
1311
        return true
1312
    });
1279
 });
1313
 });
1280
- 

Return to bug 14787